@sideboard-ai/core 0.1.38 → 0.1.39

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.
@@ -311,12 +311,20 @@ function diffFromInput(input) {
311
311
  }
312
312
  function parseDiffStat(result) {
313
313
  if (!result) return {};
314
- const plus = result.match(/\+(\d+)/);
315
- const minus = result.match(/-(\d+)/);
316
- if (plus || minus) {
314
+ const paired = result.match(/\+(\d+)\s+-(\d+)/);
315
+ if (paired) {
317
316
  return {
318
- additions: plus ? Number(plus[1]) : void 0,
319
- deletions: minus ? Number(minus[1]) : void 0
317
+ additions: Number(paired[1]),
318
+ deletions: Number(paired[2])
319
+ };
320
+ }
321
+ const verbose = result.match(
322
+ /(\d+)\s+insertions?(?:,\s*(\d+)\s+deletions?)?/i
323
+ );
324
+ if (verbose) {
325
+ return {
326
+ additions: Number(verbose[1]),
327
+ deletions: verbose[2] != null ? Number(verbose[2]) : void 0
320
328
  };
321
329
  }
322
330
  return {};
@@ -388,8 +396,8 @@ function applyAgentEvent(parts, event) {
388
396
  ...p,
389
397
  status: event.isError ? "error" : "done",
390
398
  result: event.content,
391
- additions: fromResult.additions ?? p.additions,
392
- deletions: fromResult.deletions ?? p.deletions
399
+ ...fromResult.additions != null ? { additions: fromResult.additions } : {},
400
+ ...fromResult.deletions != null ? { deletions: fromResult.deletions } : {}
393
401
  };
394
402
  });
395
403
  return next;
