Skip to main content

Crate systemprompt_models

Crate systemprompt_models 

Source
Expand description

Foundation data models for systemprompt.io.

systemprompt-models is the shared shared/* crate that every other layer (infra, domain, app, entry) depends on for the plain DTO and configuration shapes that flow across the system. It owns the wire types of the public HTTP API, the bridge manifest, the A2A and AG-UI protocol shapes, the MCP metadata helpers, and the typed error enums returned by every public function in this crate. The services manifest and the on-disk profile live in systemprompt-manifest; the provider wire codecs in systemprompt-wire.

§Module map

  • a2a — A2A protocol agent card, message, task, and transport types.
  • agui — AG-UI streaming event protocol.
  • ai — LLM request/response shapes plus the ai::AiProvider trait.
  • api — public HTTP envelopes, error model, pagination, cloud DTOs.
  • artifacts — typed tool-result artifacts.
  • attribution — scope attribution of an AI request (one value per registered subject dimension, plus the API key).
  • auth — authenticated user, permission, audience, and PKCE types.
  • bridge — bridge wire formats (signed manifest, plugin bundles, telemetry).
  • content, content_config — published content metadata.
  • errors — thiserror-derived public error enums.
  • events — analytics, A2A and system event envelopes.
  • execution — request context and execution-step bookkeeping.
  • extension — extension framework manifest types.
  • hooks — hook lifecycle events and categories.
  • macros — builder-setter macros used by the crate’s builder types.
  • managed — verified managed-resource revision bundles.
  • mcp — MCP protocol metadata helpers.
  • mime — canonical file-extension ↔ MIME mapping.
  • modules — module manifest tree resolution.
  • net — timeout constants and the outbound-URL (SSRF) validator.
  • oauth — OAuth client / server config shapes.
  • origin — client attribution of an AI request (client kind, attestation tier, evidence).
  • plugin — plugin component references carried in the bridge manifest.
  • providers — the client-facing API surface of an upstream provider.
  • routing — request routing classification.
  • scope — per-request scoping identity for scoped DB transactions.
  • subprocess — identity contract for supervised child processes.
  • text, time_format — display formatting helpers.
  • users — public user / session summaries.

No module here spawns processes or opens sockets: process spawning lives in systemprompt-loader and outbound HTTP in systemprompt-client.

§Feature flags

FeatureEffect
defaultAll public DTOs and traits, no axum integration.
webAdds axum::IntoResponse impls for the API envelopes.
sqlxDerives sqlx::Type on DB-persisted enums (e.g. ContextKind).

Public functions return thiserror-derived enums from errors; anyhow::Error is never used in a public signature.

Copyright (c) systemprompt.io — Business Source License 1.1. See https://systemprompt.io for licensing details.

Re-exports§

pub use a2a::AgentCapabilities;
pub use a2a::AgentCard;
pub use a2a::AgentExtension;
pub use a2a::AgentProvider;
pub use a2a::Artifact as A2aArtifact;
pub use a2a::ArtifactMetadata;
pub use a2a::DataPart;
pub use a2a::FileContent;
pub use a2a::FilePart;
pub use a2a::Part;
pub use a2a::Task;
pub use a2a::TaskMetadata;
pub use a2a::TaskState;
pub use a2a::TaskStatus;
pub use a2a::TextPart;
pub use agui::AgUiEvent;
pub use agui::AgUiEventBuilder;
pub use agui::AgUiEventType;
pub use agui::CustomPayload;
pub use agui::GenericCustomPayload;
pub use agui::JsonPatchOperation;
pub use agui::MessageRole as AgUiMessageRole;
pub use agui::MessagesSnapshotPayload;
pub use agui::RunErrorPayload;
pub use agui::RunFinishedPayload;
pub use agui::RunStartedPayload;
pub use agui::StateDeltaBuilder;
pub use agui::StateDeltaPayload;
pub use agui::StateSnapshotPayload;
pub use ai::AiContentPart;
pub use ai::AiMessage;
pub use ai::AiProvider;
pub use ai::AiRequest;
pub use ai::McpTool;
pub use ai::MessageRole;
pub use ai::ProviderConfig;
pub use ai::SamplingParams;
pub use ai::StreamChunk;
pub use ai::ToolCall;
pub use ai::ToolResultFormatter;
pub use ai::is_supported_audio;
pub use ai::is_supported_image;
pub use ai::is_supported_text;
pub use ai::is_supported_video;
pub use api::AcceptedResponse;
pub use api::ApiError;
pub use api::ApiErrorExt;
pub use api::ApiResponse;
pub use api::CollectionResponse;
pub use api::ContextKind;
pub use api::CreateContextRequest;
pub use api::CreatedResponse;
pub use api::ErrorCode;
pub use api::PaginationInfo;
pub use api::PaginationParams;
pub use api::SearchQuery;
pub use api::SingleResponse;
pub use api::SortOrder;
pub use api::SortParams;
pub use api::SuccessResponse;
pub use api::UpdateContextRequest;
pub use api::UserContext;
pub use api::UserContextWithStats;
pub use api::ValidationError;
pub use artifacts::Alignment;
pub use artifacts::ArtifactType;
pub use artifacts::AxisType;
pub use artifacts::ChartType;
pub use artifacts::CliArtifact;
pub use artifacts::ColumnType;
pub use artifacts::TableArtifact;
pub use auth::AuthRequestError;
pub use auth::BaseRoles;
pub use content::IngestionReport;
pub use content_config::Category;
pub use content_config::ContentConfigError;
pub use content_config::ContentConfigErrors;
pub use content_config::ContentConfigRaw;
pub use content_config::ContentRouting;
pub use content_config::ContentSourceConfigRaw;
pub use content_config::IndexingConfig;
pub use content_config::Metadata;
pub use content_config::ParentRoute;
pub use content_config::SitemapConfig;
pub use content_config::SourceBranding;
pub use events::A2AEvent;
pub use events::A2AEventBuilder;
pub use events::A2AEventType;
pub use events::AnalyticsEvent;
pub use events::AnalyticsEventBuilder;
pub use events::ContextEvent;
pub use events::SystemEvent;
pub use events::SystemEventBuilder;
pub use events::SystemEventType;
pub use execution::ExecutionStep;
pub use execution::PlannedTool;
pub use execution::RequestContext;
pub use execution::StepContent;
pub use execution::StepId;
pub use execution::StepStatus;
pub use execution::StepType;
pub use execution::TrackedStep;
pub use extension::BuildType;
pub use extension::DiscoveredExtension;
pub use extension::ExtensionManifest;
pub use mcp::Deployment;
pub use mcp::McpServerConfig;
pub use modules::ApiPaths;
pub use modules::CliPaths;
pub use routing::RouteClassifier;
pub use routing::RouteType;
pub use scope::RequestScope;

Modules§

a2a
A2A protocol models — agent cards, messages, tasks, artifacts, and transport descriptors. Protocol types retain raw String fields to match the external JSON-RPC specification.
agui
AG-UI streaming event protocol shapes.
ai
AI provider models — requests, responses, tool calls, sampling parameters, execution plans, and the AiProvider trait shared across LLM integrations.
api
api module — see crate-level docs for context.
artifacts
artifacts module — see crate-level docs for context.
attribution
Scope attribution of an AI request.
auth
Authentication and authorization value types.
bridge
Bridge wire-format models.
content
Published-content value types.
content_config
Content-configuration model and routing trait.
errors
Cross-cutting error types for systemprompt-models.
events
Event envelopes flowing across the system bus.
execution
Execution models — request context propagation, per-run execution steps, and the shared context carried through an agent run.
extension
Extension manifest types.
feedback
Skill feedback contracts shared across ingestion, marketplace, evaluators and clients.
hooks
Hook vocabulary: lifecycle events and categories.
macros
Declarative macros shared across the crate’s builder types.
managed
Verified revision closures shared across the marketplace, evaluation and scheduler domains.
mcp
MCP protocol metadata helpers.
mime
Canonical extension ↔ MIME mapping for the platform.
modules
Path constants and service-category classification shared across API/CLI surfaces.
net
Shared network timeout constants and outbound-URL validation.
oauth
OAuth client and server configuration shapes.
origin
Where a persisted AI request came from: the client that produced it, the inbound wire protocol it spoke, and how strongly the client is evidenced.
plugin
Plugin component references carried in the signed bridge manifest.
providers
Client-facing API surface for an upstream AI provider.
routing
Request-routing classification.
scope
Per-request scoping identity carried from middleware to scoped database transactions.
subprocess
Identity contract for the detached agent and MCP children the supervisor owns: the environment markers stamped at spawn time and the pure parsers that read them back off a live process image.
text
Text-formatting helpers.
time_format
Human-readable timestamp and duration formatting.
users
Public user and session summary projections.

Macros§

builder_methods
domain_error

Structs§

CallToolResult
The result of a tool call operation.
ContextId
SessionId
TaskId
UserId

Enums§

WebConfigError