import { type QueuedMessage } from "./queue.js"; import { RuntimeStateStore } from "./runtime-state.js"; import { TopicConcurrencyLimiter } from "./topic-concurrency.js"; type ChatProcessFn = (runId: string, chatId: string, mergedText: string, messages: QueuedMessage[], signal: AbortSignal, scopeKey?: string) => Promise; export declare class ChatManager { private readonly queue; private readonly runtimeState; private readonly limiter; private processFn; constructor(bufferMs: number, runtimeState: RuntimeStateStore); onProcess(fn: ChatProcessFn): void; onPending(fn: (msg: QueuedMessage) => void): void; onDiscard(fn: (messages: QueuedMessage[]) => void): void; onIdle(fn: (scopeKey: string) => void): void; enqueue(msg: QueuedMessage): boolean; push(msg: QueuedMessage): boolean; /** 队列是否已停止(关闭期间不再接受新任务)。 */ isStopped(): boolean; /** 入队一个 Session 续接 Loop;任务内容由 Pipeline 处理时从 DB 读取。 */ enqueueLoop(chatId: string, loopJobId: number, threadId?: string, replyToMsgId?: string): boolean; stop(): void; stopChat(chatId: string): number; flushChat(chatId: string): number; drain(chatId: string, shouldDiscard?: (message: QueuedMessage) => boolean): number; pendingCount(chatId: string): number; hasBusyChats(): boolean; isBusy(chatId: string): boolean; cancel(chatId: string): boolean; getState(chatId: string): import("./runtime-state.js").ChatQueueState; getLimiter(): TopicConcurrencyLimiter; getScopeKeys(): string[]; private syncRuntimeQueueState; private markActiveRunStopped; } export {};