brainy/.recovery-workspace/dist-backup-20250910-141917/augmentations/conduitAugmentations.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

71 lines
2.4 KiB
TypeScript

/**
* Conduit Augmentations - Data Synchronization Bridges
*
* These augmentations connect and synchronize data between multiple Brainy instances.
* Now using the unified BrainyAugmentation interface.
*/
import { BaseAugmentation } from './brainyAugmentation.js';
export interface WebSocketConnection {
connectionId: string;
url: string;
readyState: number;
socket?: any;
}
/**
* Base class for conduit augmentations that sync between Brainy instances
* Converted to use the unified BrainyAugmentation interface
*/
declare abstract class BaseConduitAugmentation extends BaseAugmentation {
readonly timing: "after";
readonly metadata: "readonly";
readonly operations: ("addNoun" | "delete" | "addVerb")[];
readonly priority = 20;
protected connections: Map<string, any>;
protected onShutdown(): Promise<void>;
abstract establishConnection(targetSystemId: string, config?: Record<string, unknown>): Promise<WebSocketConnection | null>;
}
/**
* WebSocket Conduit Augmentation
* Syncs data between Brainy instances using WebSockets
*/
export declare class WebSocketConduitAugmentation extends BaseConduitAugmentation {
readonly name = "websocket-conduit";
private webSocketConnections;
private messageCallbacks;
execute<T = any>(operation: string, params: any, next: () => Promise<T>): Promise<T>;
private shouldSync;
private syncOperation;
establishConnection(url: string, config?: Record<string, unknown>): Promise<WebSocketConnection | null>;
private handleMessage;
private applySyncOperation;
/**
* Subscribe to messages from a specific connection
*/
onMessage(connectionId: string, callback: (data: any) => void): void;
/**
* Send a message to a specific connection
*/
sendMessage(connectionId: string, data: any): boolean;
}
export {};
/**
* Example usage:
*
* // Server instance
* const serverBrain = new Brainy()
* serverBrain.augmentations.register(new APIServerAugmentation())
* await serverBrain.init()
*
* // Client instance
* const clientBrain = new Brainy()
* const conduit = new WebSocketConduitAugmentation()
* clientBrain.augmentations.register(conduit)
* await clientBrain.init()
*
* // Connect client to server
* await conduit.establishConnection('ws://localhost:3000/ws')
*
* // Now operations sync automatically!
* await clientBrain.addNoun('synced data', { source: 'client' })
* // This will automatically sync to the server
*/