Documentation
¶
Overview ¶
Package a2ui is the part of A2UI v0.9 (https://a2ui.org) a workflow's human task uses, on the service's side (spec_043_workflows WF-18): a form as the standard server-to-client messages any A2UI renderer can draw, and an answer (the client-to-server action message) checked against the form before a run goes on, so no client is trusted to have checked it. Nothing in a form runs as code: its functions are this package's catalog, by name.
Index ¶
Constants ¶
const CatalogID = "https://a2ui.org/specification/v0_9/catalogs/basic/catalog.json"
CatalogID is the basic catalog's, whose components and functions forms use.
const Version = "v0.9"
Version is the A2UI version the messages carry.
Variables ¶
This section is empty.
Functions ¶
func Resolve ¶
Resolve is a dynamic value: a literal, {path} in the data (relative to a template's item), or {call} of one of the catalog's functions.
Types ¶
type Action ¶
type Action struct {
Name string `json:"name"`
SurfaceID string `json:"surfaceId"`
SourceComponentID string `json:"sourceComponentId"`
Timestamp string `json:"timestamp"`
Context map[string]any `json:"context"`
}
Action is a client's answer: A2UI's action message, from a button.
func ParseAction ¶
ParseAction reads a client-to-server message ({"version": "v0.9", "action": {...}}); an error message, or anything else, is an error.
type Form ¶
type Form struct {
Components []map[string]any `json:"components" yaml:"components"`
Data map[string]any `json:"data,omitempty" yaml:"data,omitempty"`
}
Form is a surface's components (a flat list, one with the id root) and its data model.
func FormOf ¶
FormOf reads a surface's form back from its messages (the last components and the whole model they set; a path's update is applied).
func (Form) Answer ¶
Answer checks an action against the form it answers and returns the answer a run gets: the action's name as "action", with its context's values. data is the surface's data model as the client had it (nil: the form's own, with the context's bound values put back): every component's checks must pass on it, the button's context must be what it resolves to, and the button must be one of the form's, with that action, and its own checks passing.