Script forms
A script can carry a form: the user fills it in before the script runs, and the script gets the values. Both operator clients read the same format (openspec operations, Script Form Format and Running a Script with a Form):
- the web app: the form is a saved script's Form tab; the script reads
params; - the TUI: the form is
<name>.form.jsonnext to<name>.py; the script readsVIRTUFIN_TUI_FORM_DATA.
The format is scripts/script-form.v1.schema.json (published as
https://app.virtufin.com/schemas/script-form.v1.schema.json); the conformance vectors both clients
pass are scripts/validation.yaml.
The form
A JSON Schema object with "type": "object", properties (the fields, in order), and optionally
title, description, required and x-submit (the run button's label, default Run).
Nothing else: a form outside the format is refused whole, with the reason.
Fields
| Field | Schema |
|---|---|
| Text | {"type": "string"} |
| Multi-line text | {"type": "string", "x-widget": "textarea"} |
| Secret | {"type": "string", "x-widget": "password"} (the web app never keeps its last value) |
| Whole number | {"type": "integer"} |
| Number | {"type": "number"} |
| Yes / no | {"type": "boolean"} |
| One of | {"enum": ["url", "code"], "x-enumLabels": ["URL", "Code"]} |
| Some of | {"type": "array", "items": {"enum": ["binance", "alpaca"]}, "uniqueItems": true} |
| Date | {"type": "string", "format": "date"} (2026-11-19) |
| Date and time | {"type": "string", "format": "date-time"} (2026-11-19T10:30, seconds and offset optional) |
Every field may have title (the label; default the property name), description (help),
default and x-placeholder.
| Check | On |
|---|---|
required (form level) |
any field; an empty one fails (only whitespace, or nothing picked) |
minimum, maximum |
whole number, number |
minLength, maxLength, pattern (Unicode regular expression) |
text fields |
enum |
one of, some of |
A check on a kind it does not fit (a pattern on a number, a widget on a boolean) makes the form
invalid.
Choices
x-options gives a text field, or a some-of field's items (in place of enum), a list to pick
from (openspec operations, Script Form Choices). The list is fixed or read from an operation of the
catalog when the form opens:
"mode": {"type": "string", "x-options": {"values": ["fast", "slow"], "labels": ["Fast", "Slow"], "free": true}}
"worker": {"type": "string", "x-options": {"from": {"operation": "workers.list", "value": "/id", "label": "/name"}}}
"topic": {"type": "string", "x-options": {"from": {"operation": "topics.list", "input": {"prefix": {"field": "prefix"}}}, "free": true}}
"workers": {"type": "array", "uniqueItems": true, "items": {"x-options": {"from": {"operation": "workmanager.ListWorkers", "items": "/workers", "value": "/id"}}}}
| Key | Meaning |
|---|---|
values, labels |
A fixed list and what is shown for each value (default: the values). |
from.operation |
A catalog name a script may call: hand-written (workers.list) or reflected (workmanager.ListWorkers). It must be a read. A write or a people-only operation fails that field and is never called. |
from.input |
The operation's input. Each value is a literal, or {"field": "<key>"} for another field's typed value. That key is left out while the referenced field is empty or hidden. |
from.items |
A JSON Pointer to the list in the result. The default "" is the result itself. |
from.value, from.label |
JSON Pointers into each item. The value defaults to the item itself and the label to the value. Numbers become strings. Duplicates collapse, and items without a value are skipped. |
free |
true accepts a value outside the list (default false). |
- Strict (
freenot set): the value, or each pick of a some-of, must be one of the choices. While the choices load, or after reading them failed, a non-empty value is an error. - Free: only the field's text checks (
minLength,maxLength,pattern) apply. - A field is read again when a field named in its input changes. References may not point to the field itself or form a cycle.
- Not with
enum,formatorx-widget, and not on numbers or yes/no fields.
The vectors are in the choiceForms, choiceValues, requests and extract sections of
scripts/validation.yaml. The web app supports choices. The TUI does not yet, and refuses such a
form, naming the keyword.
Showing a field only sometimes
x-visibleIf shows a field only while a condition on the other fields' current values holds:
{"field": "source", "eq": "code"}
{"field": "replicas", "gte": 3}
{"field": "venue", "in": ["binance", "alpaca"]}
{"all": [{"field": "source", "eq": "code"}, {"not": {"field": "dry", "eq": true}}]}
Leaf operators: eq, neq, gt, gte, lt, lte, in (exactly one per leaf); all, any and
not combine. An empty field compares as null; gt, gte, lt and lte are false unless the
value is a number. A hidden field is neither checked nor passed.
What the script gets
One object: each visible, non-empty field's value, typed as the schema says: whole numbers and
numbers as numbers, yes / no as true / false, some-of as a list, everything else as the entered
string (not trimmed). An empty field is absent.
{
"title": "Next events of a topic",
"type": "object",
"required": ["topic"],
"x-submit": "Read",
"properties": {
"topic": {"type": "string", "title": "Topic", "x-placeholder": "act.exchange.binance.orderbook.update.BTC_USDT"},
"count": {"type": "integer", "title": "Events", "minimum": 1, "maximum": 100, "default": 3},
"timeoutMs": {"type": "integer", "title": "Wait at most (ms)", "minimum": 100, "default": 10000}
}
}
With a topic entered and the rest left alone, the script gets
{"topic": "…", "count": 3, "timeoutMs": 10000}.