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 limits;
15pub mod primitives;
16pub mod serde_helpers;
17pub mod time;
18// The `WireError` envelope is *defined* here (down in `acdp-primitives`
19// to break the historical error↔types dependency cycle), but its
20// canonical public path is `acdp::types::WireError` / `WireErrorBody`.
21// The module and the direct re-export below stay `pub` only for
22// intra-workspace back-compat (`acdp-types` re-exports from here); they
23// are `#[doc(hidden)]` so downstream users are steered to the single
24// canonical path.
25#[doc(hidden)]
26pub mod wire_error;
27
28pub use error::{AcdpError, SupersessionReason};
29pub use primitives::{AgentDid, ContentHash, ContextType, CtxId, LineageId, Status, Visibility};
30#[doc(hidden)]
31pub use wire_error::{WireError, WireErrorBody};
32
33// ── Protocol version ──────────────────────────────────────────────────────────
34
35/// The ACDP protocol version this library implements by default.
36///
37/// This is the newest **Final** wire-format line: 0.2.0 (Trust &
38/// Hardening — registry receipts, RFC-ACDP-0010), 0.3.0 (lineage-head
39/// receipts, transparency log, lifecycle/retraction, key revocation —
40/// RFC-ACDP-0011..0014), and 0.4.0 (witness cosigning, RFC-ACDP-0015,
41/// promoted to Final 2026-08). Every v0.1.0 body, signature, and
42/// `content_hash` remains valid — bumping this constant only changes
43/// what a producer stamps by *default* going forward; it is not a
44/// breaking change to anything already published. An absent
45/// `acdp_version` field on a publish request is interpreted as `0.1.0`
46/// by the protocol; 0.2.0+ builders MUST emit the field explicitly
47/// (RFC-ACDP-0001 §6). Callers that need an older explicit line (e.g. to
48/// stay under a registry that hasn't adopted 0.4.0 yet) should set it
49/// explicitly via `RequestBuilder::acdp_version` (in `acdp-producer`)
50/// rather than relying on the default.
51pub const ACDP_VERSION: &str = "0.4.0";
52
53/// The JSON Schema namespace (`$id` prefix) for this protocol version,
54/// e.g. `<ACDP_SCHEMA_NAMESPACE>/acdp-error.schema.json`.
55pub const ACDP_SCHEMA_NAMESPACE: &str = "https://schemas.acdp.io/v0.1.0";