/**
 * Kernel Context — service implementation.
 *
 * KernelContextService is the single concrete ContextCompiler for PR 1.
 * It owns a TokenSupremacyEngine internally and adapts the engine's
 * ReadingPlan into the CompiledContextPack shape.
 *
 * Scope notes (PR 1):
 * - no redesign of token heuristics, relevance learning, CAS, or budgets
 * - no dynamic per-model budget engine
 * - reservedOutputTokens / systemMarginTokens / toolMarginTokens are
 *   accepted and echoed, but not yet pushed into the optimizer
 * - `_getEngineUnsafe()` exists purely as a compat escape hatch for
 *   legacy call sites (hypertuneMax, cross-session differential, etc.)
 *   that will be migrated in PR 3 when the optimizer is split up
 */
import { TokenSupremacyEngine, type FileRef, type ReadingPlan, type FileReadPlan, type SessionSummary, type ContextDelta, type TokenBudget } from '../../engines/token-supremacy.js';
import type { AssemblyResult, BudgetConfig } from '../../engines/context-assembler.js';
import type { ContextCompiler } from './contracts.js';
import type { CompiledContextPack, CompiledContextRequest } from './types.js';
export interface KernelContextServiceOptions {
    /** Inject a pre-built engine (used by orchestrator to share state). */
    engine?: TokenSupremacyEngine;
    /** Session budget for a freshly-constructed engine. Ignored when `engine` is supplied. */
    sessionBudget?: number;
}
export declare class KernelContextService implements ContextCompiler {
    private readonly engine;
    constructor(options?: KernelContextServiceOptions);
    compileContext(input: CompiledContextRequest): Promise<CompiledContextPack>;
    /**
     * Recover the underlying ReadingPlan from a CompiledContextPack we produced.
     * Legacy formatters (formatReadingPlan) still operate on ReadingPlan; this
     * helper keeps the kernel boundary while letting existing display code work.
     */
    static extractReadingPlan(pack: CompiledContextPack): ReadingPlan | undefined;
    /** Initialize the underlying engine (loads CAS cache, session dirs). */
    init(): Promise<void>;
    /**
     * Hypertune context to maximum quality for a given task + file set.
     * Returns the reading plan, assembled context, and budget config so
     * callers can render both a file list and the assembled context string.
     */
    hypertuneMax(task: string, files: FileRef[], graphConnectivity?: (chunk: {
        source: string;
        label: string;
    }) => number): Promise<{
        plan: ReadingPlan;
        assembly: AssemblyResult;
        budgetConfig: BudgetConfig;
    }>;
    /**
     * Compute which files changed since the last session summary.
     * Returns three sets: added (new), changed (modified), unchanged (cached).
     */
    differential(prev: SessionSummary, curr: FileRef[]): ContextDelta;
    /** Load the most recent persisted session summary, or null if none. */
    loadLatestSessionSummary(): Promise<SessionSummary | null>;
    /**
     * Allocate a token budget across a set of workers. Used by Synapse to
     * assign per-operative token limits from a shared session budget.
     */
    allocateBudget(workers: Array<{
        id: string;
        estimatedValue: number;
        estimatedCost: number;
    }>, totalBudget?: number): TokenBudget;
}
/** Return the process-wide singleton service. Used by CLI + MCP helpers. */
export declare function getKernelContextService(): KernelContextService;
/** Test-only reset. Production code never calls this. */
export declare function __resetKernelContextServiceForTests(): void;
export type { FileReadPlan };
