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` and query compilation into a single Rust API surface.
4
5pub mod actor_identity;
6pub mod atomic_plan;
7pub mod atomic_prepare;
8pub mod atomic_runner;
9pub mod config;
10pub mod config_ledger;
11pub mod curation;
12#[cfg(unix)]
13pub mod daemon;
14pub mod embedder_registry;
15pub mod engine_config;
16pub mod error;
17pub mod fusion;
18pub mod graph_traversal;
19pub mod objectives;
20pub mod operations;
21pub mod pack;
22pub mod portability;
23pub mod presentation;
24pub mod reference_resolution;
25pub mod reference_ring;
26pub mod registry;
27pub mod resource;
28pub mod retrieval;
29pub mod runtime;
30pub mod secret_gate;
31pub mod validation;
32
33pub use actor_identity::{actor_is_unattributed, resolve_actor, should_warn_unattributed_actor};
34pub use atomic_plan::{
35    AffectedRowGuard, DeletePlan, GovernanceOp, GovernancePlan, GtdCompletePlan, GtdTransitionPlan,
36    LinkPlan, MergePlan, PlanPredicate, PlanStatement, PostCommitEffect, UpdatePlan,
37};
38pub use atomic_runner::{
39    run_atomic_unit, AtomicOpFailure, AtomicOpPlan, AtomicRunOutcome, AtomicRunnerError,
40};
41pub use curation::{
42    entity_fts_document, note_fts_document, ContentMergeStrategy, EdgeListFilter, EdgePatch,
43    EntityDedupMergePolicy, EntityPatch, MergeSummary, NotePatch,
44};
45#[cfg(unix)]
46pub use daemon::acquire_recovery_lock;
47pub use daemon::{
48    active_phase_names, background_task_count, pid_path, register_active_phase, run_daemon,
49    socket_path, track_background_task, DaemonDispatch, DaemonRequestFrame, DaemonResponseFrame,
50    PhaseGuard, PROTOCOL_VERSION,
51};
52pub use embedder_registry::{EmbedderProvider, EmbedderRegistry, LatticeEmbedderProvider};
53pub use engine_config::{
54    config_from_env, BackendConfig, BackendKind, ConfigError, EngineConfig, KhiveConfig, PackConfig,
55};
56pub use error::{fts_text_leg_or_err, GuardedWriteFailure, RuntimeError, RuntimeResult};
57pub use fusion::FusionStrategy;
58pub use graph_traversal::PathNode;
59pub use khive_db::{
60    checkpoint_once, run_checkpoint_task, run_migrations, CheckpointConfig, CheckpointTick,
61    ConnectionPool, StorageBackend,
62};
63pub use khive_gate::{
64    ActorRef, AllowAllGate, AuditDecision, AuditEvent, Gate, GateContext, GateDecision, GateError,
65    GateRef, GateRequest, Obligation,
66};
67pub use khive_storage::types::TraversalOptions;
68pub use khive_storage::{EventObservation, EventView, ObservationRole, ReferentKind};
69pub use khive_types::namespace::Namespace;
70pub use objectives::{
71    AmplifiedDecayAwareSalienceObjective, DecayAwareSalienceObjective, GraphProximityObjective,
72    MemoryRecallPipeline, NoteCandidate, RerankerObjective, RetrievalCandidate, RrfFusionObjective,
73    TemporalRecencyObjective, TextRelevanceObjective, VectorSimilarityObjective,
74};
75#[cfg(any(test, feature = "fault-injection"))]
76pub use operations::{
77    arm_fts_fail, arm_fts_fail_many, arm_fts_fail_many_partial, arm_rollback_cleanup_fail,
78    arm_vector_fail, arm_vector_fail_after,
79};
80pub use operations::{
81    base_entity_endpoint_rules, base_entity_rule_allows, endpoint_matches,
82    hex_prefix_to_uuid_pattern, merge_entry_metadata, EdgeEndpointKind, EntityCreateSpec, LinkSpec,
83    NoteSearchHit, QueryResult, Resolved,
84};
85pub use pack::{
86    resolve_explicit_namespace, DispatchHook, HandlerDef, KindHook, NoteKindSpec,
87    NoteLifecycleSpec, PackByIdResolver, PackFactory, PackInstall, PackLoadError, PackRegistration,
88    PackRegistry, PackRuntime, PackSchemaCollisionError, PackSchemaPlan, ParamDef, RequestIdentity,
89    SchemaPlan, VerbCategory, VerbPresentationPolicy, VerbRegistry, VerbRegistryBuilder,
90    Visibility,
91};
92pub use portability::{ImportSummary, KgArchive};
93pub use presentation::{
94    apply_redundancy_drop, micros_to_iso, present, render_format, OutputFormat, PresentationMode,
95};
96pub use reference_resolution::{resolve_reference, ReferenceCandidate, ReferenceResolution};
97pub use reference_ring::{ReferenceRing, RingEntry};
98pub use registry::{ObjectiveRegistry, RegisteredObjective};
99pub use resource::{cpu_delta_us, process_resource_usage, ProcessResourceUsage};
100pub use retrieval::{SearchHit, SearchSource};
101pub use runtime::{
102    assert_db_anchor_consistent, parse_pack_list, resolve_db_anchor, resolve_project_actor_id,
103    runtime_config_from_khive_config, BackendId, EntityTypeValidatorFn, KhiveRuntime,
104    NamespaceToken, NoteMutationHookFn, RuntimeConfig,
105};
106pub use secret_gate::SecretMatch;
107pub use validation::{
108    GraphPatch, GraphSnapshot, RuleFn, RuleId, Severity, ValidationContext, ValidationReport,
109    ValidationRule, Violation,
110};