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 { IOffsetRange } from "../../../../../editor/common/core/ranges/offsetRange.js"; import { Location, SymbolKind } from "../../../../../editor/common/languages.js"; import { MarkerSeverity, IMarker } from "../../../../../platform/markers/common/markers.js"; import { ISCMHistoryItem } from "../../../scm/common/history.js"; import { IChatContentReference } from "../chatService/chatService.js"; import { IChatRequestVariableValue } from "./chatVariables.js"; import { IToolData, IToolSet } from "../tools/languageModelToolsService.js"; interface IBaseChatRequestVariableEntry { readonly id: string; readonly fullName?: string; readonly icon?: ThemeIcon; readonly name: string; readonly modelDescription?: string; /** * The offset-range in the prompt. This means this entry has been explicitly typed out * by the user. */ readonly range?: IOffsetRange; readonly value: IChatRequestVariableValue; readonly references?: IChatContentReference[]; omittedState?: OmittedState; } export interface IGenericChatRequestVariableEntry extends IBaseChatRequestVariableEntry { kind: "generic"; tooltip?: IMarkdownString; } export interface IChatRequestDirectoryEntry extends IBaseChatRequestVariableEntry { kind: "directory"; } export interface IChatRequestFileEntry extends IBaseChatRequestVariableEntry { kind: "file"; } export declare enum OmittedState { NotOmitted = 0, Partial = 1, Full = 2 } export interface IChatRequestToolEntry extends IBaseChatRequestVariableEntry { readonly kind: "tool"; } export interface IChatRequestToolSetEntry extends IBaseChatRequestVariableEntry { readonly kind: "toolset"; readonly value: IChatRequestToolEntry[]; } export type ChatRequestToolReferenceEntry = IChatRequestToolEntry | IChatRequestToolSetEntry; export interface StringChatContextValue { value?: string; name?: string; modelDescription?: string; icon?: ThemeIcon; uri: URI; resourceUri?: URI; tooltip?: IMarkdownString; /** * Command ID to execute when this context item is clicked. */ readonly commandId?: string; readonly handle: number; } export interface IChatRequestImplicitVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "implicit"; readonly isFile: true; readonly value: URI | Location | StringChatContextValue | undefined; readonly uri: URI | undefined; readonly isSelection: boolean; enabled: boolean; } export interface IChatRequestStringVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "string"; readonly value: string | undefined; readonly modelDescription?: string; readonly icon?: ThemeIcon; readonly uri: URI; readonly resourceUri?: URI; readonly tooltip?: IMarkdownString; /** * Command ID to execute when this context item is clicked. */ readonly commandId?: string; readonly handle: number; } export interface IChatRequestWorkspaceVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "workspace"; readonly value: string; readonly modelDescription?: string; } export interface IChatRequestPasteVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "paste"; readonly code: string; readonly language: string; readonly pastedLines: string; readonly fileName: string; readonly copiedFrom: { readonly uri: URI; readonly range: IRange; } | undefined; } export interface ISymbolVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "symbol"; readonly value: Location; readonly symbolKind: SymbolKind; } export interface ICommandResultVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "command"; } export interface IImageVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "image"; readonly isPasted?: boolean; readonly isURL?: boolean; readonly mimeType?: string; } export interface INotebookOutputVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "notebookOutput"; readonly outputIndex?: number; readonly mimeType?: string; } export interface IDiagnosticVariableEntryFilterData { readonly owner?: string; readonly problemMessage?: string; readonly filterUri?: URI; readonly filterSeverity?: MarkerSeverity; readonly filterRange?: IRange; } export declare namespace IDiagnosticVariableEntryFilterData { const icon: ThemeIcon; function fromMarker(marker: IMarker): IDiagnosticVariableEntryFilterData; function toEntry(data: IDiagnosticVariableEntryFilterData): IDiagnosticVariableEntry; function id(data: IDiagnosticVariableEntryFilterData): string; function label(data: IDiagnosticVariableEntryFilterData): string; } export interface IDiagnosticVariableEntry extends IBaseChatRequestVariableEntry, IDiagnosticVariableEntryFilterData { readonly kind: "diagnostic"; } export interface IElementAncestorData { readonly tagName: string; readonly id?: string; readonly classNames?: string[]; } export interface IElementVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "element"; readonly ancestors?: IElementAncestorData[]; readonly attributes?: Record; readonly computedStyles?: Record; readonly dimensions?: { readonly top: number; readonly left: number; readonly width: number; readonly height: number; }; readonly innerText?: string; } export interface IPromptFileVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "promptFile"; readonly value: URI; readonly isRoot: boolean; readonly originLabel?: string; readonly modelDescription: string; readonly automaticallyAdded: boolean; readonly toolReferences?: readonly ChatRequestToolReferenceEntry[]; } export interface IPromptTextVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "promptText"; readonly value: string; readonly settingId?: string; readonly modelDescription: string; readonly automaticallyAdded: boolean; readonly toolReferences?: readonly ChatRequestToolReferenceEntry[]; } export interface ISCMHistoryItemVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "scmHistoryItem"; readonly value: URI; readonly historyItem: ISCMHistoryItem; } export interface ISCMHistoryItemChangeVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "scmHistoryItemChange"; readonly value: URI; readonly historyItem: ISCMHistoryItem; } export interface ISCMHistoryItemChangeRangeVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "scmHistoryItemChangeRange"; readonly value: URI; readonly historyItemChangeStart: { readonly uri: URI; readonly historyItem: ISCMHistoryItem; }; readonly historyItemChangeEnd: { readonly uri: URI; readonly historyItem: ISCMHistoryItem; }; } export interface ITerminalVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "terminalCommand"; readonly value: string; readonly resource: URI; readonly command: string; readonly output?: string; readonly exitCode?: number; } export interface IDebugVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "debugVariable"; readonly value: string; readonly expression: string; readonly type?: string; } export interface IAgentFeedbackVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "agentFeedback"; readonly sessionResource: URI; readonly feedbackItems: ReadonlyArray<{ readonly id: string; readonly text: string; readonly resourceUri: URI; readonly range: IRange; readonly codeSelection?: string; }>; } export interface IChatRequestDebugEventsVariableEntry extends IBaseChatRequestVariableEntry { readonly kind: "debugEvents"; /** Timestamp when the debug events were snapshotted. */ readonly snapshotTime: number; /** The session resource these debug events belong to. */ readonly sessionResource: URI; } export type IChatRequestVariableEntry = IGenericChatRequestVariableEntry | IChatRequestImplicitVariableEntry | IChatRequestPasteVariableEntry | ISymbolVariableEntry | ICommandResultVariableEntry | IDiagnosticVariableEntry | IImageVariableEntry | IChatRequestToolEntry | IChatRequestToolSetEntry | IChatRequestDirectoryEntry | IChatRequestFileEntry | INotebookOutputVariableEntry | IElementVariableEntry | IPromptFileVariableEntry | IPromptTextVariableEntry | ISCMHistoryItemVariableEntry | ISCMHistoryItemChangeVariableEntry | ISCMHistoryItemChangeRangeVariableEntry | ITerminalVariableEntry | IChatRequestStringVariableEntry | IChatRequestWorkspaceVariableEntry | IDebugVariableEntry | IAgentFeedbackVariableEntry | IChatRequestDebugEventsVariableEntry; export declare namespace IChatRequestVariableEntry { /** * Returns URI of the passed variant entry. Return undefined if not found. */ function toUri(entry: IChatRequestVariableEntry): URI | undefined; function toExport(v: IChatRequestVariableEntry): IChatRequestVariableEntry; function fromExport(v: IChatRequestVariableEntry): IChatRequestVariableEntry; } export declare function isImplicitVariableEntry(obj: IChatRequestVariableEntry): obj is IChatRequestImplicitVariableEntry; export declare function isStringVariableEntry(obj: IChatRequestVariableEntry): obj is IChatRequestStringVariableEntry; export declare function isTerminalVariableEntry(obj: IChatRequestVariableEntry): obj is ITerminalVariableEntry; export declare function isDebugVariableEntry(obj: IChatRequestVariableEntry): obj is IDebugVariableEntry; export declare function isAgentFeedbackVariableEntry(obj: IChatRequestVariableEntry): obj is IAgentFeedbackVariableEntry; export declare function isPasteVariableEntry(obj: IChatRequestVariableEntry): obj is IChatRequestPasteVariableEntry; export declare function isWorkspaceVariableEntry(obj: IChatRequestVariableEntry): obj is IChatRequestWorkspaceVariableEntry; export declare function isImageVariableEntry(obj: IChatRequestVariableEntry): obj is IImageVariableEntry; export declare function isNotebookOutputVariableEntry(obj: IChatRequestVariableEntry): obj is INotebookOutputVariableEntry; export declare function isElementVariableEntry(obj: IChatRequestVariableEntry): obj is IElementVariableEntry; export declare function isDiagnosticsVariableEntry(obj: IChatRequestVariableEntry): obj is IDiagnosticVariableEntry; export declare function isChatRequestFileEntry(obj: IChatRequestVariableEntry): obj is IChatRequestFileEntry; export declare function isPromptFileVariableEntry(obj: IChatRequestVariableEntry): obj is IPromptFileVariableEntry; export declare function isPromptTextVariableEntry(obj: IChatRequestVariableEntry): obj is IPromptTextVariableEntry; export declare function isChatRequestVariableEntry(obj: unknown): obj is IChatRequestVariableEntry; export declare function isSCMHistoryItemVariableEntry(obj: IChatRequestVariableEntry): obj is ISCMHistoryItemVariableEntry; export declare function isSCMHistoryItemChangeVariableEntry(obj: IChatRequestVariableEntry): obj is ISCMHistoryItemChangeVariableEntry; export declare function isSCMHistoryItemChangeRangeVariableEntry(obj: IChatRequestVariableEntry): obj is ISCMHistoryItemChangeRangeVariableEntry; export declare function isStringImplicitContextValue(value: unknown): value is StringChatContextValue; export declare enum PromptFileVariableKind { Instruction = "vscode.prompt.instructions.root", InstructionReference = "vscode.prompt.instructions", PromptFile = "vscode.prompt.file" } /** * Utility to convert a {@link uri} to a chat variable entry. * The `id` of the chat variable can be one of the following: * * - `vscode.prompt.instructions__`: for all non-root prompt instructions references * - `vscode.prompt.instructions.root__`: for *root* prompt instructions references * - `vscode.prompt.file__`: for prompt file references * * @param uri A resource URI that points to a prompt instructions file. * @param kind The kind of the prompt file variable entry. */ export declare function toPromptFileVariableEntry(uri: URI, kind: PromptFileVariableKind, originLabel?: string, automaticallyAdded?: boolean, toolReferences?: ChatRequestToolReferenceEntry[]): IPromptFileVariableEntry; export declare function toPromptTextVariableEntry(content: string, automaticallyAdded?: boolean, toolReferences?: ChatRequestToolReferenceEntry[]): IPromptTextVariableEntry; export declare function toFileVariableEntry(uri: URI, range?: IRange): IChatRequestFileEntry; export declare function toToolVariableEntry(entry: IToolData, range?: IOffsetRange): IChatRequestToolEntry; export declare function toToolSetVariableEntry(entry: IToolSet, range?: IOffsetRange): IChatRequestToolSetEntry; export declare class ChatRequestVariableSet { private _ids; private _entries; constructor(entries?: IChatRequestVariableEntry[]); add(...entry: IChatRequestVariableEntry[]): void; insertFirst(entry: IChatRequestVariableEntry): void; remove(entry: IChatRequestVariableEntry): void; has(entry: IChatRequestVariableEntry): boolean; asArray(): IChatRequestVariableEntry[]; get length(): number; } export {};