Form ABI

This document defines a minimal interactive form ABI for modules that can run in both CLI and web hosts.

Scope:

Required Exports

Input Buffer

At input_ptr:

Host must ensure:

Prompt/Completion Semantics

For the current prompt, module provides:

Form is complete when:

When complete, host should treat the form as finished and read final output from output_ptr.

Run Semantics

Host flow:

  1. Read current metadata (input_key, input_label, error_message).
  2. If input_key_size() == 0, form is complete.
  3. Otherwise, collect one input value.
  4. Write value bytes to input_ptr.
  5. Call run(input_size).

Module behavior:

run return value is UTF-8 output size in output_ptr. Final result is read when form is complete.

Invariants

Host should enforce: