import type { PluginContext } from "../../../plugin/types";
import type { Database } from "../../../shared/sqlite";
import { bumpKeyFilesVersion } from "./project-key-files";
import { type FileReadStat } from "./read-stats";
export declare const KEY_FILES_SYSTEM_PROMPT = "You are a file importance evaluator. Given read statistics about files in a coding session, identify which are core orientation files worth pinning in context. Return a JSON array.";
/**
 * Build the LLM prompt for key file identification.
 * Called from the dreamer runner which handles session creation.
 */
export declare function buildKeyFilesPrompt(candidates: FileReadStat[], tokenBudget: number, minReads: number): string;
/**
 * Parse the LLM's response into a ranked file list.
 */
export declare function parseKeyFilesOutput(text: string): Array<{
    filePath: string;
    tokens: number;
}>;
/**
 * Get candidate files for key-file analysis from OpenCode's DB.
 * Returns files with full reads >= minReads and size under half the budget.
 */
export declare function getKeyFileCandidates(openCodeDb: Database, sessionId: string, minReads: number, tokenBudget: number, projectDirectory?: string): FileReadStat[];
/**
 * Apply LLM-ranked results through the knapsack solver and persist.
 */
export declare function applyKeyFileResults(db: Database, sessionId: string, llmRanked: Array<{
    filePath: string;
    tokens: number;
}>, tokenBudget: number, candidatePaths?: Set<string>): {
    filesIdentified: number;
    totalTokens: number;
};
/**
 * Pure heuristic fallback when LLM is unavailable.
 * Ranks by: high read count, low edit count, reasonable size.
 */
export declare function heuristicKeyFileSelection(db: Database, sessionId: string, candidates: FileReadStat[], tokenBudget: number): {
    filesIdentified: number;
    totalTokens: number;
};
export interface V6KeyFilesConfig {
    enabled: boolean;
    token_budget: number;
    min_reads: number;
}
export interface ValidatedKeyFilesOutput {
    no_change: boolean;
    files: Array<{
        path: string;
        content: string;
        approx_token_estimate: number;
        local_token_estimate: number;
    }>;
}
export declare class KeyFilesValidationError extends Error {
    constructor(message: string);
}
export declare function computeGenerationConfigHash(config: Pick<V6KeyFilesConfig, "token_budget" | "min_reads">): string;
export declare function validateLlmOutput(raw: string, config: V6KeyFilesConfig, projectPath: string, candidatePaths?: ReadonlySet<string>): ValidatedKeyFilesOutput;
export declare function commitKeyFiles(args: {
    db: Database;
    projectPath: string;
    validated: ValidatedKeyFilesOutput;
    configHash: string;
    modelId: string;
    leaseHolderId: string;
    bumpVersion?: typeof bumpKeyFilesVersion;
}): number | null;
export declare function runKeyFilesTask(args: {
    db: Database;
    openCodeDb: Database;
    client: PluginContext["client"];
    projectPath: string;
    config: V6KeyFilesConfig;
    holderId: string;
    deadline: number;
    parentSessionId?: string;
    fallbackModels?: readonly string[];
}): Promise<{
    committedVersion: number | null;
    candidates: number;
    noChange: boolean;
}>;
//# sourceMappingURL=identify-key-files.d.ts.map