Skip to main content

khive_runtime/
lib.rs

1//! khive-runtime: composable Service API used by daemon, MCP server, and CLI.
2//!
3//! Wraps `StorageBackend` + query compilation into a single Rust API.
4//!
5//! # Quick start
6//!
7//! ```ignore
8//! use khive_runtime::{KhiveRuntime, RuntimeConfig};
9//! use khive_types::Namespace;
10//!
11//! // In-memory for tests:
12//! let rt = KhiveRuntime::memory()?;
13//! let tok = rt.authorize(Namespace::local()).unwrap();
14//!
15//! // Create an entity:
16//! let entity = rt.create_entity(&tok, "concept", None, "LoRA", None, None, vec![]).await?;
17//!
18//! // Link two entities:
19//! let edge = rt.link(&tok, entity.id, other_id, EdgeRelation::Extends, 1.0, None).await?;
20//! ```
21
22pub mod curation;
23#[cfg(unix)]
24pub mod daemon;
25pub mod embedder_registry;
26pub mod engine_config;
27pub mod error;
28pub mod fusion;
29pub mod graph_traversal;
30pub mod objectives;
31pub mod operations;
32pub mod pack;
33pub mod portability;
34pub mod presentation;
35pub mod registry;
36pub mod retrieval;
37pub mod runtime;
38pub mod validation;
39
40pub use curation::{
41    ContentMergeStrategy, EdgeListFilter, EdgePatch, EntityDedupMergePolicy, EntityPatch,
42    MergeSummary, NotePatch,
43};
44#[cfg(unix)]
45pub use daemon::{
46    pid_path, run_daemon, socket_path, DaemonDispatch, DaemonRequestFrame, DaemonResponseFrame,
47};
48pub use embedder_registry::{EmbedderProvider, EmbedderRegistry, LatticeEmbedderProvider};
49pub use engine_config::{config_from_env, ConfigError, EngineConfig, KhiveConfig};
50pub use error::{RuntimeError, RuntimeResult};
51pub use fusion::FusionStrategy;
52pub use graph_traversal::{PathNode, TraversalOptions};
53pub use khive_gate::{
54    ActorRef, AllowAllGate, AuditDecision, AuditEvent, Gate, GateContext, GateDecision, GateError,
55    GateRef, GateRequest, Obligation,
56};
57pub use khive_storage::{EventObservation, EventView, ObservationRole, ReferentKind};
58pub use khive_types::namespace::Namespace;
59pub use objectives::{
60    AmplifiedDecayAwareSalienceObjective, DecayAwareSalienceObjective, GraphProximityObjective,
61    MemoryRecallPipeline, NoteCandidate, RerankerObjective, RetrievalCandidate, RrfFusionObjective,
62    TemporalRecencyObjective, TextRelevanceObjective, VectorSimilarityObjective,
63};
64pub use operations::{LinkSpec, NoteSearchHit, QueryResult, Resolved};
65pub use pack::{
66    DispatchHook, HandlerDef, KindHook, NoteKindSpec, NoteLifecycleSpec, PackFactory,
67    PackLoadError, PackRegistration, PackRegistry, PackRuntime, PackSchemaPlan, ParamDef,
68    SchemaPlan, VerbCategory, VerbPresentationPolicy, VerbRegistry, VerbRegistryBuilder,
69    Visibility,
70};
71pub use portability::{ImportSummary, KgArchive};
72pub use presentation::{micros_to_iso, present, PresentationMode};
73pub use registry::{ObjectiveRegistry, RegisteredObjective};
74pub use retrieval::{SearchHit, SearchSource};
75pub use runtime::{
76    parse_pack_list, runtime_config_from_khive_config, BackendId, KhiveRuntime, NamespaceToken,
77    RuntimeConfig,
78};
79pub use validation::{
80    GraphPatch, GraphSnapshot, RuleFn, RuleId, Severity, ValidationContext, ValidationReport,
81    ValidationRule, Violation,
82};