/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import { AuthType, type ContentGeneratorConfig } from '../core/contentGenerator.js';
import { PromptRegistry } from '../prompts/prompt-registry.js';
import { ToolRegistry } from '../tools/tool-registry.js';
import type { SubagentSchedulerFactory } from '../core/subagentScheduler.js';
import { GeminiClient } from '../core/client.js';
import { FileDiscoveryService } from '../services/fileDiscoveryService.js';
import { GitService } from '../services/gitService.js';
import { TelemetryTarget } from '../telemetry/index.js';
import { DEFAULT_GEMINI_FLASH_MODEL } from './models.js';
import type { IProviderManager as ProviderManager } from '../providers/IProviderManager.js';
import { type MCPOAuthConfig } from '../mcp/oauth-provider.js';
import { IdeClient } from '../ide/ide-client.js';
import { SettingsService } from '../settings/SettingsService.js';
import { type FileSystemService } from '../services/fileSystemService.js';
import { ProfileManager } from './profileManager.js';
import { SubagentManager } from './subagentManager.js';
export type { MCPOAuthConfig, AnyToolInvocation };
import type { AnyToolInvocation } from '../tools/tools.js';
import { WorkspaceContext } from '../utils/workspaceContext.js';
import { Storage } from './storage.js';
import { FileExclusions } from '../utils/ignorePatterns.js';
import type { EventEmitter } from 'node:events';
import { MessageBus } from '../confirmation-bus/message-bus.js';
import { PolicyEngine } from '../policy/policy-engine.js';
import type { PolicyEngineConfig } from '../policy/types.js';
export interface RedactionConfig {
    redactApiKeys: boolean;
    redactCredentials: boolean;
    redactFilePaths: boolean;
    redactUrls: boolean;
    redactEmails: boolean;
    redactPersonalInfo: boolean;
    customPatterns?: Array<{
        name: string;
        pattern: RegExp;
        replacement: string;
        enabled: boolean;
    }>;
}
export declare enum ApprovalMode {
    DEFAULT = "default",
    AUTO_EDIT = "autoEdit",
    YOLO = "yolo"
}
export interface AccessibilitySettings {
    disableLoadingPhrases?: boolean;
    screenReader?: boolean;
}
export interface BugCommandSettings {
    urlTemplate: string;
}
export interface ChatCompressionSettings {
    contextPercentageThreshold?: number;
}
export interface SummarizeToolOutputSettings {
    tokenBudget?: number;
}
export interface ComplexityAnalyzerSettings {
    complexityThreshold?: number;
    minTasksForSuggestion?: number;
    suggestionCooldownMs?: number;
}
export interface TelemetrySettings {
    enabled?: boolean;
    target?: TelemetryTarget;
    otlpEndpoint?: string;
    logPrompts?: boolean;
    outfile?: string;
    logConversations?: boolean;
    logResponses?: boolean;
    redactSensitiveData?: boolean;
    maxConversationHistory?: number;
    conversationLogPath?: string;
    maxLogFiles?: number;
    maxLogSizeMB?: number;
    retentionDays?: number;
    redactFilePaths?: boolean;
    redactUrls?: boolean;
    redactEmails?: boolean;
    redactPersonalInfo?: boolean;
    customRedactionPatterns?: Array<{
        name: string;
        pattern: RegExp;
        replacement: string;
        enabled: boolean;
    }>;
    enableDataRetention?: boolean;
    conversationExpirationDays?: number;
    maxConversationsStored?: number;
    remoteConsentGiven?: boolean;
}
export interface GeminiCLIExtension {
    name: string;
    version: string;
    isActive: boolean;
    path: string;
    installMetadata?: ExtensionInstallMetadata;
}
export interface ExtensionInstallMetadata {
    source: string;
    type: 'git' | 'local' | 'link' | 'github-release';
    releaseTag?: string;
    ref?: string;
    autoUpdate?: boolean;
}
import type { FileFilteringOptions } from './constants.js';
import { DEFAULT_MEMORY_FILE_FILTERING_OPTIONS, DEFAULT_FILE_FILTERING_OPTIONS } from './constants.js';
export type { FileFilteringOptions };
export { DEFAULT_MEMORY_FILE_FILTERING_OPTIONS, DEFAULT_FILE_FILTERING_OPTIONS, };
export declare const DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD = 4000000;
export declare const DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES = 1000;
export declare class MCPServerConfig {
    readonly command?: string | undefined;
    readonly args?: string[] | undefined;
    readonly env?: Record<string, string> | undefined;
    readonly cwd?: string | undefined;
    readonly url?: string | undefined;
    readonly httpUrl?: string | undefined;
    readonly headers?: Record<string, string> | undefined;
    readonly tcp?: string | undefined;
    readonly timeout?: number | undefined;
    readonly trust?: boolean | undefined;
    readonly description?: string | undefined;
    readonly includeTools?: string[] | undefined;
    readonly excludeTools?: string[] | undefined;
    readonly extensionName?: string | undefined;
    readonly oauth?: MCPOAuthConfig | undefined;
    readonly authProviderType?: AuthProviderType | undefined;
    readonly targetAudience?: string | undefined;
    readonly targetServiceAccount?: string | undefined;
    constructor(command?: string | undefined, args?: string[] | undefined, env?: Record<string, string> | undefined, cwd?: string | undefined, url?: string | undefined, httpUrl?: string | undefined, headers?: Record<string, string> | undefined, tcp?: string | undefined, timeout?: number | undefined, trust?: boolean | undefined, description?: string | undefined, includeTools?: string[] | undefined, excludeTools?: string[] | undefined, extensionName?: string | undefined, oauth?: MCPOAuthConfig | undefined, authProviderType?: AuthProviderType | undefined, targetAudience?: string | undefined, targetServiceAccount?: string | undefined);
}
export declare enum AuthProviderType {
    DYNAMIC_DISCOVERY = "dynamic_discovery",
    GOOGLE_CREDENTIALS = "google_credentials",
    SERVICE_ACCOUNT_IMPERSONATION = "service_account_impersonation"
}
export interface SandboxConfig {
    command: 'docker' | 'podman' | 'sandbox-exec';
    image: string;
}
export interface ActiveExtension {
    name: string;
    version: string;
}
/**
 * Handler for bucket failover on rate limit/quota errors
 * @plan PLAN-20251213issue490
 */
