systemprompt-models
Defines the runtime request and response models, protocol types, bridge manifest types and supporting error types. The services manifest and profile live in systemprompt-manifest; the provider wire codecs in systemprompt-wire.
The shared layer sits at the bottom of the workspace and depends on no other systemprompt layer. infra, domain, app, and entry all consume it. Part of the systemprompt-core workspace.
Installation
[]
= "0.64"
Module Map
| Module | Purpose |
|---|---|
a2a |
A2A protocol: agent card, message, task, transport, security scheme types. |
admin |
Admin dashboard DTOs (analytics, traffic, log entries, user metrics). |
agui |
AG-UI streaming event protocol (events, payloads, builders). |
ai |
LLM request/response shapes, AiProvider trait, streaming chunks, tool execution. |
api |
Public HTTP envelopes, pagination, error model, cloud API DTOs. |
artifacts |
Typed tool-result artifacts (chart, table, image, cli, …) and conversion. |
auth |
Authenticated user, base roles, JWT audience, PKCE, grant types. |
bridge |
Cowork desktop bridge manifest types. |
content, content_config |
Published content metadata and on-disk content routing. |
errors |
thiserror-derived RepositoryError, ServiceError, and the per-concern parse, secrets, validation, provider, metadata, and row enums. |
events |
Analytics, A2A, context, and system event envelopes. |
execution |
RequestContext, ExecutionStep, planned-tool bookkeeping. |
extension |
Extension manifest and discovery types. |
hooks |
Hook lifecycle events and categories. |
macros |
Crate-internal repository helper macros. |
mcp |
MCP server/registry config, deployment, auth state, registry trait. |
modules |
API path constants, CLI paths, service category resolution. |
net |
Network-layer value objects (ports, hosts). |
oauth |
OAuth client and server configuration shapes. |
origin |
Client attribution of an AI request: client kind, attestation tier, evidence. |
plugin |
Plugin component references, hook selection and dependencies carried in the bridge manifest. |
providers |
ApiSurface, the client-facing API family a provider is advertised under. |
repository |
ServiceLifecycle trait, ServiceRecord, WhereClause query builder. |
routing |
Request routing classification (RouteClassifier, ApiCategory). |
subprocess |
Environment-marker contract between the supervisor and its detached children. |
text, time_format |
Small text and timestamp formatting helpers. |
users |
Public user and session summaries. |
Error Model
Three thiserror enums layered from database to HTTP:
RepositoryError → ServiceError → ApiError → HTTP Response
use ;
let repo_err = not_found;
let svc_err: ServiceError = repo_err.into;
let api_err: ApiError = svc_err.into;
anyhow::Error is never used in a public signature in this crate.
Request Context
use RequestContext;
use ;
let ctx = new;
Repository Helpers
use WhereClause;
let = default
.eq
.not_null
.build;
ServiceLifecycle provides the common get_running_services / mark_crashed / update_status surface implemented by repositories that supervise long-running processes.
Feature Flags
| Feature | Default | Description |
|---|---|---|
web |
off | axum::IntoResponse impls for the API envelopes. |
sqlx |
off | sqlx::Type derives for DB-persisted enums. |
Dependencies
serde,serde_json,serde_yaml: serializationthiserror,async-trait: error enums and async traitschrono,uuid,indexmap: common typesschemars,regex: schema generation and pattern validationhttp,url,futures: HTTP types, SSRF URL validation, and streamstracing: structured loggingrmcp: MCP protocol typessqlx: optional, with thesqlxfeatureaxum: optional, with thewebfeaturesystemprompt-traits,systemprompt-identifiers,systemprompt-provider-contracts: shared layer siblings
License
BSL-1.1 (Business Source License). Source-available for evaluation, testing, and non-production use. Production use requires a commercial license. Each version converts to Apache 2.0 four years after publication. See LICENSE.