odin-protocol-core
Version:
The world's first standardized AI-to-AI communication infrastructure for JavaScript/TypeScript - 100% functional with 57K+ msgs/sec throughput
96 lines (95 loc) • 2.52 kB
TypeScript
/**
* ODIN Protocol Message Types
*/
export interface OdinMessageHeader {
/** Unique message identifier */
id: string;
/** Message type */
type: string;
/** Source system identifier */
source: string;
/** Destination system identifier */
destination: string;
/** Message timestamp */
timestamp: Date;
/** Message priority */
priority: MessagePriority;
/** Correlation ID for request/response tracking */
correlationId?: string;
/** Message metadata */
metadata?: Record<string, any>;
}
export declare enum MessagePriority {
LOW = 1,
NORMAL = 2,
HIGH = 3,
CRITICAL = 4,
EMERGENCY = 5
}
export interface OdinMessagePayload {
/** Message content */
content: any;
/** Content type */
contentType: string;
/** Content encoding */
encoding?: string;
/** Payload schema version */
schemaVersion?: string;
}
export interface OdinMessageOptions {
/** Delivery timeout in milliseconds */
timeout?: number;
/** Maximum retry attempts */
maxRetries?: number;
/** Delivery confirmation required */
confirmDelivery?: boolean;
/** Message encryption enabled */
encrypted?: boolean;
/** Message compression enabled */
compressed?: boolean;
/** Content type for the message */
contentType?: string;
/** Content encoding */
encoding?: string;
/** Correlation ID for request/response tracking */
correlationId?: string;
/** Message metadata */
metadata?: Record<string, any>;
}
export interface OdinMessageStatus {
/** Current message status */
status: MessageStatus;
/** Status timestamp */
timestamp: Date;
/** Delivery attempts */
attempts: number;
/** Error message if failed */
error?: string;
/** Processing time in milliseconds */
processingTime?: number;
}
export declare enum MessageStatus {
PENDING = "pending",
SENDING = "sending",
SENT = "sent",
DELIVERED = "delivered",
PROCESSED = "processed",
FAILED = "failed",
CANCELLED = "cancelled"
}
export interface OdinMessageResponse {
/** Response to original message ID */
originalMessageId: string;
/** Response status */
status: 'success' | 'error' | 'partial';
/** Response data */
data?: any;
/** Error details if status is error */
error?: {
code: string;
message: string;
details?: any;
};
/** Response metadata */
metadata?: Record<string, any>;
}