import { agentLoop } from "../sdk/agent-core/index.js";
import { type Model } from "../sdk/ai/index.js";
import type { MemoryReflection, ObservationRecord } from "./types.js";
export declare const REFLECTOR_MAX_PASSES = 2;
export declare const PRUNER_MAX_PASSES = 2;
export declare function observationPoolTokens(observations: ObservationRecord[]): number;
interface LlmArgs {
    model: Model<any>;
    apiKey: string;
    headers?: Record<string, string>;
    signal?: AbortSignal;
    agentLoop?: typeof agentLoop;
    onEvent?: (event: import("../sdk/agent-core/index.js").AgentEvent) => void;
    maxTurns?: number;
}
export type ObservationCoverageTag = "uncited" | "cited" | "reinforced";
export interface CoverageTagCounts {
    uncited: number;
    cited: number;
    reinforced: number;
}
export declare function deriveObservationCoverageTags(reflections: MemoryReflection[], observations: ObservationRecord[]): Map<string, ObservationCoverageTag>;
export declare function coverageTagCounts(reflections: MemoryReflection[], observations: ObservationRecord[]): CoverageTagCounts;
export declare function renderObservationsForPrunerPrompt(observations: ObservationRecord[], coverageTags: ReadonlyMap<string, ObservationCoverageTag>): string;
export declare function migrateLegacyReflections(reflections: MemoryReflection[]): MemoryReflection[];
export declare function normalizeSupportingObservationIds(supportingObservationIds: readonly string[] | undefined, allowedObservationIds: readonly string[]): string[] | undefined;
export interface ReflectorPassContext {
    pass: number;
    maxPasses: number;
    minSupportingObservationIds: number;
}
export type ReflectionProposal = {
    content: string;
    supportingObservationIds?: readonly string[];
};
export interface ApplyReflectionProposalsResult {
    reflections: MemoryReflection[];
    accepted: number;
    added: number;
    merged: number;
    promoted: number;
    duplicates: number;
    unsupported: number;
}
export interface ReflectorPassStats {
    pass: number;
    toolCalls: number;
    accepted: number;
    added: number;
    merged: number;
    promoted: number;
    duplicates: number;
    unsupported: number;
    failed: boolean;
}
export interface ReflectorStats {
    passes: ReflectorPassStats[];
    toolCalls: number;
    accepted: number;
    added: number;
    merged: number;
    promoted: number;
    duplicates: number;
    unsupported: number;
    failedPass?: number;
}
export interface ReflectorResult {
    reflections: MemoryReflection[];
    stats: ReflectorStats;
}
export declare function renderReflectionsForReflectorPrompt(reflections: MemoryReflection[]): string;
export declare function applyReflectionProposals(reflections: MemoryReflection[], proposals: readonly ReflectionProposal[], allowedObservationIds: readonly string[], passContext: Pick<ReflectorPassContext, "minSupportingObservationIds">): ApplyReflectionProposalsResult;
export declare function runReflector(args: LlmArgs, reflections: MemoryReflection[], observations: ObservationRecord[], onPassStart?: (pass: number, maxPasses: number) => void): Promise<ReflectorResult>;
export type PrunerStopReason = "empty" | "under_target" | "fell_back" | "zero_drops" | "max_passes";
export interface PrunerPassStats {
    pass: number;
    poolTokens: number;
    targetTokens: number;
    deltaTokens: number;
    dropped: number;
    remaining: number;
    fellBack: boolean;
}
export interface PrunerResult {
    observations: ObservationRecord[];
    droppedIds: string[];
    fellBack: boolean;
    passes: PrunerPassStats[];
    stopReason: PrunerStopReason;
}
export declare function runPruner(args: LlmArgs, reflections: MemoryReflection[], observations: ObservationRecord[], budgetTokens: number, onPassStart?: (pass: number, maxPasses: number) => void): Promise<PrunerResult>;
/**
 * Format an observation for Markdown-safe display.
 * Wraps the ID in backticks so it renders as inline code in Markdown
 * rather than being misinterpreted as a link reference.
 */
export declare function observationToMarkdown(record: ObservationRecord): string;
/**
 * Format a reflection for Markdown-safe display.
 * Wraps the ID in backticks so it renders as inline code in Markdown.
 */
export declare function reflectionToMarkdown(reflection: MemoryReflection): string;
/**
 * Format observations as a Markdown bullet list for display.
 */
export declare function observationsToMarkdownList(observations: ObservationRecord[]): string;
/**
 * Format reflections as a Markdown bullet list for display.
 */
export declare function reflectionsToMarkdownList(reflections: MemoryReflection[]): string;
export declare function renderSummary(reflections: MemoryReflection[], observations: ObservationRecord[]): string;
export {};
//# sourceMappingURL=compaction.d.ts.map