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//! - [`wire`] — canonical AI wire types and per-protocol codecs (gateway +
37//!   agent clients).
38//!
39//! # Feature flags
40//!
41//! | Feature | Effect |
42//! | ------- | ------ |
43//! | _default_ | All public DTOs and traits, no axum integration. |
44//! | `web` | Adds `axum::IntoResponse` impls for the API envelopes. |
45//! | `sqlx` | Derives `sqlx::Type` on DB-persisted enums (e.g. [`ContextKind`]). |
46//!
47//! Public functions return `thiserror`-derived enums from [`errors`];
48//! `anyhow::Error` is never used in a public signature.
49//!
50//! Copyright (c) systemprompt.io — Business Source License 1.1.
51//! See <https://systemprompt.io> for licensing details.
52
53pub mod macros;
54
55pub mod a2a;
56pub mod admin;
57pub mod agui;
58pub mod ai;
59pub mod api;
60pub mod artifacts;
61pub mod auth;
62pub mod bridge;
63pub mod config;
64pub mod content;
65pub mod content_config;
66pub mod env;
67pub mod errors;
68pub mod events;
69pub mod execution;
70pub mod extension;
71pub mod gateway_hash;
72pub mod mcp;
73pub mod mime;
74pub mod modules;
75pub mod net;
76pub mod oauth;
77pub mod paths;
78pub mod profile;
79pub mod repository;
80pub mod routing;
81pub mod schema;
82pub mod secrets;
83pub mod services;
84pub mod subprocess;
85pub mod text;
86pub mod time_format;
87pub mod users;
88pub mod validators;
89pub mod wire;
90
91pub use a2a::{
92    AgentAuthentication, AgentCapabilities, AgentCard, AgentCardBuilder, AgentCardSignature,
93    AgentExtension, AgentInterface, AgentProvider, AgentSkill, ApiKeyLocation,
94    Artifact as A2aArtifact, ArtifactMetadata, ArtifactSummary, DataPart, FileContent, FilePart,
95    McpServerMetadata, McpToolsParams, Message, MessageMetadata as A2aMessageMetadata,
96    MessageRole as A2aMessageRole, OAuth2Flow, OAuth2Flows, Part, ProtocolBinding, SecurityScheme,
97    Task, TaskMetadata, TaskState, TaskStatus, TextPart, TransportProtocol,
98};
99pub use admin::{
100    ActivityTrend, AnalyticsData as AdminAnalyticsData, BotTrafficStats, BrowserBreakdown,
101    ContentStat, DeviceBreakdown, GeographicBreakdown, LogEntry as AdminLogEntry,
102    LogLevel as AdminLogLevel, RecentConversation, TrafficData as AdminTrafficData, UserInfo,
103    UserMetricsWithTrends,
104};
105pub use agui::{
106    AgUiEvent, AgUiEventBuilder, AgUiEventType, CustomPayload, GenericCustomPayload,
107    JsonPatchOperation, MessageRole as AgUiMessageRole, MessagesSnapshotPayload, RunErrorPayload,
108    RunFinishedPayload, RunStartedPayload, StateDeltaBuilder, StateDeltaPayload,
109    StateSnapshotPayload, StepFinishedPayload, StepStartedPayload, TextMessageContentPayload,
110    TextMessageEndPayload, TextMessageStartPayload, ToolCallArgsPayload, ToolCallEndPayload,
111    ToolCallResultPayload, ToolCallStartPayload,
112};
113pub use ai::{
114    AiContentPart, AiMessage, AiProvider, AiRequest, AiRequestBuilder, AiResponse, CallToolResult,
115    DynAiProvider, McpTool, MessageRole, ModelConfig, ModelHint, ModelPreferences, ProviderConfig,
116    ResponseFormat, SUPPORTED_AUDIO_TYPES, SUPPORTED_IMAGE_TYPES, SUPPORTED_TEXT_TYPES,
117    SUPPORTED_VIDEO_TYPES, SamplingParams, SearchGroundedResponse, StreamChunk,
118    StructuredOutputOptions, ToolCall, ToolExecution, ToolResultFormatter, is_supported_audio,
119    is_supported_image, is_supported_media, is_supported_text, is_supported_video,
120};
121pub use api::{
122    AcceptedResponse, ApiError, ApiErrorExt, ApiQuery, ApiResponse, CheckoutEvent, CheckoutRequest,
123    CheckoutResponse, CloudApiError, CloudApiErrorDetail, CloudApiResponse, CloudCustomerInfo,
124    CloudListResponse, CloudLogEntry, CloudLogsResponse, CloudPlan, CloudPlanInfo,
125    CloudStatusResponse, CloudTenant, CloudTenantInfo, CloudTenantSecrets, CloudTenantStatus,
126    CloudTenantStatusResponse, CloudUserInfo, CollectionResponse, ContextKind,
127    CreateContextRequest, CreatedResponse, DeployResponse, DiscoveryResponse, ErrorCode,
128    ErrorResponse, ExternalDbAccessResponse, Link, ModuleInfo, PaginationInfo, PaginationParams,
129    ParseContextKindError, ProvisioningEvent, ProvisioningEventType, RegistryToken, ResponseLinks,
130    ResponseMeta, SearchQuery, SetExternalDbAccessRequest, SetSecretsRequest, SingleResponse,
131    SortOrder, SortParams, SubscriptionStatus, SuccessResponse, UpdateContextRequest, UserContext,
132    UserContextWithStats, UserMeResponse, ValidationError,
133};
134pub use artifacts::{
135    Alignment, Artifact, ArtifactSchema, ArtifactType, AudioArtifact, AxisType, ChartArtifact,
136    ChartDataset, ChartType, CliArtifact, Column, ColumnType, ExecutionMetadata, ImageArtifact,
137    SortOrder as ArtifactSortOrder, TableArtifact, TableHints, ToolResponse, VideoArtifact,
138};
139pub use auth::{
140    AuthError, AuthenticatedUser, BEARER_PREFIX, BaseRole, BaseRoles, PkceMethod, ResponseType,
141};
142pub use config::{Config, PathNotConfiguredError};
143pub use content::{ContentLink, IngestionReport};
144pub use content_config::{
145    ArticleDefaults, Category, ContentConfigError, ContentConfigErrors, ContentConfigRaw,
146    ContentRouting, ContentSourceConfigRaw, IndexingConfig, Metadata, OrganizationData,
147    ParentRoute, SitemapConfig, SourceBranding, StructuredData,
148};
149pub use env::{contains_placeholder, interpolate, none_if_blank, read_env_optional};
150pub use errors::{RepositoryError, ServiceError};
151pub use events::{
152    A2AEvent, A2AEventBuilder, A2AEventType, AnalyticsEvent, AnalyticsEventBuilder, ContextEvent,
153    ContextSummary, SystemEvent, SystemEventBuilder, SystemEventType,
154};
155pub use execution::{
156    ExecutionStep, PlannedTool, RequestContext, StepContent, StepId, StepStatus, StepType,
157    TrackedStep,
158};
159pub use extension::{
160    BuildType, DiscoveredExtension, Extension, ExtensionManifest, ExtensionType, ManifestRole,
161};
162pub use mcp::{
163    Deployment, DeploymentConfig, DynMcpDeploymentProvider, DynMcpRegistry, DynMcpToolProvider,
164    ERROR as MCP_ERROR, McpAuthState, McpDeploymentProvider, McpProvider, McpRegistry,
165    McpServerConfig, McpServerState, McpToolProvider, OAuthRequirement, RUNNING as MCP_RUNNING,
166    RegistryConfig, STARTING as MCP_STARTING, STOPPED as MCP_STOPPED, Settings,
167};
168pub use modules::{ApiPaths, CliPaths, ServiceCategory};
169pub use oauth::{OAuthClientConfig, OAuthServerConfig};
170pub use paths::{
171    AppPaths, BuildPaths, PathError, StoragePaths, SystemPaths, WebPaths, cloud_container,
172    dir_names, file_names,
173};
174pub use profile::{
175    CloudConfig, CloudValidationMode, ContentNegotiationConfig,
176    DatabaseConfig as ProfileDatabaseConfig, Environment, ExtensionsConfig, LogLevel, OutputFormat,
177    PathsConfig, Profile, ProfileInfo, ProfileStyle, ProfileType, RateLimitsConfig, RuntimeConfig,
178    SecurityConfig, SecurityHeadersConfig, ServerConfig, SiteConfig,
179};
180pub use repository::{ServiceLifecycle, ServiceRecord, WhereClause};
181pub use routing::{ApiCategory, AssetType, RouteClassifier, RouteType};
182pub use secrets::Secrets;
183pub use services::{
184    AGENT_CONFIG_FILENAME, AgentCardConfig, AgentConfig, AgentMetadataConfig, AgentProviderInfo,
185    AgentSummary, AiConfig, AiProviderConfig, CapabilitiesConfig, ComponentFilter, ComponentSource,
186    DEFAULT_AGENT_SYSTEM_PROMPT_FILE, DEFAULT_SKILL_CONTENT_FILE, DiskAgentConfig, DiskHookConfig,
187    DiskSkillConfig, Frontmatter, HOOK_CONFIG_FILENAME, HistoryConfig, HookAction, HookCategory,
188    HookEvent, HookEventsConfig, HookMatcher, HookType, IncludableString, JobConfig,
189    MarketplaceConfig, MarketplaceConfigFile, MarketplaceVisibility, McpConfig,
190    OAuthConfig as AgentOAuthConfig, PluginAuthor, PluginComponentRef, PluginConfig,
191    PluginConfigFile, PluginScript, PluginVariableDef, RuntimeStatus, SKILL_CONFIG_FILENAME,
192    SamplingConfig, SchedulerConfig, ServiceType, ServicesConfig, Settings as ServicesSettings,
193    SkillConfig, SkillsConfig, SystemAdmin, SystemAdminConfig, WebConfig, split_frontmatter,
194    strip_frontmatter,
195};
196pub use systemprompt_identifiers::{AgentId, ContextId, SessionId, TaskId, TraceId, UserId};
197pub use users::{SessionSummary, UserSummary};
198
199pub use systemprompt_provider_contracts::{
200    AnimationConfig, CardConfig, ColorsConfig, FontsConfig, LayoutConfig, LogoConfig, MobileConfig,
201    PathsConfig as WebPathsConfig, RadiusConfig, ScriptConfig, ShadowsConfig, SpacingConfig,
202    TouchTargetsConfig, TypographyConfig, WebConfigError, ZIndexConfig,
203};
204pub use systemprompt_traits::{
205    StartupValidationError, StartupValidationReport, ValidationReport, ValidationWarning,
206};