import type { EngineNotice } from "../engine-notice.js";
import { type ToolTurnRepair } from "../../internal/llm.js";
/** The notice's attribution ids — the same pair, for the same reason, as the fold seat's. */
export interface ToolTurnRepairSeatIds {
    sessionId: string;
    runId: string;
}
/** What the message says became of a turn that dropped calls: the run ended on it (`model_output_invalid`), or the next
 *  request asks the model to re-issue them. */
export type ToolTurnOutcome = "terminal" | "reissued";
/** The facts of the turn a dropped-call line is about — `detail` members of the same names, each only as its source states
 *  it: the provider's ending word (the one the turn's drop notes quote, in the provider echo shape), the request's whole
 *  input and the output as the provider reported them (absent when the turn's usage is not known), and the declared
 *  context window and output cap of the model card the request named. Facts only: no member says why the calls were cut. */
export interface DroppedCallTurnFacts {
    finishReason?: string;
    inputTokens?: number;
    outputTokens?: number;
    contextWindow?: number;
    maxTokens?: number;
}
/** One thing the person is told, per cause. A dropped-call cause carries the outcome when its message states one (else
 *  `undefined`: nothing is said about the run's fate), the turn's facts and, where the run counts them, the re-asks the
 *  loop's malformed-tool-use retry made before this turn (`reasksSoFar` — the budget a lost call's failure waits on; other
 *  recovery lanes' continues are not among them: `terminal` with 0 is a turn that failed at first strike, with more a run
 *  whose re-asks ran out); the others have none of these. */
export type ToolTurnIncompleteItem = {
    cause: "truncated";
    count: number;
    outcome: ToolTurnOutcome | undefined;
    facts?: DroppedCallTurnFacts;
    reasksSoFar?: number;
} | {
    cause: "unnamed";
    count: number;
    outcome: ToolTurnOutcome | undefined;
    facts?: DroppedCallTurnFacts;
    reasksSoFar?: number;
} | {
    cause: "bad_frame";
    count: number;
} | {
    cause: "missing_result_synthesized";
    count: number;
    toolCallIds: readonly string[];
};
/** Does a turn's content carry a tool call? The dropped-call line's reading of "the turn goes on", taken at the message's
 *  end before its batch runs. The turn boundary does not read it: whether the turn owes the next request is the loop's
 *  own decision (a batch can end the run), handed to the boundary as `continues`. */
export declare function turnCarriesToolCall(content: unknown): boolean;
/** The person's line for one cause — once per run per code per cause, whichever observer saw it first. */
export interface ToolTurnIncompleteSeat {
    /** Announce `item` unless this run already said it under its code for its cause. */
    announce(item: ToolTurnIncompleteItem): void;
    /** Observe one assistant message: announces each stream drop it reports (`streamDropsOf`), worded by what became of the turn. */
    observe(message: {
        readonly diagnostics?: unknown;
    }): void;
}
/** `reasksSoFar`: the run's count of its malformed-tool-use retry's re-asks (`Prepared.loopReasksRef`), read
 *  as each message is observed; absent where no loop counts them for this seat (the line then carries no such member). */
export declare function createToolTurnIncompleteSeat(onNotice: ((notice: EngineNotice) => void) | undefined, ids: ToolTurnRepairSeatIds, reasksSoFar?: () => number): ToolTurnIncompleteSeat;
export declare function createToolTurnRepairSeat(onNotice: ((notice: EngineNotice) => void) | undefined, ids: ToolTurnRepairSeatIds): (repairs: readonly ToolTurnRepair[]) => void;
