import { IAction } from "../../../../../base/common/actions.js";
import { DeferredPromise } from "../../../../../base/common/async.js";
import { CancellationToken } from "../../../../../base/common/cancellation.js";
import { Event } from "../../../../../base/common/event.js";
import { IMarkdownString } from "../../../../../base/common/htmlContent.js";
import { IReference } from "../../../../../base/common/lifecycle.js";
import { IObservable, IReader } from "../../../../../base/common/observable.js";
import { ThemeIcon } from "../../../../../base/common/themables.js";
import { URI, UriComponents } from "../../../../../base/common/uri.js";
import { IRange } from "../../../../../editor/common/core/range.js";
import { HookTypeValue } from "../promptSyntax/hookTypes.js";
import { ISelection } from "../../../../../editor/common/core/selection.js";
import { Command, Location, TextEdit } from "../../../../../editor/common/languages.js";
import { FileType } from "../../../../../platform/files/common/files.js";
import { IAutostartResult } from "../../../mcp/common/mcpTypes.js";
import { ICellEditOperation } from "../../../notebook/common/notebookCommon.js";
import { IWorkspaceSymbol } from "../../../search/common/search.js";
import { IChatAgentCommand, IChatAgentData, IChatAgentResult, UserSelectedTools } from "../participants/chatAgents.js";
import { IChatModel, IChatRequestModeInfo, IChatResponseModel } from "../model/chatModel.js";
import { IChatParserContext } from "../requestParser/chatRequestParser.js";
import { IChatRequestVariableEntry } from "../attachments/chatVariableEntries.js";
import { IChatRequestVariableValue } from "../attachments/chatVariables.js";
import { ChatAgentLocation } from "../constants.js";
import { IPreparedToolInvocation, IToolConfirmationMessages, IToolResult, IToolResultInputOutputDetails, ToolDataSource } from "../tools/languageModelToolsService.js";
import { ReadonlyChatSessionOptionsMap } from "../chatSessionsService.js";
export interface IChatRequest {
    message: string;
    variables: Record<string, IChatRequestVariableValue[]>;
}
export declare enum ChatErrorLevel {
    Info = 0,
    Warning = 1,
    Error = 2
}
export interface IChatResponseErrorDetailsConfirmationButton {
    data: any;
    label: string;
    isSecondary?: boolean;
}
export interface IChatResponseErrorDetails {
    message: string;
    responseIsIncomplete?: boolean;
    responseIsFiltered?: boolean;
    responseIsRedacted?: boolean;
    isQuotaExceeded?: boolean;
    isRateLimited?: boolean;
    level?: ChatErrorLevel;
    confirmationButtons?: IChatResponseErrorDetailsConfirmationButton[];
    code?: string;
}
export interface IChatResponseProgressFileTreeData {
    label: string;
    uri: URI;
    type?: FileType;
    children?: IChatResponseProgressFileTreeData[];
}
export type IDocumentContext = {
    uri: URI;
    version: number;
    ranges: IRange[];
};
export declare function isIDocumentContext(obj: unknown): obj is IDocumentContext;
export interface IChatUsedContext {
    documents: IDocumentContext[];
    kind: "usedContext";
}
export declare function isIUsedContext(obj: unknown): obj is IChatUsedContext;
export interface IChatContentVariableReference {
    variableName: string;
    value?: URI | Location;
}
export declare function isChatContentVariableReference(obj: unknown): obj is IChatContentVariableReference;
export declare enum ChatResponseReferencePartStatusKind {
    Complete = 1,
    Partial = 2,
    Omitted = 3
}
export declare enum ChatResponseClearToPreviousToolInvocationReason {
    NoReason = 0,
    FilteredContentRetry = 1,
    CopyrightContentRetry = 2
}
export interface IChatContentReference {
    reference: URI | Location | IChatContentVariableReference | string;
    iconPath?: ThemeIcon | {
        light: URI;
        dark?: URI;
    };
    options?: {
        status?: {
            description: string;
            kind: ChatResponseReferencePartStatusKind;
        };
        diffMeta?: {
            added: number;
            removed: number;
        };
        originalUri?: URI;
        isDeletion?: boolean;
    };
    kind: "reference";
}
export interface IChatCodeCitation {
    value: URI;
    license: string;
    snippet: string;
    kind: "codeCitation";
}
export interface IChatUsagePromptTokenDetail {
    category: string;
    label: string;
    percentageOfPrompt: number;
}
export interface IChatUsage {
    promptTokens: number;
    completionTokens: number;
    outputBuffer?: number;
    promptTokenDetails?: readonly IChatUsagePromptTokenDetail[];
    kind: "usage";
}
export interface IChatContentInlineReference {
    resolveId?: string;
    inlineReference: URI | Location | IWorkspaceSymbol;
    name?: string;
    kind: "inlineReference";
}
export interface IChatMarkdownContent {
    kind: "markdownContent";
    content: IMarkdownString;
    inlineReferences?: Record<string, IChatContentInlineReference>;
}
export interface IChatTreeData {
    treeData: IChatResponseProgressFileTreeData;
    kind: "treeData";
}
export interface IMultiDiffResource {
    originalUri?: URI;
    modifiedUri?: URI;
    goToFileUri?: URI;
    added?: number;
    removed?: number;
}
export interface IChatMultiDiffInnerData {
    title: string;
    resources: IMultiDiffResource[];
}
export interface IChatMultiDiffData {
    multiDiffData: IChatMultiDiffInnerData | IObservable<IChatMultiDiffInnerData>;
    kind: "multiDiffData";
    collapsed?: boolean;
    readOnly?: boolean;
    toJSON(): IChatMultiDiffDataSerialized;
}
export interface IChatMultiDiffDataSerialized {
    multiDiffData: IChatMultiDiffInnerData;
    kind: "multiDiffData";
    collapsed?: boolean;
    readOnly?: boolean;
}
export declare class ChatMultiDiffData implements IChatMultiDiffData {
    readonly kind = "multiDiffData";
    readonly collapsed?: boolean | undefined;
    readonly readOnly?: boolean | undefined;
    readonly multiDiffData: IChatMultiDiffData["multiDiffData"];
    constructor(opts: {
        multiDiffData: IChatMultiDiffInnerData | IObservable<IChatMultiDiffInnerData>;
        collapsed?: boolean;
        readOnly?: boolean;
    });
    toJSON(): IChatMultiDiffDataSerialized;
}
export interface IChatProgressMessage {
    content: IMarkdownString;
    kind: "progressMessage";
    shimmer?: boolean;
}
export interface IChatTask extends IChatTaskDto {
    deferred: DeferredPromise<string | void>;
    progress: (IChatWarningMessage | IChatContentReference)[];
    readonly onDidAddProgress: Event<IChatWarningMessage | IChatContentReference>;
    add(progress: IChatWarningMessage | IChatContentReference): void;
    complete: (result: string | void) => void;
    task: () => Promise<string | void>;
    isSettled: () => boolean;
    toJSON(): IChatTaskSerialized;
}
export interface IChatUndoStop {
    kind: "undoStop";
    id: string;
}
export interface IChatExternalEditsDto {
    kind: "externalEdits";
    undoStopId: string;
    start: boolean; /** true=start, false=stop */
    resources: UriComponents[];
}
export interface IChatTaskDto {
    content: IMarkdownString;
    kind: "progressTask";
}
export interface IChatTaskSerialized {
    content: IMarkdownString;
    progress: (IChatWarningMessage | IChatContentReference)[];
    kind: "progressTaskSerialized";
}
export interface IChatTaskResult {
    content: IMarkdownString | void;
    kind: "progressTaskResult";
}
export interface IChatWarningMessage {
    content: IMarkdownString;
    kind: "warning";
}
export interface IChatAgentVulnerabilityDetails {
    title: string;
    description: string;
}
export interface IChatResponseCodeblockUriPart {
    kind: "codeblockUri";
    uri: URI;
    isEdit?: boolean;
    undoStopId?: string;
    subAgentInvocationId?: string;
}
export interface IChatAgentMarkdownContentWithVulnerability {
    content: IMarkdownString;
    vulnerabilities: IChatAgentVulnerabilityDetails[];
    kind: "markdownVuln";
}
export interface IChatCommandButton {
    command: Command;
    kind: "command";
    additionalCommands?: Command[];
}
export interface IChatMoveMessage {
    uri: URI;
    range: IRange;
    kind: "move";
}
export interface IChatTextEdit {
    uri: URI;
    edits: TextEdit[];
    kind: "textEdit";
    done?: boolean;
    isExternalEdit?: boolean;
}
export interface IChatClearToPreviousToolInvocation {
    kind: "clearToPreviousToolInvocation";
    reason: ChatResponseClearToPreviousToolInvocationReason;
}
export interface IChatNotebookEdit {
    uri: URI;
    edits: ICellEditOperation[];
    kind: "notebookEdit";
    done?: boolean;
    isExternalEdit?: boolean;
}
export interface IChatWorkspaceFileEdit {
    oldResource?: URI;
    newResource?: URI;
}
export interface IChatWorkspaceEdit {
    kind: "workspaceEdit";
    edits: IChatWorkspaceFileEdit[];
}
export interface IChatConfirmation {
    title: string;
    message: string | IMarkdownString;
    data: any;
    buttons?: string[];
    isUsed?: boolean;
    kind: "confirmation";
}
/**
 * Validation rules for a question in a question carousel.
 */
