Skip to main content

noether_engine/executor/
mod.rs

1// Native-only executor backends: require Nix, OS processes, LLM, or SQLite.
2#[cfg(feature = "native")]
3pub mod composite;
4#[cfg(feature = "native")]
5pub mod nix;
6#[cfg(feature = "native")]
7pub mod runtime;
8
9// Always-available executor implementations.
10pub mod budget;
11pub mod inline;
12pub mod mock;
13pub mod pure_cache;
14pub mod runner;
15pub mod stages;
16
17pub use inline::InlineRegistry;
18
19use noether_core::stage::StageId;
20
21#[derive(Debug, thiserror::Error)]
22pub enum ExecutionError {
23    #[error("stage {0:?} not found")]
24    StageNotFound(StageId),
25    #[error("stage {stage_id:?} failed: {message}")]
26    StageFailed { stage_id: StageId, message: String },
27    #[error("stage {stage_id:?} timed out after {timeout_secs}s")]
28    TimedOut {
29        stage_id: StageId,
30        timeout_secs: u64,
31    },
32    #[error("cost budget exceeded: spent {spent_cents}¢ of {budget_cents}¢ limit")]
33    BudgetExceeded { spent_cents: u64, budget_cents: u64 },
34    #[error("retry exhausted after {attempts} attempts for stage {stage_id:?}")]
35    RetryExhausted { stage_id: StageId, attempts: u32 },
36    #[error("remote call to {url} failed: {reason}")]
37    RemoteCallFailed { url: String, reason: String },
38}
39
40/// Pluggable execution interface for individual stages.
41pub trait StageExecutor {
42    fn execute(
43        &self,
44        stage_id: &StageId,
45        input: &serde_json::Value,
46    ) -> Result<serde_json::Value, ExecutionError>;
47}