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§
- Action
Address - 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.
- Action
Descriptor - 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. - Action
Effect - 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.
- Invocation
Provenance - Caller identity and optional semantic context for an invoked action.
- Placed
Action - 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.
- Resource
View Descriptor - Serializable data describing one explicitly declared resource view.
Enums§
- ApiError
- Why an address could not be performed.
Unknownis “nothing publishes this address”; an action published there that the caller’s permissions keep from them is refused aspermission_denied(ApiError::Unavailable), saying why. - Input
Spec - 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 intoApiError::UnavailablewithNOT_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
addresswithargumentsagainst the treeresourcespublishes, as a provider serving that tree answers a caller: resolved, available, confirmed as its contract asks of these arguments byconfirmation(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
actionofresource, as inert data: what a survey hands back. The action ataddressin the forestresources, as a survey describes it.- encode
- Turn an address plus its argument into the replayable action it
names. Split out from
invokeso 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
idinresourcesor among their children. - invoke
- Perform the operation
addressnames, attributed toprovenance.actor. Resolve, bind, decode through the app’s own registry, thendispatch_byhonouring the action’s locus. The actor is the caller’s Automerge actor bytes, so the workspace’s history names who asked;provenance.ambientcarries 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
actionthat the resourceresourcein the treeresourcespublishes, orNonewhen the tree publishes no such action: a caller holding a published tree takes its addresses from it (seeResourceSpec::action_address). - publishes_
same - Whether
aandbpublish 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
addressagainstresourceswithout running anything, so a caller can check what an address currently names before committing to it. - spec_of
- The action
actionthat the resourceresourcein the treeresourcespublishes, orNone:resolveof 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:
surveyflattened, 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 asvisitasks: 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.falsewhen it stopped,truewhen it saw every row.- survey_
placed_ level survey_placed_eachof one level: the rows ofchildren, the resourcesparentholds (""for the top), and none further down, which stand under those. What a listing of one level walks, however much its resources hold.falsewhenvisitstopped it.- survey_
placed_ level_ items survey_placed_levelwith where each row stands:visitis told the index inchildrenof 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.falsewhenvisitstopped it.- survey_
placed_ under survey_placed_eachfor one resource’s subtree, as a child ofparent: the items a listing keeps past the published page, walked as the tree would walk them.