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