export interface IChatQuestionValidation {
    minLength?: number;
    maxLength?: number;
    format?: "email" | "uri" | "date" | "date-time";
    minimum?: number;
    maximum?: number;
    isInteger?: boolean;
}
/**
 * Represents an individual question in a question carousel.
 */
export interface IChatQuestion {
    id: string;
    type: "text" | "singleSelect" | "multiSelect";
    title: string;
    message?: string | IMarkdownString;
    description?: string;
    options?: {
        id: string;
        label: string;
        value: string;
    }[];
    defaultValue?: string | string[];
    allowFreeformInput?: boolean;
    required?: boolean;
    validation?: IChatQuestionValidation;
}
/** Answer shape for a single-select question. */
export interface IChatSingleSelectAnswer {
    selectedValue?: string;
    freeformValue?: string;
}
/** Answer shape for a multi-select question. */
export interface IChatMultiSelectAnswer {
    selectedValues: string[];
    freeformValue?: string;
}
/** Union of all possible answer values in a question carousel. */
export type IChatQuestionAnswerValue = string | IChatSingleSelectAnswer | IChatMultiSelectAnswer;
/** Record mapping question IDs to their typed answer values. */
export type IChatQuestionAnswers = Record<string, IChatQuestionAnswerValue>;
/**
 * A carousel for presenting multiple questions inline in the chat response.
 * Users can navigate between questions and submit their answers.
 */
