Jidoka.Agent.Spec.Operation (Jidoka v0.9.0)

Copy Markdown View Source

Model-callable operation definition.

Summary

Functions

Returns true when this operation has a built-in approval policy.

Normalizes an existing operation specification, keyword list, or map.

Returns the operation kind used for control matching and policy checks.

Builds an operation specification from keyword or map attributes.

Builds an operation specification and raises if the attributes are invalid.

Returns true when a recorded intent may be retried without reconciliation.

Returns true when this operation requires an explicit operation control.

Returns the Zoi schema for an agent operation.

Returns the supported operation idempotency policies.

Types

idempotency()

@type idempotency() :: :pure | :idempotent | :dedupe | :reconcile | :unsafe_once

t()

@type t() :: %Jidoka.Agent.Spec.Operation{
  approval: nil | nil | any(),
  description: nil | nil | binary(),
  idempotency: (((:pure | :idempotent) | :dedupe) | :reconcile) | :unsafe_once,
  metadata: map(),
  name: binary()
}

Functions

approval_required?(operation)

@spec approval_required?(t()) :: boolean()

Returns true when this operation has a built-in approval policy.

from_input(operation)

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

Normalizes an existing operation specification, keyword list, or map.

kind(operation)

@spec kind(t()) :: atom()

Returns the operation kind used for control matching and policy checks.

Direct operations default to :operation. Adapters can set :kind, :operation_kind, :source_kind, :runtime, or :source metadata to expose a more precise kind while preserving one operation contract.

new(attrs)

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

Builds an operation specification from keyword or map attributes.

new!(attrs)

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

Builds an operation specification and raises if the attributes are invalid.

replay_safe?(arg1)

@spec replay_safe?(t() | idempotency()) :: boolean()

Returns true when a recorded intent may be retried without reconciliation.

requires_control?(arg1)

@spec requires_control?(t() | idempotency()) :: boolean()

Returns true when this operation requires an explicit operation control.

schema()

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

Returns the Zoi schema for an agent operation.

valid_idempotencies()

@spec valid_idempotencies() :: [idempotency()]

Returns the supported operation idempotency policies.