Skip to main content

Crate lean_ctx_protocol

Crate lean_ctx_protocol 

Source

Re-exports§

pub use knowledge::ClassificationLevel;
pub use knowledge::KnowledgeObjectV1;
pub use knowledge::ValidityWindow;
pub use knowledge_routing::ContextBundleV1;
pub use knowledge_routing::ContextCandidateV1;
pub use knowledge_routing::ContextReceiptV1;
pub use knowledge_routing::CostClass;
pub use knowledge_routing::KnowledgeSourceManifestV1;
pub use knowledge_routing::SourceCapabilities;
pub use savings::MeasurementMethod;
pub use savings::SavingsObservationV1;
pub use savings::SavingsReceiptV1;
pub use triage::TaskProfileV1;
pub use triage::TaskScope;
pub use triage::TriageBackend;
pub use triage::TriageResultV1;
pub use control_plane::*;
pub use decision::*;
pub use fleet_control::*;
pub use outcome::*;
pub use outcome_engine::*;
pub use value_share::*;

Modules§

auto_routing
Public model=auto wire contracts.
circuit_breaker
Deterministic, frozen circuit-breaker reference behavior.
control_plane
Model and context-selection control-plane contracts.
decision
Decision audit contract.
eligibility
Static eligibility-policy contracts for controlled routing.
fleet_control
Multi-agent authorization and budget-control contracts.
knowledge
Knowledge provenance contract.
knowledge_routing
Knowledge-source discovery and context-routing contracts.
outcome
Accepted-outcome contract.
outcome_engine
Outcome-learning contracts for evaluating control-plane decisions.
rollout
Public rollout cohort contracts and deterministic assignment reference.
savings
triage
Task triage and profile contracts.
value_share
Savings attribution and value-share settlement contracts.

Structs§

AgentId
Opaque, bounded identifier used by a protocol contract.
CapabilityId
Opaque, bounded identifier used by a protocol contract.
CapabilityManifestV1
Provider capability manifest. Unknown top-level fields are retained for additive evolution.
ContextBalanceV1
Four-stage token balance carried by an execution receipt.
ContextKitPinV1
Exact immutable identity of a Context Kit resolved for a session.
ContextSessionConfigurationV1
Frozen configuration inputs that may affect Context SDK behavior or evidence.
ContextSessionSnapshotV1
Portable V1 metadata/checkpoint contract for one Context SDK root task.
ContextSessionStateV1
Mutable checkpoint projection; it never replaces the append-only event log.
DecisionId
Opaque, bounded identifier used by a protocol contract.
EngineFailureV1
Structured, non-secret failure information with an optional recovery route.
EngineInterfaceV1
Published local Engine interface declaration and supported operation set.
EngineInvocationIdV1
Opaque identity for one Engine invocation, scoped to the local Engine.
EngineInvocationV1
A deterministic local Engine request after identity and policy resolution.
EngineMeasurementV1
One bounded, named numerical Engine observation.
EngineObservationV1
Structured output, measurements, failure state, and optional receipt lineage.
EngineOperationV1
One named, versioned Engine capability selected by the caller.
EnginePolicyAdmissionV1
Policy reference and admission decision for a single invocation.
EngineReceiptLinkV1
Immutable link from an Engine observation to an integrity-addressed receipt.
EventId
Opaque, bounded identity owned by the public protocol.
EvidenceGapClosedV1
EvidenceGapOpenedV1
EvidenceRefV1
Typed evidence reference (not just a string).
ExecutionPlanV1
V1 execution plan produced from a task envelope.
ExecutionReceiptV1
Auditable result of executing an execution plan.
ExperimentAssignmentV1
Signed assignment from sidecar. Runtime executes, never decides.
HandoffId
Opaque, bounded identity owned by the public protocol.
InvocationCapabilityBindingV1
One selected capability bound to its canonical CapabilityManifest bytes.
InvocationContextBindingSignerV1
Metadata identifying the key used to sign an invocation context binding.
InvocationContextBindingV1
Canonical signed admission context for one Engine invocation.
InvocationEngineReceiptBindingV1
Exact Engine receipt locator and content digest.
InvocationEvidenceManifestV1
Strict, canonical evidence join for one Engine invocation.
InvocationPolicyBindingV1
One policy locator bound to the digest of the exact policy decision bytes.
InvocationSourceBindingV1
One source locator bound to the digest of its exact persisted bytes.
KitId
Opaque, bounded identity owned by the public protocol.
MeasuredUnitV1
MeasurementSupportV1
Measurement dimensions a capability can report.
MoneyV1
Sub-cent precision money. NOT floating point. Rounding to legal minor units happens only at invoice time.
OutcomeId
Opaque, bounded identifier used by a protocol contract.
PackageId
Opaque, bounded identity owned by the public protocol.
PlanId
Opaque, bounded identifier used by a protocol contract.
PolicyClassification
Extended policy rule with classification.
PolicyId
Opaque, bounded identity owned by the public protocol.
ProfileId
Opaque, bounded identity owned by the public protocol.
ProjectContextId
Opaque, bounded identity owned by the public protocol.
ProjectId
Opaque, bounded identifier used by a protocol contract.
ProtocolReference
Bounded non-path reference to provenance, activation, or policy material.
ReceiptCapabilityLinkV1
Version-pinned capability that participated in the invocation.
ReceiptChainLinkV1
Chain predecessor covered by this receipt signature.
ReceiptDocumentV1
Canonical signed receipt document.
ReceiptEvidenceRefV1
Strict digest-only evidence reference; payload bytes are never embedded.
ReceiptId
Opaque, bounded identifier used by a protocol contract.
ReceiptLineageV1
Immutable identity map for the execution lineage.
ReceiptOutcomeLinkV1
Link to the separately persisted outcome observation.
ReceiptSignerV1
Explicit signer identity without an embedded trust root.
ReceiptValueV1
One named integer fact with enough provenance to interpret its claim class.
ResolvedLocalEngineIdentityV1
Resolved local Engine identity; it is not a tenant, user, or agent identity.
RunId
Opaque, bounded identity owned by the public protocol.
SemanticVersion
A strict SemVer 2.0.0 identity used for pinned protocol artifacts.
SessionId
Opaque, bounded identifier used by a protocol contract.
SessionIdentityV1
Immutable identity established when a Context SDK session is created.
Sha256Digest
A canonical sha256:<lowercase-hex> content identity.
SourceId
Opaque, bounded identity owned by the public protocol.
SurfaceSupportV1
Per-surface support details in a capability manifest.
TaskEnvelopeV1
Canonical task envelope for a V1 execution lineage.
TaskId
Opaque, bounded identifier used by a protocol contract.
TenantId
Opaque, bounded identifier used by a protocol contract.
TraceId
Opaque, bounded identifier used by a protocol contract.
TuningProfilePinV1
Exact immutable identity of a TuningProfile resolved for a session.
UsageBreakdownV1
Granular token usage breakdown.
UtcTimestamp
Canonical UTC timestamp with second precision for deterministic session metadata.
ValidationError
Error returned when a contract value cannot satisfy a wire invariant.
ViewId
Opaque, bounded identity owned by the public protocol.
WorkspaceId
Opaque, bounded identity owned by the public protocol.

