import { ToolConfirmationMode } from '../common/chat-tool-preferences'; import { AiConfigurationService, ToolRequest } from '@theia/ai-core'; /** * The loop-invariant inputs to {@link ToolConfirmationManager.computeEffectiveDefaultForTool}: * the product-shipped per-tool schema defaults and the effective global default. Reading these * once lets bulk operations avoid re-inspecting the preference schema per tool. */ interface ToolConfirmationDefaults { perToolDefaults?: { [toolId: string]: ToolConfirmationMode; }; globalDefault: ToolConfirmationMode; } /** * Utility class to manage tool confirmation settings */ export declare class ToolConfirmationManager { protected readonly aiConfigurationService: AiConfigurationService; protected sessionOverrides: Map>; /** * Get the global default confirmation mode (used when no tool-specific entry exists). * * Read through the trust-aware reader so that an untrusted workspace cannot override * the default to a more permissive value. */ getDefaultConfirmationMode(): ToolConfirmationMode; /** * Set the global default confirmation mode. * * Returns the promise produced by the underlying preference update so callers can * `await` completion and react to errors (e.g. show a notification on failure). */ setDefaultConfirmationMode(mode: ToolConfirmationMode): Promise; /** * Get the confirmation mode for a specific tool, considering session overrides first (per chat). * * For tools with `confirmAlwaysAllow` flag: * - They default to CONFIRM mode instead of inheriting ALWAYS_ALLOW from the global default. * - Tool-specific preference entries are still respected (informed user consent). * * @param toolId - The tool identifier * @param chatId - The chat session identifier * @param toolRequest - Optional ToolRequest to check for confirmAlwaysAllow flag */ getConfirmationMode(toolId: string, chatId: string, toolRequest?: ToolRequest): ToolConfirmationMode; /** * Set the confirmation mode for a specific tool (persisted) * * @param toolId - The tool identifier * @param mode - The confirmation mode to set * @param toolRequest - Optional ToolRequest to check for confirmAlwaysAllow flag */ setConfirmationMode(toolId: string, mode: ToolConfirmationMode, toolRequest?: ToolRequest): Promise; /** * Apply multiple per-tool confirmation modes with a single preference write. * * Preserves the same "remove entry if it matches the effective default" behavior as * {@link setConfirmationMode}. Use this for bulk operations to avoid one preference * round-trip per tool. */ setConfirmationModes(updates: Iterable<{ toolId: string; mode: ToolConfirmationMode; toolRequest?: ToolRequest; }>): Promise; /** * Set the confirmation mode for a specific tool for this session only (not persisted, per chat) */ setSessionConfirmationMode(toolId: string, mode: ToolConfirmationMode, chatId: string): void; /** * Clear all session overrides for a specific chat, or all if no chatId is given */ clearSessionOverrides(chatId?: string): void; /** * Get all tool confirmation settings */ getAllConfirmationSettings(): { [toolId: string]: ToolConfirmationMode; }; resetAllConfirmationModeSettings(): Promise; /** * Read the loop-invariant inputs for {@link computeEffectiveDefaultForTool}: the product-shipped * per-tool schema defaults and the effective global default. */ protected readConfirmationDefaults(): ToolConfirmationDefaults; protected computeEffectiveDefaultForTool(toolId: string, toolRequest?: ToolRequest, defaults?: ToolConfirmationDefaults): ToolConfirmationMode; /** * Read the schema-level default for the default-confirmation preference. * Falls back to CONFIRM if the preference service has not registered the schema yet. */ protected getDefaultPreferenceSchemaDefault(): ToolConfirmationMode; } export {}; //# sourceMappingURL=chat-tool-preference-bindings.d.ts.map