/**
 * Kernel Context — barrel export.
 *
 * This is the ONLY module CLI / MCP / orchestrator should import from
 * when they need context planning. Do not reach into `./service` or
 * into `../../engines/token-supremacy.js` directly from consumer code.
 */
export { KernelContextService, getKernelContextService, __resetKernelContextServiceForTests, } from './service.js';
// Legacy pretty-printer passthrough. Kept here so consumers that display a
// plan don't need to import from the engine module. Backed by the current
// TokenSupremacyEngine formatter; when PR 3 replaces the backend, the
// formatter will move inside the kernel.
import { formatReadingPlan } from '../../engines/token-supremacy.js';
import { KernelContextService } from './service.js';
/**
 * Render a CompiledContextPack for human display.
 *
 * Falls back to a minimal ASCII summary if the pack was produced by a
 * backend that doesn't carry a ReadingPlan in debugMeta.raw (future-proof
 * against PR 3 swapping the backend).
 */
export function formatCompiledContextPack(pack) {
    const legacy = KernelContextService.extractReadingPlan(pack);
    if (legacy)
        return formatReadingPlan(legacy);
    return renderFallback(pack);
}
function renderFallback(pack) {
    const lines = [];
    lines.push(`Compiled Context — backend=${pack.debugMeta.backend}`);
    lines.push(`  input tokens : ${pack.tokenPlan.estimatedInputTokens.toLocaleString()}`);
    if (typeof pack.tokenPlan.savings === 'number') {
        lines.push(`  savings      : ${pack.tokenPlan.savings.toLocaleString()}`);
    }
    lines.push(`  selected     : ${pack.selectedFiles.length}`);
    lines.push(`  omitted      : ${pack.omittedFiles.length}`);
    if (pack.warnings.length > 0) {
        lines.push(`  warnings     : ${pack.warnings.length}`);
        for (const w of pack.warnings)
            lines.push(`    - ${w}`);
    }
    return lines.join('\n');
}
export { formatReadingPlan } from '../../engines/token-supremacy.js';
