pub struct KnowledgePack { /* private fields */ }Expand description
Knowledge corpus pack — atoms, domains, TF-IDF search, fold, import, and KG concept verbs.
Implementations§
Source§impl KnowledgePack
impl KnowledgePack
Sourcepub fn new(runtime: KhiveRuntime) -> Self
pub fn new(runtime: KhiveRuntime) -> Self
Create a new pack bound to the given runtime, initializing a shared ANN index.
Sourcepub fn new_with_index_role(
runtime: KhiveRuntime,
builds_corpus_indexes: bool,
) -> Self
pub fn new_with_index_role( runtime: KhiveRuntime, builds_corpus_indexes: bool, ) -> Self
As Self::new, but states whether this process may build the atom
index from the full corpus. See MemoryPack::new_with_index_role for the
reasoning; the two packs share one index root per model family and the
same cost.
Trait Implementations§
Source§impl Pack for KnowledgePack
impl Pack for KnowledgePack
Source§const NOTE_KINDS: &'static [&'static str]
const NOTE_KINDS: &'static [&'static str]
Source§const ENTITY_KINDS: &'static [&'static str]
const ENTITY_KINDS: &'static [&'static str]
Source§const BRAIN_CONSUMER_KINDS: &'static [&'static str]
const BRAIN_CONSUMER_KINDS: &'static [&'static str]
Source§const HANDLERS: &'static [HandlerDef]
const HANDLERS: &'static [HandlerDef]
Source§const REQUIRES: &'static [&'static str]
const REQUIRES: &'static [&'static str]
Source§const SCHEMA_PLAN: Option<PackSchemaPlan>
const SCHEMA_PLAN: Option<PackSchemaPlan>
Source§const EDGE_RULES: &'static [EdgeEndpointRule]
const EDGE_RULES: &'static [EdgeEndpointRule]
Source§const ENTITY_TYPES: &'static [EntityTypeDef]
const ENTITY_TYPES: &'static [EntityTypeDef]
(EntityKind, entity_type) registry (the entity_type axis is distinct from and
finer-grained than the closed EntityKind
taxonomy — see khive-types::entity_type::EntityTypeRegistry). Read moreSource§const NOTE_KIND_SPECS: &'static [NoteKindSpec]
const NOTE_KIND_SPECS: &'static [NoteKindSpec]
Source§const NOTE_PROPERTY_POLICIES: &'static [NotePropertyPolicySpec]
const NOTE_PROPERTY_POLICIES: &'static [NotePropertyPolicySpec]
Source§const NOTE_EMBEDDING_POLICIES: &'static [NoteEmbeddingPolicySpec]
const NOTE_EMBEDDING_POLICIES: &'static [NoteEmbeddingPolicySpec]
NOTE_KINDS.
Unlisted kinds retain the all-model default.Source§const SCHEMA_COLUMN_ADDITIONS: &'static [PackColumnAddition]
const SCHEMA_COLUMN_ADDITIONS: &'static [PackColumnAddition]
Source§const VALIDATION_RULES: &'static [&'static str]
const VALIDATION_RULES: &'static [&'static str]
Source§impl PackByIdResolver for KnowledgePack
impl PackByIdResolver for KnowledgePack
Source§fn resolve_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Resolved>, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn resolve_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Resolved>, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Resolve a live knowledge record by UUID.
Queries knowledge_domains first (canonical record), then
knowledge_atoms. The domain mirror atom shares the domain’s UUID
(crud.rs:279/300) so domains must win over the mirror.
Source§fn resolve_by_id_including_deleted<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Resolved>, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn resolve_by_id_including_deleted<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Resolved>, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Resolve a knowledge record including already-soft-deleted records.
Used by the hard-delete path to locate tombstoned records.
Source§fn delete_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
hard: bool,
) -> Pin<Box<dyn Future<Output = Result<Value, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
hard: bool,
) -> Pin<Box<dyn Future<Output = Result<Value, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete a knowledge domain or atom by UUID.
Soft-delete by default (hard=false): sets deleted_at = now().
For domains, also tombstones the mirror atom in knowledge_atoms.
Hard-delete (hard=true): permanently removes rows from the table(s).
Source§fn private_record_verbs(&self) -> &'static [&'static str]
fn private_record_verbs(&self) -> &'static [&'static str]
Source§impl PackRuntime for KnowledgePack
impl PackRuntime for KnowledgePack
Source§fn note_kinds(&self) -> &'static [&'static str]
fn note_kinds(&self) -> &'static [&'static str]
<Self as Pack>::NOTE_KINDS.Source§fn entity_kinds(&self) -> &'static [&'static str]
fn entity_kinds(&self) -> &'static [&'static str]
<Self as Pack>::ENTITY_KINDS.Source§fn brain_consumer_kinds(&self) -> &'static [&'static str]
fn brain_consumer_kinds(&self) -> &'static [&'static str]
<Self as Pack>::BRAIN_CONSUMER_KINDS.Source§fn handlers(&self) -> &'static [HandlerDef]
fn handlers(&self) -> &'static [HandlerDef]
<Self as Pack>::HANDLERS.Source§fn edge_rules(&self) -> &'static [EdgeEndpointRule]
fn edge_rules(&self) -> &'static [EdgeEndpointRule]
<Self as Pack>::EDGE_RULES.
Defaults to empty so existing packs that don’t extend the edge contract
can ignore it.Source§fn entity_types(&self) -> &'static [EntityTypeDef]
fn entity_types(&self) -> &'static [EntityTypeDef]
<Self as Pack>::ENTITY_TYPES.
Defaults to empty so existing packs that don’t extend the entity_type
registry can ignore it.Source§fn requires(&self) -> &'static [&'static str]
fn requires(&self) -> &'static [&'static str]
Source§fn note_kind_specs(&self) -> &'static [NoteKindSpec]
fn note_kind_specs(&self) -> &'static [NoteKindSpec]
Source§fn note_embedding_policies(&self) -> &'static [NoteEmbeddingPolicySpec]
fn note_embedding_policies(&self) -> &'static [NoteEmbeddingPolicySpec]
Source§fn schema_column_additions(&self) -> &'static [PackColumnAddition]
fn schema_column_additions(&self) -> &'static [PackColumnAddition]
Source§fn schema_plan(&self) -> SchemaPlan
fn schema_plan(&self) -> SchemaPlan
Source§fn warm<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn warm<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn dispatch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
verb: &'life1 str,
params: Value,
registry: &'life2 VerbRegistry,
token: &'life3 NamespaceToken,
) -> Pin<Box<dyn Future<Output = Result<Value, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn dispatch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
verb: &'life1 str,
params: Value,
registry: &'life2 VerbRegistry,
token: &'life3 NamespaceToken,
) -> Pin<Box<dyn Future<Output = Result<Value, RuntimeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Source§fn host_state(&self) -> Option<Arc<dyn Any + Sync + Send>>
fn host_state(&self) -> Option<Arc<dyn Any + Sync + Send>>
Source§fn validate_config(&self) -> Result<(), RuntimeError>
fn validate_config(&self) -> Result<(), RuntimeError>
Source§fn apply_profile_section_feedback<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_token: &'life1 NamespaceToken,
_profile_id: &'life2 str,
_section_signals: Value,
_target_attribution: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<Value, RuntimeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn apply_profile_section_feedback<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_token: &'life1 NamespaceToken,
_profile_id: &'life2 str,
_section_signals: Value,
_target_attribution: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<Value, RuntimeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Source§fn input_schema(&self, _verb: &str) -> Option<Value>
fn input_schema(&self, _verb: &str) -> Option<Value>
Source§fn note_property_policies(&self) -> &'static [NotePropertyPolicySpec]
fn note_property_policies(&self) -> &'static [NotePropertyPolicySpec]
Source§fn kind_hook(&self, _kind: &str) -> Option<Arc<dyn KindHook>>
fn kind_hook(&self, _kind: &str) -> Option<Arc<dyn KindHook>>
Source§fn context_contributor(&self) -> Option<Arc<dyn ContextContributor>>
fn context_contributor(&self) -> Option<Arc<dyn ContextContributor>>
Source§fn accept_channel_ingest_capability(&self, _capability: ChannelIngestCapability)
fn accept_channel_ingest_capability(&self, _capability: ChannelIngestCapability)
Source§fn validation_rules(&self) -> &'static [ValidationRule]
fn validation_rules(&self) -> &'static [ValidationRule]
Source§fn register_embedders(&self, _runtime: &KhiveRuntime)
fn register_embedders(&self, _runtime: &KhiveRuntime)
KhiveRuntime::embedder(name)
resolves provider names declared here. Default no-op — packs that only use
built-in lattice models do not need to override this.
See docs/api/pack.md#register_embedders for a usage example.Source§fn register_entity_type_validator(&self, _runtime: &KhiveRuntime)
fn register_entity_type_validator(&self, _runtime: &KhiveRuntime)
create_many/create_entity reject unregistered entity_type values at the
runtime layer. Default no-op leaves the validator absent (skip-when-None).
See docs/api/pack.md#register_entity_type_validator for the two-hook compatibility contract.Source§fn register_entity_type_validator_with_types(
&self,
runtime: &KhiveRuntime,
_pack_entity_types: &[EntityTypeDef],
)
fn register_entity_type_validator_with_types( &self, runtime: &KhiveRuntime, _pack_entity_types: &[EntityTypeDef], )
ENTITY_TYPES (VerbRegistry::all_entity_types).
Defaults to calling register_entity_type_validator
with just the runtime. call_register_entity_type_validators calls this hook, not
the simpler one — override this to receive the composed vocabulary.
See docs/api/pack.md#register_entity_type_validator for the two-hook compatibility contract.Source§fn register_note_mutation_hook(&self, _runtime: &KhiveRuntime)
fn register_note_mutation_hook(&self, _runtime: &KhiveRuntime)
register_entity_type_validator. Packs
that cache derived state keyed by note content (e.g. khive-pack-memory’s warm
ANN index) override this to install a hook via
KhiveRuntime::install_note_mutation_hook. Default no-op leaves the hook absent.
See docs/api/pack.md#register_note_mutation_hook for cross-pack notification rationale.Source§fn register_note_search_ann_provider(&self, _runtime: &KhiveRuntime)
fn register_note_search_ann_provider(&self, _runtime: &KhiveRuntime)
Source§fn register_note_write_validator(&self, _runtime: &KhiveRuntime)
fn register_note_write_validator(&self, _runtime: &KhiveRuntime)
register_note_mutation_hook. Read moreSource§fn registered_embedding_model_names(&self) -> Vec<String>
fn registered_embedding_model_names(&self) -> Vec<String>
docs/api/pack.md#registered_embedding_model_names for the ADR-103 consumer.fn mounted_namespace(&self) -> Option<&str>
Source§fn mounted_catalog_snapshot(&self) -> Vec<MountedVerb>
fn mounted_catalog_snapshot(&self) -> Vec<MountedVerb>
fn mounted_catalog<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<MountedVerb>, RuntimeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn dispatch_mounted<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
_definition: &'life1 MountedVerb,
verb: &'life2 str,
params: Value,
registry: &'life3 VerbRegistry,
token: &'life4 NamespaceToken,
) -> Pin<Box<dyn Future<Output = Result<Value, RuntimeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Self: 'async_trait,
Source§fn dispatch_search_intercepted<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_params: Value,
_registry: &'life1 VerbRegistry,
_token: &'life2 NamespaceToken,
) -> Pin<Box<dyn Future<Output = Result<InterceptedDispatchResult<Option<(NoteStatusSelector, u64)>>, RuntimeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn dispatch_search_intercepted<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_params: Value,
_registry: &'life1 VerbRegistry,
_token: &'life2 NamespaceToken,
) -> Pin<Box<dyn Future<Output = Result<InterceptedDispatchResult<Option<(NoteStatusSelector, u64)>>, RuntimeError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Auto Trait Implementations§
impl !Freeze for KnowledgePack
impl !RefUnwindSafe for KnowledgePack
impl !UnwindSafe for KnowledgePack
impl Forget for KnowledgePack
impl Move for KnowledgePack
impl Send for KnowledgePack
impl Sync for KnowledgePack
impl Unpin for KnowledgePack
impl UnsafeUnpin for KnowledgePack
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more