Struct AppState
pub struct AppState {Show 36 fields
pub config: Arc<RwLock<RawRwLock, Config>>,
pub model_provider: Arc<dyn ModelProvider>,
pub model: String,
pub temperature: Option<f64>,
pub mem: Arc<dyn Memory>,
pub memory_strategy: Arc<dyn MemoryStrategy>,
pub auto_save: bool,
pub webhook_secret_hash: Option<Arc<str>>,
pub pairing: Arc<PairingGuard>,
pub trust_forwarded_headers: bool,
pub rate_limiter: Arc<GatewayRateLimiter>,
pub auth_limiter: Arc<AuthRateLimiter>,
pub idempotency_store: Arc<IdempotencyStore>,
pub gmail_push: Option<Arc<GmailPushChannel>>,
pub observer: Arc<dyn Observer>,
pub tools_registry: Arc<Vec<ToolSpec>>,
pub tools_registry_by_agent: Arc<HashMap<String, Arc<Vec<ToolSpec>>>>,
pub cost_tracker: Option<Arc<CostTracker>>,
pub event_tx: Sender<Value>,
pub event_buffer: Arc<EventBuffer>,
pub shutdown_tx: Sender<bool>,
pub reload_tx: Option<Sender<bool>>,
pub node_registry: Arc<NodeRegistry>,
pub mdns_peer_registry: MdnsPeerRegistry,
pub path_prefix: String,
pub web_dist_dir: Option<PathBuf>,
pub session_backend: Option<Arc<dyn SessionBackend>>,
pub session_queue: Arc<SessionActorQueue>,
pub device_registry: Option<Arc<DeviceRegistry>>,
pub pending_pairings: Option<Arc<PairingStore>>,
pub canvas_store: CanvasStore,
pub cancel_tokens: Arc<Mutex<HashMap<String, CancellationToken>>>,
pub pending_reload: Arc<Atomic<bool>>,
pub tui_registry: Option<Arc<TuiRegistry>>,
pub sop_engine: Option<Arc<Mutex<SopEngine>>>,
pub sop_audit: Option<Arc<SopAuditLogger>>,
}Expand description
Shared state for all axum handlers
Fields§
§config: Arc<RwLock<RawRwLock, Config>>§model_provider: Arc<dyn ModelProvider>§model: String§temperature: Option<f64>None means “let the provider decide” — required for models
(e.g. claude-opus-4-7) that reject the field. Always preserve
Option<f64> end-to-end; never substitute a hardcoded default.
mem: Arc<dyn Memory>§memory_strategy: Arc<dyn MemoryStrategy>§auto_save: bool§webhook_secret_hash: Option<Arc<str>>SHA-256 hash of X-Webhook-Secret (hex-encoded), never plaintext.
pairing: Arc<PairingGuard>§trust_forwarded_headers: bool§rate_limiter: Arc<GatewayRateLimiter>§auth_limiter: Arc<AuthRateLimiter>§idempotency_store: Arc<IdempotencyStore>§gmail_push: Option<Arc<GmailPushChannel>>Gmail Pub/Sub push notification channel
observer: Arc<dyn Observer>Observability backend for metrics scraping
tools_registry: Arc<Vec<ToolSpec>>Registered tool specs (for web dashboard tools page). This is the
default (no ?agent=) listing, seeded from the deterministically
smallest enabled agent alias.
tools_registry_by_agent: Arc<HashMap<String, Arc<Vec<ToolSpec>>>>Per-agent tool-spec listings keyed by agent alias, powering the
agent-aware GET /api/tools?agent=<alias> view so the WebUI Tools
page can show each agent’s scoped tool set. Falls back to
tools_registry for an unknown or omitted alias.
cost_tracker: Option<Arc<CostTracker>>Cost tracker (optional, for web dashboard cost page)
event_tx: Sender<Value>SSE broadcast channel for real-time events
event_buffer: Arc<EventBuffer>Ring buffer of recent events for history replay
shutdown_tx: Sender<bool>Shutdown signal sender for graceful shutdown
reload_tx: Option<Sender<bool>>Reload signal sender owned by the daemon. /admin/reload writes true
here; the daemon’s wait loop reacts and re-instantiates every
subsystem in place. None when running standalone (zeroclaw gateway start)
— reload then degrades to a 503 with a clear message.
node_registry: Arc<NodeRegistry>Registry of dynamically connected nodes
mdns_peer_registry: MdnsPeerRegistryLAN-local peer hints discovered by multicast. These are informational only; they never authorize or connect a peer.
path_prefix: StringPath prefix for reverse-proxy deployments (empty string = no prefix)
web_dist_dir: Option<PathBuf>Filesystem path to web/dist/ for serving the dashboard (None = API-only)
session_backend: Option<Arc<dyn SessionBackend>>Session backend for persisting gateway WS chat sessions
session_queue: Arc<SessionActorQueue>Per-session actor queue for serializing concurrent turns
device_registry: Option<Arc<DeviceRegistry>>Device registry for paired device management
pending_pairings: Option<Arc<PairingStore>>Pending pairing request store
canvas_store: CanvasStoreShared canvas store for Live Canvas (A2UI) system
cancel_tokens: Arc<Mutex<HashMap<String, CancellationToken>>>Per-session cancellation tokens for aborting in-flight agent responses.
Key is session_key (e.g. gw_<session_id>), value is the token for the
current turn. Entries are inserted before each turn and removed after
completion (normal or cancelled).
pending_reload: Arc<Atomic<bool>>§tui_registry: Option<Arc<TuiRegistry>>TUI session registry from the daemon (for /api/tuis endpoint).
None when the gateway runs standalone without a daemon.
sop_engine: Option<Arc<Mutex<SopEngine>>>Shared SOP engine from the daemon (for WS agent sessions).
None when the gateway runs standalone — sessions build their own.
sop_audit: Option<Arc<SopAuditLogger>>Shared SOP audit logger from the daemon (for WS agent sessions).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AppState
impl !RefUnwindSafe for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin for AppState
impl !UnwindSafe for AppState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more