pub fn invoke_capability(
request: &CapabilityRequest,
) -> Result<CapabilityResponse, NodeAppError>Expand description
Invoke a capability on the host via the capability router.
This is the primary mechanism for app-to-app communication. The host resolves the capability name to the providing app, dispatches the request, and returns the response. The provider may itself be a different app, the host kernel, or a remote node (transparent to the caller).
Trace context is propagated automatically: if this call happens
inside handle_capability and the inbound request carried a
trace_id, the same trace ID is injected on outbound calls. Callers
may override this by setting trace_id explicitly on the request.
§Errors
Returns NodeAppError::CapabilityError when:
- The host context is not available (called before init).
- The host’s invoke callback is not wired up.
- The capability is not registered, the provider rejects the call, or the response cannot be deserialized.