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;
23pub mod daemon;
24pub mod embedder_registry;
25pub mod engine_config;
26pub mod error;
27pub mod fusion;
28pub mod graph_traversal;
29pub mod objectives;
30pub mod operations;
31pub mod pack;
32pub mod portability;
33pub mod presentation;
34pub mod registry;
35pub mod retrieval;
36pub mod runtime;
37pub mod validation;
38
39pub use curation::{
40    ContentMergeStrategy, EdgeListFilter, EdgePatch, EntityDedupMergePolicy, EntityPatch,
41    MergeSummary, NotePatch,
42};
43pub use daemon::{
44    pid_path, run_daemon, socket_path, DaemonDispatch, DaemonRequestFrame, DaemonResponseFrame,
45};
46pub use embedder_registry::{EmbedderProvider, EmbedderRegistry, LatticeEmbedderProvider};
47pub use engine_config::{config_from_env, ConfigError, EngineConfig, KhiveConfig};
48pub use error::{RuntimeError, RuntimeResult};
49pub use fusion::FusionStrategy;
50pub use graph_traversal::{PathNode, TraversalOptions};
51pub use khive_gate::{
52    ActorRef, AllowAllGate, AuditDecision, AuditEvent, Gate, GateContext, GateDecision, GateError,
53    GateRef, GateRequest, Obligation,
54};
55pub use khive_storage::{EventObservation, EventView, ObservationRole, ReferentKind};
56pub use khive_types::namespace::Namespace;
57pub use objectives::{
58    AmplifiedDecayAwareSalienceObjective, DecayAwareSalienceObjective, GraphProximityObjective,
59    MemoryRecallPipeline, NoteCandidate, RerankerObjective, RetrievalCandidate, RrfFusionObjective,
60    TemporalRecencyObjective, TextRelevanceObjective, VectorSimilarityObjective,
61};
62pub use operations::{LinkSpec, NoteSearchHit, QueryResult, Resolved};
63pub use pack::{
64    DispatchHook, HandlerDef, KindHook, NoteKindSpec, NoteLifecycleSpec, PackFactory,
65    PackLoadError, PackRegistration, PackRegistry, PackRuntime, PackSchemaPlan, ParamDef,
66    SchemaPlan, VerbCategory, VerbPresentationPolicy, VerbRegistry, VerbRegistryBuilder,
67    Visibility,
68};
69pub use portability::{ImportSummary, KgArchive};
70pub use presentation::{micros_to_iso, present, PresentationMode};
71pub use registry::{ObjectiveRegistry, RegisteredObjective};
72pub use retrieval::{SearchHit, SearchSource};
73pub use runtime::{
74    parse_pack_list, runtime_config_from_khive_config, BackendId, KhiveRuntime, NamespaceToken,
75    RuntimeConfig,
76};
77pub use validation::{
78    GraphPatch, GraphSnapshot, RuleFn, RuleId, Severity, ValidationContext, ValidationReport,
79    ValidationRule, Violation,
80};