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
This commit is contained in:
David Snelling 2025-09-10 15:18:04 -07:00
parent f65455fb22
commit 8ff382ca3b
895 changed files with 143654 additions and 28268 deletions

View file

@ -0,0 +1,106 @@
/**
* Distributed Configuration Manager
* Manages shared configuration in S3 for distributed Brainy instances
*/
import { DistributedConfig, SharedConfig, InstanceInfo, InstanceRole } from '../types/distributedTypes.js';
import { StorageAdapter } from '../coreTypes.js';
export declare class DistributedConfigManager {
private config;
private instanceId;
private role;
private configPath;
private heartbeatInterval;
private configCheckInterval;
private instanceTimeout;
private storage;
private heartbeatTimer?;
private configWatchTimer?;
private lastConfigVersion;
private onConfigUpdate?;
private hasMigrated;
constructor(storage: StorageAdapter, distributedConfig?: DistributedConfig, brainyMode?: {
readOnly?: boolean;
writeOnly?: boolean;
});
/**
* Initialize the distributed configuration
*/
initialize(): Promise<SharedConfig>;
/**
* Load existing config or create new one
*/
private loadOrCreateConfig;
/**
* Determine role based on configuration
* IMPORTANT: Role must be explicitly set - no automatic assignment based on order
*/
private determineRole;
/**
* Check if an instance is still alive
*/
private isInstanceAlive;
/**
* Register this instance in the shared config
*/
private registerInstance;
/**
* Migrate config from legacy location to new location
*/
private migrateConfigFromLegacyLocation;
/**
* Migrate config to new location in index folder
*/
private migrateConfig;
/**
* Save configuration with version increment
*/
private saveConfig;
/**
* Start heartbeat to keep instance alive in config
*/
private startHeartbeat;
/**
* Update heartbeat and clean stale instances
*/
private updateHeartbeat;
/**
* Start watching for config changes
*/
private startConfigWatch;
/**
* Check for configuration updates
*/
private checkForConfigUpdates;
/**
* Load configuration from storage
*/
private loadConfig;
/**
* Get current configuration
*/
getConfig(): SharedConfig | null;
/**
* Get instance role
*/
getRole(): InstanceRole;
/**
* Get instance ID
*/
getInstanceId(): string;
/**
* Set config update callback
*/
setOnConfigUpdate(callback: (config: SharedConfig) => void): void;
/**
* Get all active instances of a specific role
*/
getInstancesByRole(role: InstanceRole): InstanceInfo[];
/**
* Update instance metrics
*/
updateMetrics(metrics: Partial<InstanceInfo['metrics']>): Promise<void>;
/**
* Cleanup resources
*/
cleanup(): Promise<void>;
}