MingaAgent.Hooks.Result (Minga v0.1.0)

Copy Markdown View Source

Structured result returned by agent hook runners.

:allow means execution may continue. :veto means the hook blocked the tool call and the tool callback must not run.

Summary

Types

Why a hook vetoed or failed.

t()

Structured hook result.

Functions

Builds an allow result.

Builds a veto result for dispatch-level failures (no hook context available).

Returns a concise user-facing error for a veto result.

Builds a veto result.

Types

reason()

@type reason() :: {:exit, non_neg_integer()} | :timeout | {:failed_to_start, term()}

Why a hook vetoed or failed.

t()

@type t() :: %MingaAgent.Hooks.Result{
  exit_status: non_neg_integer() | nil,
  hook: MingaAgent.Hooks.Hook.t() | nil,
  reason: reason() | nil,
  status: :allow | :veto,
  stderr: String.t()
}

Structured hook result.

Functions

allow(hook \\ nil)

@spec allow(MingaAgent.Hooks.Hook.t() | nil) :: t()

Builds an allow result.

dispatch_error(detail)

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

Builds a veto result for dispatch-level failures (no hook context available).

message(result)

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

Returns a concise user-facing error for a veto result.

veto(hook, stderr, reason)

@spec veto(MingaAgent.Hooks.Hook.t(), String.t(), reason()) :: t()

Builds a veto result.