import type { AgentMessage } from '@earendil-works/pi-agent-core'; import type { Api, Model } from '@earendil-works/pi-ai'; import { type ContextBudgetInput } from './context-budget.js'; import type { CompactionDiscardedAttempt, CompactionExecutionOptions, CompactionResult } from './compaction.js'; import type { ResolvedCompactionPolicy } from './compaction-policy.js'; export declare class ContextRecoveryError extends Error { readonly code: 'disabled' | 'unrecoverable'; constructor(code: 'disabled' | 'unrecoverable', message: string); } /** Projection is ephemeral; the transcript remains the authoritative record. */ export declare function assessContext(input: ContextBudgetInput, maxBytes: number): { bytes: number; fits: boolean; messages: AgentMessage[]; evaluation: import("./context-budget.js").ContextBudgetEvaluation; prunedToolResults: number; prunedImages: number; }; interface RecoveryTranscript { loadMessages(): Promise; compact(messages: AgentMessage[], model: Model, instructions?: string, force?: boolean, options?: CompactionExecutionOptions): Promise; } /** One normal compaction and at most one full-history recovery, under the caller's deadline. */ export declare function recoverContext(options: { conversationId: string; transcript: RecoveryTranscript; budget: Omit; policy: ResolvedCompactionPolicy; summaryModel: Model | (() => Model | Promise>); fallbackModels?: Model[]; signal?: AbortSignal; providerRejected?: boolean; /** Force a real compaction after crossing the trigger, even for a short but very large turn. */ forceOnTrigger?: boolean; preserveLastUser?: boolean; discardedAttempt?: CompactionDiscardedAttempt; onCompactionStart?: (phase: 'normal' | 'full_history') => void; onCompacted?: () => void; }): Promise<{ status: "unchanged"; messages: AgentMessage[]; result?: undefined; } | { status: "compacted" | "unchanged"; result: CompactionResult; messages: AgentMessage[]; }>; export {};