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, CodeGenMode, 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, 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;
}
export interface SessionContext {
    sessionId: string;
    turns: CodegenTurn[];
    customInstructions: CustomInstruction[];
    customAgents: CustomAgentDefinition[];
    userContext: UserContext;
    prettierConfig: Record<string, unknown> | 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;
    mode: CodeGenMode;
    queueMode?: QueueMode;
    privacyMode?: PrivacyMode;
    softContextWindow?: number;
    builtInCustomInstructions?: CustomInstruction[];
    builtInCustomAgents?: SubAgent[];
    builtInMCPServerConfig?: MCPServerConfig;
    autoImportLocalMCPs?: boolean;
    systemPromptOverride?: string;
    fusionConfig?: FusionConfig;
    devServerOrchestrator?: DevServerOrchestrator;
    git?: boolean;
    gitAutoInit?: boolean;
    workingDirectory?: string;
    mcpServers?: boolean;
    enabledTools?: (keyof CodeGenToolMap)[];
    modelOverride?: string;
    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;
}
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<void>;
    switchModelOverride(model: string | undefined): Promise<void>;
    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<void>;
    initializeSession(opts?: {
        skipSessionLoading?: boolean;
        signal?: AbortSignal;
    }): Promise<void>;
    loadHistory(): Promise<LoadHistoryResult>;
    loadWholeSession(opts?: LoadWholeSessionOptions): Promise<LoadWholeSessionResult>;
    loadMoreTurns(): Promise<CodegenTurn[]>;
    setCustomInstructions(instructions: CustomInstruction[]): Promise<void>;
    setCustomAgents(agents: SubAgent[]): Promise<void>;
    pushRepoV2(repoInfo: {
        repoFullName: string;
        repoUrl: string;
    }): Promise<CodegenApiResult>;
    /**
     * 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<CodegenApiResult>;
    zipFolder(folderName: string): Promise<string>;
    archiveProject(): Promise<string>;
    isIdle(): boolean;
    needsBackup(): Promise<boolean>;
    uploadBackup(forcedFullBackup?: boolean): Promise<BackupGitRepoResult | {
        success: false;
        error: Error;
    }>;
    getCommitMode(): import("#ai-utils").CommitMode;
    pushChanges(opts: PushChangesArgs): Promise<CodegenApiResult>;
    abortMerge(emitStatus?: boolean): Promise<CodegenApiResult>;
    syncChangesFromRemote(opts?: SyncChangesFromRemote): Promise<CodegenApiResult>;
    /**
     * Get the current commit hash
     */
    getCurrentCommitHash(branchName?: string, repoPath?: string): Promise<string | undefined>;
    getCurrentBranch(repoPath?: string): Promise<string>;
    /**
     * Get the feature branch name
     */
    getFeatureBranch(): string;
    /**
     * Get the AI branch name
     */
    getAiBranch(): string;
    git(args: string[], opts?: string | Partial<RunCommandOptions>): Promise<string>;
    setDebug(debug: boolean): void;
    createTerminal(options?: CodegenApiCreateTerminal): Promise<CodegenApiTerminal>;
    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<boolean>;
    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<string[]>;
    searchFiles(options: SearchFilesOptions): Promise<SearchFilesResult>;
    /**
     * Search for files by their names/paths (for quick open functionality).
     * Uses ripgrep's --files flag for speed (like VS Code's Cmd+T quick open).
     * Always case insensitive. Returns match indices for highlighting in the UI.
     * Respects access control policies (deny patterns).
     */
    searchFileTree(options: SearchFileTreeOptions): Promise<SearchFileTreeResult>;
    collectRepoMetrics(opts?: {
        rootPath?: string;
        folderName?: string;
    }): Promise<RepoMetrics>;
    getSessionId(): string;
    updateMetadata(metadata: Record<string, any>): void;
    getMetadata(): Record<string, any>;
    setTimeline(timeline: TimelineCollector): void;
    getTimeline(): TimelineCollector | null;
    getSpaceId(): string | undefined;
    revertToCommitSnapshot(commitSnapshot: GitSnapshot): Promise<void>;
    revertToCommitHash(commitHash: string): Promise<void>;
    resetToCommitSnapshot(commitSnapshot: GitSnapshot, requestRefresh?: boolean): Promise<void>;
    resetToCommitHash(commitHash: string, requestRefresh?: boolean): Promise<void>;
    /**
     * 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<CodegenFeedback>): Promise<void>;
    lastTurnHasChanges(): Promise<boolean>;
    waitUntilState(state: GenerateCompletionState, timeout?: number): Promise<void>;
    getProxyConfig(): {
        proxyOrigin: string | undefined;
        proxyDefaultOrigin: string | undefined;
        proxyDestination: string | undefined;
    };
    clearSession(): Promise<void>;
    clearMessageQueue(emitUserMessages?: boolean): Promise<void>;
    updateMessage(opts: MessageUpdateOptions): void;
    flushMessageQueue(): Promise<void>;
    sendMessage(message: GenerateUserMessage | GenerateUserMessage[]): Promise<string | null>;
    /**
     * 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;
    } | {
        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<SpawnAgentResult>;
    /**
     * Returns info about currently running background sub-agents.
     */
    getRunningSubAgents(): Array<{
        id: string;
        description: string;
        startedAt: number;
    }>;
    canHandleTool(toolName: keyof CodeGenToolMap): boolean;
    setProxyOrigin(proxySrc: string | undefined, proxyDefaultOrigin: string | undefined): void;
    getTurns(): CodegenTurn[];
    getSessionContext(): SessionContext;
    runSetupCommand(): Promise<import("#ai-utils").SetupCommandResult | undefined>;
    abortSetupCommand(): Promise<import("#ai-utils").SetupCommandResult | undefined> | undefined;
    abortValidateCommand(): Promise<import("#ai-utils").ValidateCommandResult | undefined> | 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<void>;
    abort(abortOptions?: CodegenAbortOptions | boolean): Promise<boolean>;
    stopEventLoop(): Promise<void>;
    requestRefresh(): void;
    configureDevOrchestrator(opts: ConfigureDevOrchestratorOpts): Promise<ConfigureDevOrchestratorUpdates>;
    /**
     * 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<void>;
    tsServerInit(): Promise<{
        ok: boolean;
        cwd?: string;
        error?: string;
    }>;
    tsServerOpenFile(filePath: string, content: string): Promise<void>;
    tsServerChangeFile(filePath: string, content: string): Promise<void>;
    tsServerCloseFile(filePath: string): Promise<void>;
    tsServerGetCompletions(filePath: string, line: number, offset: number, options?: {
        triggerCharacter?: string;
        includeExternalModuleExports?: boolean;
    }): Promise<import("./tsserver-manager").TsServerRequestResult>;
    tsServerGetCompletionDetails(filePath: string, line: number, offset: number, entryNames: string[]): Promise<import("./tsserver-manager").TsServerRequestResult>;
    tsServerGetDefinition(filePath: string, line: number, offset: number): Promise<import("./tsserver-manager").TsServerRequestResult>;
    tsServerGetTypeDefinition(filePath: string, line: number, offset: number): Promise<import("./tsserver-manager").TsServerRequestResult>;
    tsServerGetQuickInfo(filePath: string, line: number, offset: number): Promise<import("./tsserver-manager").TsServerRequestResult>;
    tsServerGetReferences(filePath: string, line: number, offset: number): Promise<import("./tsserver-manager").TsServerRequestResult>;
    tsServerGetSignatureHelp(filePath: string, line: number, offset: number): Promise<import("./tsserver-manager").TsServerRequestResult>;
    tsServerRequestDiagnostics(filePaths: string[]): Promise<void>;
    tsServerGetRenameLocations(filePath: string, line: number, offset: number): Promise<import("./tsserver-manager").TsServerRequestResult>;
    tsServerGetNavTree(filePath: string): Promise<import("./tsserver-manager").TsServerRequestResult>;
    tsServerOrganizeImports(filePath: string): Promise<import("./tsserver-manager").TsServerRequestResult>;
    tsServerGetInlayHints(filePath: string): Promise<import("./tsserver-manager").TsServerRequestResult>;
    tsServerGetCodeFixes(filePath: string, startLine: number, startOffset: number, endLine: number, endOffset: number, errorCodes: number[]): Promise<import("./tsserver-manager").TsServerRequestResult>;
    tsServerGetApplicableRefactors(filePath: string, startLine: number, startOffset: number, endLine: number, endOffset: number): Promise<import("./tsserver-manager").TsServerRequestResult>;
    tsServerGetEditsForRefactor(filePath: string, startLine: number, startOffset: number, endLine: number, endOffset: number, refactorName: string, actionName: string): Promise<import("./tsserver-manager").TsServerRequestResult>;
    tsServerGetImplementation(filePath: string, line: number, offset: number): Promise<import("./tsserver-manager").TsServerRequestResult>;
    tsServerGetSelectionRange(filePath: string, locations: Array<{
        line: number;
        offset: number;
    }>): Promise<import("./tsserver-manager").TsServerRequestResult>;
    tsServerGetLinkedEditingRange(filePath: string, line: number, offset: number): Promise<import("./tsserver-manager").TsServerRequestResult>;
    tsServerGetFormatRange(filePath: string, startLine: number, startOffset: number, endLine: number, endOffset: number): Promise<import("./tsserver-manager").TsServerRequestResult>;
    subscribeToDiagnostics(onEvent: (event: any) => void): () => void;
    close(uploadGitBackup?: boolean): Promise<void>;
    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<boolean>;
    getLastSuggestedAction(): SuggestedActionBuildError | undefined;
    connectToEventLoop(shouldReplay: boolean, onStep: (step: GenerateCompletionStep) => void, options?: {
        canHandleTools?: (keyof CodeGenToolMap)[];
    }): () => void;
    waitUntilPendingPromises(signal?: AbortSignal): Promise<void>;
    waitUntilBlockingPendingPromises(signal?: AbortSignal): Promise<void>;
    waitUntilIdle(signal?: AbortSignal): Promise<void>;
    waitForEventLoop(): Promise<void>;
    /**
     * 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<void>;
    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<string | null>;
    /**
     * 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<string | null>;
    /**
     * 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<string | null>;
    /**
     * 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)
     * @returns Object with oldContent (from parent branch) and newContent (current)
     */
    getSingleFileDiff(args: {
        path: string;
        folderName?: string;
        previousChecksum?: string;
    } | 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<string | null>;
    /**
     * 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<string[]>;
    /**
     * List custom instructions (rules and skills) discovered from the workspace.
     * Returns instructions with isSkill flag to distinguish skills from rules.
     */
    listCustomInstructions(): Promise<Array<{
        id: string;
        name: string;
        description?: string;
        type?: string;
        isSkill: boolean;
        disableModelInvocation?: boolean;
        userInvocable?: boolean;
    }>>;
    /**
     * 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 from the workspace
     * @param filePath A file path that may include a workspace prefix
     * @returns True if the delete was successful, false otherwise
     */
    deleteFile(filePath: string, skipAclCheck?: boolean): Promise<string | null>;
    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<string>;
        folderName?: string;
    }): Promise<ApplyActionsResult[]>;
    /**
     * 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<string>;
        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;
}
