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 email_address;
20pub mod entity;
21pub mod entity_type;
22pub mod error;
23pub mod event;
24pub mod hash;
25pub mod header;
26pub mod id;
27#[cfg(feature = "serde")]
28pub mod json_type;
29pub mod khive_error;
30pub mod namespace;
31pub mod note;
32pub mod operation;
33pub mod pack;
34pub mod refusal;
35pub mod sql_like;
36pub mod substrate;
37pub mod timestamp;
38pub mod vector;
39
40pub use agent::{AgentRecord, AgentState, TerminalReason};
41#[cfg(feature = "serde")]
42pub use canonical_json::canonical_json_bytes;
43pub use edge::{EdgeCategory, EdgeRelation};
44pub use entity::{Entity, EntityKind, Link, PropertyValue};
45pub use entity_type::{
46    to_snake_case, EntityTypeDef, EntityTypeError, EntityTypeRegistry, ResolvedEntityType,
47};
48pub use error::{TypeError, UnknownVariant};
49pub use event::{
50    AggregateRef, ApplyResult, Event, EventBuilder, EventKind, EventOutcome, EventPayload,
51    ProposalAppliedPayload, ProposalDecision, ProposalReviewedPayload, ProposalWithdrawnPayload,
52    RerankExecutedPayload, ToolCheckDecidedPayload,
53};
54#[cfg(feature = "serde")]
55pub use event::{
56    EntityDraft, NoteDraft, ProposalChangeset, ProposalCreatedPayload, ProposalEntityPatch,
57};
58pub use hash::Hash32;
59pub use header::Header;
60pub use id::{Id128, ParseIdError};
61#[cfg(feature = "serde")]
62pub use json_type::json_type_name;
63pub use khive_error::{Details, ErrorCode, ErrorDomain, ErrorKind, KhiveError, RetryHint};
64pub use namespace::Namespace;
65pub use note::{Note, NoteStatus};
66// REASON: `VerbDef` is marked `#[deprecated]` in pack.rs but still re-exported
67// here for callers that have not yet migrated to `HandlerDef`.
68// Remove this allow once all downstream crates are migrated.
69#[allow(deprecated)]
70pub use pack::VerbDef;
71pub use pack::{
72    EdgeEndpointRule, EndpointKind, HandlerDef, IdResolutionMode, NoteEmbeddingPolicy,
73    NoteEmbeddingPolicySpec, NoteKindSpec, NoteLifecycleSpec, Pack, PackColumnAddition,
74    PackColumnAffinity, PackSchemaPlan, ParamDef, VerbCategory, VerbPresentationPolicy, Visibility,
75    RESERVED_ENVELOPE_ARGS,
76};
77pub use refusal::RefusalReason;
78pub use sql_like::escape_like_literal;
79pub use substrate::{SubstrateKind, SUBSTRATE_COUNT};
80pub use timestamp::Timestamp;
81pub use vector::DistanceMetric;
82
83pub use operation::{OperationAttribution, RefResolution};