export interface IChatQuestionCarousel {
    questions: IChatQuestion[];
    allowSkip: boolean;
    /** Unique identifier for resolving the carousel answers back to the extension */
    resolveId?: string;
    /** Storage for collected answers when user submits */
    data?: IChatQuestionAnswers;
    /** Whether the carousel has been submitted/skipped */
    isUsed?: boolean;
    /** Top-level message shown above the questions (e.g. from MCP elicitation message) */
    message?: string | IMarkdownString;
    /** Source attribution (e.g. MCP server) */
    source?: ToolDataSource;
    kind: "questionCarousel";
}
export declare enum ElicitationState {
    Pending = "pending",
    Accepted = "accepted",
    Rejected = "rejected"
}
export interface IChatElicitationRequest {
    kind: "elicitation2";
    title: string | IMarkdownString;
    message: string | IMarkdownString;
    acceptButtonLabel: string;
    rejectButtonLabel: string | undefined;
    subtitle?: string | IMarkdownString;
    source?: ToolDataSource;
    state: IObservable<ElicitationState>;
    acceptedResult?: Record<string, unknown>;
    moreActions?: IAction[];
    accept(value: IAction | true): Promise<void>;
    reject?: () => Promise<void>;
    isHidden?: IObservable<boolean>;
    hide?(): void;
    toJSON(): IChatElicitationRequestSerialized;
}
export interface IChatElicitationRequestSerialized {
    kind: "elicitationSerialized";
    title: string | IMarkdownString;
    message: string | IMarkdownString;
    subtitle: string | IMarkdownString | undefined;
    source: ToolDataSource | undefined;
    state: ElicitationState.Accepted | ElicitationState.Rejected;
    isHidden: boolean;
    acceptedResult?: Record<string, unknown>;
}
export interface IChatThinkingPart {
    kind: "thinking";
    value?: string | string[];
    id?: string;
    metadata?: {
        readonly [key: string]: any;
    };
    generatedTitle?: string;
}
/**
 * A progress part representing the execution result of a hook.
 * Aligned with the hook output JSON structure: { stopReason, systemMessage, hookSpecificOutput }.
 * If {@link stopReason} is set, the hook blocked/denied the operation.
 */
export interface IChatHookPart {
    kind: "hook";
    /** The type of hook that was executed */
    hookType: HookTypeValue;
    /** If set, the hook blocked processing. This message is shown to the user. */
    stopReason?: string;
    /** Warning/system message from the hook, shown to the user */
    systemMessage?: string;
    /** Display name of the tool that was affected by the hook */
    toolDisplayName?: string;
    metadata?: {
        readonly [key: string]: unknown;
    };
    /** If set, this hook was executed within a subagent invocation and should be grouped with it. */
    subAgentInvocationId?: string;
}
export interface IChatTerminalToolInvocationData {
    kind: "terminal";
    commandLine: {
        original: string;
        userEdited?: string;
        toolEdited?: string;
        forDisplay?: string;
        isSandboxWrapped?: boolean;
    };
    /** The working directory URI for the terminal */
    cwd?: UriComponents;
    /**
     * Pre-computed confirmation display data (localization must happen at source).
     * Contains the command line to show in confirmation (potentially without cd prefix)
     * and the formatted cwd label if a cd prefix was extracted.
     */
    confirmation?: {
        /** The command line to display in the confirmation editor */
        commandLine: string;
        /** The formatted cwd label to show in title (if cd was extracted) */
        cwdLabel?: string;
        /** The cd prefix to prepend back when user edits */
        cdPrefix?: string;
    };
    /**
     * Overrides to apply to the presentation of the tool call only, but not actually change the
     * command that gets run. For example, python -c "print('hello')" can be presented as just
     * the Python code with Python syntax highlighting.
     */
    presentationOverrides?: {
        /** The command line to display in the UI */
        commandLine: string;
        /** The language for syntax highlighting */
        language?: string;
    };
    /** Message for model recommending the use of an alternative tool */
    alternativeRecommendation?: string;
    language: string;
    terminalToolSessionId?: string;
    /** The predefined command ID that will be used for this terminal command */
    terminalCommandId?: string;
    /** Whether the terminal command was started as a background execution */
    isBackground?: boolean;
    /** Whether the command was explicitly approved to run outside the sandbox */
    requestUnsandboxedExecution?: boolean;
    /** The model-provided reason for requesting sandbox bypass */
    requestUnsandboxedExecutionReason?: string;
    /** Serialized URI for the command that was executed in the terminal */
    terminalCommandUri?: UriComponents;
    /** Serialized output of the executed command */
    terminalCommandOutput?: {
        text: string;
        truncated?: boolean;
        lineCount?: number;
    };
    /** Stored theme colors at execution time to style detached output */
    terminalTheme?: {
        background?: string;
        foreground?: string;
    };
    /** Stored command state to restore decorations after reload */
    terminalCommandState?: {
        exitCode?: number;
        timestamp?: number;
        duration?: number;
    };
    /** Whether the user chose to continue in background for this tool invocation */
    didContinueInBackground?: boolean;
    autoApproveInfo?: IMarkdownString;
}
/**
 * @deprecated This is the old API shape, we should support this for a while before removing it so
 * we don't break existing chats
 */
