Skip to main content

PackRegistry

Struct PackRegistry 

Source
pub struct PackRegistry;
Expand description

Registry of pack factories discovered via inventory at link time.

No instance is needed — all methods are associated functions that walk the globally-collected PackRegistration slice.

Implementations§

Source§

impl PackRegistry

Source

pub fn discovered_names() -> Vec<&'static str>

Names of all pack factories discovered via inventory.

Source

pub fn register_packs( names: &[String], runtime: KhiveRuntime, builder: &mut VerbRegistryBuilder, ) -> Result<(), PackLoadError>

Register the named packs into builder using the supplied runtime.

Validates the explicit pack list against PackFactory::requires() — if any requested pack declares a dependency that is absent from names, registration fails (missing dependency is a boot error, not silently auto-added). Callers must include all required packs explicitly.

The VerbRegistryBuilder::build topo-sort enforces correct load order.

Returns Ok(()) when all names are recognised and all declared dependencies are satisfied; returns Err(PackLoadError) with a distinct variant for unknown pack vs missing dependency.

Source

pub fn build_ingest_registry( runtime: &KhiveRuntime, audit_store: IngestAuditStore, ) -> Result<VerbRegistry, RuntimeError>

Build a VerbRegistry from runtime’s own configuration: gate, default namespace, visible namespaces, actor id, and the configured pack set, then install the registry’s aggregated edge rules back onto runtime. This is the wiring shared by every one-shot CLI ingest path (kkernel code-ingest, kkernel git-ingest) that needs a real registry to dispatch through outside of a live MCP server.

audit_store selects whether the registry gets the runtime’s event store; see IngestAuditStore for what each variant does.

This helper carries only the subset every ingest path duplicated verbatim. The MCP server’s own registry construction additionally wires channel-loop admission, config_id, embedder/entity-type/ note-mutation-hook registration, schema-plan application, and the WAL checkpoint pool handle — all server-only concerns a one-shot CLI pass has no use for, so KhiveMcpServer::with_packs keeps its own construction rather than calling this helper.

Source

pub fn register_packs_with_runtimes( names: &[String], runtimes: &HashMap<String, KhiveRuntime>, default_runtime: &KhiveRuntime, builder: &mut VerbRegistryBuilder, ) -> Result<(), PackLoadError>

Register the named packs into builder, routing each pack to its own runtime.

runtimes maps pack name → KhiveRuntime (one per backend assignment). default_runtime is used for any pack whose name is not in runtimes. The validation logic (unknown pack, missing dependency) is identical to PackRegistry::register_packs.

This is the multi-backend boot path (ADR-028). Single-backend callers should continue using PackRegistry::register_packs.

Source

pub fn register_packs_with_runtimes_with_extra_factories( extra_factories: &[&'static dyn PackFactory], names: &[String], runtimes: &HashMap<String, KhiveRuntime>, default_runtime: &KhiveRuntime, builder: &mut VerbRegistryBuilder, ) -> Result<(), PackLoadError>

Like Self::register_packs_with_runtimes, but resolves pack names against the link-time inventory registry plus extra_factories — pack factories the composition root supplies directly rather than discovers through inventory::iter::<PackRegistration> (ADR-191 D6, ADR-192 S4: “a pack compiled outside this repository … extends the web ontology without any change here” — a host binary that depends on a pinned khive revision plus an out-of-tree pack crate, or a composition root registering a credential-provider/request-hook consumer pack, has no inventory presence in this binary short of its own force-link anchor). An inventory-discovered factory always wins a name collision with an extra_factories entry — the linked set is the trusted default; an extra factory only fills a name inventory does not already answer.

This is the seam D6 describes as “kkernel exposes its server construction as a library entry point that accepts additional pack factories” — the kkernel library entry point itself lives in kkernel::compose, built on this function exactly as khive-mcp/src/serve.rs builds on Self::register_packs_with_runtimes.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more