/**
 * LLM rewrite of a transcript: spelling, punctuation, dictionary terms and
 * transliteration, for English, any Indian language, or a mix of the two.
 *
 * The rewrite is a convenience, never a risk to the words:
 * - on timeout (default 12 s) or error the input text is kept;
 * - a rewrite that drops more than `maxDropRatio` (default 0.25) of the words
 *   is discarded — a model that summarises or truncates must not cost words;
 * - the model's answer is the last non-empty line(s), because some models
 *   echo a preamble ("Here is the corrected sentence:") before it;
 * - `maxTokens` is always an integer: a float (`60 + 1.5 × chars` unrounded)
 *   was once rejected with an HTTP 400.
 *
 * The prompt's hardest rule is "never translate": asked to "correct" a
 * Hindi-English sentence, models readily return an English translation, which
 * reads well and loses what was said.
 *
 * @module voice/correction/rewrite
 */
import type { STTCorrectionDeps, STTCorrectionOptions, STTDictionaryEntry, STTRewriteLinesOutcome, STTRewriteOutcome } from "../../types/index.js";
/** Default per-call rewrite timeout; on expiry the input text is kept. */
export declare const DEFAULT_REWRITE_TIMEOUT_MS = 12000;
/** Default per-batch timeout for `rewriteLines`: a batch carries up to 25 lines. */
export declare const DEFAULT_REWRITE_LINES_TIMEOUT_MS = 60000;
/** Default share of words a rewrite may drop before it is discarded. */
export declare const DEFAULT_MAX_DROP_RATIO = 0.25;
/** Lines per request in `rewriteLines`. */
export declare const REWRITE_LINES_BATCH = 25;
/**
 * Output budget: ~1.5 tokens per input character plus a fixed allowance,
 * capped. Generous on purpose — transliterated Indic text takes more tokens
 * than its source script — and rounded, because a float is a 400 on at least
 * one OpenAI-compatible server.
 */
export declare function rewriteMaxTokens(inputChars: number): number;
/** Words for the drop guard: whitespace tokens that hold a letter or a digit. */
export declare function countWords(text: string): number;
/**
 * System prompt for the rewrite. `lines: true` is the batched variant for long
 * transcripts: numbered lines in, the same numbered lines out.
 */
export declare function buildRewriteSystemPrompt(options?: {
    transliterate?: "latin" | "native";
    punctuate?: boolean;
    dictionary?: readonly STTDictionaryEntry[];
    lines?: boolean;
}): string;
/**
 * User message for the rewrite. With a second opinion the two transcripts are
 * labelled; `literal` lists aliases the guard decided were meant literally, so
 * the rewrite does not turn them back into dictionary terms.
 */
export declare function buildRewriteUserPrompt(primary: string, secondOpinion?: string, extras?: {
    labels?: {
        primary?: string;
        secondary?: string;
    };
    literal?: readonly string[];
}): string;
/**
 * The model's answer: the last `lineCount` non-empty lines, since a preamble,
 * if any, comes first. An echoed "Transcript:" label is stripped.
 */
export declare function extractRewrite(content: string, lineCount?: number): string;
/**
 * Rewrite one transcript (a sentence, an utterance, or a short multi-line
 * text). `primary` is the leading text — already dictionary-applied — and the
 * one the drop guard measures against. Never throws.
 */
export declare function rewriteTranscript(input: {
    primary: string;
    secondOpinion?: string;
    dictionary?: readonly STTDictionaryEntry[];
    options?: STTCorrectionOptions;
    labels?: {
        primary?: string;
        secondary?: string;
    };
    literal?: readonly string[];
    onPartial?: (text: string) => void;
}, rewrite: STTCorrectionDeps["rewrite"]): Promise<STTRewriteOutcome>;
/**
 * Batched rewrite for long transcripts (file transcription, diarized turns):
 * 25 numbered lines per request, the same numbers back. A failed or timed-out
 * batch keeps its lines; a line missing from the output, empty, or shorter by
 * more than `maxDropRatio` of its words keeps its input. Blank input lines
 * are never sent and come back as they were. Never throws.
 */
export declare function rewriteLines(lines: readonly string[], rewrite: STTCorrectionDeps["rewrite"], options?: {
    dictionary?: readonly STTDictionaryEntry[];
    correction?: STTCorrectionOptions;
}): Promise<STTRewriteLinesOutcome>;
