mcp_exec/
config.rs

1//! Configuration primitives describing how the executor resolves, verifies, and
2//! runs Wasm components.
3
4use std::collections::HashMap;
5use std::time::Duration;
6
7use crate::store::ToolStore;
8
9/// Configuration for a single executor invocation.
10#[derive(Clone, Debug)]
11pub struct ExecConfig {
12    pub store: ToolStore,
13    pub security: VerifyPolicy,
14    pub runtime: RuntimePolicy,
15    pub http_enabled: bool,
16}
17
18/// Policy describing how artifacts must be verified prior to execution.
19#[derive(Clone, Debug, Default)]
20pub struct VerifyPolicy {
21    /// Whether artifacts without a matching digest/signature are still allowed.
22    pub allow_unverified: bool,
23    /// Expected digests (hex encoded) keyed by component identifier.
24    pub required_digests: HashMap<String, String>,
25    /// Signers that are trusted to vouch for artifacts.
26    pub trusted_signers: Vec<String>,
27}
28
29/// Runtime resource limits applied to the Wasm execution.
30#[derive(Clone, Debug)]
31pub struct RuntimePolicy {
32    pub fuel: Option<u64>,
33    pub max_memory: Option<u64>,
34    pub wallclock_timeout: Duration,
35    pub per_call_timeout: Duration,
36    pub max_attempts: u32,
37    pub base_backoff: Duration,
38}
39
40impl Default for RuntimePolicy {
41    fn default() -> Self {
42        Self {
43            fuel: None,
44            max_memory: None,
45            wallclock_timeout: Duration::from_secs(30),
46            per_call_timeout: Duration::from_secs(10),
47            max_attempts: 1,
48            base_backoff: Duration::from_millis(100),
49        }
50    }
51}