/**
 * Analyse post-emit verify — types.
 *
 * The analyse-side analog of `realize/post-emit-verify/types.ts`. Where realize
 * verifies emitted FILES (tsc, stub-completeness), analyse verifies the emitted
 * per-action BODIES in memory (steps / requires / ensures / publishes) for
 * QUALITY defects the schema validator can't see — transcribed code as steps
 * (`ANL-STEP-CODE`) and non-domain events as publishes (`ANL-EVENT-NONDOMAIN`).
 *
 * Each verifier flags `VerifyFinding`s localised to one action stub (`stubPath`
 * = the skeleton-provenance yamlPath). The feedback runner groups findings by
 * stub and surgically re-fires just that action body with the per-finding
 * `correction` injected into the `analyse-action` prompt's `{{correction}}`
 * slot. Residuals are recorded in an `analyse-quality.json` sidecar — never
 * dropped (an action body is content; a bad paraphrase beats losing a step).
 *
 * See `specverse-self/docs/proposals/in-progress/2026-05-28-ANALYSE-POST-EMIT-VERIFY.md`.
 */
import type { ActionBody } from '../microcall-orchestrator.js';
import type { SkeletonProvenance } from '../skeleton-emitter.js';
/** A single quality violation localised to one action body. Mirror of
 *  realize's `VerifyError`, but keyed by spec stub-path rather than file. */
export interface VerifyFinding {
    /** Rule code, e.g. `ANL-STEP-CODE`, `ANL-EVENT-NONDOMAIN`. */
    code: string;
    severity: 'error' | 'warning';
    /** The skeleton-provenance `yamlPath` of the offending action stub. */
    stubPath: string;
    /** Human-readable description for the sidecar + logs. */
    message: string;
    /** Targeted instruction injected into the re-fire prompt's `{{correction}}`
     *  slot. One sentence the LLM can act on for THIS body. */
    correction: string;
}
/** What the LLM/scope a re-fire needs. v1 both rules use 'action' (the input-
 *  format fix already feeds raw method source per-action). 'owner' / 'spec'
 *  are reserved for later phases (see proposal "Context scope"). */
export type ContextScope = 'action' | 'owner' | 'spec';
/** Context handed to every verifier — the assembled spec plus the in-memory
 *  per-action bodies plus the skeleton provenance (maps a stubPath to its
 *  owner / source location). */
export interface AnalyseVerifyContext {
    /** Filled action bodies keyed by stub `yamlPath` (the orchestrator's output). */
    actionBodies: Map<string, ActionBody>;
    /** Skeleton provenance — stubPath → { ownerName, ownerKind, sourceLocation }. */
    skeletonProvenance: SkeletonProvenance;
    /** The assembled `.specly` text (for future spec-scope rules). */
    spec: string;
}
/** A quality verifier. Mirror of realize's `PostEmitVerifier`, but `verify` is
 *  SYNCHRONOUS — analyse detectors are pure string checks, no subprocess. */
export interface AnalyseVerifier {
    /** Stable kebab-case id, e.g. 'anl-step-code'. */
    id: string;
    /** Human-readable name for logs. */
    name: string;
    /** Whether this verifier runs unless explicitly disabled. v1 ships all
     *  verifiers `false` (opt-in via SPECVERSE_ANALYSE_VERIFY_ENABLE) while the
     *  framework is proven on the corpus; flip to true in a follow-up. */
    enabledByDefault?: boolean;
    /** Re-fire scope this verifier's findings need (v1: always 'action'). */
    contextScope: ContextScope;
    /** Predicate: does this verifier apply to the given context? */
    applies: (ctx: AnalyseVerifyContext) => boolean;
    /** Run the verifier. MUST NOT throw — return [] on nothing-to-flag. */
    verify: (ctx: AnalyseVerifyContext) => VerifyFinding[];
}
/** Per-owner aggregation in the sidecar. */
export interface OwnerQualityEntry {
    ownerName: string;
    findings: Array<{
        code: string;
        stubPath: string;
        actionName: string;
        severity: 'error' | 'warning';
        message: string;
        /** True if still present after the re-fire pass. */
        residual: boolean;
    }>;
}
/** `analyse-quality.json` — mirror of realize's `RealizeQualitySidecar`. */
export interface AnalyseQualitySidecar {
    schemaVersion: '1.0';
    ranAt: string;
    totals: {
        /** Findings detected before the re-fire pass. */
        findings: number;
        findingsByCode: Record<string, number>;
        ownersWithFindings: number;
        /** Findings still present after the re-fire pass. */
        residual: number;
        /** Action stubs re-fired. */
        refired: number;
    };
    byOwner: Record<string, OwnerQualityEntry>;
    notes: string[];
}
//# sourceMappingURL=types.d.ts.map