Wardrik.Notice (wardrik_protocol v0.1.0-rc.1)

Copy Markdown

Tells someone what an agent did while nobody watched.

agent is the agent's ID. at is when it happened. kind is one of:

  • :parked - a turn waits on a person. calls lists each Wardrik.Interrupt, with the arguments the model wrote, where known.
  • :failed - a turn failed. reason says why.
  • :finished - a turn answered. text is the answer.

Summary

Types

A call a parked turn waits on, with its arguments.

t()

Functions

Returns the notice's event name: turn_parked, turn_failed or turn_finished.

Returns the notice as the JSON a webhook receives.

Returns every kind of notice.

Types

call()

@type call() :: %{interrupt: Wardrik.Interrupt.t(), arguments: term()}

A call a parked turn waits on, with its arguments.

kind()

@type kind() :: :parked | :failed | :finished

t()

@type t() :: %Wardrik.Notice{
  agent: String.t(),
  at: DateTime.t(),
  calls: [call()],
  kind: kind(),
  reason: String.t() | nil,
  text: String.t() | nil
}

Functions

event(notice)

@spec event(t()) :: String.t()

Returns the notice's event name: turn_parked, turn_failed or turn_finished.

json(notice)

@spec json(t()) :: map()

Returns the notice as the JSON a webhook receives.

Wardrik.Notice.json(notice)
#=> %{"event" => "turn_failed", "agent" => "acme/triage", "reason" => "It timed out.", ...}

kinds()

@spec kinds() :: [kind()]

Returns every kind of notice.