export interface BucketFailoverHandler {
    /**
     * Get the list of available buckets
     */
    getBuckets(): string[];
    /**
     * Get the currently active bucket
     */
    getCurrentBucket(): string | undefined;
    /**
     * Try to failover to the next bucket
     * @returns true if successfully switched to a new bucket, false if no more buckets
     */
    tryFailover(): Promise<boolean>;
    /**
     * Check if bucket failover is enabled
     */
    isEnabled(): boolean;
}
export interface ConfigParameters {
    sessionId: string;
    embeddingModel?: string;
    sandbox?: SandboxConfig;
    targetDir: string;
    debugMode: boolean;
    question?: string;
    fullContext?: boolean;
    coreTools?: string[];
    allowedTools?: string[];
    excludeTools?: string[];
    toolDiscoveryCommand?: string;
    toolCallCommand?: string;
    mcpServerCommand?: string;
    mcpServers?: Record<string, MCPServerConfig>;
    userMemory?: string;
    llxprtMdFileCount?: number;
    llxprtMdFilePaths?: string[];
    approvalMode?: ApprovalMode;
    showMemoryUsage?: boolean;
    contextLimit?: number;
    compressionThreshold?: number;
    contextFileName?: string | string[];
    accessibility?: AccessibilitySettings;
    telemetry?: TelemetrySettings;
    usageStatisticsEnabled?: boolean;
    fileFiltering?: {
        respectGitIgnore?: boolean;
        respectLlxprtIgnore?: boolean;
        enableRecursiveFileSearch?: boolean;
        disableFuzzySearch?: boolean;
    };
    checkpointing?: boolean;
    dumpOnError?: boolean;
    proxy?: string;
    cwd: string;
    fileDiscoveryService?: FileDiscoveryService;
    includeDirectories?: string[];
    bugCommand?: BugCommandSettings;
    model: string;
    extensionContextFilePaths?: string[];
    maxSessionTurns?: number;
    experimentalZedIntegration?: boolean;
    listExtensions?: boolean;
    activeExtensions?: ActiveExtension[];
    providerManager?: ProviderManager;
    provider?: string;
    extensions?: GeminiCLIExtension[];
    blockedMcpServers?: Array<{
        name: string;
        extensionName: string;
    }>;
    noBrowser?: boolean;
    summarizeToolOutput?: Record<string, SummarizeToolOutputSettings>;
    folderTrustFeature?: boolean;
    folderTrust?: boolean;
    ideMode?: boolean;
    ideClient?: IdeClient;
    complexityAnalyzer?: ComplexityAnalyzerSettings;
    loadMemoryFromIncludeDirectories?: boolean;
    chatCompression?: ChatCompressionSettings;
    interactive?: boolean;
    shellReplacement?: boolean;
    trustedFolder?: boolean;
    useRipgrep?: boolean;
    shouldUseNodePtyShell?: boolean;
    skipNextSpeakerCheck?: boolean;
    extensionManagement?: boolean;
    enablePromptCompletion?: boolean;
    eventEmitter?: EventEmitter;
    useSmartEdit?: boolean;
    settingsService?: SettingsService;
    policyEngineConfig?: PolicyEngineConfig;
    truncateToolOutputThreshold?: number;
    truncateToolOutputLines?: number;
    enableToolOutputTruncation?: boolean;
}
export declare class Config {
    private toolRegistry;
    private promptRegistry;
    private readonly sessionId;
    private readonly settingsService;
    private fileSystemService;
    private contentGeneratorConfig;
    private readonly embeddingModel;
    private readonly sandbox;
    private readonly targetDir;
    private workspaceContext;
    private readonly debugMode;
    private readonly question;
    private readonly fullContext;
    private readonly coreTools;
    private readonly allowedTools;
    private readonly excludeTools;
    private readonly toolDiscoveryCommand;
    private readonly toolCallCommand;
    private readonly mcpServerCommand;
    private readonly mcpServers;
    private userMemory;
    private llxprtMdFileCount;
    private llxprtMdFilePaths;
    private approvalMode;
    private readonly showMemoryUsage;
    private readonly accessibility;
    private telemetrySettings;
    private readonly usageStatisticsEnabled;
    private geminiClient;
    private runtimeState;
    private readonly fileFiltering;
    private alwaysAllowedCommands;
    private fileDiscoveryService;
    private gitService;
    private readonly checkpointing;
    private readonly dumpOnError;
    private readonly proxy;
    private readonly cwd;
    private readonly bugCommand;
    private model;
    private readonly originalModel;
    private readonly extensionContextFilePaths;
    private readonly noBrowser;
    private readonly folderTrustFeature;
    private readonly folderTrust;
    private ideMode;
    private ideClient;
    private inFallbackMode;
    private _modelSwitchedDuringSession;
    private readonly maxSessionTurns;
    private readonly _activeExtensions;
    private readonly listExtensions;
    private readonly _extensions;
    private readonly _blockedMcpServers;
    private providerManager?;
    private profileManager?;
    private subagentManager?;
    private subagentSchedulerFactory?;
    private bucketFailoverHandler?;
    private allPotentialTools;
    setProviderManager(providerManager: ProviderManager): void;
    getProviderManager(): ProviderManager | undefined;
    setProfileManager(manager: ProfileManager | undefined): void;
    getProfileManager(): ProfileManager | undefined;
    setSubagentManager(manager: SubagentManager | undefined): void;
    getSubagentManager(): SubagentManager | undefined;
    /**
     * Set the bucket failover handler for rate limit/quota error handling
     * @plan PLAN-20251213issue490
     */
    setBucketFailoverHandler(handler: BucketFailoverHandler | undefined): void;
    /**
     * Get the bucket failover handler
     * @plan PLAN-20251213issue490
     */
    getBucketFailoverHandler(): BucketFailoverHandler | undefined;
    setInteractiveSubagentSchedulerFactory(factory: SubagentSchedulerFactory | undefined): void;
    getInteractiveSubagentSchedulerFactory(): SubagentSchedulerFactory | undefined;
    private provider?;
    private readonly summarizeToolOutput;
    private readonly experimentalZedIntegration;
    private readonly complexityAnalyzerSettings;
    private readonly loadMemoryFromIncludeDirectories;
    private readonly chatCompression;
    private readonly interactive;
    private readonly trustedFolder;
    private readonly useRipgrep;
    private readonly shouldUseNodePtyShell;
    private readonly skipNextSpeakerCheck;
    private readonly extensionManagement;
    private readonly enablePromptCompletion;
    private initialized;
    private readonly shellReplacement;
    readonly storage: Storage;
    private readonly fileExclusions;
    private readonly eventEmitter?;
    private readonly useSmartEdit;
    private readonly messageBus;
    private readonly policyEngine;
    truncateToolOutputThreshold: number;
    truncateToolOutputLines: number;
    enableToolOutputTruncation: boolean;
    constructor(params: ConfigParameters);
    /**
     * Must only be called once, throws if called again.
     */
    initialize(): Promise<void>;
    refreshAuth(authMethod: AuthType): Promise<void>;
    getSessionId(): string;
    shouldLoadMemoryFromIncludeDirectories(): boolean;
    getContentGeneratorConfig(): ContentGeneratorConfig | undefined;
    getModel(): string;
    setModel(newModel: string): void;
    isInFallbackMode(): boolean;
    resetModelToDefault(): void;
    setFallbackMode(active: boolean): void;
    getMaxSessionTurns(): number;
    getEmbeddingModel(): string | undefined;
    getSandbox(): SandboxConfig | undefined;
    isRestrictiveSandbox(): boolean;
    getTargetDir(): string;
    getProjectRoot(): string;
    getWorkspaceContext(): WorkspaceContext;
    getToolRegistry(): ToolRegistry;
    getPromptRegistry(): PromptRegistry;
    getDebugMode(): boolean;
    getQuestion(): string | undefined;
    getFullContext(): boolean;
    getCoreTools(): string[] | undefined;
    getAllowedTools(): string[] | undefined;
    getExcludeTools(): string[] | undefined;
    getToolDiscoveryCommand(): string | undefined;
    getToolCallCommand(): string | undefined;
    getMcpServerCommand(): string | undefined;
    getMcpServers(): Record<string, MCPServerConfig> | undefined;
    getUserMemory(): string;
    setUserMemory(newUserMemory: string): void;
    getLlxprtMdFileCount(): number;
    setLlxprtMdFileCount(count: number): void;
    getLlxprtMdFilePaths(): string[];
    setLlxprtMdFilePaths(paths: string[]): void;
    getApprovalMode(): ApprovalMode;
    setApprovalMode(mode: ApprovalMode): void;
    getMessageBus(): MessageBus;
    getPolicyEngine(): PolicyEngine;
    getShowMemoryUsage(): boolean;
    getAccessibility(): AccessibilitySettings;
    getTelemetryEnabled(): boolean;
    getTelemetryLogPromptsEnabled(): boolean;
    getTelemetryOtlpEndpoint(): string;
    getTelemetryTarget(): TelemetryTarget;
    getTelemetryOutfile(): string | undefined;
    getConversationLoggingEnabled(): boolean;
    getResponseLoggingEnabled(): boolean;
    getConversationLogPath(): string;
    getMaxConversationHistory(): number;
    getConversationRetentionDays(): number;
    getMaxLogFiles(): number;
    getMaxLogSizeMB(): number;
    getRedactionConfig(): RedactionConfig;
    getDataRetentionEnabled(): boolean;
    getConversationExpirationDays(): number;
    getMaxConversationsStored(): number;
    getTelemetrySettings(): TelemetrySettings & {
        remoteConsentGiven?: boolean;
        [key: string]: unknown;
    };
    updateTelemetrySettings(settings: Partial<TelemetrySettings>): void;
    private expandPath;
    getGeminiClient(): GeminiClient;
    getGeminiDir(): string;
    getProjectTempDir(): string;
    getEnableRecursiveFileSearch(): boolean;
    getFileFilteringDisableFuzzySearch(): boolean;
    getFileFilteringRespectGitIgnore(): boolean;
    getFileFilteringRespectLlxprtIgnore(): boolean;
    getFileFilteringOptions(): FileFilteringOptions;
    /**
     * Gets custom file exclusion patterns from configuration.
     * TODO: This is a placeholder implementation. In the future, this could
     * read from settings files, CLI arguments, or environment variables.
     */
    getCustomExcludes(): string[];
    getCheckpointingEnabled(): boolean;
    getDumpOnError(): boolean;
    getProxy(): string | undefined;
    getWorkingDir(): string;
    getBugCommand(): BugCommandSettings | undefined;
    getFileService(): FileDiscoveryService;
    getUsageStatisticsEnabled(): boolean;
    getExtensionContextFilePaths(): string[];
    getExperimentalZedIntegration(): boolean;
    getListExtensions(): boolean;
    getExtensionManagement(): boolean;
    getExtensions(): GeminiCLIExtension[];
    getActiveExtensions(): ActiveExtension[];
    getBlockedMcpServers(): Array<{
        name: string;
        extensionName: string;
    }>;
    getProvider(): string | undefined;
    setProvider(provider: string): void;
    getNoBrowser(): boolean;
    isBrowserLaunchSuppressed(): boolean;
    getSummarizeToolOutputConfig(): Record<string, SummarizeToolOutputSettings> | undefined;
    getIdeClient(): IdeClient | undefined;
    getIdeMode(): boolean;
    getFolderTrustFeature(): boolean;
    /**
     * Returns 'true' if the workspace is considered "trusted".
     * 'false' for untrusted.
     */
    getFolderTrust(): boolean;
    isTrustedFolder(): boolean;
    setIdeMode(value: boolean): void;
    setIdeClientDisconnected(): void;
    setIdeClientConnected(): void;
    getComplexityAnalyzerSettings(): ComplexityAnalyzerSettings;
    private normalizeStreamingValue;
    private normalizeAndPersistStreaming;
    getEphemeralSetting(key: string): unknown;
    private normalizeContextLimit;
    setEphemeralSetting(key: string, value: unknown): void;
    clearEphemeralSettings(): void;
    getEphemeralSettings(): Record<string, unknown>;
    isInteractive(): boolean;
    /**
     * Get the current FileSystemService
     */
    getFileSystemService(): FileSystemService;
    /**
     * Set a custom FileSystemService
     */
    setFileSystemService(fileSystemService: FileSystemService): void;
    getChatCompression(): ChatCompressionSettings | undefined;
    addAlwaysAllowedCommand(rootCommand: string): void;
    isCommandAlwaysAllowed(rootCommand: string): boolean;
    getAlwaysAllowedCommands(): string[];
    getShellReplacement(): boolean;
    getUseRipgrep(): boolean;
    getShouldUseNodePtyShell(): boolean;
    getSkipNextSpeakerCheck(): boolean;
    getScreenReader(): boolean;
    getEnablePromptCompletion(): boolean;
    getUseSmartEdit(): boolean;
    getNonInteractive(): boolean;
    getGitService(): Promise<GitService>;
    /**
     * Get the SettingsService instance
     */
    getSettingsService(): SettingsService;
    getFileExclusions(): FileExclusions;
    refreshMemory(): Promise<{
        memoryContent: string;
        fileCount: number;
        filePaths: string[];
    }>;
    createToolRegistry(): Promise<ToolRegistry>;
    /**
     * Get all potential tools (both registered and unregistered) for settings UI
     */
    getAllPotentialTools(): {
        toolClass: any;
        toolName: string;
        displayName: string;
        isRegistered: boolean;
        reason?: string;
        args: any[];
    }[];
    /**
     * Get tool registry information with registered/unregistered separation
     */
    getToolRegistryInfo(): {
        registered: {
            toolClass: any;
            toolName: string;
            displayName: string;
            isRegistered: boolean;
            reason?: string;
            args: any[];
        }[];
        unregistered: {
            toolClass: any;
            toolName: string;
            displayName: string;
            isRegistered: boolean;
            reason?: string;
            args: any[];
        }[];
    };
}
export { DEFAULT_GEMINI_FLASH_MODEL };