Enums§

BillingPeriodStatus
CapabilityKind
Capability category exposed by a provider or runtime.
ContextSdkIntegrationDepthV1
Integration coverage claimed by a session, never an agent-hosting mode.
ContextSessionPhaseV1
Lifecycle phase for a persisted Context SDK session snapshot.
ContextSessionRecoveryStateV1
Result of checking whether a persisted session can safely resume execution.
ContextStrategy
Strategy used to assemble context for a plan.
DataClassification
DataMovement
Boundary at which a capability moves data.
Determinism
Determinism guarantee made by a capability.
EngineFailureCodeV1
Stable failure taxonomy for a local Engine operation.
EngineObservationStatusV1
Terminal status of one Engine operation; it never controls the host loop.
EnginePolicyDecisionV1
The result of local policy admission before an Engine operation runs.
EngineValueClassificationV1
Whether an observation value was directly measured, derived as an estimate, or unavailable for the invocation.
EvidenceKind
ExperimentArm
Experiment arm assignment — signed by proprietary platform.
ExpiryBehavior
GapReason
Gap lifecycle — append-only audit events.
InvocationPolicyRoleV1
Required policy role in the invocation evidence join.
InvocationSourceRoleV1
Source role in the invocation’s complete source lineage.
PolicyCriticality
Policy class — determines fail behavior on expiry.
ReceiptEvidenceKindV1
Kind of payload referenced by a receipt.
ReceiptKeyAdmissionV1
Admission mode for signer keys. No key bytes are embedded in a receipt.
ReceiptTerminalStatusV1
Terminal state of the recorded execution.
ReceiptValueClassificationV1
Provenance class of one integer observation.
Reversibility
Whether a capability’s effects can be undone.
RiskClass
Risk class used for safety-sensitive routing.
SideEffectPolicy
SignatureStatus
StopCondition
Terminal condition selected by an execution plan.
TaskComplexity
Coarse task complexity used by policy and scheduling decisions.

Constants§

INVOCATION_CONTEXT_BINDING_SIGNATURE_DOMAIN
Domain prefix covered by an InvocationContextBindingV1 signature.
MAX_IDENTIFIER_LENGTH
Maximum size for an opaque identifier on the wire.
MAX_INVOCATION_CONTEXT_BINDING_ITEMS
Maximum source and capability entries in one binding.
MAX_INVOCATION_EVIDENCE_ITEMS
Maximum number of bindings of each manifest collection.
MAX_RECEIPT_ITEMS
Maximum array length in the receipt wire contract.
MAX_SAFE_INTEGER
Maximum integer that round-trips exactly through every v1 JSON consumer.
V1_SCHEMA_VERSION
The schema version implemented by this crate.

Functions§

deserialize_milliunit
Decode a required milliunit constrained to the inclusive 0..=1000 range.
deserialize_optional_milliunit
Decode an optional milliunit constrained to the inclusive 0..=1000 range.
deserialize_schema_version
Require the one schema version implemented by this crate during decoding.
validate_milliunit
Validate a 0..=1000 milliunit value on values built directly in Rust.
validate_schema_version
Validate a schema version on values built directly in Rust.

Type Aliases§

CurrencyCode
ISO 4217 currency code.