Skip to main content

Crate systemprompt_identifiers

Crate systemprompt_identifiers 

Source
Expand description

Typed newtype identifiers for systemprompt.io.

Every entity in the platform is referenced through a wrapper newtype rather than a raw String.

This crate provides both the macros that generate those wrappers (define_id!, define_token!) and the canonical concrete types (UserId, AgentId, TaskId, TraceId, ContextId, SessionId, McpServerId, …).

Boundary types for talking to the database — DbValue, ToDbValue, FromDbValue, JsonRow — also live here so that identifier modules can interoperate without depending on the database crate.

§Construction

use systemprompt_identifiers::{TaskId, UserId};

// Known string value (literal, parsed input, DB row).
let user = UserId::new("user_abc");

// Mint a fresh UUID-backed identifier.
let task = TaskId::generate();

Validated identifiers (McpServerId, Email, ProfileName, ValidatedUrl, ValidatedFilePath, AgentName) additionally expose a fallible try_new constructor returning error::IdValidationError.

§Feature flags

FeatureEffect
(default)Pure-Rust types only.
sqlxDerives sqlx::Type on every identifier, allowing direct binding in query_as! macros.

Re-exports§

pub use db_value::DbValue;
pub use db_value::FromDbValue;
pub use db_value::JsonRow;
pub use db_value::ToDbValue;
pub use db_value::parse_database_datetime;

Modules§

db_value
Database-value abstraction shared between repository code and the identifier crate.
error
Error types raised by identifier validation and database value conversion.
headers
Canonical HTTP header name constants used throughout the platform for propagating trace, session, and authorization context across services.
macros
Declarative macros that generate the typed identifier and token newtypes.

Macros§

define_id
define_token

Structs§

AccessTokenId
AgentId
AgentName
AiGatewayPolicyId
AiQuotaBucketId
AiRequestId
AiSafetyFindingId
AiToolCallId
ApiKeyId
ApiKeySecret
ArtifactId
AuthorizationCode
CampaignId
CategoryId
ChallengeId
CheckoutSessionId
ClientId
CloudAuthToken
ConfigId
ConnectionId
ContentId
ContextId
DeviceCertId
Email
EngagementEventId
ExecutionStepId
FileId
FunnelId
FunnelProgressId
HookId
JobName
JwtToken
LinkClickId
LinkId
LogId
McpExecutionId
McpServerId
MessageId
PluginId
PolicyVersion
PriceId
ProfileName
RefreshTokenId
RoleId
ScheduledJobId
SectionId
SessionId
SessionToken
SkillId
SourceId
TagId
TaskId
TenantId
TokenId
TraceId
TransactionId
UserId
ValidatedFilePath
ValidatedUrl
WebhookEndpointId

Enums§

ClientType
SessionSource