/**
 * Per-worker in-memory registry of active MCP sessions with open GET-SSE
 * streams. The persistent session record lives in `system.mcp_session`
 * (RocksDB); this registry holds the things that can't be persisted —
 * the live IterableEventQueue, plus per-session snapshots of the last
 * `tools/list` / `resources/list` results so the listChanged dispatcher
 * can suppress no-op notifications.
 *
 * Per-worker only. A session's GET stream is bound to the worker that
 * accepted the GET; cross-worker fan-out isn't attempted in v1.
 *
 * Lifecycle: an entry is created on GET-SSE open and removed via three
 * paths — explicit DELETE (transport calls `deleteSession`), the on-close
 * hook fired when the consumer's async-iterator returns/throws (e.g.
 * client drop), or the idle-prune sweep that catches zombies the close
 * hook missed (e.g. a proxy holding the connection after the client died
 * without a graceful close).
 */
import { IterableEventQueue } from '../../resources/IterableEventQueue.ts';
import type { AuthedUser } from './toolRegistry.ts';
import type { McpProfile } from './transport.ts';
export interface SseEvent {
    event?: string;
    data?: unknown;
    id?: string;
}
export interface RegisteredSession {
    sessionId: string;
    profile: McpProfile;
    user: AuthedUser;
    queue: IterableEventQueue<SseEvent>;
    /** Most recent tools/list payload sent on this session — used for diffing. */
    lastTools?: ReadonlyArray<{
        name: string;
    }>;
    /** Most recent resources/list payload sent on this session — used for diffing. */
    lastResources?: ReadonlyArray<{
        uri: string;
    }>;
    /** Wall-clock ms of last activity. Bumped by registerSession + touchSession. */
    lastSeen: number;
}
export declare function _setClockForTest(fn: (() => number) | undefined): void;
export declare function registerSession(sessionId: string, profile: McpProfile, user: AuthedUser): RegisteredSession;
export declare function unregisterSession(sessionId: string): void;
export declare function getRegisteredSession(sessionId: string): RegisteredSession | undefined;
/**
 * Mark a session as having activity right now (e.g. a `tools/call` came in).
 * Keeps idle-prune from sweeping live sessions whose GET stream is dormant
 * between server-push events. Distinct from `session.touchSession` — that
 * one updates the persistent RocksDB record's `lastActivity`; this one
 * updates the in-memory registry's `lastSeen` (used only by the idle-prune).
 */
export declare function touchRegisteredSession(sessionId: string): void;
/**
 * Apply a callback to every session matching `profile`. Used by the
 * listChanged dispatcher to recompute lists per-session.
 */
export declare function forEachSessionByProfile(profile: McpProfile, cb: (record: RegisteredSession) => void): void;
/** Test seam — drop all sessions. */
export declare function _resetSessionRegistryForTest(): void;
/** Test seam — peek count. */
export declare function _sessionRegistrySize(): number;
