brainy/.recovery-workspace/dist-backup-20250910-141917/augmentations/configResolver.d.ts
David Snelling 8ff382ca3b chore: recovery checkpoint - v3.0 API successfully recovered
CRITICAL CHECKPOINT - DO NOT PUSH TO GITHUB

Recovery Status:
- Successfully recovered brainy.ts from compiled JavaScript
- All core v3.0 API methods functional (add, get, update, delete, relate, find, etc.)
- Neural subsystem intact (562KB embedded patterns, NLP working)
- Augmentation pipeline operational (20+ augmentations)
- HNSW clustering system complete
- Triple Intelligence compiled (needs constructor fix)
- Test suite validates functionality

Changes preserved:
- 898 files with changes from last 3 days
- 144,475 insertions
- All augmentation improvements
- All test coverage enhancements
- Complete v3.0 feature set

This is a LOCAL checkpoint only - contains recovered work after corruption incident.
Created backup in .backups/brainy-full-20250910-151314.tar.gz

Branch: recovery-checkpoint-20250910-151433
Date: Wed Sep 10 03:18:04 PM PDT 2025
2025-09-10 15:18:04 -07:00

122 lines
3 KiB
TypeScript

/**
* Configuration Resolver for Augmentations
*
* Handles loading and resolving configuration from multiple sources:
* - Environment variables
* - Configuration files
* - Runtime updates
* - Default values from schema
*/
import { JSONSchema } from './manifest.js';
/**
* Configuration source priority (highest to lowest)
*/
export declare enum ConfigPriority {
RUNTIME = 4,// Runtime updates (highest priority)
CONSTRUCTOR = 3,// Constructor parameters
ENVIRONMENT = 2,// Environment variables
FILE = 1,// Configuration files
DEFAULT = 0
}
/**
* Configuration source information
*/
export interface ConfigSource {
priority: ConfigPriority;
source: string;
config: any;
}
/**
* Configuration resolution options
*/
export interface ConfigResolverOptions {
augmentationId: string;
schema?: JSONSchema;
defaults?: Record<string, any>;
configPaths?: string[];
envPrefix?: string;
allowUndefined?: boolean;
}
/**
* Augmentation Configuration Resolver
*/
export declare class AugmentationConfigResolver {
private options;
private sources;
private resolved;
constructor(options: ConfigResolverOptions);
/**
* Resolve configuration from all sources
* @param constructorConfig Optional constructor configuration
* @returns Resolved configuration
*/
resolve(constructorConfig?: any): any;
/**
* Load default values from schema and defaults
*/
private loadDefaults;
/**
* Load configuration from files
*/
private loadFromFiles;
/**
* Parse configuration file based on extension
*/
private parseConfigFile;
/**
* Extract augmentation-specific configuration from a config object
*/
private extractAugmentationConfig;
/**
* Load configuration from environment variables
*/
private loadFromEnvironment;
/**
* Convert environment variable key to config key
* ENABLED -> enabled
* MAX_SIZE -> maxSize
*/
private envKeyToConfigKey;
/**
* Parse environment variable value
*/
private parseEnvValue;
/**
* Merge configurations by priority
*/
private mergeConfigurations;
/**
* Deep merge two objects
*/
private deepMerge;
/**
* Validate configuration against schema
*/
private validateConfiguration;
/**
* Validate a single property against its schema
*/
private validateProperty;
/**
* Get configuration sources for debugging
*/
getSources(): ConfigSource[];
/**
* Get resolved configuration
*/
getResolved(): any;
/**
* Update configuration at runtime
*/
updateRuntime(config: any): any;
/**
* Save configuration to file
* @param filepath Path to save configuration
* @param format Format to save as (json, etc.)
*/
saveToFile(filepath?: string, format?: 'json'): Promise<void>;
/**
* Get environment variable names for this augmentation
*/
getEnvironmentVariables(): Record<string, any>;
}