/** * Core-2 snapshot builder — dead-simple fork snapshot. * * Strips batch read/write/edit bodies (keeping first 3 + last 3 lines as * orientation) and preserves all other conversation verbatim in * chronological order. */ import type { FlowTier, ContextProfile, ToolResultCategory } from "../flow/agents.js"; export type CompressionLevel = "none" | "light" | "medium" | "aggressive"; export interface CompressionStats { preBytes: number; postBytes: number; level: CompressionLevel; profileName?: string; messagesDropped: number; syntheticSummary?: string; } /** * Build a snapshot with optional context compression. If the estimated token * count exceeds the threshold (or an override is set), a second pass applies * the resolved compression level and profile. */ export declare function buildSnapshotWithCompression(sessionManager: SessionSnapshotSource, options?: BuildCore2SnapshotOptions, maxContextTokens?: number): { snapshot: string | null; stats?: CompressionStats; }; export interface SessionSnapshotSource { getHeader: () => unknown; getBranch: () => unknown[]; } export interface BuildCore2SnapshotOptions { forkedFrom?: string; forkedAt?: string; parentFlow?: string; depth?: number; activeToolCallId?: string; tier?: FlowTier; compressionLevel?: CompressionLevel; compressionProfile?: ContextProfile; /** If provided, compression stats are written here after the snapshot is built. */ compressionStats?: CompressionStats; } /** Rough token estimate for a snapshot string (1 token ≈ 4 chars). */ export declare function estimateTotalContextTokens(snapshotJsonl: string): number; /** Classify a tool/toolResult message into a category for profile-aware compression. */ export declare function classifyToolResult(entry: unknown): ToolResultCategory; export declare function buildCore2Snapshot(sessionManager: SessionSnapshotSource, options?: BuildCore2SnapshotOptions): string | null; export interface CompressionResult { entries: unknown[]; droppedCount: number; syntheticSummary?: string; } export declare function applyContextCompression(entries: unknown[], level: CompressionLevel | undefined, profile?: ContextProfile): CompressionResult; export interface SharedContext { messageCount: number; userMessageCount: number; assistantMessageCount: number; toolCalls: Record; totalTokens: number; preview: string; } export declare function parseSharedContext(snapshotJsonl: string | null): SharedContext | undefined; //# sourceMappingURL=snapshot.d.ts.map