import type { TopicData, TopicKey, TopicParams } from "./topics.js"; export type TopicStatus = "loading" | "connected" | "error"; export interface DebugInterestTopic { topicKey: TopicKey; cacheKey: string; listenerCount: number; status: TopicStatus; lastRefreshAt: number | null; } export interface TopicState { data: TopicData | undefined; status: TopicStatus; error: Error | null; } /** * The InterestManager owns all realtime actor connections and cached state. * * Multiple subscribers to the same topic share one connection and one cache * entry. After the last subscriber leaves, a short grace period keeps the * connection warm so navigation does not thrash actor connections. */ export interface InterestManager { subscribe(topicKey: K, params: TopicParams, listener: () => void): () => void; getSnapshot(topicKey: K, params: TopicParams): TopicData | undefined; getStatus(topicKey: K, params: TopicParams): TopicStatus; getError(topicKey: K, params: TopicParams): Error | null; listDebugTopics(): DebugInterestTopic[]; dispose(): void; }