SkillKit.Webhook.Registry (SkillKit v0.1.0)

Copy Markdown View Source

Per-node directory of running agents the webhook Plug can dispatch to.

Populated automatically by SkillKit.Webhook.Lifecycle when an agent boots (:pre_agent hook). Each attached agent's per-agent Registry process is monitored; :DOWN purges the entry. Re-attach (after an agent restart) overwrites the prior entry and replaces the monitor, guarding against stale :DOWN messages deleting the fresh binding.

Two ETS tables keyed off the supervisor name:

  • agents : agent_name → %SkillKit.Agent{}
  • monitors : monitor_ref → agent_name

Summary

Functions

Binds agent.name to the running %Agent{} and monitors its per-agent registry process. Called by Webhook.Lifecycle from the :pre_agent hook; hosts should not call this directly.

Returns a specification to start this module under a supervisor.

Functions

attach(agent, opts)

@spec attach(
  SkillKit.Agent.t(),
  keyword()
) :: :ok

Binds agent.name to the running %Agent{} and monitors its per-agent registry process. Called by Webhook.Lifecycle from the :pre_agent hook; hosts should not call this directly.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

detach(agent_name, opts)

@spec detach(
  String.t(),
  keyword()
) :: :ok

start_link(opts)

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

whereis(agent_name, opts)

@spec whereis(
  String.t(),
  keyword()
) :: {:ok, SkillKit.Agent.t()} | {:error, :agent_not_running}