package/dist/index.cjs CHANGED
@@ -5907,6 +5907,8 @@ __export(index_exports, {
5907
5907
  HARNESS_ENV_KEYS: () => HARNESS_ENV_KEYS,
5908
5908
  MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS: () => MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS,
5909
5909
  Orchestrator: () => Orchestrator,
5910
+ PASTE_ATTACH_MIN_CHARS: () => PASTE_ATTACH_MIN_CHARS,
5911
+ PASTE_ATTACH_MIN_LINES: () => PASTE_ATTACH_MIN_LINES,
5910
5912
  PLAN_MODE_INSTRUCTION: () => PLAN_MODE_INSTRUCTION,
5911
5913
  SIDEBOARD_FORCE_STOP: () => SIDEBOARD_FORCE_STOP,
5912
5914
  SIDEBOARD_MCP_ALLOWED_TOOLS: () => SIDEBOARD_MCP_ALLOWED_TOOLS,
@@ -5941,6 +5943,7 @@ __export(index_exports, {
5941
5943
  buildClaudeStreamJsonUserMessage: () => buildClaudeStreamJsonUserMessage,
5942
5944
  buildDiffCommentAttachment: () => buildDiffCommentAttachment,
5943
5945
  buildForkTranscriptAttachment: () => buildForkTranscriptAttachment,
5946
+ buildPastedTextAttachment: () => buildPastedTextAttachment,
5944
5947
  buildSessionSeed: () => buildSessionSeed,
5945
5948
  buildWorkspaceScriptEnv: () => buildWorkspaceScriptEnv,
5946
5949
  caffeinateWhileCloudConnectEnabled: () => caffeinateWhileCloudConnectEnabled,
@@ -6094,6 +6097,7 @@ __export(index_exports, {
6094
6097
  mcpAuthWarnings: () => mcpAuthWarnings,
6095
6098
  mergePr: () => mergePr,
6096
6099
  mergeUsage: () => mergeUsage,
6100
+ nextPastedTextName: () => nextPastedTextName,
6097
6101
  normalizeParseResult: () => normalizeParseResult,
6098
6102
  normalizeThread: () => normalizeThread,
6099
6103
  normalizeTurnInput: () => normalizeTurnInput,
@@ -6108,6 +6112,7 @@ __export(index_exports, {
6108
6112
  parseGithubSlugFromRemoteUrl: () => parseGithubSlugFromRemoteUrl,
6109
6113
  parseMcpList: () => parseMcpList,
6110
6114
  partsToAssistantText: () => partsToAssistantText,
6115
+ pastedTextStats: () => pastedTextStats,
6111
6116
  permissionMode: () => permissionMode,
6112
6117
  previewLand: () => previewLand,
6113
6118
  pushBranch: () => pushBranch,
@@ -6143,6 +6148,7 @@ __export(index_exports, {
6143
6148
  saveAppSettings: () => saveAppSettings,
6144
6149
  setStatus: () => setStatus,
6145
6150
  settingsSourceLabel: () => settingsSourceLabel,
6151
+ shouldAttachPastedText: () => shouldAttachPastedText,
6146
6152
  shouldCompactContext: () => shouldCompactContext,
6147
6153
  shouldRunWorktreeCleanup: () => shouldRunWorktreeCleanup,
6148
6154
  sideboardHomeDir: () => sideboardHomeDir,
@@ -6479,12 +6485,20 @@ function diffFromInput(input) {
6479
6485
  }
6480
6486
  function parseDiffStat(result) {
6481
6487
  if (!result) return {};
6482
- const plus = result.match(/\+(\d+)/);
6483
- const minus = result.match(/-(\d+)/);
6484
- if (plus || minus) {
6488
+ const paired = result.match(/\+(\d+)\s+-(\d+)/);
6489
+ if (paired) {
6485
6490
  return {
6486
- additions: plus ? Number(plus[1]) : void 0,
6487
- deletions: minus ? Number(minus[1]) : void 0
6491
+ additions: Number(paired[1]),
6492
+ deletions: Number(paired[2])
6493
+ };
6494
+ }
6495
+ const verbose = result.match(
6496
+ /(\d+)\s+insertions?(?:,\s*(\d+)\s+deletions?)?/i
6497
+ );
6498
+ if (verbose) {
6499
+ return {
6500
+ additions: Number(verbose[1]),
6501
+ deletions: verbose[2] != null ? Number(verbose[2]) : void 0
6488
6502
  };
6489
6503
  }
6490
6504
  return {};
@@ -6556,8 +6570,8 @@ function applyAgentEvent(parts, event) {
6556
6570
  ...p,
6557
6571
  status: event.isError ? "error" : "done",
6558
6572
  result: event.content,
6559
- additions: fromResult.additions ?? p.additions,
6560
- deletions: fromResult.deletions ?? p.deletions
6573
+ ...fromResult.additions != null ? { additions: fromResult.additions } : {},
6574
+ ...fromResult.deletions != null ? { deletions: fromResult.deletions } : {}
6561
6575
  };
6562
6576
  });
6563
6577
  return next;
@@ -8323,6 +8337,42 @@ function attachmentsFromWorktreePaths(worktreePath, relativePaths) {
8323
8337
  return out;
8324
8338
  }
8325
8339
 
8340
+ // src/composer/pasted-text.ts
8341
+ var import_node_crypto3 = require("crypto");
8342
+ var PASTE_ATTACH_MIN_CHARS = 1200;
8343
+ var PASTE_ATTACH_MIN_LINES = 15;
8344
+ var PASTED_NAME_RE = /^Pasted text #(\d+)\.txt$/i;
8345
+ var PASTED_NAME_ALT_RE = /^pasted-(\d+)\.txt$/i;
8346
+ function pastedTextStats(text) {
8347
+ const chars = text.length;
8348
+ if (chars === 0) return { chars: 0, lines: 0 };
8349
+ const lines = text.split(/\r\n|\r|\n/).length;
8350
+ return { chars, lines };
8351
+ }
8352
+ function shouldAttachPastedText(text) {
8353
+ const trimmed = text.trim();
8354
+ if (!trimmed) return false;
8355
+ const { chars, lines } = pastedTextStats(text);
8356
+ return chars >= PASTE_ATTACH_MIN_CHARS || lines >= PASTE_ATTACH_MIN_LINES;
8357
+ }
8358
+ function nextPastedTextName(existing) {
8359
+ let max = 0;
8360
+ for (const a of existing) {
8361
+ const m = PASTED_NAME_RE.exec(a.name) ?? PASTED_NAME_ALT_RE.exec(a.name);
8362
+ if (m?.[1]) max = Math.max(max, Number(m[1]));
8363
+ }
8364
+ return `Pasted text #${max + 1}.txt`;
8365
+ }
8366
+ function buildPastedTextAttachment(text, opts) {
8367
+ return {
8368
+ id: opts?.id ?? (0, import_node_crypto3.randomUUID)(),
8369
+ name: opts?.name ?? "Pasted text #1.txt",
8370
+ kind: "file",
8371
+ path: opts?.path,
8372
+ content: text
8373
+ };
8374
+ }
8375
+
8326
8376
  // src/composer/summarize.ts
8327
8377
  init_run();
8328
8378
  init_path();
@@ -8851,7 +8901,7 @@ async function listLinearIssues(agent, repoPath) {
8851
8901
  }
8852
8902
 
8853
8903
  // src/threads/chat-tabs.ts
8854
- var import_node_crypto3 = require("crypto");
8904
+ var import_node_crypto4 = require("crypto");
8855
8905
  init_teams();
8856
8906
  init_worktree_labels();
8857
8907
  init_global_workspace();
@@ -8907,7 +8957,7 @@ function forkMessageSlice(from, throughIndex) {
8907
8957
  function buildForkTranscriptAttachment(baseTitle, messages) {
8908
8958
  const title = baseTitle || "Chat";
8909
8959
  return {
8910
- id: (0, import_node_crypto3.randomUUID)(),
8960
+ id: (0, import_node_crypto4.randomUUID)(),
8911
8961
  name: `Transcript of ${title}.md`,
8912
8962
  kind: "transcript",
8913
8963
  content: formatTranscriptMarkdown(title, messages)
@@ -11631,6 +11681,8 @@ init_injected_mcp();
11631
11681
  HARNESS_ENV_KEYS,
11632
11682
  MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS,
11633
11683
  Orchestrator,
11684
+ PASTE_ATTACH_MIN_CHARS,
11685
+ PASTE_ATTACH_MIN_LINES,
11634
11686
  PLAN_MODE_INSTRUCTION,
11635
11687
  SIDEBOARD_FORCE_STOP,
11636
11688
  SIDEBOARD_MCP_ALLOWED_TOOLS,
@@ -11665,6 +11717,7 @@ init_injected_mcp();
11665
11717
  buildClaudeStreamJsonUserMessage,
11666
11718
  buildDiffCommentAttachment,
11667
11719
  buildForkTranscriptAttachment,
11720
+ buildPastedTextAttachment,
11668
11721
  buildSessionSeed,
11669
11722
  buildWorkspaceScriptEnv,
11670
11723
  caffeinateWhileCloudConnectEnabled,
@@ -11818,6 +11871,7 @@ init_injected_mcp();
11818
11871
  mcpAuthWarnings,
11819
11872
  mergePr,
11820
11873
  mergeUsage,
11874
+ nextPastedTextName,
11821
11875
  normalizeParseResult,
11822
11876
  normalizeThread,
11823
11877
  normalizeTurnInput,
@@ -11832,6 +11886,7 @@ init_injected_mcp();
11832
11886
  parseGithubSlugFromRemoteUrl,
11833
11887
  parseMcpList,
11834
11888
  partsToAssistantText,
11889
+ pastedTextStats,
11835
11890
  permissionMode,
11836
11891
  previewLand,
11837
11892
  pushBranch,
@@ -11867,6 +11922,7 @@ init_injected_mcp();
11867
11922
  saveAppSettings,
11868
11923
  setStatus,
11869
11924
  settingsSourceLabel,
11925
+ shouldAttachPastedText,
11870
11926
  shouldCompactContext,
11871
11927
  shouldRunWorktreeCleanup,
11872
11928
  sideboardHomeDir,
package/dist/index.d.cts CHANGED
@@ -1637,6 +1637,33 @@ declare function attachmentsFromBuffers(buffers: ComposerFileBuffer[]): ThreadAt
1637
1637
  */
1638
1638
  declare function attachmentsFromWorktreePaths(worktreePath: string, relativePaths: string[]): ThreadAttachment[];
1639
1639
 
1640
+ /** Paste this large → attach as a doc chip instead of flooding the composer. */
1641
+ declare const PASTE_ATTACH_MIN_CHARS = 1200;
1642
+ /** Or this many lines (whichever hits first). */
1643
+ declare const PASTE_ATTACH_MIN_LINES = 15;
1644
+ declare function pastedTextStats(text: string): {
1645
+ chars: number;
1646
+ lines: number;
1647
+ };
1648
+ /**
1649
+ * True when clipboard text is large enough that Claude-style doc attachment
1650
+ * is preferable to dumping it into the message input.
1651
+ */
1652
+ declare function shouldAttachPastedText(text: string): boolean;
1653
+ /** Next `Pasted text #N.txt` name given existing composer attachments. */
1654
+ declare function nextPastedTextName(existing: Array<{
1655
+ name: string;
1656
+ }>): string;
1657
+ /**
1658
+ * Build a file-kind attachment for a large paste. Content is expanded into the
1659
+ * agent prompt via `expandComposerPrompt` like other composer attachments.
1660
+ */
1661
+ declare function buildPastedTextAttachment(text: string, opts?: {
1662
+ name?: string;
1663
+ id?: string;
1664
+ path?: string;
1665
+ }): ThreadAttachment;
1666
+
1640
1667
  interface SummarizeResult {
1641
1668
  summary: string;
1642
1669
  method: 'claude' | 'extractive';
@@ -2636,4 +2663,4 @@ declare function writeInjectedMcpConfig(opts: {
2636
2663
  includeBrightsy?: boolean;
2637
2664
  }): Promise<string | null>;
2638
2665
 
2639
- export { type ActiveRun, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentInstructionFile, type AgentKind, type AgentModelInfo, type AgentSetupActionResult, type AgentSetupInfo, type AgentSetupKind, type AgentStatus, type AgentTurnInput, type AnthropicCacheControl, type AppSettings, type ApplyIntoMainResult, type AttachCommand, type Autonomy, BRIGHTSY_MCP_ALLOWED_TOOLS, type BranchInfo, type BrightsyAccount, type BrightsyChatTarget, type BrightsyChatTargets, type BrightsyCloudConnectAgent, type BrightsyHarnessSettings, type BrightsySession, BrightsySideboardApi, type BrightsyTeamTargets, CLOUD_COORDINATOR_BUSY_REPLY, CLOUD_COORDINATOR_STOPPED_REPLY, CLOUD_COORDINATOR_TIMEOUT_REPLY, CLOUD_ORCHESTRATOR_GOAL, CONTEXT_COMPACT_CHARS, CONTEXT_KEEP_RECENT_CHARS, CONTEXT_KEEP_RECENT_MESSAGES, CONTEXT_MIN_MESSAGES, COORDINATOR_TOOL_PLAYBOOK, type ClaudeHarnessSettings, type CleanupOrphansResult, type CloudConnectAgent, type CloudConnectOptions, type CloudConnectStatus, type CompactResult, type CompactThresholds, type ComposerFileBuffer, type ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateThreadInput, type CreateWorktreeResult, type CursorModelInfo, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorWorktreesConfig, type DefaultsAppSettings, type DevServerHandle, type DiffCommentInput, type DiffCommentLine, type DiffCommit, type DiffFile, type DiffResult, type DiffScope, type DiffScopeStat, type ExpandResult, FAMOUS_SOCCER_TEAMS, type ForkChatTabInput, type ForkThreadWorktreeInput, type FormatGhLandErrorOptions, GLOBAL_WORKSPACE_ID, type GetDiffOptions, type GitHubStatus, type GitWorktreeStatus, HARNESS_ENV_KEYS, type HarnessId, type IntegrationsSettings, type IpcApi, type IssueInfo, type IssueSource, type LandPreview, type LandResult, type ListIssuesResult, MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS, type McpServerStatus, type MessagePart, Orchestrator, type OrchestratorEvent, type OrchestratorRuntime, type OrphanWorktree, PLAN_MODE_INSTRUCTION, type PrActor, type PrCheckRun, type PrCommentInfo, type PrCommitInfo, type PrDetails, type PrInfo, type PrMeta, type PrReviewInfo, type RepoSettings, type RepoSetupInfo, type RunMode, type RunScript, SIDEBOARD_FORCE_STOP, SIDEBOARD_MCP_ALLOWED_TOOLS, type ScriptHandle, type SkillInfo, type SourceType, type SpawnTurnHandle, type SummarizeResult, type TeamName, type Thread, type ThreadAttachment, type ThreadMessage, type ThreadOptionsPatch, type ThreadStatus, type TokenUsage, type TranscriptToolDetail, type TurnCommand, type Workspace, type WorkspaceInventoryEntry, type WorkspaceScriptEnvOpts, addWorkspace, adoptThread, allAdapters, allocatePort, allocatePortRange, allocateTeamName, allocateTeamSlug, appDataDir, appSettingsPath, appendMessage, applyAgentEvent, applyAppEnvironment, applyCompaction, applyThreadIntoMain, attachmentFromAbsolutePath, attachmentsFromBuffers, attachmentsFromWorktreePaths, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyMcpAllowedTools, brightsyMcpServerName, buildCachedUserContent, buildClaudeStreamJsonUserMessage, buildDiffCommentAttachment, buildForkTranscriptAttachment, buildSessionSeed, buildWorkspaceScriptEnv, caffeinateWhileCloudConnectEnabled, caffeinateWhileRunningEnabled, captureLoginEnv, captureTurnBaseline, childEnvWithAppSettings, claudeAdapter, claudeChromeEnabled, claudeUserSettingsPath, cleanupOrphanWorktrees, cloneRepoIntoSideboard, codexAdapter, collectTakenTeamSlugs, commitAll, conductorDbPath, confirmLand, connectBrightsyTeam, coordinatorSystemPrompt, coordinatorTurnReminder, copyConfiguredFiles, countCacheControlBlocks, createChatTab, createEmptyThread, createGlobalChat, createOrUpdatePr, createThread, createThreadWorktree, currentBranch, cursorAdapter, cursorSdkMessageToEvents, decodeBrightsyTarget, deleteBranchOnPurgeEnabled, deleteThreadRecord, detectAgents, detectLocalMergeConflicts, disconnectBrightsyTeam, discoverSkills, encodeBrightsyTarget, enrichWorkspacesWithGithub, ensureAgentPath, ensureCloudCoordinator, ensureGhPreferOrigin, ensureGlobalCoordinatorCwd, ensureWorkspace, estimateMessageChars, estimateThreadChars, expandComposerPrompt, extractGhErrorDetail, extractiveSummary, fetchPrHead, finalizeParts, findInvalidCacheControlTtlOrder, findOrphanWorktrees, findThreadByRef, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatArtifactDirective, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, getAgentSetupInfo, getBrightsySession, getDefaultAgent, getDefaultModel, getDefaultRunScript, getDiff, getDiffSummary, getGitHubStatus, getIssueSource, getLinearApiKey, getOrchestrator, getPr, getPrChecks, getPrDetails, getPrMeta, getRepoSetupInfo, getRunMode, getRunScript, gh, ghHeadRef, ghRepoSelectArgs, git, globalAgentCwd, harnessEnvKey, hasConductorHook, hasCursorWorktreeSetup, hasRepoHook, hasWorkspaceHook, healOrchestrationSoccerTitles, importConductorWorkspace, importConductorWorkspaceAsync, initializeGitRepository, inspectGitWorktree, installAgent, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isCursorAutoModel, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isImageFilePath, isLinearConnected, isOrchestratorThread, isPlaceholderBranch, listAgentSetupInfo, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listCodexModels, listConductorWorkspaces, listConnectedBrightsyTeams, listCursorModels, listGitHubIssues, listGlobalThreads, listIssues, listLinearIssues, listLinearIssuesDirect, listOpencodeModels, listPrs, listRunScripts, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadRepoSettings, loadWorkspaceSettings, locksDir, loginAgent, lookupSoccerTeam, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergePr, mergeUsage, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, openInSystemTerminal, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, originGhRepoEnv, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, permissionMode, previewLand, pushBranch, readSkillBody, readThread, readWorktreeFile, readWorktreeFileForUpload, readWorktreeInclude, refreshGitHubAuth, removeWorkspace, removeWorktree, repoSlug, requireAgent, resolveClaudeExecutable, resolveConductorCursorAgentId, resolveCursorModelId, resolveDefaultBranch, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGithubRepoSlug, resolvePrSelector, resolveRepoRoot, resolveThreadDefaults, resolveWorktreeStartPoint, run, runArchiveScript, runCloudConnect, runCursorWorktreeSetup, runSetupScript, sameWorktreePath, sanitizeMcpServerName, saveAppSettings, setStatus, settingsSourceLabel, shouldCompactContext, shouldRunWorktreeCleanup, sideboardHomeDir, sideboardReposDir, sideboardWorkspacesDir, slugify, spawnAgentTurn, splitForCompaction, stageAbsolutePathsAsAttachments, stageBuffersAsAttachments, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateDefaultsSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
2666
+ export { type ActiveRun, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentInstructionFile, type AgentKind, type AgentModelInfo, type AgentSetupActionResult, type AgentSetupInfo, type AgentSetupKind, type AgentStatus, type AgentTurnInput, type AnthropicCacheControl, type AppSettings, type ApplyIntoMainResult, type AttachCommand, type Autonomy, BRIGHTSY_MCP_ALLOWED_TOOLS, type BranchInfo, type BrightsyAccount, type BrightsyChatTarget, type BrightsyChatTargets, type BrightsyCloudConnectAgent, type BrightsyHarnessSettings, type BrightsySession, BrightsySideboardApi, type BrightsyTeamTargets, CLOUD_COORDINATOR_BUSY_REPLY, CLOUD_COORDINATOR_STOPPED_REPLY, CLOUD_COORDINATOR_TIMEOUT_REPLY, CLOUD_ORCHESTRATOR_GOAL, CONTEXT_COMPACT_CHARS, CONTEXT_KEEP_RECENT_CHARS, CONTEXT_KEEP_RECENT_MESSAGES, CONTEXT_MIN_MESSAGES, COORDINATOR_TOOL_PLAYBOOK, type ClaudeHarnessSettings, type CleanupOrphansResult, type CloudConnectAgent, type CloudConnectOptions, type CloudConnectStatus, type CompactResult, type CompactThresholds, type ComposerFileBuffer, type ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateThreadInput, type CreateWorktreeResult, type CursorModelInfo, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorWorktreesConfig, type DefaultsAppSettings, type DevServerHandle, type DiffCommentInput, type DiffCommentLine, type DiffCommit, type DiffFile, type DiffResult, type DiffScope, type DiffScopeStat, type ExpandResult, FAMOUS_SOCCER_TEAMS, type ForkChatTabInput, type ForkThreadWorktreeInput, type FormatGhLandErrorOptions, GLOBAL_WORKSPACE_ID, type GetDiffOptions, type GitHubStatus, type GitWorktreeStatus, HARNESS_ENV_KEYS, type HarnessId, type IntegrationsSettings, type IpcApi, type IssueInfo, type IssueSource, type LandPreview, type LandResult, type ListIssuesResult, MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS, type McpServerStatus, type MessagePart, Orchestrator, type OrchestratorEvent, type OrchestratorRuntime, type OrphanWorktree, PASTE_ATTACH_MIN_CHARS, PASTE_ATTACH_MIN_LINES, PLAN_MODE_INSTRUCTION, type PrActor, type PrCheckRun, type PrCommentInfo, type PrCommitInfo, type PrDetails, type PrInfo, type PrMeta, type PrReviewInfo, type RepoSettings, type RepoSetupInfo, type RunMode, type RunScript, SIDEBOARD_FORCE_STOP, SIDEBOARD_MCP_ALLOWED_TOOLS, type ScriptHandle, type SkillInfo, type SourceType, type SpawnTurnHandle, type SummarizeResult, type TeamName, type Thread, type ThreadAttachment, type ThreadMessage, type ThreadOptionsPatch, type ThreadStatus, type TokenUsage, type TranscriptToolDetail, type TurnCommand, type Workspace, type WorkspaceInventoryEntry, type WorkspaceScriptEnvOpts, addWorkspace, adoptThread, allAdapters, allocatePort, allocatePortRange, allocateTeamName, allocateTeamSlug, appDataDir, appSettingsPath, appendMessage, applyAgentEvent, applyAppEnvironment, applyCompaction, applyThreadIntoMain, attachmentFromAbsolutePath, attachmentsFromBuffers, attachmentsFromWorktreePaths, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyMcpAllowedTools, brightsyMcpServerName, buildCachedUserContent, buildClaudeStreamJsonUserMessage, buildDiffCommentAttachment, buildForkTranscriptAttachment, buildPastedTextAttachment, buildSessionSeed, buildWorkspaceScriptEnv, caffeinateWhileCloudConnectEnabled, caffeinateWhileRunningEnabled, captureLoginEnv, captureTurnBaseline, childEnvWithAppSettings, claudeAdapter, claudeChromeEnabled, claudeUserSettingsPath, cleanupOrphanWorktrees, cloneRepoIntoSideboard, codexAdapter, collectTakenTeamSlugs, commitAll, conductorDbPath, confirmLand, connectBrightsyTeam, coordinatorSystemPrompt, coordinatorTurnReminder, copyConfiguredFiles, countCacheControlBlocks, createChatTab, createEmptyThread, createGlobalChat, createOrUpdatePr, createThread, createThreadWorktree, currentBranch, cursorAdapter, cursorSdkMessageToEvents, decodeBrightsyTarget, deleteBranchOnPurgeEnabled, deleteThreadRecord, detectAgents, detectLocalMergeConflicts, disconnectBrightsyTeam, discoverSkills, encodeBrightsyTarget, enrichWorkspacesWithGithub, ensureAgentPath, ensureCloudCoordinator, ensureGhPreferOrigin, ensureGlobalCoordinatorCwd, ensureWorkspace, estimateMessageChars, estimateThreadChars, expandComposerPrompt, extractGhErrorDetail, extractiveSummary, fetchPrHead, finalizeParts, findInvalidCacheControlTtlOrder, findOrphanWorktrees, findThreadByRef, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatArtifactDirective, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, getAgentSetupInfo, getBrightsySession, getDefaultAgent, getDefaultModel, getDefaultRunScript, getDiff, getDiffSummary, getGitHubStatus, getIssueSource, getLinearApiKey, getOrchestrator, getPr, getPrChecks, getPrDetails, getPrMeta, getRepoSetupInfo, getRunMode, getRunScript, gh, ghHeadRef, ghRepoSelectArgs, git, globalAgentCwd, harnessEnvKey, hasConductorHook, hasCursorWorktreeSetup, hasRepoHook, hasWorkspaceHook, healOrchestrationSoccerTitles, importConductorWorkspace, importConductorWorkspaceAsync, initializeGitRepository, inspectGitWorktree, installAgent, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isCursorAutoModel, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isImageFilePath, isLinearConnected, isOrchestratorThread, isPlaceholderBranch, listAgentSetupInfo, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listCodexModels, listConductorWorkspaces, listConnectedBrightsyTeams, listCursorModels, listGitHubIssues, listGlobalThreads, listIssues, listLinearIssues, listLinearIssuesDirect, listOpencodeModels, listPrs, listRunScripts, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadRepoSettings, loadWorkspaceSettings, locksDir, loginAgent, lookupSoccerTeam, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergePr, mergeUsage, nextPastedTextName, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, openInSystemTerminal, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, originGhRepoEnv, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, pastedTextStats, permissionMode, previewLand, pushBranch, readSkillBody, readThread, readWorktreeFile, readWorktreeFileForUpload, readWorktreeInclude, refreshGitHubAuth, removeWorkspace, removeWorktree, repoSlug, requireAgent, resolveClaudeExecutable, resolveConductorCursorAgentId, resolveCursorModelId, resolveDefaultBranch, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGithubRepoSlug, resolvePrSelector, resolveRepoRoot, resolveThreadDefaults, resolveWorktreeStartPoint, run, runArchiveScript, runCloudConnect, runCursorWorktreeSetup, runSetupScript, sameWorktreePath, sanitizeMcpServerName, saveAppSettings, setStatus, settingsSourceLabel, shouldAttachPastedText, shouldCompactContext, shouldRunWorktreeCleanup, sideboardHomeDir, sideboardReposDir, sideboardWorkspacesDir, slugify, spawnAgentTurn, splitForCompaction, stageAbsolutePathsAsAttachments, stageBuffersAsAttachments, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateDefaultsSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
package/dist/index.d.ts CHANGED
@@ -1637,6 +1637,33 @@ declare function attachmentsFromBuffers(buffers: ComposerFileBuffer[]): ThreadAt
1637
1637
  */
1638
1638
  declare function attachmentsFromWorktreePaths(worktreePath: string, relativePaths: string[]): ThreadAttachment[];
1639
1639
 
1640
+ /** Paste this large → attach as a doc chip instead of flooding the composer. */
1641
+ declare const PASTE_ATTACH_MIN_CHARS = 1200;
1642
+ /** Or this many lines (whichever hits first). */
1643
+ declare const PASTE_ATTACH_MIN_LINES = 15;
1644
+ declare function pastedTextStats(text: string): {
1645
+ chars: number;
1646
+ lines: number;
1647
+ };
1648
+ /**
1649
+ * True when clipboard text is large enough that Claude-style doc attachment
1650
+ * is preferable to dumping it into the message input.
1651
+ */
1652
+ declare function shouldAttachPastedText(text: string): boolean;
1653
+ /** Next `Pasted text #N.txt` name given existing composer attachments. */
1654
+ declare function nextPastedTextName(existing: Array<{
1655
+ name: string;
1656
+ }>): string;
1657
+ /**
1658
+ * Build a file-kind attachment for a large paste. Content is expanded into the
1659
+ * agent prompt via `expandComposerPrompt` like other composer attachments.
1660
+ */
1661
+ declare function buildPastedTextAttachment(text: string, opts?: {
1662
+ name?: string;
1663
+ id?: string;
1664
+ path?: string;
1665
+ }): ThreadAttachment;
1666
+
1640
1667
  interface SummarizeResult {
1641
1668
  summary: string;
1642
1669
  method: 'claude' | 'extractive';
@@ -2636,4 +2663,4 @@ declare function writeInjectedMcpConfig(opts: {
2636
2663
  includeBrightsy?: boolean;
2637
2664
  }): Promise<string | null>;
2638
2665
 
2639
- export { type ActiveRun, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentInstructionFile, type AgentKind, type AgentModelInfo, type AgentSetupActionResult, type AgentSetupInfo, type AgentSetupKind, type AgentStatus, type AgentTurnInput, type AnthropicCacheControl, type AppSettings, type ApplyIntoMainResult, type AttachCommand, type Autonomy, BRIGHTSY_MCP_ALLOWED_TOOLS, type BranchInfo, type BrightsyAccount, type BrightsyChatTarget, type BrightsyChatTargets, type BrightsyCloudConnectAgent, type BrightsyHarnessSettings, type BrightsySession, BrightsySideboardApi, type BrightsyTeamTargets, CLOUD_COORDINATOR_BUSY_REPLY, CLOUD_COORDINATOR_STOPPED_REPLY, CLOUD_COORDINATOR_TIMEOUT_REPLY, CLOUD_ORCHESTRATOR_GOAL, CONTEXT_COMPACT_CHARS, CONTEXT_KEEP_RECENT_CHARS, CONTEXT_KEEP_RECENT_MESSAGES, CONTEXT_MIN_MESSAGES, COORDINATOR_TOOL_PLAYBOOK, type ClaudeHarnessSettings, type CleanupOrphansResult, type CloudConnectAgent, type CloudConnectOptions, type CloudConnectStatus, type CompactResult, type CompactThresholds, type ComposerFileBuffer, type ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateThreadInput, type CreateWorktreeResult, type CursorModelInfo, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorWorktreesConfig, type DefaultsAppSettings, type DevServerHandle, type DiffCommentInput, type DiffCommentLine, type DiffCommit, type DiffFile, type DiffResult, type DiffScope, type DiffScopeStat, type ExpandResult, FAMOUS_SOCCER_TEAMS, type ForkChatTabInput, type ForkThreadWorktreeInput, type FormatGhLandErrorOptions, GLOBAL_WORKSPACE_ID, type GetDiffOptions, type GitHubStatus, type GitWorktreeStatus, HARNESS_ENV_KEYS, type HarnessId, type IntegrationsSettings, type IpcApi, type IssueInfo, type IssueSource, type LandPreview, type LandResult, type ListIssuesResult, MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS, type McpServerStatus, type MessagePart, Orchestrator, type OrchestratorEvent, type OrchestratorRuntime, type OrphanWorktree, PLAN_MODE_INSTRUCTION, type PrActor, type PrCheckRun, type PrCommentInfo, type PrCommitInfo, type PrDetails, type PrInfo, type PrMeta, type PrReviewInfo, type RepoSettings, type RepoSetupInfo, type RunMode, type RunScript, SIDEBOARD_FORCE_STOP, SIDEBOARD_MCP_ALLOWED_TOOLS, type ScriptHandle, type SkillInfo, type SourceType, type SpawnTurnHandle, type SummarizeResult, type TeamName, type Thread, type ThreadAttachment, type ThreadMessage, type ThreadOptionsPatch, type ThreadStatus, type TokenUsage, type TranscriptToolDetail, type TurnCommand, type Workspace, type WorkspaceInventoryEntry, type WorkspaceScriptEnvOpts, addWorkspace, adoptThread, allAdapters, allocatePort, allocatePortRange, allocateTeamName, allocateTeamSlug, appDataDir, appSettingsPath, appendMessage, applyAgentEvent, applyAppEnvironment, applyCompaction, applyThreadIntoMain, attachmentFromAbsolutePath, attachmentsFromBuffers, attachmentsFromWorktreePaths, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyMcpAllowedTools, brightsyMcpServerName, buildCachedUserContent, buildClaudeStreamJsonUserMessage, buildDiffCommentAttachment, buildForkTranscriptAttachment, buildSessionSeed, buildWorkspaceScriptEnv, caffeinateWhileCloudConnectEnabled, caffeinateWhileRunningEnabled, captureLoginEnv, captureTurnBaseline, childEnvWithAppSettings, claudeAdapter, claudeChromeEnabled, claudeUserSettingsPath, cleanupOrphanWorktrees, cloneRepoIntoSideboard, codexAdapter, collectTakenTeamSlugs, commitAll, conductorDbPath, confirmLand, connectBrightsyTeam, coordinatorSystemPrompt, coordinatorTurnReminder, copyConfiguredFiles, countCacheControlBlocks, createChatTab, createEmptyThread, createGlobalChat, createOrUpdatePr, createThread, createThreadWorktree, currentBranch, cursorAdapter, cursorSdkMessageToEvents, decodeBrightsyTarget, deleteBranchOnPurgeEnabled, deleteThreadRecord, detectAgents, detectLocalMergeConflicts, disconnectBrightsyTeam, discoverSkills, encodeBrightsyTarget, enrichWorkspacesWithGithub, ensureAgentPath, ensureCloudCoordinator, ensureGhPreferOrigin, ensureGlobalCoordinatorCwd, ensureWorkspace, estimateMessageChars, estimateThreadChars, expandComposerPrompt, extractGhErrorDetail, extractiveSummary, fetchPrHead, finalizeParts, findInvalidCacheControlTtlOrder, findOrphanWorktrees, findThreadByRef, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatArtifactDirective, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, getAgentSetupInfo, getBrightsySession, getDefaultAgent, getDefaultModel, getDefaultRunScript, getDiff, getDiffSummary, getGitHubStatus, getIssueSource, getLinearApiKey, getOrchestrator, getPr, getPrChecks, getPrDetails, getPrMeta, getRepoSetupInfo, getRunMode, getRunScript, gh, ghHeadRef, ghRepoSelectArgs, git, globalAgentCwd, harnessEnvKey, hasConductorHook, hasCursorWorktreeSetup, hasRepoHook, hasWorkspaceHook, healOrchestrationSoccerTitles, importConductorWorkspace, importConductorWorkspaceAsync, initializeGitRepository, inspectGitWorktree, installAgent, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isCursorAutoModel, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isImageFilePath, isLinearConnected, isOrchestratorThread, isPlaceholderBranch, listAgentSetupInfo, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listCodexModels, listConductorWorkspaces, listConnectedBrightsyTeams, listCursorModels, listGitHubIssues, listGlobalThreads, listIssues, listLinearIssues, listLinearIssuesDirect, listOpencodeModels, listPrs, listRunScripts, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadRepoSettings, loadWorkspaceSettings, locksDir, loginAgent, lookupSoccerTeam, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergePr, mergeUsage, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, openInSystemTerminal, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, originGhRepoEnv, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, permissionMode, previewLand, pushBranch, readSkillBody, readThread, readWorktreeFile, readWorktreeFileForUpload, readWorktreeInclude, refreshGitHubAuth, removeWorkspace, removeWorktree, repoSlug, requireAgent, resolveClaudeExecutable, resolveConductorCursorAgentId, resolveCursorModelId, resolveDefaultBranch, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGithubRepoSlug, resolvePrSelector, resolveRepoRoot, resolveThreadDefaults, resolveWorktreeStartPoint, run, runArchiveScript, runCloudConnect, runCursorWorktreeSetup, runSetupScript, sameWorktreePath, sanitizeMcpServerName, saveAppSettings, setStatus, settingsSourceLabel, shouldCompactContext, shouldRunWorktreeCleanup, sideboardHomeDir, sideboardReposDir, sideboardWorkspacesDir, slugify, spawnAgentTurn, splitForCompaction, stageAbsolutePathsAsAttachments, stageBuffersAsAttachments, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateDefaultsSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
2666
+ export { type ActiveRun, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentInstructionFile, type AgentKind, type AgentModelInfo, type AgentSetupActionResult, type AgentSetupInfo, type AgentSetupKind, type AgentStatus, type AgentTurnInput, type AnthropicCacheControl, type AppSettings, type ApplyIntoMainResult, type AttachCommand, type Autonomy, BRIGHTSY_MCP_ALLOWED_TOOLS, type BranchInfo, type BrightsyAccount, type BrightsyChatTarget, type BrightsyChatTargets, type BrightsyCloudConnectAgent, type BrightsyHarnessSettings, type BrightsySession, BrightsySideboardApi, type BrightsyTeamTargets, CLOUD_COORDINATOR_BUSY_REPLY, CLOUD_COORDINATOR_STOPPED_REPLY, CLOUD_COORDINATOR_TIMEOUT_REPLY, CLOUD_ORCHESTRATOR_GOAL, CONTEXT_COMPACT_CHARS, CONTEXT_KEEP_RECENT_CHARS, CONTEXT_KEEP_RECENT_MESSAGES, CONTEXT_MIN_MESSAGES, COORDINATOR_TOOL_PLAYBOOK, type ClaudeHarnessSettings, type CleanupOrphansResult, type CloudConnectAgent, type CloudConnectOptions, type CloudConnectStatus, type CompactResult, type CompactThresholds, type ComposerFileBuffer, type ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateThreadInput, type CreateWorktreeResult, type CursorModelInfo, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorWorktreesConfig, type DefaultsAppSettings, type DevServerHandle, type DiffCommentInput, type DiffCommentLine, type DiffCommit, type DiffFile, type DiffResult, type DiffScope, type DiffScopeStat, type ExpandResult, FAMOUS_SOCCER_TEAMS, type ForkChatTabInput, type ForkThreadWorktreeInput, type FormatGhLandErrorOptions, GLOBAL_WORKSPACE_ID, type GetDiffOptions, type GitHubStatus, type GitWorktreeStatus, HARNESS_ENV_KEYS, type HarnessId, type IntegrationsSettings, type IpcApi, type IssueInfo, type IssueSource, type LandPreview, type LandResult, type ListIssuesResult, MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS, type McpServerStatus, type MessagePart, Orchestrator, type OrchestratorEvent, type OrchestratorRuntime, type OrphanWorktree, PASTE_ATTACH_MIN_CHARS, PASTE_ATTACH_MIN_LINES, PLAN_MODE_INSTRUCTION, type PrActor, type PrCheckRun, type PrCommentInfo, type PrCommitInfo, type PrDetails, type PrInfo, type PrMeta, type PrReviewInfo, type RepoSettings, type RepoSetupInfo, type RunMode, type RunScript, SIDEBOARD_FORCE_STOP, SIDEBOARD_MCP_ALLOWED_TOOLS, type ScriptHandle, type SkillInfo, type SourceType, type SpawnTurnHandle, type SummarizeResult, type TeamName, type Thread, type ThreadAttachment, type ThreadMessage, type ThreadOptionsPatch, type ThreadStatus, type TokenUsage, type TranscriptToolDetail, type TurnCommand, type Workspace, type WorkspaceInventoryEntry, type WorkspaceScriptEnvOpts, addWorkspace, adoptThread, allAdapters, allocatePort, allocatePortRange, allocateTeamName, allocateTeamSlug, appDataDir, appSettingsPath, appendMessage, applyAgentEvent, applyAppEnvironment, applyCompaction, applyThreadIntoMain, attachmentFromAbsolutePath, attachmentsFromBuffers, attachmentsFromWorktreePaths, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyMcpAllowedTools, brightsyMcpServerName, buildCachedUserContent, buildClaudeStreamJsonUserMessage, buildDiffCommentAttachment, buildForkTranscriptAttachment, buildPastedTextAttachment, buildSessionSeed, buildWorkspaceScriptEnv, caffeinateWhileCloudConnectEnabled, caffeinateWhileRunningEnabled, captureLoginEnv, captureTurnBaseline, childEnvWithAppSettings, claudeAdapter, claudeChromeEnabled, claudeUserSettingsPath, cleanupOrphanWorktrees, cloneRepoIntoSideboard, codexAdapter, collectTakenTeamSlugs, commitAll, conductorDbPath, confirmLand, connectBrightsyTeam, coordinatorSystemPrompt, coordinatorTurnReminder, copyConfiguredFiles, countCacheControlBlocks, createChatTab, createEmptyThread, createGlobalChat, createOrUpdatePr, createThread, createThreadWorktree, currentBranch, cursorAdapter, cursorSdkMessageToEvents, decodeBrightsyTarget, deleteBranchOnPurgeEnabled, deleteThreadRecord, detectAgents, detectLocalMergeConflicts, disconnectBrightsyTeam, discoverSkills, encodeBrightsyTarget, enrichWorkspacesWithGithub, ensureAgentPath, ensureCloudCoordinator, ensureGhPreferOrigin, ensureGlobalCoordinatorCwd, ensureWorkspace, estimateMessageChars, estimateThreadChars, expandComposerPrompt, extractGhErrorDetail, extractiveSummary, fetchPrHead, finalizeParts, findInvalidCacheControlTtlOrder, findOrphanWorktrees, findThreadByRef, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatArtifactDirective, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, getAgentSetupInfo, getBrightsySession, getDefaultAgent, getDefaultModel, getDefaultRunScript, getDiff, getDiffSummary, getGitHubStatus, getIssueSource, getLinearApiKey, getOrchestrator, getPr, getPrChecks, getPrDetails, getPrMeta, getRepoSetupInfo, getRunMode, getRunScript, gh, ghHeadRef, ghRepoSelectArgs, git, globalAgentCwd, harnessEnvKey, hasConductorHook, hasCursorWorktreeSetup, hasRepoHook, hasWorkspaceHook, healOrchestrationSoccerTitles, importConductorWorkspace, importConductorWorkspaceAsync, initializeGitRepository, inspectGitWorktree, installAgent, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isCursorAutoModel, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isImageFilePath, isLinearConnected, isOrchestratorThread, isPlaceholderBranch, listAgentSetupInfo, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listCodexModels, listConductorWorkspaces, listConnectedBrightsyTeams, listCursorModels, listGitHubIssues, listGlobalThreads, listIssues, listLinearIssues, listLinearIssuesDirect, listOpencodeModels, listPrs, listRunScripts, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadRepoSettings, loadWorkspaceSettings, locksDir, loginAgent, lookupSoccerTeam, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergePr, mergeUsage, nextPastedTextName, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, openInSystemTerminal, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, originGhRepoEnv, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, pastedTextStats, permissionMode, previewLand, pushBranch, readSkillBody, readThread, readWorktreeFile, readWorktreeFileForUpload, readWorktreeInclude, refreshGitHubAuth, removeWorkspace, removeWorktree, repoSlug, requireAgent, resolveClaudeExecutable, resolveConductorCursorAgentId, resolveCursorModelId, resolveDefaultBranch, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGithubRepoSlug, resolvePrSelector, resolveRepoRoot, resolveThreadDefaults, resolveWorktreeStartPoint, run, runArchiveScript, runCloudConnect, runCursorWorktreeSetup, runSetupScript, sameWorktreePath, sanitizeMcpServerName, saveAppSettings, setStatus, settingsSourceLabel, shouldAttachPastedText, shouldCompactContext, shouldRunWorktreeCleanup, sideboardHomeDir, sideboardReposDir, sideboardWorkspacesDir, slugify, spawnAgentTurn, splitForCompaction, stageAbsolutePathsAsAttachments, stageBuffersAsAttachments, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateDefaultsSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
package/dist/index.js CHANGED
@@ -101,7 +101,7 @@ import {
101
101
  withAgentInstructions,
102
102
  worktreeCleanupSettings,
103
103
  writeWorktreeFile
104
- } from "./chunk-UKDAGGTU.js";
104
+ } from "./chunk-2YFQNL3O.js";
105
105
  import {
106
106
  addWorkspace,
107
107
  ensureWorkspace,
@@ -413,6 +413,42 @@ function buildDiffCommentAttachment(input) {
413
413
  };
414
414
  }
415
415
 
416
+ // src/composer/pasted-text.ts
417
+ import { randomUUID } from "crypto";
418
+ var PASTE_ATTACH_MIN_CHARS = 1200;
419
+ var PASTE_ATTACH_MIN_LINES = 15;
420
+ var PASTED_NAME_RE = /^Pasted text #(\d+)\.txt$/i;
421
+ var PASTED_NAME_ALT_RE = /^pasted-(\d+)\.txt$/i;
422
+ function pastedTextStats(text) {
423
+ const chars = text.length;
424
+ if (chars === 0) return { chars: 0, lines: 0 };
425
+ const lines = text.split(/\r\n|\r|\n/).length;
426
+ return { chars, lines };
427
+ }
428
+ function shouldAttachPastedText(text) {
429
+ const trimmed = text.trim();
430
+ if (!trimmed) return false;
431
+ const { chars, lines } = pastedTextStats(text);
432
+ return chars >= PASTE_ATTACH_MIN_CHARS || lines >= PASTE_ATTACH_MIN_LINES;
433
+ }
434
+ function nextPastedTextName(existing) {
435
+ let max = 0;
436
+ for (const a of existing) {
437
+ const m = PASTED_NAME_RE.exec(a.name) ?? PASTED_NAME_ALT_RE.exec(a.name);
438
+ if (m?.[1]) max = Math.max(max, Number(m[1]));
439
+ }
440
+ return `Pasted text #${max + 1}.txt`;
441
+ }
442
+ function buildPastedTextAttachment(text, opts) {
443
+ return {
444
+ id: opts?.id ?? randomUUID(),
445
+ name: opts?.name ?? "Pasted text #1.txt",
446
+ kind: "file",
447
+ path: opts?.path,
448
+ content: text
449
+ };
450
+ }
451
+
416
452
  // src/brightsy/api.ts
417
453
  function formatBrightsyFetchError(err, url) {
418
454
  if (!(err instanceof Error)) return `${String(err)} (${url})`;
@@ -756,6 +792,8 @@ export {
756
792
  HARNESS_ENV_KEYS,
757
793
  MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS,
758
794
  Orchestrator,
795
+ PASTE_ATTACH_MIN_CHARS,
796
+ PASTE_ATTACH_MIN_LINES,
759
797
  PLAN_MODE_INSTRUCTION,
760
798
  SIDEBOARD_FORCE_STOP,
761
799
  SIDEBOARD_MCP_ALLOWED_TOOLS,
@@ -790,6 +828,7 @@ export {
790
828
  buildClaudeStreamJsonUserMessage,
791
829
  buildDiffCommentAttachment,
792
830
  buildForkTranscriptAttachment,
831
+ buildPastedTextAttachment,
793
832
  buildSessionSeed,
794
833
  buildWorkspaceScriptEnv,
795
834
  caffeinateWhileCloudConnectEnabled,
@@ -943,6 +982,7 @@ export {
943
982
  mcpAuthWarnings,
944
983
  mergePr,
945
984
  mergeUsage,
985
+ nextPastedTextName,
946
986
  normalizeParseResult,
947
987
  normalizeThread,
948
988
  normalizeTurnInput,
@@ -957,6 +997,7 @@ export {
957
997
  parseGithubSlugFromRemoteUrl,
958
998
  parseMcpList,
959
999
  partsToAssistantText,
1000
+ pastedTextStats,
960
1001
  permissionMode,
961
1002
  previewLand,
962
1003
  pushBranch,
@@ -992,6 +1033,7 @@ export {
992
1033
  saveAppSettings,
993
1034
  setStatus,
994
1035
  settingsSourceLabel,
1036
+ shouldAttachPastedText,
995
1037
  shouldCompactContext,
996
1038
  shouldRunWorktreeCleanup,
997
1039
  sideboardHomeDir,
@@ -5724,12 +5724,20 @@ function diffFromInput(input) {
5724
5724
  }
5725
5725
  function parseDiffStat(result) {
5726
5726
  if (!result) return {};
5727
- const plus = result.match(/\+(\d+)/);
5728
- const minus = result.match(/-(\d+)/);
5729
- if (plus || minus) {
5727
+ const paired = result.match(/\+(\d+)\s+-(\d+)/);
5728
+ if (paired) {
5730
5729
  return {
5731
- additions: plus ? Number(plus[1]) : void 0,
5732
- deletions: minus ? Number(minus[1]) : void 0
5730
+ additions: Number(paired[1]),
5731
+ deletions: Number(paired[2])
5732
+ };
5733
+ }
5734
+ const verbose = result.match(
5735
+ /(\d+)\s+insertions?(?:,\s*(\d+)\s+deletions?)?/i
5736
+ );
5737
+ if (verbose) {
5738
+ return {
5739
+ additions: Number(verbose[1]),
5740
+ deletions: verbose[2] != null ? Number(verbose[2]) : void 0
5733
5741
  };
5734
5742
  }
5735
5743
  return {};
@@ -5801,8 +5809,8 @@ function applyAgentEvent(parts, event) {
5801
5809
  ...p,
5802
5810
  status: event.isError ? "error" : "done",
5803
5811
  result: event.content,
5804
- additions: fromResult.additions ?? p.additions,
5805
- deletions: fromResult.deletions ?? p.deletions
5812
+ ...fromResult.additions != null ? { additions: fromResult.additions } : {},
5813
+ ...fromResult.deletions != null ? { deletions: fromResult.deletions } : {}
5806
5814
  };
5807
5815
  });
5808
5816
  return next;
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  startMcpServer
4
- } from "../chunk-UKDAGGTU.js";
4
+ } from "../chunk-2YFQNL3O.js";
5
5
  import "../chunk-FVGRUZHI.js";
6
6
  import "../chunk-IS3AGU33.js";
7
7
  import "../chunk-PTASB7SJ.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sideboard-ai/core",
3
- "version": "0.1.38",
3
+ "version": "0.1.39",
4
4
  "description": "Sideboard core — orchestration, agents, git worktrees, MCP server",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",