Skip to main content

Module api

Module api 

Source
Expand description

The action API: how a member that is not the app enumerates what it has open and performs one of its exported operations.

ResourceSpec trees already describe an app’s surface and dispatch already performs one operation on it; the missing step was naming a thing from outside the process that built it — without which collaboration, agency and scripting stay per-app features.

survey and invoke stay separate so enumeration can never cause an effect: a descriptor carries no callback, token or handle, so read-only is the shape of the type, not a promise in a comment.

Authority stays with the host, which resolves the caller against the workspace’s capability model before offering an address: an operation the caller may not perform is absent from the survey, never a flag to ignore.

Structs§

ActionAddress
The stable address of one exported operation: which resource, which action. Both halves are the app’s own ids — no screen position, no list index — so the same address names the same operation across layouts, themes, resolutions, and a caller with no display can work from ids and labels alone.
ActionDescriptor
One exported operation, as inert data: everything a caller needs to decide whether to perform it, nothing that could perform it — an ActionSpec’s closure never appears here or crosses a boundary, only the address does.
ActionEffect
One step an action takes on a record other than the resource it is declared on: the app whose record it writes, the record’s kind, and the verb it runs there. A step that is an action a device’s provider offers names that provider as its app and the resource it offers the action on as its kind.
InvocationProvenance
Caller identity and optional semantic context for an invoked action.
PlacedAction
One exported operation of a surveyed forest, in the row it stands in: the resource of the level above it, and whether its own resource holds rows below it, which a listing asked with that resource as its parent answers.
ResourceViewDescriptor
Serializable data describing one explicitly declared resource view.

Enums§

ApiError
Why an address could not be performed. Unknown is “nothing publishes this address”; an action published there that the caller’s permissions keep from them is refused as permission_denied (ApiError::Unavailable), saying why.
InputSpec
What an invocation of one action must carry, advertised on the descriptor rather than discovered by trying — enumeration is the only thing a caller that can’t see the screen has to work from.

Constants§

NOT_READY
The code a resource answers a write with when what it changes is still on its way from the workspace: nothing was made, and the same call under the same invocation is asked again once that is here.
NOT_READY_REASON
What such a write says in words, beside NOT_READY. A resource answers it as the whole reason its operation failed, and the toolkit turns that reason into ApiError::Unavailable with NOT_READY: a caller is told to ask again, never that a write made nothing.
NOT_THE_ASKED_PERSON
Why answering a question was refused: it is the asked person’s to answer, and the caller is not them. A question a request raised is the person’s decision, never its asker’s, and no agent answers another’s on their behalf (ApiError::Refused’s code).

Functions§

admit
Admit one invocation of address with arguments against the tree resources publishes, as a provider serving that tree answers a caller: resolved, available, confirmed as its contract asks of these arguments by confirmation (the phrase the caller typed, or the person’s approve of the asked record the call was kept as, which only the dispatch hands back and every frame entry refuses otherwise, admit_frame), and bound strictly into the action’s own encoded form. Nothing a caller writes is a yes.
described
action of resource, as inert data: what a survey hands back. The action at address in the forest resources, as a survey describes it.
encode
Turn an address plus its argument into the replayable action it names. Split out from invoke so a host can build/inspect/route the encoded action itself, and so argument rules are checked in one place. Binding happens before anything runs, so a bad call is a refusal with the document untouched, never a half-applied edit.
encode_json
Build an action from the canonical typed JSON argument object advertised by ActionDescriptor::params. Binding is strict and completes before any document mutation or application effect is attempted.
find_resource
The resource id in resources or among their children.
invoke
Perform the operation address names, attributed to provenance.actor. Resolve, bind, decode through the app’s own registry, then dispatch_by honouring the action’s locus. The actor is the caller’s Automerge actor bytes, so the workspace’s history names who asked; provenance.ambient carries the task or run the call belongs to. The resource’s concrete action label and address remain authoritative; app, purpose, group, and facets of the ambient context fill only fields the resource did not supply.
invoke_json
Typed-argument counterpart to invoke.
locate
resolve, with the resource that publishes the action: what the API needs to place the action in the tree it grants over.
published
The address of the action action that the resource resource in the tree resources publishes, or None when the tree publishes no such action: a caller holding a published tree takes its addresses from it (see ResourceSpec::action_address).
publishes_same
Whether a and b publish the same: every resource as a reader sees it and every action as a survey describes it. A target bound anew to the same item publishes the same, so a surface that described itself again after drawing is told from one whose offer moved.
resolve
Resolve address against resources without running anything, so a caller can check what an address currently names before committing to it.
spec_of
The action action that the resource resource in the tree resources publishes, or None: resolve of the address the tree publishes it at (published).
survey
Walk a resource forest and describe every operation it exports. Depth-first, parents before children, matching flatten’s order. Borrows the tree, returns owned data — nothing handed back can act on what it described.
survey_placed
Walk a resource forest and describe every operation it exports, each in the row a listing publishes it in: survey flattened, with the resource it stands under and whether its own resource holds rows below it, so a caller reading a level at a time knows where a level continues.
survey_placed_each
survey_placed, one row at a time and only as far as visit asks: it answers whether to go on, so a caller listing a page of a record that publishes thousands of actions builds the rows up to its page and no more. false when it stopped, true when it saw every row.
survey_placed_level
survey_placed_each of one level: the rows of children, the resources parent holds ("" for the top), and none further down, which stand under those. What a listing of one level walks, however much its resources hold. false when visit stopped it.
survey_placed_level_items
survey_placed_level with where each row stands: visit is told the index in children of the resource the action is on, so a caller listing a page counts what each resource admits and keeps its place from one page to the next. false when visit stopped it.
survey_placed_under
survey_placed_each for one resource’s subtree, as a child of parent: the items a listing keeps past the published page, walked as the tree would walk them.