/** * Triage engine — FR-003, FR-004, US2. * * Deterministic fast-path classifier: obvious-trivial → economical tier, * obvious-complex → frontier tier, otherwise ambiguous for deeper stages. * * Pipeline: sanitize (T026, FR-004) → entropy tail check (SP-154) → * Aho-Corasick keyword scan (T025) → cyclomatic scan (T025b) → verdict. */ export type TriageVerdict = 'trivial' | 'complex' | 'ambiguous'; export interface TriageResult { readonly verdict: TriageVerdict; readonly reason_code: string; readonly trivial_hits: number; readonly complex_hits: number; readonly cyclomatic_score: number; readonly sanitized_length_delta: number; /** Length-normalized Shannon entropy of the analyzed tail window (0–1). */ readonly entropy_score: number; /** Tail entropy minus prefix entropy; large positive values indicate adversarial suffixes. */ readonly entropy_tail_delta: number; /** Characters removed by entropy tail stripping (0 when none). */ readonly entropy_tail_stripped_length: number; } export declare const CYCLOMATIC_THRESHOLD = 15; /** * Strip adversarial complexity-inflation patterns from prompt text (FR-004). * * Removes base64 blocks, long hex runs, HTML/XML markup, URL-encoded sequences, * and excessive character repetition. Preserves newlines and indentation so code * blocks remain extractable by the cyclomatic scanner. */ export declare function sanitize(raw: string): string; export declare const TRIVIAL_KEYWORDS: readonly string[]; export declare const COMPLEX_KEYWORDS: readonly string[]; /** * Estimate cyclomatic complexity of code embedded in the prompt. * Extracts fenced or indented code blocks and counts decision points. * Returns 1 (baseline) when no code is detected. */ export declare function cyclomaticScan(text: string): number; /** * Classify a prompt as trivial, complex, or ambiguous for fast-path routing. * * Deterministic and synchronous — runs in the triage pipeline stage (FR-003). * Sanitizes adversarial content before scoring (FR-004). * Strips high-entropy tail suffixes after sanitization (SP-154, #82). * * False-positive mitigation for entropy stripping: * - Requires both relative tail-vs-prefix delta AND absolute tail entropy threshold * - Skips enforcement on short prompts and tails below MIN_TAIL_TOKENS * - Prefix comparison preserves classification when entire prompt is uniformly high-entropy (e.g. code) */ export declare function triage(promptText: string): TriageResult; //# sourceMappingURL=triage-engine.d.ts.map