Jidoka.Control behaviour (Jidoka v0.8.0-beta.1)

Copy Markdown View Source

Minimal reusable policy control contract for Jidoka agents.

Controls are declared by agents as data first. Runtime execution will attach them at explicit control points, but the current implementation only needs a stable module contract and published name.

Summary

Callbacks

Evaluates a control context and returns whether execution may continue.

Returns the stable control name used in specs, traces, and inspection output.

Functions

Defines a reusable Jidoka control module.

Returns the published name for a validated control module.

Validates that a module implements the Jidoka control contract.

Types

decision()

@type decision() ::
  :allow
  | :cont
  | :ok
  | {:block, term()}
  | {:interrupt, term()}
  | {:error, term()}

name()

@type name() :: String.t()

Callbacks

call(term)

@callback call(term()) :: decision()

Evaluates a control context and returns whether execution may continue.

name()

@callback name() :: name()

Returns the stable control name used in specs, traces, and inspection output.

Functions

__using__(opts \\ [])

(macro)
@spec __using__(keyword()) :: Macro.t()

Defines a reusable Jidoka control module.

control_name(module)

@spec control_name(module()) :: {:ok, name()} | {:error, String.t()}

Returns the published name for a validated control module.

validate_module(module)

@spec validate_module(module()) :: :ok | {:error, String.t()}

Validates that a module implements the Jidoka control contract.