import type { ApprovalResponse, ApprovalState, ApprovalVote, ArtifactCreateOptions, ArtifactRef, FabricEvent, SessionData, SessionEntry, SessionStore, StreamChunkStore } from "./types.js"; import type { RunEvent, RunStore } from "./persistence.js"; export declare class InMemorySessionStore implements SessionStore { /** Tag so callers (and runtime-mode resolution) can detect ephemeral storage. */ readonly __inMemory = true; private readonly sessions; private readonly artifacts; private readonly approvalWaiters; load(id: string): Promise; save(data: SessionData): Promise; listSessions(): Promise; appendEvent(sessionId: string, event: FabricEvent): Promise; appendEntry(sessionId: string, entry: SessionEntry): Promise; appendEntries(sessionId: string, entries: readonly SessionEntry[], options?: { expectedLeafId?: string | undefined; }): Promise; waitForApproval(sessionId: string, approvalId: string, timeoutMs?: number): Promise; resolveApproval(sessionId: string, approvalId: string, response: ApprovalResponse): Promise; voteApproval(sessionId: string, approvalId: string, vote: ApprovalVote): Promise; getApprovalState(sessionId: string, approvalId: string): Promise; listApprovalStates(sessionId: string): Promise; putArtifact(sessionId: string, name: string, content: string | Uint8Array, options?: ArtifactCreateOptions): Promise; getArtifact(sessionId: string, artifactIdOrName: string): Promise<{ ref: ArtifactRef; content: Uint8Array; } | undefined>; listArtifacts(sessionId: string): Promise; delete(sessionId: string): Promise; /** Serializable state used by durable adapters that wrap the reference semantics. */ exportPersistenceSnapshot(): unknown; importPersistenceSnapshot(snapshot: unknown): void; private resolveApprovalWaiters; private removeApprovalWaiter; private ensure; } export declare const defaultSessionStore: InMemorySessionStore; /** * No-op session store for `runtime: 'stateless'` mode. All writes are * discarded; reads always return the empty initial session. Use this * when the agent is intended as a pure request/response handler with * no persistence (typical for high-volume webhooks and edge runtimes). * * Approvals and artifact retrieval are not supported — wiring those * up requires a real store. Callers in stateless mode should not rely * on artifact persistence or approval gating. */ export declare class NoopSessionStore implements SessionStore { readonly __stateless = true; load(_id: string): Promise; save(_data: SessionData): Promise; appendEvent(_sessionId: string, _event: FabricEvent): Promise; appendEntry(_sessionId: string, _entry: SessionEntry): Promise; appendEntries(_sessionId: string, _entries: readonly SessionEntry[], _options?: { expectedLeafId?: string | undefined; }): Promise; } export declare const noopSessionStore: NoopSessionStore; /** * Merge one idempotent, leaf-fenced entry batch into a session snapshot. * Exported for first-party storage adapters so every backend applies the same * conflict and exact-replay semantics before its single atomic write. */ export declare function mergeSessionEntryBatch(existing: SessionData, entries: readonly SessionEntry[], expectedLeafId?: string, enforceExpectedLeaf?: boolean): SessionData | false; /** * A unified in-memory store that implements {@link SessionStore}, * {@link StreamChunkStore}, and {@link RunStore}. Useful for testing and * dev environments where a single object needs to be passed as `store`, * `streamChunkStore`, and `runStore`. * * Backed by separate Maps for each concern so that stream chunks and * run data do not pollute session state. */ export declare class UnifiedInMemoryStore extends InMemorySessionStore implements StreamChunkStore, RunStore { private readonly streamSegments; private readonly runs; private readonly runEvents; appendStreamChunkSegment(streamKey: string, segmentIndex: number, body: string): Promise; getStreamChunkSegments(streamKey: string): Promise>; saveRun(run: unknown): Promise; getRun(id: string): Promise; listRuns(): Promise; appendRunEvent(runId: string, event: RunEvent): Promise; getRunEvents(runId: string, fromIndex?: number): Promise; /** Clean up stream segments and run data for a given session/run prefix. */ deleteStreamData(streamKey: string): Promise; deleteRun(runId: string): Promise; } /** * Factory that returns a fresh {@link UnifiedInMemoryStore}. * The returned object can be passed as `store`, `streamChunkStore`, * and `runStore` simultaneously. */ export declare function createUnifiedInMemoryStore(): UnifiedInMemoryStore; export declare function approvalStatesFromEntries(sessionId: string, entries: SessionEntry[]): ApprovalState[]; //# sourceMappingURL=store.d.ts.map