Module params
Expand description
Typed action parameters: what an invocation must carry, and the strict bind that checks it before anything runs.
An ActionSpec used to describe its argument
in prose — "Value 0–1", "Rate, e.g. 0.5 / 1 / 2", "grayscale / sepia / invert" — and hand the raw string to a closure that parsed it leniently. A
typo became a silent default. That is tolerable when a human is looking at a
prompt and can see the result; it is not tolerable for a caller with no
screen, whose only description of the surface is the enumeration it was
handed.
So a parameter is declared, not narrated: a name, a
ParamType, whether it is required, optional
choices, and a description that explains meaning
rather than syntax. ActionArgs::bind then refuses a missing, unknown,
wrong-typed or out-of-choice argument up front, so a bad call is a refusal
and never a half-applied edit.
§One vocabulary, both sides
This is deliberately the same vocabulary the compositor’s headless action
API already speaks (ParamType / ActionParam / ArgValue / strict
ActionArgs::bind), lifted here so the app-side action model and the
shell-side one share a single definition instead of converging by accident.
The const constructors keep const PARAMS: &[ActionParam] = &[…]
compiling verbatim; the owned constructors are what an app needs, because an
app builds its parameters at runtime out of document state.
Structs§
- Action
Args - Arguments for one invocation, already checked against the action’s declared parameters.
- Action
Param - One typed parameter an action declares.
- Made
From - The resource an invocation is made from: its address, as the caller names it, and the type it points at.
Enums§
- ArgError
- Why a set of arguments does not satisfy an action’s parameters.
- ArgValue
- One bound argument value.
- ArgViolation
- How a value broke its parameter’s declared range, as data: what a
failure’s
detailscarry beside its message, so a caller corrects the call without reading the prose. - Param
Type - The type of one action parameter. Deliberately small: these are values a caller with no screen can produce from a descriptor alone.
- Pick
- What a parameter’s value names in the workspace, so a person picks it
from what is there instead of typing its encoding (
PICK_ANNOTATION).
Constants§
- ARGUMENTS_
JSON_ PREFIX - Marks the legacy single-string invocation slot as carrying a canonical JSON argument object. The record-separator prefix cannot be produced by a normal palette text field, preserving unambiguous backward compatibility.
- CHOICE_
LABELS_ ANNOTATION - Schema annotation saying how each of a parameter’s choices reads to a
person: an object from choice to label; see
ActionParam::with_labelled_choices. An identity is chosen by its name, never by its fingerprint. - CONTENT_
ANNOTATION - Schema annotation marking a text parameter as the address of content
another action produced (a content hash), not words a caller can say;
see
ActionParam::as_content. - FROM_
ARGUMENT - The argument key a caller names the resource it makes the invocation from with: what the
resources the action makes were made from (
created(r)?.from,linked(r)). It is no parameter of any action, and every builder may read it, the ones that record provenance and the ones that ignore it alike. - PEOPLE_
ANNOTATION - Schema annotation naming which of a parameter’s choices are people
(identities, collaborators): a surface shows each with its avatar; see
ActionParam::choosing_people. - PICK_
ANNOTATION - Schema annotation naming what a parameter’s value picks from the
workspace; see
ActionParam::picking. An annotation, not an assertion: binding takes any value of the parameter’s type. - PLACE_
ANNOTATION - Schema annotation marking a parameter as a place inside the resource the
action is on (an item, a caret in it, a range of it); see
ActionParam::as_place. - RESOURCE_
KIND_ ANNOTATION - Schema annotation naming the kind of resource a
ParamType::Resourceparameter takes; seeActionParam::of_resource_kind. An annotation, not an assertion: binding does not check it.
Functions§
- picked_
resource_ schema - The schema of a parameter that picks an existing resource of kind
kind(Pick::Resource): a reference (resource_reference_schema), annotated with what it picks. - place_
schema - The schema of a place inside a resource (
ActionParam::as_place). - resource_
reference_ schema - The schema of a reference to an existing resource of the workspace, as
a parameter that picks one takes it (
Pick::Resource): the app that keeps it, the record it keeps it in when not its record of the workspace, its kind, its id in that app and how it reads. The label is presentation only; the app, kind and id are the address. - validate_
json_ schema - Validate one JSON value against the deterministic JSON Schema subset used by Tilo action contracts.
Type Aliases§
- Str
- A string that is either a
&'static str(so a parameter list can be aconst) or owned (so an app can build one per frame from its document).