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 config;
57pub mod content;
58pub mod content_config;
59pub mod errors;
60pub mod events;
61pub mod execution;
62pub mod extension;
63pub mod mcp;
64pub mod modules;
65pub mod net;
66pub mod oauth;
67pub mod paths;
68pub mod profile;
69pub mod repository;
70pub mod routing;
71pub mod secrets;
72pub mod services;
73pub mod text;
74pub mod time_format;
75pub mod users;
76pub mod validators;
77
78pub use a2a::{
79    AgentAuthentication, AgentCapabilities, AgentCard, AgentCardBuilder, AgentCardSignature,
80    AgentExtension, AgentInterface, AgentProvider, AgentSkill, ApiKeyLocation,
81    Artifact as A2aArtifact, ArtifactMetadata, ArtifactSummary, DataPart, FileContent, FilePart,
82    McpServerMetadata, McpToolsParams, Message, MessageMetadata as A2aMessageMetadata,
83    MessageRole as A2aMessageRole, OAuth2Flow, OAuth2Flows, Part, ProtocolBinding, SecurityScheme,
84    Task, TaskMetadata, TaskState, TaskStatus, TextPart, TransportProtocol,
85};
86pub use admin::{
87    ActivityTrend, AnalyticsData as AdminAnalyticsData, BotTrafficStats, BrowserBreakdown,
88    ContentStat, DeviceBreakdown, GeographicBreakdown, LogEntry as AdminLogEntry,
89    LogLevel as AdminLogLevel, RecentConversation, TrafficData as AdminTrafficData, UserInfo,
90    UserMetricsWithTrends,
91};
92pub use agui::{
93    AgUiEvent, AgUiEventBuilder, AgUiEventType, CustomPayload, GenericCustomPayload,
94    JsonPatchOperation, MessageRole as AgUiMessageRole, MessagesSnapshotPayload, RunErrorPayload,
95    RunFinishedPayload, RunStartedPayload, StateDeltaBuilder, StateDeltaPayload,
96    StateSnapshotPayload, StepFinishedPayload, StepStartedPayload, TextMessageContentPayload,
97    TextMessageEndPayload, TextMessageStartPayload, ToolCallArgsPayload, ToolCallEndPayload,
98    ToolCallResultPayload, ToolCallStartPayload,
99};
100pub use ai::{
101    AiContentPart, AiMessage, AiProvider, AiRequest, AiRequestBuilder, AiResponse, CallToolResult,
102    DynAiProvider, McpTool, MessageRole, ModelConfig, ModelHint, ModelPreferences, ProviderConfig,
103    ResponseFormat, SUPPORTED_AUDIO_TYPES, SUPPORTED_IMAGE_TYPES, SUPPORTED_TEXT_TYPES,
104    SUPPORTED_VIDEO_TYPES, SamplingParams, SearchGroundedResponse, StreamChunk,
105    StructuredOutputOptions, ToolCall, ToolExecution, ToolResultFormatter, is_supported_audio,
106    is_supported_image, is_supported_media, is_supported_text, is_supported_video,
107};
108pub use api::{
109    AcceptedResponse, ApiError, ApiErrorExt, ApiQuery, ApiResponse, CheckoutEvent, CheckoutRequest,
110    CheckoutResponse, CloudApiError, CloudApiErrorDetail, CloudApiResponse, CloudCustomerInfo,
111    CloudListResponse, CloudLogEntry, CloudLogsResponse, CloudPlan, CloudPlanInfo,
112    CloudStatusResponse, CloudTenant, CloudTenantInfo, CloudTenantSecrets, CloudTenantStatus,
113    CloudTenantStatusResponse, CloudUserInfo, CollectionResponse, CreateContextRequest,
114    CreatedResponse, DeployResponse, DiscoveryResponse, ErrorCode, ErrorResponse,
115    ExternalDbAccessResponse, Link, ModuleInfo, PaginationInfo, PaginationParams,
116    ProvisioningEvent, ProvisioningEventType, RegistryToken, ResponseLinks, ResponseMeta,
117    SearchQuery, SetExternalDbAccessRequest, SetSecretsRequest, SingleResponse, SortOrder,
118    SortParams, SubscriptionStatus, SuccessResponse, UpdateContextRequest, UserContext,
119    UserContextWithStats, UserMeResponse, ValidationError,
120};
121pub use artifacts::{
122    Alignment, Artifact, ArtifactSchema, ArtifactType, AudioArtifact, AxisType, ChartArtifact,
123    ChartDataset, ChartType, CliArtifact, CliArtifactType, Column, ColumnType, CommandResultRaw,
124    ConversionError, ExecutionMetadata, ImageArtifact, RenderingHints,
125    SortOrder as ArtifactSortOrder, TableArtifact, TableHints, ToolResponse, VideoArtifact,
126};
127pub use auth::{
128    AuthError, AuthenticatedUser, BEARER_PREFIX, BaseRole, BaseRoles, GrantType, PkceMethod,
129    ResponseType,
130};
131pub use config::{Config, PathNotConfiguredError};
132pub use content::{ContentLink, IngestionReport};
133pub use content_config::{
134    ArticleDefaults, Category, ContentConfigError, ContentConfigErrors, ContentConfigRaw,
135    ContentRouting, ContentSourceConfigRaw, IndexingConfig, Metadata, OrganizationData,
136    ParentRoute, SitemapConfig, SourceBranding, StructuredData,
137};
138pub use errors::{CoreError, RepositoryError, ServiceError};
139pub use events::{
140    A2AEvent, A2AEventBuilder, A2AEventType, AnalyticsEvent, AnalyticsEventBuilder, ContextEvent,
141    ContextSummary, SystemEvent, SystemEventBuilder, SystemEventType,
142};
143pub use execution::{
144    ExecutionStep, PlannedTool, RequestContext, StepContent, StepId, StepStatus, StepType,
145    TrackedStep,
146};
147pub use extension::{
148    BuildType, DiscoveredExtension, Extension, ExtensionManifest, ExtensionType, ManifestRole,
149};
150pub use mcp::{
151    Deployment, DeploymentConfig, DynMcpDeploymentProvider, DynMcpRegistry, DynMcpToolProvider,
152    ERROR as MCP_ERROR, McpAuthState, McpDeploymentProvider, McpProvider, McpRegistry,
153    McpServerConfig, McpServerState, McpToolProvider, OAuthRequirement, RUNNING as MCP_RUNNING,
154    RegistryConfig, STARTING as MCP_STARTING, STOPPED as MCP_STOPPED, Settings,
155};
156pub use modules::{
157    ApiConfig, ApiPaths, CliPaths, Module, ModuleDefinition, ModulePermission, ModuleSchema,
158    ModuleSeed, ModuleType, Modules, ServiceCategory,
159};
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, McpConfig,
180    OAuthConfig as AgentOAuthConfig, PartialServicesConfig, PluginAuthor, PluginComponentRef,
181    PluginConfig, PluginConfigFile, PluginScript, PluginVariableDef, RuntimeStatus,
182    SKILL_CONFIG_FILENAME, SamplingConfig, SchedulerConfig, ServiceType, ServicesConfig,
183    Settings as ServicesSettings, SkillConfig, SkillsConfig, ToolModelConfig, ToolModelSettings,
184    WebConfig, strip_frontmatter,
185};
186pub use systemprompt_identifiers::{AgentId, ContextId, SessionId, TaskId, TraceId, UserId};
187pub use users::{SessionSummary, UserSummary};
188
189pub use systemprompt_provider_contracts::{
190    AnimationConfig, CardConfig, ColorsConfig, FontsConfig, LayoutConfig, LogoConfig, MobileConfig,
191    PathsConfig as WebPathsConfig, RadiusConfig, ScriptConfig, ShadowsConfig, SpacingConfig,
192    TouchTargetsConfig, TypographyConfig, WebConfigError, ZIndexConfig,
193};
194pub use systemprompt_traits::{
195    StartupValidationError, StartupValidationReport, ValidationReport, ValidationWarning,
196};