pub enum RunEnd {
Success {
result: Option<Value>,
},
Interrupted {
interrupts: Vec<Interrupt>,
},
Failed {
message: String,
code: Option<String>,
},
}Expand description
How a run ended.
Exhaustive, unlike Update and unlike every error in this workspace: a
run ends in one of three ways because the protocol says so — RUN_FINISHED
with a success outcome, RUN_FINISHED with an interrupt outcome, or
RUN_ERROR (which the truncated-stream case is reported as). A fourth would
be a wire-contract change, and docs/DESIGN.md explains why those are meant
to be compile errors for consumers rather than something a _ arm swallows.
This is the match a front-end most wants the compiler’s help with — it
decides whether the input goes live again.
Variants§
Success
The agent finished.
Meaning “the agent said the run succeeded”, not “nothing went wrong”.
The two come apart: a protocol violation the verifier caught, or a state
patch that would not apply, arrives as an Update::Error and the run
carries on to end here — those are the client’s diagnostics, and the
agent is neither told nor asked. A view that routes on
Update::Done alone will call such a run clean; track the errors as
they arrive if the difference matters to you.
Interrupted
The agent paused for human input. The same interrupts arrived
individually as Update::Interrupt, and are on
Session::interrupts until the next run.
Failed
The run failed, or the transport stopped before it could finish. The
matching Update::Error came first.