/**
 * The inputs that advance the run state machine.
 *
 * A {@link Signal} is the only thing that can move a run forward. The pure
 * reducer takes the current snapshot plus one signal and returns the next
 * snapshot together with the side-effects to perform. Every external happening —
 * a caller's prompt, a streamed emission, a tool result, a completed
 * compaction, an abort — enters the machine as exactly one of these.
 */
import type { Turn } from "../../llmgateway/contract";
import type { Emission } from "../../llmgateway/contract";
import type { ToolOutcome } from "./tools";
import type { RunError } from "./errors";
/** The caller submits new input turns to start or extend the run. */
export interface SubmitSignal {
    readonly kind: "submit";
    readonly input: Turn[];
}
/** One streaming emission from the in-flight model invocation arrived. */
export interface EmissionSignal {
    readonly kind: "emission";
    readonly emission: Emission;
}
/** The model's stream finished folding; the assistant turn is complete. */
export interface StreamEndSignal {
    readonly kind: "stream_end";
}
/** A dispatched tool finished and reported its result. */
export interface ToolSettledSignal {
    readonly kind: "tool_settled";
    readonly id: string;
    readonly result: ToolOutcome;
}
/** A compaction pass finished and produced a summary turn to splice in. */
export interface CompactedSignal {
    readonly kind: "compacted";
    readonly summary: Turn;
}
/** The caller requested cancellation of the run. */
export interface AbortSignalInput {
    readonly kind: "abort";
}
/** An unrecoverable failure occurred and should terminate the run. */
export interface FaultSignal {
    readonly kind: "fault";
    readonly error: RunError;
}
/** The tagged union of every input that drives the run state machine. */
export type Signal = SubmitSignal | EmissionSignal | StreamEndSignal | ToolSettledSignal | CompactedSignal | AbortSignalInput | FaultSignal;
