1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! Generic execution-result API aligned with the Lean ProtocolMachine execution model.
use crate::engine::ObsEvent;
/// Execution status after one step/round.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ExecStatus<G = ()> {
/// Coroutine continues execution.
Continue,
/// Coroutine blocked on a guard/policy reason.
Blocked(G),
/// Coroutine/session halted.
Halted,
/// Runtime detected a fault.
Faulted,
}
/// One execution event emitted by a step.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum StepEvent<E = ()> {
/// Observable ProtocolMachine event.
Obs(ObsEvent),
/// Internal effect/policy event payload.
Internal(E),
}
/// Structured result of one execution step.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ExecResult<G = (), E = ()> {
/// Status after applying one step.
pub status: ExecStatus<G>,
/// Optional emitted event.
pub event: Option<StepEvent<E>>,
}
/// Generic execution pack carrying updated coroutine state plus step result.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct StepPack<G = (), E = ()> {
/// Coroutine identifier after the step.
pub coro_id: usize,
/// Step result.
pub res: ExecResult<G, E>,
}