/** * Configuration Management Types * * Types for centralized configuration loading and validation services. * These support the refactored configuration architecture that separates * configuration management from hook execution. */ import type { HookEvent, HookEventConfig } from "./hooks.js"; import type { PermissionMode } from "./permissions.js"; import type { ModelConfig } from "./config.js"; import type { MarketplaceSource } from "./marketplace.js"; import type { TelemetryConfig } from "./telemetry.js"; export type Scope = "user" | "project" | "local"; export interface MarketplaceConfig { source: MarketplaceSource; autoUpdate?: boolean; } /** * Root configuration structure for all Wave Agent settings including hooks and environment variables */ export interface WaveConfiguration { hooks?: Partial>; env?: Record; // Environment variables key-value pairs /** New field for persistent permissions */ permissions?: { allow?: string[]; deny?: string[]; permissionMode?: PermissionMode; // Default permission mode for restricted tools /** * List of directories that are considered part of the Safe Zone. * File operations within these directories can be auto-accepted. */ additionalDirectories?: string[]; }; /** New field for scoped plugin management */ enabledPlugins?: Record; /** Preferred language for agent communication */ language?: string; /** Whether auto-memory is enabled */ autoMemoryEnabled?: boolean; /** Frequency of auto-memory extraction turns */ autoMemoryFrequency?: number; /** Persisted model selection (from /model command) */ model?: string; /** Model-specific configuration overrides */ models?: Record>; /** Scoped marketplace declarations */ marketplaces?: Record; /** OpenTelemetry monitoring configuration */ monitoring?: { telemetry?: Partial; }; } /** * Legacy alias for backward compatibility - will be deprecated */ export interface HookConfiguration extends WaveConfiguration { hooks: Partial>; } /** * Partial hook configuration for loading/merging scenarios */ export type PartialHookConfiguration = Partial< Record >; /** * Direct hook configuration record (for test convenience) */ export type HookConfigurationRecord = Record; /** * Result of configuration loading operations with detailed status information */ export interface ConfigurationLoadResult { /** The loaded configuration, or null if loading failed */ configuration: WaveConfiguration | null; /** Whether the loading operation was successful */ success: boolean; /** Error message if loading failed */ error?: string; /** Path of the successfully loaded file */ sourcePath?: string; /** Non-critical warnings during loading */ warnings: string[]; } /** * Result of configuration validation operations */ export interface ValidationResult { /** Whether the configuration is valid */ isValid: boolean; /** Critical errors that prevent configuration use */ errors: string[]; /** Non-critical warnings about the configuration */ warnings: string[]; } /** * Configuration file paths organized by category */ export interface ConfigurationPaths { /** User-specific configuration file paths in priority order */ userPaths: string[]; /** Project-specific configuration file paths in priority order */ projectPaths: string[]; /** Builtin configuration file paths */ builtinPaths: string[]; /** All configuration paths combined */ allPaths: string[]; /** Only the paths that actually exist on the filesystem */ existingPaths: string[]; } /** * Options for configuring the ConfigurationService */ export interface ConfigurationServiceOptions { /** Working directory for resolving project configurations */ workdir: string; /** Optional logger for configuration operations */ logger?: Logger; /** Whether to enable validation during loading (default: true) */ enableValidation?: boolean; } /** * Minimal logger interface for configuration services */ interface Logger { error: (...args: unknown[]) => void; warn: (...args: unknown[]) => void; info: (...args: unknown[]) => void; debug: (...args: unknown[]) => void; } export interface RemoteSettingsResponse { uuid: string; checksum: string; settings: WaveConfiguration; } export interface RemoteSettingsCache { uuid: string; checksum: string; settings: WaveConfiguration; fetchedAt: string; } export interface RemoteSettingsFetchResult { success: boolean; settings?: WaveConfiguration | null; checksum?: string; error?: string; notConfigured?: boolean; }