export declare const MEMORY_SOURCE_INTERFACE_VERSION = 1; export type MemorySourceRecord = { [key: string]: unknown; }; export interface MemorySourceSessionMetadata { sessionId?: string; title?: string; cwd?: string; updatedAt?: number; } /** * Adapter-reported coverage of its own retained data. Omit (or omit * `complete`) only when the adapter returned everything it currently holds; * an adapter that caps enumeration or record loading must report * `complete: false` with a stable machine-readable reason so the engine never * presents a silently truncated archive as authoritative. */ export interface MemorySourceCoverage { complete: boolean; reason?: string; } export interface MemorySourceSessionDescriptor { sessionKey: string; sessionId?: string; revision: string; metadata?: MemorySourceSessionMetadata; } export interface MemorySourceSnapshot extends MemorySourceSessionDescriptor { records: readonly MemorySourceRecord[]; /** Authoritative live leaf; null means an empty active path, omitted uses persisted semantics. */ selectedLeafId?: string | null; /** Record-loading coverage; omitted means complete. */ coverage?: MemorySourceCoverage; } export interface MemorySourceListPage { sessions: readonly MemorySourceSessionDescriptor[]; /** Enumeration coverage; omitted means complete. */ coverage?: MemorySourceCoverage; } export type MemorySourceAction = "list" | "recall" | "expand"; export interface MemorySourceRequestContext { signal?: AbortSignal; } export interface PortableMemorySource { readonly interfaceVersion: typeof MEMORY_SOURCE_INTERFACE_VERSION; readonly id: string; listSessions(request: { limit: number; } & MemorySourceRequestContext): Promise; loadSession(sessionKey: string, request: MemorySourceRequestContext): Promise; authorize?(action: MemorySourceAction, sessionKey: string | null): boolean | Promise; } export type MemorySourceErrorCode = "source_not_found" | "source_unauthorized" | "invalid_source_response" | "session_not_found" | "aborted"; export declare class MemorySourceError extends Error { readonly code: MemorySourceErrorCode; constructor(code: MemorySourceErrorCode, message: string); } /** Validate a portable memory source at registration time; returns it unchanged. */ export declare const defineMemorySource: (source: PortableMemorySource) => PortableMemorySource; export interface MemorySourceRegistry { register(source: PortableMemorySource): void; get(id: string): PortableMemorySource | undefined; ids(): readonly string[]; } export declare const createMemorySourceRegistry: () => MemorySourceRegistry; //# sourceMappingURL=portable.d.ts.map