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