Skip to main content

systemprompt_runtime/
lib.rs

1mod builder;
2mod context;
3mod database_context;
4mod installation;
5mod registry;
6mod span;
7mod startup_validation;
8mod validation;
9mod wellknown;
10
11pub use builder::AppContextBuilder;
12pub use context::AppContext;
13pub use database_context::DatabaseContext;
14pub use installation::{install_module, install_module_with_db};
15pub use registry::{ModuleApiRegistration, ModuleApiRegistry, ModuleRuntime, WellKnownRoute};
16pub use span::create_request_span;
17pub use startup_validation::{
18    FilesConfigValidator, StartupValidator, display_validation_report, display_validation_warnings,
19};
20pub use validation::{validate_database_path, validate_system};
21pub use wellknown::{WellKnownMetadata, get_wellknown_metadata};
22
23pub use systemprompt_models::modules::{
24    ApiConfig, Module, ModuleDefinition, ModulePermission, ModuleSchema, ModuleSeed, ModuleType,
25    Modules, ServiceCategory,
26};
27
28#[macro_export]
29macro_rules! register_module_api {
30    ($module_name:literal, $category:expr, $router_fn:expr, $auth_required:expr, $module_type:expr) => {
31        inventory::submit! {
32            $crate::ModuleApiRegistration {
33                module_name: $module_name,
34                category: $category,
35                module_type: $module_type,
36                router_fn: $router_fn,
37                auth_required: $auth_required,
38            }
39        }
40    };
41    ($module_name:literal, $category:expr, $router_fn:expr, $auth_required:expr) => {
42        inventory::submit! {
43            $crate::ModuleApiRegistration {
44                module_name: $module_name,
45                category: $category,
46                module_type: $crate::ModuleType::Regular,
47                router_fn: $router_fn,
48                auth_required: $auth_required,
49            }
50        }
51    };
52}
53
54#[macro_export]
55macro_rules! register_wellknown_route {
56    ($path:literal, $handler:expr, $methods:expr, name: $name:literal, description: $desc:literal) => {
57        inventory::submit! {
58            $crate::WellKnownRoute {
59                path: $path,
60                handler_fn: $handler,
61                methods: $methods,
62            }
63        }
64
65        inventory::submit! {
66            $crate::WellKnownMetadata::new($path, $name, $desc)
67        }
68    };
69
70    ($path:literal, $handler:expr, $methods:expr) => {
71        inventory::submit! {
72            $crate::WellKnownRoute {
73                path: $path,
74                handler_fn: $handler,
75                methods: $methods,
76            }
77        }
78    };
79}