/** * Shared types + helpers for the Sentinel rule ports (Phase C bridge). * Split from index.ts so ports.ts and index.ts can both import them without * a circular module graph (index → ports → index would hit TDZ on JS_TS). */ export interface SentinelDetection { /** 1-indexed line of the defect in the scanned code. */ line: number; /** Human-readable evidence detail (what matched, why it is a defect). */ detail: string; } export interface SentinelRulePort { /** Sentinel rule id, e.g. 'SECRETS-004'. */ id: string; /** Sentinel domain, e.g. 'secrets-exposure'. */ domain: string; /** CWE reference, e.g. 'CWE-798'. */ cwe: string; severity: 'critical' | 'high' | 'medium'; /** One-line description of what the port detects. */ title: string; /** * Relevance gate: the port adjudicates a claim only when this matches the * claim's `description + assertion` text. Keeps evidence in-scope — a * hardcoded-secret hit must never fail an unrelated XSS claim (the * patch-verify lesson, commit 21a917a, applied at the formal layer). */ claimPattern: RegExp; /** Languages the detector is meaningful for (lowercase). */ languages: ReadonlySet; /** * Presence-of-defect detector over ONE file's content. Returns every * defect instance found; empty array = clean scan. */ detect: (code: string) => SentinelDetection[]; } export declare const JS_TS: ReadonlySet; /** Split with 1-indexed access helper for line-oriented scans. */ export declare function splitLines(code: string): string[]; /** True when a line is a comment (JS/TS //, /*, *, or #) — comment hits are examples, not defects. */ export declare function isCommentLine(line: string): boolean; /** * Shannon entropy in bits/char — used to separate real secrets from * natural-language string literals. Prose like 'see your dashboard settings * page' sits low; random key material sits high. */ export declare function shannonEntropy(s: string): number; /** * Secret-shaped string heuristic. TIGHTER than Sentinel's original on * purpose: the assay-bridge-dogfood FP bait (`apiKey = 'see your dashboard * settings page'`) is a value Sentinel's SECRETS-004 flags and its LLM lane * has to dismiss. At the formal layer there is no LLM safety net, so the * port itself must not fire on natural-language values. * * A value is secret-shaped when it looks like key material, not prose: * • no interior whitespace (prose has spaces), * • length ≥ 8, * • not a placeholder (env-var-ish, <...>, your-*-here, example/test/dummy), * • entropy or charset diversity consistent with credentials. */ export declare function isSecretShaped(value: string): boolean;