API Reference GenAI Approval v#0.1.0

Copy Markdown View Source

Modules

Interactive approval scripts for agents.

Structured error for script rejection (parse + static checks).

Behaviour for script execution targets (PRD §6.4).

Executes script calls against host-registered native handlers — no network, no MCP. Config is a map of "command" => handler, where handler is a 2-arity fun (args, run_ctx) returning {:ok, result} | {:error, reason}, or {module, function}.

Executes script calls against MCP servers via Noizu.MCP.Client (M4, PRD §6.4 adapter 1). One client per declared endpoint, started under GenAI.Approval.ClientSupervisor and closed when the run terminates (R6.7).

Pure evaluator for script expressions against a string-keyed environment.

Behaviour a host application implements to surface approval runs (PRD §7.2). Mirrors the proven park/respond split: the engine calls present/2 and streams on_event/3; the host answers by issuing GenAI.Approval.command/2.

Splits script source into segments and tokenizes them.

Phoenix LiveView reference UI for an approval run (PRD R7.1).

The v1 interop surface (PRD §10): a standard MCP tool any client can call to submit an approval script. Register it on a Noizu.MCP.Server

Recursive-descent parser for the approval-script grammar (PRD §5).

Allow/block command rules and their resolution (PRD §8).

One allow/block rule. pattern is "endpoint:command" with glob support.

Pluggable persistence for permission rules.

Durable permission-rule store (M3): DETS-backed, survives restarts.

Default in-memory rule store.

Shared rendering model for approval-script UIs (PRD §7.3).

Result-contract helpers (PRD §9).

One interactive approval run (PRD §6): a GenServer holding the run state machine. Steps execute in supervised tasks so control commands (halt above all) stay responsive while a call is in flight.

Parsed approval script: AST + metadata.

{{assign var = expr}} — expr may be a call expression.

{{call "endpoint" "command" arg=expr ...}} statement.

Preamble endpoint declaration. auth is {:credential, id} — never a secret.

Conditional. {{#unless}} parses to an If with negate: true.

One declared output, evaluated at end of run.

One approvable unit. calls is the statically-extracted {endpoint, command} list.

Typed variable declaration.

Post-parse validation (PRD R5.1–R5.6). Returns a list of %Error{} — empty when the script is valid. All applicable errors are reported, not just the first.

Behaviour the host application implements to accept agent-submitted approval scripts (the v1 interop surface, PRD §10).