/** * Strip self-referential reasoning-fence delimiters that a provider leaks * *inside* a structured thinking part. * * The visible-channel healers ({@link ../utils/leaked-thinking-stream}, * {@link ./fenced-thinking}) split leaked ` ```thinking ` fences out of the * *text* stream. They never run over parts a provider already flags as * thinking, so when a model (observed on Gemini thought summaries — issue * #8719) emits a bare ` ```thinking ` / ` ``````thinking ` opener line between * summaries, that delimiter reaches display and persistence verbatim as fence * spam inside the reasoning block. * * This stripper removes only a *standalone* reasoning-fence opener line — a line * that is nothing but a run of ≥3 backticks immediately followed by the info * string `thinking` or `reasoning`. Such a line is always redundant inside an * already-structured thinking block and never carries content. Inline mentions * (prose on the same line), language-tagged code fences (` ```rs `), and bare * closers (` ``` `) are left untouched so legitimate fenced code inside the * reasoning survives. * * Streaming-safe: deltas may split a line anywhere. A trailing partial line is * held only while it remains a viable opener prefix; the moment it cannot be an * opener it is flushed and the rest of the line passes through character-level. * Correctness never depends on the prefix heuristic — every held line is * classified strictly on its newline (or on {@link ThinkingFenceStripper.flush}) * before it is dropped. */ /** * Stateful, line-oriented stripper for leaked reasoning-fence openers in one * structured thinking block. One instance per thinking block; feed every * thinking delta through {@link push} and drain the tail with {@link flush}. */ export declare class ThinkingFenceStripper { #private; /** Consume one thinking delta; returns the sanitized text to emit (may be empty). */ push(chunk: string): string; /** Drain any held partial line at block end; returns text to emit (may be empty). */ flush(): string; }