import { type SharedSessionInputRecord } from './session-intents.js'; import type { SharedSessionStoreSnapshot } from './session-broker-helpers.js'; import type { SharedSessionMessage, SharedSessionParticipant, SharedSessionRecord } from './session-types.js'; export declare function sortSessions(records: Iterable): SharedSessionRecord[]; export declare function sortMessages(records: Iterable): SharedSessionMessage[]; export declare function sortInputs(records: Iterable): SharedSessionInputRecord[]; export declare function loadSessionBrokerState(snapshot: SharedSessionStoreSnapshot | null | undefined): { readonly sessions: Map; readonly messages: Map; readonly inputs: Map; }; /** * Build the durable snapshot with a PER-SESSION message cap. * * `maxPersistedMessagesPerSession` bounds each session's retained bodies * independently, NOT the flattened total. The old global slice-after-flatten * behaviour silently dropped whole sessions' transcripts (the oldest ones) once * the combined message count crossed the cap, while `messageCount` stayed * inflated. Capping per session keeps every session's most recent bodies and, * when a session IS truncated, stamps `retainedMessageCount` so the loss is * honest rather than silent (see {@link SharedSessionRecord.retainedMessageCount}). */ export declare function createSessionBrokerSnapshot(state: { readonly sessions: ReadonlyMap; readonly messages: ReadonlyMap; readonly inputs: ReadonlyMap; }, maxPersistedMessagesPerSession: number): SharedSessionStoreSnapshot; export declare function upsertSessionParticipant(participants: readonly SharedSessionParticipant[], participant: SharedSessionParticipant): SharedSessionParticipant[]; /** * Boot-time reconciliation of a freshly-loaded broker state (mutates in place): * cancels inputs stuck in `spawned`/`delivered` from a prior run (agent state is * unknown after a restart) and clears stale `activeAgentId` on every session. * Returns the set of session ids whose input buckets changed so the caller can * refresh their pending counts. */ export declare function reconcileSessionBrokerBoot(sessions: Map, inputs: Map): Set; export declare function countPendingSessionInputs(records: readonly SharedSessionInputRecord[]): number; //# sourceMappingURL=session-broker-state.d.ts.map