/** * Context Shadow Compiler — A-CTX-0 * * Deterministic shadow manifest emitter. Observes the compiled prompt and * records what a context-aware selector would have chosen, without altering * the actual provider input in any way. * * Invariants: * - nowMs is always a captured input; Date.now() is never called internally * - No source text appears in any output type * - Required segments are always preferred first * - required-over-budget is recorded, never thrown * - Manifest hash covers metadata only (no content) */ import type { ContextC5EnvelopeV1, ContextEvidence, ContextShadowManifestV1 } from "../contracts/index.js"; export interface ContextShadowSegment { segmentId: string; kind: string; required: boolean; text: string; } export interface CompileContextShadowInput { runId: string; taskId?: string; adapter: string; model?: string; /** Milliseconds since epoch — must be explicit. Never call Date.now() here. */ nowMs: number; shadowBudgetTokens: number; modelWindowTokens?: number; modelWindowEvidence?: ContextEvidence; segments: readonly ContextShadowSegment[]; } export interface CompileContextShadowResult { manifest: ContextShadowManifestV1; receipt: ContextC5EnvelopeV1; } export declare function estimateContextTokens(text: string): number; export declare function compileContextShadow(input: CompileContextShadowInput): CompileContextShadowResult;