UNPKG

odin-protocol-core

Version:

The world's first standardized AI-to-AI communication infrastructure for JavaScript/TypeScript - 100% functional with 57K+ msgs/sec throughput

91 lines (90 loc) 2.62 kB
/** * Core ODIN Protocol Types and Interfaces */ export interface OdinConfig { /** Unique node identifier */ nodeId: string; /** Network endpoint URL */ networkEndpoint: string; /** Authentication token */ token?: string; /** Connection timeout in milliseconds */ timeout?: number; /** Enable debug logging */ debug?: boolean; /** Maximum retry attempts */ maxRetries?: number; /** Maximum number of connections */ maxConnections: number; /** Heartbeat interval in milliseconds */ heartbeatInterval?: number; /** Performance monitoring enabled */ performanceMonitoring?: boolean; } export interface OdinPerformanceMetrics { /** Messages per second */ messagesPerSecond: number; /** Average response time in milliseconds */ averageResponseTime: number; /** Success rate percentage */ successRate: number; /** Current error rate */ errorRate: number; /** Total messages processed */ totalMessages: number; /** Total errors encountered */ totalErrors: number; /** System uptime in milliseconds */ uptime: number; /** Peak throughput achieved */ peakThroughput: number; /** Timestamp of metrics */ timestamp: Date; } export interface OdinConnectionStatus { /** Connection state */ state: ConnectionState; /** Number of connected peers */ connectedPeers: number; /** Last heartbeat timestamp */ lastHeartbeat: Date; /** Network latency in milliseconds */ networkLatency: number; /** Current throughput */ throughput: number; /** Connection quality (0-100) */ quality?: number; /** Error message if disconnected */ error?: string; } export declare enum ConnectionState { DISCONNECTED = "disconnected", CONNECTING = "connecting", CONNECTED = "connected", DISCONNECTING = "disconnecting", ERROR = "error", RECONNECTING = "reconnecting" } export declare enum OdinEventType { MESSAGE_SENT = "message_sent", MESSAGE_RECEIVED = "message_received", CONNECTION_ESTABLISHED = "connection_established", CONNECTION_LOST = "connection_lost", ERROR_OCCURRED = "error_occurred", PERFORMANCE_UPDATE = "performance_update", SYSTEM = "system", MESSAGE = "message", ERROR = "error" } export interface OdinEvent { /** Event type */ type: OdinEventType | string; /** Event timestamp */ timestamp: Date; /** Event data payload */ data?: any; /** Event metadata */ metadata?: Record<string, any>; /** Event source identifier */ source?: string; }