@sideboard-ai/core 0.1.23 → 0.1.30

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
@@ -51,6 +51,10 @@ interface ThreadAttachment {
51
51
  name: string;
52
52
  kind: 'transcript' | 'file' | 'issue' | 'workspace' | 'diff-comment';
53
53
  content: string;
54
+ /** Worktree-relative path when this attachment is a real file that can be opened in a tab. */
55
+ path?: string;
56
+ /** data: URL thumbnail for image attachments shown in the composer (pending only). */
57
+ previewDataUrl?: string;
54
58
  }
55
59
  interface Thread {
56
60
  id: string;
@@ -1513,6 +1517,35 @@ interface DiffCommentInput {
1513
1517
  */
1514
1518
  declare function buildDiffCommentAttachment(input: DiffCommentInput): ThreadAttachment;
1515
1519
 
1520
+ declare function isImageFilePath(filePath: string): boolean;
1521
+ /**
1522
+ * Build a composer attachment from an absolute filesystem path (no copy).
1523
+ * Used by the native file picker when no worktree is available yet.
1524
+ */
1525
+ declare function attachmentFromAbsolutePath(absolutePath: string): ThreadAttachment;
1526
+ /**
1527
+ * Copy absolute paths into `.sideboard/attachments/` and return composer attachments
1528
+ * with worktree-relative `path` (and image previews when applicable).
1529
+ */
1530
+ declare function stageAbsolutePathsAsAttachments(worktreePath: string, absolutePaths: string[]): ThreadAttachment[];
1531
+ interface ComposerFileBuffer {
1532
+ name: string;
1533
+ dataBase64: string;
1534
+ }
1535
+ /**
1536
+ * Write in-memory file buffers into `.sideboard/attachments/` (renderer drop
1537
+ * fallback when Electron does not expose a filesystem path).
1538
+ */
1539
+ declare function stageBuffersAsAttachments(worktreePath: string, buffers: ComposerFileBuffer[]): ThreadAttachment[];
1540
+ /**
1541
+ * Build attachments from in-memory buffers without a worktree (create modal).
1542
+ */
1543
+ declare function attachmentsFromBuffers(buffers: ComposerFileBuffer[]): ThreadAttachment[];
1544
+ /**
1545
+ * Attach existing worktree-relative files (e.g. drag from the file tree).
1546
+ */
1547
+ declare function attachmentsFromWorktreePaths(worktreePath: string, relativePaths: string[]): ThreadAttachment[];
1548
+
1516
1549
  interface SummarizeResult {
1517
1550
  summary: string;
1518
1551
  method: 'claude' | 'extractive';
@@ -1832,6 +1865,15 @@ declare class Orchestrator {
1832
1865
  }): Promise<Thread>;
1833
1866
  renameThread(threadRef: string, title: string): Thread;
1834
1867
  setAttachments(threadRef: string, attachments: Thread['attachments']): Thread;
1868
+ /**
1869
+ * Stage OS / worktree files into composer attachments (copies external files
1870
+ * into `.sideboard/attachments/` so agents can Read images and binaries).
1871
+ */
1872
+ attachComposerFiles(threadRef: string, opts: {
1873
+ absolutePaths?: string[];
1874
+ relativePaths?: string[];
1875
+ buffers?: ComposerFileBuffer[];
1876
+ }): ThreadAttachment[];
1835
1877
  listWorktreeChats(threadRef: string): Thread[];
1836
1878
  archive(threadRef: string): Promise<Thread>;
1837
1879
  purge(threadRef: string, opts?: {
@@ -2035,6 +2077,24 @@ interface IpcApi {
2035
2077
  forkThreadWorktree(input: ForkThreadWorktreeInput): Promise<Thread>;
2036
2078
  renameThread(threadRef: string, title: string): Promise<Thread>;
2037
2079
  setAttachments(threadRef: string, attachments: ThreadAttachment[]): Promise<Thread>;
2080
+ /**
2081
+ * Stage dropped/picked files into composer attachments. External files are
2082
+ * copied into `.sideboard/attachments/` in the thread worktree.
2083
+ */
2084
+ attachComposerFiles(threadRef: string, opts: {
2085
+ absolutePaths?: string[];
2086
+ relativePaths?: string[];
2087
+ /** When Electron hides File.path, renderer sends file bytes instead. */
2088
+ buffers?: Array<{
2089
+ name: string;
2090
+ dataBase64: string;
2091
+ }>;
2092
+ }): Promise<ThreadAttachment[]>;
2093
+ /**
2094
+ * Resolve an absolute filesystem path for a File from a drag/drop or picker.
2095
+ * Uses Electron `webUtils.getPathForFile` (File.path is unavailable under contextIsolation).
2096
+ */
2097
+ getPathForFile(file: File): string;
2038
2098
  listWorktreeChats(threadRef: string): Promise<Thread[]>;
2039
2099
  listWorkspaces(): Promise<Workspace[]>;
2040
2100
  addWorkspace(repoPath: string): Promise<Workspace>;
@@ -2216,8 +2276,18 @@ interface IpcApi {
2216
2276
  getRepoPath(): Promise<string>;
2217
2277
  setRepoPath(path: string): Promise<string>;
2218
2278
  pickRepoPath(): Promise<string | null>;
2219
- /** Native file picker; returns attachments ready for the composer. */
2220
- pickFiles(): Promise<ThreadAttachment[]>;
2279
+ /**
2280
+ * Native file picker; returns attachments ready for the composer.
2281
+ * When `threadRef` is set, files are staged into the worktree (same as drop).
2282
+ */
2283
+ pickFiles(threadRef?: string | null): Promise<ThreadAttachment[]>;
2284
+ /** Build composer attachments from absolute paths without a worktree (create modal). */
2285
+ attachmentsFromPaths(absolutePaths: string[]): Promise<ThreadAttachment[]>;
2286
+ /** Build composer attachments from in-memory file buffers (create modal drop fallback). */
2287
+ attachmentsFromBuffers(buffers: Array<{
2288
+ name: string;
2289
+ dataBase64: string;
2290
+ }>): Promise<ThreadAttachment[]>;
2221
2291
  /** Prefer worktree settings; optional main-repo fallback. */
2222
2292
  hasConductorHook(worktreePath: string, repoPath?: string | null): Promise<boolean>;
2223
2293
  getRepoSetupInfo(worktreePath: string, repoPath?: string | null): Promise<{
@@ -2433,4 +2503,4 @@ declare function writeInjectedMcpConfig(opts: {
2433
2503
  includeBrightsy?: boolean;
2434
2504
  }): Promise<string | null>;
2435
2505
 
2436
- 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, formatArtifactDirective, 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, readWorktreeFileForUpload, 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 };
2506
+ 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 ComposerFileBuffer, 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, attachmentFromAbsolutePath, attachmentsFromBuffers, attachmentsFromWorktreePaths, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyMcpAllowedTools, brightsyMcpServerName, buildCachedUserContent, buildClaudeStreamJsonUserMessage, buildDiffCommentAttachment, buildForkTranscriptAttachment, buildSessionSeed, buildWorkspaceScriptEnv, caffeinateWhileCloudConnectEnabled, caffeinateWhileRunningEnabled, captureLoginEnv, captureTurnBaseline, childEnvWithAppSettings, claudeAdapter, claudeChromeEnabled, claudeUserSettingsPath, cleanupOrphanWorktrees, cloneRepoIntoSideboard, codexAdapter, collectTakenTeamSlugs, commitAll, conductorDbPath, confirmLand, connectBrightsyTeam, coordinatorSystemPrompt, coordinatorTurnReminder, copyConfiguredFiles, countCacheControlBlocks, createChatTab, createEmptyThread, createGlobalChat, createOrUpdatePr, createThread, createThreadWorktree, currentBranch, cursorAdapter, cursorSdkMessageToEvents, decodeBrightsyTarget, deleteBranchOnPurgeEnabled, deleteThreadRecord, detectAgents, detectLocalMergeConflicts, disconnectBrightsyTeam, discoverSkills, encodeBrightsyTarget, enrichWorkspacesWithGithub, ensureAgentPath, ensureCloudCoordinator, ensureGhPreferOrigin, ensureGlobalCoordinatorCwd, ensureWorkspace, estimateMessageChars, estimateThreadChars, expandComposerPrompt, extractGhErrorDetail, extractiveSummary, fetchPrHead, finalizeParts, findInvalidCacheControlTtlOrder, findOrphanWorktrees, findThreadByRef, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatArtifactDirective, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, 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, isImageFilePath, 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, readWorktreeFileForUpload, 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, stageAbsolutePathsAsAttachments, stageBuffersAsAttachments, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
package/dist/index.d.ts CHANGED
@@ -51,6 +51,10 @@ interface ThreadAttachment {
51
51
  name: string;
52
52
  kind: 'transcript' | 'file' | 'issue' | 'workspace' | 'diff-comment';
53
53
  content: string;
54
+ /** Worktree-relative path when this attachment is a real file that can be opened in a tab. */
55
+ path?: string;
56
+ /** data: URL thumbnail for image attachments shown in the composer (pending only). */
57
+ previewDataUrl?: string;
54
58
  }
55
59
  interface Thread {
56
60
  id: string;
@@ -1513,6 +1517,35 @@ interface DiffCommentInput {
1513
1517
  */
1514
1518
  declare function buildDiffCommentAttachment(input: DiffCommentInput): ThreadAttachment;
1515
1519
 
1520
+ declare function isImageFilePath(filePath: string): boolean;
1521
+ /**
1522
+ * Build a composer attachment from an absolute filesystem path (no copy).
1523
+ * Used by the native file picker when no worktree is available yet.
1524
+ */
1525
+ declare function attachmentFromAbsolutePath(absolutePath: string): ThreadAttachment;
1526
+ /**
1527
+ * Copy absolute paths into `.sideboard/attachments/` and return composer attachments
1528
+ * with worktree-relative `path` (and image previews when applicable).
1529
+ */
1530
+ declare function stageAbsolutePathsAsAttachments(worktreePath: string, absolutePaths: string[]): ThreadAttachment[];
1531
+ interface ComposerFileBuffer {
1532
+ name: string;
1533
+ dataBase64: string;
1534
+ }
1535
+ /**
1536
+ * Write in-memory file buffers into `.sideboard/attachments/` (renderer drop
1537
+ * fallback when Electron does not expose a filesystem path).
1538
+ */
1539
+ declare function stageBuffersAsAttachments(worktreePath: string, buffers: ComposerFileBuffer[]): ThreadAttachment[];
1540
+ /**
1541
+ * Build attachments from in-memory buffers without a worktree (create modal).
1542
+ */
1543
+ declare function attachmentsFromBuffers(buffers: ComposerFileBuffer[]): ThreadAttachment[];
1544
+ /**
1545
+ * Attach existing worktree-relative files (e.g. drag from the file tree).
1546
+ */
1547
+ declare function attachmentsFromWorktreePaths(worktreePath: string, relativePaths: string[]): ThreadAttachment[];
1548
+
1516
1549
  interface SummarizeResult {
1517
1550
  summary: string;
1518
1551
  method: 'claude' | 'extractive';
@@ -1832,6 +1865,15 @@ declare class Orchestrator {
1832
1865
  }): Promise<Thread>;
1833
1866
  renameThread(threadRef: string, title: string): Thread;
1834
1867
  setAttachments(threadRef: string, attachments: Thread['attachments']): Thread;
1868
+ /**
1869
+ * Stage OS / worktree files into composer attachments (copies external files
1870
+ * into `.sideboard/attachments/` so agents can Read images and binaries).
1871
+ */
1872
+ attachComposerFiles(threadRef: string, opts: {
1873
+ absolutePaths?: string[];
1874
+ relativePaths?: string[];
1875
+ buffers?: ComposerFileBuffer[];
1876
+ }): ThreadAttachment[];
1835
1877
  listWorktreeChats(threadRef: string): Thread[];
1836
1878
  archive(threadRef: string): Promise<Thread>;
1837
1879
  purge(threadRef: string, opts?: {
@@ -2035,6 +2077,24 @@ interface IpcApi {
2035
2077
  forkThreadWorktree(input: ForkThreadWorktreeInput): Promise<Thread>;
2036
2078
  renameThread(threadRef: string, title: string): Promise<Thread>;
2037
2079
  setAttachments(threadRef: string, attachments: ThreadAttachment[]): Promise<Thread>;
2080
+ /**
2081
+ * Stage dropped/picked files into composer attachments. External files are
2082
+ * copied into `.sideboard/attachments/` in the thread worktree.
2083
+ */
2084
+ attachComposerFiles(threadRef: string, opts: {
2085
+ absolutePaths?: string[];
2086
+ relativePaths?: string[];
2087
+ /** When Electron hides File.path, renderer sends file bytes instead. */
2088
+ buffers?: Array<{
2089
+ name: string;
2090
+ dataBase64: string;
2091
+ }>;
2092
+ }): Promise<ThreadAttachment[]>;
2093
+ /**
2094
+ * Resolve an absolute filesystem path for a File from a drag/drop or picker.
2095
+ * Uses Electron `webUtils.getPathForFile` (File.path is unavailable under contextIsolation).
2096
+ */
2097
+ getPathForFile(file: File): string;
2038
2098
  listWorktreeChats(threadRef: string): Promise<Thread[]>;
2039
2099
  listWorkspaces(): Promise<Workspace[]>;
2040
2100
  addWorkspace(repoPath: string): Promise<Workspace>;
@@ -2216,8 +2276,18 @@ interface IpcApi {
2216
2276
  getRepoPath(): Promise<string>;
2217
2277
  setRepoPath(path: string): Promise<string>;
2218
2278
  pickRepoPath(): Promise<string | null>;
2219
- /** Native file picker; returns attachments ready for the composer. */
2220
- pickFiles(): Promise<ThreadAttachment[]>;
2279
+ /**
2280
+ * Native file picker; returns attachments ready for the composer.
2281
+ * When `threadRef` is set, files are staged into the worktree (same as drop).
2282
+ */
2283
+ pickFiles(threadRef?: string | null): Promise<ThreadAttachment[]>;
2284
+ /** Build composer attachments from absolute paths without a worktree (create modal). */
2285
+ attachmentsFromPaths(absolutePaths: string[]): Promise<ThreadAttachment[]>;
2286
+ /** Build composer attachments from in-memory file buffers (create modal drop fallback). */
2287
+ attachmentsFromBuffers(buffers: Array<{
2288
+ name: string;
2289
+ dataBase64: string;
2290
+ }>): Promise<ThreadAttachment[]>;
2221
2291
  /** Prefer worktree settings; optional main-repo fallback. */
2222
2292
  hasConductorHook(worktreePath: string, repoPath?: string | null): Promise<boolean>;
2223
2293
  getRepoSetupInfo(worktreePath: string, repoPath?: string | null): Promise<{
@@ -2433,4 +2503,4 @@ declare function writeInjectedMcpConfig(opts: {
2433
2503
  includeBrightsy?: boolean;
2434
2504
  }): Promise<string | null>;
2435
2505
 
2436
- 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, formatArtifactDirective, 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, readWorktreeFileForUpload, 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 };
2506
+ 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 ComposerFileBuffer, 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, attachmentFromAbsolutePath, attachmentsFromBuffers, attachmentsFromWorktreePaths, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyMcpAllowedTools, brightsyMcpServerName, buildCachedUserContent, buildClaudeStreamJsonUserMessage, buildDiffCommentAttachment, buildForkTranscriptAttachment, buildSessionSeed, buildWorkspaceScriptEnv, caffeinateWhileCloudConnectEnabled, caffeinateWhileRunningEnabled, captureLoginEnv, captureTurnBaseline, childEnvWithAppSettings, claudeAdapter, claudeChromeEnabled, claudeUserSettingsPath, cleanupOrphanWorktrees, cloneRepoIntoSideboard, codexAdapter, collectTakenTeamSlugs, commitAll, conductorDbPath, confirmLand, connectBrightsyTeam, coordinatorSystemPrompt, coordinatorTurnReminder, copyConfiguredFiles, countCacheControlBlocks, createChatTab, createEmptyThread, createGlobalChat, createOrUpdatePr, createThread, createThreadWorktree, currentBranch, cursorAdapter, cursorSdkMessageToEvents, decodeBrightsyTarget, deleteBranchOnPurgeEnabled, deleteThreadRecord, detectAgents, detectLocalMergeConflicts, disconnectBrightsyTeam, discoverSkills, encodeBrightsyTarget, enrichWorkspacesWithGithub, ensureAgentPath, ensureCloudCoordinator, ensureGhPreferOrigin, ensureGlobalCoordinatorCwd, ensureWorkspace, estimateMessageChars, estimateThreadChars, expandComposerPrompt, extractGhErrorDetail, extractiveSummary, fetchPrHead, finalizeParts, findInvalidCacheControlTtlOrder, findOrphanWorktrees, findThreadByRef, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatArtifactDirective, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, 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, isImageFilePath, 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, readWorktreeFileForUpload, 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, stageAbsolutePathsAsAttachments, stageBuffersAsAttachments, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
package/dist/index.js CHANGED
@@ -10,6 +10,9 @@ import {
10
10
  applyAgentEvent,
11
11
  applyCompaction,
12
12
  applyThreadIntoMain,
13
+ attachmentFromAbsolutePath,
14
+ attachmentsFromBuffers,
15
+ attachmentsFromWorktreePaths,
13
16
  buildForkTranscriptAttachment,
14
17
  buildSessionSeed,
15
18
  buildWorkspaceScriptEnv,
@@ -51,6 +54,7 @@ import {
51
54
  initializeGitRepository,
52
55
  inspectGitWorktree,
53
56
  isBrightsyNdjsonLine,
57
+ isImageFilePath,
54
58
  listBranchCommits,
55
59
  listConductorWorkspaces,
56
60
  listGitHubIssues,
@@ -80,6 +84,8 @@ import {
80
84
  shouldRunWorktreeCleanup,
81
85
  spawnAgentTurn,
82
86
  splitForCompaction,
87
+ stageAbsolutePathsAsAttachments,
88
+ stageBuffersAsAttachments,
83
89
  startDevServer,
84
90
  startMcpServer,
85
91
  startOrchestration,
@@ -95,7 +101,7 @@ import {
95
101
  withAgentInstructions,
96
102
  worktreeCleanupSettings,
97
103
  writeWorktreeFile
98
- } from "./chunk-JNMLRJ3D.js";
104
+ } from "./chunk-RPSHBKLW.js";
99
105
  import {
100
106
  addWorkspace,
101
107
  ensureWorkspace,
@@ -388,6 +394,7 @@ function buildDiffCommentAttachment(input) {
388
394
  id: input.id ?? `diff-comment-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
389
395
  name,
390
396
  kind: "diff-comment",
397
+ path: input.path.trim(),
391
398
  content
392
399
  };
393
400
  }
@@ -752,6 +759,9 @@ export {
752
759
  applyAppEnvironment,
753
760
  applyCompaction,
754
761
  applyThreadIntoMain,
762
+ attachmentFromAbsolutePath,
763
+ attachmentsFromBuffers,
764
+ attachmentsFromWorktreePaths,
755
765
  autoCleanupOrphansEnabled,
756
766
  autoRenameBranchEnabled,
757
767
  autoRunAfterSetupEnabled,
@@ -874,6 +884,7 @@ export {
874
884
  isGhRateLimitError,
875
885
  isGlobalRepoPath,
876
886
  isGlobalThread,
887
+ isImageFilePath,
877
888
  isLinearConnected,
878
889
  isOrchestratorThread,
879
890
  isPlaceholderBranch,
@@ -962,6 +973,8 @@ export {
962
973
  slugify,
963
974
  spawnAgentTurn,
964
975
  splitForCompaction,
976
+ stageAbsolutePathsAsAttachments,
977
+ stageBuffersAsAttachments,
965
978
  startDevServer,
966
979
  startMcpServer,
967
980
  startOrchestration,
@@ -4936,11 +4936,11 @@ var init_workspaces = __esm({
4936
4936
  var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
4937
4937
  var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
4938
4938
  var import_zod = require("zod");
4939
- var import_node_path22 = require("path");
4939
+ var import_node_path23 = require("path");
4940
4940
 
4941
4941
  // src/orchestrator/orchestrator.ts
4942
4942
  var import_node_events = require("events");
4943
- var import_node_fs23 = require("fs");
4943
+ var import_node_fs24 = require("fs");
4944
4944
 
4945
4945
  // src/agents/spawn.ts
4946
4946
  var import_node_readline = require("readline");
@@ -6350,12 +6350,16 @@ async function forkThreadWorktree(input, onSetupLine) {
6350
6350
  repoPath: from.repoPath,
6351
6351
  agent: input.agent ?? from.agent,
6352
6352
  autonomy: from.autonomy,
6353
+ model: from.model,
6354
+ fast: from.fast,
6355
+ planMode: from.planMode,
6353
6356
  title: input.title?.trim() || void 0,
6354
- parentThreadId: from.id
6357
+ parentThreadId: from.id,
6358
+ attachments: [attachment]
6355
6359
  },
6356
6360
  onSetupLine
6357
6361
  );
6358
- return updateThread(thread.id, { attachments: [attachment] });
6362
+ return thread;
6359
6363
  }
6360
6364
 
6361
6365
  // src/threads/adopt.ts
@@ -7513,6 +7517,9 @@ function expandComposerPrompt(worktreePath, prompt, opts) {
7513
7517
  parts.push("");
7514
7518
  parts.push(`## Attachment: ${att.name}`);
7515
7519
  parts.push(`Kind: ${att.kind}`);
7520
+ if (att.path) {
7521
+ parts.push(`Path in worktree: \`${att.path}\``);
7522
+ }
7516
7523
  parts.push("");
7517
7524
  parts.push(att.content);
7518
7525
  }
@@ -7555,9 +7562,198 @@ function expandComposerPrompt(worktreePath, prompt, opts) {
7555
7562
  };
7556
7563
  }
7557
7564
 
7558
- // src/agents/instructions.ts
7565
+ // src/composer/stage-files.ts
7559
7566
  var import_node_fs22 = require("fs");
7560
7567
  var import_node_path21 = require("path");
7568
+ var import_node_crypto3 = require("crypto");
7569
+ var IMAGE_EXTENSIONS2 = /* @__PURE__ */ new Set([
7570
+ "png",
7571
+ "jpg",
7572
+ "jpeg",
7573
+ "gif",
7574
+ "webp",
7575
+ "svg",
7576
+ "bmp",
7577
+ "ico"
7578
+ ]);
7579
+ var IMAGE_MIME_BY_EXT = {
7580
+ png: "image/png",
7581
+ jpg: "image/jpeg",
7582
+ jpeg: "image/jpeg",
7583
+ gif: "image/gif",
7584
+ webp: "image/webp",
7585
+ svg: "image/svg+xml",
7586
+ bmp: "image/bmp",
7587
+ ico: "image/x-icon"
7588
+ };
7589
+ var ATTACHMENTS_DIR = ".sideboard/attachments";
7590
+ var ATTACHMENTS_GITIGNORE = `# Sideboard review / composer attachments (local only)
7591
+ *
7592
+ !.gitignore
7593
+ `;
7594
+ var MAX_INLINE_BYTES = 4e5;
7595
+ var MAX_PREVIEW_BYTES = 5e6;
7596
+ function fileExtension(filePath) {
7597
+ const base = (0, import_node_path21.basename)(filePath).toLowerCase();
7598
+ return base.includes(".") ? base.split(".").pop() || "" : "";
7599
+ }
7600
+ function isImageFilePath(filePath) {
7601
+ return IMAGE_EXTENSIONS2.has(fileExtension(filePath));
7602
+ }
7603
+ function imageMimeType(filePath) {
7604
+ return IMAGE_MIME_BY_EXT[fileExtension(filePath)] || "image/png";
7605
+ }
7606
+ function ensureAttachmentsDir(worktreePath) {
7607
+ const dir = (0, import_node_path21.join)(worktreePath, ATTACHMENTS_DIR);
7608
+ (0, import_node_fs22.mkdirSync)(dir, { recursive: true });
7609
+ const gi = (0, import_node_path21.join)(dir, ".gitignore");
7610
+ if (!(0, import_node_fs22.existsSync)(gi)) {
7611
+ (0, import_node_fs22.writeFileSync)(gi, ATTACHMENTS_GITIGNORE, "utf8");
7612
+ }
7613
+ return dir;
7614
+ }
7615
+ function uniqueAttachmentName(dir, originalName) {
7616
+ const safe = originalName.replace(/[/\\]/g, "_") || "file";
7617
+ if (!(0, import_node_fs22.existsSync)((0, import_node_path21.join)(dir, safe))) return safe;
7618
+ const ext = (0, import_node_path21.extname)(safe);
7619
+ const stem = ext ? safe.slice(0, -ext.length) : safe;
7620
+ for (let i = 1; i < 1e4; i++) {
7621
+ const candidate = `${stem}-${i}${ext}`;
7622
+ if (!(0, import_node_fs22.existsSync)((0, import_node_path21.join)(dir, candidate))) return candidate;
7623
+ }
7624
+ return `${stem}-${(0, import_node_crypto3.randomUUID)()}${ext}`;
7625
+ }
7626
+ function previewDataUrlFromBuf(filePath, buf) {
7627
+ if (!isImageFilePath(filePath)) return void 0;
7628
+ if (buf.length > MAX_PREVIEW_BYTES) return void 0;
7629
+ return `data:${imageMimeType(filePath)};base64,${buf.toString("base64")}`;
7630
+ }
7631
+ function attachmentFromBuffer(name, buf, opts) {
7632
+ const previewDataUrl = previewDataUrlFromBuf(name, buf);
7633
+ if (isImageFilePath(name)) {
7634
+ const pathHint = opts.path ? `\`${opts.path}\`` : opts.sourceLabel || name;
7635
+ return {
7636
+ id: (0, import_node_crypto3.randomUUID)(),
7637
+ name,
7638
+ kind: "file",
7639
+ path: opts.path,
7640
+ previewDataUrl,
7641
+ content: [
7642
+ `Image attached: ${pathHint}`,
7643
+ opts.path ? `Use the Read tool on \`${opts.path}\` to view this image.` : "The image is shown in the composer; copy it into the worktree if you need to inspect pixels."
7644
+ ].join("\n")
7645
+ };
7646
+ }
7647
+ if (buf.length > MAX_INLINE_BYTES) {
7648
+ return {
7649
+ id: (0, import_node_crypto3.randomUUID)(),
7650
+ name,
7651
+ kind: "file",
7652
+ path: opts.path,
7653
+ content: opts.path ? `(file too large to attach inline: \`${opts.path}\`, ${buf.length} bytes \u2014 use the Read tool)` : `(file too large to attach inline: ${opts.sourceLabel || name}, ${buf.length} bytes)`
7654
+ };
7655
+ }
7656
+ if (buf.includes(0)) {
7657
+ return {
7658
+ id: (0, import_node_crypto3.randomUUID)(),
7659
+ name,
7660
+ kind: "file",
7661
+ path: opts.path,
7662
+ content: opts.path ? `(binary file at \`${opts.path}\` \u2014 use tools to inspect)` : `(binary file attached by path only: ${opts.sourceLabel || name})`
7663
+ };
7664
+ }
7665
+ return {
7666
+ id: (0, import_node_crypto3.randomUUID)(),
7667
+ name,
7668
+ kind: "file",
7669
+ path: opts.path,
7670
+ content: buf.toString("utf8")
7671
+ };
7672
+ }
7673
+ function stageAbsolutePathsAsAttachments(worktreePath, absolutePaths) {
7674
+ if (absolutePaths.length === 0) return [];
7675
+ const dir = ensureAttachmentsDir(worktreePath);
7676
+ const out = [];
7677
+ for (const abs of absolutePaths) {
7678
+ const originalName = (0, import_node_path21.basename)(abs);
7679
+ try {
7680
+ const st = (0, import_node_fs22.statSync)(abs);
7681
+ if (!st.isFile()) continue;
7682
+ const name = uniqueAttachmentName(dir, originalName);
7683
+ const destAbs = (0, import_node_path21.join)(dir, name);
7684
+ (0, import_node_fs22.copyFileSync)(abs, destAbs);
7685
+ const rel = `${ATTACHMENTS_DIR}/${name}`;
7686
+ const buf = (0, import_node_fs22.readFileSync)(destAbs);
7687
+ out.push(attachmentFromBuffer(name, buf, { path: rel, sourceLabel: abs }));
7688
+ } catch (err) {
7689
+ out.push({
7690
+ id: (0, import_node_crypto3.randomUUID)(),
7691
+ name: originalName,
7692
+ kind: "file",
7693
+ content: `(could not attach ${abs}: ${err instanceof Error ? err.message : String(err)})`
7694
+ });
7695
+ }
7696
+ }
7697
+ return out;
7698
+ }
7699
+ function stageBuffersAsAttachments(worktreePath, buffers) {
7700
+ if (buffers.length === 0) return [];
7701
+ const dir = ensureAttachmentsDir(worktreePath);
7702
+ const out = [];
7703
+ for (const item of buffers) {
7704
+ const originalName = (item.name || "file").replace(/[/\\]/g, "_") || "file";
7705
+ try {
7706
+ const buf = Buffer.from(item.dataBase64, "base64");
7707
+ const name = uniqueAttachmentName(dir, originalName);
7708
+ const destAbs = (0, import_node_path21.join)(dir, name);
7709
+ (0, import_node_fs22.writeFileSync)(destAbs, buf);
7710
+ const rel = `${ATTACHMENTS_DIR}/${name}`;
7711
+ out.push(attachmentFromBuffer(name, buf, { path: rel }));
7712
+ } catch (err) {
7713
+ out.push({
7714
+ id: (0, import_node_crypto3.randomUUID)(),
7715
+ name: originalName,
7716
+ kind: "file",
7717
+ content: `(could not attach ${originalName}: ${err instanceof Error ? err.message : String(err)})`
7718
+ });
7719
+ }
7720
+ }
7721
+ return out;
7722
+ }
7723
+ function attachmentsFromWorktreePaths(worktreePath, relativePaths) {
7724
+ const out = [];
7725
+ for (const rel of relativePaths) {
7726
+ if (!rel || rel.includes("..") || rel.startsWith("/")) {
7727
+ out.push({
7728
+ id: (0, import_node_crypto3.randomUUID)(),
7729
+ name: (0, import_node_path21.basename)(rel) || "file",
7730
+ kind: "file",
7731
+ content: `(invalid path: ${rel})`
7732
+ });
7733
+ continue;
7734
+ }
7735
+ const name = (0, import_node_path21.basename)(rel);
7736
+ try {
7737
+ const abs = (0, import_node_path21.join)(worktreePath, rel);
7738
+ const st = (0, import_node_fs22.statSync)(abs);
7739
+ if (!st.isFile()) continue;
7740
+ const buf = (0, import_node_fs22.readFileSync)(abs);
7741
+ out.push(attachmentFromBuffer(name, buf, { path: rel, sourceLabel: abs }));
7742
+ } catch (err) {
7743
+ out.push({
7744
+ id: (0, import_node_crypto3.randomUUID)(),
7745
+ name,
7746
+ kind: "file",
7747
+ content: `(could not read ${rel}: ${err instanceof Error ? err.message : String(err)})`
7748
+ });
7749
+ }
7750
+ }
7751
+ return out;
7752
+ }
7753
+
7754
+ // src/agents/instructions.ts
7755
+ var import_node_fs23 = require("fs");
7756
+ var import_node_path22 = require("path");
7561
7757
  init_worktree_labels();
7562
7758
  function normPath2(p) {
7563
7759
  return p.replace(/\/+$/, "");
@@ -7671,11 +7867,11 @@ function loadAgentInstructions(worktreePath, agent) {
7671
7867
  const out = [];
7672
7868
  for (const rel of candidates) {
7673
7869
  if (seen.has(rel)) continue;
7674
- const abs = (0, import_node_path21.join)(worktreePath, rel);
7675
- if (!(0, import_node_fs22.existsSync)(abs)) continue;
7870
+ const abs = (0, import_node_path22.join)(worktreePath, rel);
7871
+ if (!(0, import_node_fs23.existsSync)(abs)) continue;
7676
7872
  try {
7677
- if (!(0, import_node_fs22.statSync)(abs).isFile()) continue;
7678
- let content = (0, import_node_fs22.readFileSync)(abs, "utf8");
7873
+ if (!(0, import_node_fs23.statSync)(abs).isFile()) continue;
7874
+ let content = (0, import_node_fs23.readFileSync)(abs, "utf8");
7679
7875
  if (!content.trim()) continue;
7680
7876
  if (content.length > MAX_CHARS_PER_FILE) {
7681
7877
  content = `${content.slice(0, MAX_CHARS_PER_FILE)}
@@ -7801,7 +7997,7 @@ var Orchestrator = class {
7801
7997
  }
7802
7998
  continue;
7803
7999
  }
7804
- if (!(0, import_node_fs23.existsSync)(thread.worktreePath)) {
8000
+ if (!(0, import_node_fs24.existsSync)(thread.worktreePath)) {
7805
8001
  setStatus(thread.id, "broken", "Worktree missing on disk");
7806
8002
  this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
7807
8003
  continue;
@@ -8613,6 +8809,23 @@ var Orchestrator = class {
8613
8809
  setAttachments(threadRef, attachments) {
8614
8810
  return updateThread(this.requireThread(threadRef).id, { attachments });
8615
8811
  }
8812
+ /**
8813
+ * Stage OS / worktree files into composer attachments (copies external files
8814
+ * into `.sideboard/attachments/` so agents can Read images and binaries).
8815
+ */
8816
+ attachComposerFiles(threadRef, opts) {
8817
+ const thread = this.requireThread(threadRef);
8818
+ const fromAbs = stageAbsolutePathsAsAttachments(
8819
+ thread.worktreePath,
8820
+ opts.absolutePaths ?? []
8821
+ );
8822
+ const fromRel = attachmentsFromWorktreePaths(
8823
+ thread.worktreePath,
8824
+ opts.relativePaths ?? []
8825
+ );
8826
+ const fromBuf = stageBuffersAsAttachments(thread.worktreePath, opts.buffers ?? []);
8827
+ return [...fromAbs, ...fromRel, ...fromBuf];
8828
+ }
8616
8829
  listWorktreeChats(threadRef) {
8617
8830
  const thread = this.requireThread(threadRef);
8618
8831
  return threadsSharingWorktree(thread.worktreePath);
@@ -8672,7 +8885,7 @@ var Orchestrator = class {
8672
8885
  updateThread(thread.id, { worktreePath: globalAgentCwd2() });
8673
8886
  return setStatus(thread.id, "idle");
8674
8887
  }
8675
- if (!(0, import_node_fs23.existsSync)(thread.worktreePath)) {
8888
+ if (!(0, import_node_fs24.existsSync)(thread.worktreePath)) {
8676
8889
  const { createThreadWorktree: createThreadWorktree2 } = await Promise.resolve().then(() => (init_worktree(), worktree_exports));
8677
8890
  const { execa: execa7 } = await import("execa");
8678
8891
  const slug = thread.worktreePath.split("/").pop();
@@ -8890,7 +9103,7 @@ async function startMcpServer() {
8890
9103
  async () => {
8891
9104
  const threads = orch.getThreads(true);
8892
9105
  const lines = threads.map((t) => {
8893
- const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path22.basename)(t.repoPath) || t.repoPath;
9106
+ const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path23.basename)(t.repoPath) || t.repoPath;
8894
9107
  return `${t.id.slice(0, 8)} ${t.status.padEnd(9)} ${t.agent.padEnd(8)} ${repo} ${t.sourceType}:${t.sourceRef} ${t.title} sideboard://thread/${t.id}${t.devPort ? ` http://localhost:${t.devPort}` : ""}`;
8895
9108
  });
8896
9109
  return {