1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
//! Runtime context handed to extensions during router resolution. //! //! Copyright (c) systemprompt.io — Business Source License 1.1. //! See <https://systemprompt.io> for licensing details. use std::sync::Arc; use systemprompt_traits::{ConfigProvider, DatabaseHandle}; pub trait ExtensionContext: Send + Sync { fn system_owner_id(&self) -> systemprompt_identifiers::UserId; fn config(&self) -> Arc<dyn ConfigProvider>; fn database(&self) -> Arc<dyn DatabaseHandle>; fn get_extension(&self, id: &str) -> Option<Arc<dyn crate::Extension>>; fn has_extension(&self, id: &str) -> bool { self.get_extension(id).is_some() } } pub type DynExtensionContext = Arc<dyn ExtensionContext>;