WardrikTriggers. Target behaviour
(wardrik_triggers v0.1.0-rc.1)
Copy Markdown
Connects triggers to your agents. Given to WardrikTriggers as :target, as {module, config}.
Each callback gets config as its first argument.
Summary
Callbacks
Asks agent_id prompt.
Called after every run of trigger, with how it went.
Returns the secret name held for agent_id. A webhook names it as ${NAME}.
Callbacks
@callback ask( config :: term(), agent_id :: String.t(), prompt :: String.t(), opts :: [trigger: String.t(), overlap: :skip | :queue, labels: [String.t()]] ) :: :asked | :busy | :no_agent | {:error, term()}
Asks agent_id prompt.
Options
:trigger- the trigger's name.:overlap-:skipto return:busyand ask nothing while the agent is busy.:queueto ask anyway.:labels-["outside"]when the prompt holds feed entries or a webhook body.[]otherwise.
Return :no_agent if there's no such agent. {:error, reason} is logged and reported as
:failed.
@callback fired( config :: term(), agent_id :: String.t(), trigger :: String.t(), WardrikTriggers.Trigger.status() ) :: :ok
Called after every run of trigger, with how it went.
@callback resolve_secret(config :: term(), agent_id :: String.t(), name :: String.t()) :: {:ok, String.t()} | :error
Returns the secret name held for agent_id. A webhook names it as ${NAME}.