/**
 * What subscribers observe, and how the model is reached.
 *
 * A {@link RunEvent} is the outward-facing notification the loop publishes (via
 * a `publish` effect) so hosts can render progress: each new snapshot, each
 * incremental text/thinking delta, the lifecycle of every tool, and the
 * terminal settle/fault. A {@link ModelInvoker} is the single injectable seam
 * through which the loop reaches a model — defaulted to the gateway later, but
 * swappable so tests can script a deterministic channel.
 */
import type { Channel, Conversation, StreamOptions } from "../../llmgateway/contract";
import type { RunSnapshot } from "./run-state";
import type { RunError } from "./errors";
import type { ToolOutcome } from "./tools";
/** A fresh immutable snapshot was produced. */
export interface SnapshotEvent {
    readonly kind: "snapshot";
    readonly snapshot: RunSnapshot;
}
/** An incremental fragment of assistant prose arrived from the model. */
export interface TextDeltaEvent {
    readonly kind: "text_delta";
    readonly delta: string;
}
/** An incremental fragment of model reasoning arrived. */
export interface ThinkingDeltaEvent {
    readonly kind: "thinking_delta";
    readonly delta: string;
}
/** A tool the model requested began executing. */
export interface ToolStartedEvent {
    readonly kind: "tool_started";
    readonly id: string;
    readonly name: string;
}
/** A tool finished, successfully or not. */
export interface ToolFinishedEvent {
    readonly kind: "tool_finished";
    readonly id: string;
    readonly name: string;
    readonly outcome: ToolOutcome;
}
/** The run reached a clean terminal state. */
export interface SettledEvent {
    readonly kind: "settled";
    readonly snapshot: RunSnapshot;
}
/** The run reached a faulted terminal state. */
export interface FaultedEvent {
    readonly kind: "faulted";
    readonly error: RunError;
    readonly snapshot: RunSnapshot;
}
/** The tagged union of every notification a subscriber can receive. */
export type RunEvent = SnapshotEvent | TextDeltaEvent | ThinkingDeltaEvent | ToolStartedEvent | ToolFinishedEvent | SettledEvent | FaultedEvent;
/**
 * The injectable model entrypoint.
 *
 * Given a provider-neutral conversation and per-call options, it returns a
 * {@link Channel} of streaming emissions. The production wiring delegates to the
 * gateway's `stream`; tests supply a function that yields a scripted channel.
 */
export type ModelInvoker = (conversation: Conversation, options: StreamOptions) => Channel;
