import { DeferredPromise } from "../../../../base/common/async.js";
import { Event } from "../../../../base/common/event.js";
import { IMarkdownString } from "../../../../base/common/htmlContent.js";
import { ThemeIcon } from "../../../../base/common/themables.js";
import { URI } from "../../../../base/common/uri.js";
import { IRange } from "../../../../editor/common/core/range.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 { ICellEditOperation } from "../../notebook/common/notebookCommon.js";
import { IWorkspaceSymbol } from "@codingame/monaco-vscode-42931eb9-e564-530c-bafc-fa23ab43a070-common/vscode/vs/workbench/contrib/search/common/search";
import { IChatAgentCommand, IChatAgentData, IChatAgentResult } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatAgents";
import { IChatRequestVariableEntry, IChatResponseModel } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatModel";
import { IChatParserContext } from "@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatRequestParser";
import { IChatRequestVariableValue } from "./chatVariables.js";
import { ChatAgentLocation, ChatMode } from "./constants.js";
import { IPreparedToolInvocation, IToolConfirmationMessages, IToolResult } from "./languageModelToolsService.js";
export interface IChatRequest {
    message: string;
    variables: Record<string, IChatRequestVariableValue[]>;
}
export declare enum ChatErrorLevel {
    Info = 0,
    Warning = 1,
    Error = 2
}
export interface IChatResponseErrorDetails {
    message: string;
    responseIsIncomplete?: boolean;
    responseIsFiltered?: boolean;
    responseIsRedacted?: boolean;
    isQuotaExceeded?: boolean;
    level?: ChatErrorLevel;
}
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 enum ChatResponseReferencePartStatusKind {
    Complete = 1,
    Partial = 2,
    Omitted = 3
}
export interface IChatContentReference {
    reference: URI | Location | IChatContentVariableReference | string;
    iconPath?: ThemeIcon | {
        light: URI;
        dark?: URI;
    };
    options?: {
        status?: {
            description: string;
            kind: ChatResponseReferencePartStatusKind;
        };
    };
    kind: "reference";
}
export interface IChatCodeCitation {
    value: URI;
    license: string;
    snippet: string;
    kind: "codeCitation";
}
export interface IChatContentInlineReference {
    resolveId?: string;
    inlineReference: URI | Location | IWorkspaceSymbol;
    name?: string;
    kind: "inlineReference";
}
export interface IChatMarkdownContent {
    content: IMarkdownString;
    inlineReferences?: Record<string, IChatContentInlineReference>;
    kind: "markdownContent";
}
export interface IChatTreeData {
    treeData: IChatResponseProgressFileTreeData;
    kind: "treeData";
}
export interface IChatProgressMessage {
    content: IMarkdownString;
    kind: "progressMessage";
}
export interface IChatTask extends IChatTaskDto {
    deferred: DeferredPromise<string | void>;
    progress: (IChatWarningMessage | IChatContentReference)[];
    onDidAddProgress: Event<IChatWarningMessage | IChatContentReference>;
    add(progress: IChatWarningMessage | IChatContentReference): void;
    complete: (result: string | void) => void;
    task: () => Promise<string | void>;
    isSettled: () => boolean;
}
export interface IChatUndoStop {
    kind: "undoStop";
    id: string;
}
export interface IChatTaskDto {
    content: IMarkdownString;
    kind: "progressTask";
}
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;
}
export interface IChatAgentMarkdownContentWithVulnerability {
    content: IMarkdownString;
    vulnerabilities: IChatAgentVulnerabilityDetails[];
    kind: "markdownVuln";
}
export interface IChatCommandButton {
    command: Command;
    kind: "command";
}
export interface IChatMoveMessage {
    uri: URI;
    range: IRange;
    kind: "move";
}
export interface IChatTextEdit {
    uri: URI;
    edits: TextEdit[];
    kind: "textEdit";
    done?: boolean;
}
export interface IChatNotebookEdit {
    uri: URI;
    edits: ICellEditOperation[];
    kind: "notebookEdit";
    done?: boolean;
}
export interface IChatConfirmation {
    title: string;
    message: string;
    data: any;
    buttons?: string[];
    isUsed?: boolean;
    kind: "confirmation";
}
export interface IChatTerminalToolInvocationData {
    kind: "terminal";
    command: string;
    language: string;
}
export interface IChatToolInputInvocationData {
    kind: "input";
    rawInput: any;
}
export interface IChatToolInvocation {
    presentation: IPreparedToolInvocation["presentation"];
    toolSpecificData?: IChatTerminalToolInvocationData | IChatToolInputInvocationData;
    confirmationMessages?: IToolConfirmationMessages;
    confirmed: DeferredPromise<boolean>;
    isConfirmed: boolean | undefined;
    invocationMessage: string | IMarkdownString;
    pastTenseMessage: string | IMarkdownString | undefined;
    resultDetails: IToolResult["toolResultDetails"];
    readonly toolId: string;
    readonly toolCallId: string;
    isCompletePromise: Promise<void>;
    isComplete: boolean;
    complete(result: IToolResult): void;
    kind: "toolInvocation";
}
export interface IChatToolInvocationSerialized {
    presentation: IPreparedToolInvocation["presentation"];
    toolSpecificData?: IChatTerminalToolInvocationData | IChatToolInputInvocationData;
    invocationMessage: string | IMarkdownString;
    pastTenseMessage: string | IMarkdownString | undefined;
    resultDetails: IToolResult["toolResultDetails"];
    isConfirmed: boolean | undefined;
    isComplete: boolean;
    toolCallId: string;
    kind: "toolInvocationSerialized";
}
export type IChatProgress = IChatMarkdownContent | IChatAgentMarkdownContentWithVulnerability | IChatTreeData | IChatUsedContext | IChatContentReference | IChatContentInlineReference | IChatCodeCitation | IChatProgressMessage | IChatTask | IChatTaskResult | IChatCommandButton | IChatWarningMessage | IChatTextEdit | IChatNotebookEdit | IChatMoveMessage | IChatResponseCodeblockUriPart | IChatConfirmation | IChatToolInvocation | IChatToolInvocationSerialized | IChatUndoStop;
export interface IChatFollowup {
    kind: "reply";
    message: string;
    agentId: string;
    subCommand?: string;
    title?: string;
    tooltip?: string;
}
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;
}
export interface IChatInsertAction {
    kind: "insert";
    codeBlockIndex: number;
    totalCharacters: number;
    newFile?: boolean;
}
export interface IChatApplyAction {
    kind: "apply";
    codeBlockIndex: number;
    totalCharacters: number;
    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" | "saved";
}
export type ChatUserAction = IChatVoteAction | IChatCopyAction | IChatInsertAction | IChatApplyAction | IChatTerminalAction | IChatCommandAction | IChatFollowupAction | IChatBugReportAction | IChatInlineChatCodeAction | IChatEditingSessionAction;
export interface IChatUserActionEvent {
    action: ChatUserAction;
    agentId: string | undefined;
    command: string | undefined;
    sessionId: string;
    requestId: string;
    result: IChatAgentResult | undefined;
}
export interface IChatDynamicRequest {
    message: string;
    metadata?: any;
}
export interface IChatCompleteResponse {
    message: string | ReadonlyArray<IChatProgress>;
    result?: IChatAgentResult;
    followups?: IChatFollowup[];
}
export interface IChatDetail {
    sessionId: string;
    title: string;
    lastMessageDate: number;
    isActive: boolean;
}
export interface IChatProviderInfo {
    id: string;
}
export interface IChatTransferredSessionData {
    sessionId: string;
    inputValue: string;
    location: ChatAgentLocation;
    mode: ChatMode;
}
export interface IChatSendRequestResponseState {
    responseCreatedPromise: Promise<IChatResponseModel>;
    responseCompletePromise: Promise<void>;
}
export interface IChatSendRequestData extends IChatSendRequestResponseState {
    agent: IChatAgentData;
    slashCommand?: IChatAgentCommand;
}
export interface IChatEditorLocationData {
    type: ChatAgentLocation.Editor;
    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;
export interface IChatSendRequestOptions {
    mode?: ChatMode;
    userSelectedModelId?: string;
    userSelectedTools?: string[];
    location?: ChatAgentLocation;
    locationData?: IChatLocationData;
    parserContext?: IChatParserContext;
    attempt?: number;
    noCommandDetection?: boolean;
    acceptedConfirmationData?: any[];
    rejectedConfirmationData?: any[];
    attachedContext?: IChatRequestVariableEntry[];
    agentId?: string;
    slashCommand?: string;
    confirmation?: string;
    hasInstructionAttachments?: boolean;
}
export declare const KEYWORD_ACTIVIATION_SETTING_ID = "accessibility.voice.keywordActivation";
