/** * Fold a confirmed checkpoint's structured `InterpretedIntent` into remediation * block / finding ORDERING (DC-1, remediate half). * * The user's `free_form_intent` is interpreted ONCE, deterministically, by the * single shared interpreter (`interpretFreeFormIntent`) into lens weights, * priority signals, and scope emphases. This module consumes that structured * signal to reorder the plan's findings (and the blocks that carry them) so the * work the user emphasised is dispatched first. * * Hard boundaries (mirroring audit's planning boost): * - ORDERING ONLY. Intent never drops, filters, or mutates a finding — dropping * is the review/clarification gate's job (DC-1 tradeoff note). Every input * finding/block is present in the output; only their order changes. * - INV-S04: the verbatim `free_form_intent` string is never read here. Only the * derived `InterpretedIntent` (lens weights / priority / scope) is consumed, so * the raw directive can never leak into a worker prompt via the ordering path. * - STABLE. Equal-weight findings keep their original relative order, so ordering * is deterministic across runs. * * Pure and synchronous — no IO, no LLM. */ import type { InterpretedIntent } from "audit-tools/shared"; import type { Finding, RemediationBlock } from "../state/types.js"; /** * The intent-derived ordering weight for a single finding: its severity base * plus boosts for an emphasised lens and any priority signal, PLUS/MINUS a * scope-match adjustment. Higher weight sorts earlier. When the intent is * empty (no lens weights, scope, or priority), this collapses to the severity * base, so an absent/empty `free_form_intent` leaves ordering driven purely by * severity. * * Scope-match sign convention (COR-a0648a7d / COR-a0648a7d-2): a finding * matching an EXCLUSION needle (e.g. "ignore vendor/") is DEBOOSTED — checked * first, and takes precedence over an incidental inclusion match — so a scope * the user asked to avoid can never rank ahead of an unmatched finding, let * alone an included one. A finding matching only an INCLUSION needle is * boosted, unchanged from before this fix. */ export declare function findingIntentWeight(finding: Finding, intent: InterpretedIntent, includeNeedles?: string[], excludeNeedles?: string[]): number; export interface IntentOrderingResult { findings: Finding[]; blocks: RemediationBlock[]; } /** * Reorder `findings` and `blocks` by intent-derived weight (descending), stably. * * - Findings sort by `findingIntentWeight` desc, ties broken by original index. * - Blocks sort by the MAX intent weight of their member findings (so a block * carrying an emphasised finding is dispatched first), ties broken by original * index. A block's internal item order is left untouched. * - When the intent carries no signal, both arrays are returned UNCHANGED (no * reordering, no severity-shuffle) so behaviour is a strict no-op without a * `free_form_intent`. * * Never adds, drops, or mutates a finding/block — ordering only. */ export declare function applyIntentOrdering(findings: Finding[], blocks: RemediationBlock[], intent: InterpretedIntent): IntentOrderingResult; //# sourceMappingURL=intentOrdering.d.ts.map