Jidoka.Review.Interrupt (Jidoka v0.9.0)

Copy Markdown View Source

Durable pause point produced by a runtime control.

Interrupts are data. They describe why a turn paused and what pending effect may continue after an application supplies a review response.

Summary

Functions

Returns true when the review window has expired.

Normalizes an existing interrupt, keyword list, or map.

Builds a review interrupt from keyword or map attributes.

Builds a review interrupt and raises if the attributes are invalid.

Returns the Zoi schema for a runtime review interrupt.

Builds a stable review identifier from deterministic parts.

Adds request and expiry times to an interrupt.

Types

t()

@type t() :: %Jidoka.Review.Interrupt{
  agent_id: binary(),
  arguments: map(),
  boundary: :operation,
  control: atom(),
  control_name: binary(),
  created_at_ms: nil | nil | integer(),
  effect_id: binary(),
  effect_kind: :operation,
  expires_at_ms: nil | nil | integer(),
  id: binary(),
  idempotency: (((:pure | :idempotent) | :dedupe) | :reconcile) | :unsafe_once,
  idempotency_key: nil | nil | binary(),
  loop_index: integer(),
  metadata: map(),
  operation: binary(),
  operation_kind:
    (((((((((:action | :operation) | :tool) | :ash_resource) | :browser)
         | :skill)
        | :mcp)
       | :catalog)
      | :workflow)
     | :subagent)
    | :handoff,
  reason: any(),
  request_id: binary()
}

Functions

expired?(interrupt, now_ms)

@spec expired?(t(), non_neg_integer()) :: boolean()

Returns true when the review window has expired.

from_input(interrupt)

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

Normalizes an existing interrupt, keyword list, or map.

new(attrs)

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

Builds a review interrupt from keyword or map attributes.

new!(attrs)

@spec new!(keyword() | map()) :: t()

Builds a review interrupt and raises if the attributes are invalid.

schema()

@spec schema() :: Zoi.schema()

Returns the Zoi schema for a runtime review interrupt.

stable_id(parts)

@spec stable_id([term()]) :: String.t()

Builds a stable review identifier from deterministic parts.

with_review_window(interrupt, now_ms, ttl_ms)

@spec with_review_window(t(), non_neg_integer(), pos_integer() | nil) :: t()

Adds request and expiry times to an interrupt.