@codai/cbd
Version:
Codai Better Database - High-Performance Vector Memory System with HPKV-inspired architecture and MCP server
165 lines • 4.25 kB
TypeScript
/**
* Ecosystem Integration Framework
* Service mesh, cross-service synchronization, authentication, and monitoring
*/
import { EventEmitter } from 'events';
interface ServiceConfig {
name: string;
url: string;
port: number;
health_endpoint: string;
version: string;
capabilities: string[];
}
interface ServiceMeshConfig {
services: Record<string, ServiceConfig>;
discovery: {
enabled: boolean;
refresh_interval: number;
timeout: number;
};
load_balancing: {
strategy: 'round-robin' | 'least-connections' | 'weighted';
health_check_interval: number;
};
security: {
authentication: boolean;
encryption: boolean;
api_key_required: boolean;
};
}
/**
* CODAI Ecosystem Integration Manager
* Manages connections and communication between all CODAI services
*/
export declare class EcosystemIntegrationManager extends EventEmitter {
private services;
private meshConfig;
private syncManager;
private authManager;
private monitoringManager;
private discoveryInterval?;
constructor(config: ServiceMeshConfig);
/**
* Initialize ecosystem integration
*/
initialize(): Promise<void>;
/**
* Connect to all configured services
*/
private connectToServices;
/**
* Connect to individual service
*/
private connectToService;
/**
* Start service discovery process
*/
private startServiceDiscovery;
/**
* Discover available services
*/
private discoverServices;
/**
* Get service by name
*/
getService(name: string): ServiceConnection | undefined;
/**
* Get all connected services
*/
getAllServices(): ServiceConnection[];
/**
* Execute cross-service operation
*/
executeDistributedOperation(operation: DistributedOperation): Promise<DistributedOperationResult>;
/**
* Shutdown ecosystem integration
*/
shutdown(): Promise<void>;
}
/**
* Individual service connection manager
*/
declare class ServiceConnection extends EventEmitter {
name: string;
config: ServiceConfig;
private authManager;
private httpClient;
private wsConnection?;
private healthCheckInterval?;
private isConnected;
constructor(name: string, config: ServiceConfig, authManager: UnifiedAuthenticationManager);
/**
* Connect to service
*/
connect(): Promise<void>;
/**
* Connect WebSocket for real-time communication
*/
private connectWebSocket;
/**
* Start periodic health checks
*/
private startHealthChecks;
/**
* Handle health check failure
*/
private handleHealthCheckFailure;
/**
* Execute API call
*/
execute(endpoint: string, method?: 'GET' | 'POST' | 'PUT' | 'DELETE', data?: any): Promise<any>;
/**
* Send WebSocket message
*/
sendMessage(message: any): void;
/**
* Disconnect from service
*/
disconnect(): Promise<void>;
}
/**
* Unified Authentication Manager
* Handles authentication across all services
*/
declare class UnifiedAuthenticationManager {
private securityConfig;
private tokens;
private refreshInterval?;
constructor(securityConfig: ServiceMeshConfig['security']);
initialize(): Promise<void>;
/**
* Load authentication tokens
*/
private loadAuthTokens;
/**
* Attach authentication to request
*/
attachAuth(config: any): any;
/**
* Refresh authentication tokens
*/
private refreshTokens;
shutdown(): Promise<void>;
}
interface DistributedOperation {
name: string;
steps: DistributedOperationStep[];
}
interface DistributedOperationStep {
service: string;
endpoint: string;
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
data?: any;
required?: boolean;
onSuccess?: (result: any) => Promise<void>;
onError?: (error: any) => Promise<void>;
}
interface DistributedOperationResult {
success: boolean;
results: Record<string, any>;
errors: string[];
}
export declare const DEFAULT_ECOSYSTEM_CONFIG: ServiceMeshConfig;
export {};
//# sourceMappingURL=ecosystem-integration.d.ts.map