pub fn invoke(
doc: &mut Doc,
resources: &[ResourceSpec],
address: &ActionAddress,
argument: Option<&str>,
(provenance, confirmed): (InvocationProvenance<'_>, bool),
registry: &ActionRegistry,
transport: &mut dyn ActionTransport,
) -> Result<Dispatched, ApiError>Expand description
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.
resources must be a tree built now, not the one an earlier
survey walked — re-resolving turns an address that has since
stopped naming anything into a refusal rather than an edit to
whatever took its place. Decoding through registry (rather than
trusting the tree) makes this fail-closed: an unregistered action
type can’t run, and the decoder used here is the one a replaying peer
would use too.
§Errors
Returns any error encode documents; ApiError::ConfirmationRequired
when the action’s effective confirmation for this argument is not
None and the caller does not say the person’s answer for
this call came through the system’s own question (confirmed);
ApiError::UnregisteredType if registry has no decoder for the
encoded action’s type; or ApiError::Failed if dispatch_by fails
once decoded.