Skip to main content

Crate systemprompt_traits

Crate systemprompt_traits 

Source
Expand description

§systemprompt-traits

Trait-first interface contracts for the systemprompt.io platform.

This crate defines the abstractions every other layer (infra, domain, app, entry) implements or consumes: configuration, database handle, analytics, authentication, JWT, file storage, repositories, and the cross-cutting ExtensionError contract.

§Layering

systemprompt-traits lives in the shared layer and depends only on systemprompt-identifiers and systemprompt-provider-contracts. Concrete implementations live in their respective domain or infra crates and are wired together at the entry layer.

§Errors

Each provider trait pairs with a typed thiserror-derived error enum (e.g. AnalyticsProviderError, AuthProviderError, JwtProviderError, FileStorageError, ContextPropagationError). The crate also defines the cross-cutting ExtensionError trait which downstream errors implement so the API and MCP transports can render them uniformly.

§Async traits

Most provider traits are exposed as Arc<dyn TraitName> (see the Dyn* aliases). Until trait dispatch supports native async fn on dyn traits, these continue to rely on #[async_trait]. Each trait whose contract requires it is annotated with that rationale.

§Feature flags

This crate exposes no Cargo features.

Copyright (c) systemprompt.io — Business Source License 1.1. See https://systemprompt.io for licensing details.

Re-exports§

pub use content::ContentCatalogStats;
pub use content::DynContentCatalogStats;
pub use context::AppContext;
pub use context::ConfigProvider;
pub use context::ContextPropagation;
pub use context::ContextPropagationError;
pub use context::ContextPropagationResult;
pub use context::DatabaseHandle;
pub use context::InjectContextHeaders;
pub use repository::RepositoryError;
pub use ownership::DynOwnerReassignment;
pub use ownership::OwnerReassignment;
pub use ownership::ReassignedRows;
pub use tool_executions::DynToolExecutionLookup;
pub use tool_executions::ToolExecutionLookup;
pub use log_service::LogService;
pub use managed_resources::DynManagedSkillResolver;
pub use managed_resources::ManagedSkillResolver;
pub use managed_resources::ManagedSkillResolverError;
pub use managed_resources::ResolvedManagedSkill;
pub use managed_resources::SkillResolution;
pub use managed_resources::WithheldReason;
pub use context_provider::ContextMaterializer;
pub use context_provider::ContextProvider;
pub use context_provider::ContextProviderError;
pub use context_provider::ContextStats;
pub use context_provider::ContextWithStats;
pub use context_provider::DynContextMaterializer;
pub use context_provider::DynContextProvider;
pub use context_provider::EnsureContextParams;
pub use validation::MetadataValidation;
pub use validation::MetadataValidationError;
pub use validation::Validate;
pub use validation::ValidationResult;
pub use analytics::ActiveSession;
pub use analytics::AnalyticsProvider;
pub use analytics::AnalyticsProviderError;
pub use analytics::AnalyticsResult;
pub use analytics::AnalyticsSession;
pub use analytics::CreateSessionInput;
pub use analytics::DynAnalyticsProvider;
pub use analytics::DynFingerprintProvider;
pub use analytics::DynSessionUsageCounters;
pub use analytics::ExtractSignals;
pub use analytics::FingerprintProvider;
pub use analytics::SessionAnalytics;
pub use analytics::SessionUsageCounters;
pub use auth::AuthProviderError;
pub use auth::AuthResult;
pub use auth::AuthUser;
pub use auth::DynRoleProvider;
pub use auth::DynUserProvider;
pub use auth::FederatedIdentityClaims;
pub use auth::RoleProvider;
pub use auth::SenderIdentity;
pub use auth::UserProvider;
pub use storage::FileStorage;
pub use storage::FileStorageError;
pub use storage::FileStorageResult;
pub use storage::StoredFileId;
pub use storage::StoredFileMetadata;
pub use ai_providers::AiFilePersistenceProvider;
pub use ai_providers::AiGeneratedFile;
pub use ai_providers::AiProviderError;
pub use ai_providers::AiProviderResult;
pub use ai_providers::AiRequestTrace;
pub use ai_providers::AiSessionProvider;
pub use ai_providers::CreateAiSessionParams;
pub use ai_providers::DynAiFilePersistenceProvider;
pub use ai_providers::DynAiRequestTrace;
pub use ai_providers::DynAiSessionProvider;
pub use ai_providers::ImageGenerationInfo;
pub use ai_providers::ImageMetadata;
pub use ai_providers::ImageStorageConfig;
pub use ai_providers::InsertAiFileParams;
pub use ai_providers::TraceMessage;
pub use ai_providers::TraceRequestStatus;
pub use ai_providers::TraceRequestUsage;
pub use ai_providers::TraceSample;
pub use ai_providers::TraceSampleFilter;
pub use ai_providers::TraceSampleMode;
pub use registry::AgentInfo;
pub use registry::AgentRegistryProvider;
pub use registry::DynAgentRegistryProvider;
pub use registry::DynMcpRegistryProvider;
pub use registry::McpRegistryProvider;
pub use registry::McpServerInfo;
pub use registry::RegistryError;
pub use registry::ServiceOAuthConfig;
pub use extension_error::ExtensionApiError;
pub use extension_error::ExtensionError;
pub use extension_error::McpErrorData;
pub use domain_config::DomainConfig;
pub use domain_config::DomainConfigError;
pub use domain_config::DomainConfigRegistry;
pub use validation_report::StartupValidationError;
pub use validation_report::StartupValidationReport;
pub use validation_report::ValidationReport;
pub use validation_report::ValidationWarning;
pub use jwt::AgentJwtClaims;
pub use jwt::DynJwtValidationProvider;
pub use jwt::GenerateTokenParams;
pub use jwt::JwtProviderError;
pub use jwt::JwtResult;
pub use jwt::JwtValidationProvider;
pub use analytics::DynSessionProvider;
pub use analytics::SessionProvider;
pub use analytics_events::AnalyticsEventRecord;
pub use analytics_events::AnalyticsEventStore;
pub use analytics_events::DynAnalyticsEventStore;
pub use session_store::DynSessionStore;
pub use session_store::SessionStore;

