Skip to main content

Crate systemprompt_extension

Crate systemprompt_extension 

Source
Expand description

Compile-time extension framework for systemprompt.io.

Built on the inventory crate, this crate lets extension authors declare schemas, API routes, scheduled jobs, and provider implementations using the Extension trait and the register_extension! macro. The runtime collects every registration at startup, validates dependencies, and merges the resulting wiring into the host application.

§Authoring an extension

use systemprompt_extension::prelude::*;

#[derive(Default)]
struct MyExtension;

impl Extension for MyExtension {
    fn metadata(&self) -> ExtensionMetadata {
        ExtensionMetadata { id: "my-ext", name: "My Extension", version: "0.1.0" }
    }
}

register_extension!(MyExtension);

§Module map

§Feature flags

This crate has no Cargo features; everything compiles into every build.

Re-exports§

pub use context::DynExtensionContext;
pub use context::ExtensionContext;
pub use error::ConfigError;
pub use error::LoaderError;
pub use metadata::ExtensionMetadata;
pub use metadata::ExtensionRole;
pub use metadata::SchemaDefinition;
pub use metadata::SchemaSource;
pub use metadata::SeedSource;
pub use migration::Migration;
pub use registry::ExtensionRegistration;
pub use registry::ExtensionRegistry;
pub use router::ExtensionRouter;
pub use router::ExtensionRouterConfig;
pub use router::SiteAuthConfig;
pub use any::AnyExtension;
pub use any::ApiExtensionWrapper;
pub use any::ExtensionWrapper;
pub use any::SchemaExtensionWrapper;
pub use builder::ExtensionBuilder;
pub use capabilities::CapabilityContext;
pub use capabilities::FullContext;
pub use capabilities::HasAnalytics;
pub use capabilities::HasConfig;
pub use capabilities::HasDatabase;
pub use capabilities::HasEventBus;
pub use capabilities::HasExtension;
pub use capabilities::HasFingerprint;
pub use capabilities::HasHttpClient;
pub use capabilities::HasRouteClassifier;
pub use capabilities::HasUserService;
pub use hlist::Contains;
pub use hlist::NotSame;
pub use hlist::Subset;
pub use hlist::TypeList;
pub use typed::ApiExtensionTyped;
pub use typed::ApiExtensionTypedDyn;
pub use typed::ConfigExtensionTyped;
pub use typed::JobExtensionTyped;
pub use typed::ProviderExtensionTyped;
pub use typed::SchemaDefinitionTyped;
pub use typed::SchemaExtensionTyped;
pub use typed::SchemaSourceTyped;
pub use typed_registry::RESERVED_PATHS;
pub use typed_registry::TypedExtensionRegistry;
pub use types::Dependencies;
pub use types::DependencyList;
pub use types::ExtensionMeta;
pub use types::ExtensionType;
pub use types::MissingDependency;
pub use types::NoDependencies;

Modules§

any
Type-erased wrappers used by crate::TypedExtensionRegistry.
builder
Fluent typed builder that enforces dependency ordering at compile time.
capabilities
Has* capability traits and the CapabilityContext composition helper.
context
Runtime context handed to extensions during router resolution.
error
Typed error enums raised by extension registration and configuration.
hlist
Heterogeneous-list type machinery used by the extension builder’s dependency typestate.
metadata
Static metadata, schema-source, and role-definition value types.
migration
Schema migration value type.
prelude
registry
Dynamic extension registry that stores extensions as Arc<dyn Extension>.
router
Router and site-auth configuration value types.
runtime_config
Process-level injection of extensions registered outside of the inventory linker collector.
typed
Compile-time-checked sub-traits for typed extension declarations.
typed_registry
Typed registry that tracks registrations by both ID and concrete type.
types
Type-level identifiers, dependency lists, and the ExtensionMeta supertrait used by typed extension declarations.

Macros§

register_extension

Structs§

AssetDefinition
AssetDefinitionBuilder

Enums§

AssetType

Traits§

AssetPaths
Extension