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