Skip to main content

systemprompt_models/
lib.rs

1//! Foundation data models for systemprompt.io.
2//!
3//! `systemprompt-models` is the shared `shared/*` crate that every
4//! other layer (`infra`, `domain`, `app`, `entry`) depends on for the
5//! plain DTO and configuration shapes that flow across the system.
6//! It owns the wire types of the public HTTP API, the on-disk profile
7//! and services configuration, the A2A and AG-UI protocol shapes, the
8//! MCP metadata helpers, and the typed error enums returned by every
9//! public function in this crate.
10//!
11//! # Module map
12//!
13//! - [`a2a`] — A2A protocol agent card, message, task, and transport types.
14//! - [`agui`] — AG-UI streaming event protocol.
15//! - [`ai`] — LLM request/response shapes plus the [`ai::AiProvider`] trait.
16//! - [`api`] — public HTTP envelopes, error model, pagination, cloud DTOs.
17//! - [`artifacts`] — typed tool-result artifacts.
18//! - [`auth`] — authenticated user, permission, audience, and PKCE types.
19//! - [`config`] — global [`config::Config`] singleton and validation helpers.
20//! - [`content`], [`content_config`] — published content metadata.
21//! - [`errors`] — `thiserror`-derived public error enums.
22//! - [`events`] — analytics, A2A and system event envelopes.
23//! - [`execution`] — request context and execution-step bookkeeping.
24//! - [`extension`] — extension framework manifest types.
25//! - [`mcp`] — MCP protocol metadata helpers.
26//! - [`modules`] — module manifest tree resolution.
27//! - [`oauth`] — OAuth client / server config shapes.
28//! - [`paths`] — well-known directory layout helpers.
29//! - [`profile`] — on-disk profile and bootstrap configuration.
30//! - [`repository`] — repository lifecycle traits and value objects.
31//! - [`routing`] — request routing classification.
32//! - [`secrets`] — secrets document model.
33//! - [`services`] — services manifest (agents, plugins, hooks, MCP, …).
34//! - [`users`] — public user / session summaries.
35//! - [`validators`] — startup configuration validation passes.
36//!
37//! # Feature flags
38//!
39//! | Feature | Effect |
40//! | ------- | ------ |
41//! | _default_ | All public DTOs and traits, no axum integration. |
42//! | `web` | Adds `axum::IntoResponse` impls for the API envelopes. |
43//!
44//! Public functions return `thiserror`-derived enums from [`errors`];
45//! `anyhow::Error` is never used in a public signature.
46
47pub mod macros;
48
49pub mod a2a;
50pub mod admin;
51pub mod agui;
52pub mod ai;
53pub mod api;
54pub mod artifacts;
55pub mod auth;
56pub mod bridge;
57pub mod config;
58pub mod content;
59pub mod content_config;
60pub mod env;
61pub mod errors;
62pub mod events;
63pub mod execution;
64pub mod extension;
65pub mod gateway_hash;
66pub mod mcp;
67pub mod modules;
68pub mod net;
69pub mod oauth;
70pub mod paths;
71pub mod profile;
72pub mod repository;
73pub mod routing;
74pub mod secrets;
75pub mod services;
76pub mod text;
77pub mod time_format;
78pub mod users;
79pub mod validators;
80
81pub use a2a::{
82    AgentAuthentication, AgentCapabilities, AgentCard, AgentCardBuilder, AgentCardSignature,
83    AgentExtension, AgentInterface, AgentProvider, AgentSkill, ApiKeyLocation,
84    Artifact as A2aArtifact, ArtifactMetadata, ArtifactSummary, DataPart, FileContent, FilePart,
85    McpServerMetadata, McpToolsParams, Message, MessageMetadata as A2aMessageMetadata,
86    MessageRole as A2aMessageRole, OAuth2Flow, OAuth2Flows, Part, ProtocolBinding, SecurityScheme,
87    Task, TaskMetadata, TaskState, TaskStatus, TextPart, TransportProtocol,
88};
89pub use admin::{
90    ActivityTrend, AnalyticsData as AdminAnalyticsData, BotTrafficStats, BrowserBreakdown,
91    ContentStat, DeviceBreakdown, GeographicBreakdown, LogEntry as AdminLogEntry,
92    LogLevel as AdminLogLevel, RecentConversation, TrafficData as AdminTrafficData, UserInfo,
93    UserMetricsWithTrends,
94};
95pub use agui::{
96    AgUiEvent, AgUiEventBuilder, AgUiEventType, CustomPayload, GenericCustomPayload,
97    JsonPatchOperation, MessageRole as AgUiMessageRole, MessagesSnapshotPayload, RunErrorPayload,
98    RunFinishedPayload, RunStartedPayload, StateDeltaBuilder, StateDeltaPayload,
99    StateSnapshotPayload, StepFinishedPayload, StepStartedPayload, TextMessageContentPayload,
100    TextMessageEndPayload, TextMessageStartPayload, ToolCallArgsPayload, ToolCallEndPayload,
101    ToolCallResultPayload, ToolCallStartPayload,
102};
103pub use ai::{
104    AiContentPart, AiMessage, AiProvider, AiRequest, AiRequestBuilder, AiResponse, CallToolResult,
105    DynAiProvider, McpTool, MessageRole, ModelConfig, ModelHint, ModelPreferences, ProviderConfig,
106    ResponseFormat, SUPPORTED_AUDIO_TYPES, SUPPORTED_IMAGE_TYPES, SUPPORTED_TEXT_TYPES,
107    SUPPORTED_VIDEO_TYPES, SamplingParams, SearchGroundedResponse, StreamChunk,
108    StructuredOutputOptions, ToolCall, ToolExecution, ToolResultFormatter, is_supported_audio,
109    is_supported_image, is_supported_media, is_supported_text, is_supported_video,
110};
111pub use api::{
112    AcceptedResponse, ApiError, ApiErrorExt, ApiQuery, ApiResponse, CheckoutEvent, CheckoutRequest,
113    CheckoutResponse, CloudApiError, CloudApiErrorDetail, CloudApiResponse, CloudCustomerInfo,
114    CloudListResponse, CloudLogEntry, CloudLogsResponse, CloudPlan, CloudPlanInfo,
115    CloudStatusResponse, CloudTenant, CloudTenantInfo, CloudTenantSecrets, CloudTenantStatus,
116    CloudTenantStatusResponse, CloudUserInfo, CollectionResponse, CreateContextRequest,
117    CreatedResponse, DeployResponse, DiscoveryResponse, ErrorCode, ErrorResponse,
118    ExternalDbAccessResponse, Link, ModuleInfo, PaginationInfo, PaginationParams,
119    ProvisioningEvent, ProvisioningEventType, RegistryToken, ResponseLinks, ResponseMeta,
120    SearchQuery, SetExternalDbAccessRequest, SetSecretsRequest, SingleResponse, SortOrder,
121    SortParams, SubscriptionStatus, SuccessResponse, UpdateContextRequest, UserContext,
122    UserContextWithStats, UserMeResponse, ValidationError,
123};
124pub use artifacts::{
125    Alignment, Artifact, ArtifactSchema, ArtifactType, AudioArtifact, AxisType, ChartArtifact,
126    ChartDataset, ChartType, CliArtifact, CliArtifactType, Column, ColumnType, CommandResultRaw,
127    ConversionError, ExecutionMetadata, ImageArtifact, RenderingHints,
128    SortOrder as ArtifactSortOrder, TableArtifact, TableHints, ToolResponse, VideoArtifact,
129};
130pub use auth::{
131    AuthError, AuthenticatedUser, BEARER_PREFIX, BaseRole, BaseRoles, PkceMethod, ResponseType,
132};
133pub use config::{Config, PathNotConfiguredError};
134pub use content::{ContentLink, IngestionReport};
135pub use content_config::{
136    ArticleDefaults, Category, ContentConfigError, ContentConfigErrors, ContentConfigRaw,
137    ContentRouting, ContentSourceConfigRaw, IndexingConfig, Metadata, OrganizationData,
138    ParentRoute, SitemapConfig, SourceBranding, StructuredData,
139};
140pub use env::{contains_placeholder, interpolate, read_env_optional};
141pub use errors::{RepositoryError, ServiceError};
142pub use events::{
143    A2AEvent, A2AEventBuilder, A2AEventType, AnalyticsEvent, AnalyticsEventBuilder, ContextEvent,
144    ContextSummary, SystemEvent, SystemEventBuilder, SystemEventType,
145};
146pub use execution::{
147    ExecutionStep, PlannedTool, RequestContext, StepContent, StepId, StepStatus, StepType,
148    TrackedStep,
149};
150pub use extension::{
151    BuildType, DiscoveredExtension, Extension, ExtensionManifest, ExtensionType, ManifestRole,
152};
153pub use mcp::{
154    Deployment, DeploymentConfig, DynMcpDeploymentProvider, DynMcpRegistry, DynMcpToolProvider,
155    ERROR as MCP_ERROR, McpAuthState, McpDeploymentProvider, McpProvider, McpRegistry,
156    McpServerConfig, McpServerState, McpToolProvider, OAuthRequirement, RUNNING as MCP_RUNNING,
157    RegistryConfig, STARTING as MCP_STARTING, STOPPED as MCP_STOPPED, Settings,
158};
159pub use modules::{ApiPaths, CliPaths, ServiceCategory};
160pub use oauth::{OAuthClientConfig, OAuthServerConfig};
161pub use paths::{
162    AppPaths, BuildPaths, PathError, StoragePaths, SystemPaths, WebPaths, cloud_container,
163    dir_names, file_names,
164};
165pub use profile::{
166    CloudConfig, CloudValidationMode, ContentNegotiationConfig,
167    DatabaseConfig as ProfileDatabaseConfig, Environment, ExtensionsConfig, LogLevel, OutputFormat,
168    PathsConfig, Profile, ProfileInfo, ProfileStyle, ProfileType, RateLimitsConfig, RuntimeConfig,
169    SecurityConfig, SecurityHeadersConfig, ServerConfig, SiteConfig,
170};
171pub use repository::{ServiceLifecycle, ServiceRecord, WhereClause};
172pub use routing::{ApiCategory, AssetType, RouteClassifier, RouteType};
173pub use secrets::Secrets;
174pub use services::{
175    AGENT_CONFIG_FILENAME, AgentCardConfig, AgentConfig, AgentMetadataConfig, AgentProviderInfo,
176    AgentSummary, AiConfig, AiProviderConfig, CapabilitiesConfig, ComponentFilter, ComponentSource,
177    DEFAULT_AGENT_SYSTEM_PROMPT_FILE, DEFAULT_SKILL_CONTENT_FILE, DiskAgentConfig, DiskHookConfig,
178    DiskSkillConfig, HOOK_CONFIG_FILENAME, HistoryConfig, HookAction, HookCategory, HookEvent,
179    HookEventsConfig, HookMatcher, HookType, IncludableString, JobConfig, MarketplaceConfig,
180    MarketplaceConfigFile, MarketplaceVisibility, McpConfig, OAuthConfig as AgentOAuthConfig,
181    PluginAuthor, PluginComponentRef, PluginConfig, PluginConfigFile, PluginScript,
182    PluginVariableDef, RuntimeStatus, SKILL_CONFIG_FILENAME, SamplingConfig, SchedulerConfig,
183    ServiceType, ServicesConfig, Settings as ServicesSettings, SkillConfig, SkillsConfig,
184    SystemAdmin, SystemAdminConfig, ToolModelConfig, ToolModelSettings, WebConfig,
185    strip_frontmatter,
186};
187pub use systemprompt_identifiers::{AgentId, ContextId, SessionId, TaskId, TraceId, UserId};
188pub use users::{SessionSummary, UserSummary};
189
190pub use systemprompt_provider_contracts::{
191    AnimationConfig, CardConfig, ColorsConfig, FontsConfig, LayoutConfig, LogoConfig, MobileConfig,
192    PathsConfig as WebPathsConfig, RadiusConfig, ScriptConfig, ShadowsConfig, SpacingConfig,
193    TouchTargetsConfig, TypographyConfig, WebConfigError, ZIndexConfig,
194};
195pub use systemprompt_traits::{
196    StartupValidationError, StartupValidationReport, ValidationReport, ValidationWarning,
197};