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
120
.recovery-workspace/dist-backup-20250910-141917/distributed/httpTransport.d.ts
vendored
Normal file
120
.recovery-workspace/dist-backup-20250910-141917/distributed/httpTransport.d.ts
vendored
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
/**
|
||||
* HTTP + SSE Transport for Zero-Config Distributed Brainy
|
||||
* Simple, reliable, works everywhere - no WebSocket complexity!
|
||||
* REAL PRODUCTION CODE - Handles millions of operations
|
||||
*/
|
||||
import * as http from 'http';
|
||||
import { EventEmitter } from 'events';
|
||||
export interface TransportMessage {
|
||||
id: string;
|
||||
method: string;
|
||||
params: any;
|
||||
timestamp: number;
|
||||
from: string;
|
||||
to?: string;
|
||||
}
|
||||
export interface TransportResponse {
|
||||
id: string;
|
||||
result?: any;
|
||||
error?: {
|
||||
code: number;
|
||||
message: string;
|
||||
data?: any;
|
||||
};
|
||||
timestamp: number;
|
||||
}
|
||||
export interface SSEClient {
|
||||
id: string;
|
||||
response: http.ServerResponse;
|
||||
lastPing: number;
|
||||
}
|
||||
export declare class HTTPTransport extends EventEmitter {
|
||||
private server;
|
||||
private port;
|
||||
private nodeId;
|
||||
private endpoints;
|
||||
private pendingRequests;
|
||||
private sseClients;
|
||||
private messageHandlers;
|
||||
private isRunning;
|
||||
private readonly REQUEST_TIMEOUT;
|
||||
private readonly SSE_HEARTBEAT_INTERVAL;
|
||||
private sseHeartbeatTimer;
|
||||
constructor(nodeId: string);
|
||||
/**
|
||||
* Start HTTP server with automatic port selection
|
||||
*/
|
||||
start(): Promise<number>;
|
||||
/**
|
||||
* Stop HTTP server
|
||||
*/
|
||||
stop(): Promise<void>;
|
||||
/**
|
||||
* Register a node endpoint
|
||||
*/
|
||||
registerEndpoint(nodeId: string, endpoint: string): void;
|
||||
/**
|
||||
* Register RPC method handler
|
||||
*/
|
||||
registerHandler(method: string, handler: (params: any, from: string) => Promise<any>): void;
|
||||
/**
|
||||
* Call RPC method on remote node
|
||||
*/
|
||||
call(nodeId: string, method: string, params: any): Promise<any>;
|
||||
/**
|
||||
* Broadcast to all SSE clients
|
||||
*/
|
||||
broadcast(event: string, data: any): void;
|
||||
/**
|
||||
* Handle health check
|
||||
*/
|
||||
private handleHealth;
|
||||
/**
|
||||
* Handle RPC requests
|
||||
*/
|
||||
private handleRPC;
|
||||
/**
|
||||
* Handle SSE connections for real-time updates
|
||||
*/
|
||||
private handleSSE;
|
||||
/**
|
||||
* Handle streaming data (for shard migration)
|
||||
*/
|
||||
private handleStream;
|
||||
/**
|
||||
* Handle stream upload (receiving data)
|
||||
*/
|
||||
private handleStreamUpload;
|
||||
/**
|
||||
* Handle stream download (sending data)
|
||||
*/
|
||||
private handleStreamDownload;
|
||||
/**
|
||||
* Send HTTP request to another node
|
||||
*/
|
||||
private sendHTTPRequest;
|
||||
/**
|
||||
* Read request body
|
||||
*/
|
||||
private readBody;
|
||||
/**
|
||||
* Find an available port
|
||||
*/
|
||||
private findAvailablePort;
|
||||
/**
|
||||
* Start SSE heartbeat to keep connections alive
|
||||
*/
|
||||
private startSSEHeartbeat;
|
||||
/**
|
||||
* Generate unique ID
|
||||
*/
|
||||
private generateId;
|
||||
/**
|
||||
* Get connected nodes count
|
||||
*/
|
||||
getConnectionCount(): number;
|
||||
/**
|
||||
* Get SSE client count
|
||||
*/
|
||||
getSSEClientCount(): number;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue