/**
 * semantic-coherence — Semantic stall detector for agentic loops.
 *
 * Complements the EMA-based createCoherenceDetector (structural) with a
 * semantic dimension: detects "paraphrasing the same thing" by computing
 * mean pairwise cosine similarity over a rolling window of output embeddings.
 *
 * Reference: IBM Research "Unsupervised Cycle Detection in Agentic Applications"
 * arXiv:2511.10650 — hybrid structural + semantic achieves F1 0.72 vs 0.08
 * structural-only.
 *
 * Design constraints:
 *   - Pure module: no I/O, no side effects.
 *   - Provider-agnostic: the embed function is injected by the host; the SDK
 *     does NOT import any embedder implementation.
 *   - Defensive: throws RangeError on vector dimension mismatch to prevent
 *     silent garbage cosine values.
 */
/**
 * Optional embed function injected by the host. Returns a fixed-dim vector
 * (typically 384 for all-MiniLM-L6-v2). The SDK does NOT import any embedder
 * implementation — preserves provider-agnosticism.
 */
export type EmbedFn = (text: string) => Promise<number[]>;
export interface SemanticCoherenceConfig {
    /** How many recent outputs to compare. Default 5. */
    windowSize?: number;
    /**
     * Mean pairwise cosine above which we flag a semantic stall. Default 0.85.
     * At 0.85 cosine, two sentences share > 85% directional alignment in
     * embedding space, which reliably indicates paraphrase rather than progress.
     */
    similarityThreshold?: number;
}
export interface SemanticCoherenceVerdict {
    isSemanticStall: boolean;
    meanCosine: number;
    /** Actual buffer length at time of verdict (may be < windowSize on early calls). */
    windowSize: number;
}
/**
 * Stateful tracker that maintains a ring buffer of recent output embeddings
 * and exposes `observe()` to detect semantic stalls.
 *
 * Minimum buffer size for stall detection is 3 — a single or two-item buffer
 * is not statistically meaningful for the paraphrase pattern documented in
 * arXiv:2511.10650.
 */
export declare class SemanticCoherenceTracker {
    private readonly _embedFn;
    private readonly _windowSize;
    private readonly _threshold;
    /**
     * Ring buffer storing at most `_windowSize` embedding vectors.
     * New entries push to the end; when full, the oldest (front) is discarded.
     */
    private _buffer;
    /** Dimension of the first embedded vector. Subsequent calls must match. */
    private _expectedDim;
    constructor(embedFn: EmbedFn, config?: SemanticCoherenceConfig);
    /**
     * Embed `output`, push to the ring buffer, and return a verdict.
     *
     * Throws RangeError if the embedding dimension differs from the first
     * observed vector (defensive against embedder hot-swap or misconfiguration).
     */
    observe(output: string): Promise<SemanticCoherenceVerdict>;
    /** Reset the rolling buffer and forget the expected dimension. */
    reset(): void;
}
//# sourceMappingURL=semantic-coherence.d.ts.map