/**
 * Prompt layer types for system prompt assembly and compaction.
 *
 * Each layer in the system prompt has metadata that determines how it behaves
 * under token budget pressure — whether it can be expired or truncated, and
 * at what priority it should be preserved.
 */
/**
 * Determines how a prompt layer can be compacted when under token budget
 * pressure. Layers are compacted in priority order (lowest priority first).
 *
 * - "preserve":  Never compacted — core identity (profile, contract).
 * - "truncate":  Can compact the middle to fit a maxTokens cap.
 * - "expire":    Can be dropped entirely when under pressure.
 */
export type PromptLayerCompactStrategy = "preserve" | "truncate" | "expire";
/**
 * A single layer in the assembled system prompt.
 *
 * Layers are merged in order to produce the final system prompt string.
 * Each layer carries compact metadata so the engine can make informed
 * decisions when token budgets are tight.
 */
export interface PromptLayer {
    /** Human-readable layer name (e.g. "host-profile", "evidence", "skills"). */
    name: string;
    /** The prompt text for this layer. undefined if expired by compaction. */
    value?: string;
    /** Semantic category (e.g. "profile", "context", "evidence", "repair"). */
    kind: string;
    /**
     * Priority for compaction. 0 = highest priority (never dropped).
     * Higher numbers are dropped/compacted first.
     */
    priority: number;
    /** How this layer can be compacted. */
    compactStrategy: PromptLayerCompactStrategy;
    /** Soft token cap for this layer (used by "truncate" strategy). */
    maxTokens?: number;
    /** Optional semantic compactor for layers where middle clipping loses important recency. */
    compact?: (value: string, maxTokens: number) => string;
    /** Pre-computed or cached token estimate for this layer's value. */
    estimatedTokens?: number;
}
export interface PromptLayerCompactionResult {
    /** The layers after compaction (some may have value set to undefined). */
    layers: PromptLayer[];
    /** Total estimated tokens saved by the compaction. */
    tokensSaved: number;
    /** Total estimated tokens before any compaction was applied. */
    originalEstimatedTokens: number;
    /** Total estimated tokens after compaction completes. */
    finalEstimatedTokens: number;
    /** Budget used for the compaction attempt. */
    budgetTokens: number;
    /** Remaining token overflow after all compaction strategies were exhausted. */
    overBudgetTokens: number;
}
/**
 * Compact system prompt layers to fit within a token budget.
 *
 * Applies compact strategies from lowest priority up:
 * - "expire" layers are dropped first.
 * - "truncate" layers are cut to their maxTokens.
 * - "preserve" layers are never touched.
 *
 * @param layers  The prompt layers to potentially compact.
 * @param budgetTokens  The remaining token budget.
 * @returns The compacted layers and tokens saved.
 */
export declare function compactSystemPromptLayers(layers: PromptLayer[], budgetTokens: number): PromptLayerCompactionResult;
/**
 * Rough token estimate: ~4 characters per token.
 * This matches the existing estimateTextTokens heuristic used elsewhere.
 */
export declare function estimatePromptLayerTokens(value: string | undefined): number;
export declare function compactRecentPromptLayerLines(value: string, maxTokens: number): string;
export declare function compactConversationMemoryLayer(value: string, maxTokens: number): string;
//# sourceMappingURL=prompt-layers.d.ts.map