import { CancellationToken } from "../../../../base/common/cancellation.js";
import { IMarkdownString } from "../../../../base/common/htmlContent.js";
import { IJSONSchema } from "../../../../base/common/jsonSchema.js";
import { ThemeIcon } from "../../../../base/common/themables.js";
import { URI } from "../../../../base/common/uri.js";
import { Location } from "../../../../editor/common/languages.js";
import { ContextKeyExpression } from "../../../../platform/contextkey/common/contextkey.js";
import { ExtensionIdentifier } from "../../../../platform/extensions/common/extensions.js";
import { IProgress } from "../../../../platform/progress/common/progress.js";
import { IChatTerminalToolInvocationData, IChatToolInputInvocationData } from "./chatService.js";
import { VSBuffer } from "../../../../base/common/buffer.js";
export interface IToolData {
    id: string;
    source: ToolDataSource;
    toolReferenceName?: string;
    icon?: {
        dark: URI;
        light?: URI;
    } | ThemeIcon;
    when?: ContextKeyExpression;
    tags?: string[];
    displayName: string;
    userDescription?: string;
    modelDescription: string;
    inputSchema?: IJSONSchema;
    canBeReferencedInPrompt?: boolean;
    runsInWorkspace?: boolean;
    alwaysDisplayInputOutput?: boolean;
    supportsToolPicker?: boolean;
}
export interface IToolProgressStep {
    readonly message: string | IMarkdownString | undefined;
    readonly increment: number | undefined;
    readonly total: number | undefined;
}
export type ToolProgress = IProgress<IToolProgressStep>;
export type ToolDataSource = {
    type: "extension";
    label: string;
    extensionId: ExtensionIdentifier;
    isExternalTool: boolean;
} | {
    type: "mcp";
    label: string;
    collectionId: string;
    definitionId: string;
} | {
    type: "internal";
};
export declare namespace ToolDataSource {
    function toKey(source: ToolDataSource): string;
}
export interface IToolInvocation {
    callId: string;
    toolId: string;
    parameters: Object;
    tokenBudget?: number;
    context: IToolInvocationContext | undefined;
    chatRequestId?: string;
    chatInteractionId?: string;
    toolSpecificData?: IChatTerminalToolInvocationData | IChatToolInputInvocationData;
    modelId?: string;
}
export interface IToolInvocationContext {
    sessionId: string;
}
export declare function isToolInvocationContext(obj: any): obj is IToolInvocationContext;
export interface IToolResultInputOutputDetails {
    readonly input: string;
    readonly output: ({
        type: "text";
        value: string;
    } | {
        type: "data";
        mimeType: string;
        value64: string;
    })[];
    readonly isError?: boolean;
}
export declare function isToolResultInputOutputDetails(obj: any): obj is IToolResultInputOutputDetails;
export interface IToolResult {
    content: (IToolResultPromptTsxPart | IToolResultTextPart | IToolResultDataPart)[];
    toolResultMessage?: string | IMarkdownString;
    toolResultDetails?: Array<URI | Location> | IToolResultInputOutputDetails;
    toolResultError?: string;
}
export declare function toolResultHasBuffers(result: IToolResult): boolean;
export interface IToolResultPromptTsxPart {
    kind: "promptTsx";
    value: unknown;
}
export declare function stringifyPromptTsxPart(part: IToolResultPromptTsxPart): string;
export interface IToolResultTextPart {
    kind: "text";
    value: string;
}
export interface IToolResultDataPart {
    kind: "data";
    value: {
        mimeType: string;
        data: VSBuffer;
    };
}
export interface IToolConfirmationMessages {
    title: string;
    message: string | IMarkdownString;
    allowAutoConfirm?: boolean;
}
export interface IPreparedToolInvocation {
    invocationMessage?: string | IMarkdownString;
    pastTenseMessage?: string | IMarkdownString;
    originMessage?: string | IMarkdownString;
    confirmationMessages?: IToolConfirmationMessages;
    presentation?: "hidden" | undefined;
    toolSpecificData?: IChatTerminalToolInvocationData | IChatToolInputInvocationData;
}
export interface IToolImpl {
    invoke(invocation: IToolInvocation, countTokens: CountTokensCallback, progress: ToolProgress, token: CancellationToken): Promise<IToolResult>;
    prepareToolInvocation?(parameters: any, token: CancellationToken): Promise<IPreparedToolInvocation | undefined>;
}
export type CountTokensCallback = (input: string, token: CancellationToken) => Promise<number>;
export declare function createToolInputUri(toolOrId: IToolData | string): URI;
export declare function createToolSchemaUri(toolOrId: IToolData | string): URI;
