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:
parent
f65455fb22
commit
8ff382ca3b
895 changed files with 143654 additions and 28268 deletions
119
.recovery-workspace/dist-backup-20250910-141917/augmentations/walAugmentation.d.ts
vendored
Normal file
119
.recovery-workspace/dist-backup-20250910-141917/augmentations/walAugmentation.d.ts
vendored
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
/**
|
||||
* Write-Ahead Log (WAL) Augmentation
|
||||
*
|
||||
* Provides file-based durability and atomicity for storage operations
|
||||
* Automatically enabled for all critical storage operations
|
||||
*
|
||||
* Features:
|
||||
* - True file-based persistence for crash recovery
|
||||
* - Operation replay after startup
|
||||
* - Automatic log rotation and cleanup
|
||||
* - Cross-platform compatibility (filesystem, OPFS, cloud)
|
||||
*/
|
||||
import { BaseAugmentation } from './brainyAugmentation.js';
|
||||
import { AugmentationManifest } from './manifest.js';
|
||||
interface WALConfig {
|
||||
enabled?: boolean;
|
||||
immediateWrites?: boolean;
|
||||
adaptivePersistence?: boolean;
|
||||
walPrefix?: string;
|
||||
maxSize?: number;
|
||||
checkpointInterval?: number;
|
||||
autoRecover?: boolean;
|
||||
maxRetries?: number;
|
||||
}
|
||||
export declare class WALAugmentation extends BaseAugmentation {
|
||||
name: string;
|
||||
timing: "around";
|
||||
metadata: "readonly";
|
||||
operations: ("addNoun" | "addVerb" | "saveNoun" | "saveVerb" | "updateMetadata" | "delete" | "deleteVerb" | "clear")[];
|
||||
priority: number;
|
||||
readonly category: "internal";
|
||||
readonly description = "Write-ahead logging for durability and crash recovery";
|
||||
private currentLogId;
|
||||
private operationCounter;
|
||||
private checkpointTimer?;
|
||||
private isRecovering;
|
||||
constructor(config?: WALConfig);
|
||||
/**
|
||||
* Get the augmentation manifest for discovery
|
||||
*/
|
||||
getManifest(): AugmentationManifest;
|
||||
/**
|
||||
* Handle runtime configuration changes
|
||||
*/
|
||||
protected onConfigChange(newConfig: WALConfig, oldConfig: WALConfig): Promise<void>;
|
||||
protected onInitialize(): Promise<void>;
|
||||
shouldExecute(operation: string, params: any): boolean;
|
||||
execute<T = any>(operation: string, params: any, next: () => Promise<T>): Promise<T>;
|
||||
/**
|
||||
* Asynchronous WAL entry logging (fire-and-forget for immediate writes)
|
||||
*/
|
||||
private logAsyncWALEntry;
|
||||
/**
|
||||
* Write WAL entry to persistent storage using storage adapter
|
||||
*/
|
||||
private writeWALEntry;
|
||||
/**
|
||||
* Recover pending operations from all existing WAL files
|
||||
*/
|
||||
private recoverPendingOperations;
|
||||
/**
|
||||
* Find all WAL files in storage
|
||||
*/
|
||||
private findWALFiles;
|
||||
/**
|
||||
* Read WAL entries from a file
|
||||
*/
|
||||
private readWALEntries;
|
||||
/**
|
||||
* Find operations that were started but not completed
|
||||
*/
|
||||
private findPendingOperations;
|
||||
/**
|
||||
* Replay an operation during recovery
|
||||
*/
|
||||
private replayOperation;
|
||||
/**
|
||||
* Create a checkpoint to mark a point in time
|
||||
*/
|
||||
private createCheckpoint;
|
||||
/**
|
||||
* Check if log rotation is needed
|
||||
*/
|
||||
private checkLogRotation;
|
||||
/**
|
||||
* Sanitize parameters for logging (remove large objects)
|
||||
*/
|
||||
private sanitizeParams;
|
||||
/**
|
||||
* Get WAL statistics
|
||||
*/
|
||||
getStats(): {
|
||||
enabled: boolean;
|
||||
currentLogId: string;
|
||||
operationCount: number;
|
||||
logSize: number;
|
||||
pendingOperations: number;
|
||||
failedOperations: number;
|
||||
};
|
||||
/**
|
||||
* Manually trigger checkpoint
|
||||
*/
|
||||
checkpoint(): Promise<void>;
|
||||
/**
|
||||
* Manually trigger log rotation
|
||||
*/
|
||||
rotate(): Promise<void>;
|
||||
/**
|
||||
* Write WAL data directly to storage without embedding
|
||||
* This bypasses the brain's AI processing pipeline for raw WAL data
|
||||
*/
|
||||
private writeWALFileDirectly;
|
||||
/**
|
||||
* Read WAL data directly from storage without embedding
|
||||
*/
|
||||
private readWALFileDirectly;
|
||||
protected onShutdown(): Promise<void>;
|
||||
}
|
||||
export {};
|
||||
Loading…
Add table
Add a link
Reference in a new issue