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