import type { World, QueuedMessage, StorageAPI, WorldMessageEvent } from './types.js'; export declare const pausedQueues: Set; type QueueStorageOperations = Required>; export declare function getQueueStorageOrThrow(caller: string): QueueStorageOperations; /** * Core queue processing trigger. Finds the next 'queued' message for the chat, * marks it 'sending', and publishes it. Registers a world-activity listener to * chain to the next message after response completion. * * Guards: pause flag, active-processing check, per-chat dedup. */ export declare function triggerPendingQueueResume(world: World, chatId: string, options?: { recoverStaleSending?: boolean; }): void; /** * Synchronously add the old chat's queue to the paused set on chat switch. * Called by managers.ts restoreChat. */ export declare function autoPauseQueueForChat(worldId: string, chatId: string): void; /** * Clear the pause flag for a chat (used when activating/restoring a chat). */ export declare function clearQueuePauseForChat(worldId: string, chatId: string): void; /** * Add a message to the queue for a chat. Returns the created QueuedMessage or null. */ export declare function addToQueue(worldId: string, chatId: string, content: string, sender: string, options?: { triggerProcessing?: boolean; targetWorld?: World | null; source?: 'direct' | 'queue' | 'retry'; preassignedMessageId?: string; }): Promise; /** * Runtime-start recovery hook. * Resets interrupted `sending` queue rows back to `queued`. */ export declare function recoverQueueSendingMessages(): Promise; /** * Immediate dispatch helper for non-user chat messages. */ export declare function dispatchImmediateChatMessage(worldId: string, chatId: string, content: string, sender: string, targetWorld?: World | null, options?: { source?: 'direct' | 'queue' | 'retry'; preassignedMessageId?: string; }): Promise; /** * External user-send ingress helper. * Queue-backed submission is restricted to user-authored turns only. */ export declare function enqueueAndProcessUserTurn(worldId: string, chatId: string, content: string, sender: string, targetWorld?: World | null, options?: { source?: 'direct' | 'queue' | 'retry'; preassignedMessageId?: string; }): Promise; /** * Return all queue messages (queued, sending, error) for a chat. */ export declare function getQueueMessages(worldId: string, chatId: string): Promise; /** * Remove a specific message from the queue by messageId. */ export declare function removeFromQueue(worldId: string, messageId: string): Promise; /** * Pause queue processing for a chat. Current in-flight message completes normally. */ export declare function pauseChatQueue(worldId: string, chatId: string): Promise; /** * Resume queue processing for a chat. Clears the pause flag and triggers the next item. */ export declare function resumeChatQueue(worldId: string, chatId: string): Promise; /** * Stop queue processing: cancel remaining queued messages and set pause flag. * The current in-flight message completes normally. */ export declare function stopChatQueue(worldId: string, chatId: string): Promise; /** * Clear the entire queue for a chat (removes all queue rows including cancelled/error). */ export declare function clearChatQueue(worldId: string, chatId: string): Promise; /** * Reset a failed queue message (status='error') back to 'queued' with retry_count=0, * then trigger queue processing. Allows the user to manually retry after automatic * retries have been exhausted. */ export declare function retryQueueMessage(worldId: string, messageId: string, chatId: string): Promise; export {};