/** * v1.3.6 §3.2 — originality gate (anti-reskin). * * Ported from agency-agents `check-agent-originality.sh`: detect when a new * asset's prose is largely a copy of an existing one (a "re-skin" — same role * rewritten under a new name). We do this statically, without behavioural eval: * neutralize entity names, slice text into N-word shingles, and measure how * much of each asset's shingle set also appears in *another* asset. * * overlap(A) = max over B≠A of |shingles(A) ∩ shingles(B)| / |shingles(A)| * * FAIL ≥ 0.40 (likely re-skin / role overlap), WARN ≥ 0.20. Used for both * skills and agents (260618 Part D/G2). Pure — no fs, no domain types. */ export interface OriginalityItem { /** Asset id, e.g. "skill-manager" or "product/product-manager". */ id: string; /** Prose to compare — typically description + SKILL.md body. */ text: string; } export interface OriginalityFinding { /** The asset whose text is largely duplicated. */ id: string; /** The other asset it most overlaps with. */ against: string; /** Fraction of `id`'s shingles also present in `against` (0..1). */ overlap: number; level: "fail" | "warn"; } export interface OriginalityOptions { /** Shingle window in words. Default 8 (agency-agents). */ shingleSize?: number; /** ≥ this fraction → fail. Default 0.40. */ failThreshold?: number; /** ≥ this fraction → warn. Default 0.20. */ warnThreshold?: number; } /** * Neutralize entity-specific tokens so a pure re-skin (identical text except * the asset name) reads as near-total overlap. Lowercases, drops the asset's * own name segments, strips markdown/punctuation, collapses whitespace. */ export declare function neutralize(text: string, id: string): string; /** Word shingles (sliding window of `size`) for a neutralized string. */ export declare function shingles(neutralized: string, size: number): Set; /** * Run the originality gate across a corpus. Returns one finding per asset that * crosses the warn threshold (its single worst overlap), highest overlap first. */ export declare function checkOriginality(items: OriginalityItem[], opts?: OriginalityOptions): OriginalityFinding[];