systemprompt_runtime/
lib.rs1mod builder;
23mod context;
24mod context_loaders;
25mod context_traits;
26mod database_context;
27mod error;
28mod installation;
29mod registry;
30mod span;
31mod startup_validation;
32mod validation;
33mod wellknown;
34
35pub use builder::AppContextBuilder;
36pub use context::{AppContext, AppContextParts};
37pub use database_context::DatabaseContext;
38pub use error::{RuntimeError, RuntimeResult};
39pub use installation::{install_module, install_module_with_db};
40pub use registry::{ModuleApiRegistration, ModuleApiRegistry, ModuleRuntime, WellKnownRoute};
41pub use span::create_request_span;
42pub use startup_validation::{
43 FilesConfigValidator, StartupValidator, display_validation_report, display_validation_warnings,
44};
45pub use validation::{validate_database_path, validate_system};
46pub use wellknown::{WellKnownMetadata, get_wellknown_metadata};
47
48pub use systemprompt_models::modules::{
49 ApiConfig, Module, ModuleDefinition, ModulePermission, ModuleSchema, ModuleSeed, ModuleType,
50 Modules, ServiceCategory,
51};
52
53#[macro_export]
54macro_rules! register_module_api {
55 ($module_name:literal, $category:expr, $router_fn:expr, $auth_required:expr, $module_type:expr) => {
56 inventory::submit! {
57 $crate::ModuleApiRegistration {
58 module_name: $module_name,
59 category: $category,
60 module_type: $module_type,
61 router_fn: $router_fn,
62 auth_required: $auth_required,
63 }
64 }
65 };
66 ($module_name:literal, $category:expr, $router_fn:expr, $auth_required:expr) => {
67 inventory::submit! {
68 $crate::ModuleApiRegistration {
69 module_name: $module_name,
70 category: $category,
71 module_type: $crate::ModuleType::Regular,
72 router_fn: $router_fn,
73 auth_required: $auth_required,
74 }
75 }
76 };
77}
78
79#[macro_export]
80macro_rules! register_wellknown_route {
81 ($path:literal, $handler:expr, $methods:expr, name: $name:literal, description: $desc:literal) => {
82 inventory::submit! {
83 $crate::WellKnownRoute {
84 path: $path,
85 handler_fn: $handler,
86 methods: $methods,
87 }
88 }
89
90 inventory::submit! {
91 $crate::WellKnownMetadata::new($path, $name, $desc)
92 }
93 };
94
95 ($path:literal, $handler:expr, $methods:expr) => {
96 inventory::submit! {
97 $crate::WellKnownRoute {
98 path: $path,
99 handler_fn: $handler,
100 methods: $methods,
101 }
102 }
103 };
104}