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, ContextId, Email, ProfileName, ValidatedUrl, ValidatedFilePath, AgentName, …) expose only the fallible try_new constructor returning error::IdValidationError; there is no infallible new that could panic on runtime input. Values minted by the platform itself (ContextId::generate, AgentName::system) come from dedicated constructors.

§Feature flags

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

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

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
Actor
AgentId
AgentName
AiGatewayPolicyId
AiQuotaBucketId
AiRequestId
AiSafetyFindingId
AiToolCallId
AnalyticsChangeId
AnalyticsFactId
AnalyticsSnapshotJobId
AnalyticsWorkerId
ApiKeyId
ApiKeySecret
ArtifactId
AuthorizationCode
CallId
CampaignId
CategoryId
ChallengeId
ClientId
ClientSessionId
CloudAuthToken
ConfigId
ConnectionId
ConsumerInstallationId
ContentId
ContextId
DepartmentId
DepartmentName
DependencyVerificationId
DeviceCertId
DeviceId
DistributionId
Email
EngagementEventId
EventOutboxId
ExecutionStepId
ExternalAgentId
FileId
FunnelId
FunnelProgressId
GatewayConversationId
HookId
InstallationReceiptId
InstallationSessionBindingId
InstanceId
InventoryEntryId
InvocationAttributionId
JobName
JwtToken
LinkClickId
LinkId
LocaleCode
LogId
ManagedReconciliationId
ManagedResourceId
ManagedSourceId
MarketplaceId
McpExecutionId
McpServerId
McpToolName
MessageId
ModelId
NativeSessionId
PluginId
PolicyId
PolicyVersion
PriceId
ProfileName
ProviderId
ProviderRequestId
PublicationId
PublicationReviewId
RefreshTokenId
ResourceInvocationId
ResourceRevisionId
RoleId
RouteId
RuleId
ScheduledJobId
SecretName
SecretPatternId
SectionId
SessionId
SessionToken
SkillId
SlackChannelId
SlackUserId
SlackWorkspaceId
SourceId
SourceSnapshotId
TagId
TaskId
TeamsConversationId
TeamsTenantId
TeamsUserId
TenantId
TokenId
TraceId
UserId
ValidatedFilePath
ValidatedUrl
WebhookEndpointId
WithdrawalProposalId

Enums§

ActorKind
ActorKindTag
Discriminant-only view of ActorKind, bound to the actor_kind column in governance_decisions.
ClientType
SessionSource