Functions
form_reducer
2
FormState
▼
Reducer for form state.
form_reducer
2
FormState
▼
def form_reducer(state: FormState | None, action: Action) -> FormState
Parameters
| Name | Type | Description |
|---|---|---|
state |
FormState | None |
|
action |
Action |
Returns
FormState
make_form_reducer
2
Callable
▼
Create a form reducer pre-loaded with field specs.
The returned reducer initia…
make_form_reducer
2
Callable
▼
def make_form_reducer(*specs: FieldSpec, navigate_on_submit: bool = False) -> Callable
Create a form reducer pre-loaded with field specs.
The returned reducer initializes with the given fields on @@INIT, so you don't need to pass specs via action payload.
If navigate_on_submit=True, dispatches @@NAVIGATE when the form is submitted — useful in flows where the next screen should appear automatically after form completion.
Parameters
| Name | Type | Description |
|---|---|---|
*specs |
FieldSpec |
|
navigate_on_submit |
bool |
Default:False
|
Returns
Callable
form
3
dict[str, Any]
▼
Run an interactive form, return field values.
Falls back to input() if not a T…
form
3
dict[str, Any]
▼
def form(*specs: FieldSpec, env: Any = None, timeout: float | None | Any = _UNSET) -> dict[str, Any]
Run an interactive form, return field values.
Falls back to input() if not a TTY.
Parameters
| Name | Type | Description |
|---|---|---|
*specs |
FieldSpec |
|
env |
Any |
Default:None
|
timeout |
float | None | Any |
Maximum seconds to wait for input. Omit (or leave as default) for no limit in TTY sessions; non-TTY sessions default to 30 s to prevent CI pipelines from hanging indefinitely. Pass _UNSET
|
Returns
dict[str, Any]
form_schema
1
dict[str, Any]
▼
Return a JSON Schema describing an interactive form.
Mirrors `function_to_sche…
form_schema
1
dict[str, Any]
▼
def form_schema(*specs: FieldSpec) -> dict[str, Any]
Return a JSON Schema describing an interactive form.
Mirrorsfunction_to_schema() output shape so agents
can introspect form structure without running the TUI. A field is
required when its FieldSpec carries no default.
Parameters
| Name | Type | Description |
|---|---|---|
*specs |
FieldSpec |
Returns
dict[str, Any]