/** * Recommendation engine — compression protection + recommendation. * * Clean-room reimplementation of the recommendation algorithm (MIT, ours). * These pure functions answer two questions every turn: * * 1. **Protection** — which messages must NOT be compressed? (protected tools, * recent messages, recent tokens) * 2. **Recommendation** — which remaining ranges are actually WORTH compressing? * (growth-aware threshold; suppress nudges when ranges are too small) * * Called by the `recommend` pipeline node. No side effects, no state mutation. */ import type { Config, ContextRanges, CoreMessage } from "./types.js"; import type { CompressionState } from "./types.js"; /** * Compute the set of protected message refs (mNNNNN) that form the * "soft-protected zone" at the tail of the conversation. * * Combines two rules: * 1. Last N messages (`config.preserveRecentMessages`) * 2. Last N tokens expanding backward (`config.preserveRecentTokens`) * * Only considers visible, non-synthetic, non-pruned messages that have refs. */ export declare function computeProtectedRefs(messages: CoreMessage[], state: CompressionState, config: Config, countTokens?: (text: string) => number): Set; /** * Build compressible and protected range groups from the message list. * * Messages are classified into: * - **compressible**: normal messages outside the protected zone * - **protected**: messages from protected tools (e.g., skill, task) * - **skipped**: covered by blocks, synthetic, or in the protected zone * * Compressible messages are grouped into contiguous ranges. The protected * zone (from `computeProtectedRefs`) splits groups — the unprotected head * survives as its own range. */ export declare function buildCompressibleRanges(messages: CoreMessage[], state: CompressionState, config: Config, protectedZoneRefs?: Set, countTokens?: (text: string) => number): ContextRanges; //# sourceMappingURL=recommend.d.ts.map