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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//! Runtime-facing config views: [`RuntimeConfig`] and [`CliOverrides`].
//!
//! [`RuntimeConfig`] is the non-secret runtime slice carried in shared server
//! state for transport adapters (produced by [`ServerConfig::into_parts`]);
//! [`CliOverrides`] is the command-line override bundle merged after file and
//! environment values. Both are re-exported from the `config` module so every
//! existing `crate::config::X` path resolves identically.
//!
//! [`ServerConfig::into_parts`]: super::ServerConfig::into_parts
use std::{net::SocketAddr, path::PathBuf, time::Duration};
use super::{
AuthConfig, AuthoringConfig, AutoCreate, DeployConfig, DevConfig, ListenConfig, MetricsConfig,
NamespaceConfig, ObservabilityConfig, OpsConsoleConfig, OutboxConfig, ResolvedMcpConfig,
TlsConfig, WebSocketConfig, WorkerConfig,
};
/// Command-line configuration overrides applied after file and environment values.
#[derive(Debug, Default)]
pub struct CliOverrides {
/// Optional explicit config path from `--config`.
pub config_path: Option<PathBuf>,
/// Override for `[server].listen_address`.
pub listen_address: Option<SocketAddr>,
/// Override for `[server].grpc_address`.
pub grpc_address: Option<SocketAddr>,
/// Retired `--store-url` input retained only so load-time validation can refuse it.
pub store_url: Option<String>,
/// Override for `[runtime].scheduler_threads`.
pub scheduler_threads: Option<usize>,
/// Override for `[runtime].jit_threshold`.
pub jit_threshold: Option<u32>,
/// Override for `[drain].timeout_seconds`.
pub drain_timeout_seconds: Option<u64>,
/// Additional workflow package archives loaded after config and auto-discovered packages.
pub workflow_packages: Vec<PathBuf>,
/// Override for `[authoring].gleam_path`: the external `gleam` binary that
/// gates the server-side authoring loop. Setting it commissions the
/// authoring endpoints.
pub gleam_path: Option<PathBuf>,
/// Override for `[authoring].project_root`: the built Gleam workflow
/// project submitted source is written into and packaged from.
pub authoring_project_root: Option<PathBuf>,
}
/// Runtime settings retained in shared server state for transport adapters.
#[derive(Clone, Debug)]
pub struct RuntimeConfig {
/// Listener addresses for public transports.
pub listen: ListenConfig,
/// Optional TLS material for public transports.
pub tls: Option<TlsConfig>,
/// Authentication configuration shared by transports.
pub auth: AuthConfig,
/// Ops-console asset location.
pub ops_console: OpsConsoleConfig,
/// Namespace resolver construction mode.
pub namespace: NamespaceConfig,
/// Remote worker heartbeat configuration.
pub worker: WorkerConfig,
/// WebSocket stream configuration.
pub websocket: WebSocketConfig,
/// Workflow package archives loaded into the engine at startup.
pub workflow_packages: Vec<PathBuf>,
/// Operator deploy API settings.
pub deploy: DeployConfig,
/// Server-side Gleam authoring API settings.
pub authoring: AuthoringConfig,
/// Local dev-server surface settings.
pub dev: DevConfig,
/// Durable-outbox fan-out dispatcher settings.
pub outbox: OutboxConfig,
/// Agent-observability transcript retention bounds (`[observability]`).
pub observability: ObservabilityConfig,
/// Model Context Protocol surface settings (`[mcp]`), fully resolved.
pub mcp: ResolvedMcpConfig,
/// Engine scheduler thread count.
pub scheduler_threads: usize,
/// Engine JIT compilation threshold, or [`None`] to defer to beamr's own
/// default. Carried as an [`Option`] because "the operator named a
/// threshold" and "nobody said" are different states, and only the first
/// may override beamr.
pub jit_threshold: Option<u32>,
/// Engine reply deadline for workflow queries. REQUIRED — carried as an
/// [`Option`] only so state construction can re-validate (defense in
/// depth, like `websocket.event_broadcast_capacity`); validated
/// configurations always hold [`Some`] non-zero duration.
pub query_timeout: Option<Duration>,
/// Workloop sweep interval — how often the engine checks its registered
/// loops for a due cadence window or an exceeded tolerance.
pub workloop_sweep_interval: Option<Duration>,
/// Default namespace used by worker dispatch and unauthenticated local callers.
pub default_namespace: String,
/// Minted-on-use policy applied at the worker-registration mint hook
/// (`[namespaces] auto_create`). [`AutoCreate::Open`] (the default) mints an
/// unseen namespace durably; [`AutoCreate::Closed`] rejects it.
pub auto_create: AutoCreate,
/// Platform-wide default for a namespace's cluster-wide concurrent
/// in-flight-activity ceiling (`[namespaces] max_in_flight_activities`),
/// applied when a namespace record carries no explicit override. Carried in
/// runtime state so the later P2-Q2 keyed-backpressure dispatcher can read
/// it without reloading config. Stored-only in this slice — nothing reads it
/// yet.
pub max_in_flight_activities: u32,
/// Graceful drain timeout.
pub drain_timeout: Duration,
/// Metrics endpoint settings.
pub metrics: MetricsConfig,
/// Static distribution-shard assignment for this node (from `[store]
/// owned_shards`). Empty means own ALL shards (single-node default,
/// byte-identical to today); a non-empty set scopes engine recovery and
/// enumeration to exactly those shards. No election: assignment is static.
pub owned_shards: Vec<usize>,
/// Browser origins allowed cross-origin access to the public HTTP API (from
/// `[server] cors_allowed_origins`). Empty means no cross-origin access and
/// no `CorsLayer` is installed (secure default); a non-empty set installs
/// the layer scoped to exactly those origins.
pub cors_allowed_origins: Vec<String>,
}