import { MessageQueue, QueueConfig, QueueEntry, Unsubscribe } from '@agentxjs/core/mq'; /** * OffsetGenerator - Generates monotonically increasing offsets * * Format: "{timestamp_base36}-{sequence_padded}" * Example: "lq5x4g2-0001" * * This format ensures: * - Lexicographic ordering matches temporal ordering * - Multiple events in same millisecond get unique offsets * - Human-readable and compact */ declare class OffsetGenerator { private lastTimestamp; private sequence; /** * Generate a new offset */ generate(): string; /** * Compare two offsets * @returns negative if a < b, 0 if a == b, positive if a > b */ static compare(a: string, b: string): number; } /** * SqliteMessageQueue - RxJS-based message queue with SQLite persistence * * - In-memory pub/sub using RxJS Subject (real-time) * - SQLite persistence for recovery guarantee * - Consumer offset tracking for at-least-once delivery */ /** * SqliteMessageQueue implementation */ declare class SqliteMessageQueue implements MessageQueue { private readonly subject; private readonly offsetGen; private readonly config; private readonly db; private cleanupTimer?; private isClosed; private constructor(); /** * Create a new SqliteMessageQueue instance */ static create(path: string, config?: QueueConfig): SqliteMessageQueue; publish(topic: string, event: unknown): Promise; subscribe(topic: string, handler: (entry: QueueEntry) => void): Unsubscribe; ack(consumerId: string, topic: string, offset: string): Promise; getOffset(consumerId: string, topic: string): Promise; recover(topic: string, afterOffset?: string, limit?: number): Promise; close(): Promise; /** * Cleanup old entries based on retention policy */ private cleanup; } export { OffsetGenerator, SqliteMessageQueue };