Skip to main content

Module draft

Module draft 

Expand description

Every invocation as a draft a person can read, change and confirm.

Where a delegate’s action asks first, the person is shown exactly what will happen before it does. Draft::render derives that from the action’s inert descriptor and the arguments it would run with, so every application’s actions are draftable without code of their own: a field per parameter (an object parameter’s fields one level down), resource references and attachments by label, secrets withheld. An action that wants a richer preview names its layout with a contract tag (MESSAGE_PREVIEW_TAG); a parameter shaped like a message (recipients and a body) is previewed as one without it.

What the person confirms is bound to the exact arguments (arguments_digest): changing a field (Draft::apply_edits) makes new arguments, and those are what run.

Structs§

Draft
An invocation as a person reviews it.
DraftEdit
One change a person made to a draft’s field.
DraftField

Enums§

DraftLayout
How a draft is laid out.
DraftValue
What one field holds.
MessageRole
The role a field plays in a DraftLayout::Message.

Constants§

AWAITING_CAUSE
The error code an invocation an agent makes inside a turn is answered with while the message that caused it has not reached this device: the caller waits and asks again once it has; nothing has run.
AWAITING_CONFIRMATION
The error code an invocation is answered with while the person it is made for has not yet confirmed it. The caller waits and asks again with the same arguments; nothing has run.
DECLINED
The error code an invocation is answered with when the person declined it. What follows the code is the reason they gave, if any.
MAX_FIELD_CHARS
Longest text a draft keeps for one field; a longer value is shown cut and cannot be edited in place.
MESSAGE_PREVIEW_TAG
Contract tag of an action whose draft is previewed as a message: who it goes to, its subject, its body and what it carries.

Functions§

arguments_digest
The digest binding a confirmation to the exact arguments it was given for. Keys are ordered, so the same arguments always digest the same.