Skip to main content

contextgraph_types/
lib.rs

1//! `contextgraph-types` — the Context Graph Protocol (CGP) wire types.
2//!
3//! This crate is the industry-facing artifact: **MIT licensed, zero
4//! dependencies beyond `serde`**, publishable to crates.io on its own so a
5//! third party can implement a CGP host or provider without pulling in any
6//! other code. The normative shape these types bind to is [`SPEC.md`] at the
7//! repository root; every doc comment below cites a section of it.
8//!
9//! [`SPEC.md`]: https://github.com/macanderson/context-graph-protocol/blob/main/SPEC.md
10//!
11//! Protocol version: `contextgraph/1.0-draft`.
12
13pub mod attribution;
14pub mod capability;
15pub mod consent;
16pub mod error_code;
17pub mod frame;
18pub mod identity;
19pub mod query;
20pub mod scope;
21pub mod token;
22pub mod usage;
23pub mod validate;
24pub mod verify;
25
26pub use attribution::{AttributionReport, ContextUse};
27pub use capability::{
28    Capabilities, DataFlow, ProviderInfo, QueryCapability, embedding_fingerprints_match,
29    fingerprint_dimensions,
30};
31pub use consent::{ConsentReceipt, Grantor};
32pub use error_code::{ErrorCode, HostReaction};
33pub use frame::{
34    ContentFidelity, ContentRef, ContextFrame, FrameEmbedding, FrameKind, InlineContentRequirement,
35    Provenance, Relation, Representation, Transform, rel,
36};
37pub use identity::{FrameId, canonical_order};
38pub use query::{ContextQuery, ContextQueryResult};
39pub use scope::EgressScope;
40pub use token::{
41    BYTES_PER_BUDGET_TOKEN, SUGGESTED_HOST_SAFETY_FACTOR, budget_from_model_tokens, budget_tokens,
42};
43pub use usage::{ProviderUsage, ServedFrame, UsageReport};
44pub use validate::{
45    DIGEST_ALGORITHMS, format_protocol_timestamp, is_protocol_timestamp, is_well_formed_digest,
46};
47pub use verify::{FrameVerdict, Verdict, VerifyRequest, VerifyResponse};
48
49/// The protocol version string this crate implements. Frozen to `contextgraph/1.0`
50/// only at the public v1.0 release (`SPEC.md` §Version strings).
51pub const PROTOCOL_VERSION: &str = "contextgraph/1.0-draft";