/** Built-in fraction of the model context window that triggers compaction/pruning. */ export declare const CONTEXT_LIMIT_RATIO = 0.8; export interface ConversationCompactionPolicy { enabled: boolean; reserveTokens: number; keepRecentTokens: number; } export interface ManualCompactionPolicy { keepRecentTokens: number; minKeepRecentTokens: number; maxKeepRecentTokens: number; } export interface AutoOlderHistoryCompactionPolicy { enabled: boolean; keepRecentTokens: number; cooldownTurns: number; minRawTokens: number; /** Window-relative floor for the raw suffix kept by request-time pruning. */ keepRecentRatio: number; /** Window-relative growth budget that triggers a fresh re-prune of a frozen cut. */ hysteresisRatio: number; } export interface AgentDrivenCompactionPolicy { enabled: boolean; cooldownTurns: number; minRawTokens: number; olderHistoryKeepRecentTokens: number; olderHistoryMinKeepRecentTokens: number; olderHistoryMaxKeepRecentTokens: number; olderHistoryMinCompactableTokens: number; } export interface ToolOutputCompressorPolicy { enabled: boolean; maxResultChars: number; maxReadLines: number; maxLsLines: number; maxSearchLines: number; stripAnsi: boolean; stripComments: boolean; testFailuresOnly: boolean; compactGit: boolean; } export interface TruncationContinuationPolicy { maxAttempts: number; totalOutputTokenBudget: number; } export interface CompactionPolicy { conversation: ConversationCompactionPolicy; manual: ManualCompactionPolicy; autoOlderHistory: AutoOlderHistoryCompactionPolicy; agentDriven: AgentDrivenCompactionPolicy; toolOutputCompressor: ToolOutputCompressorPolicy; truncationContinuation: TruncationContinuationPolicy; } export interface CompactionPolicySettings { /** Legacy/current conversation compaction flag. Defaults to true. */ enabled?: boolean; /** Legacy/current reserve tokens for compaction prompt/output. */ reserveTokens?: number; /** Legacy/current recent raw suffix for automatic older-history compaction. */ keepRecentTokens?: number; manual?: Partial; autoOlderHistory?: Partial; agentDriven?: Partial; toolOutputCompressor?: Partial; truncationContinuation?: Partial; } export declare const DEFAULT_COMPACTION_POLICY: CompactionPolicy; export declare function normalizeManualKeepRecentTokens(value: unknown, manualPolicy?: ManualCompactionPolicy): number; export declare function normalizeAgentDrivenOlderHistoryKeepRecentTokens(value: unknown, agentPolicy?: AgentDrivenCompactionPolicy): number; export declare function getAutoOlderHistoryContextThresholdTokens(policy: CompactionPolicy, contextWindow: number | null | undefined): number | null; /** * Resolve the recent raw suffix to keep for virtual request-time pruning. * * The suffix is window-relative by default: `keepRecentRatio * contextWindow` * with the agent-driven absolute value acting only as a safety floor. An * explicit caller-provided value always wins so existing tool/manual callers * keep their current behavior. */ export declare function getAutoOlderHistoryKeepRecentTokens(policy: CompactionPolicy, contextWindow: number | null | undefined, explicitKeepRecentTokens?: number): number | undefined; /** * Resolve the growth budget that triggers a frozen request-time cut to re-prune. * * The floor is twice the kept suffix; on large windows the window-relative * `hysteresisRatio * contextWindow` wins so re-pruning tracks the model size. */ export declare function getAutoOlderHistoryHysteresisTokens(policy: CompactionPolicy, contextWindow: number | null | undefined, keepRecentTokens: number): number; export declare function normalizeCompactionPolicy(settings?: CompactionPolicySettings): CompactionPolicy; //# sourceMappingURL=policy.d.ts.map