Behaviour shared by Work, Vigil and library-owned operational controllers.
Controller callbacks are deterministic reducers. They run briefly inside
the Agent owner; external work must be represented by a registered
Spectre.Operation.Request and is executed by a temporary Runner.
A kind: :directive Definition with can_start: [:work] may return
start_loops: [{:work, controller, input, opts}] from a successful
apply_result/4. Each intent requires a stable :intent_id; the Agent
validates and commits the parent Result and every new Work atomically.
Work and Vigil controllers cannot acquire this capability.
Summary
Types
@type context() :: map()
Callbacks
@callback apply_result( term(), Spectre.Operation.Request.t(), Spectre.Operation.Result.t(), context() ) :: {:ok, term()} | {:ok, term(), keyword() | map()} | {:error, term()}
@callback next(term(), context()) :: {:run, Spectre.Operation.Request.t()} | {:run, atom() | String.t(), term()} | {:wait, Spectre.Operation.Wait.t()} | {:blocked, term()} | {:complete, term()} | {:error, term()}