/** * Central live healing for leaked reasoning markup in the visible text channel. * * Some providers emit their canonical reasoning idioms (` ```thinking `, * ``, Gemma/Harmony channels, …) into the *visible* text stream instead * of a structured thinking part. {@link wrapLeakedThinkingStream} re-projects a * provider stream into a fresh {@link AssistantMessageEventStream}, splitting the * leaked fences out into proper `thinking` blocks *live* as deltas arrive. * * Applied to every provider stream *except* official first-party endpoints * (the official Anthropic API and the official OpenAI / OpenAI-Codex endpoints), * which return structured thinking and never leak — `healLeakedThinking` in * `../stream.ts` gates the wrap so the healer cannot misfire on legitimate * fenced content those models emit as visible text. * * The healing is idempotent: a second pass over already-clean text finds no * fences, so wrapping a provider that already heals (or wrapping twice) is a * harmless pass-through. Signatures are load-bearing for Google/Gemini/Vertex * thought round-tripping, so text sub-blocks carry the source `textSignature`, * forwarded thinking blocks their `thinkingSignature`, and forwarded tool calls * their `thoughtSignature`. * * Modeled on {@link wrapInbandToolStream} / `InbandStreamProjector` in * `../dialect/owned-stream.ts`, minus all in-band tool-call grammar: tool-call * events are forwarded verbatim. */ import { AssistantMessageEventStream } from "./event-stream.js"; /** * Wrap a provider stream so leaked reasoning fences are healed into thinking * blocks live, for every provider. Returns a new stream that re-projects the * inner one; the inner stream is fully consumed. */ export declare function wrapLeakedThinkingStream(inner: AssistantMessageEventStream): AssistantMessageEventStream;