/**
 * D3 — insight-guardrail: the honesty enforcer (PRD-0006 v0.1.5 S12).
 *
 * A local agent reads the user's 9 published works and emits candidate
 * "最新洞察" lines. AutoViral has on disk ONLY five per-post metrics:
 *   play / digg / comment / share / collect.
 * It NEVER measures retention / 完播率 / 钩子留存 / hook-timing / watch-time.
 *
 * This module is the regression gate that turns "honesty" from a human review
 * step into a TESTED contract: any candidate insight that references a metric
 * outside the on-disk set is fabrication and is REJECTED before it can ever
 * reach the UI. Two layers of defence:
 *   1. the candidate's DECLARED `metrics[]` must all be available, and
 *   2. the candidate's BODY prose must not mention any never-measured metric
 *      (an agent that declares only `play` but writes "完播率…" in prose is
 *      still lying — we catch that too).
 *
 * Everything here is a PURE function over its inputs — no fs, no network — so
 * the honesty contract is unit-testable in isolation (ADR-009 "pure core +
 * thin shell"). The server route (`routes/analytics.ts`) runs the agent and
 * merely calls into this module to parse + filter.
 */
/** The metrics actually present on disk (the frozen Douyin scrape). */
export declare const AVAILABLE_METRICS: ReadonlySet<string>;
/**
 * Keywords that name a metric AutoViral has NEVER measured. If any appears in
 * an insight's prose (or in its declared metrics, normalised), the insight is
 * a fabrication and is rejected. Covers ZH + EN surface forms the agent might
 * reach for. Matched case-insensitively as substrings.
 */
export declare const FORBIDDEN_METRIC_KEYWORDS: readonly string[];
/** A candidate insight emitted by the agent, before the guardrail runs. */
export interface InsightCandidate {
    /** The human-readable insight line. */
    body: string;
    /** A short label/tag (e.g. "互动" / "方向"). */
    tag: string;
    /**
     * The metrics the insight claims to cite. Optional — when omitted the
     * guardrail falls back to scanning the body prose only (still strict).
     */
    metrics?: string[];
}
/** An insight that passed the guardrail, shaped for the UI (InsightsList). */
export interface PassedInsight {
    body: string;
    tag: string;
    /** ISO date (collection date or render date) for the row's timestamp. */
    date: string;
}
/**
 * Scan free text for any never-measured metric keyword. Returns the matched
 * keywords (empty array → clean). Case-insensitive substring match — deliberate
 * over-reach is acceptable here: a false positive only drops one fabricated-
 * looking line, whereas a false negative would let a lie reach the user.
 */
export declare function detectForbiddenMetrics(text: string): string[];
/**
 * THE honesty gate. Keep a candidate insight only when:
 *   - it has a non-empty body, AND
 *   - every metric it DECLARES is in `available` (and none is a forbidden
 *     alias), AND
 *   - its body prose mentions no never-measured metric.
 *
 * Any candidate that references a metric not on disk — especially retention /
 * 完播 / hook-timing — is rejected. This is the core regression gate for
 * honesty (PRD-0006: "把诚实从人肉 review 升级为测试门控").
 */
export declare function filterInsights(candidates: InsightCandidate[], available?: ReadonlySet<string>): InsightCandidate[];
/**
 * Parse the local agent's raw output into guardrail-passed candidates. Robust
 * to markdown fences / chatter; returns [] (never throws) on garbage so the UI
 * never renders junk. The surviving insights have ALL passed D3.
 */
export declare function parseAgentInsights(raw: string, available?: ReadonlySet<string>): InsightCandidate[];
export interface InsightWorkInput {
    desc: string;
    playCount: number;
    diggCount: number;
    commentCount: number;
    shareCount: number;
    collectCount: number;
}
/**
 * Build the prompt for the local insight agent. It grounds the agent on the
 * user's REAL per-work metrics and explicitly forbids inventing any metric
 * AutoViral never measured (完播 / 留存 / retention / hook-timing). The agent
 * is asked to return a JSON array of {body, tag, metrics} — D3 then filters it.
 */
export declare function buildInsightPrompt(works: InsightWorkInput[]): string;
//# sourceMappingURL=insight-guardrail.d.ts.map