acdp_primitives/lib.rs
1//! # acdp-primitives — foundational types for the Agent Context Distribution Protocol
2//!
3//! The bottom layer of the `acdp` crate family: the typed error
4//! vocabulary ([`error::AcdpError`]), the opaque identifier/enum
5//! primitives ([`primitives`]), the wire error envelope (`WireError`,
6//! whose canonical public path is `acdp::types::WireError`), and small
7//! shared utilities (`limits`, `time`, `serde_helpers`). It has no
8//! cryptography and makes no network calls.
9//!
10//! Most users should depend on the umbrella [`acdp`](https://docs.rs/acdp)
11//! crate, which re-exports everything here.
12
13pub mod error;
14pub mod keyless;
15pub mod limits;
16pub mod primitives;
17pub mod revocation;
18pub mod serde_helpers;
19pub mod time;
20// The `WireError` envelope is *defined* here (down in `acdp-primitives`
21// to break the historical error↔types dependency cycle), but its
22// canonical public path is `acdp::types::WireError` / `WireErrorBody`.
23// The module and the direct re-export below stay `pub` only for
24// intra-workspace back-compat (`acdp-types` re-exports from here); they
25// are `#[doc(hidden)]` so downstream users are steered to the single
26// canonical path.
27#[doc(hidden)]
28pub mod wire_error;
29
30pub use error::{AcdpError, SupersessionReason};
31pub use primitives::{AgentDid, ContentHash, ContextType, CtxId, LineageId, Status, Visibility};
32#[doc(hidden)]
33pub use revocation::{
34 RevocationEffect, RevocationRefusal, RevocationSource, RevocationTrustClass, SourcedRevocation,
35 UnknownReason,
36};
37pub use wire_error::{WireError, WireErrorBody};
38
39// ── Protocol version ──────────────────────────────────────────────────────────
40
41/// The ACDP protocol version this library implements by default.
42///
43/// This is the newest **Final** wire-format line: 0.2.0 (Trust &
44/// Hardening — registry receipts, RFC-ACDP-0010), 0.3.0 (lineage-head
45/// receipts, transparency log, lifecycle/retraction, key revocation —
46/// RFC-ACDP-0011..0014), and 0.4.0 (witness cosigning, RFC-ACDP-0015,
47/// promoted to Final 2026-08). Every v0.1.0 body, signature, and
48/// `content_hash` remains valid — bumping this constant only changes
49/// what a producer stamps by *default* going forward; it is not a
50/// breaking change to anything already published. An absent
51/// `acdp_version` field on a publish request is interpreted as `0.1.0`
52/// by the protocol; 0.2.0+ builders MUST emit the field explicitly
53/// (RFC-ACDP-0001 §6). Callers that need an older explicit line (e.g. to
54/// stay under a registry that hasn't adopted 0.4.0 yet) should set it
55/// explicitly via `RequestBuilder::acdp_version` (in `acdp-producer`)
56/// rather than relying on the default.
57pub const ACDP_VERSION: &str = "0.4.0";
58
59/// The JSON Schema namespace (`$id` prefix) for this protocol version,
60/// e.g. `<ACDP_SCHEMA_NAMESPACE>/acdp-error.schema.json`.
61pub const ACDP_SCHEMA_NAMESPACE: &str = "https://schemas.acdp.io/v0.1.0";