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