export interface ILegacyChatTerminalToolInvocationData {
    kind: "terminal";
    command: string;
    language: string;
}
export declare function isLegacyChatTerminalToolInvocationData(data: unknown): data is ILegacyChatTerminalToolInvocationData;
export interface IChatToolInputInvocationData {
    kind: "input";
    rawInput: any;
    /** Optional MCP App UI metadata for rendering during and after tool execution */
    mcpAppData?: {
        /** URI of the UI resource for rendering (e.g., "ui://weather-server/dashboard") */
        resourceUri: string;
        /** Reference to the server definition for reconnection */
        serverDefinitionId: string;
        /** Reference to the collection containing the server */
        collectionId: string;
    };
}
export declare enum ToolConfirmKind {
    Denied = 0,
    ConfirmationNotNeeded = 1,
    Setting = 2,
    LmServicePerTool = 3,
    UserAction = 4,
    Skipped = 5
}
export type ConfirmedReason = {
    type: ToolConfirmKind.Denied;
} | {
    type: ToolConfirmKind.ConfirmationNotNeeded;
    reason?: string | IMarkdownString;
} | {
    type: ToolConfirmKind.Setting;
    id: string;
} | {
    type: ToolConfirmKind.LmServicePerTool;
    scope: "session" | "workspace" | "profile";
} | {
    type: ToolConfirmKind.UserAction;
    selectedButton?: string;
} | {
    type: ToolConfirmKind.Skipped;
};
export interface IChatToolInvocation {
    readonly presentation: IPreparedToolInvocation["presentation"];
    readonly toolSpecificData?: IChatTerminalToolInvocationData | ILegacyChatTerminalToolInvocationData | IChatToolInputInvocationData | IChatExtensionsContent | IChatPullRequestContent | IChatTodoListContent | IChatSubagentToolInvocationData | IChatSimpleToolInvocationData | IChatToolResourcesInvocationData | IChatModifiedFilesConfirmationData;
    readonly originMessage: string | IMarkdownString | undefined;
    readonly invocationMessage: string | IMarkdownString;
    readonly pastTenseMessage: string | IMarkdownString | undefined;
    readonly source: ToolDataSource;
    readonly toolId: string;
    readonly toolCallId: string;
    readonly subAgentInvocationId?: string;
    readonly icon?: ThemeIcon;
    readonly state: IObservable<IChatToolInvocation.State>;
    generatedTitle?: string;
    isAttachedToThinking: boolean;
    kind: "toolInvocation";
    toJSON(): IChatToolInvocationSerialized;
}
export declare namespace IChatToolInvocation {
    export enum StateKind {
        /** Tool call is streaming partial input from the LM */
        Streaming = 0,
        WaitingForConfirmation = 1,
        Executing = 2,
        WaitingForPostApproval = 3,
        Completed = 4,
        Cancelled = 5
    }
    interface IChatToolInvocationStateBase {
        type: StateKind;
    }
    export interface IChatToolInvocationStreamingState extends IChatToolInvocationStateBase {
        type: StateKind.Streaming;
        /** Observable partial input from the LM stream */
        readonly partialInput: IObservable<unknown>;
        /** Custom invocation message from handleToolStream */
        readonly streamingMessage: IObservable<string | IMarkdownString | undefined>;
    }
    /** Properties available after streaming is complete */
    interface IChatToolInvocationPostStreamState {
        readonly parameters: unknown;
        readonly confirmationMessages?: IToolConfirmationMessages;
    }
    interface IChatToolInvocationWaitingForConfirmationState extends IChatToolInvocationStateBase, IChatToolInvocationPostStreamState {
        type: StateKind.WaitingForConfirmation;
        confirm(reason: ConfirmedReason): void;
    }
    interface IChatToolInvocationPostConfirmState extends IChatToolInvocationPostStreamState {
        confirmed: ConfirmedReason;
    }
    interface IChatToolInvocationExecutingState extends IChatToolInvocationStateBase, IChatToolInvocationPostConfirmState {
        type: StateKind.Executing;
        progress: IObservable<{
            message?: string | IMarkdownString;
            progress: number | undefined;
        }>;
    }
    interface IChatToolInvocationPostExecuteState extends IChatToolInvocationPostConfirmState {
        resultDetails: IToolResult["toolResultDetails"];
    }
    interface IChatToolWaitingForPostApprovalState extends IChatToolInvocationStateBase, IChatToolInvocationPostExecuteState {
        type: StateKind.WaitingForPostApproval;
        confirm(reason: ConfirmedReason): void;
        contentForModel: IToolResult["content"];
    }
    interface IChatToolInvocationCompleteState extends IChatToolInvocationStateBase, IChatToolInvocationPostExecuteState {
        type: StateKind.Completed;
        postConfirmed: ConfirmedReason | undefined;
        contentForModel: IToolResult["content"];
    }
    interface IChatToolInvocationCancelledState extends IChatToolInvocationStateBase, IChatToolInvocationPostStreamState {
        type: StateKind.Cancelled;
        reason: ToolConfirmKind.Denied | ToolConfirmKind.Skipped;
        /** Optional message explaining why the tool was cancelled (e.g., from hook denial) */
        reasonMessage?: string | IMarkdownString;
    }
    export type State = IChatToolInvocationStreamingState | IChatToolInvocationWaitingForConfirmationState | IChatToolInvocationExecutingState | IChatToolWaitingForPostApprovalState | IChatToolInvocationCompleteState | IChatToolInvocationCancelledState;
    export function executionConfirmedOrDenied(invocation: IChatToolInvocation | IChatToolInvocationSerialized, reader?: IReader): ConfirmedReason | undefined;
    export function awaitConfirmation(invocation: IChatToolInvocation, token?: CancellationToken): Promise<ConfirmedReason>;
    export function confirmWith(invocation: IChatToolInvocation | undefined, reason: ConfirmedReason): boolean;
    export function awaitPostConfirmation(invocation: IChatToolInvocation, token?: CancellationToken): Promise<ConfirmedReason>;
    export function resultDetails(invocation: IChatToolInvocation | IChatToolInvocationSerialized, reader?: IReader): IToolResultInputOutputDetails | import("../tools/languageModelToolsService.js").IToolResultOutputDetails | (URI | Location)[] | IToolResultOutputDetailsSerialized | undefined;
    export function isComplete(invocation: IChatToolInvocation | IChatToolInvocationSerialized, reader?: IReader): boolean;
    export function isStreaming(invocation: IChatToolInvocation | IChatToolInvocationSerialized, reader?: IReader): boolean;
    /**
     * Get parameters from invocation. Returns undefined during streaming state.
     */
    export function getParameters(invocation: IChatToolInvocation | IChatToolInvocationSerialized, reader?: IReader): unknown | undefined;
    /**
     * Get confirmation messages from invocation. Returns undefined during streaming state.
     */
    export function getConfirmationMessages(invocation: IChatToolInvocation | IChatToolInvocationSerialized, reader?: IReader): IToolConfirmationMessages | undefined;
    export {};
}
export interface IToolResultOutputDetailsSerialized {
    output: {
        type: "data";
        mimeType: string;
        base64Data: string;
    };
}
/**
 * This is a IChatToolInvocation that has been serialized, like after window reload, so it is no longer an active tool invocation.
 */
