/** * @license * Copyright 2025 OSAgent OC * SPDX-License-Identifier: Apache-2.0 */ import type { EventEmitter } from 'node:events'; import type { ContentGenerator, ContentGeneratorConfig } from '../core/contentGenerator.js'; import type { FallbackModelHandler } from '../fallback/types.js'; import type { MCPOAuthConfig } from '../mcp/oauth-provider.js'; import type { ShellExecutionConfig } from '../services/shellExecutionService.js'; import type { AnyToolInvocation } from '../tools/tools.js'; import { BaseLlmClient } from '../core/baseLlmClient.js'; import { OSAClient } from '../core/client.js'; import { AuthType } from '../core/contentGenerator.js'; import { FileDiscoveryService } from '../services/fileDiscoveryService.js'; import { type FileSystemService } from '../services/fileSystemService.js'; import { GitService } from '../services/gitService.js'; import { ToolRegistry } from '../tools/tool-registry.js'; import { InputFormat, OutputFormat } from '../output/types.js'; import { PromptRegistry } from '../prompts/prompt-registry.js'; import { SubagentManager } from '../subagents/subagent-manager.js'; import { type TelemetryTarget } from '../telemetry/index.js'; import { FileExclusions } from '../utils/ignorePatterns.js'; import { WorkspaceContext } from '../utils/workspaceContext.js'; import type { FileFilteringOptions } from './constants.js'; import { DEFAULT_FILE_FILTERING_OPTIONS, DEFAULT_MEMORY_FILE_FILTERING_OPTIONS } from './constants.js'; import { Storage } from './storage.js'; export type { AnyToolInvocation, FileFilteringOptions, MCPOAuthConfig }; export { DEFAULT_FILE_FILTERING_OPTIONS, DEFAULT_MEMORY_FILE_FILTERING_OPTIONS, }; export declare enum ApprovalMode { PLAN = "plan", DEFAULT = "default", AUTO_EDIT = "auto-edit", YOLO = "yolo" } export declare const APPROVAL_MODES: ApprovalMode[]; export interface AccessibilitySettings { disableLoadingPhrases?: boolean; screenReader?: boolean; } export interface BugCommandSettings { urlTemplate: string; } export interface ChatCompressionSettings { contextPercentageThreshold?: number; } export interface SummarizeToolOutputSettings { tokenBudget?: number; } export interface TelemetrySettings { enabled?: boolean; target?: TelemetryTarget; otlpEndpoint?: string; otlpProtocol?: 'grpc' | 'http'; logPrompts?: boolean; outfile?: string; useCollector?: boolean; } export interface OutputSettings { format?: OutputFormat; } export interface GitCoAuthorSettings { enabled?: boolean; name?: string; email?: string; } export interface OSACLIExtension { 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; } export declare const DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD = 25000; export declare const DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES = 1000; export declare class MCPServerConfig { readonly command?: string | undefined; readonly args?: string[] | undefined; readonly env?: Record | undefined; readonly cwd?: string | undefined; readonly url?: string | undefined; readonly httpUrl?: string | undefined; readonly headers?: Record | 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 | undefined, cwd?: string | undefined, url?: string | undefined, httpUrl?: string | undefined, headers?: Record | 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", OSAgent_CREDENTIALS = "OSAgent_credentials", SERVICE_ACCOUNT_IMPERSONATION = "service_account_impersonation" } export interface SandboxConfig { command: 'docker' | 'podman' | 'sandbox-exec'; image: string; } export interface ConfigParameters { sessionId: string; embeddingModel?: string; sandbox?: SandboxConfig; targetDir: string; debugMode: boolean; includePartialMessages?: boolean; question?: string; fullContext?: boolean; coreTools?: string[]; allowedTools?: string[]; excludeTools?: string[]; toolDiscoveryCommand?: string; toolCallCommand?: string; mcpServerCommand?: string; mcpServers?: Record; userMemory?: string; OSAMdFileCount?: number; approvalMode?: ApprovalMode; showMemoryUsage?: boolean; contextFileName?: string | string[]; accessibility?: AccessibilitySettings; telemetry?: TelemetrySettings; gitCoAuthor?: GitCoAuthorSettings; usageStatisticsEnabled?: boolean; fileFiltering?: { respectGitIgnore?: boolean; respectOSAIgnore?: boolean; enableRecursiveFileSearch?: boolean; disableFuzzySearch?: boolean; }; checkpointing?: boolean; proxy?: string; cwd: string; fileDiscoveryService?: FileDiscoveryService; includeDirectories?: string[]; bugCommand?: BugCommandSettings; model?: string; extensionContextFilePaths?: string[]; maxSessionTurns?: number; sessionTokenLimit?: number; experimentalZedIntegration?: boolean; listExtensions?: boolean; extensions?: OSACLIExtension[]; blockedMcpServers?: Array<{ name: string; extensionName: string; }>; noBrowser?: boolean; summarizeToolOutput?: Record; folderTrustFeature?: boolean; folderTrust?: boolean; ideMode?: boolean; authType?: AuthType; generationConfig?: Partial; cliVersion?: string; loadMemoryFromIncludeDirectories?: boolean; webSearch?: { provider: Array<{ type: 'tavily' | 'OSAgent' | 'dashscope'; apiKey?: string; searchEngineId?: string; }>; default: string; }; chatCompression?: ChatCompressionSettings; interactive?: boolean; trustedFolder?: boolean; useRipgrep?: boolean; useBuiltinRipgrep?: boolean; shouldUseNodePtyShell?: boolean; skipNextSpeakerCheck?: boolean; shellExecutionConfig?: ShellExecutionConfig; extensionManagement?: boolean; skipLoopDetection?: boolean; vlmSwitchMode?: string; truncateToolOutputThreshold?: number; truncateToolOutputLines?: number; enableToolOutputTruncation?: boolean; eventEmitter?: EventEmitter; useSmartEdit?: boolean; output?: OutputSettings; skipStartupContext?: boolean; inputFormat?: InputFormat; outputFormat?: OutputFormat; } export declare class Config { private toolRegistry; private promptRegistry; private subagentManager; private readonly sessionId; private fileSystemService; private contentGeneratorConfig; private contentGenerator; private _generationConfig; private readonly embeddingModel; private readonly sandbox; private readonly targetDir; private workspaceContext; private readonly debugMode; private readonly inputFormat; private readonly outputFormat; private readonly includePartialMessages; 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 OSAMdFileCount; private approvalMode; private readonly showMemoryUsage; private readonly accessibility; private readonly telemetrySettings; private readonly gitCoAuthor; private readonly usageStatisticsEnabled; private OSAClient; private baseLlmClient; private readonly fileFiltering; private fileDiscoveryService; private gitService; private readonly checkpointing; private readonly proxy; private readonly cwd; private readonly bugCommand; private readonly extensionContextFilePaths; private readonly noBrowser; private readonly folderTrustFeature; private readonly folderTrust; private ideMode; private inFallbackMode; private readonly maxSessionTurns; private readonly sessionTokenLimit; private readonly listExtensions; private readonly _extensions; private readonly _blockedMcpServers; fallbackModelHandler?: FallbackModelHandler; private quotaErrorOccurred; private readonly summarizeToolOutput; private readonly cliVersion?; private readonly experimentalZedIntegration; private readonly loadMemoryFromIncludeDirectories; private readonly webSearch?; private readonly chatCompression; private readonly interactive; private readonly trustedFolder; private readonly useRipgrep; private readonly useBuiltinRipgrep; private readonly shouldUseNodePtyShell; private readonly skipNextSpeakerCheck; private shellExecutionConfig; private readonly extensionManagement; private readonly skipLoopDetection; private readonly skipStartupContext; private readonly vlmSwitchMode; private initialized; readonly storage: Storage; private readonly fileExclusions; private readonly truncateToolOutputThreshold; private readonly truncateToolOutputLines; private readonly enableToolOutputTruncation; private readonly eventEmitter?; private readonly useSmartEdit; constructor(params: ConfigParameters); /** * Must only be called once, throws if called again. */ initialize(): Promise; getContentGenerator(): ContentGenerator; /** * Updates the credentials in the generation config. * This is needed when credentials are set after Config construction. */ updateCredentials(credentials: { apiKey?: string; baseUrl?: string; model?: string; }): void; refreshAuth(authMethod: AuthType, isInitialAuth?: boolean): Promise; /** * Provides access to the BaseLlmClient for stateless LLM operations. */ getBaseLlmClient(): BaseLlmClient; getSessionId(): string; shouldLoadMemoryFromIncludeDirectories(): boolean; getContentGeneratorConfig(): ContentGeneratorConfig; getModel(): string; setModel(newModel: string, _metadata?: { reason?: string; context?: string; }): Promise; isInFallbackMode(): boolean; setFallbackMode(active: boolean): void; setFallbackModelHandler(handler: FallbackModelHandler): void; getMaxSessionTurns(): number; getSessionTokenLimit(): number; setQuotaErrorOccurred(value: boolean): void; getQuotaErrorOccurred(): boolean; getEmbeddingModel(): string; 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 | undefined; getUserMemory(): string; setUserMemory(newUserMemory: string): void; getOSAMdFileCount(): number; setOSAMdFileCount(count: number): void; getApprovalMode(): ApprovalMode; setApprovalMode(mode: ApprovalMode): void; getShowMemoryUsage(): boolean; getInputFormat(): 'text' | 'stream-json'; getIncludePartialMessages(): boolean; getAccessibility(): AccessibilitySettings; getTelemetryEnabled(): boolean; getTelemetryLogPromptsEnabled(): boolean; getTelemetryOtlpEndpoint(): string; getTelemetryOtlpProtocol(): 'grpc' | 'http'; getTelemetryTarget(): TelemetryTarget; getTelemetryOutfile(): string | undefined; getGitCoAuthor(): GitCoAuthorSettings; getTelemetryUseCollector(): boolean; getOSAClient(): OSAClient; getEnableRecursiveFileSearch(): boolean; getFileFilteringDisableFuzzySearch(): boolean; getFileFilteringRespectGitIgnore(): boolean; getFileFilteringRespectOSAIgnore(): 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; getProxy(): string | undefined; getWorkingDir(): string; getBugCommand(): BugCommandSettings | undefined; getFileService(): FileDiscoveryService; getUsageStatisticsEnabled(): boolean; getExtensionContextFilePaths(): string[]; getExperimentalZedIntegration(): boolean; getListExtensions(): boolean; getExtensionManagement(): boolean; getExtensions(): OSACLIExtension[]; getBlockedMcpServers(): Array<{ name: string; extensionName: string; }>; getNoBrowser(): boolean; isBrowserLaunchSuppressed(): boolean; getSummarizeToolOutputConfig(): Record | undefined; getWebSearchConfig(): { provider: Array<{ type: "tavily" | "OSAgent" | "dashscope"; apiKey?: string; searchEngineId?: string; }>; default: string; } | undefined; getIdeMode(): boolean; getFolderTrustFeature(): boolean; /** * Returns 'true' if the workspace is considered "trusted". * 'false' for untrusted. */ getFolderTrust(): boolean; isTrustedFolder(): boolean; setIdeMode(value: boolean): void; getAuthType(): AuthType | undefined; getCliVersion(): string | undefined; /** * Get the current FileSystemService */ getFileSystemService(): FileSystemService; /** * Set a custom FileSystemService */ setFileSystemService(fileSystemService: FileSystemService): void; getChatCompression(): ChatCompressionSettings | undefined; isInteractive(): boolean; getUseRipgrep(): boolean; getUseBuiltinRipgrep(): boolean; getShouldUseNodePtyShell(): boolean; getSkipNextSpeakerCheck(): boolean; getShellExecutionConfig(): ShellExecutionConfig; setShellExecutionConfig(config: ShellExecutionConfig): void; getScreenReader(): boolean; getSkipLoopDetection(): boolean; getSkipStartupContext(): boolean; getVlmSwitchMode(): string | undefined; getEnableToolOutputTruncation(): boolean; getTruncateToolOutputThreshold(): number; getTruncateToolOutputLines(): number; getUseSmartEdit(): boolean; getOutputFormat(): OutputFormat; getGitService(): Promise; getFileExclusions(): FileExclusions; getSubagentManager(): SubagentManager; createToolRegistry(): Promise; }