trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
37 lines • 1.32 kB
TypeScript
/**
* In-memory persistence for a WebSocket relay hub (demo / dev).
*
* Retains durable-enough session state: latest presence per peer, chat tail,
* and collaborative text (snapshot preferred, else op tail). Not the VCS op
* log — reset when the relay process stops.
*/
import type { RealtimeMessage } from './types.js';
export declare const DEFAULT_MAX_CHAT = 200;
export declare const DEFAULT_MAX_TEXT_OPS = 2000;
export interface RelayPersistenceOptions {
maxChat?: number;
maxTextOps?: number;
}
/**
* Records relay traffic and builds ordered replay batches for newcomers.
*/
export declare class RelayPersistence {
private maxChat;
private maxTextOps;
private presence;
/** Chat is a grow-only set keyed by {@link chatKey} — dedup on record. */
private chatLog;
private chatKeys;
private textSnapshot;
private textOps;
constructor(opts?: RelayPersistenceOptions);
/** Record an inbound client message (skip `hello` / `replay`). */
record(message: RealtimeMessage): void;
/** Ordered messages to replay to a peer that just connected. */
buildReplay(): RealtimeMessage[];
getPresenceCount(): number;
getChatCount(): number;
hasTextSnapshot(): boolean;
private recordBroadcast;
}
//# sourceMappingURL=relay-persistence.d.ts.map