Skip to main content

khive_types/
lib.rs

1//! khive-types — core primitives and substrate data types.
2//!
3//! `#![no_std]` compatible. Minimal dependencies. No ID generation, no clock
4//! access, no panics. Substrate structs (Note, Entity, Event) are merged into
5//! this crate — they are the data shape that the rest of the runtime operates on.
6
7#![no_std]
8#![forbid(unsafe_code)]
9
10extern crate alloc;
11
12#[cfg(feature = "std")]
13extern crate std;
14
15pub mod agent;
16#[cfg(feature = "serde")]
17pub mod canonical_json;
18pub mod edge;
19pub mod entity;
20pub mod entity_type;
21pub mod error;
22pub mod event;
23pub mod hash;
24pub mod header;
25pub mod id;
26pub mod khive_error;
27pub mod namespace;
28pub mod note;
29pub mod operation;
30pub mod pack;
31pub mod refusal;
32pub mod substrate;
33pub mod timestamp;
34pub mod vector;
35
36pub use agent::{AgentRecord, AgentState, TerminalReason};
37#[cfg(feature = "serde")]
38pub use canonical_json::canonical_json_bytes;
39pub use edge::{EdgeCategory, EdgeRelation};
40pub use entity::{Entity, EntityKind, Link, PropertyValue};
41pub use entity_type::{
42    to_snake_case, EntityTypeDef, EntityTypeError, EntityTypeRegistry, ResolvedEntityType,
43};
44pub use error::{TypeError, UnknownVariant};
45pub use event::{
46    AggregateRef, ApplyResult, Event, EventBuilder, EventKind, EventOutcome, EventPayload,
47    ProposalAppliedPayload, ProposalDecision, ProposalReviewedPayload, ProposalWithdrawnPayload,
48    RerankExecutedPayload,
49};
50#[cfg(feature = "serde")]
51pub use event::{
52    EntityDraft, NoteDraft, ProposalChangeset, ProposalCreatedPayload, ProposalEntityPatch,
53};
54pub use hash::Hash32;
55pub use header::Header;
56pub use id::{Id128, ParseIdError};
57pub use khive_error::{Details, ErrorCode, ErrorDomain, ErrorKind, KhiveError, RetryHint};
58pub use namespace::Namespace;
59pub use note::{Note, NoteStatus};
60// REASON: `VerbDef` is marked `#[deprecated]` in pack.rs but still re-exported
61// here for callers that have not yet migrated to `HandlerDef`.
62// Remove this allow once all downstream crates are migrated.
63#[allow(deprecated)]
64pub use pack::VerbDef;
65pub use pack::{
66    EdgeEndpointRule, EndpointKind, HandlerDef, IdResolutionMode, NoteKindSpec, NoteLifecycleSpec,
67    Pack, PackColumnAddition, PackColumnAffinity, PackSchemaPlan, ParamDef, VerbCategory,
68    VerbPresentationPolicy, Visibility, RESERVED_ENVELOPE_ARGS,
69};
70pub use refusal::RefusalReason;
71pub use substrate::{SubstrateKind, SUBSTRATE_COUNT};
72pub use timestamp::Timestamp;
73pub use vector::DistanceMetric;
74
75pub use operation::{OperationAttribution, RefResolution};