import type { LoggedEvent, SessionEventLog } from './SessionEventLog.js'; import { type StreamEventFilter } from './shouldEmit.js'; export interface SessionRouteDeps { eventLog: SessionEventLog; memory: { readBlocks(owner: string): Promise>; readExtracted(owner: string): Promise>; }; cancelTurn(sessionId: string, reason?: string): Promise<'cancelled' | 'no_active_turn'>; /** * Owner key for a memory read, or null to deny (403). Return the SAME key the runtime writes * memory under — a transport that returns a differently-scoped key reads a keyspace nothing * writes and silently returns empty. Tenancy is enforced by returning null, not by partitioning * the key. */ memoryOwner(principal: { tenantId: string; userId: string; }, requestedUserId: string): string | null; /** Set by the transport per request when streaming with follow=true. */ abortSignal?: AbortSignal; } export interface RouteOutcome { status: number; body?: unknown; ndjson?: AsyncIterable; } export interface SessionEventsQuery { from?: string; follow?: string; } export interface SessionSnapshotQuery { limit?: string; } declare function parseFromIndex(raw: string | undefined): number | null; declare function parseLimit(raw: string | undefined): number | null; declare function parseFollow(raw: string | undefined): boolean; export declare function readEvents(deps: SessionRouteDeps, sessionId: string, query: SessionEventsQuery, filter: StreamEventFilter): Promise; export declare function readSnapshot(deps: SessionRouteDeps, sessionId: string, query: SessionSnapshotQuery, filter: StreamEventFilter, rawSessionId?: string): Promise; export declare function cancelSession(deps: SessionRouteDeps, sessionId: string): Promise; export declare function readMemory(deps: SessionRouteDeps, principal: { tenantId: string; userId: string; }, requestedUserId: string): Promise; /** Exported for unit tests that assert query parsing semantics. */ export declare const sessionRouteParsing: { parseFromIndex: typeof parseFromIndex; parseLimit: typeof parseLimit; parseFollow: typeof parseFollow; }; export {};