/** * Deterministic emergency fallback for the Adaptive Context Governor. * * This path is deliberately NOT another summarizer call. It moves the oldest * balanced surface range into the same durable, reversible ARC block store and * writes a bounded extractive index as the checkpoint. Originals remain in * the append-only log, so search_context/decompress still recover them. * @module dsh-arc-context/fallback */ import type { CompactionResult, CompactionAgentContext } from '@deepseek-ai/dsh-compaction'; import { type CompactionTransactionInput } from './region.ts'; /** Global checkpoint budget, including a model-written summary and its appendix. */ export declare const MAX_SUMMARY_CHARS = 24000; /** Body-assembly policy when the index exceeds the checkpoint budget. */ export type SafetyIndexRanking = 'chronological' | 'value'; /** Build the local, bounded checkpoint text used by emergency cold-storage. */ export declare function buildEmergencyFallbackSummary(agent: CompactionAgentContext, shadowedSeqs: readonly number[]): string; /** Build the local checkpoint used by official manual/region seam calls. */ export declare function buildManualFallbackSummary(agent: CompactionAgentContext, shadowedSeqs: readonly number[]): string; /** * Exact/reversible safety appendix for a model-written ARC checkpoint. Models * vary in what they retain; the appendix keeps structured and rare evidence * without a second API call and applies the same archive-instruction boundary. */ export declare function buildModelSummarySafetyIndex(agent: CompactionAgentContext, shadowedSeqs: readonly number[], maxChars?: number, ranking?: SafetyIndexRanking): string; /** * Price the exact replacement span with the host's token-meter protocol. * `compaction/summary.shadowedTokenCount` is not descriptive metadata: the * bounded surface projection subtracts it from its own heuristic total. A * different estimator (notably ARC's CJK-aware count) can over-claim the * replaced range and make the host projection negative. */ export declare function resolveShadowedTokenCount(agent: CompactionAgentContext, shadowedSeqs: readonly number[]): number; /** Prepare one exact local replacement, returning null when it would not shrink. */ export declare function prepareLocalCompaction(agent: CompactionAgentContext, requestedStart: number, requestedEnd: number): CompactionTransactionInput | null; /** Compact one caller-selected range through the official region seam. */ export declare function runLocalCompactionRegion(agent: CompactionAgentContext, start: number, end: number): CompactionResult | null; /** Move one largest safe old range into reversible cold-storage without an API call. */ export declare function runEmergencyFallback(agent: CompactionAgentContext): CompactionResult | null;