Modules§

ai_providers
AI generation file storage and session provider traits.
analytics
Request analytics extraction, session lifecycle, and fingerprint provider traits.
analytics_events
Persistence contract for analytics ingestion into the logging-owned event store.
auth
Authentication and role-management provider traits.
content
Content provider traits for blog posts, docs, and other published items.
context
Application context, configuration and database handle contracts, and request-context propagation across HTTP boundaries.
context_provider
Conversation context provider trait used by chat and agent surfaces.
domain_config
Per-domain configuration loading and validation.
extension_error
ExtensionError trait and HTTP/MCP error wire types.
jwt
JWT validation and generation provider trait.
log_service
Generic log persistence trait.
managed_resources
Runtime resolution of a skill through an installation’s managed-resource authority.
ownership
Owner reassignment across domain repositories.
registry
Registry provider traits for agents and MCP servers.
repository
Generic repository error type used by domain crates.
session_store
Session repository row and migration-result types.
storage
File storage trait and identifier types.
tool_executions
Read seam over the MCP tool-execution ledger.
validation
Lightweight value-validation traits used by config and metadata types.
validation_report
Unified validation report types used during startup.

Macros§

submit_job

Structs§

JobContext
JobResult
ModuleInfo
ServerListingFailure
ServiceInfo
ToolCallRequest
ToolCallResult
ToolContext
ToolDefinition
ToolInventory
Tools gathered from every reachable server plus the servers that could not be listed.

Enums§

DbValue
JobScope
Where a job runs when the scheduler has several replicas.
Phase
ProviderError
ServiceState
ServiceType
StartupEvent
ToolContent
ToolProviderError

Traits§

FromDbValue
Job
StartupEventExt
ToDbValue
ToolProvider

Functions§

parse_database_datetime
startup_channel

Type Aliases§

JsonRow
ProviderResult
StartupEventReceiver
StartupEventSender
ToolProviderResult