PromptRunner.Verifier (PromptRunnerSDK v0.12.1)

Copy Markdown View Source

Deterministic prompt verification.

Summary

Functions

Returns the contract clauses the verifier evaluates.

The contract actually enforced for a prompt: the packet's, plus every amendment recorded for it.

Whether report contains any item whose check could not run.

A one-line description of a faulted item, naming the command and its cwd.

The items in report whose check could not run.

Types

fault()

@type fault() :: :verifier_fault | :verifier_timeout

report()

@type report() :: %{
  pass?: boolean(),
  items: [map()],
  failures: [map()],
  faults: [map()],
  prompt_id: String.t() | nil,
  amendments: [map()]
}

Functions

contract_items(contract)

@spec contract_items(map()) :: [map()]

contract_keys()

@spec contract_keys() :: [String.t()]

Returns the contract clauses the verifier evaluates.

Anything else under verify: is parsed, stored, and never evaluated, which is what mix prompt_runner packet lint reads this list to detect.

enforced_contract(plan, prompt, opts \\ [])

@spec enforced_contract(PromptRunner.Plan.t(), map(), keyword()) :: map()

The contract actually enforced for a prompt: the packet's, plus every amendment recorded for it.

The packet's own contract is never mutated. It is read fresh each time and the amendments are applied on top, so a re-run from clean state — with no amendment log — enforces exactly what the packet says.

fault?(report)

@spec fault?(report() | map()) :: boolean()

Whether report contains any item whose check could not run.

fault_line(item)

@spec fault_line(map()) :: String.t()

A one-line description of a faulted item, naming the command and its cwd.

faults(report)

@spec faults(report() | map()) :: [map()]

The items in report whose check could not run.

A fault is not a verification failure. The contract said nothing about the work because it never got to look, so a caller must neither pass the prompt nor spend an attempt trying to repair it — it has to stop and say what could not run.

verify(plan, opts \\ [])

@spec verify(
  PromptRunner.Plan.t(),
  keyword()
) :: {:ok, [report()]}

verify_prompt(plan, prompt, opts \\ [])

@spec verify_prompt(PromptRunner.Plan.t(), map(), keyword()) :: report()