import { URI } from "../../../../../base/common/uri.js"; import { IQuickInputButton, IQuickTreeItem } from "../../../../../platform/quickinput/common/quickInput.js"; import { ConfirmedReason } from "../chatService/chatService.js"; import { ToolDataSource } from "./languageModelToolsService.js"; export interface ILanguageModelToolConfirmationActions { /** Label for the action */ label: string; /** Action detail (e.g. tooltip) */ detail?: string; /** Show a separator before this action */ divider?: boolean; /** The scope of this action, if applicable */ scope?: "session" | "workspace" | "profile"; /** Selects this action. Resolves true if the action should be confirmed after selection */ select(): Promise; } export interface ILanguageModelToolConfirmationRef { toolId: string; source: ToolDataSource; parameters: unknown; chatSessionResource?: URI; } export interface ILanguageModelToolConfirmationActionProducer { getPreConfirmAction(ref: ILanguageModelToolConfirmationRef): ConfirmedReason | undefined; getPostConfirmAction(ref: ILanguageModelToolConfirmationRef): ConfirmedReason | undefined; /** Gets the selectable actions to take to memorize confirmation changes */ getPreConfirmActions(ref: ILanguageModelToolConfirmationRef): ILanguageModelToolConfirmationActions[]; getPostConfirmActions(ref: ILanguageModelToolConfirmationRef): ILanguageModelToolConfirmationActions[]; } export interface ILanguageModelToolConfirmationContributionQuickTreeItem extends IQuickTreeItem { onDidTriggerItemButton?(button: IQuickInputButton): void; onDidChangeChecked?(checked: boolean): void; onDidOpen?(): void | Promise; } /** * Type that can be registered to provide more specific confirmation * actions for a specific tool. */ export type ILanguageModelToolConfirmationContribution = Partial & { /** * Gets items to be shown in the `manageConfirmationPreferences` quick tree. * These are added under the tool's category. */ getManageActions?(): ILanguageModelToolConfirmationContributionQuickTreeItem[]; /** * Defaults to true. If false, the "Always Allow" options will not be shown * and _only_ your custom manage actions will be shown. */ canUseDefaultApprovals?: boolean; /** * Reset all confirmation settings for this tool. */ reset?(): void; };