ocp-types 0.1.0

Open Context Protocol (OCP) wire types: context frames, queries, capabilities, provenance. MIT, zero deps beyond serde — publishable to crates.io independently of any stella code.
Documentation
  • Coverage
  • 40%
    30 out of 75 items documented0 out of 14 items with examples
  • Size
  • Source code size: 22.6 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 968.1 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • macanderson

ocp-types

The wire types for the Open Context Protocol (OCP): context frames, queries, capabilities, and provenance.

ocp-types is the industry-facing artifact of the OCP crates: MIT licensed, zero dependencies beyond serde. You can implement an OCP provider or host in Rust against this crate alone, with no dependency on Stella or any of its other crates.

Protocol version: ocp/1.0-draft (see stability.md for what that means for this crate's semver).

What's in here

Example

use ocp_types::{ContextFrame, FrameKind};

let frame = ContextFrame {
    id: "frm_1".into(),
    kind: FrameKind::Doc,
    title: "Getting Started".into(),
    content: "Install with `cargo add ocp-types`.".into(),
    uri: Some("file:///docs/getting-started.md".into()),
    score: 0.82,
    token_cost: 64,
    valid_from: None,
    valid_to: None,
    recorded_at: None,
    provenance: vec![],
    citation_label: Some("getting-started.md L1-40".into()),
    embedding: None,
    relations: vec![],
};

assert!(frame.has_valid_score());
let json = serde_json::to_string(&frame)?;
# Ok::<(), serde_json::Error>(())

Every type here round-trips through serde_json — that JSON shape is the protocol; there is no separate IDL.

Building on this crate

  • ocp-host — a host runtime (provider discovery, stdio/HTTP transports, consent gating, fan-out routing) built on these types, for anyone who wants a ready-made OCP host rather than hand- rolling the wire protocol.
  • ocp-conformance — the public conformance suite. Green on it is what "OCP conformant" means for your declared capability set.

Docs

License

MIT — see LICENSE-MIT in the workspace root.