GenAI.Approval.Executor behaviour (GenAI Approval v0.1.0)

Copy Markdown View Source

Behaviour for script execution targets (PRD §6.4).

Adapters: GenAI.Approval.Executor.Local (native handlers, in-process); an MCP adapter over noizu_mcp clients arrives with milestone M4.

Summary

Callbacks

Optional metadata for UIs: arg schema for edit forms, risk annotations.

Types

endpoint_decl()

@type endpoint_decl() :: GenAI.Approval.Script.Endpoint.t()

run_ctx()

@type run_ctx() :: %{run_id: String.t(), step_id: String.t(), env: map()}

Callbacks

close(state)

(optional)
@callback close(state :: term()) :: :ok

describe(command, state)

(optional)
@callback describe(command :: String.t(), state :: term()) ::
  {:ok, %{schema: map() | nil, annotations: map()}} | {:error, term()}

Optional metadata for UIs: arg schema for edit forms, risk annotations.

execute(command, args, state, run_ctx)

@callback execute(command :: String.t(), args :: map(), state :: term(), run_ctx()) ::
  {:ok, result :: term()} | {:error, term()}

prepare(endpoint_decl, config)

@callback prepare(endpoint_decl(), config :: term()) ::
  {:ok, state :: term()} | {:error, term()}