import type { CompressionBlock, CompressionState, CoreMessage } from "acp-kernel"; import { type BlockSnapshot, type ShapeVariantName, type ShapeTarget, type SnapManifest, type SnapUserMessage } from "./snapcompact.js"; /** Minimal shape: pi AgentSessionModel exposes `input: string[]`. */ export interface VisionModelLike { input?: string[]; } export interface SnapSettings { mode: "auto" | "on" | "off"; variant?: ShapeVariantName; maxFrames: number; /** Newest N active blocks stay hot text; older ones are snap candidates. */ hotBlocks: number; /** Auto-snap fires when unsnapped cold summaries sum to >= this many tokens. */ thresholdTokens: number; midTurnEnabled: boolean; idleEnabled: boolean; idleTimeoutSeconds: number; /** Idle snap only runs when last observed usage >= this many tokens. */ idleThresholdTokens: number; } /** Env ACP_SNAPCOMPACT=off|force overrides the configured mode (matches the * official escape hatch). */ export declare function resolveSnapSettings(adapterConfig: object, env?: NodeJS.ProcessEnv): SnapSettings; export declare function hasVision(model?: VisionModelLike): boolean; /** Whether the PNG path may run at all. "on" without a vision model still * returns true — callers dispatch to the text fallback when !hasVision. */ export declare function snapEnabled(settings: SnapSettings, model?: VisionModelLike): boolean; export declare function summaryTokens(blocks: CompressionBlock[]): number; /** Active blocks oldest-first. */ export declare function activeByAge(state: CompressionState): CompressionBlock[]; /** Cold = active blocks outside the hot window (newest hotBlocks stay text). */ export declare function coldBlocks(state: CompressionState, settings: SnapSettings): CompressionBlock[]; /** Cold blocks not yet rendered into frames. */ export declare function unsnappedCold(state: CompressionState, manifest: SnapManifest, settings: SnapSettings): CompressionBlock[]; /** Quality gate: auto-snap only when pending cold summaries are worth a * render pass. Returns the blocks to snap, or null when under threshold. */ export declare function autoSnapCandidates(state: CompressionState, manifest: SnapManifest, settings: SnapSettings): CompressionBlock[] | null; /** Blocks whose summaries are already imaged AND still active — their anchor * compress tool-calls must be hidden so the summary text is not duplicated * beside its frame. */ export declare function snappedView(state: CompressionState, manifest: SnapManifest): { blockIds: Set; callIds: Set; }; /** Load, GC (drop batches whose blocks were consumed/deactivated), and cap. * Cheap enough to run on every context event; only writes when changed. */ export declare function pruneManifest(sessionFile: string, state: CompressionState, settings: SnapSettings): SnapManifest; export interface SnapRunResult { manifest: SnapManifest; added: number; blocks: BlockSnapshot[]; } /** Build renderable snapshots: official-style scoped serialization of each * block's original messages when available (frames then read like official * archives), plain summary otherwise (idle maintenance has no messages). */ export declare function snapshotBlocks(blocks: CompressionBlock[], coreMessages: CoreMessage[] | null): BlockSnapshot[]; /** Render the given snapshots into frames (vision path). */ export declare function runSnap(options: { sessionFile: string; manifest: SnapManifest; blocks: BlockSnapshot[]; settings: SnapSettings; model?: ShapeTarget; }): Promise; export declare function snapAttachment(manifest: SnapManifest): SnapUserMessage | undefined; /** Text-model fallback (/acp-snap on a non-vision model): direct the model to * run tier-2 distillation over the cold blocks right now. */ export declare function distillDirective(blocks: CompressionBlock[]): string; /** Manual /compact restoration: force the model to compress everything * compressible immediately (plugin compression stays model-driven). */ export declare function compactDirective(): string;