export interface IChatToolInvocationSerialized {
    presentation: IPreparedToolInvocation["presentation"];
    toolSpecificData?: IChatTerminalToolInvocationData | IChatToolInputInvocationData | IChatExtensionsContent | IChatPullRequestContent | IChatTodoListContent | IChatSubagentToolInvocationData | IChatSimpleToolInvocationData | IChatToolResourcesInvocationData | IChatModifiedFilesConfirmationData;
    invocationMessage: string | IMarkdownString;
    originMessage: string | IMarkdownString | undefined;
    pastTenseMessage: string | IMarkdownString | undefined;
    resultDetails?: Array<URI | Location> | IToolResultInputOutputDetails | IToolResultOutputDetailsSerialized;
    /** boolean used by pre-1.104 versions */
    isConfirmed: ConfirmedReason | boolean | undefined;
    isComplete: boolean;
    toolCallId: string;
    toolId: string;
    readonly icon?: undefined;
    source: ToolDataSource | undefined;
    readonly subAgentInvocationId?: string;
    generatedTitle?: string;
    isAttachedToThinking?: boolean;
    kind: "toolInvocationSerialized";
}
export interface IChatExtensionsContent {
    extensions: string[];
    kind: "extensions";
}
export interface IChatPullRequestContent {
    /**
     * @deprecated use `command` instead
     */
    uri?: URI;
    command: Command;
    title: string;
    description: string;
    author: string;
    linkTag: string;
    kind: "pullRequest";
}
export interface IChatSubagentToolInvocationData {
    kind: "subagent";
    description?: string;
    agentName?: string;
    prompt?: string;
    result?: string;
    modelName?: string;
}
/**
 * Progress type for external tool invocation updates from extensions.
 * When isComplete is false, creates or updates a tool invocation.
 * When isComplete is true, completes an existing tool invocation.
 */
