/** * state.ts — Transport-agnostic mutable state for the watcher subsystem. * * All shared runtime state lives here. No transport SDK imports. * Transport-specific state (Baileys socket, GramJS client, chat/message stores) * remains in the per-project packages. */ import type { RegisteredSession, QueuedMessage, ClientWaiter, ContactEntry, VoiceConfig } from "../types/index.js"; export declare const sessionRegistry: Map; export declare const managedSessions: Map; export declare const sessionTtyCache: Map; export declare let activeClientId: string | null; export declare let activeItermSessionId: string; export declare let lastRoutedSessionId: string; export declare function setLastRoutedSessionId(id: string): void; export declare function setActiveClientId(id: string | null): void; export declare function setActiveItermSessionId(id: string): void; export declare function updateSessionTtyCache(entries: Array<{ id: string; tty: string; }>): void; export declare let cachedSessionList: Array<{ id: string; name: string; path: string; type: "claude" | "terminal"; paiName: string | null; atPrompt: boolean; }> | null; export declare let cachedSessionListTime: number; export declare function setCachedSessionList(list: typeof cachedSessionList, time: number): void; export declare const clientQueues: Map; export declare const clientWaiters: Map; export declare const contactMessageQueues: Map; export declare const contactDirectory: Map; export declare let voiceConfig: VoiceConfig; export declare function setVoiceConfig(cfg: VoiceConfig): void; import type { AibpBridge } from "../aibp/bridge.js"; export declare function setAibpBridge(bridge: AibpBridge): void; export declare function getAibpBridge(): AibpBridge | null; export type CommandHandler = (text: string, timestamp: number) => void | Promise; export declare let commandHandler: CommandHandler | null; export declare function setCommandHandler(handler: CommandHandler | null): void; export type MessageSource = string; export declare let messageSource: MessageSource; export declare function setMessageSource(src: MessageSource): void; export declare const sentMessageIds: Set; export interface MailboxMessage { from: string; content: string; timestamp: number; /** * Set once this message has been reported as stale. * * "Queued" is an honest answer at the moment of sending and a false one four * hours later: a message nobody drained is undelivered, not pending. The flag * exists so the fault is reported once rather than every sweep. */ staleReported?: boolean; } /** * Deposit a message, returning anything the queue had to drop to fit it. * * The overflow used to be a bare `shift()`. A message evicted that way was * undelivered and left no trace anywhere — the same silent drop this mailbox * exists to prevent, one level down. The caller gets it back so it can be * recorded. */ export declare function depositToSessionMailbox(itermSessionId: string, from: string, content: string): MailboxMessage | undefined; /** * Read-only view of every mailbox, for anything that needs to age its contents. * * Returns the live message objects deliberately: a sweep marks what it has * already reported, and copying would lose that. */ export declare function listSessionMailboxes(): Array<{ sessionId: string; messages: MailboxMessage[]; }>; export declare function drainSessionMailbox(itermSessionId: string): MailboxMessage[]; export declare function dispatchIncomingMessage(body: string, timestamp: number): void; export declare function enqueueContactMessage(contactId: string, body: string, timestamp: number): void; //# sourceMappingURL=state.d.ts.map