/**
 * UsherActedCorrelator — the precision-numerator wiring for the Usher (rung 4 of
 * continuous-working-awareness).
 *
 * The Usher FIRES re-surface signals (UsherSignalStore.recordSignal). Until this
 * module, nothing ever called markActed — so `precision = acted/fired` was pinned
 * at 0 and the rung-5 (mid-task injection) gate could never be satisfied by data.
 * This closes that loop via TWO correlation paths, both reducing to "does some
 * probe text COVER a fired signal's contextText?":
 *
 *   (a) auto-use   — the agent's next reply on the topic uses the re-surfaced
 *                    context. creditUsherOnOutbound(). The nudge was useful: the
 *                    agent acted on it.
 *   (b) miss-map   — the user later had to CORRECT the agent (a HumanAsDetector
 *                    signal) on that same context. creditUsherOnMiss(). The nudge
 *                    was a genuine catch the agent ignored — still a true positive
 *                    for the Usher's precision.
 *
 * Matching is deliberately PRECISION-OVER-RECALL: precision gates whether the
 * Usher earns the right to interrupt (rung 5), so a falsely-HIGH precision is the
 * dangerous direction. We require a meaningful salient-term overlap (≥ MIN_SHARED
 * shared content words AND ≥ MIN_COVERAGE of the context's terms) and only credit
 * recently-fired signals. Under-crediting a fast reply is acceptable; inflating
 * the gate is not.
 *
 * All exported integration fns are best-effort and NEVER throw into the
 * message/delivery path — mirroring the Usher's own degrade-safety invariants.
 */
import type { UsherSignal, UsherSignalStore } from './UsherSignalStore.js';
/** Minimal inbound-entry shape the miss path reads (matches InboundMessageEntry). */
export interface MissEntry {
    topicId?: number | null;
    text?: string;
}
export declare const MIN_SHARED = 2;
export declare const MIN_COVERAGE = 0.5;
/** Window in which the agent's reply still counts as "using" a just-fired nudge. */
export declare const USE_WINDOW_MS: number;
/** Window in which a later user correction still credits a prior nudge. */
export declare const MISS_WINDOW_MS: number;
/**
 * Salient content tokens of a text: lowercased, alphanumeric-split, ≥3 chars,
 * stopwords removed. Pure + deterministic.
 */
export declare function salientTerms(text: string): Set<string>;
/**
 * Does `probeText` cover enough of `contextText`'s salient terms to count as a
 * genuine reference to it? Requires ≥ minShared shared terms AND ≥ minCoverage
 * fraction of the context's terms (so single-coincidental-word matches fail, and
 * a long context needs proportionally more overlap).
 */
export declare function contextCoveredBy(contextText: string, probeText: string, opts?: {
    minShared?: number;
    minCoverage?: number;
}): boolean;
/**
 * Pure: among NOT-yet-acted signals, which ones does `probeText` cover? Returns
 * their ids. `maxAgeMs`+`nowMs` optionally drop signals older than the window.
 */
export declare function findCoveredSignalIds(signals: UsherSignal[], probeText: string, opts?: {
    minShared?: number;
    minCoverage?: number;
    maxAgeMs?: number;
    nowMs?: number;
}): string[];
/**
 * Core integration: correlate `probeText` against a topic's fired signals and
 * mark the matches acted (stamped with `via`). Best-effort, never throws.
 * Returns the ids actually marked.
 */
export declare function markActedByCoverage(store: UsherSignalStore, topicId: number, probeText: string, via: 'use' | 'miss', opts?: {
    now?: () => number;
    maxAgeMs?: number;
    minShared?: number;
    minCoverage?: number;
    onMarked?: (id: string) => void;
}): string[];
/**
 * Path (a): the agent's reply just went out on `topicId`. Credit any recent
 * faded-context nudge the reply actually used. Wire on the outbound-reply path.
 */
export declare function creditUsherOnOutbound(store: UsherSignalStore | null | undefined, topicId: number, replyText: string, opts?: {
    now?: () => number;
    maxAgeMs?: number;
}): string[];
/**
 * Path (b): the user just had to correct the agent (`missSignal` non-null). If a
 * recent nudge on this topic covers what they're correcting, that nudge was a
 * real catch the agent ignored → credit it. Wire on the inbound human-detector
 * seam. No-op when there was no miss, no topic, or no text.
 */
export declare function creditUsherOnMiss(store: UsherSignalStore | null | undefined, missSignal: unknown, entry: MissEntry, opts?: {
    now?: () => number;
    maxAgeMs?: number;
}): string[];
//# sourceMappingURL=UsherActedCorrelator.d.ts.map