export interface IChatExternalToolInvocationUpdate {
    kind: "externalToolInvocationUpdate";
    toolCallId: string;
    toolName: string;
    isComplete: boolean;
    errorMessage?: string;
    invocationMessage?: string | IMarkdownString;
    pastTenseMessage?: string | IMarkdownString;
    toolSpecificData?: IChatTerminalToolInvocationData | IChatToolInputInvocationData | IChatExtensionsContent | IChatTodoListContent | IChatSubagentToolInvocationData | IChatModifiedFilesConfirmationData;
    subagentInvocationId?: string;
    resultDetails?: IToolResultInputOutputDetails;
}
export interface IChatTodoListContent {
    kind: "todoList";
    todoList: Array<{
        id: string;
        title: string;
        status: "not-started" | "in-progress" | "completed";
    }>;
}
export interface IChatSimpleToolInvocationData {
    kind: "simpleToolInvocation";
    input: string;
    output: string;
}
export interface IChatToolResourcesInvocationData {
    readonly kind: "resources";
    readonly values: Array<URI | Location>;
}
export interface IChatModifiedFilesConfirmationData {
    readonly kind: "modifiedFilesConfirmation";
    readonly options: readonly string[];
    readonly modifiedFiles: readonly {
        readonly uri: UriComponents;
        readonly originalUri?: UriComponents;
        readonly insertions?: number;
        readonly deletions?: number;
        readonly title?: string;
        readonly description?: string;
    }[];
}
export interface IChatMcpServersStarting {
    readonly kind: "mcpServersStarting";
    readonly state?: IObservable<IAutostartResult>;
    didStartServerIds?: string[];
    toJSON(): IChatMcpServersStartingSerialized;
}
export interface IChatMcpServersStartingSerialized {
    readonly kind: "mcpServersStarting";
    readonly state?: undefined;
    didStartServerIds?: string[];
}
export interface IChatDisabledClaudeHooksPart {
    readonly kind: "disabledClaudeHooks";
}
export declare class ChatMcpServersStarting implements IChatMcpServersStarting {
    readonly state: IObservable<IAutostartResult>;
    readonly kind = "mcpServersStarting";
    didStartServerIds?: string[];
    get isEmpty(): boolean;
    constructor(state: IObservable<IAutostartResult>);
    wait(): Promise<IAutostartResult>;
    toJSON(): IChatMcpServersStartingSerialized;
}
export type IChatProgress = IChatMarkdownContent | IChatAgentMarkdownContentWithVulnerability | IChatTreeData | IChatMultiDiffData | IChatMultiDiffDataSerialized | IChatUsedContext | IChatContentReference | IChatContentInlineReference | IChatCodeCitation | IChatProgressMessage | IChatTask | IChatTaskResult | IChatCommandButton | IChatWarningMessage | IChatTextEdit | IChatNotebookEdit | IChatWorkspaceEdit | IChatMoveMessage | IChatResponseCodeblockUriPart | IChatConfirmation | IChatQuestionCarousel | IChatClearToPreviousToolInvocation | IChatToolInvocation | IChatToolInvocationSerialized | IChatExtensionsContent | IChatPullRequestContent | IChatUndoStop | IChatThinkingPart | IChatTaskSerialized | IChatElicitationRequest | IChatElicitationRequestSerialized | IChatMcpServersStarting | IChatMcpServersStartingSerialized | IChatHookPart | IChatExternalToolInvocationUpdate | IChatDisabledClaudeHooksPart;
export interface IChatFollowup {
    kind: "reply";
    message: string;
    agentId: string;
    subCommand?: string;
    title?: string;
    tooltip?: string;
}
export declare function isChatFollowup(obj: unknown): obj is IChatFollowup;
export declare enum ChatAgentVoteDirection {
    Down = 0,
    Up = 1
}
export declare enum ChatAgentVoteDownReason {
    IncorrectCode = "incorrectCode",
    DidNotFollowInstructions = "didNotFollowInstructions",
    IncompleteCode = "incompleteCode",
    MissingContext = "missingContext",
    PoorlyWrittenOrFormatted = "poorlyWrittenOrFormatted",
    RefusedAValidRequest = "refusedAValidRequest",
    OffensiveOrUnsafe = "offensiveOrUnsafe",
    Other = "other",
    WillReportIssue = "willReportIssue"
}
export interface IChatVoteAction {
    kind: "vote";
    direction: ChatAgentVoteDirection;
    reason: ChatAgentVoteDownReason | undefined;
}
export declare enum ChatCopyKind {
    Action = 1,
    Toolbar = 2
}
export interface IChatCopyAction {
    kind: "copy";
    codeBlockIndex: number;
    copyKind: ChatCopyKind;
    copiedCharacters: number;
    totalCharacters: number;
    copiedText: string;
    totalLines: number;
    copiedLines: number;
    modelId: string;
    languageId?: string;
}
export interface IChatInsertAction {
    kind: "insert";
    codeBlockIndex: number;
    totalCharacters: number;
    totalLines: number;
    languageId?: string;
    modelId: string;
    newFile?: boolean;
}
export interface IChatApplyAction {
    kind: "apply";
    codeBlockIndex: number;
    totalCharacters: number;
    totalLines: number;
    languageId?: string;
    modelId: string;
    newFile?: boolean;
    codeMapper?: string;
    editsProposed: boolean;
}
export interface IChatTerminalAction {
    kind: "runInTerminal";
    codeBlockIndex: number;
    languageId?: string;
}
export interface IChatCommandAction {
    kind: "command";
    commandButton: IChatCommandButton;
}
export interface IChatFollowupAction {
    kind: "followUp";
    followup: IChatFollowup;
}
export interface IChatBugReportAction {
    kind: "bug";
}
export interface IChatInlineChatCodeAction {
    kind: "inlineChat";
    action: "accepted" | "discarded";
}
export interface IChatEditingSessionAction {
    kind: "chatEditingSessionAction";
    uri: URI;
    hasRemainingEdits: boolean;
    outcome: "accepted" | "rejected" | "userModified";
}
export interface IChatEditingHunkAction {
    kind: "chatEditingHunkAction";
    uri: URI;
    lineCount: number;
    linesAdded: number;
    linesRemoved: number;
    outcome: "accepted" | "rejected";
    hasRemainingEdits: boolean;
    modeId?: string;
    modelId?: string;
    languageId?: string;
}
export type ChatUserAction = IChatVoteAction | IChatCopyAction | IChatInsertAction | IChatApplyAction | IChatTerminalAction | IChatCommandAction | IChatFollowupAction | IChatBugReportAction | IChatInlineChatCodeAction | IChatEditingSessionAction | IChatEditingHunkAction;
export interface IChatUserActionEvent {
    action: ChatUserAction;
    agentId: string | undefined;
    command: string | undefined;
    sessionResource: URI;
    requestId: string;
    result: IChatAgentResult | undefined;
    modelId?: string | undefined;
    modeId?: string | undefined;
}
export interface IChatDynamicRequest {
    /**
     * The message that will be displayed in the UI
     */
    message: string;
    /**
     * Any extra metadata/context that will go to the provider.
     */
    metadata?: any;
}
export interface IChatCompleteResponse {
    message: string | ReadonlyArray<IChatProgress>;
    result?: IChatAgentResult;
    followups?: IChatFollowup[];
}
export interface IChatSessionStats {
    readonly fileCount: number;
    readonly added: number;
    readonly removed: number;
}
export type IChatSessionTiming = {
    /**
     * Timestamp when the session was created in milliseconds elapsed since January 1, 1970 00:00:00 UTC.
     */
    readonly created: number;
    /**
     * Timestamp when the most recent request started in milliseconds elapsed since January 1, 1970 00:00:00 UTC.
     *
     * Should be undefined if no requests have been made yet.
     */
    readonly lastRequestStarted: number | undefined;
    /**
     * Timestamp when the most recent request completed in milliseconds elapsed since January 1, 1970 00:00:00 UTC.
     *
     * Should be undefined if the most recent request is still in progress or if no requests have been made yet.
     */
    readonly lastRequestEnded: number | undefined;
};
interface ILegacyChatSessionTiming {
    readonly startTime: number;
    readonly endTime?: number;
}
export declare function convertLegacyChatSessionTiming(timing: IChatSessionTiming | ILegacyChatSessionTiming): IChatSessionTiming;
export declare enum ResponseModelState {
    Pending = 0,
    Complete = 1,
    Cancelled = 2,
    Failed = 3,
    NeedsInput = 4
}
export interface IChatDetail {
    sessionResource: URI;
    title: string;
    lastMessageDate: number;
    timing: IChatSessionTiming | ILegacyChatSessionTiming;
    isActive: boolean;
    stats?: IChatSessionStats;
    lastResponseState: ResponseModelState;
}
export interface IChatProviderInfo {
    id: string;
}
export interface IChatSendRequestResponseState {
    responseCreatedPromise: Promise<IChatResponseModel>;
    responseCompletePromise: Promise<void>;
}
export interface IChatSendRequestData extends IChatSendRequestResponseState {
    agent: IChatAgentData;
    slashCommand?: IChatAgentCommand;
}
/**
 * Result of a sendRequest call - a discriminated union of possible outcomes.
 */
