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

82 lines
2.3 KiB
TypeScript

/**
* BrainyMCPBroadcast
*
* Enhanced MCP service with real-time WebSocket broadcasting capabilities
* for multi-agent coordination (Jarvis ↔ Picasso communication)
*
* Features:
* - WebSocket server for real-time push notifications
* - Subscription management for multiple Claude instances
* - Message broadcasting to all connected agents
* - Works both locally and with cloud deployment
*/
import { BrainyMCPService } from './brainyMCPService.js';
import { BrainyDataInterface } from '../types/brainyDataInterface.js';
import { MCPServiceOptions } from '../types/mcpTypes.js';
interface BroadcastMessage {
id: string;
from: string;
to?: string | string[];
type: 'message' | 'notification' | 'sync' | 'heartbeat' | 'identify';
event?: string;
data: any;
timestamp: number;
}
export declare class BrainyMCPBroadcast extends BrainyMCPService {
private wsServer?;
private httpServer?;
private agents;
private messageHistory;
private maxHistorySize;
constructor(brainyData: BrainyDataInterface, options?: MCPServiceOptions & {
broadcastPort?: number;
cloudUrl?: string;
});
/**
* Start the WebSocket broadcast server
* @param port Port to listen on (default: 8765)
* @param isCloud Whether this is a cloud deployment
*/
startBroadcastServer(port?: number, isCloud?: boolean): Promise<void>;
/**
* Handle new WebSocket connection
*/
private handleNewConnection;
/**
* Handle message from an agent
*/
private handleAgentMessage;
/**
* Broadcast message to all connected agents
*/
broadcast(message: BroadcastMessage, excludeId?: string): void;
/**
* Send message to specific agent
*/
private sendToAgent;
/**
* Remove agent from connected list
*/
private removeAgent;
/**
* Add message to history
*/
private addToHistory;
/**
* Stop the broadcast server
*/
stopBroadcastServer(): Promise<void>;
/**
* Get connected agents
*/
getConnectedAgents(): Array<{
id: string;
name: string;
role: string;
}>;
/**
* Get message history
*/
getMessageHistory(): BroadcastMessage[];
}
export default BrainyMCPBroadcast;