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
132
.recovery-workspace/dist-backup-20250910-141917/distributed/networkTransport.d.ts
vendored
Normal file
132
.recovery-workspace/dist-backup-20250910-141917/distributed/networkTransport.d.ts
vendored
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
/**
|
||||
* Network Transport Layer for Distributed Brainy
|
||||
* Uses WebSocket + HTTP for maximum compatibility
|
||||
*/
|
||||
import { EventEmitter } from 'events';
|
||||
export interface NetworkMessage {
|
||||
type: string;
|
||||
from: string;
|
||||
to?: string;
|
||||
data: any;
|
||||
timestamp: number;
|
||||
id: string;
|
||||
}
|
||||
export interface NodeEndpoint {
|
||||
nodeId: string;
|
||||
host: string;
|
||||
httpPort: number;
|
||||
wsPort: number;
|
||||
lastSeen: number;
|
||||
}
|
||||
export interface NetworkConfig {
|
||||
nodeId?: string;
|
||||
host?: string;
|
||||
httpPort?: number;
|
||||
wsPort?: number;
|
||||
seeds?: string[];
|
||||
discoveryMethod?: 'seeds' | 'dns' | 'kubernetes' | 'auto';
|
||||
enableUDP?: boolean;
|
||||
}
|
||||
/**
|
||||
* Production-ready network transport
|
||||
*/
|
||||
export declare class NetworkTransport extends EventEmitter {
|
||||
private nodeId;
|
||||
private config;
|
||||
private httpServer?;
|
||||
private wsServer;
|
||||
private peers;
|
||||
private connections;
|
||||
private messageHandlers;
|
||||
private responseHandlers;
|
||||
private isRunning;
|
||||
constructor(config: NetworkConfig);
|
||||
/**
|
||||
* Start network transport
|
||||
*/
|
||||
start(): Promise<void>;
|
||||
/**
|
||||
* Stop network transport
|
||||
*/
|
||||
stop(): Promise<void>;
|
||||
/**
|
||||
* Start HTTP server for REST API and health checks
|
||||
*/
|
||||
private startHTTPServer;
|
||||
/**
|
||||
* Start WebSocket server for real-time communication
|
||||
*/
|
||||
private startWebSocketServer;
|
||||
/**
|
||||
* Discover peers based on configuration
|
||||
*/
|
||||
private discoverPeers;
|
||||
/**
|
||||
* Connect to seed nodes
|
||||
*/
|
||||
private connectToSeeds;
|
||||
/**
|
||||
* Discover peers via DNS
|
||||
*/
|
||||
private discoverViaDNS;
|
||||
/**
|
||||
* Discover peers via Kubernetes
|
||||
*/
|
||||
private discoverViaKubernetes;
|
||||
/**
|
||||
* Connect to a specific node
|
||||
*/
|
||||
private connectToNode;
|
||||
/**
|
||||
* Get node information via HTTP
|
||||
*/
|
||||
private getNodeInfo;
|
||||
/**
|
||||
* Connect to peer via WebSocket
|
||||
*/
|
||||
private connectWebSocket;
|
||||
/**
|
||||
* Start heartbeat to maintain connections
|
||||
*/
|
||||
private startHeartbeat;
|
||||
/**
|
||||
* Send message to specific node
|
||||
*/
|
||||
sendToNode(nodeId: string, type: string, data: any): Promise<any>;
|
||||
/**
|
||||
* Send via HTTP
|
||||
*/
|
||||
private sendViaHTTP;
|
||||
/**
|
||||
* Broadcast to all peers
|
||||
*/
|
||||
broadcast(type: string, data: any): Promise<void>;
|
||||
/**
|
||||
* Register message handler
|
||||
*/
|
||||
onMessage(type: string, handler: (msg: NetworkMessage) => Promise<any>): void;
|
||||
/**
|
||||
* Get connected peers
|
||||
*/
|
||||
getPeers(): NodeEndpoint[];
|
||||
/**
|
||||
* Check if connected
|
||||
*/
|
||||
isConnected(nodeId: string): boolean;
|
||||
/**
|
||||
* Generate node ID
|
||||
*/
|
||||
private generateNodeId;
|
||||
/**
|
||||
* Generate message ID
|
||||
*/
|
||||
private generateMessageId;
|
||||
/**
|
||||
* Get node ID
|
||||
*/
|
||||
getNodeId(): string;
|
||||
}
|
||||
/**
|
||||
* Create network transport
|
||||
*/
|
||||
export declare function createNetworkTransport(config: NetworkConfig): NetworkTransport;
|
||||
Loading…
Add table
Add a link
Reference in a new issue