export type ChatSendResult = ChatSendResultRejected | ChatSendResultSent | ChatSendResultQueued;
export interface ChatSendResultRejected {
    readonly kind: "rejected";
    readonly reason: string;
}
export interface ChatSendResultSent {
    readonly kind: "sent";
    readonly data: IChatSendRequestData;
    /** Set when the session was replaced by a new one (e.g. untitled -> real contributed session). */
    readonly newSessionResource?: URI;
}
export interface ChatSendResultQueued {
    readonly kind: "queued";
    /**
     * Promise that resolves when the queued message is actually processed.
     * Will resolve to a 'sent' or 'rejected' result.
     */
    readonly deferred: Promise<ChatSendResult>;
}
export declare namespace ChatSendResult {
    function isSent(result: ChatSendResult): result is ChatSendResultSent;
    function isRejected(result: ChatSendResult): result is ChatSendResultRejected;
    function isQueued(result: ChatSendResult): result is ChatSendResultQueued;
    /** Assertion function for tests - asserts that the result is a sent result */
    function assertSent(result: ChatSendResult): asserts result is ChatSendResultSent;
}
export interface IChatEditorLocationData {
    type: ChatAgentLocation.EditorInline;
    id: string;
    document: URI;
    selection: ISelection;
    wholeRange: IRange;
}
export interface IChatNotebookLocationData {
    type: ChatAgentLocation.Notebook;
    sessionInputUri: URI;
}
export interface IChatTerminalLocationData {
    type: ChatAgentLocation.Terminal;
}
export type IChatLocationData = IChatEditorLocationData | IChatNotebookLocationData | IChatTerminalLocationData;
/**
 * The kind of queue request.
 */
