import type { DevToolsSys } from "../types"; import { type Credentials } from "./credentials"; import { TimelineCollector } from "./utils/timeline-collector"; import type { CodegenFeedback, CodeGenToolMap, CodegenTurn, CustomInstruction, FusionConfig, GenerateCompletionState, GenerateCompletionStep, GenerateUserMessage, SessionMode, UserContext, UserSource, WorkspaceFolder, LoadWholeSessionOptions, LoadWholeSessionResult, LoadHistoryResult, ApplyActionsResult, PrivacyMode, CodeGenPosition, BackupGitRepoResult, SuggestedActionBuildError, PushChangesArgs, CodegenApiResult, CodegenApiTerminal, ConfigureDevOrchestratorOpts, ConfigureDevOrchestratorUpdates, RepoMetrics, FolderWatchEvent, MCPServerConfig, CodegenApiCreateTerminal, SyncChangesFromRemote, SearchFilesOptions, SearchFilesResult, SearchFileTreeOptions, SearchFileTreeResult, HttpServerState, ExplorationMetadataToolInput, CodegenAbortOptions, MessageUpdateOptions, GitRepoContext, SystemReminderObj, GitSnapshot, AutoPushMode, QueueMode, CustomAgentDefinition, AgentModelOverrides, MemorySummary, SendMessageToOrgAgentInput, ReasoningEffort } from "#ai-utils"; import { type ToolResolution } from "./code-tools"; import { type SubAgent } from "./utils/agent-discovery"; import EventEmitter from "node:events"; import { type RunCommandOptions } from "./utils/git"; import { type DevServerOrchestrator } from "./launch/dev-server-orchestrator"; import type { FusionStatusMonitor } from "./launch/machine-health"; export interface SyncChangesFromBranches { canPush: boolean; branches: string[]; uncommittedChanges: "stash" | "commit" | "fail"; allowUnrelatedHistory: boolean; fastForward: "never" | "required" | "auto"; requestRefresh?: boolean; /** * When true, compute the remote branch per-repo using #getRemoteBranch(ctx) * instead of using the passed branches array. This handles multi-repo * scenarios where each repo may have a different feature branch. */ syncRemoteBranch?: boolean; /** * When true, perform a hard reset to the remote feature/base branch instead * of merging. The `branches` array must contain the feature/base branch name. */ resetToBase?: boolean; /** * Whether to update the internal "last AI commits" baseline after the sync * completes. Defaults to `true`. When `false`, `#lastAICommits` is left * untouched so `getChangesReport()` keeps diffing from the previous * baseline (useful to surface what changed since the reset in a prompt). */ updateLastCommits?: boolean; } export interface SessionContext { sessionId: string; turns: CodegenTurn[]; customInstructions: CustomInstruction[]; customAgents: CustomAgentDefinition[]; userContext: UserContext; prettierConfig: Record | null; state: GenerateCompletionState; title: string | undefined; beforeCommit: GitSnapshot | undefined; createdUnixTime: number; updatedUnixTime: number; canLoadMore: boolean; sessionMode: SessionMode; } export interface CodeGenSessionOptionsBase { sys: DevToolsSys; credentials: Credentials; position: CodeGenPosition; maxTokens?: number; queueMode?: QueueMode; privacyMode?: PrivacyMode; softContextWindow?: number; builtInCustomInstructions?: CustomInstruction[]; builtInCustomAgents?: SubAgent[]; builtInMCPServerConfig?: MCPServerConfig; autoImportLocalMCPs?: boolean; systemPromptOverride?: string | string[]; fusionConfig?: FusionConfig; devServerOrchestrator?: DevServerOrchestrator; git?: boolean; gitAutoInit?: boolean; workingDirectory?: string; mcpServers?: boolean; enabledTools?: (keyof CodeGenToolMap)[]; modelOverride?: string; agentModelOverrides?: AgentModelOverrides; skipFileDiff?: boolean; agentType?: string; includeMemories?: boolean; fusionStatusMonitor?: FusionStatusMonitor; asyncSubAgents?: boolean; persistSessionLocally?: boolean; /** Default reasoning effort level for this session. Sent to the service with each completion request. */ reasoning?: ReasoningEffort; /** Immediate parent session id when this is a sub-agent. */ parentSessionId?: string; /** Root session of the agent tree. Inherited by every descendant; cost rolls up here in one hop. */ mainSessionId?: string; } export interface CodeGenSessionOptionsSession extends CodeGenSessionOptionsBase { sessionOrCompletionId?: string; } export interface CodeGenSessionOptionsInitialUrl extends CodeGenSessionOptionsBase { initialUrl: string; } export type CodeGenSessionOptions = CodeGenSessionOptionsSession | CodeGenSessionOptionsInitialUrl; export type SpawnAgentResult = SpawnAgentResultSuccess | SpawnAgentResultFailed; export interface SpawnAgentResultSuccess { success: boolean; response: string; metadata: ExplorationMetadataToolInput; lastTurn?: CodegenTurn; sessionId: string; } export interface SpawnAgentResultFailed { success: false; response: string; } export type CodeGenEventEmitter = EventEmitter<{ step: [GenerateCompletionStep]; idle: []; }>; export declare class CodeGenSession { #private; /** * Returns the primary git working directory path. * This is always #gitRepoContexts[0].path for backwards compatibility. */ get primaryGitPath(): string; constructor(options: CodeGenSessionOptions); get fusionConfig(): FusionConfig | undefined; /** Returns the first git-enabled folder for backwards compatibility */ get gitEnabledFolder(): WorkspaceFolder | undefined; /** Returns all git-enabled folders */ get gitEnabledFolders(): WorkspaceFolder[]; /** Returns runtime git repo contexts for all enabled repos */ get gitRepoContexts(): readonly GitRepoContext[]; get workingDirectory(): string; get bashWorkingDirectory(): string; getSessionMode(): SessionMode; switchSessionMode(newMode: SessionMode): Promise; switchModelOverride(model: string | undefined): Promise; removeSystemReminder(tag: string): void; /** * Returns memories whose glob matches the given file path, excluding ones * already injected this session. Marks returned memories as reminded. */ getMemoriesForFile(filePath: string): MemorySummary[]; queueSystemReminder(reminder: SystemReminderObj): { operation: string; }; setDefaultAutoPush(autoPush: AutoPushMode | undefined): void; setPrivacyMode(privacyMode: PrivacyMode | undefined): Promise; initializeSession(opts?: { skipSessionLoading?: boolean; signal?: AbortSignal; }): Promise; loadHistory(): Promise; loadWholeSession(opts?: LoadWholeSessionOptions): Promise; loadMoreTurns(): Promise; setCustomInstructions(instructions: CustomInstruction[]): Promise; setCustomAgents(agents: SubAgent[]): Promise; pushRepoV2(repoInfo: { repoFullName: string; repoUrl: string; }): Promise; /** * Ensures git authentication is valid by refreshing git URLs and tokens. * This should be called before executing git/gh commands to prevent * authentication failures due to expired tokens. */ ensureGitAuth(): Promise; zipFolder(folderName: string): Promise; archiveProject(): Promise; isIdle(): boolean; needsBackup(): Promise; uploadBackup(forcedFullBackup?: boolean): Promise; getCommitMode(): import("#ai-utils").CommitMode; pushChanges(opts: PushChangesArgs): Promise; abortMerge(emitStatus?: boolean): Promise; syncChangesFromRemote(opts?: SyncChangesFromRemote): Promise; /** * Get the current commit hash */ getCurrentCommitHash(branchName?: string, repoPath?: string): Promise; getCurrentBranch(repoPath?: string): Promise; /** * Get the feature branch name */ getFeatureBranch(): string; /** * Get the AI branch name */ getAiBranch(): string; git(args: string[], opts?: string | Partial): Promise; setDebug(debug: boolean): void; createTerminal(options?: CodegenApiCreateTerminal): Promise; updateTerminal({ terminalId, cols, rows, title, }: { terminalId: string; cols?: number; rows?: number; title?: string; }): boolean; writeTerminal({ terminalId, data }: { terminalId: string; data: string; }): boolean; signalTerminal({ terminalId, signal, }: { terminalId: string; signal: "SIGINT" | "SIGTERM" | "SIGKILL"; }): boolean; disposeTerminal({ terminalId, emitTerminals, }: { terminalId: string; emitTerminals?: boolean; }): boolean; restartTerminal({ terminalId }: { terminalId: string; }): Promise; subscribeTerminal({ terminalId, onData, onExit, }: { terminalId: string; onData: (chunk: string) => void; onExit?: (code?: number) => void; }): (() => void) | undefined; getAllFiles(options?: { getDotFiles?: boolean; globbyPattern?: string; includePattern?: string; gitignore?: boolean; deep?: number; truncate?: number; maxFiles?: number; onlyFiles?: boolean; }): Promise; searchFiles(options: SearchFilesOptions): Promise; /** * Search for files by their names/paths using Fuse.js fuzzy matching. * Matches against the full path (including directory segments), so * "components" matches "src/components/Button.tsx" — unlike the old * ripgrep glob approach which only matched the filename. * Respects access control policies (deny patterns). */ searchFileTree(options: SearchFileTreeOptions): Promise; collectRepoMetrics(opts?: { rootPath?: string; folderName?: string; }): Promise; getSessionId(): string; /** Root session id passed to each spawned sub-agent as their mainSessionId. */ getMainSessionId(): string; updateMetadata(metadata: Record): void; getMetadata(): Record; setTimeline(timeline: TimelineCollector): void; getTimeline(): TimelineCollector | null; getSpaceId(): string | undefined; revertToCommitSnapshot(commitSnapshot: GitSnapshot): Promise; revertToCommitHash(commitHash: string): Promise; resetToCommitSnapshot(commitSnapshot: GitSnapshot, requestRefresh?: boolean): Promise; resetToCommitHash(commitHash: string, requestRefresh?: boolean): Promise; /** * Core function to restore the codebase to a state that matches a predicate. * This is the main function that handles both git-based and file-based restoration. * * @param predicate Function that takes a turn and its index and returns true if we should restore up to that turn * @param dryRun If true, only simulate the restoration without making changes * @returns Array of file paths that were changed */ restore({ location, predicate, revert, dryRun, forceReplay, debug, }: { location: "before" | "after"; predicate: (turn: CodegenTurn | null, index: number) => boolean; dryRun?: boolean; revert?: boolean; forceReplay?: boolean; debug?: string; }): Promise<{ undone: string[] | null; message: string; }>; restoreFromCompletionId({ location, completionId, forceReplay, }: { location: "before" | "after"; completionId: string; forceReplay?: boolean; }): Promise<{ undone: string[] | null; message: string; }>; restoreBeforeCompletionId(completionId: string): Promise<{ undone: string[] | null; message: string; }>; /** * Undo all changes back to the last user message */ undoLastUserMessage(dryRun?: boolean): Promise<{ undone: string[] | null; message: string; }>; getLastUserCompletionId(): string | undefined; getLastCompletionId(): string | undefined; getCurrentState(): GenerateCompletionState; getLastApplyResultsTurn(): CodegenTurn | undefined; getLastTurn(): CodegenTurn | undefined; getLastMessage(): string | undefined; getNextUrl(): string | undefined; sendFeedback(feedback: Partial): Promise; lastTurnHasChanges(): Promise; waitUntilState(state: GenerateCompletionState, timeout?: number): Promise; getProxyConfig(): { proxyOrigin: string | undefined; proxyDefaultOrigin: string | undefined; proxyDestination: string | undefined; }; clearSession(): Promise; clearMessageQueue(emitUserMessages?: boolean): Promise; updateMessage(opts: MessageUpdateOptions): void; flushMessageQueue(): Promise; sendMessage(message: GenerateUserMessage | GenerateUserMessage[]): Promise; /** * Waits for the setup command to finish if it's currently running. * Returns information about the setup command state. * * @param signal - Optional abort signal * @returns Object with setup command state information */ waitForSetupCommand(signal?: AbortSignal): Promise<{ state: "installed" | "not-installed" | "install-failed" | "install-aborted"; shouldProceed: boolean; }>; waitForDevServer(signal?: AbortSignal, timeoutMs?: number, expectedStates?: HttpServerState[]): Promise<{ shouldProceed: boolean; message: string; serverUrl?: string; }>; getNamedAgentConfig(agentName: string | undefined, sessionId: string, signal?: AbortSignal): Promise<{ success: true; options: CodeGenSessionOptions; resetAfterRun: boolean; subagent_type: string; /** Set when the run was launched with browser session replay enabled. */ replayId?: string; /** * HTTP(S) URL to force-close the browser-service WebSocket on * agent shutdown/abort. Present whenever a Chrome connection * was acquired (not just when replay is enabled) so the pool * slot is freed promptly instead of sitting idle for 30min. */ browserDisconnectUrl?: string; /** Optional override for the maximum timeout for this agent. */ maxTimeoutMs?: number; } | { success: false; response: string; }>; /** * Spawn a named custom agent by ID or name * @param agentNameOrId - The agent's name or ID * @param options - Additional spawning options * @returns SpawnAgentResult */ spawnNamedAgent(agentName: string | undefined, options: { prompt: string; user: UserSource; signal: AbortSignal; maxCompletions: number; sessionId: string; resume?: string; mcpServers?: boolean; attachmentUrls?: string[]; }): Promise; /** * Returns info about currently running background sub-agents. */ getRunningSubAgents(): Array<{ id: string; description: string; startedAt: number; }>; canHandleTool(toolName: keyof CodeGenToolMap): boolean; /** * Declare tools that are handleable at the session level, independent of * live streaming connections. Used by fire-and-forget (queue-based) * integrations like Slack where tool calls are handled asynchronously * via event hooks rather than a persistent connection. * * These capabilities are automatically cleared when the session goes idle, * simulating a "disconnect". The next message from the integration will * re-register them. */ setSessionCanHandleTools(tools: (keyof CodeGenToolMap)[]): void; clearSessionCanHandleTools(): void; setProxyOrigin(proxySrc: string | undefined, proxyDefaultOrigin: string | undefined): void; getTurns(): CodegenTurn[]; getSessionContext(): SessionContext; runSetupCommand(): Promise; abortSetupCommand(): Promise | undefined; abortValidateCommand(): Promise | undefined; toolsRunning(): boolean; abortAllTools(): void; /** * Fulfil a pending tool call (usually AskUser or any passThrough tool) * Exposed via websocket as `toolFullfilment` for the Builder UI to send back * the user's response. */ toolFullfilment(id: string, result: ToolResolution | string): boolean; cancelAllPendingToolFulfilments(userMessage?: string): void; fulfillToolCall(id: string, result: ToolResolution): boolean; abortToolCall(id: string, reason?: string): boolean; acceptCode(): Promise; abort(abortOptions?: CodegenAbortOptions | boolean): Promise; stopEventLoop(): Promise; requestRefresh(): void; configureDevOrchestrator(opts: ConfigureDevOrchestratorOpts): Promise; /** * Subscribe to file change events for the entire working directory. * Returns a dispose function to unsubscribe. * The watcher is lazily initialized on first subscription and cleaned up on last unsubscribe. */ subscribeToFileChanges(onEvent: (event: FolderWatchEvent) => void): () => Promise; tsServerInit(): Promise<{ ok: boolean; cwd?: string; error?: string; }>; tsServerOpenFile(filePath: string, content: string): Promise; tsServerChangeFile(filePath: string, content: string): Promise; tsServerCloseFile(filePath: string): Promise; tsServerGetCompletions(filePath: string, line: number, offset: number, options?: { triggerCharacter?: string; includeExternalModuleExports?: boolean; }): Promise; tsServerGetCompletionDetails(filePath: string, line: number, offset: number, entryNames: string[]): Promise; tsServerGetDefinition(filePath: string, line: number, offset: number): Promise; tsServerGetTypeDefinition(filePath: string, line: number, offset: number): Promise; tsServerGetQuickInfo(filePath: string, line: number, offset: number): Promise; tsServerGetReferences(filePath: string, line: number, offset: number): Promise; tsServerGetSignatureHelp(filePath: string, line: number, offset: number): Promise; tsServerRequestDiagnostics(filePaths: string[]): Promise; tsServerGetRenameLocations(filePath: string, line: number, offset: number): Promise; tsServerGetNavTree(filePath: string): Promise; tsServerOrganizeImports(filePath: string): Promise; tsServerGetInlayHints(filePath: string): Promise; tsServerGetCodeFixes(filePath: string, startLine: number, startOffset: number, endLine: number, endOffset: number, errorCodes: number[]): Promise; tsServerGetApplicableRefactors(filePath: string, startLine: number, startOffset: number, endLine: number, endOffset: number): Promise; tsServerGetEditsForRefactor(filePath: string, startLine: number, startOffset: number, endLine: number, endOffset: number, refactorName: string, actionName: string): Promise; tsServerGetImplementation(filePath: string, line: number, offset: number): Promise; tsServerGetSelectionRange(filePath: string, locations: Array<{ line: number; offset: number; }>): Promise; tsServerGetLinkedEditingRange(filePath: string, line: number, offset: number): Promise; tsServerGetFormatRange(filePath: string, startLine: number, startOffset: number, endLine: number, endOffset: number): Promise; subscribeToDiagnostics(onEvent: (event: any) => void): () => void; close(uploadGitBackup?: boolean): Promise; sendMessageToOrgAgent(options: SendMessageToOrgAgentInput): Promise<{ status: "success"; } | { status: "error"; error: string; }>; /** * Queues a semantic git status reminder for the LLM. * Call this after significant git operations to keep the LLM informed. */ queueGitStatusReminder(context: { trigger: "session-start" | "sync-success" | "push-success" | "pull-success"; syncedBranches?: string[]; pushedToRemote?: boolean; }): void; manualCommit(options: { add: string; commitMessage: string; folderName?: string; }): Promise; getLastSuggestedAction(): SuggestedActionBuildError | undefined; connectToEventLoop(shouldReplay: boolean, onStep: (step: GenerateCompletionStep) => void, options?: { canHandleTools?: (keyof CodeGenToolMap)[]; }): () => void; waitUntilPendingPromises(signal?: AbortSignal): Promise; waitUntilBlockingPendingPromises(signal?: AbortSignal): Promise; waitUntilIdle(signal?: AbortSignal): Promise; waitForEventLoop(): Promise; /** * Stages and optionally commits work in progress. * * When `#batchCommitsEnabled` is false (default): stages AND commits immediately. * When `#batchCommitsEnabled` is true: only stages files, sets #pendingCommit flag. * * @returns commit hash if committed, false if no changes or staged only */ commitWorkInProgress(defaultCommitMessage: string, changedFiles: string[]): Promise; getChangesReport(): Promise<{ diff: string; files: string[]; } | undefined>; /** * Resolves a workspace file path to its actual file system path * @param filePath A file path that may include a workspace prefix (e.g., "workspace1/path/to/file.js") * @param forceWorkspace If true, will try the first workspace as fallback when no workspace folder is found * @returns The actual file system path and the workspace folder it belongs to */ resolveWorkspacePath(filePath: string, forceWorkspace: boolean): { resolvedPath: string; workspaceFolder?: WorkspaceFolder; }; /** * Converts an absolute file system path to a workspace URL * @param absolutePath The absolute file system path to convert * @returns The workspace URL if the path can be converted, undefined otherwise */ absolutePathToWorkspaceUrl(absolutePath: string): string | undefined; /** * Launches the editor for a given file path * @param filePath The file path to launch the editor for * @param line The line number to launch the editor at * @param column The column number to launch the editor at * @returns void */ launchEditor(opts?: { filePath?: string; line?: number; column?: number; }): Promise<{ success: boolean; message?: string; }>; /** * Reads a file from the workspace * @param filePath A file path that may include a workspace prefix * @returns The file content or null if the file doesn't exist */ readFile(filePath: string, skipAclCheck?: boolean): Promise; /** * Reads a file and returns content with a checksum for caching. * If previousChecksum is provided and matches, returns notModified: true * without sending the file content. */ readFileWithChecksum(args: { filePath: string; previousChecksum?: string; skipAclCheck?: boolean; }): Promise<{ content: string | null; checksum: string | null; notModified?: boolean; }>; /** * Reads a binary file from the workspace and returns its content as base64. * Unlike readFile which reads as UTF-8 (corrupting binary data), this method * preserves binary content by encoding it as base64. */ readBinaryFile(filePath: string): Promise; /** * Gets file content at a specific git reference (e.g., origin/main, HEAD~1, commit hash) * @param filePath - The file path relative to the workspace * @param gitRef - The git reference (branch, commit, tag) - defaults to parent branch * @returns The file content at that reference, or null if not found */ getFileAtRef(filePath: string, gitRef?: string, repoPathOverride?: string): Promise; /** * Gets the diff information for a single file including full content * @param args - Either an options object or a file path string (legacy) * @param opts.path - The file path, can be folder-prefixed (e.g., 'builder-anime-works/client/App.tsx') or relative * @param opts.folderName - Optional folder name (deprecated, prefer folder-prefixed path) * @param opts.mode - Diff baseline mode. "remote-parent-branch" (default) * compares against the parent branch merge-base. "remote-current-branch" * compares against origin/ (with fallback to merge-base * when the branch has never been pushed). * @returns Object with oldContent (from baseline ref) and newContent (current) */ getSingleFileDiff(args: { path: string; folderName?: string; previousChecksum?: string; mode?: "remote-parent-branch" | "remote-current-branch"; } | string): Promise<{ oldContent: string | null; newContent: string | null; action: "create" | "update" | "delete"; checksum: string | null; notModified?: boolean; }>; /** * Discards changes for a specific file by creating a revert commit * @param args - Either an options object or a file path string (legacy) * @param opts.filePath - The file path, can be folder-prefixed (e.g., 'builder-anime-works/client/App.tsx') * @param opts.folderName - Optional folder name (deprecated, prefer folder-prefixed path) * @returns success status, commit hash for reverting, and optional error message */ discardFileChanges(args: { filePath: string; folderName?: string; } | string): Promise<{ success: boolean; commitHash?: string; error?: string; }>; /** * Reverts a discard commit using git revert * @param commitHash - The commit hash to revert * @param folderName - Optional folder name to target specific repo (more efficient) * @returns success status and optional error message */ revertDiscard(options: { commitHash: string; folderName?: string; }): Promise<{ success: boolean; error?: string; }>; /** * Checks if a file exists in the workspace * @param filePath A file path that may include a workspace prefix * @returns True if the file exists, false otherwise */ fileExists(filePath: string): Promise<{ absolutePath: string | undefined; recommendedPath: string | undefined; workspaceFolder: WorkspaceFolder | undefined; virtual: boolean; }>; /** * Reads a file from the workspace synchronously * @param filePath A file path that may include a workspace prefix * @returns The file content or null if the file doesn't exist */ readFileSync(filePath: string, skipAclCheck?: boolean): string | null; /** * Writes content to a file in the workspace * @param filePath A file path that may include a workspace prefix * @param content The content to write * @returns True if the write was successful, false otherwise */ writeFile(filePath: string, content: string | Uint8Array, skipAclCheck?: boolean): Promise; /** * Lists files in a directory in the workspace * @param dirPath A directory path that may include a workspace prefix * @returns Array of file names in the directory or empty array if directory doesn't exist */ listDir(dirPath: string): Promise; /** * List custom instructions (rules and skills) discovered from the workspace. * Returns instructions with isSkill flag to distinguish skills from rules. */ listCustomInstructions(): Promise>; /** * Get stats for a file in the workspace * @param filePath A file path that may include a workspace prefix * @returns The file stats or null if the file doesn't exist */ stat(filePath: string, skipAclCheck?: boolean): Promise<{ isDirectory: () => boolean; isFile: () => boolean; size: number; } | null>; /** * Deletes a file or directory from the workspace. * Directories are removed recursively along with all of their contents. * @param filePath A file or directory path that may include a workspace prefix * @returns The resolved path that was deleted, or null on failure / if it didn't exist */ deleteFile(filePath: string, skipAclCheck?: boolean): Promise; getLinesStats(): { net: number; added: number; removed: number; }; /** * Get git diff between current commit and remote branch * If remote current branch doesn't exist, gets diff between default branch and current branch * @param numberOfContextLines - Optional number of context lines to include in the diff * @param includeFilesOnly - If true, only return filePath and action properties * @param filePaths - Optional array of file paths to limit the diff to specific files * @param folderName - Optional folder name to specify which repo to get diff from */ getDiffFromRemote({ numberOfContextLines, includeFilesOnly, filePaths, folderName, }: { numberOfContextLines?: number; includeFilesOnly?: boolean; filePaths?: Array; folderName?: string; }): Promise; /** * Get git diff based on the specified mode * @param mode - The diff mode: 'previous-commit', 'parent-branch', or 'remote' * @param numberOfContextLines - Optional number of context lines to include in the diff (e.g., 999 for -U999) * @param includeFilesOnly - If true, only return filePath and action properties * @param filePaths - Optional array of file paths to limit the diff to specific files * @param folderName - Optional folder name to specify which repo to get diff from */ getDiff({ mode, numberOfContextLines, includeFilesOnly, filePaths, folderName, }: { mode: "remote-parent-branch" | "remote-current-branch"; numberOfContextLines?: number; includeFilesOnly?: boolean; filePaths?: Array; folderName?: string; }): Promise<{ state: "error" | "success"; diff?: ApplyActionsResult[]; error?: Error; }>; /** * Get the default branch name from remote repository. * Caches the promise so parallel requests share a single resolution * and subsequent calls reuse the result (default branch never changes during a session). */ private getDefaultBranch; /** * Get git diff between current branch and its parent branch (main/master) * @param numberOfContextLines - Optional number of context lines to include in the diff * @param includeFilesOnly - If true, only return filePath and action properties * @param filePaths - Optional array of file paths to limit the diff to specific files * @param folderName - Optional folder name to specify which repo to get diff from */ private getDiffFromParentBranch; }