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