SkillKit.Webhook (SkillKit v0.1.0)

Copy Markdown View Source

Primary struct and public facade for the webhook adapter.

A %SkillKit.Webhook{} represents a registered HTTP endpoint bound to an agent. Inbound requests matching the webhook's id are verified, then cast as user messages to the agent's mailbox.

The module also acts as a supervisor facade: {SkillKit.Webhook, opts} in an application tree starts SkillKit.Webhook.Supervisor and its children (Registry, Store, Idempotency). Public API calls (register/2 etc.) take a supervisor: option that defaults to SkillKit.Webhook; multi-tenant setups override it per tree.

Summary

Types

filter()

@type filter() :: map()

idempotency_config()

@type idempotency_config() :: map() | nil

t()

@type t() :: %SkillKit.Webhook{
  agent_name: String.t(),
  id: String.t(),
  idempotency: idempotency_config(),
  inserted_at: DateTime.t(),
  prompt: String.t(),
  verifier: verifier_binding()
}

verifier_binding()

@type verifier_binding() :: {module(), map()}

Functions

child_spec(opts)

See SkillKit.Webhook.Supervisor.child_spec/1.

get(id, opts \\ [])

@spec get(
  String.t(),
  keyword()
) :: {:ok, t()} | {:error, :not_found}

list(filter \\ %{}, opts)

@spec list(
  filter(),
  keyword()
) :: {:ok, [t()]}

register(webhook, opts \\ [])

@spec register(
  t(),
  keyword()
) :: :ok | {:error, term()}

unregister(id, opts \\ [])

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

url(webhook, opts \\ [])

@spec url(
  t(),
  keyword()
) :: String.t()

Builds the externally-visible URL for a webhook.