Skip to main content

Crate contextgraph_types

Crate contextgraph_types 

Source
Expand description

contextgraph-types — the Context Graph Protocol (CGP) wire types.

This crate is the industry-facing artifact: MIT licensed, zero dependencies beyond serde, publishable to crates.io on its own so a third party can implement a CGP host or provider without pulling in any other code. The normative shape these types bind to is SPEC.md at the repository root; every doc comment below cites a section of it.

Protocol version: contextgraph/1.0-draft.

Re-exports§

pub use attribution::AttributionReport;
pub use attribution::ContextUse;
pub use capability::Capabilities;
pub use capability::DataFlow;
pub use capability::ProviderInfo;
pub use capability::QueryCapability;
pub use capability::embedding_fingerprints_match;
pub use capability::fingerprint_dimensions;
pub use consent::ConsentReceipt;
pub use consent::Grantor;
pub use error_code::ErrorCode;
pub use error_code::HostReaction;
pub use frame::ContentFidelity;
pub use frame::ContentRef;
pub use frame::ContextFrame;
pub use frame::FrameEmbedding;
pub use frame::FrameKind;
pub use frame::InlineContentRequirement;
pub use frame::Provenance;
pub use frame::Relation;
pub use frame::Representation;
pub use frame::Transform;
pub use frame::rel;
pub use identity::FrameId;
pub use identity::canonical_order;
pub use query::ContextQuery;
pub use query::ContextQueryResult;
pub use record::ConstraintEffect;
pub use record::ContextRecord;
pub use record::ContractRequirement;
pub use record::DirectiveKind;
pub use record::Enforcement;
pub use record::KnowledgeKind;
pub use record::LIFECYCLE_SCHEMA_VERSION;
pub use record::OriginClass;
pub use record::RecordAttestation;
pub use record::RecordBody;
pub use record::RecordProvenance;
pub use record::RecordScope;
pub use record::RecordStatus;
pub use record::RequirementResult;
pub use record::SharingScope;
pub use record::ValidationOutcome;
pub use scope::EgressScope;
pub use token::BYTES_PER_BUDGET_TOKEN;
pub use token::SUGGESTED_HOST_SAFETY_FACTOR;
pub use token::budget_from_model_tokens;
pub use token::budget_tokens;
pub use usage::ProviderUsage;
pub use usage::ServedFrame;
pub use usage::UsageReport;
pub use validate::DIGEST_ALGORITHMS;
pub use validate::format_protocol_timestamp;
pub use validate::is_protocol_timestamp;
pub use validate::is_well_formed_digest;
pub use verify::FrameVerdict;
pub use verify::Verdict;
pub use verify::VerifyRequest;
pub use verify::VerifyResponse;

Modules§

attribution
Retrieval attribution: closing the loop from a served frame to what it did (SPEC.md §14; issue #31).
capability
Handshake and capability negotiation types (SPEC.md §3). DataFlow is the security-critical field: hosts surface it at install/consent time, and egress: true providers must never be auto-enabled (SPEC.md §4).
consent
Consent receipts — the durable, audit-grade record of a granted egress permission (docs/context-reuse.md §3).
error_code
Structured error codes (SPEC.md §Errors, issue #9).
frame
ContextFrame — the unit of exchange between a CGP host and a provider. SPEC.md §6 fixes this exact shape; frames, never blobs, carry relevance, cost, and provenance so a budgeting, citing host can compose sources honestly.
identity
Stable frame identity and the canonical composition order (docs/context-reuse.md §1).
query
context/query request/response shapes (SPEC.md §5). Budget-aware by contract: every query carries max_tokens; a conforming provider never returns more than the budget and never lies about cost.
record
ContextRecord — the immutable, provenance-bearing unit of the Context Exchange Provider lifecycle profile (contextgraph/lifecycle/1.0-draft, issue #28).
scope
Egress-scope vocabulary — a closed, extensible classification of where a provider’s content goes (docs/context-reuse.md §3).
token
Canonical token accounting — the rule that makes budget honesty checkable (SPEC.md §B3, ADR 0003).
usage
Usage reports — a per-request roll-up of context cost (docs/context-reuse.md §2).
validate
Format validators for fields the protocol declares but could not previously check (SPEC.md §F4, §F5; issues #10 and #12).
verify
context/verify — pull-based revalidation of frames a host already holds (docs/context-reuse.md §4).

Constants§

PROTOCOL_VERSION
The protocol version string this crate implements. Frozen to contextgraph/1.0 only at the public v1.0 release (SPEC.md §Version strings).