export declare enum ChatRequestQueueKind {
    /** Request is queued to be sent after current request completes */
    Queued = "queued",
    /** Request is queued and signals the active request to yield */
    Steering = "steering"
}
export interface IChatSendRequestOptions {
    modeInfo?: IChatRequestModeInfo;
    userSelectedModelId?: string;
    userSelectedTools?: IObservable<UserSelectedTools>;
    location?: ChatAgentLocation;
    locationData?: IChatLocationData;
    parserContext?: IChatParserContext;
    attempt?: number;
    noCommandDetection?: boolean;
    acceptedConfirmationData?: any[];
    rejectedConfirmationData?: any[];
    attachedContext?: IChatRequestVariableEntry[];
    resolvedVariables?: IChatRequestVariableEntry[];
    /** The target agent ID can be specified with this property instead of using @ in 'message' */
    agentId?: string;
    /** agentId, but will not add a @ name to the request */
    agentIdSilent?: string;
    slashCommand?: string;
    /**
     * The label of the confirmation action that was selected.
     */
    confirmation?: string;
    /**
     * When set, queues this message to be sent after the current request completes.
     * If Steering, also sets yieldRequested on any active request to signal it should wrap up.
     */
    queue?: ChatRequestQueueKind;
    /**
     * When true, the queued request will not be processed immediately even if no request is active.
     * The request stays in the queue until `processPendingRequests` is called explicitly.
     */
    pauseQueue?: boolean;
}
export type IChatModelReference = IReference<IChatModel>;
export interface IChatSessionContext {
    readonly chatSessionResource: URI;
    readonly initialSessionOptions?: ReadonlyChatSessionOptionsMap;
}
export declare const KEYWORD_ACTIVIATION_SETTING_ID = "accessibility.voice.keywordActivation";
export interface IChatSessionStartOptions {
    canUseTools?: boolean;
    disableBackgroundKeepAlive?: boolean;
}
export declare const ChatStopCancellationNoopEventName = "chat.stopCancellationNoop";
export type ChatStopCancellationNoopEvent = {
    source: string;
    reason: "noWidget" | "noViewModel" | "noPendingRequest" | "requestAlreadyCanceled" | "requestIdUnavailable";
    requestInProgress: "true" | "false" | "unknown";
    pendingRequests: number;
    sessionScheme?: string;
    lastRequestId?: string;
    chatSessionId?: string;
};
export type ChatStopCancellationNoopClassification = {
    source: {
        classification: "SystemMetaData";
        purpose: "FeatureInsight";
        comment: "The layer where stop cancellation no-op occurred.";
    };
    reason: {
        classification: "SystemMetaData";
        purpose: "FeatureInsight";
        comment: "The no-op reason when stop cancellation did not dispatch fully.";
    };
    requestInProgress: {
        classification: "SystemMetaData";
        purpose: "FeatureInsight";
        comment: "Whether request-in-progress was true, false, or unknown at no-op time.";
    };
    pendingRequests: {
        classification: "SystemMetaData";
        purpose: "FeatureInsight";
        comment: "The number of queued pending requests at no-op time when known.";
        isMeasurement: true;
    };
    sessionScheme?: {
        classification: "SystemMetaData";
        purpose: "FeatureInsight";
        comment: "The URI scheme of the session resource (e.g. vscodeLocalChatSession vs remote).";
    };
    lastRequestId?: {
        classification: "SystemMetaData";
        purpose: "FeatureInsight";
        comment: "The ID of the last request in the session, for correlating with tool invocations.";
    };
    chatSessionId?: {
        classification: "SystemMetaData";
        purpose: "FeatureInsight";
        comment: "The chat session ID.";
    };
    owner: "roblourens";
    comment: "Tracks possible no-op stop cancellation paths.";
};
export declare const ChatPendingRequestChangeEventName = "chat.pendingRequestChange";
export type ChatPendingRequestChangeEvent = {
    action: "add" | "remove" | "notCancelable";
    source: string;
    requestId?: string;
    chatSessionId?: string;
};
export type ChatPendingRequestChangeClassification = {
    action: {
        classification: "SystemMetaData";
        purpose: "FeatureInsight";
        comment: "Whether a pending request was added or removed.";
    };
    source: {
        classification: "SystemMetaData";
        purpose: "FeatureInsight";
        comment: "The method that triggered the pending request change.";
    };
    requestId?: {
        classification: "SystemMetaData";
        purpose: "FeatureInsight";
        comment: "The request ID associated with the pending request change.";
    };
    chatSessionId?: {
        classification: "SystemMetaData";
        purpose: "FeatureInsight";
        comment: "The chat session ID.";
    };
    owner: "roblourens";
    comment: "Tracks pending request lifecycle changes in the chat service.";
};
export {};
