Skip to content

Platform services are exposed to .flux programs through a versioned capability contract: a registry of capabilities and methods with stable, deterministically derived numeric ids, resolved identically on the dev server and on both native hosts. The declarations live in stdlib/capabilities.flux and the host registries mirror them; the IDL is kept in sync by generated code (ADR-0045, ADR-0058).

Capability ID Known method
Camera 1 capture
Storage 2 removeItem (method 3)
Router 3 navigate (method 1)
Clipboard 4 copy / paste
Location 5 current position
… up through 11 see stdlib/capabilities.flux

Capability ids are derived deterministically and never hand-assigned — a hand-assigned id desyncs the server and host registries, and the parity guards fail the build when the tables drift.

A capability call in the wire/VM is CALL_CAP; it carries the capability and method ids plus the argument record.

CALL_CAP returns a result-cell signal. The cell is part of the reactive graph, so you render its states with ordinary expressions:

State Meaning Typical render
Ready The call completed The value
Pending An async call is in flight value ?? "Loading..."
Error The call failed or was denied Your error UI

A synchronous capability settles the cell before the call returns. An async capability leaves it Pending and an injected AsyncResolver settles it when the platform responds (ADR-0044, ADR-0045).

Async results are threaded back onto the reactive dispatcher by the host — you never write signals from a background thread. When a cell settles, the host recomputes the dirty set from the written signal exactly as for any other dispatch, and only the nodes that read the cell recompose.

Capabilities backed by OS permissions (Camera, Location, Notifications) are gated by the host:

  • The host surfaces the system permission prompt when required.
  • A denied call produces a capability error — it never crashes the app. The denied call does not run, and the host renders the on-device red banner.
  • The error payload names cap_id / method_id, the resolved cap_name / method_name, the required OS permission, and a human-readable why.

See the troubleshooting guide for the fix path, and the capabilities how-to for call patterns.