@sideboard-ai/core 0.1.144 → 0.1.146

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/{agents-OEEOIKUB.js → agents-N3KMRQUZ.js} +4 -4
  2. package/dist/{agents-E5AAMHDY.js → agents-YVETHB2R.js} +4 -4
  3. package/dist/{chunk-CG25RYQQ.js → chunk-4RYRNJPN.js} +3 -3
  4. package/dist/{chunk-OHWN4JEL.js → chunk-67K3FRKR.js} +1 -1
  5. package/dist/{chunk-R2W7A2UO.js → chunk-IHSR7EVK.js} +2 -2
  6. package/dist/{chunk-HC5N3BDL.js → chunk-JHZ6HGRI.js} +2 -2
  7. package/dist/{chunk-4Q45TLZ5.js → chunk-JTPDWTWJ.js} +194 -42
  8. package/dist/{chunk-4D4PEBGB.js → chunk-JW436RTA.js} +2 -2
  9. package/dist/{chunk-FADNFPZO.js → chunk-KNE3FZ46.js} +2 -2
  10. package/dist/{chunk-OLR4UPP7.js → chunk-KZG47SZP.js} +45 -14
  11. package/dist/{chunk-UG5N7ET3.js → chunk-SXPTL222.js} +1 -1
  12. package/dist/{chunk-VHTIHOHE.js → chunk-WWH4NNBH.js} +3 -3
  13. package/dist/{chunk-O3JEC2UJ.js → chunk-YP3CSOZ6.js} +194 -42
  14. package/dist/{chunk-FGT26PJE.js → chunk-ZZBN2MR7.js} +45 -14
  15. package/dist/{coordinator-prompt-FBX7Y4EM.js → coordinator-prompt-2EOR35TP.js} +2 -2
  16. package/dist/{coordinator-prompt-2LD3C74O.js → coordinator-prompt-6EPVHVGJ.js} +2 -2
  17. package/dist/{global-workspace-NG7SU3GV.js → global-workspace-EZVQPMWT.js} +3 -3
  18. package/dist/{global-workspace-OCV77UYF.js → global-workspace-PANZGRUS.js} +3 -3
  19. package/dist/index.cjs +232 -42
  20. package/dist/index.d.cts +42 -1
  21. package/dist/index.d.ts +42 -1
  22. package/dist/index.js +16 -6
  23. package/dist/mcp/run-stdio.cjs +222 -42
  24. package/dist/mcp/run-stdio.js +6 -6
  25. package/dist/{orchestrator-DB5ZSE6M.js → orchestrator-KWV2PPML.js} +6 -6
  26. package/dist/{orchestrator-IQGVBBSH.js → orchestrator-T35BJZWY.js} +6 -6
  27. package/dist/{workspaces-4FUQW5LD.js → workspaces-DWERPUQJ.js} +4 -4
  28. package/dist/{workspaces-PU5YHQ7Z.js → workspaces-ZJATBC4A.js} +4 -4
  29. package/dist/{worktree-GKLPPNWR.js → worktree-RZRJNHYL.js} +11 -1
  30. package/dist/{worktree-Z22HTSCU.js → worktree-UCWWTVLS.js} +11 -1
  31. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1653,6 +1653,28 @@ interface CreateWorktreeResult {
1653
1653
  * Local-only refs (e.g. fetched PR heads, existing thread branches) stay local.
1654
1654
  */
1655
1655
  declare function resolveWorktreeStartPoint(repoPath: string, sourceRef: string): Promise<string>;
1656
+ /** Branch name to `git fetch origin <name>` — never a pull/checkout of the main tree. */
1657
+ declare function originFetchBranch(sourceRef: string): string | null;
1658
+ /**
1659
+ * Refresh `origin/<branch>` remote-tracking refs before `git worktree add`.
1660
+ * Does **not** pull, merge, checkout, or reset the main repo working tree —
1661
+ * new worktrees start from the remote tip; the project folder stays untouched.
1662
+ */
1663
+ declare function fetchOriginForWorktree(repoPath: string, sourceRef: string, opts?: {
1664
+ timeoutMs?: number;
1665
+ }): Promise<boolean>;
1666
+ type FastForwardMainResult = {
1667
+ updated: boolean;
1668
+ reason: 'updated' | 'already-current' | 'not-on-default' | 'dirty' | 'diverged' | 'no-origin-tip' | 'ff-failed';
1669
+ };
1670
+ /**
1671
+ * Fast-forward the project-folder checkout to `origin/<default>` when that is
1672
+ * safe: already on the default branch, clean, and a strict ancestor of the
1673
+ * remote tip. Never checkout, reset, or merge if it would not fast-forward.
1674
+ */
1675
+ declare function fastForwardMainCheckoutIfSafe(repoPath: string, opts?: {
1676
+ branch?: string;
1677
+ }): Promise<FastForwardMainResult>;
1656
1678
  declare function createThreadWorktree(opts: {
1657
1679
  repoPath: string;
1658
1680
  sourceRef: string;
@@ -1674,6 +1696,8 @@ declare function listWorktrees(repoPath: string): Promise<Array<{
1674
1696
  path: string;
1675
1697
  branch: string | null;
1676
1698
  }>>;
1699
+ /** Commits on HEAD not yet on `origin/<branch>`. Unknown / never-pushed counts as ahead. */
1700
+ declare function countUnpushedVsOrigin(worktreePath: string): Promise<number>;
1677
1701
  declare function isDirty(worktreePath: string): Promise<boolean>;
1678
1702
  /**
1679
1703
  * Local workspace scratch (`.context/attachments`, legacy `.sideboard/attachments`).
@@ -1683,6 +1707,12 @@ declare function isSideboardScratchPath(relativePath: string): boolean;
1683
1707
  declare function currentBranch(worktreePath: string): Promise<string>;
1684
1708
  declare function commitAll(worktreePath: string, message: string): Promise<boolean>;
1685
1709
  declare function pushBranch(worktreePath: string, branchName: string): Promise<void>;
1710
+ /** Mark a draft pull request ready for review (`gh pr ready`). Idempotent. */
1711
+ declare function markPrReady(cwd: string, selector: string): Promise<{
1712
+ url: string;
1713
+ state: string;
1714
+ isDraft: boolean;
1715
+ }>;
1686
1716
  /** Merge an open pull request.
1687
1717
  * When the worktree is on a GitHub PR stack, uses `gh stack merge` (atomic through that PR).
1688
1718
  * Otherwise: draft → ready, then `gh pr merge` (squash by default). */
@@ -3704,6 +3734,11 @@ declare class Orchestrator {
3704
3734
  draft?: boolean;
3705
3735
  web?: boolean;
3706
3736
  }): Promise<LandResult>;
3737
+ markPrReady(threadRef: string): Promise<{
3738
+ url: string;
3739
+ state: string;
3740
+ isDraft: boolean;
3741
+ }>;
3707
3742
  mergePr(threadRef: string): Promise<{
3708
3743
  url: string;
3709
3744
  state: string;
@@ -4665,6 +4700,12 @@ interface IpcApi {
4665
4700
  draft?: boolean;
4666
4701
  web?: boolean;
4667
4702
  }): Promise<LandResult>;
4703
+ /** Mark the thread's linked draft PR ready for review (`gh pr ready`). */
4704
+ markPrReady(threadRef: string): Promise<{
4705
+ url: string;
4706
+ state: string;
4707
+ isDraft: boolean;
4708
+ }>;
4668
4709
  /** Merge the thread's linked PR on GitHub (`gh pr merge`). */
4669
4710
  mergePr(threadRef: string): Promise<{
4670
4711
  url: string;
@@ -5446,4 +5487,4 @@ declare function pollSlackOutboundWatches(opts?: {
5446
5487
  now?: number;
5447
5488
  }): Promise<void>;
5448
5489
 
5449
- export { ABLETIME_MCP_PATH, AGENT_GIT_ACTIONS, AGENT_RUNNER_MAX_OLD_SPACE_MB, ATTACHMENTS_DIR, type AbleTimeAssignedIssuesResult, type AbleTimeMcpToolName, type AbleTimeOrientation, type AbleTimeProject, type AbleTimeTask, type AbleTimeViewer, type ActiveRun, type AddBoardPinInput, type AddStackLayerInput, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentGitAction, type AgentInstructionFile, type AgentKind, type AgentModelCatalog, type AgentModelInfo, type AgentSetupActionResult, type AgentSetupInfo, type AgentSetupKind, type AgentStatus, type AgentTurnInput, type AnthropicCacheControl, type AppSettings, type ApplyIntoMainResult, type AttachCommand, type Autonomy, BAKED_SLACK_RELAY_URL, BRIGHTSY_MCP_ALLOWED_TOOLS, BRIGHTSY_SUMMARIZE_CONTEXT_TOOL, BUNDLED_LONG_RUNNING_PATH, BUNDLED_SKILL_PREFIX, type BoardPin, type BranchInfo, type BrightsyAccount, type BrightsyChatTarget, type BrightsyChatTargets, type BrightsyCloudConnectAgent, type BrightsyHarnessSettings, type BrightsySession, BrightsySideboardApi, type BrightsyTeamTargets, CHARS_PER_CONTEXT_TOKEN, CLAUDE_MODEL_CATALOG, 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, CONVENTION_SETUP_RELPATHS, COORDINATOR_TOOL_PLAYBOOK, type CaffeinateHoldState, type ClaudeHarnessSettings, type CleanupOrphansResult, type CliAgentKind, type CliExecutableSettings, type CloudConnectAgent, type CloudConnectOptions, type CloudConnectStatus, type CompactResult, type CompactThresholds, type ComposerFileBuffer, type ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type ConventionSetupFile, type CowboyThreadFields, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateScheduledTaskInput, type CreateStackInput, type CreateThreadInput, type CreateWorktreeResult, type CursorAgentUsageSnapshot, type CursorModelInfo, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorUsageCost, type CursorWorktreesConfig, DEFAULT_ABLETIME_HOST, DEFAULT_WORKTREE_SORT, 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, GITHUB_GIT_AUTH_MODES, GLOBAL_WORKSPACE_ID, type GetDiffOptions, type GhStackStatus, type GitHubStatus, type GitWorktreeStatus, type GithubGitAuthMode, HARNESS_ENV_KEYS, HOME_BOARD_CACHE_TTL_MS, type HarnessId, type HomeBoardLoaded, type HomeBoardRemoteData, ISSUE_SOURCE_LABELS, type InitStackFromThreadInput, type IntegrationsSettings, type IpcApi, type IssueCycleInfo, type IssueInfo, type IssueSource, LEGACY_ATTACHMENTS_DIR, LEGACY_PLAN_FILE_REL, LEGACY_REVIEW_REQUEST_PATH, LINEAR_OAUTH_CANCELLED, LINEAR_OAUTH_PORT, LINEAR_OAUTH_REDIRECT, LINEAR_OAUTH_SCOPES, LONG_RUNNING_SKILL_COMMAND, type LandPreview, type LandResult, type LinearAssignedIssuesResult, type LinearComment, type LinearIssue, LinearOAuthCancelledError, type LinearTeam, type LinearTeamsResult, type LinearWorkflowState, type ListIssuesResult, MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS, type McpServerStatus, type MessagePart, OPTIONAL_SERVICES, OPTIONAL_SERVICE_IDS, ORCHESTRATOR_AGENT_KINDS, type OpenPrStackLayersInput, type OpenStackLayerInput, type OpenStackLayerResult, type OptionalServiceCliStatus, type OptionalServiceId, type OptionalServiceSpec, type OrchestrationQuotaOnLimit, Orchestrator, type OrchestratorAgentKind, type OrchestratorEvent, type OrchestratorRuntime, type OrphanWorktree, PASTE_ATTACH_MIN_CHARS, PASTE_ATTACH_MIN_LINES, PLAN_FILE_NAME, PLAN_FILE_REL, PLAN_MODE_INSTRUCTION, PLAN_QUESTION_ANSWERS_PREFIX, type PendingPlanQuestions, type PlanQuestion, type PlanQuestionAnswer, type PlanQuestionOption, type PlanToolPartLike, type PrActor, type PrCheckRun, type PrCommentInfo, type PrCommitInfo, type PrDetails, type PrInfo, type PrMeta, type PrReviewInfo, type PrStack, type PrStackLayer, type PresentedPlan, type PublicAppSettings, type PublicIntegrationsSettings, REPO_REVIEW_NAME, REPO_REVIEW_PATH, REVIEW_REQUEST_NAME, REVIEW_REQUEST_PATH, REVIEW_REQUEST_PREFILL, REVIEW_REQUEST_TEMPLATE, REVIEW_SKILL_NAME, REVIEW_SKILL_PATH, type RepoSettings, type RepoSetupInfo, type RequestReviewResult, type ResolvedReviewGuidelines, type ReviewGuidelinesSource, type RunMode, type RunScript, SESSION_RESET_OCCUPANCY_TOKENS, SIDEBOARD_FORCE_STOP, SIDEBOARD_MCP_ALLOWED_TOOLS, SIDEBOARD_MCP_PROFILE_ENV, SLACK_LISTEN_STOPPED_REPLY, SLACK_LISTEN_TIMEOUT_REPLY, SLACK_OAUTH_CANCELLED, SLACK_OAUTH_REDIRECT, SLACK_PROGRESS_DELAY_MS, SLACK_PROGRESS_EDIT_MS, SLACK_REPLY_FORMATTING, SLACK_SEEN_REACTION, type ScheduleCreatedBy, type ScheduleWhen, type ScheduledTask, type ScriptHandle, type SetupRunResult, type SideboardMcpProfile, type SkillInfo, type SlackInboundMessage, type SlackListenOptions, type SlackListenStatus, SlackOAuthCancelledError, type SlackOutboundReply, type SlackOutboundWatch, type SlackRelayClientMessage, type SlackRelayClientOptions, SlackRelayHub, type SlackRelayServerHandle, type SlackRelayServerMessage, type SlackRelayServerOptions, type SlackWorkspaceInfo, type SourceType, type SpawnTurnHandle, type SummarizeResult, THINKING_EFFORTS, type TeamName, type ThinkingEffort, type Thread, type ThreadAttachment, type ThreadMessage, type ThreadOptionsPatch, type ThreadStatus, type TokenUsage, type ToolPartLike, type TranscriptToolDetail, type TurnCommand, type UpdateScheduledTaskPatch, type UsageScope, WORKTREE_MCP_TOOLS, type Workspace, type WorkspaceInventoryEntry, type WorkspaceScriptEnvOpts, type WorktreeSortMode, abletimeMcpRequest, abletimeMcpUrl, ackSlackInboundSeen, addBoardPin, addPrStackLayer, addStackLayerFromThread, addWorkspace, adoptThread, agentGitPrompt, allAdapters, allocatePort, allocatePortRange, allocateTeamName, allocateTeamSlug, appDataDir, appSettingsPath, appendIndexedGitConfig, appendMessage, applyAgentEvent, applyAgentRunnerHeapEnv, applyAppEnvironment, applyCompaction, applyForwardOccupancy, applyGithubGitAuthEnv, applyPromptCacheTtlEnv, applyThreadIntoMain, applyTurnUsage, armSchedules, assertOrchestratorCapableAgent, attachmentFromAbsolutePath, attachmentsFromBuffers, attachmentsFromWorktreePaths, attachmentsGitignoreBody, autoArchiveOnMergeEnabled, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAccessTokenNeedsRefresh, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyInjectWorktreeMcpEnabled, brightsyMcpAllowedTools, brightsyMcpServerName, buildBrightsySessionSeed, buildCachedUserContent, buildClaudeStreamJsonUserMessage, buildDiffCommentAttachment, buildForkTranscriptAttachment, buildPastedTextAttachment, buildReviewRequestAttachment, buildSessionSeed, buildWorkspaceScriptEnv, caffeinateHoldPath, caffeinateWhileCloudConnectEnabled, caffeinateWhileRunningEnabled, caffeinateWhileSchedulesEnabled, caffeinateWhileSlackListenEnabled, callAbleTimeTool, canonicalizeRepoPath, captureLoginEnv, captureTurnBaseline, checkoutPrStackLayer, childEnvWithAppSettings, claimDesktopHost, classifyWorktreeColumn, claudeAdapter, claudeChromeEnabled, claudeUserSettingsPath, cleanupOrphanWorktrees, clearBoardPins, clearHomeBoardCache, cloneRepoIntoSideboard, codexAdapter, codexSandboxWritableRootsArgs, codexUnattendedGitConfigArgs, coerceOrchestratorAgent, collectTakenTeamSlugs, commentLinearIssue, commitAll, computeNextRunAt, conductorBundledBinDir, conductorDbPath, confirmLand, connectBrightsyTeam, connectOptionalService, connectSlackToken, connectedOptionalServices, contextTokens, coordinatorSystemPrompt, coordinatorTurnReminder, copyConfiguredFiles, countCacheControlBlocks, cowboyModeEnabled, createAbleTimeTask, createChatTab, createEmptyThread, createExistingBranchWorktree, createGlobalChat, createLinearIssue, createLinearPkce, createOrUpdatePr, createPrStack, createSchedule, createThread, createThreadWorktree, currentBranch, cursorAdapter, cursorSdkMessageToEvents, decodeBrightsyTarget, defaultScheduleName, deleteBranchOnPurgeEnabled, deleteSchedule, deleteThreadRecord, desktopHostPidPath, detectAgents, detectGhStack, detectLocalMergeConflicts, detectOptionalServiceClis, disconnectAbleTimeConnection, disconnectBrightsyTeam, disconnectLinear, disconnectLinearConnection, disconnectOptionalService, disconnectSlackWorkspace, discoverSkills, dropCachedPrefixOnResume, emptyPublicIntegrations, encodeBrightsyTarget, enrichPathWithNpmGlobalBin, enrichWorkspacesWithGithub, ensureAbleTimeTask, ensureAgentPath, ensureBrightsyLocalConfigFresh, ensureCloudCoordinator, ensureConnectedBrightsyTeamTokens, ensureGhPreferOrigin, ensureGlobalCoordinatorCwd, ensureReviewRequestFile, ensureReviewSkillFile, ensureSlackCoordinator, ensureSlackDeviceIdentity, ensureWorkspace, estimateMessageChars, estimateOccupancyTokens, estimateThreadChars, expandComposerPrompt, extractBrightsyContextSummary, extractGhErrorDetail, extractPendingPlanQuestions, extractPresentedPlan, extractiveSummary, fetchPrHead, finalizeParts, findConventionSetup, findInvalidCacheControlTtlOrder, findLastBrightsyContextSummary, findLiveThreadForCreate, findOrphanWorktrees, findSlackCoordinator, findThreadByRef, findThreadForStackLayer, fireSchedule, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatArtifactDirective, formatBrightsyFetchError, formatDetachedJobInvoke, formatFetchError, formatGhLandError, formatGitAuthModeDirective, formatIpcInvokeError, formatLongRunningDirective, formatLongRunningReminder, formatMergePrError, formatMessagesAsTranscript, formatOptionalServicesDirective, formatOptionalServicesReminder, formatPlanQuestionAnswers, formatPlanQuestionsForChat, formatProcessGuideDirective, formatRateLimitResetHint, formatRenameBranchDirective, formatScheduleWhen, formatScheduledPrompt, formatSlackExternalReplyPrompt, formatSlackInboundPrompt, formatSlackRepliesForTurn, formatSlackReplyContinuePrompt, formatSlackSignedReply, formatSlackWorkingText, formatTranscriptMarkdown, formatUiReminder, formatWorkspaceInventory, formatWorktreeDirective, formatWorktreeReminder, forwardContextUsage, forwardOccupancyTokens, fromInclusiveInputUsage, getAbleTimeAccessToken, getAbleTimeHost, getAbleTimeOrientation, getAbleTimeTask, getAdapter, getAgentSetupInfo, getBrightsySession, getCaffeinateHold, getDefaultAgent, getDefaultEffort, getDefaultFast, getDefaultModel, getDefaultRunScript, getDiff, getDiffSummary, getGitHubStatus, getGithubGitAuthMode, getGithubPat, getHomeBoardInputs, getIssueSource, getLinearApiKey, getLinearAuthToken, getLinearIssue, getOrchestrator, getPr, getPrChecks, getPrDetails, getPrForHeadBranch, getPrMeta, getPrStack, getRepoSetupInfo, getRunMode, getRunScript, getSchedule, getSlackWorkspace, gh, ghHeadRef, ghRepoSelectArgs, git, githubAgentGitEnv, globalAgentCwd, groupHomeBoardWorktrees, handleSlackInbound, harnessEnvKey, hasBakedLinearOAuth, hasBakedSlackOAuth, hasConductorHook, hasConventionSetup, hasCursorWorktreeSetup, hasEnabledSchedules, hasRepoHook, hasWorkspaceHook, healOrchestrationSoccerTitles, httpFetch, importConductorWorkspace, importConductorWorkspaceAsync, initPrStack, initStackFromThread, initializeGitRepository, inspectGitWorktree, installAgent, installNpmGlobalPackage, installOptionalServiceCli, interruptSlackCoordinatorForInbound, invalidateThreadListCache, isAbleTimeConnected, isAskUserToolName, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isConductorBundledCli, isCowboyThread, isCursorAutoModel, isDefaultishSourceRef, isDesktopHostAlive, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isHomeBoardThread, isImageFilePath, isInPrStack, isInboundForThisDesktop, isIssueSourceConnected, isLinearConnected, isLinearOAuthCancelled, isOptionalServiceId, isOrchestratorCapableAgent, isOrchestratorThread, isPidAlive, isPlaceholderBranch, isPlanQuestionAnswersMessage, isPollWrapperToolName, isPrNotMergeableError, isPresentPlanToolName, isPrimaryCheckoutThread, isSessionQuotaLimit, isShellToolName, isSideboardScratchPath, isSlackCoordinatorThread, isSlackExternalReplyPrompt, isSlackOAuthCancelled, isSubagentToolName, isThinkingEffort, isThisProcessDesktopHost, isThreadCaffeinated, isThreadRecordFile, isWorkspaceScratchPath, issueAttachmentForAbleTimeTask, issueSourceLabel, lastRequestOccupancy, latestPendingPlanQuestions, linearAuthorizationHeader, linearCycleIsActive, linearGraphql, linearOAuthAuthorizeUrl, linearOAuthCredentials, listAbleTimeAssignedIssues, listAbleTimeProjects, listAbleTimeTasks, listAgentSetupInfo, listBoardPins, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listCodexModels, listConductorWorkspaces, listConnectedBrightsyTeams, listCursorModels, listGitHubIssues, listGlobalThreads, listIssues, listLinearAssignedIssues, listLinearIssues, listLinearIssuesDirect, listLinearTeams, listModelsForAgent, listOpencodeModels, listPrs, listRunScripts, listSchedules, listSlackOutboundWatches, listSlackWorkspaces, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, liveActivitySummary, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadHomeBoardInputs, loadRepoSettings, loadWorkspaceSettings, locksDir, loginAgent, lookupSoccerTeam, mapAbleTimeTask, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergeAgentGitAuthEnv, mergePr, mergePrStack, mergeSideboardIntoMcpServersJson, mergeUsage, messagePartParentId, messagesSinceLastBrightsyContextSummary, nextPastedTextName, nextThinkingEffort, nonInteractiveGitProcessEnv, normalizeAbleTimeHost, normalizeParseResult, normalizeServiceOrigin, normalizeThinkingEffort, normalizeThread, normalizeTurnInput, normalizeWorktreePath, openInSystemTerminal, openPrStackLayers, openStackLayer, opencodeAdapter, optionalServiceConnected, optionalServiceSpec, orchestrationQuotaFallbackAgent, orchestrationQuotaOnLimit, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, originGhRepoEnv, packagedDetachedJobPath, parseCursorRunnerLine, parseDurationMs, parseForceStopMessage, parseGhStackViewJson, parseGithubSlugFromRemoteUrl, parseMcpList, parsePlanQuestionsInput, parseSessionQuotaResetAt, parseSlackRelayClientMessage, parseSlackRelayServerMessage, partsToAssistantText, pastedTextStats, pendingSlackExternalReplies, permissionMode, persistPendingFileAttachments, persistVaultKeyInKeychain, planFileAbs, planQuestionsSignature, pollSlackOutboundWatches, posixShellSingleQuote, preferredCursorCostCents, prepareTerminalCommand, previewLand, promptMentionsBrightsy, pushBranch, readExistingReviewRequestFile, readKeychainVaultKey, readPlanFile, readSkillBody, readThread, readWorktreeFile, readWorktreeFileForUpload, readWorktreeInclude, recordScheduleRun, recordSlackOutboundWatch, refreshBrightsyAccessToken, refreshGitHubAuth, registerPackagedUserMcpClients, releaseCaffeinateHoldForThread, releaseDesktopHost, removeBoardPin, removeWorkspace, removeWorktree, repoSlug, requestOccupancy, requestReview, requireAgent, resetGhStackDetectCache, resetGithubAgentTokenMemo, resolveAgentExecutable, resolveAgentGitAuthEnv, resolveClaudeExecutable, resolveCodexGitWritableRoots, resolveCommandBinarySync, resolveConductorCursorAgentId, resolveCursorModelId, resolveDefaultBranch, resolveDetachedJobScript, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGhAuthToken, resolveGitDirsForLockRecovery, resolveGithubAgentToken, resolveGithubRepoSlug, resolveLinearState, resolveLinearTeam, resolveLoginCommand, resolveNewThreadOptions, resolvePlanMarkdown, resolvePrSelector, resolvePrSelectors, resolveQuotaFallbackAgent, resolveRepoRoot, resolveReviewGuidelines, resolveScheduleThreadId, resolveSlackListenMode, resolveThreadDefaults, resolveThreadEffort, resolveVaultKey, resolveWorktreeStartPoint, rewriteAbleTimeError, rewriteLinearError, run, runArchiveScript, runCloudConnect, runConventionSetup, runCursorWorktreeSetup, runSetupScript, runSlackListen, runSlackRelayClient, runWorkspaceSetup, sameWorktreePath, sanitizeMcpServerName, saveAbleTimeConnection, saveAppSettings, saveLinearOAuth, schedulesPath, scrubGithubTokensFromChildEnv, searchAbleTimeTasks, secureFileUnlocksWith, setCaffeinateHold, setHttpFetchImpl, setStatus, setVaultMasterKey, settingsSourceLabel, shouldAttachPastedText, shouldCompactContext, shouldInjectBrightsyMcp, shouldRefreshReviewRequestTemplate, shouldRemoveWorktreeOnTeardown, shouldResetSessionForOccupancy, shouldRunWorktreeCleanup, showCostEnabled, sideboardHomeDir, sideboardMcpProfile, sideboardReposDir, sideboardWorkspacesDir, slackAppLevelToken, slackArchiveUrl, slackCoordinatorSourceRef, slackListenEnabled, slackOAuthCredentials, slackOAuthResultUrl, slackRelayUrl, slugify, spawnAgentTurn, splitForCompaction, stackAgentDefaultsFrom, stackIdFrom, stackMergeReadiness, stageAbsolutePathsAsAttachments, stageBuffersAsAttachments, startDevServer, startLinearOAuth, startMcpServer, startOrchestration, startSlackOAuth, startSlackRelayServer, stripBrightsyNdjsonNoise, stripNestedElectronEnv, submitPrStack, suggestSlug, sumUsageList, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, taskUrl, thinkingEffortBars, thinkingEffortLabel, thisProcessShouldDrainAgentQueues, threadDisplayLabel, threadFilePath, threadHasCompactedContext, threadLivePath, threadLockPath, threadRequestsBrightsyMcp, threadsDir, threadsSharingWorktree, toAbleTimeIssueInfo, toPublicAppSettings, toolActivityLine, toolDescription, toolDetail, toolFilePath, totalTokens, turnCostUsdFromCursorUsage, updateAdvancedSettings, updateAgentExecutable, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateCodexSettings, updateDefaultsSettings, updateIntegrationsSettings, updateLinearIssue, updateOpencodeSettings, updateSchedule, updateThread, userClaudeMcpConfigPath, userCursorMcpConfigPath, validateLinearApiKey, verifyAbleTimeConnection, verifyOptionalService, visibleToolRowDetail, waitForPidExit, warmGithubAgentAuth, whichOnPath, withAgentInstructions, withEventParentId, withEventsParentId, withExportedPath, withMaxOldSpaceSize, withThreadLock, workspaceSettingsSourceLabel, worktreeBoardStatus, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, wrapReviewSkillMarkdown, writeInjectedMcpConfig, writePlanFile, writeThread, writeWorktreeFile };
5490
+ export { ABLETIME_MCP_PATH, AGENT_GIT_ACTIONS, AGENT_RUNNER_MAX_OLD_SPACE_MB, ATTACHMENTS_DIR, type AbleTimeAssignedIssuesResult, type AbleTimeMcpToolName, type AbleTimeOrientation, type AbleTimeProject, type AbleTimeTask, type AbleTimeViewer, type ActiveRun, type AddBoardPinInput, type AddStackLayerInput, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentGitAction, type AgentInstructionFile, type AgentKind, type AgentModelCatalog, type AgentModelInfo, type AgentSetupActionResult, type AgentSetupInfo, type AgentSetupKind, type AgentStatus, type AgentTurnInput, type AnthropicCacheControl, type AppSettings, type ApplyIntoMainResult, type AttachCommand, type Autonomy, BAKED_SLACK_RELAY_URL, BRIGHTSY_MCP_ALLOWED_TOOLS, BRIGHTSY_SUMMARIZE_CONTEXT_TOOL, BUNDLED_LONG_RUNNING_PATH, BUNDLED_SKILL_PREFIX, type BoardPin, type BranchInfo, type BrightsyAccount, type BrightsyChatTarget, type BrightsyChatTargets, type BrightsyCloudConnectAgent, type BrightsyHarnessSettings, type BrightsySession, BrightsySideboardApi, type BrightsyTeamTargets, CHARS_PER_CONTEXT_TOKEN, CLAUDE_MODEL_CATALOG, 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, CONVENTION_SETUP_RELPATHS, COORDINATOR_TOOL_PLAYBOOK, type CaffeinateHoldState, type ClaudeHarnessSettings, type CleanupOrphansResult, type CliAgentKind, type CliExecutableSettings, type CloudConnectAgent, type CloudConnectOptions, type CloudConnectStatus, type CompactResult, type CompactThresholds, type ComposerFileBuffer, type ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type ConventionSetupFile, type CowboyThreadFields, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateScheduledTaskInput, type CreateStackInput, type CreateThreadInput, type CreateWorktreeResult, type CursorAgentUsageSnapshot, type CursorModelInfo, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorUsageCost, type CursorWorktreesConfig, DEFAULT_ABLETIME_HOST, DEFAULT_WORKTREE_SORT, type DefaultsAppSettings, type DevServerHandle, type DiffCommentInput, type DiffCommentLine, type DiffCommit, type DiffFile, type DiffResult, type DiffScope, type DiffScopeStat, type ExpandResult, FAMOUS_SOCCER_TEAMS, type FastForwardMainResult, type ForkChatTabInput, type ForkThreadWorktreeInput, type FormatGhLandErrorOptions, GITHUB_GIT_AUTH_MODES, GLOBAL_WORKSPACE_ID, type GetDiffOptions, type GhStackStatus, type GitHubStatus, type GitWorktreeStatus, type GithubGitAuthMode, HARNESS_ENV_KEYS, HOME_BOARD_CACHE_TTL_MS, type HarnessId, type HomeBoardLoaded, type HomeBoardRemoteData, ISSUE_SOURCE_LABELS, type InitStackFromThreadInput, type IntegrationsSettings, type IpcApi, type IssueCycleInfo, type IssueInfo, type IssueSource, LEGACY_ATTACHMENTS_DIR, LEGACY_PLAN_FILE_REL, LEGACY_REVIEW_REQUEST_PATH, LINEAR_OAUTH_CANCELLED, LINEAR_OAUTH_PORT, LINEAR_OAUTH_REDIRECT, LINEAR_OAUTH_SCOPES, LONG_RUNNING_SKILL_COMMAND, type LandPreview, type LandResult, type LinearAssignedIssuesResult, type LinearComment, type LinearIssue, LinearOAuthCancelledError, type LinearTeam, type LinearTeamsResult, type LinearWorkflowState, type ListIssuesResult, MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS, type McpServerStatus, type MessagePart, OPTIONAL_SERVICES, OPTIONAL_SERVICE_IDS, ORCHESTRATOR_AGENT_KINDS, type OpenPrStackLayersInput, type OpenStackLayerInput, type OpenStackLayerResult, type OptionalServiceCliStatus, type OptionalServiceId, type OptionalServiceSpec, type OrchestrationQuotaOnLimit, Orchestrator, type OrchestratorAgentKind, type OrchestratorEvent, type OrchestratorRuntime, type OrphanWorktree, PASTE_ATTACH_MIN_CHARS, PASTE_ATTACH_MIN_LINES, PLAN_FILE_NAME, PLAN_FILE_REL, PLAN_MODE_INSTRUCTION, PLAN_QUESTION_ANSWERS_PREFIX, type PendingPlanQuestions, type PlanQuestion, type PlanQuestionAnswer, type PlanQuestionOption, type PlanToolPartLike, type PrActor, type PrCheckRun, type PrCommentInfo, type PrCommitInfo, type PrDetails, type PrInfo, type PrMeta, type PrReviewInfo, type PrStack, type PrStackLayer, type PresentedPlan, type PublicAppSettings, type PublicIntegrationsSettings, REPO_REVIEW_NAME, REPO_REVIEW_PATH, REVIEW_REQUEST_NAME, REVIEW_REQUEST_PATH, REVIEW_REQUEST_PREFILL, REVIEW_REQUEST_TEMPLATE, REVIEW_SKILL_NAME, REVIEW_SKILL_PATH, type RepoSettings, type RepoSetupInfo, type RequestReviewResult, type ResolvedReviewGuidelines, type ReviewGuidelinesSource, type RunMode, type RunScript, SESSION_RESET_OCCUPANCY_TOKENS, SIDEBOARD_FORCE_STOP, SIDEBOARD_MCP_ALLOWED_TOOLS, SIDEBOARD_MCP_PROFILE_ENV, SLACK_LISTEN_STOPPED_REPLY, SLACK_LISTEN_TIMEOUT_REPLY, SLACK_OAUTH_CANCELLED, SLACK_OAUTH_REDIRECT, SLACK_PROGRESS_DELAY_MS, SLACK_PROGRESS_EDIT_MS, SLACK_REPLY_FORMATTING, SLACK_SEEN_REACTION, type ScheduleCreatedBy, type ScheduleWhen, type ScheduledTask, type ScriptHandle, type SetupRunResult, type SideboardMcpProfile, type SkillInfo, type SlackInboundMessage, type SlackListenOptions, type SlackListenStatus, SlackOAuthCancelledError, type SlackOutboundReply, type SlackOutboundWatch, type SlackRelayClientMessage, type SlackRelayClientOptions, SlackRelayHub, type SlackRelayServerHandle, type SlackRelayServerMessage, type SlackRelayServerOptions, type SlackWorkspaceInfo, type SourceType, type SpawnTurnHandle, type SummarizeResult, THINKING_EFFORTS, type TeamName, type ThinkingEffort, type Thread, type ThreadAttachment, type ThreadMessage, type ThreadOptionsPatch, type ThreadStatus, type TokenUsage, type ToolPartLike, type TranscriptToolDetail, type TurnCommand, type UpdateScheduledTaskPatch, type UsageScope, WORKTREE_MCP_TOOLS, type Workspace, type WorkspaceInventoryEntry, type WorkspaceScriptEnvOpts, type WorktreeSortMode, abletimeMcpRequest, abletimeMcpUrl, ackSlackInboundSeen, addBoardPin, addPrStackLayer, addStackLayerFromThread, addWorkspace, adoptThread, agentGitPrompt, allAdapters, allocatePort, allocatePortRange, allocateTeamName, allocateTeamSlug, appDataDir, appSettingsPath, appendIndexedGitConfig, appendMessage, applyAgentEvent, applyAgentRunnerHeapEnv, applyAppEnvironment, applyCompaction, applyForwardOccupancy, applyGithubGitAuthEnv, applyPromptCacheTtlEnv, applyThreadIntoMain, applyTurnUsage, armSchedules, assertOrchestratorCapableAgent, attachmentFromAbsolutePath, attachmentsFromBuffers, attachmentsFromWorktreePaths, attachmentsGitignoreBody, autoArchiveOnMergeEnabled, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAccessTokenNeedsRefresh, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyInjectWorktreeMcpEnabled, brightsyMcpAllowedTools, brightsyMcpServerName, buildBrightsySessionSeed, buildCachedUserContent, buildClaudeStreamJsonUserMessage, buildDiffCommentAttachment, buildForkTranscriptAttachment, buildPastedTextAttachment, buildReviewRequestAttachment, buildSessionSeed, buildWorkspaceScriptEnv, caffeinateHoldPath, caffeinateWhileCloudConnectEnabled, caffeinateWhileRunningEnabled, caffeinateWhileSchedulesEnabled, caffeinateWhileSlackListenEnabled, callAbleTimeTool, canonicalizeRepoPath, captureLoginEnv, captureTurnBaseline, checkoutPrStackLayer, childEnvWithAppSettings, claimDesktopHost, classifyWorktreeColumn, claudeAdapter, claudeChromeEnabled, claudeUserSettingsPath, cleanupOrphanWorktrees, clearBoardPins, clearHomeBoardCache, cloneRepoIntoSideboard, codexAdapter, codexSandboxWritableRootsArgs, codexUnattendedGitConfigArgs, coerceOrchestratorAgent, collectTakenTeamSlugs, commentLinearIssue, commitAll, computeNextRunAt, conductorBundledBinDir, conductorDbPath, confirmLand, connectBrightsyTeam, connectOptionalService, connectSlackToken, connectedOptionalServices, contextTokens, coordinatorSystemPrompt, coordinatorTurnReminder, copyConfiguredFiles, countCacheControlBlocks, countUnpushedVsOrigin, cowboyModeEnabled, createAbleTimeTask, createChatTab, createEmptyThread, createExistingBranchWorktree, createGlobalChat, createLinearIssue, createLinearPkce, createOrUpdatePr, createPrStack, createSchedule, createThread, createThreadWorktree, currentBranch, cursorAdapter, cursorSdkMessageToEvents, decodeBrightsyTarget, defaultScheduleName, deleteBranchOnPurgeEnabled, deleteSchedule, deleteThreadRecord, desktopHostPidPath, detectAgents, detectGhStack, detectLocalMergeConflicts, detectOptionalServiceClis, disconnectAbleTimeConnection, disconnectBrightsyTeam, disconnectLinear, disconnectLinearConnection, disconnectOptionalService, disconnectSlackWorkspace, discoverSkills, dropCachedPrefixOnResume, emptyPublicIntegrations, encodeBrightsyTarget, enrichPathWithNpmGlobalBin, enrichWorkspacesWithGithub, ensureAbleTimeTask, ensureAgentPath, ensureBrightsyLocalConfigFresh, ensureCloudCoordinator, ensureConnectedBrightsyTeamTokens, ensureGhPreferOrigin, ensureGlobalCoordinatorCwd, ensureReviewRequestFile, ensureReviewSkillFile, ensureSlackCoordinator, ensureSlackDeviceIdentity, ensureWorkspace, estimateMessageChars, estimateOccupancyTokens, estimateThreadChars, expandComposerPrompt, extractBrightsyContextSummary, extractGhErrorDetail, extractPendingPlanQuestions, extractPresentedPlan, extractiveSummary, fastForwardMainCheckoutIfSafe, fetchOriginForWorktree, fetchPrHead, finalizeParts, findConventionSetup, findInvalidCacheControlTtlOrder, findLastBrightsyContextSummary, findLiveThreadForCreate, findOrphanWorktrees, findSlackCoordinator, findThreadByRef, findThreadForStackLayer, fireSchedule, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatArtifactDirective, formatBrightsyFetchError, formatDetachedJobInvoke, formatFetchError, formatGhLandError, formatGitAuthModeDirective, formatIpcInvokeError, formatLongRunningDirective, formatLongRunningReminder, formatMergePrError, formatMessagesAsTranscript, formatOptionalServicesDirective, formatOptionalServicesReminder, formatPlanQuestionAnswers, formatPlanQuestionsForChat, formatProcessGuideDirective, formatRateLimitResetHint, formatRenameBranchDirective, formatScheduleWhen, formatScheduledPrompt, formatSlackExternalReplyPrompt, formatSlackInboundPrompt, formatSlackRepliesForTurn, formatSlackReplyContinuePrompt, formatSlackSignedReply, formatSlackWorkingText, formatTranscriptMarkdown, formatUiReminder, formatWorkspaceInventory, formatWorktreeDirective, formatWorktreeReminder, forwardContextUsage, forwardOccupancyTokens, fromInclusiveInputUsage, getAbleTimeAccessToken, getAbleTimeHost, getAbleTimeOrientation, getAbleTimeTask, getAdapter, getAgentSetupInfo, getBrightsySession, getCaffeinateHold, getDefaultAgent, getDefaultEffort, getDefaultFast, getDefaultModel, getDefaultRunScript, getDiff, getDiffSummary, getGitHubStatus, getGithubGitAuthMode, getGithubPat, getHomeBoardInputs, getIssueSource, getLinearApiKey, getLinearAuthToken, getLinearIssue, getOrchestrator, getPr, getPrChecks, getPrDetails, getPrForHeadBranch, getPrMeta, getPrStack, getRepoSetupInfo, getRunMode, getRunScript, getSchedule, getSlackWorkspace, gh, ghHeadRef, ghRepoSelectArgs, git, githubAgentGitEnv, globalAgentCwd, groupHomeBoardWorktrees, handleSlackInbound, harnessEnvKey, hasBakedLinearOAuth, hasBakedSlackOAuth, hasConductorHook, hasConventionSetup, hasCursorWorktreeSetup, hasEnabledSchedules, hasRepoHook, hasWorkspaceHook, healOrchestrationSoccerTitles, httpFetch, importConductorWorkspace, importConductorWorkspaceAsync, initPrStack, initStackFromThread, initializeGitRepository, inspectGitWorktree, installAgent, installNpmGlobalPackage, installOptionalServiceCli, interruptSlackCoordinatorForInbound, invalidateThreadListCache, isAbleTimeConnected, isAskUserToolName, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isConductorBundledCli, isCowboyThread, isCursorAutoModel, isDefaultishSourceRef, isDesktopHostAlive, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isHomeBoardThread, isImageFilePath, isInPrStack, isInboundForThisDesktop, isIssueSourceConnected, isLinearConnected, isLinearOAuthCancelled, isOptionalServiceId, isOrchestratorCapableAgent, isOrchestratorThread, isPidAlive, isPlaceholderBranch, isPlanQuestionAnswersMessage, isPollWrapperToolName, isPrNotMergeableError, isPresentPlanToolName, isPrimaryCheckoutThread, isSessionQuotaLimit, isShellToolName, isSideboardScratchPath, isSlackCoordinatorThread, isSlackExternalReplyPrompt, isSlackOAuthCancelled, isSubagentToolName, isThinkingEffort, isThisProcessDesktopHost, isThreadCaffeinated, isThreadRecordFile, isWorkspaceScratchPath, issueAttachmentForAbleTimeTask, issueSourceLabel, lastRequestOccupancy, latestPendingPlanQuestions, linearAuthorizationHeader, linearCycleIsActive, linearGraphql, linearOAuthAuthorizeUrl, linearOAuthCredentials, listAbleTimeAssignedIssues, listAbleTimeProjects, listAbleTimeTasks, listAgentSetupInfo, listBoardPins, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listCodexModels, listConductorWorkspaces, listConnectedBrightsyTeams, listCursorModels, listGitHubIssues, listGlobalThreads, listIssues, listLinearAssignedIssues, listLinearIssues, listLinearIssuesDirect, listLinearTeams, listModelsForAgent, listOpencodeModels, listPrs, listRunScripts, listSchedules, listSlackOutboundWatches, listSlackWorkspaces, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, liveActivitySummary, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadHomeBoardInputs, loadRepoSettings, loadWorkspaceSettings, locksDir, loginAgent, lookupSoccerTeam, mapAbleTimeTask, markPrReady, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergeAgentGitAuthEnv, mergePr, mergePrStack, mergeSideboardIntoMcpServersJson, mergeUsage, messagePartParentId, messagesSinceLastBrightsyContextSummary, nextPastedTextName, nextThinkingEffort, nonInteractiveGitProcessEnv, normalizeAbleTimeHost, normalizeParseResult, normalizeServiceOrigin, normalizeThinkingEffort, normalizeThread, normalizeTurnInput, normalizeWorktreePath, openInSystemTerminal, openPrStackLayers, openStackLayer, opencodeAdapter, optionalServiceConnected, optionalServiceSpec, orchestrationQuotaFallbackAgent, orchestrationQuotaOnLimit, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, originFetchBranch, originGhRepoEnv, packagedDetachedJobPath, parseCursorRunnerLine, parseDurationMs, parseForceStopMessage, parseGhStackViewJson, parseGithubSlugFromRemoteUrl, parseMcpList, parsePlanQuestionsInput, parseSessionQuotaResetAt, parseSlackRelayClientMessage, parseSlackRelayServerMessage, partsToAssistantText, pastedTextStats, pendingSlackExternalReplies, permissionMode, persistPendingFileAttachments, persistVaultKeyInKeychain, planFileAbs, planQuestionsSignature, pollSlackOutboundWatches, posixShellSingleQuote, preferredCursorCostCents, prepareTerminalCommand, previewLand, promptMentionsBrightsy, pushBranch, readExistingReviewRequestFile, readKeychainVaultKey, readPlanFile, readSkillBody, readThread, readWorktreeFile, readWorktreeFileForUpload, readWorktreeInclude, recordScheduleRun, recordSlackOutboundWatch, refreshBrightsyAccessToken, refreshGitHubAuth, registerPackagedUserMcpClients, releaseCaffeinateHoldForThread, releaseDesktopHost, removeBoardPin, removeWorkspace, removeWorktree, repoSlug, requestOccupancy, requestReview, requireAgent, resetGhStackDetectCache, resetGithubAgentTokenMemo, resolveAgentExecutable, resolveAgentGitAuthEnv, resolveClaudeExecutable, resolveCodexGitWritableRoots, resolveCommandBinarySync, resolveConductorCursorAgentId, resolveCursorModelId, resolveDefaultBranch, resolveDetachedJobScript, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGhAuthToken, resolveGitDirsForLockRecovery, resolveGithubAgentToken, resolveGithubRepoSlug, resolveLinearState, resolveLinearTeam, resolveLoginCommand, resolveNewThreadOptions, resolvePlanMarkdown, resolvePrSelector, resolvePrSelectors, resolveQuotaFallbackAgent, resolveRepoRoot, resolveReviewGuidelines, resolveScheduleThreadId, resolveSlackListenMode, resolveThreadDefaults, resolveThreadEffort, resolveVaultKey, resolveWorktreeStartPoint, rewriteAbleTimeError, rewriteLinearError, run, runArchiveScript, runCloudConnect, runConventionSetup, runCursorWorktreeSetup, runSetupScript, runSlackListen, runSlackRelayClient, runWorkspaceSetup, sameWorktreePath, sanitizeMcpServerName, saveAbleTimeConnection, saveAppSettings, saveLinearOAuth, schedulesPath, scrubGithubTokensFromChildEnv, searchAbleTimeTasks, secureFileUnlocksWith, setCaffeinateHold, setHttpFetchImpl, setStatus, setVaultMasterKey, settingsSourceLabel, shouldAttachPastedText, shouldCompactContext, shouldInjectBrightsyMcp, shouldRefreshReviewRequestTemplate, shouldRemoveWorktreeOnTeardown, shouldResetSessionForOccupancy, shouldRunWorktreeCleanup, showCostEnabled, sideboardHomeDir, sideboardMcpProfile, sideboardReposDir, sideboardWorkspacesDir, slackAppLevelToken, slackArchiveUrl, slackCoordinatorSourceRef, slackListenEnabled, slackOAuthCredentials, slackOAuthResultUrl, slackRelayUrl, slugify, spawnAgentTurn, splitForCompaction, stackAgentDefaultsFrom, stackIdFrom, stackMergeReadiness, stageAbsolutePathsAsAttachments, stageBuffersAsAttachments, startDevServer, startLinearOAuth, startMcpServer, startOrchestration, startSlackOAuth, startSlackRelayServer, stripBrightsyNdjsonNoise, stripNestedElectronEnv, submitPrStack, suggestSlug, sumUsageList, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, taskUrl, thinkingEffortBars, thinkingEffortLabel, thisProcessShouldDrainAgentQueues, threadDisplayLabel, threadFilePath, threadHasCompactedContext, threadLivePath, threadLockPath, threadRequestsBrightsyMcp, threadsDir, threadsSharingWorktree, toAbleTimeIssueInfo, toPublicAppSettings, toolActivityLine, toolDescription, toolDetail, toolFilePath, totalTokens, turnCostUsdFromCursorUsage, updateAdvancedSettings, updateAgentExecutable, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateCodexSettings, updateDefaultsSettings, updateIntegrationsSettings, updateLinearIssue, updateOpencodeSettings, updateSchedule, updateThread, userClaudeMcpConfigPath, userCursorMcpConfigPath, validateLinearApiKey, verifyAbleTimeConnection, verifyOptionalService, visibleToolRowDetail, waitForPidExit, warmGithubAgentAuth, whichOnPath, withAgentInstructions, withEventParentId, withEventsParentId, withExportedPath, withMaxOldSpaceSize, withThreadLock, workspaceSettingsSourceLabel, worktreeBoardStatus, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, wrapReviewSkillMarkdown, writeInjectedMcpConfig, writePlanFile, writeThread, writeWorktreeFile };
package/dist/index.js CHANGED
@@ -212,7 +212,7 @@ import {
212
212
  worktreeCleanupSettings,
213
213
  wrapReviewSkillMarkdown,
214
214
  writeWorktreeFile
215
- } from "./chunk-FGT26PJE.js";
215
+ } from "./chunk-ZZBN2MR7.js";
216
216
  import {
217
217
  BRIGHTSY_MCP_ALLOWED_TOOLS,
218
218
  CLAUDE_MODEL_CATALOG,
@@ -294,7 +294,7 @@ import {
294
294
  withEventParentId,
295
295
  withEventsParentId,
296
296
  writeInjectedMcpConfig
297
- } from "./chunk-VHTIHOHE.js";
297
+ } from "./chunk-WWH4NNBH.js";
298
298
  import {
299
299
  brightsyMcpServerName,
300
300
  connectBrightsyTeam,
@@ -319,7 +319,7 @@ import {
319
319
  listWorkspaces,
320
320
  removeWorkspace,
321
321
  syncWorkspacesFromThreads
322
- } from "./chunk-HC5N3BDL.js";
322
+ } from "./chunk-JHZ6HGRI.js";
323
323
  import {
324
324
  CLOUD_COORDINATOR_BUSY_REPLY,
325
325
  CLOUD_COORDINATOR_STOPPED_REPLY,
@@ -354,7 +354,7 @@ import {
354
354
  stageAbsolutePathsAsAttachments,
355
355
  stageBuffersAsAttachments,
356
356
  takenTeamSlugsForOrchestration
357
- } from "./chunk-R2W7A2UO.js";
357
+ } from "./chunk-IHSR7EVK.js";
358
358
  import {
359
359
  COORDINATOR_TOOL_PLAYBOOK,
360
360
  SLACK_REPLY_FORMATTING,
@@ -363,7 +363,7 @@ import {
363
363
  enrichWorkspacesWithGithub,
364
364
  ensureGlobalCoordinatorCwd,
365
365
  formatWorkspaceInventory
366
- } from "./chunk-UG5N7ET3.js";
366
+ } from "./chunk-SXPTL222.js";
367
367
  import {
368
368
  ABLETIME_MCP_PATH,
369
369
  DEFAULT_ABLETIME_HOST,
@@ -433,6 +433,7 @@ import {
433
433
  codexUnattendedGitConfigArgs,
434
434
  collectTakenTeamSlugs,
435
435
  commitAll,
436
+ countUnpushedVsOrigin,
436
437
  createExistingBranchWorktree,
437
438
  createOrUpdatePr,
438
439
  createThreadWorktree,
@@ -441,6 +442,8 @@ import {
441
442
  detectLocalMergeConflicts,
442
443
  ensureGhPreferOrigin,
443
444
  extractGhErrorDetail,
445
+ fastForwardMainCheckoutIfSafe,
446
+ fetchOriginForWorktree,
444
447
  fetchPrHead,
445
448
  formatGhLandError,
446
449
  formatGitAuthModeDirective,
@@ -468,11 +471,13 @@ import {
468
471
  listPrs,
469
472
  listWorktrees,
470
473
  lookupSoccerTeam,
474
+ markPrReady,
471
475
  mergeAgentGitAuthEnv,
472
476
  mergePr,
473
477
  mergePrStack,
474
478
  nonInteractiveGitProcessEnv,
475
479
  normalizeWorktreePath,
480
+ originFetchBranch,
476
481
  originGhRepoEnv,
477
482
  parseGhStackViewJson,
478
483
  parseGithubSlugFromRemoteUrl,
@@ -500,7 +505,7 @@ import {
500
505
  worktreeDisplayLabel,
501
506
  worktreeDisplayLabelForGroup,
502
507
  worktreeNameFromPath
503
- } from "./chunk-O3JEC2UJ.js";
508
+ } from "./chunk-YP3CSOZ6.js";
504
509
  import {
505
510
  ATTACHMENTS_DIR,
506
511
  LEGACY_ATTACHMENTS_DIR,
@@ -6563,6 +6568,7 @@ export {
6563
6568
  coordinatorTurnReminder,
6564
6569
  copyConfiguredFiles,
6565
6570
  countCacheControlBlocks,
6571
+ countUnpushedVsOrigin,
6566
6572
  cowboyModeEnabled,
6567
6573
  createAbleTimeTask,
6568
6574
  createChatTab,
@@ -6622,6 +6628,8 @@ export {
6622
6628
  extractPendingPlanQuestions,
6623
6629
  extractPresentedPlan,
6624
6630
  extractiveSummary,
6631
+ fastForwardMainCheckoutIfSafe,
6632
+ fetchOriginForWorktree,
6625
6633
  fetchPrHead,
6626
6634
  finalizeParts,
6627
6635
  findConventionSetup,
@@ -6832,6 +6840,7 @@ export {
6832
6840
  loginAgent,
6833
6841
  lookupSoccerTeam,
6834
6842
  mapAbleTimeTask,
6843
+ markPrReady,
6835
6844
  maxConcurrentAgents,
6836
6845
  maybeCompactContext,
6837
6846
  mcpAllowTools,
@@ -6863,6 +6872,7 @@ export {
6863
6872
  orchestrationQuotaOnLimit,
6864
6873
  orchestrationTitleNeedsSoccerNickname,
6865
6874
  orchestratorSessionPoisonedByBuiltins,
6875
+ originFetchBranch,
6866
6876
  originGhRepoEnv,
6867
6877
  packagedDetachedJobPath,
6868
6878
  parseCursorRunnerLine,
@@ -4784,12 +4784,15 @@ __export(worktree_exports, {
4784
4784
  canonicalizeRepoPath: () => canonicalizeRepoPath,
4785
4785
  collectTakenTeamSlugs: () => collectTakenTeamSlugs,
4786
4786
  commitAll: () => commitAll,
4787
+ countUnpushedVsOrigin: () => countUnpushedVsOrigin,
4787
4788
  createExistingBranchWorktree: () => createExistingBranchWorktree,
4788
4789
  createOrUpdatePr: () => createOrUpdatePr,
4789
4790
  createThreadWorktree: () => createThreadWorktree,
4790
4791
  currentBranch: () => currentBranch,
4791
4792
  detectLocalMergeConflicts: () => detectLocalMergeConflicts,
4792
4793
  ensureGhPreferOrigin: () => ensureGhPreferOrigin,
4794
+ fastForwardMainCheckoutIfSafe: () => fastForwardMainCheckoutIfSafe,
4795
+ fetchOriginForWorktree: () => fetchOriginForWorktree,
4793
4796
  fetchPrHead: () => fetchPrHead,
4794
4797
  getPr: () => getPr,
4795
4798
  getPrChecks: () => getPrChecks,
@@ -4807,8 +4810,10 @@ __export(worktree_exports, {
4807
4810
  listPrs: () => listPrs,
4808
4811
  listWorktrees: () => listWorktrees,
4809
4812
  lookupSoccerTeam: () => lookupSoccerTeam,
4813
+ markPrReady: () => markPrReady,
4810
4814
  mergePr: () => mergePr,
4811
4815
  normalizeWorktreePath: () => normalizeWorktreePath,
4816
+ originFetchBranch: () => originFetchBranch,
4812
4817
  originGhRepoEnv: () => originGhRepoEnv,
4813
4818
  parseGithubSlugFromRemoteUrl: () => parseGithubSlugFromRemoteUrl,
4814
4819
  pushBranch: () => pushBranch,
@@ -5587,45 +5592,128 @@ async function resolveWorktreeStartPoint(repoPath, sourceRef) {
5587
5592
  function isLocalPrFetchBranch(ref) {
5588
5593
  return /^sideboard-pr-\d+$/.test(ref.trim());
5589
5594
  }
5590
- async function createThreadWorktree(opts) {
5591
- let branchName = `thread/${opts.slug}`;
5592
- const worktreePath = (0, import_node_path17.join)(worktreesRoot(opts.repoPath), opts.slug);
5593
- if ((0, import_node_fs14.existsSync)(worktreePath)) {
5594
- throw new Error(`Worktree already exists at ${worktreePath}`);
5595
+ function originFetchBranch(sourceRef) {
5596
+ const ref = sourceRef.trim();
5597
+ if (!ref || isLocalPrFetchBranch(ref)) return null;
5598
+ if (ref.startsWith("refs/remotes/origin/")) {
5599
+ return ref.slice("refs/remotes/origin/".length) || null;
5595
5600
  }
5596
- await ensureGhPreferOrigin(opts.repoPath);
5597
- let startPoint = null;
5601
+ if (ref.startsWith("refs/heads/")) {
5602
+ return ref.slice("refs/heads/".length) || null;
5603
+ }
5604
+ if (ref.startsWith("refs/")) return null;
5605
+ if (ref.startsWith("origin/")) return ref.slice("origin/".length) || null;
5606
+ return ref;
5607
+ }
5608
+ async function fetchOriginWithAuth(repoPath, args, timeoutMs) {
5609
+ const first = await git(args, repoPath, { reject: false, timeoutMs });
5610
+ if (first.exitCode === 0) return true;
5611
+ let mode;
5598
5612
  try {
5599
- startPoint = await resolveWorktreeStartPoint(opts.repoPath, opts.sourceRef);
5613
+ mode = getGithubGitAuthMode();
5600
5614
  } catch {
5601
- startPoint = null;
5615
+ return false;
5602
5616
  }
5603
- if (!isLocalPrFetchBranch(opts.sourceRef)) {
5604
- const fetchTimeoutMs = startPoint ? 12e3 : 45e3;
5605
- await git(["fetch", "origin", "--prune"], opts.repoPath, {
5606
- reject: false,
5607
- timeoutMs: fetchTimeoutMs
5617
+ if (mode === "ssh") return false;
5618
+ const token = await resolveGithubAgentToken(mode, repoPath);
5619
+ if (!token) return false;
5620
+ const tryHttps = async (header) => git(args, repoPath, {
5621
+ reject: false,
5622
+ timeoutMs,
5623
+ env: { GIT_TERMINAL_PROMPT: "0" },
5624
+ config: {
5625
+ "url.https://github.com/.insteadOf": "git@github.com:",
5626
+ "http.extraHeader": header
5627
+ }
5628
+ });
5629
+ const bearer = await tryHttps(`AUTHORIZATION: bearer ${token}`);
5630
+ if (bearer.exitCode === 0) return true;
5631
+ const basic = Buffer.from(`x-access-token:${token}`, "utf8").toString("base64");
5632
+ const basicFetch = await tryHttps(`Authorization: Basic ${basic}`);
5633
+ return basicFetch.exitCode === 0;
5634
+ }
5635
+ async function fetchOriginForWorktree(repoPath, sourceRef, opts) {
5636
+ const timeoutMs = opts?.timeoutMs ?? 2e4;
5637
+ const branch = originFetchBranch(sourceRef);
5638
+ if (!branch) return false;
5639
+ const tipOk = await fetchOriginWithAuth(
5640
+ repoPath,
5641
+ ["fetch", "origin", branch],
5642
+ timeoutMs
5643
+ );
5644
+ await fetchOriginWithAuth(repoPath, ["fetch", "origin", "--prune"], timeoutMs);
5645
+ return tipOk;
5646
+ }
5647
+ async function fastForwardMainCheckoutIfSafe(repoPath, opts) {
5648
+ try {
5649
+ const branch = opts?.branch?.trim() || await resolveDefaultBranch(repoPath, { network: false });
5650
+ const head = await git(["rev-parse", "--abbrev-ref", "HEAD"], repoPath, {
5651
+ reject: false
5608
5652
  });
5609
- if (!opts.sourceRef.startsWith("origin/") && !opts.sourceRef.startsWith("refs/")) {
5610
- await git(["fetch", "origin", opts.sourceRef], opts.repoPath, {
5611
- reject: false,
5612
- timeoutMs: fetchTimeoutMs
5613
- });
5653
+ const current = head.stdout.trim();
5654
+ if (head.exitCode !== 0 || !current || current === "HEAD" || current !== branch) {
5655
+ return { updated: false, reason: "not-on-default" };
5614
5656
  }
5615
- try {
5616
- startPoint = await resolveWorktreeStartPoint(
5617
- opts.repoPath,
5618
- opts.sourceRef
5619
- );
5620
- } catch (err) {
5621
- if (!startPoint) throw err;
5657
+ if (await isDirty(repoPath)) {
5658
+ return { updated: false, reason: "dirty" };
5622
5659
  }
5623
- }
5624
- if (!startPoint) {
5625
- throw new Error(
5626
- `Invalid git reference: ${opts.sourceRef} (and fetch did not resolve it)`
5660
+ const remote = `origin/${branch}`;
5661
+ const remoteOk = await git(["rev-parse", "--verify", remote], repoPath, {
5662
+ reject: false
5663
+ });
5664
+ if (remoteOk.exitCode !== 0) {
5665
+ return { updated: false, reason: "no-origin-tip" };
5666
+ }
5667
+ const ancestor = await git(
5668
+ ["merge-base", "--is-ancestor", "HEAD", remote],
5669
+ repoPath,
5670
+ { reject: false }
5671
+ );
5672
+ if (ancestor.exitCode !== 0) {
5673
+ return { updated: false, reason: "diverged" };
5674
+ }
5675
+ const behind = await git(
5676
+ ["rev-list", "--count", `HEAD..${remote}`],
5677
+ repoPath,
5678
+ { reject: false }
5627
5679
  );
5680
+ const n = Number(behind.stdout.trim());
5681
+ if (behind.exitCode !== 0 || !Number.isFinite(n) || n <= 0) {
5682
+ return { updated: false, reason: "already-current" };
5683
+ }
5684
+ const ff = await git(["merge", "--ff-only", remote], repoPath, {
5685
+ reject: false
5686
+ });
5687
+ if (ff.exitCode !== 0) {
5688
+ return { updated: false, reason: "ff-failed" };
5689
+ }
5690
+ return { updated: true, reason: "updated" };
5691
+ } catch {
5692
+ return { updated: false, reason: "ff-failed" };
5628
5693
  }
5694
+ }
5695
+ async function refreshOriginAndMaybeFastForwardMain(repoPath, sourceRef) {
5696
+ if (!isLocalPrFetchBranch(sourceRef)) {
5697
+ await fetchOriginForWorktree(repoPath, sourceRef);
5698
+ }
5699
+ const def = await resolveDefaultBranch(repoPath, { network: false });
5700
+ if (originFetchBranch(sourceRef) !== def) {
5701
+ await fetchOriginForWorktree(repoPath, def);
5702
+ }
5703
+ await fastForwardMainCheckoutIfSafe(repoPath, { branch: def });
5704
+ }
5705
+ async function createThreadWorktree(opts) {
5706
+ let branchName = `thread/${opts.slug}`;
5707
+ const worktreePath = (0, import_node_path17.join)(worktreesRoot(opts.repoPath), opts.slug);
5708
+ if ((0, import_node_fs14.existsSync)(worktreePath)) {
5709
+ throw new Error(`Worktree already exists at ${worktreePath}`);
5710
+ }
5711
+ await ensureGhPreferOrigin(opts.repoPath);
5712
+ await refreshOriginAndMaybeFastForwardMain(opts.repoPath, opts.sourceRef);
5713
+ const startPoint = await resolveWorktreeStartPoint(
5714
+ opts.repoPath,
5715
+ opts.sourceRef
5716
+ );
5629
5717
  const added = await withRepoGitLock(opts.repoPath, async () => {
5630
5718
  const add = await git(
5631
5719
  ["worktree", "add", "-b", branchName, worktreePath, startPoint],
@@ -5662,10 +5750,7 @@ async function createExistingBranchWorktree(opts) {
5662
5750
  throw new Error(`Worktree already exists at ${worktreePath}`);
5663
5751
  }
5664
5752
  await ensureGhPreferOrigin(opts.repoPath);
5665
- await git(["fetch", "origin", "--prune"], opts.repoPath, { reject: false });
5666
- if (!branchName.startsWith("origin/") && !branchName.startsWith("refs/")) {
5667
- await git(["fetch", "origin", branchName], opts.repoPath, { reject: false });
5668
- }
5753
+ await refreshOriginAndMaybeFastForwardMain(opts.repoPath, branchName);
5669
5754
  const existing = await listWorktrees(opts.repoPath);
5670
5755
  const already = existing.find((w) => w.branch === branchName);
5671
5756
  if (already?.path) {
@@ -5731,6 +5816,32 @@ async function listWorktrees(repoPath) {
5731
5816
  if (current) entries.push(current);
5732
5817
  return entries;
5733
5818
  }
5819
+ async function countUnpushedVsOrigin(worktreePath) {
5820
+ const head = await git(["rev-parse", "--abbrev-ref", "HEAD"], worktreePath, {
5821
+ reject: false
5822
+ });
5823
+ const branch = head.stdout.trim();
5824
+ if (branch && branch !== "HEAD") {
5825
+ const remote = await git(
5826
+ ["rev-list", "--count", `origin/${branch}..HEAD`],
5827
+ worktreePath,
5828
+ { reject: false }
5829
+ );
5830
+ if (remote.exitCode === 0) {
5831
+ const n = Number(remote.stdout.trim());
5832
+ return Number.isFinite(n) ? n : 1;
5833
+ }
5834
+ const all = await git(["rev-list", "--count", "HEAD"], worktreePath, {
5835
+ reject: false
5836
+ });
5837
+ if (all.exitCode === 0) {
5838
+ const n = Number(all.stdout.trim());
5839
+ if (Number.isFinite(n) && n > 0) return n;
5840
+ }
5841
+ return 1;
5842
+ }
5843
+ return 1;
5844
+ }
5734
5845
  async function isDirty(worktreePath) {
5735
5846
  const { stdout } = await git(["status", "--porcelain"], worktreePath);
5736
5847
  for (const line of stdout.split("\n")) {
@@ -5794,6 +5905,54 @@ async function pushBranch(worktreePath, branchName) {
5794
5905
  const httpsErr = (basicPush.stderr || bearer.stderr || bearer.stdout).trim();
5795
5906
  throw new Error(httpsErr || sshErr || `git push origin ${branchName} failed`);
5796
5907
  }
5908
+ async function runPrReady(cwd, selector, slug) {
5909
+ const readyArgs = ["pr", "ready", selector];
5910
+ if (slug) readyArgs.push("--repo", slug);
5911
+ const ready = await gh(readyArgs, cwd, { reject: false });
5912
+ if (ready.exitCode !== 0) {
5913
+ throw new Error(
5914
+ ready.stderr.trim() || ready.stdout.trim() || "Could not mark draft pull request as ready"
5915
+ );
5916
+ }
5917
+ }
5918
+ async function markPrReady(cwd, selector) {
5919
+ const slug = await resolveGithubRepoSlug(cwd);
5920
+ const viewArgs = ["pr", "view", selector, "--json", "url,state,isDraft"];
5921
+ if (slug) viewArgs.push("--repo", slug);
5922
+ const before = await gh(viewArgs, cwd, { reject: false });
5923
+ if (before.exitCode !== 0 || !before.stdout.trim()) {
5924
+ throw new Error(before.stderr.trim() || "Could not load pull request");
5925
+ }
5926
+ let url = "";
5927
+ let state = "";
5928
+ let isDraft = false;
5929
+ try {
5930
+ const parsed = JSON.parse(before.stdout);
5931
+ url = String(parsed.url ?? "");
5932
+ state = String(parsed.state ?? "").toUpperCase();
5933
+ isDraft = Boolean(parsed.isDraft);
5934
+ } catch {
5935
+ throw new Error("Could not parse pull request details");
5936
+ }
5937
+ if (state === "MERGED" || state === "CLOSED") {
5938
+ return { url, state, isDraft: false };
5939
+ }
5940
+ if (isDraft) {
5941
+ if (await isDirty(cwd)) {
5942
+ throw new Error(
5943
+ "Commit and push local work before marking the pull request ready for review."
5944
+ );
5945
+ }
5946
+ const unpushed = await countUnpushedVsOrigin(cwd);
5947
+ if (unpushed > 0) {
5948
+ throw new Error(
5949
+ "Push this branch to origin before marking the pull request ready for review."
5950
+ );
5951
+ }
5952
+ await runPrReady(cwd, selector, slug);
5953
+ }
5954
+ return { url, state: state || "OPEN", isDraft: false };
5955
+ }
5797
5956
  async function mergePr(cwd, selector, opts) {
5798
5957
  const slug = await resolveGithubRepoSlug(cwd);
5799
5958
  const viewArgs = ["pr", "view", selector, "--json", "url,state,isDraft,number"];
@@ -5828,14 +5987,7 @@ async function mergePr(cwd, selector, opts) {
5828
5987
  return { url, state: "MERGED" };
5829
5988
  }
5830
5989
  if (isDraft) {
5831
- const readyArgs = ["pr", "ready", selector];
5832
- if (slug) readyArgs.push("--repo", slug);
5833
- const ready = await gh(readyArgs, cwd, { reject: false });
5834
- if (ready.exitCode !== 0) {
5835
- throw new Error(
5836
- ready.stderr.trim() || ready.stdout.trim() || "Could not mark draft pull request as ready"
5837
- );
5838
- }
5990
+ await runPrReady(cwd, selector, slug);
5839
5991
  }
5840
5992
  const method = opts?.method ?? "squash";
5841
5993
  const mergeFlag = method === "rebase" ? "--rebase" : method === "merge" ? "--merge" : "--squash";
@@ -13874,6 +14026,8 @@ async function createThread(input, _onSetupLine) {
13874
14026
  `Cowboy mode uses ${defaultBranch} in the project folder. Switch that checkout to ${defaultBranch} first (currently ${head}).`
13875
14027
  );
13876
14028
  }
14029
+ await fetchOriginForWorktree(repoPath, defaultBranch);
14030
+ await fastForwardMainCheckoutIfSafe(repoPath, { branch: defaultBranch });
13877
14031
  const explicitTitle2 = input.title?.trim();
13878
14032
  const thread2 = createEmptyThread({
13879
14033
  title: explicitTitle2 || `Cowboy \xB7 ${head}`,
@@ -18794,6 +18948,32 @@ var init_orchestrator = __esm({
18794
18948
  }
18795
18949
  return result;
18796
18950
  }
18951
+ async markPrReady(threadRef) {
18952
+ const { thread, selectors, cwd } = await this.withPrSelector(threadRef);
18953
+ this.assertNotGlobal(thread, "Ready for review");
18954
+ const selector = selectors[0];
18955
+ if (!selector) throw new Error("No pull request linked to this thread");
18956
+ const result = await markPrReady(cwd, selector);
18957
+ const meta = await getPrMeta(cwd, selector);
18958
+ if (meta) {
18959
+ await this.persistPrMetaAndMaybeArchive(thread, { ...meta, isDraft: false });
18960
+ return { url: meta.url || result.url, state: meta.state || result.state, isDraft: false };
18961
+ }
18962
+ await this.persistPrMetaAndMaybeArchive(thread, {
18963
+ number: 0,
18964
+ title: thread.prTitle ?? thread.title,
18965
+ url: result.url || thread.prUrl || "",
18966
+ state: result.state || "OPEN",
18967
+ isDraft: false,
18968
+ reviewDecision: null,
18969
+ baseRefName: "",
18970
+ headRefName: "",
18971
+ isInMergeQueue: false,
18972
+ mergeable: null,
18973
+ mergeStateStatus: null
18974
+ });
18975
+ return { ...result, isDraft: false };
18976
+ }
18797
18977
  async mergePr(threadRef) {
18798
18978
  const { thread, selectors, cwd } = await this.withPrSelector(threadRef);
18799
18979
  this.assertNotGlobal(thread, "Merge PR");
@@ -32,14 +32,14 @@ import {
32
32
  slackTokenFor,
33
33
  syncBoardPins,
34
34
  updateSchedule
35
- } from "../chunk-OLR4UPP7.js";
35
+ } from "../chunk-KZG47SZP.js";
36
36
  import {
37
37
  listModelsForAgent,
38
38
  sideboardMcpProfile
39
- } from "../chunk-CG25RYQQ.js";
39
+ } from "../chunk-4RYRNJPN.js";
40
40
  import "../chunk-ED4UPEJX.js";
41
41
  import "../chunk-S42XV45P.js";
42
- import "../chunk-4D4PEBGB.js";
42
+ import "../chunk-JW436RTA.js";
43
43
  import {
44
44
  createAbleTimeTask,
45
45
  ensureAbleTimeTask,
@@ -59,8 +59,8 @@ import "../chunk-KLBOWJ74.js";
59
59
  import {
60
60
  GLOBAL_WORKSPACE_ID,
61
61
  isCloudCoordinatorThread
62
- } from "../chunk-FADNFPZO.js";
63
- import "../chunk-OHWN4JEL.js";
62
+ } from "../chunk-KNE3FZ46.js";
63
+ import "../chunk-67K3FRKR.js";
64
64
  import {
65
65
  canonicalizeRepoPath,
66
66
  listBranches,
@@ -68,7 +68,7 @@ import {
68
68
  resolveGithubRepoSlug,
69
69
  resolveRepoRoot,
70
70
  warmGithubAgentAuth
71
- } from "../chunk-4Q45TLZ5.js";
71
+ } from "../chunk-JTPDWTWJ.js";
72
72
  import "../chunk-B3SJXYIJ.js";
73
73
  import "../chunk-EUXOHTUK.js";
74
74
  import {