import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation"; import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event"; import { Disposable, IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle"; import { ContextKeyExpression } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey"; import { IProgress } from "@codingame/monaco-vscode-api/vscode/vs/platform/progress/common/progress"; import { IChatMessage } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels"; import { IChatFollowup, IChatProgress, IChatResponseProgressFileTreeData, IChatSendRequestOptions } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService"; import { IExtensionService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service"; import { ChatAgentLocation, ChatModeKind } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants"; import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { IChatSlashCommandService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/participants/chatSlashCommands.service"; export interface IChatSlashData { command: string; detail: string; sortText?: string; /** * Whether the command should execute as soon * as it is entered. Defaults to `false`. */ executeImmediately?: boolean; /** * Whether the command should be added as a request/response * turn to the chat history. Defaults to `false`. * * For instance, the `/save` command opens an untitled document * to the side hence does not contain any chatbot responses. */ silent?: boolean; locations: ChatAgentLocation[]; modes?: ChatModeKind[]; sessionTypes?: string[]; /** * Optional context key expression that controls visibility of this command. * When set, the command is only shown if the expression evaluates to true. */ when?: ContextKeyExpression; } export interface IChatSlashFragment { content: string | { treeData: IChatResponseProgressFileTreeData; }; } export type IChatSlashCallback = { (prompt: string, progress: IProgress, history: IChatMessage[], location: ChatAgentLocation, sessionResource: URI, token: CancellationToken, options?: IChatSendRequestOptions): Promise<{ followUp: IChatFollowup[]; } | void>; }; export declare class ChatSlashCommandService extends Disposable implements IChatSlashCommandService { private readonly _extensionService; _serviceBrand: undefined; private readonly _commands; private readonly _onDidChangeCommands; readonly onDidChangeCommands: Event; constructor(_extensionService: IExtensionService); dispose(): void; private getSessionScopedCommands; private commandsOverlap; private getCommand; registerSlashCommand(data: IChatSlashData, command: IChatSlashCallback): IDisposable; getCommands(location: ChatAgentLocation, mode: ChatModeKind): Array; hasCommand(id: string, sessionType: string): boolean; executeCommand(id: string, prompt: string, progress: IProgress, history: IChatMessage[], location: ChatAgentLocation, sessionResource: URI, token: CancellationToken, options?: IChatSendRequestOptions): Promise<{ followUp: IChatFollowup[]; } | void>; }