MingaAgent.Hooks.Registry (Minga v0.1.0)

Copy Markdown View Source

Source-owned registry for extension-contributed agent hooks.

User config hooks still live on MingaAgent.Config. Extension hooks are normalized here so session lifecycle hooks and provider tool hooks read the same source-aware view, and extension cleanup can remove a whole source deterministically.

Summary

Types

Registry entry for one normalized hook.

Source that contributed hooks.

Functions

Returns all normalized hooks in registration order.

Returns all registry entries in registration order.

Registers a source-owned batch of raw hook declarations. Same-source batches replace prior entries.

Starts the hook registry.

Removes all hooks owned by a source.

Types

entry()

@type entry() :: %{source: source(), id: String.t(), hook: MingaAgent.Hooks.Hook.t()}

Registry entry for one normalized hook.

source()

Source that contributed hooks.

state()

@type state() :: [entry()]

Functions

all()

@spec all() :: [MingaAgent.Hooks.Hook.t()]

Returns all normalized hooks in registration order.

entries()

@spec entries() :: [entry()]

Returns all registry entries in registration order.

register_many(source, hooks, opts \\ [])

@spec register_many(source(), [{atom() | String.t(), keyword()}], keyword()) :: :ok

Registers a source-owned batch of raw hook declarations. Same-source batches replace prior entries.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Starts the hook registry.

unregister_source(source)

@spec unregister_source(source()) :: :ok

Removes all hooks owned by a source.