import type { FileChange } from "./types.js"; export interface PendingToolCall { readonly sessionID: string; readonly toolArgs: Record; } export type SessionScope = "all" | "main" | "child"; export declare class SessionStateStore { private readonly sessions; private readonly pendingToolCalls; private readonly deletedTombstones; private readonly nowFn; constructor(options?: { nowFn?: () => number; }); rememberSession(sessionID: string, parentID?: string | null): void; evaluateScope(sessionID: string, scope: SessionScope, resolveParentID: (sessionID: string) => Promise): Promise; getRootSessionID(sessionID: string, resolveParentID: (sessionID: string) => Promise): Promise; isDeleted(sessionID: string): boolean; deleteSession(sessionID: string): void; private recordTombstone; setPendingToolCall(callID: string, sessionID: string, toolArgs: Record): void; consumePendingToolCall(callID: string): PendingToolCall | undefined; /** * Number of currently-tracked pending tool calls. Exposed for tests and * diagnostics; not part of the public consumer surface. */ pendingToolCallCount(): number; private sweepExpiredPendingToolCalls; addFileChanges(sessionID: string, changes: Iterable): void; getFileChanges(sessionID: string): FileChange[]; getModifiedPaths(sessionID: string): string[]; beginIdleDispatch(sessionID: string, changes: readonly FileChange[]): void; consumeFileChanges(sessionID: string, changes: readonly FileChange[]): void; cancelIdleDispatch(sessionID: string): void; private getOrCreateSession; /** * Walks `parentID` chain to the root session id. Caches the result on the * caller's session record only; intermediate parent records are NOT * mutated when reached transitively (P1-6). Previously every parent on the * walk got a `getOrCreateSession` call, which would resurrect a deleted * session (or invent one that PI never told us about) just because we * traversed through it. The fix is to read parent records when they exist * and otherwise treat the parent chain as opaque, only resolving via the * host adapter without writing through. */ private resolveRootSessionID; } /** * Returns a shallow-cloned tool_args with sensitive keys redacted and the * total JSON-serialized size capped at `TOOL_ARGS_MAX_BYTES` (64 KiB). If * the JSON exceeds the cap the result collapses to a single-key placeholder * indicating truncation. */ export declare function sanitizeToolArgsForSerialization(toolArgs: Record | undefined): Record | undefined;