pub struct VerbRegistry { /* private fields */ }Expand description
Immutable registry that dispatches verb calls to registered packs.
Clone is cheap (Arc-wrapped). Constructed via VerbRegistryBuilder.
Implementations§
Source§impl VerbRegistry
impl VerbRegistry
Sourcepub fn describe_verb(&self, verb: &str) -> Result<Value, RuntimeError>
pub fn describe_verb(&self, verb: &str) -> Result<Value, RuntimeError>
Return the help schema envelope for a verb (issue #287).
Walks registered packs for the first matching HandlerDef and returns a
structured JSON envelope. Subhandlers carry callable_via_mcp: false.
Unknown verbs return RuntimeError::InvalidInput. Full shape documented
in docs/protocol.md §Request Schema.
Sourcepub async fn dispatch(
&self,
verb: &str,
params: Value,
) -> Result<Value, RuntimeError>
pub async fn dispatch( &self, verb: &str, params: Value, ) -> Result<Value, RuntimeError>
Dispatch a verb to the first pack that handles it.
Routes through the gate, then invokes the matching pack handler. When
params["help"] == true, short-circuits to describe_verb with no side effects.
Gate errors are fail-open. Full dispatch flow documented in docs/protocol.md.
Sourcepub fn find_kind_hook(&self, kind: &str) -> Option<Arc<dyn KindHook>>
pub fn find_kind_hook(&self, kind: &str) -> Option<Arc<dyn KindHook>>
Find a kind hook among the registered packs.
Walks packs in registration order; the first pack that both owns the
kind (declares it in note_kinds() or entity_kinds()) and returns
a hook from kind_hook(kind) wins. Returns None if the kind is
unknown to all packs or no owning pack registered a hook.
Sourcepub fn all_verbs(&self) -> Vec<&'static HandlerDef>
pub fn all_verbs(&self) -> Vec<&'static HandlerDef>
All MCP-exposed handlers across all registered packs (Visibility::Verb only).
Subhandlers (Visibility::Subhandler) are excluded — they are internal
pipeline steps not surfaced on the MCP wire (F118). Returned with 'static
lifetime since pack handlers are &'static [HandlerDef] constants.
Sourcepub fn all_verbs_with_names(&self) -> Vec<(&str, &'static HandlerDef)>
pub fn all_verbs_with_names(&self) -> Vec<(&str, &'static HandlerDef)>
All MCP-exposed handlers paired with the name of the pack that owns them
(Visibility::Verb only).
Subhandlers (Visibility::Subhandler) are excluded from the MCP catalog
(F118-F123). Use all_handlers_with_names when internal handlers must
also be enumerated (e.g. runtime introspection).
Sourcepub fn all_handlers_with_names(&self) -> Vec<(&str, &'static HandlerDef)>
pub fn all_handlers_with_names(&self) -> Vec<(&str, &'static HandlerDef)>
All handler definitions across all registered packs, including subhandlers.
Unlike all_verbs, this includes Visibility::Subhandler entries. Useful
for runtime introspection (e.g. list_handlers) and tooling that needs
the complete handler surface.
Sourcepub fn all_note_kinds(&self) -> Vec<&'static str>
pub fn all_note_kinds(&self) -> Vec<&'static str>
Merged set of note kinds across all registered packs (deduplicated, first-seen order preserved).
Sourcepub fn all_entity_kinds(&self) -> Vec<&'static str>
pub fn all_entity_kinds(&self) -> Vec<&'static str>
Merged set of entity kinds across all registered packs (deduplicated, first-seen order preserved).
Sourcepub fn pack_names(&self) -> Vec<&str>
pub fn pack_names(&self) -> Vec<&str>
Names of packs in topological load order.
Sourcepub fn pack_requires(&self, name: &str) -> Option<&'static [&'static str]>
pub fn pack_requires(&self, name: &str) -> Option<&'static [&'static str]>
Declared dependencies for a registered pack.
Sourcepub fn pack_note_kinds(&self, name: &str) -> Option<&'static [&'static str]>
pub fn pack_note_kinds(&self, name: &str) -> Option<&'static [&'static str]>
Note kinds owned by a specific registered pack.
Returns None if no pack with name is registered. The slice is
the pack’s NOTE_KINDS constant — 'static lifetime, no allocation.
Sourcepub fn pack_entity_kinds(&self, name: &str) -> Option<&'static [&'static str]>
pub fn pack_entity_kinds(&self, name: &str) -> Option<&'static [&'static str]>
Entity kinds owned by a specific registered pack.
Returns None if no pack with name is registered. The slice is
the pack’s ENTITY_KINDS constant — 'static lifetime, no allocation.
Sourcepub fn pack_verbs(&self, name: &str) -> Option<&'static [HandlerDef]>
pub fn pack_verbs(&self, name: &str) -> Option<&'static [HandlerDef]>
Handlers declared by a specific registered pack.
Returns None if no pack with name is registered. Each HandlerDef
carries name + description + visibility — sufficient for introspection clients.
Sourcepub fn all_edge_rules(&self) -> Vec<EdgeEndpointRule>
pub fn all_edge_rules(&self) -> Vec<EdgeEndpointRule>
All pack-declared edge endpoint rules across registered packs.
Order follows topological pack registration; duplicates are not deduplicated — validation only checks membership, and an exact-duplicate rule is a harmless restatement.
Sourcepub fn all_note_kind_specs(&self) -> Vec<&'static NoteKindSpec>
pub fn all_note_kind_specs(&self) -> Vec<&'static NoteKindSpec>
Collect all NoteKindSpec declarations from every loaded pack.
Used by the runtime for lifecycle introspection and future enforcement.
Sourcepub fn all_validation_rules(&self) -> Vec<&'static ValidationRule>
pub fn all_validation_rules(&self) -> Vec<&'static ValidationRule>
All pack-contributed validation rules across registered packs.
Returns references into the pack-owned 'static slices — no allocation
beyond the outer Vec. Rule IDs are namespaced by pack; callers can
group by rule.id.split_once('/') to attribute rules to their packs.
Sourcepub fn all_schema_plans(&self) -> Vec<SchemaPlan>
pub fn all_schema_plans(&self) -> Vec<SchemaPlan>
Pack-auxiliary schema plans for all registered packs.
Returns one SchemaPlan per pack. Callers (typically the runtime
bootstrap) apply each plan to the pack’s assigned backend. Empty plans
are included so the caller can iterate uniformly; callers that want to
skip empty plans should check plan.is_empty().
Sourcepub fn call_register_embedders(&self, runtime: &KhiveRuntime)
pub fn call_register_embedders(&self, runtime: &KhiveRuntime)
Invoke PackRuntime::register_embedders on every registered pack.
Called by the transport during startup, after the registry is built and
before the first verb dispatch, so that custom embedding providers
contributed by packs are reachable via KhiveRuntime::embedder(name).
Packs whose register_embedders is the default no-op pay no overhead.
The method is idempotent when the underlying registry uses last-wins
semantics for duplicate provider names.
Sourcepub async fn call_warm_all(&self)
pub async fn call_warm_all(&self)
Invoke PackRuntime::warm on every registered pack.
Called by the daemon at boot (in a background task) so expensive in-memory
state (ANN indexes) is pre-loaded without blocking request serving.
Sourcepub fn presentation_policy_for(&self, verb: &str) -> VerbPresentationPolicy
pub fn presentation_policy_for(&self, verb: &str) -> VerbPresentationPolicy
Resolve the presentation policy for a verb name.
Walks all registered handlers (including subhandlers) for the first
matching name and returns its declared VerbPresentationPolicy.
Returns Standard for unknown verbs — unknown verbs will fail at
dispatch anyway, so the fallback here is safe.
Sourcepub fn is_subhandler_verb(&self, verb: &str) -> bool
pub fn is_subhandler_verb(&self, verb: &str) -> bool
Returns true if the named verb exists and is tagged
Visibility::Subhandler (internal / operator-only).
Used by the MCP server to gate subhandler invocation at the wire boundary without blocking internal callers that invoke the same verbs through the runtime directly.
Sourcepub fn apply_schema_plans(&self, backend: &StorageBackend)
pub fn apply_schema_plans(&self, backend: &StorageBackend)
Apply all non-empty pack-auxiliary schema plans to the given backend (c12 startup application).
This is the centralized startup hook that replaced the previous lazy
per-pack self-bootstrap pattern. Each pack’s SchemaPlan carries
idempotent CREATE TABLE IF NOT EXISTS DDL; calling this more than once
is safe. Empty plans are skipped.
Errors from individual plans are logged via tracing::warn! and not
propagated so that a single pack’s schema failure does not prevent the
rest from loading. Callers that need hard-failure semantics should call
all_schema_plans() and apply each plan individually.
Trait Implementations§
Source§impl Clone for VerbRegistry
impl Clone for VerbRegistry
Source§fn clone(&self) -> VerbRegistry
fn clone(&self) -> VerbRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more