@sideboard-ai/core 0.1.15 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -49,7 +49,7 @@ interface ThreadMessage {
49
49
  interface ThreadAttachment {
50
50
  id: string;
51
51
  name: string;
52
- kind: 'transcript' | 'file' | 'issue' | 'workspace';
52
+ kind: 'transcript' | 'file' | 'issue' | 'workspace' | 'diff-comment';
53
53
  content: string;
54
54
  }
55
55
  interface Thread {
@@ -695,6 +695,10 @@ type FormatGhLandErrorOptions = {
695
695
  /** Land push already succeeded before PR create failed. Default true for PR-create path. */
696
696
  pushed?: boolean;
697
697
  nowMs?: number;
698
+ /** Repo Sideboard passed to `gh -R` (origin), when known. */
699
+ targetedRepo?: string;
700
+ /** Head ref passed to `gh pr create` (often `owner:branch`). */
701
+ headRef?: string;
698
702
  };
699
703
  /**
700
704
  * Turn noisy `gh pr create` / Execa failures into a short notice for UI/CLI.
@@ -703,16 +707,17 @@ declare function formatGhLandError(raw: string, opts?: FormatGhLandErrorOptions)
703
707
  /** Strip Electron's IPC invoke wrapper, then humanize known gh failures. */
704
708
  declare function formatIpcInvokeError(err: unknown): string;
705
709
 
706
- /**
707
- * Memorable worktree / thread labels (Conductor-style nicknames).
708
- * Slug is the directory + `thread/<slug>` branch; `name` is the UI title.
709
- */
710
710
  interface TeamName {
711
711
  name: string;
712
712
  slug: string;
713
+ /** City / region where the club is based. */
714
+ location: string;
715
+ /** Top competition the club plays in. */
716
+ league: string;
713
717
  }
714
- /** Famous soccer clubs — short, recognizable thread labels. */
715
718
  declare const FAMOUS_SOCCER_TEAMS: readonly TeamName[];
719
+ /** Resolve toast-ready club info from a thread title or worktree slug. */
720
+ declare function lookupSoccerTeam(titleOrSlug: string): TeamName | null;
716
721
  declare function allocateTeamName(taken: Iterable<string>, random?: () => number): TeamName;
717
722
 
718
723
  /** Canonical worktree path for grouping tabs (browser-safe, no node:path). */
@@ -757,7 +762,7 @@ declare function worktreeDisplayLabelForGroup(threads: {
757
762
  declare function slugify(input: string): string;
758
763
  declare function resolveRepoRoot(cwd: string): Promise<string>;
759
764
  /**
760
- * Parse `owner/name` from a git remote URL (SSH or HTTPS).
765
+ * Parse `owner/name` from a git remote URL (SSH, HTTPS, or SSH host aliases).
761
766
  */
762
767
  declare function parseGithubSlugFromRemoteUrl(url: string): string | null;
763
768
  /**
@@ -770,6 +775,21 @@ declare function parseGithubSlugFromRemoteUrl(url: string): string | null;
770
775
  * resolves to upstream — which lists the wrong open PRs in the create modal.
771
776
  */
772
777
  declare function resolveGithubRepoSlug(repoPath: string): Promise<string | null>;
778
+ /** Global `-R owner/repo` args so gh never targets upstream by accident. */
779
+ declare function ghRepoSelectArgs(slug: string): string[];
780
+ /** Same-repo head ref as `owner:branch` (required for reliable `-R` creates). */
781
+ declare function ghHeadRef(slug: string, branch: string): string;
782
+ /**
783
+ * On Makerkit-style checkouts (`origin` product + `upstream` template), `gh`
784
+ * prefers `upstream` → so bare `gh pr create` hits the wrong GitHub repo.
785
+ * Pin the CLI default to `origin` once per repo (shared by all worktrees).
786
+ */
787
+ declare function ensureGhPreferOrigin(cwd: string): Promise<void>;
788
+ /**
789
+ * Env pin so bare `gh` (and agents) target this checkout's **origin**, not
790
+ * Makerkit-style `upstream`. `GH_REPO` is the CLI's documented override.
791
+ */
792
+ declare function originGhRepoEnv(cwd: string): Promise<Record<string, string>>;
773
793
  declare function resolveDefaultBranch(repoPath: string): Promise<string>;
774
794
  /**
775
795
  * Prefer `origin/<branch>` for diff/merge-base so Changes / Land don't inflate
@@ -1189,7 +1209,9 @@ declare function formatRenameBranchDirective(thread: Pick<Thread, 'worktreePath'
1189
1209
  * Mandatory Sideboard isolation + landing guidance — agents must edit the thread
1190
1210
  * worktree and open PRs whose titles/bodies describe the *purpose of the changes*.
1191
1211
  */
1192
- declare function formatWorktreeDirective(thread: Pick<Thread, 'worktreePath' | 'repoPath' | 'branchName'> & Partial<Pick<Thread, 'title' | 'prUrl'>>): string;
1212
+ declare function formatWorktreeDirective(thread: Pick<Thread, 'worktreePath' | 'repoPath' | 'branchName'> & Partial<Pick<Thread, 'title' | 'prUrl'>>, opts?: {
1213
+ githubSlug?: string | null;
1214
+ }): string;
1193
1215
  interface AgentInstructionFile {
1194
1216
  relativePath: string;
1195
1217
  content: string;
@@ -1458,6 +1480,23 @@ declare function expandComposerPrompt(worktreePath: string, prompt: string, opts
1458
1480
  attachments?: ThreadAttachment[];
1459
1481
  }): ExpandResult;
1460
1482
 
1483
+ interface DiffCommentLine {
1484
+ side: 'add' | 'del' | 'context';
1485
+ lineNo: number;
1486
+ text: string;
1487
+ }
1488
+ interface DiffCommentInput {
1489
+ path: string;
1490
+ comment: string;
1491
+ lines: DiffCommentLine[];
1492
+ id?: string;
1493
+ }
1494
+ /**
1495
+ * Build a composer attachment from a Changes/diff line selection + reviewer note.
1496
+ * Expanded into agent context via `expandComposerPrompt` like other attachments.
1497
+ */
1498
+ declare function buildDiffCommentAttachment(input: DiffCommentInput): ThreadAttachment;
1499
+
1461
1500
  interface SummarizeResult {
1462
1501
  summary: string;
1463
1502
  method: 'claude' | 'extractive';
@@ -1840,8 +1879,8 @@ declare function cloneRepoIntoSideboard(opts: {
1840
1879
 
1841
1880
  /**
1842
1881
  * Sideboard MCP server — agent-facing judgment surface.
1843
- * Deliberately excludes ready-for-review confirm_land and purge_thread.
1844
- * Draft PRs are allowed via create_draft_pr.
1882
+ * Deliberately excludes ready-for-review confirm_land, purge_thread, and
1883
+ * host-owned draft PR creation. Orchestrators ask worktree agents to open PRs.
1845
1884
  */
1846
1885
  declare function startMcpServer(): Promise<void>;
1847
1886
 
@@ -2348,4 +2387,4 @@ declare function writeInjectedMcpConfig(opts: {
2348
2387
  includeBrightsy?: boolean;
2349
2388
  }): Promise<string | null>;
2350
2389
 
2351
- export { type ActiveRun, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentInstructionFile, type AgentKind, 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 ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateThreadInput, type CreateWorktreeResult, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorWorktreesConfig, type DevServerHandle, 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, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyMcpAllowedTools, brightsyMcpServerName, buildCachedUserContent, buildClaudeStreamJsonUserMessage, 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, ensureGlobalCoordinatorCwd, ensureWorkspace, estimateMessageChars, estimateThreadChars, expandComposerPrompt, extractGhErrorDetail, extractiveSummary, fetchPrHead, finalizeParts, findInvalidCacheControlTtlOrder, findOrphanWorktrees, findThreadByRef, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, getBrightsySession, getDefaultRunScript, getDiff, getDiffSummary, getGitHubStatus, getIssueSource, getLinearApiKey, getOrchestrator, getPr, getPrChecks, getPrDetails, getPrMeta, getRepoSetupInfo, getRunMode, getRunScript, gh, git, globalAgentCwd, harnessEnvKey, hasConductorHook, hasCursorWorktreeSetup, hasRepoHook, hasWorkspaceHook, healOrchestrationSoccerTitles, importConductorWorkspace, importConductorWorkspaceAsync, initializeGitRepository, inspectGitWorktree, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isLinearConnected, isOrchestratorThread, isPlaceholderBranch, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listConductorWorkspaces, listConnectedBrightsyTeams, listGitHubIssues, listGlobalThreads, listIssues, listLinearIssues, listLinearIssuesDirect, listPrs, listRunScripts, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadRepoSettings, loadWorkspaceSettings, locksDir, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergePr, mergeUsage, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, permissionMode, previewLand, pushBranch, readSkillBody, readThread, readWorktreeFile, readWorktreeInclude, refreshGitHubAuth, removeWorkspace, removeWorktree, repoSlug, requireAgent, resolveClaudeExecutable, resolveConductorCursorAgentId, resolveDefaultBranch, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGithubRepoSlug, resolvePrSelector, resolveRepoRoot, resolveWorktreeStartPoint, run, runArchiveScript, runCloudConnect, runCursorWorktreeSetup, runSetupScript, sameWorktreePath, sanitizeMcpServerName, saveAppSettings, setStatus, settingsSourceLabel, shouldCompactContext, shouldRunWorktreeCleanup, sideboardHomeDir, sideboardReposDir, sideboardWorkspacesDir, slugify, spawnAgentTurn, splitForCompaction, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
2390
+ export { type ActiveRun, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentInstructionFile, type AgentKind, 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 ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateThreadInput, type CreateWorktreeResult, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorWorktreesConfig, 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, 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, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, getBrightsySession, 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, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isLinearConnected, isOrchestratorThread, isPlaceholderBranch, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listConductorWorkspaces, listConnectedBrightsyTeams, listGitHubIssues, listGlobalThreads, listIssues, listLinearIssues, listLinearIssuesDirect, listPrs, listRunScripts, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadRepoSettings, loadWorkspaceSettings, locksDir, lookupSoccerTeam, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergePr, mergeUsage, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, originGhRepoEnv, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, permissionMode, previewLand, pushBranch, readSkillBody, readThread, readWorktreeFile, readWorktreeInclude, refreshGitHubAuth, removeWorkspace, removeWorktree, repoSlug, requireAgent, resolveClaudeExecutable, resolveConductorCursorAgentId, resolveDefaultBranch, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGithubRepoSlug, resolvePrSelector, resolveRepoRoot, resolveWorktreeStartPoint, run, runArchiveScript, runCloudConnect, runCursorWorktreeSetup, runSetupScript, sameWorktreePath, sanitizeMcpServerName, saveAppSettings, setStatus, settingsSourceLabel, shouldCompactContext, shouldRunWorktreeCleanup, sideboardHomeDir, sideboardReposDir, sideboardWorkspacesDir, slugify, spawnAgentTurn, splitForCompaction, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
package/dist/index.d.ts CHANGED
@@ -49,7 +49,7 @@ interface ThreadMessage {
49
49
  interface ThreadAttachment {
50
50
  id: string;
51
51
  name: string;
52
- kind: 'transcript' | 'file' | 'issue' | 'workspace';
52
+ kind: 'transcript' | 'file' | 'issue' | 'workspace' | 'diff-comment';
53
53
  content: string;
54
54
  }
55
55
  interface Thread {
@@ -695,6 +695,10 @@ type FormatGhLandErrorOptions = {
695
695
  /** Land push already succeeded before PR create failed. Default true for PR-create path. */
696
696
  pushed?: boolean;
697
697
  nowMs?: number;
698
+ /** Repo Sideboard passed to `gh -R` (origin), when known. */
699
+ targetedRepo?: string;
700
+ /** Head ref passed to `gh pr create` (often `owner:branch`). */
701
+ headRef?: string;
698
702
  };
699
703
  /**
700
704
  * Turn noisy `gh pr create` / Execa failures into a short notice for UI/CLI.
@@ -703,16 +707,17 @@ declare function formatGhLandError(raw: string, opts?: FormatGhLandErrorOptions)
703
707
  /** Strip Electron's IPC invoke wrapper, then humanize known gh failures. */
704
708
  declare function formatIpcInvokeError(err: unknown): string;
705
709
 
706
- /**
707
- * Memorable worktree / thread labels (Conductor-style nicknames).
708
- * Slug is the directory + `thread/<slug>` branch; `name` is the UI title.
709
- */
710
710
  interface TeamName {
711
711
  name: string;
712
712
  slug: string;
713
+ /** City / region where the club is based. */
714
+ location: string;
715
+ /** Top competition the club plays in. */
716
+ league: string;
713
717
  }
714
- /** Famous soccer clubs — short, recognizable thread labels. */
715
718
  declare const FAMOUS_SOCCER_TEAMS: readonly TeamName[];
719
+ /** Resolve toast-ready club info from a thread title or worktree slug. */
720
+ declare function lookupSoccerTeam(titleOrSlug: string): TeamName | null;
716
721
  declare function allocateTeamName(taken: Iterable<string>, random?: () => number): TeamName;
717
722
 
718
723
  /** Canonical worktree path for grouping tabs (browser-safe, no node:path). */
@@ -757,7 +762,7 @@ declare function worktreeDisplayLabelForGroup(threads: {
757
762
  declare function slugify(input: string): string;
758
763
  declare function resolveRepoRoot(cwd: string): Promise<string>;
759
764
  /**
760
- * Parse `owner/name` from a git remote URL (SSH or HTTPS).
765
+ * Parse `owner/name` from a git remote URL (SSH, HTTPS, or SSH host aliases).
761
766
  */
762
767
  declare function parseGithubSlugFromRemoteUrl(url: string): string | null;
763
768
  /**
@@ -770,6 +775,21 @@ declare function parseGithubSlugFromRemoteUrl(url: string): string | null;
770
775
  * resolves to upstream — which lists the wrong open PRs in the create modal.
771
776
  */
772
777
  declare function resolveGithubRepoSlug(repoPath: string): Promise<string | null>;
778
+ /** Global `-R owner/repo` args so gh never targets upstream by accident. */
779
+ declare function ghRepoSelectArgs(slug: string): string[];
780
+ /** Same-repo head ref as `owner:branch` (required for reliable `-R` creates). */
781
+ declare function ghHeadRef(slug: string, branch: string): string;
782
+ /**
783
+ * On Makerkit-style checkouts (`origin` product + `upstream` template), `gh`
784
+ * prefers `upstream` → so bare `gh pr create` hits the wrong GitHub repo.
785
+ * Pin the CLI default to `origin` once per repo (shared by all worktrees).
786
+ */
787
+ declare function ensureGhPreferOrigin(cwd: string): Promise<void>;
788
+ /**
789
+ * Env pin so bare `gh` (and agents) target this checkout's **origin**, not
790
+ * Makerkit-style `upstream`. `GH_REPO` is the CLI's documented override.
791
+ */
792
+ declare function originGhRepoEnv(cwd: string): Promise<Record<string, string>>;
773
793
  declare function resolveDefaultBranch(repoPath: string): Promise<string>;
774
794
  /**
775
795
  * Prefer `origin/<branch>` for diff/merge-base so Changes / Land don't inflate
@@ -1189,7 +1209,9 @@ declare function formatRenameBranchDirective(thread: Pick<Thread, 'worktreePath'
1189
1209
  * Mandatory Sideboard isolation + landing guidance — agents must edit the thread
1190
1210
  * worktree and open PRs whose titles/bodies describe the *purpose of the changes*.
1191
1211
  */
1192
- declare function formatWorktreeDirective(thread: Pick<Thread, 'worktreePath' | 'repoPath' | 'branchName'> & Partial<Pick<Thread, 'title' | 'prUrl'>>): string;
1212
+ declare function formatWorktreeDirective(thread: Pick<Thread, 'worktreePath' | 'repoPath' | 'branchName'> & Partial<Pick<Thread, 'title' | 'prUrl'>>, opts?: {
1213
+ githubSlug?: string | null;
1214
+ }): string;
1193
1215
  interface AgentInstructionFile {
1194
1216
  relativePath: string;
1195
1217
  content: string;
@@ -1458,6 +1480,23 @@ declare function expandComposerPrompt(worktreePath: string, prompt: string, opts
1458
1480
  attachments?: ThreadAttachment[];
1459
1481
  }): ExpandResult;
1460
1482
 
1483
+ interface DiffCommentLine {
1484
+ side: 'add' | 'del' | 'context';
1485
+ lineNo: number;
1486
+ text: string;
1487
+ }
1488
+ interface DiffCommentInput {
1489
+ path: string;
1490
+ comment: string;
1491
+ lines: DiffCommentLine[];
1492
+ id?: string;
1493
+ }
1494
+ /**
1495
+ * Build a composer attachment from a Changes/diff line selection + reviewer note.
1496
+ * Expanded into agent context via `expandComposerPrompt` like other attachments.
1497
+ */
1498
+ declare function buildDiffCommentAttachment(input: DiffCommentInput): ThreadAttachment;
1499
+
1461
1500
  interface SummarizeResult {
1462
1501
  summary: string;
1463
1502
  method: 'claude' | 'extractive';
@@ -1840,8 +1879,8 @@ declare function cloneRepoIntoSideboard(opts: {
1840
1879
 
1841
1880
  /**
1842
1881
  * Sideboard MCP server — agent-facing judgment surface.
1843
- * Deliberately excludes ready-for-review confirm_land and purge_thread.
1844
- * Draft PRs are allowed via create_draft_pr.
1882
+ * Deliberately excludes ready-for-review confirm_land, purge_thread, and
1883
+ * host-owned draft PR creation. Orchestrators ask worktree agents to open PRs.
1845
1884
  */
1846
1885
  declare function startMcpServer(): Promise<void>;
1847
1886
 
@@ -2348,4 +2387,4 @@ declare function writeInjectedMcpConfig(opts: {
2348
2387
  includeBrightsy?: boolean;
2349
2388
  }): Promise<string | null>;
2350
2389
 
2351
- export { type ActiveRun, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentInstructionFile, type AgentKind, 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 ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateThreadInput, type CreateWorktreeResult, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorWorktreesConfig, type DevServerHandle, 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, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyMcpAllowedTools, brightsyMcpServerName, buildCachedUserContent, buildClaudeStreamJsonUserMessage, 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, ensureGlobalCoordinatorCwd, ensureWorkspace, estimateMessageChars, estimateThreadChars, expandComposerPrompt, extractGhErrorDetail, extractiveSummary, fetchPrHead, finalizeParts, findInvalidCacheControlTtlOrder, findOrphanWorktrees, findThreadByRef, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, getBrightsySession, getDefaultRunScript, getDiff, getDiffSummary, getGitHubStatus, getIssueSource, getLinearApiKey, getOrchestrator, getPr, getPrChecks, getPrDetails, getPrMeta, getRepoSetupInfo, getRunMode, getRunScript, gh, git, globalAgentCwd, harnessEnvKey, hasConductorHook, hasCursorWorktreeSetup, hasRepoHook, hasWorkspaceHook, healOrchestrationSoccerTitles, importConductorWorkspace, importConductorWorkspaceAsync, initializeGitRepository, inspectGitWorktree, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isLinearConnected, isOrchestratorThread, isPlaceholderBranch, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listConductorWorkspaces, listConnectedBrightsyTeams, listGitHubIssues, listGlobalThreads, listIssues, listLinearIssues, listLinearIssuesDirect, listPrs, listRunScripts, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadRepoSettings, loadWorkspaceSettings, locksDir, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergePr, mergeUsage, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, permissionMode, previewLand, pushBranch, readSkillBody, readThread, readWorktreeFile, readWorktreeInclude, refreshGitHubAuth, removeWorkspace, removeWorktree, repoSlug, requireAgent, resolveClaudeExecutable, resolveConductorCursorAgentId, resolveDefaultBranch, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGithubRepoSlug, resolvePrSelector, resolveRepoRoot, resolveWorktreeStartPoint, run, runArchiveScript, runCloudConnect, runCursorWorktreeSetup, runSetupScript, sameWorktreePath, sanitizeMcpServerName, saveAppSettings, setStatus, settingsSourceLabel, shouldCompactContext, shouldRunWorktreeCleanup, sideboardHomeDir, sideboardReposDir, sideboardWorkspacesDir, slugify, spawnAgentTurn, splitForCompaction, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
2390
+ export { type ActiveRun, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentInstructionFile, type AgentKind, 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 ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateThreadInput, type CreateWorktreeResult, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorWorktreesConfig, 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, 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, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, getBrightsySession, 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, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isLinearConnected, isOrchestratorThread, isPlaceholderBranch, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listConductorWorkspaces, listConnectedBrightsyTeams, listGitHubIssues, listGlobalThreads, listIssues, listLinearIssues, listLinearIssuesDirect, listPrs, listRunScripts, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadRepoSettings, loadWorkspaceSettings, locksDir, lookupSoccerTeam, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergePr, mergeUsage, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, originGhRepoEnv, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, permissionMode, previewLand, pushBranch, readSkillBody, readThread, readWorktreeFile, readWorktreeInclude, refreshGitHubAuth, removeWorkspace, removeWorktree, repoSlug, requireAgent, resolveClaudeExecutable, resolveConductorCursorAgentId, resolveDefaultBranch, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGithubRepoSlug, resolvePrSelector, resolveRepoRoot, resolveWorktreeStartPoint, run, runArchiveScript, runCloudConnect, runCursorWorktreeSetup, runSetupScript, sameWorktreePath, sanitizeMcpServerName, saveAppSettings, setStatus, settingsSourceLabel, shouldCompactContext, shouldRunWorktreeCleanup, sideboardHomeDir, sideboardReposDir, sideboardWorkspacesDir, slugify, spawnAgentTurn, splitForCompaction, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
package/dist/index.js CHANGED
@@ -93,14 +93,14 @@ import {
93
93
  withAgentInstructions,
94
94
  worktreeCleanupSettings,
95
95
  writeWorktreeFile
96
- } from "./chunk-MAWKQA2Y.js";
96
+ } from "./chunk-ULFES3M5.js";
97
97
  import {
98
98
  addWorkspace,
99
99
  ensureWorkspace,
100
100
  listWorkspaces,
101
101
  removeWorkspace,
102
102
  syncWorkspacesFromThreads
103
- } from "./chunk-MGSJQMJA.js";
103
+ } from "./chunk-PER4N6LS.js";
104
104
  import {
105
105
  CLOUD_COORDINATOR_BUSY_REPLY,
106
106
  CLOUD_COORDINATOR_STOPPED_REPLY,
@@ -120,7 +120,7 @@ import {
120
120
  orchestratorSessionPoisonedByBuiltins,
121
121
  parseForceStopMessage,
122
122
  takenTeamSlugsForOrchestration
123
- } from "./chunk-3OJG4LP4.js";
123
+ } from "./chunk-Y2EWQ4TL.js";
124
124
  import {
125
125
  COORDINATOR_TOOL_PLAYBOOK,
126
126
  coordinatorSystemPrompt,
@@ -128,7 +128,7 @@ import {
128
128
  enrichWorkspacesWithGithub,
129
129
  ensureGlobalCoordinatorCwd,
130
130
  formatWorkspaceInventory
131
- } from "./chunk-TNIAXABV.js";
131
+ } from "./chunk-BMB7WCGF.js";
132
132
  import {
133
133
  BRIGHTSY_MCP_ALLOWED_TOOLS,
134
134
  MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS,
@@ -158,7 +158,7 @@ import {
158
158
  permissionMode,
159
159
  sanitizeMcpServerName,
160
160
  writeInjectedMcpConfig
161
- } from "./chunk-MEI4AXV4.js";
161
+ } from "./chunk-V54GKKCI.js";
162
162
  import {
163
163
  brightsyConfigPath,
164
164
  brightsyMcpServerName,
@@ -216,6 +216,7 @@ import {
216
216
  createThreadWorktree,
217
217
  currentBranch,
218
218
  detectLocalMergeConflicts,
219
+ ensureGhPreferOrigin,
219
220
  extractGhErrorDetail,
220
221
  fetchPrHead,
221
222
  formatGhLandError,
@@ -225,14 +226,18 @@ import {
225
226
  getPrChecks,
226
227
  getPrDetails,
227
228
  getPrMeta,
229
+ ghHeadRef,
230
+ ghRepoSelectArgs,
228
231
  isDirty,
229
232
  isGhRateLimitError,
230
233
  isPlaceholderBranch,
231
234
  listBranches,
232
235
  listPrs,
233
236
  listWorktrees,
237
+ lookupSoccerTeam,
234
238
  mergePr,
235
239
  normalizeWorktreePath,
240
+ originGhRepoEnv,
236
241
  parseGithubSlugFromRemoteUrl,
237
242
  pushBranch,
238
243
  removeWorktree,
@@ -248,7 +253,7 @@ import {
248
253
  worktreeDisplayLabel,
249
254
  worktreeDisplayLabelForGroup,
250
255
  worktreeNameFromPath
251
- } from "./chunk-L44AX7IG.js";
256
+ } from "./chunk-UFWEANLU.js";
252
257
  import {
253
258
  appendMessage,
254
259
  createEmptyThread,
@@ -338,6 +343,53 @@ async function refreshGitHubAuth() {
338
343
  return getGitHubStatus();
339
344
  }
340
345
 
346
+ // src/composer/diff-comment.ts
347
+ function lineRangeLabel(lines) {
348
+ const nos = lines.map((l) => l.lineNo);
349
+ const start = Math.min(...nos);
350
+ const end = Math.max(...nos);
351
+ return start === end ? `L${start}` : `L${start}-${end}`;
352
+ }
353
+ function formatDiffBody(lines) {
354
+ return lines.map((l) => {
355
+ const prefix = l.side === "add" ? "+" : l.side === "del" ? "-" : " ";
356
+ return `${prefix}${l.text}`;
357
+ }).join("\n");
358
+ }
359
+ function buildDiffCommentAttachment(input) {
360
+ const comment = input.comment.trim();
361
+ if (!input.path.trim()) {
362
+ throw new Error("diff comment requires a file path");
363
+ }
364
+ if (!comment) {
365
+ throw new Error("diff comment requires a note");
366
+ }
367
+ if (input.lines.length === 0) {
368
+ throw new Error("diff comment requires at least one cited line");
369
+ }
370
+ const range = lineRangeLabel(input.lines);
371
+ const name = `${input.path}:${range}`;
372
+ const content = [
373
+ `Diff review comment on \`${input.path}\` (${range}).`,
374
+ "",
375
+ "Address this feedback on the cited lines. Prefer a precise fix over rewriting unrelated code.",
376
+ "",
377
+ "### Reviewer comment",
378
+ comment,
379
+ "",
380
+ "### Cited diff",
381
+ "```diff",
382
+ formatDiffBody(input.lines),
383
+ "```"
384
+ ].join("\n");
385
+ return {
386
+ id: input.id ?? `diff-comment-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
387
+ name,
388
+ kind: "diff-comment",
389
+ content
390
+ };
391
+ }
392
+
341
393
  // src/brightsy/api.ts
342
394
  function formatBrightsyFetchError(err, url) {
343
395
  if (!(err instanceof Error)) return `${String(err)} (${url})`;
@@ -710,6 +762,7 @@ export {
710
762
  brightsyMcpServerName,
711
763
  buildCachedUserContent,
712
764
  buildClaudeStreamJsonUserMessage,
765
+ buildDiffCommentAttachment,
713
766
  buildForkTranscriptAttachment,
714
767
  buildSessionSeed,
715
768
  buildWorkspaceScriptEnv,
@@ -753,6 +806,7 @@ export {
753
806
  enrichWorkspacesWithGithub,
754
807
  ensureAgentPath,
755
808
  ensureCloudCoordinator,
809
+ ensureGhPreferOrigin,
756
810
  ensureGlobalCoordinatorCwd,
757
811
  ensureWorkspace,
758
812
  estimateMessageChars,
@@ -796,6 +850,8 @@ export {
796
850
  getRunMode,
797
851
  getRunScript,
798
852
  gh,
853
+ ghHeadRef,
854
+ ghRepoSelectArgs,
799
855
  git,
800
856
  globalAgentCwd,
801
857
  harnessEnvKey,
@@ -842,6 +898,7 @@ export {
842
898
  loadRepoSettings,
843
899
  loadWorkspaceSettings,
844
900
  locksDir,
901
+ lookupSoccerTeam,
845
902
  maxConcurrentAgents,
846
903
  maybeCompactContext,
847
904
  mcpAllowTools,
@@ -855,6 +912,7 @@ export {
855
912
  opencodeAdapter,
856
913
  orchestrationTitleNeedsSoccerNickname,
857
914
  orchestratorSessionPoisonedByBuiltins,
915
+ originGhRepoEnv,
858
916
  parseCursorRunnerLine,
859
917
  parseForceStopMessage,
860
918
  parseGithubSlugFromRemoteUrl,