import { type GthTerminationReason } from '#src/core/terminationReason.js'; /** The middleware's name, which `createAgent` also gives to the error it wraps a throw in. */ export declare const CUT_STREAM_RETRY_MIDDLEWARE_NAME = "GthCutStreamRetry"; /** The debug-log line written when a cut reply is retried. Stable, so a log can be counted. */ export declare const CUT_STREAM_RETRY_LOG = "EXT-204 cut stream: retrying the model call once"; /** The debug-log line written when the retried reply was cut as well. */ export declare const CUT_STREAM_EXHAUSTED_LOG = "EXT-204 cut stream: the retry was cut too, ending the turn"; /** The debug-log line written when the retry came back whole. */ export declare const CUT_STREAM_RECOVERED_LOG = "EXT-204 cut stream: recovered on the retry"; /** * Was this model reply cut off before it finished? True only for an `AIMessage` with no answer text, * no tool call (valid or invalid) and no stop/finish reason under any key the EXT-159 reader knows. * * Thought parts do not count as answer text ({@link answerTextOf} excludes them), which is exactly the * measured shape. Anything that is not an `AIMessage` — a `Command` from a structured-output retry — * is not a reply this module has an opinion about. */ export declare function isCutModelReply(message: unknown): boolean; /** * The model's reply was cut off twice in a row: the turn ends here with the `stream_cut` reason * attached, rather than as an empty answer. */ export declare class ModelStreamCutError extends Error { readonly reason: GthTerminationReason; constructor(reason: GthTerminationReason); } /** * Build the retry middleware. See the module comment for the argument. * * @param onCut Records the `stream_cut` reason on the agent when the retry is cut as well. Called * before the throw, so the agent's first-write-wins record holds it whatever a later site notes. */ export declare function createCutStreamRetryMiddleware(onCut?: (reason: GthTerminationReason) => void): import("langchain").AgentMiddleware;