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    ToolRegistrationChangedPayload,
68};
69#[cfg(feature = "serde")]
70pub use event::{
71    EntityDraft, NoteDraft, ProposalChangeset, ProposalCreatedPayload, ProposalEntityPatch,
72};
73pub use hash::{fnv1a_64, Hash32};
74pub use header::Header;
75pub use id::{is_lowercase_hex, Id128, ParseIdError};
76#[cfg(feature = "serde")]
77pub use json_type::json_type_name;
78pub use khive_error::{Details, ErrorCode, ErrorDomain, ErrorKind, KhiveError, RetryHint};
79pub use namespace::Namespace;
80pub use note::{Note, NoteStatus};
81// REASON: `VerbDef` is marked `#[deprecated]` in pack.rs but still re-exported
82// here for callers that have not yet migrated to `HandlerDef`.
83// Remove this allow once all downstream crates are migrated.
84#[allow(deprecated)]
85pub use pack::VerbDef;
86pub use pack::{
87    EdgeEndpointRule, EndpointKind, HandlerDef, IdResolutionMode, NoteEmbeddingPolicy,
88    NoteEmbeddingPolicySpec, NoteKindSpec, NoteLifecycleSpec, NotePropertyPolicySpec, Pack,
89    PackColumnAddition, PackColumnAffinity, PackSchemaPlan, ParamDef, PropertyPolicy, VerbCategory,
90    VerbPresentationPolicy, Visibility, RESERVED_ENVELOPE_ARGS,
91};
92pub use refusal::RefusalReason;
93pub use sql_like::escape_like_literal;
94pub use substrate::{SubstrateKind, SUBSTRATE_COUNT};
95#[cfg(feature = "serde")]
96pub use tag_match::tag_contains;
97pub use timestamp::Timestamp;
98pub use vector::DistanceMetric;
99
100pub use operation::{OperationAttribution, RefResolution};