Skip to main content

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.
36///
37/// `0.2.0` carries the Trust & Hardening amendments (registry receipts
38/// — RFC-ACDP-0010, `did:key` producers, mandatory explicit
39/// `acdp_version`, lineage anchoring). Every v0.1.0 body, signature, and
40/// `content_hash` remains valid. An absent `acdp_version` field on a
41/// publish request is interpreted as `0.1.0` by the protocol; 0.2.0
42/// builders MUST emit the field explicitly (RFC-ACDP-0001 §6).
43pub const ACDP_VERSION: &str = "0.2.0";
44
45/// The JSON Schema namespace (`$id` prefix) for this protocol version,
46/// e.g. `<ACDP_SCHEMA_NAMESPACE>/acdp-error.schema.json`.
47pub const ACDP_SCHEMA_NAMESPACE: &str = "https://schemas.acdp.io/v0.1.0";