Vibe.Gateway.Backend behaviour (vibe v0.2.1)

Copy Markdown View Source

Behaviour for external chat gateway backends.

Backends own platform details such as Telegram update payloads, Bot API clients, mentions, and auth rules. Vibe.Gateway.Runtime owns the generic Vibe flow: normalize, gate, derive a session key, and dispatch to a semantic session.

Summary

Types

config()

@type config() :: struct() | map()

normalized()

@type normalized() :: %{message: Vibe.Gateway.Message.t(), trigger: map()}

Callbacks

authorized?(t, trigger, config)

@callback authorized?(Vibe.Gateway.Message.t(), trigger :: map(), config()) :: boolean()

child_specs(config, runtime)

(optional)
@callback child_specs(config(), runtime :: pid()) :: [Supervisor.child_spec()]

load_config(keyword)

@callback load_config(keyword()) :: {:ok, config()} | {:error, term()}

normalize(term, config)

@callback normalize(term(), config()) :: {:ok, normalized()} | :ignore | {:error, term()}

outbound_adapter(config)

@callback outbound_adapter(config()) :: module()