pub struct RunHooks<'a> {
pub now: &'a mut dyn FnMut() -> Result<TimeMs, AxError>,
pub interrupt: &'a mut dyn FnMut(SafePoint) -> Interrupt,
pub checkpoint: Option<&'a mut dyn FnMut(TimeMs) -> Result<Payload, AxError>>,
pub writes: &'a dyn Fn(&ToolCall) -> Writes,
pub invoke: &'a mut dyn ConcurrentInvoke,
pub wait: &'a mut dyn FnMut(TimeMs) -> NextCall,
pub deltas: Option<&'a mut (dyn FnMut(&Increment) + 'a)>,
}Expand description
The things the driver cannot decide for itself. Closures rather than traits: no second implementation exists yet, and this library introduces a trait at a seam that already has one.
Fields§
§now: &'a mut dyn FnMut() -> Result<TimeMs, AxError>The clock, called by the driver on its own thread and nowhere else: once per dispatch line, once per turn, once when each model attempt is sent and once when its reply is whole, once when each tool call starts and once when it answers, and once per freeze that is not a cancellation.
interrupt: &'a mut dyn FnMut(SafePoint) -> InterruptAnswers what arrived at a safe point.
checkpoint: Option<&'a mut dyn FnMut(TimeMs) -> Result<Payload, AxError>>The pre-wave checkpoint. None runs without a net, which
the tool layer refuses for anything that can delete.
writes: &'a dyn Fn(&ToolCall) -> WritesWhat a call may write, by its declared effect, asked before the
wave runs: a wave whose every call answers Nothing changes no
file, so it needs no checkpoint of its own (§8-45).
invoke: &'a mut dyn ConcurrentInvokeRuns a wave’s tool calls in three stages (see
crate::ConcurrentInvoke). admit receives the turn’s stamp; a
call’s own moments are read by the turn from now, never by the
tool face, which holds no clock of its own.
wait: &'a mut dyn FnMut(TimeMs) -> NextCallHolds the run until the moment the watchdog set for the next call to a provider that failed, and answers whether that call may go.
Halted comes back as soon as a halt reaches the run, without
waiting the rest out: a backoff grows to a minute, and a brake
that engages a minute late is not one. A counted clock answers
Allowed at once, because nothing it replays waits in real time.
deltas: Option<&'a mut (dyn FnMut(&Increment) + 'a)>Where text goes while the model is still saying it.
None runs the model without asking for a stream, which is what
citysim and every offline replay do: an increment changes nothing
a run decides, so a driver with nowhere to put one asks for none
and the call is byte-identical to what it always was.
It takes no result, because nothing here may fail a call. What
arrives is a thing to look at; the record of what was said is
written from model_returned, once, afterwards.