Docs Run work on your own devices

Run work on your own devices

From a device card, choose Run, then select a saved API collection or UI test by name. Open Advanced to edit the JSON payload. Use Connect a device in the toolbar to open the connection options directly.

If a required field is empty or the JSON or labels have an invalid format, Mockarty highlights the field and shows what to fix.

The device mesh lets you send a bounded piece of work to one of your own devices — a Desktop left running at home, for example — from another Mockarty client, and then read back a short receipt. A Desktop that has joined the mesh advertises what it can run, claims one command at a time, executes it with its own local engine and reports the outcome. A command carries an object identifier, never a target address, so a caller cannot use your device to reach something you did not choose.

Android hosting on the local network

On a Community server, an active Grid connection appears as Online under This phone. Open Manage pairing on that card to view the connection.

Android Grid has a separate switch for hosting on the local network. Turn it on only when you want other devices to request pairing. Finding a host on Wi-Fi does not approve it or join a mesh: the host operator must approve the request, and the joining device must complete the pairing code step.

Only a paired device may upload its own screen/audio or collect its own queued commands. Screen viewing, listening and controls on the host use the host app’s local controls; a remote peer does not gain operator access by joining. Discovery does not grant permission to change the device limit.

The host keeps device approvals separately from online status. Losing the connection does not transfer queued work to another device with the same name. A saved connection from an older app without a verifiable device binding is not automatically reassigned by name. Keep app data when updating. To restore it, request pairing from the original device, then choose Restore saved device for the correct retained device ID on the host approval card. Complete the existing pairing code step. This explicit selection keeps the retained device and queued work; ordinary approval alone does not assign an old record by its name.

Local hosting is distinct from the server-backed device mesh described below. Discovery, a passing local route check, and a single-device connection do not establish a working multi-hop path between Desktop, a server and a phone.

If a device list cannot be loaded, the console shows which source failed and continues to display devices from the available source. An empty list is shown only after both sources confirm it. Refreshes keep keyboard focus on the same device or command action while it is available.

Before you start

Access follows the existing role permissions in the namespace. Owner, Admin and User may read and write device-mesh resources; Viewer may only read.

The mesh is part of the API testing module in your licence, together with the execution fleet (/api/v1/runners, runner tasks and the companion grid): the commands it accepts — replay an API collection, run a UI test — are API-testing work. If the module is not in your licence, an administrator can add it; nothing else is needed for the mesh.

The node that answers /api/v1 must run the device-mesh control plane. On a node that does not, every device-mesh route answers 503 device_mesh_unavailable; there is no fallback in-process queue.

A Desktop joins the mesh only when you opt in, and both switches are off by default. Set them in the Desktop’s environment before starting it:

Variable What it enables
MOCKARTY_DEVICE_MESH Let this computer accept remote commands at all. Only 1, true, yes or on (any letter case) turn it on; any other value, including a typo, leaves it off.
MOCKARTY_DEVICE_MESH_UI_TESTS Also advertise the browser engine, so the Desktop can claim ui_test.run commands. Uses the same accepted values; off by default.

Both are Desktop settings, not settings of a Mockarty server process: a Mockarty server does not read them, and changing them never changes server behaviour.

Participation is per connection profile. A Local profile has no server to register with. A Company profile registers with that company server; a Cloud profile registers through the Cloud relay, on the same verified runtime edge the Desktop already uses for shared runs — the server is the mesh’s storage either way. Participation follows your authority: the Cloud grants the device scope to Owner, Admin and Editor roles, and the company server applies its own namespace permissions. A Viewer, or a seat whose plan does not grant the action, joins nothing — the Desktop does not register, and its log names the reason instead of appearing connected and never claiming work. Switching connection profiles stops the previous profile’s participation, so the computer does not stay reachable under a profile you are no longer using. To sign a Desktop in to a company server at all, an administrator must first enable Desktop sign-in on that server — see Desktop sync with Cloud or a company server.

For a Company profile over HTTPS, or a Cloud profile, the Desktop must already have verified and saved the server identity during sign-in. Mesh requests use that identity and do not follow redirects. If the identity is missing or changes, remote participation stays stopped until the connection is verified again.

A startup log line alone does not prove that the Desktop registered — check the
Device Mesh page for the device. If shutdown reports an error, completion has
not been confirmed; do not treat that outcome as a clean stop.

The console and the API

Switching accounts or namespaces clears the previous screen and pairing code. Open confirmations belong to the account and namespace where you opened them; confirm the action again in the current workspace. This does not cancel commands already sent to the server.

The browser remembers tracked command references separately for each account and namespace. References saved by older versions without an account binding are retained locally but are not assigned to the next person who signs in. This local list is not the complete server command history.

Search in the device list filters the already loaded devices by name, kind, environment, state or capability. The count shows matching rows and all loaded rows. A search does not change execution placement or grant access to another device.

In Connect a device, choose Add a computer to see connection instructions. The computer appears in the device list after Mockarty Desktop connects to the server with its profile.

In the server Web console, select the workspace you want the phone to join before choosing Add a phone or tablet. The temporary pairing code is issued for that workspace.

When adding a phone, wait for the QR image to appear before scanning it. If the image cannot load, the console shows an explanation; you can still enter the temporary pairing code manually. Keep the server address reachable from the phone. In Desktop, open the phone connection window before creating a QR.

To remove a phone’s access from the server Web console, open Connect a device → Paired phones and tablets, choose Unlink next to the device and confirm. The phone must pair again to regain access. A recent activity record may remain visible briefly.

If Grid Console cannot open a phone pairing window, follow Desktop control panel in the explanation. It opens the phone pairing settings directly.

If the countdown has reached zero and a replacement is loading, wait for the new QR in the same panel. You do not need to refresh the page or request another code while that update is in progress. If renewal fails, the panel closes and clears the expired code. Select Add device to request a fresh code.

The Device Mesh console at /ui/device-mesh shows every device you may use in the
active namespace — mesh-registered computers and the phones/runners on the execution grid
in one list — with its state, capabilities, labels, last heartbeat and owner. It lets you
register a device, refresh its presence, lend it to a colleague (a grant), submit a command,
follow it from queued to a terminal state with its receipt, stop a whole group, and cancel
an individual command. Placement reasons (no_such_capability, draining, no_device,
no_consent) are shown when a submit could not be bound to a device.

Everything the console does is also REST, documented on this page, so automation keeps
working exactly as before. Agents reach the same surface over MCP:
device_mesh_devices_list shows the devices you may use, device_mesh_run places one piece
of work on a device or lets the server pick one, device_mesh_fanout runs it across every
qualifying device, and device_mesh_status reads a command or a group. Grants have no
curated MCP tool: lending your machine is your own decision — only the device’s owner can
create a grant, so an agent cannot grant itself access.

Register, discover, dispatch: a worked example

The example signs in as the user who owns the device. The same user must register the device and perform the claim, progress and receipt calls: execution is always authorised by the device owner’s own session. A person you grant access to may submit and read commands, but cannot execute them. Replace the namespace (sandbox) and the device id with your own.

The variable payload of a command is JSON. In the response, the same field is returned as a JSON string.

TOKEN="${MOCKARTY_API_KEY:?Set MOCKARTY_API_KEY first}"
BASE="${MOCKARTY_URL:-http://127.0.0.1:5770}/api/v1"
NS="sandbox"
DEVICE="desk-home"

# 1. Register (or refresh) the device. Repeat this to update labels or capabilities.
curl -s -X POST "$BASE/namespaces/$NS/device-mesh/devices" \
  -H "X-API-Key: $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "deviceId": "desk-home",
    "kind": "desktop",
    "capabilities": ["api_test", "ui_test_browser"],
    "labels": {"os": "macos", "site": "home"}
  }' | jq '{deviceId, state, capabilities, labels}'

# 2. Discover which of your devices can run what you need.
curl -s "$BASE/namespaces/$NS/device-mesh/devices?capability=api_test" \
  -H "X-API-Key: $TOKEN" \
  | jq '.devices[] | {deviceId, state, capabilities, labels}'

# 3. Submit a command. Reusing the idempotency key replays the same command.
CMD=$(curl -s -X POST "$BASE/namespaces/$NS/device-mesh/commands" \
  -H "X-API-Key: $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "kind": "ping",
    "idempotencyKey": "ping-desk-home-1",
    "targetDeviceId": "desk-home",
    "requiredCapabilities": ["api_test"],
    "payload": {}
  }' | jq -r '.command.id')

# 4. Claim it as the device. An empty body claims the next queued command;
#    HTTP 204 means nothing was claimable right now.
curl -s -X POST "$BASE/namespaces/$NS/device-mesh/devices/$DEVICE/commands/claim" \
  -H "X-API-Key: $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"commandId": "'"$CMD"'", "leaseTtlSeconds": 120}' \
  | jq '{id, state, leaseOwner, leaseExpiresAt}'

# 4b. Keep the lease alive while the work runs (device side).
curl -s -X POST "$BASE/namespaces/$NS/device-mesh/commands/$CMD/renew?deviceId=$DEVICE" \
  -H "X-API-Key: $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"leaseTtlSeconds": 300}' \
  | jq '{state, leaseExpiresAt}'

# 5. Report that work started, then report the outcome.
curl -s -X POST "$BASE/namespaces/$NS/device-mesh/commands/$CMD/report?deviceId=$DEVICE" \
  -H "X-API-Key: $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"state": "running"}' | jq '{state, startedAt}'

curl -s -X POST "$BASE/namespaces/$NS/device-mesh/commands/$CMD/report?deviceId=$DEVICE" \
  -H "X-API-Key: $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"state": "succeeded", "resultSummary": "device reachable; ping, api_test.collection, ui_test.run available"}' \
  | jq '{state, finishedAt, resultSummary}'

# 6. Read the stored command and its receipt at any time.
curl -s "$BASE/namespaces/$NS/device-mesh/commands/$CMD" \
  -H "X-API-Key: $TOKEN" \
  | jq '{id, kind, state, targetDeviceId, leaseOwner, resultSummary, resultRef, failureReason}'

Submitting returns 202 Accepted with {"command": {...}, "replayed": false}. Repeating the request with the same idempotencyKey and the same intent returns the original command with "replayed": true; the command is not queued twice. Changing the intent under the same key is refused with 409 idempotency_conflict.

What a device can execute

The control plane stores any lower-case command kind (letters, digits, ., _ and -, at most 64 characters), but a Desktop executes a closed vocabulary. A kind outside it is refused by the device and reported as a failure with a reason; it is not silently ignored.

kind payload What the device does
ping none, or {} Runs nothing. Use it to prove presence, dispatch, claim and receipt without touching a stored object. The Desktop reports the summary device reachable; ping, api_test.collection, ui_test.run available.
api_test.collection {"collectionId": "<collection uuid>", "environment": "<name>"} Replays one stored API-tester collection. environment is optional and selects a saved environment on the device. A finished receipt carries a reference of the form api-test-run/<run id>.
api_test.company_collection {"collectionId": "<collection uuid>"} Runs the selected server collection on a compatible Company Desktop, including when synchronization is off. The Desktop needs no local copy.
ui_test.run {"uiTestId": "<ui test uuid>"} Replays one saved UI test in the Desktop’s browser. The Desktop advertises ui_test_browser only with the UI-tests opt-in, so require that capability when you target one. A finished receipt carries a reference of the form ui-test-run/<task id>.

In the Device Mesh console, select a compatible Company Desktop, then choose an API test and the server collection. The console selects the server definition for this run. In a connected Company Desktop, this selection requires a named device that is online or busy and supports server collections. The author needs access to the collection and permission to use that device. The server checks both again before giving the collection to the executor. If its definition changed while queued, start a new run. Collections with embedded credentials cannot use this server-definition path.

On your own Company Desktop, you can select a Company environment. The server verifies access and sends only its reference and variable names. Set the values on the executing Desktop. If you created its environment separately, enter the exact name in Saved environment on Desktop. Leave it blank to look up the same UUID. If a local value is missing, the command reports that the environment needs setup. Values do not appear in the command, receipt, or report.

When the compatible Desktop completes the run, open the command and select Open collection report. The report lists each request’s name, protocol, result, HTTP status when available, duration, and passed and failed check counts. Request and response contents are omitted. Members with read access to a collection can open its report by link if the collection was shared with their Space when Desktop received the run and remains shared. Reports from other collections require access to the original collection and the Mesh command. A Desktop that only supports summary reporting leaves a receipt in the command. The same request results are available from GET /api/v1/namespaces/{namespace}/device-mesh/commands/{commandId}/collection-report.

On a new PostgreSQL Company server, set AUTH_POLICY_STORE=application on every admin node before the first start to enable detailed collection reports. This is the same authorization configuration used for Company sync. If an existing PostgreSQL server uses the legacy authorization store, open the run summary. It remains available when request details cannot be shown.

The device parses a payload strictly: an unknown field, a missing identifier or trailing data is a failure with a reason, not a partial run. The payload may contain references and options only. A credential-like field anywhere in it — token, password, authorization, api_key and similar names, or any field whose name ends in _token, _secret, _password, _credential, _api_key or _private_key — is refused by the server with 400 sensitive_field_rejected.

Command states

Every command moves through a durable state. Only the last four are terminal.

State Meaning How it is reached
queued Accepted and waiting for a capable device. targetDeviceId is empty when no device matched at submission time. A successful submit.
claimed One device holds a lease on it. leaseOwner names that device and leaseExpiresAt bounds the lease. A successful claim.
running The device reported that execution started. A report with "state": "running".
succeeded Terminal. The receipt is stored. A report with "state": "succeeded".
failed Terminal. failureReason explains why. A report with "state": "failed".
canceled Terminal. The command will not run. A cancel by the submitter or by the owner of the targeted device.
expired Terminal. The lease passed leaseExpiresAt before a terminal report arrived. Evaluated when the command is next read, claimed, renewed or reported.

A terminal receipt is immutable. A late or duplicate report returns the receipt that is already stored instead of overwriting it, and cancelling an already cancelled command is a harmless repeat. A succeeded, failed or expired command cannot be cancelled: the server answers 409 terminal_command.

# Cancel a queued or running command (submitter or target device owner).
curl -s -X POST "$BASE/namespaces/$NS/device-mesh/commands/$CMD/cancel" \
  -H "X-API-Key: $TOKEN" | jq '{state, finishedAt}'

A lease is not an automatic retry. When it expires, the command is finalised as expired and stays that way; submit a new command if the work still needs to run. Renewing a lease after it has passed returns 410 lease_expired.

You will not see a proposed state in normal use: submitting a command queues it
directly.

Targeting and grants

When access to a tracked command is refused, the console hides its cached details and receipts. If access returns, the next refresh can show the command again.

When a command carries targetDeviceId, the server checks that the device exists in the namespace, that you may use it, that it is not draining, and that it advertises every requiredCapabilities entry and matches every targetLabels entry. A mismatch is refused immediately (422 capability_missing or 422 target_mismatch) instead of waiting for a device that can never run it.

Without targetDeviceId, the server selects among devices you may use that are online or busy, have the required capabilities and match all target labels. Load is the number of unexpired leases a device currently holds, and the least loaded device wins; ties break on the oldest heartbeat. If no device matches, the command still queues with no target, so a device that becomes available later can claim it — and the submit response then carries placementReason, naming the gate that stopped it, so you know what to fix instead of guessing:

placementReason What it means What to do
no_device No device is registered in this namespace. Register a device.
no_consent Devices exist, but none is yours and none was granted to you. Ask the device’s owner for a grant.
consent_missing_capability You hold a grant for a device, but it does not cover the capability this work needs. Ask for a broader grant.
no_such_capability You may use devices, but none advertises the required capabilities. Use a device that can run this kind of work.
label_mismatch A capable device exists, but its labels do not match targetLabels. Correct the selector or the device’s labels.
offline A capable, permitted device exists and is not online. Bring it back; the queued command is claimed when it returns.
draining A capable, permitted device is being retired. Use another device.

placementReason describes the fleet at submit time and is not stored: a later read of the command does not repeat it, because by then a device may already hold the work.

Placement settings

If settings cannot be refreshed, the console shows an error and keeps the last loaded settings during temporary failures. It clears them if access is refused.

Two preferences can be set once for the whole namespace instead of on every submit. Both are preferences: a namespace that sets nothing behaves exactly as described above.

Key Values Default What it changes
placement.prefer_own true / false false Orders your own devices before devices another user granted to you. It changes the order, never the set: if no own device qualifies, granted capacity is still used.
placement.default_labels JSON object, e.g. {"os":"linux"} none Supplies target labels only when the submit carried no targetLabels. An explicit selector always wins.

Set them per layer: platform is any (the whole namespace), server, desktop or mobile. A platform value overrides the namespace value; removing it returns the namespace value.

# Order own devices first for everyone in the namespace
curl -X PUT "{{baseUrl}}/api/v1/namespaces/default/device-mesh/settings/placement.prefer_own" \
  -H "Authorization: Bearer {{apiKey}}" -H "Content-Type: application/json" \
  -d '{"platform":"any","value":"true"}'

# Prefer Linux devices on the desktop layer only
curl -X PUT "{{baseUrl}}/api/v1/namespaces/default/device-mesh/settings/placement.default_labels" \
  -H "Authorization: Bearer {{apiKey}}" -H "Content-Type: application/json" \
  -d '{"platform":"desktop","value":"{\"os\":\"linux\"}"}'

# Read them back
curl "{{baseUrl}}/api/v1/namespaces/default/device-mesh/settings?platform=desktop" \
  -H "Authorization: Bearer {{apiKey}}"

An empty value clears the setting. Unknown keys and unknown platforms are refused with 400 invalid_setting / 400 invalid_platform, and a node where the settings store is not composed answers 503 execution_settings_unavailable. Writing a setting is audited as execution_setting with the platform, key and value.

A device can be used by its owner alone unless the owner creates a grant. A grant names the grantee by user UUID (not a login or an email) and covers one device. It also carries a capability scope (capabilities): the owner lends specific kinds of work, so a grant that lets a colleague replay an API collection does not let them run a UI test on the same machine. An empty or omitted list keeps the original meaning — everything the device advertises — which is what every grant created before the scope existed means. The grantee then sees that device in the list and may dispatch work to it. A grant does not let the grantee claim, renew or report commands: execution stays with the device owner’s session. Revoking a grant takes effect immediately, and a command still queued under that grant can no longer be claimed by the device.

A joined Desktop keeps its own presence fresh and sends a heartbeat every 30 seconds. When a Company Desktop changes Spaces or shuts down cleanly, it marks the registration it is leaving offline. Heartbeat expiry remains the fallback after a crash or a lost connection.

A client that manages its own registration can use session-aware heartbeats when registration returns supportsSessionHeartbeat: true. Register with a fresh sessionId, then pass it as expectedSessionId in each heartbeat. A matching state: "offline" retires that registration. A heartbeat for a replaced or retired session returns 409 device_registration_changed. Clients on earlier servers continue to use ordinary heartbeats.

For command leases, a server that returns supportsLeaseRegistration: true accepts X-Mockarty-Device-Registration on claim, renew and report requests. Use the same sessionId throughout a claimed command. Once a claim supplies this header, replacing the registration does not transfer its lease. A missing, replaced or different registration returns 409 device_registration_changed. Company Desktop passes the value automatically. Its registration uses the same signed-in session for heartbeats and command leases. Another sign-in to the same account cannot take over that registration. After shutdown or reconnect, Desktop registers with a fresh ID. Existing API-key devices can still claim ordinary leases without this header.

# Refresh presence (optional fields may be omitted).
curl -s -X POST "$BASE/namespaces/$NS/device-mesh/devices/$DEVICE/heartbeat" \
  -H "X-API-Key: $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"state": "online"}' | jq '{deviceId, state, heartbeatAt}'

# Let one colleague dispatch API-collection work to this device (grantee is a
# user UUID; omit capabilities to lend everything the device advertises).
curl -s -X POST "$BASE/namespaces/$NS/device-mesh/devices/$DEVICE/grants" \
  -H "X-API-Key: $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"granteeUserId": "11111111-2222-3333-4444-555555555555", "capabilities": ["api_test"]}' \
  | jq '{deviceId, granteeUserId, capabilities}'

# Withdraw the grant.
curl -s -X DELETE "$BASE/namespaces/$NS/device-mesh/devices/$DEVICE/grants/11111111-2222-3333-4444-555555555555" \
  -H "X-API-Key: $TOKEN" | jq

Running on every device at once

A fan-out sends one piece of work to every device you may use that satisfies the requirement — the “run it on the whole fleet” case. It is one request and one group, but each device gets its own ordinary command, so claims, leases, cancellation, expiry and receipts behave exactly as they do for a single command.

The groupKey makes the whole group idempotent: repeating the request returns the children created the first time, even if a device joined in between — “everything available” means the set you saw when you submitted, not a set that grew while you were away. Each child is created already targeted at its device, so no device can claim another device’s share.

# One collection, every capable device you may use.
curl -s -X POST "$BASE/namespaces/$NS/device-mesh/fanouts" \
  -H "X-API-Key: $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "groupKey": "nightly-fleet-2026-10-26",
    "kind": "api_test.collection",
    "requiredCapabilities": ["api_test"],
    "payload": {"collectionId": "11111111-1111-4111-8111-111111111111"}
  }' | jq '{state: .fanout.state, total: .fanout.summary.total}'

# Read the group: per-device children plus one aggregate verdict.
curl -s "$BASE/namespaces/$NS/device-mesh/fanouts/nightly-fleet-2026-10-26" \
  -H "X-API-Key: $TOKEN" | jq '{state: .state, summary}'

# Stop the whole group in one call — every child you may cancel is cancelled.
curl -s -X POST "$BASE/namespaces/$NS/device-mesh/fanouts/nightly-fleet-2026-10-26/cancel" \
  -H "X-API-Key: $TOKEN" | jq '{state: .state, canceled: .summary.canceled}'

Cancelling a group is one decision, so it is one call: a child the caller may not cancel is left alone, and the response is the group as it now stands. Cancelling twice is idempotent.

The group’s state is derived from its children and is never guessed:

state Meaning
empty No device qualified; placementReason says which gate stopped it. Nothing was queued.
queued Every child is still waiting.
running At least one child has not finished.
succeeded Every child succeeded.
partial Some succeeded and some did not. The successful runs are real — this is a verdict, not a failure.
canceled Every child was cancelled.
failed No child succeeded (and not all were cancelled).

A group spanning several owners is readable by each owner for their own device’s child, and by the submitter for the whole set; anyone else gets the same 404 command_not_found as a group that does not exist.

The submit response also carries skipped: the devices the requirement did not admit, with the reason (offline, no_such_capability, label_mismatch, no_consent, …), and skippedTotal — the full count, because the list is capped at 50 so a large fleet does not turn one response into a list of its own size. “Two of five devices ran” is not the whole answer when you expected five, so the three that were skipped are named. Like placementReason, it describes the fleet at submit time and is not stored.

Reading a command

GET /commands/:commandId returns the stored command. A trimmed receipt looks like this (values are illustrative):

{
  "id": "3f1c2d9e-8b7a-4f6e-9c1d-2a4b6c8d0e1f",
  "namespace": "sandbox",
  "submitterUserId": "0d9a6f2c-1b3e-4a5c-8d7f-9e0a1b2c3d4e",
  "idempotencyKey": "ping-desk-home-1",
  "kind": "ping",
  "state": "succeeded",
  "requiredCapabilities": ["api_test"],
  "targetDeviceId": "desk-home",
  "leaseOwner": "desk-home",
  "payload": "{}",
  "queuedAt": "2026-10-25T09:00:00Z",
  "claimedAt": "2026-10-25T09:00:04Z",
  "startedAt": "2026-10-25T09:00:05Z",
  "leaseExpiresAt": "2026-10-25T09:02:04Z",
  "finishedAt": "2026-10-25T09:00:05Z",
  "resultSummary": "device reachable; ping, api_test.collection, ui_test.run available"
}

resultSummary is bounded to 8 KiB. resultRef and failureReason are bounded to 2048 bytes each. The payload is bounded to 64 KiB. Keep receipts content-free: a summary names an outcome, a reference points at a stored run, and neither should quote a response body or a credential.

The submitter and the owner of the targeted device may read a command; once a device claims it, the owner of the device holding the lease may read it too. A device that merely knows a command id cannot read or report it while another device holds the lease.

Execution receipts

If a temporary refresh error occurs, Recent receipts keeps the last loaded rows and shows an error. If access is refused, it clears those rows. The empty message appears after a successful read with no receipts.

When a device reports a command as succeeded or failed, the server records a receipt — the durable answer to “did this run, and what did it produce” for anyone who holds its ref. You can read a receipt when the device is one you may use (your own, or granted to you) or when you submitted the command; a member who is neither sees nothing, not even that the work exists.

A receipt is an artefact keyed by the executor’s own ref (the resultRef the device sent), not a field of the command: a command is the right to act on one machine and never leaves the node that owns it. If the device sends no ref, the server derives devicemesh.command:<command id> so every receipt still has an identity.

The receipt is a closing projection — state, a bounded summary, the ref, the device and the timings. It never contains the command payload, a result body, headers or a token.

Field Meaning
ref The executor’s own reference, or the derived one.
reportKind What produced the receipt; today always device_mesh.command.
subjectId The command id.
state succeeded or failed.
summary The bounded summary the device reported.
failureCode The first 64 characters of the failure reason, when there is one.
deviceId The device that executed the command.
startedAt, finishedAt, recordedAt When the work ran and when the receipt was written.
# One receipt by the ref the executor returned
curl "{{baseUrl}}/api/v1/namespaces/default/device-mesh/reports?ref=run-collection-77" \
  -H "Authorization: Bearer {{apiKey}}"

# Every receipt of one command
curl "{{baseUrl}}/api/v1/namespaces/default/device-mesh/reports?commandId=<command-id>" \
  -H "Authorization: Bearer {{apiKey}}"

At most 200 receipts come back in one read, newest first. Re-reporting a terminal command is a no-op for the command and does not append a second receipt: the first one is kept, because a receipt describes a moment that already happened.

A receipt also travels. When the namespace has Company sync enabled against a team server (and is not a Cloud-managed namespace), the receipt of a terminal command is published to that server and applied on the other nodes of the namespace. A second node can therefore answer “did this run, and what did it produce” without running it again. What travels is exactly the receipt described above — state, summary, ref, device and timings — never the command, its payload or a result body: the command itself stays on the machine that executed it.

Refusals

Errors use the shape {"error": "<code>", "code": "<code>", "message": "..."}. The code values below are stable.

Status code What it means
400 invalid_request A field is missing, malformed or out of bounds: a bad device id or kind, an unknown capability in a body, a bad lease TTL, an idempotency key or kind with the wrong shape, a payload that is not JSON or is too large, a report state other than running, succeeded or failed.
400 invalid_body The body is not valid JSON for this endpoint, contains an unknown field, or has trailing data.
400 sensitive_field_rejected A payload or label carries a credential-like field name. Replace it with a reference.
400 unknown_capability The capability query filter is not one of the known capability keys.
400 device_required A renew or report call is missing the deviceId query parameter.
401 unauthenticated The call has no authenticated session.
403 forbidden You may not use this device or command: you are not its owner, hold no grant, or are not the submitter.
403 grant_scope_missing You hold a grant for this device, but it does not cover the capability the command needs. Ask for a broader grant; this is not a loss of access.
403 namespace_mismatch A scoped token addressed another namespace in the path.
404 device_not_found The device is not registered in this namespace.
404 command_not_found The command does not exist in this namespace.
409 claim_lost Another executor already claimed the command you named, or it is no longer queued. Ask for the next one.
409 terminal_command The command already reached a terminal state and cannot change.
409 lease_owner_mismatch The lease belongs to another device.
409 device_unavailable The device is not accepting commands: it is draining, or a claim came from an offline device.
409 idempotency_conflict The idempotency key was already used for a different command. Use a new key for a different intent.
410 lease_expired The lease had already expired. The command is not retried automatically.
422 capability_missing The targeted device does not advertise a required capability.
422 target_mismatch The targeted device does not match the label selector.
503 device_mesh_unavailable This node does not run the device-mesh control plane. Use a node that does.

A claim that finds nothing to do is not an error: the server answers 204 No Content. That is the normal outcome of polling a device that has no queued work, and also the answer when the command you named is not one this device can claim.

Good to know

  • Off by default. A Desktop never accepts remote work until its operator sets MOCKARTY_DEVICE_MESH. A regulated installation does not discover afterwards that other clients can run work on it.
  • The device’s own session authorises execution. A caller cannot borrow a device’s authority: register, claim, renew and report are accepted only from the user who owns the device.
  • References, not targets. Commands carry identifiers of stored objects. A caller cannot make the device call an arbitrary address.
  • Receipts are short. Only a state, a bounded summary and an optional reference travel back; response bodies and page content stay on the device.
  • Heartbeats and presence. A device that stops heartbeating is reported as offline after 90 seconds without a background sweep. Registering a device with "state": "offline" is refused: offline is computed, not claimed.
  • Polling and concurrency. A joined Desktop checks for queued work every 5 seconds and runs one command at a time; a command that arrives while it is busy stays queued for the next free slot.
  • Capability keys. api_test, ui_test_browser, ui_test_mobile, perf, fuzz, chaos, coder, computer_use. A Desktop advertises api_test always and ui_test_browser only with the UI-tests opt-in; it does not advertise the others in this release.
  • Device kinds. desktop, mobile, web, runner.
  • A console and an API. The Device Mesh page in the sidebar shows devices, commands and grants, and lets you submit and follow work. Everything on it is also REST, so automation keeps working as described here. Desktop has no separate mesh screen; it joins from its connection profile.

Continue work on another device

The same account can be signed in on several clients — a Desktop, a phone browser, the server’s web interface. Mockarty records, per user and per device, which discussion or mission you were last on and how far you had read. The resume endpoint returns what this device should show next: unread discussions with the exact message id to continue after, and missions that changed since your last look — plus every mission waiting for a person (a question or a deployment approval), even when nothing else changed.

Discussions, their read cursors, missions, approvals and their decision keys are already server state. The continuity records add only the device identity and the per-device position; they never copy or rewrite the work itself.

1. Register the client

deviceId is minted by the client and must stay the same for the life of that install or browser profile. Allowed characters: letters, digits, ., _, :, -; length 8–128.

curl -s -X POST "$BASE/namespaces/$NS/continuity/devices" \
  -H "X-API-Key: $TOKEN" -H "Content-Type: application/json" \
  -d '{"deviceId":"phone-web-a1b2c3d4","platform":"mobile","label":"Pixel browser",
       "activeChatThreadId":"<thread-uuid>"}' | jq '{created, device}'
  • platform is web, desktop or mobile.
  • The call is also a heartbeat: repeat it periodically. The first call answers "created": true; every repeat answers false and refreshes lastSeenAt.
  • A deviceId already registered by another account is refused with 409 device_owned_by_another_user. Never share a device id between users; mint a new one.
  • An omitted activeChatThreadId / activeMissionId leaves the stored hint untouched (a heartbeat must not erase where you were). Send "replaceActive": true to clear them explicitly.

2. Ask what to show next

curl -s "$BASE/namespaces/$NS/continuity/resume?deviceId=phone-web-a1b2c3d4" \
  -H "X-API-Key: $TOKEN" | jq '{totals, threads, missions, nextSince}'

Each thread carries lastMessageId, lastReadMessageId (your shared cursor from any device), unreadCount and resumeAfter — the id to continue after. resumeAfter is the largest of what you have already read anywhere and this device’s own cursor, clamped to the newest message on the server:

  • Your read cursor is shared: reading on the phone clears the badge on the Desktop.
  • A cursor ahead of the server (a restore, a deleted message at the tip) is clamped and flagged "aheadOfServer": true; it never skips work.
  • cursorSource is server when the shared cursor decided the value and device when this device had read further.

On a first start omit since. Afterwards pass the nextSince from the previous response:

... /continuity/resume?deviceId=phone-web-a1b2c3d4&since=2026-10-25T12:00:00Z

A mission updated while you were reading is returned now and again next time — a replay is safe, a skipped mission is not. Missions with needsHuman: true are always returned regardless of since.

3. Record how far you got

curl -s -X PUT "$BASE/namespaces/$NS/continuity/devices/phone-web-a1b2c3d4/cursors" \
  -H "X-API-Key: $TOKEN" -H "Content-Type: application/json" \
  -d '{"surface":"chat","targetId":"<thread-uuid>","position":42}' | jq '{advanced, cursor}'
  • surface is chat (position = message id) or mission (position = the mission’s updatedAt as epoch microseconds).
  • Positions only move forward. A lower or equal value is a no-op that returns "advanced": false and the stored value: retrying an advance is always safe.
  • The resume call itself is a read. It does not advance anything; record your position after you have actually shown the content.

4. Continue a session on another device

GET …/continuity/handoff/targets?sessionId=<id> lists where the caller’s mesh may continue one running session; POST …/continuity/handoff moves the caller’s own resume pointer. Both accept an autonomous mission or a coder session.

  • The session family is resolved from the server store, never guessed from the id. A coder session returns "kind": "coder" and a continueUrl under /ui/harness; an autonomous mission returns "kind": "mission" and a continueUrl under /ui/missions.
  • sessionKind in the POST body is optional. The server resolves the family from the stored session, so a stale client that still says mission cannot repoint a coder session; an unknown family is refused with 400 invalid_request.
  • A handoff to a device writes only that device’s row: activeMissionId, activeSessionKind (mission or coder) and a cursor at the session’s current position. Resume returns these fields, so a client that restarts or moves to another node still opens the right receiver.
  • An empty toDeviceId selects the server: nothing is written and the canonical continueUrl is returned.

This changes where you open and control the session. It does not move a local
working folder or a running coding engine to a server runner. Keep the machine
that executes local work available. Selecting a runner for a new coding job is
a separate action.

The handoff route needs the device-mesh permission like the rest of this surface, plus the session’s own read domain: mission read for an autonomous mission, coder read for a coder session. A caller with only one of the two domains is refused for the other; namespace, device ownership and user boundaries are checked exactly as before.

A private native-folder coding task can be continued only by its original requester. Space membership and coder-read permission do not reveal another user’s task goal or authorize a handoff. If the task cannot be read temporarily, the request returns 503 mission_read_failed; retry the same task later rather than switching to a different session.

curl -s "$BASE/namespaces/$NS/continuity/handoff/targets?sessionId=<id>" \
  -H "X-API-Key: $TOKEN" | jq '{session, targets}'

curl -s -X POST "$BASE/namespaces/$NS/continuity/handoff" \
  -H "X-API-Key: $TOKEN" -H "Content-Type: application/json" \
  -d '{"sessionKind":"coder","sessionId":"<id>","toDeviceId":"phone-web-a1b2c3d4"}' | jq '.handoff'

5. Send without duplicates

POST …/threads/:threadId/messages accepts an optional clientMessageId (a UUID). If the reply is lost and you retry with the same id, the server returns the message that already landed instead of posting a second one. Use a new id for a new message. Mission answers and approvals already take an idempotency key and behave the same way.

What stays on the device

Unsent drafts, the Desktop local-session process and its local instruction outbox
stay on the device. When a coding-session mirror is available, another client can
read the published state and queue a next instruction on the server. The original
machine executes that instruction; the server queue does not contain a copy of
its working folder or running engine. If publishing is unavailable or the saved
mirror belongs to another account or server, local work is preserved and is not
silently shared with the new connection.

Errors

Status Code Meaning
400 invalid_request A field is missing or malformed (device id shape, platform, surface, negative position, bad since).
401 unauthenticated No authenticated user on the request.
403 namespace_forbidden The token is scoped to another namespace.
403 session_read_forbidden Handoff only: the caller lacks the resolved session’s own read domain (coder or mission).
404 device_not_found The device is not registered for this user. Another account’s device reads the same way.
409 device_owned_by_another_user Registration only: the id already belongs to another account. Mint a new id.
503 continuity_unavailable This node has not composed the continuity store. Use a node that has.

The route permissions are the same as for the device mesh: Owner, Admin and User may read and write; Viewer may read. Continuity is used by clients and automation; there is no separate screen for it.

Choose where work runs: devices and the server fleet together

The device-mesh endpoints below answer “which of my devices can run this”. A
second surface answers the broader question behind it — this device, a chosen
Desktop, a chosen server runner, or every eligible device
— without asking you
to learn two vocabularies. It reads the device mesh and the server runner fleet
and returns one list.

Method Path What it does
GET /api/v1/namespaces/:namespace/mesh-targets Every device you may use and every server runner assigned to the space, each with an eligible flag and a typed reason when it is not. Optional capability, selector=key=value and job query parameters narrow the answer.
POST /api/v1/namespaces/:namespace/mesh-targets/dispatch Run one job on the chosen target(s).
GET /api/v1/namespaces/:namespace/mesh-targets/settings Which settings are shared and which belong to one Desktop.

Access uses the same device_mesh read/write permission as the routes above.

Modes

mode Meaning
here This device. Send deviceId; the device must be yours, and “first own device” is deliberately not guessed.
device One chosen device, including a chosen Desktop.
devices Every eligible device (device mesh only).
runner One chosen server runner.
fleet Every eligible target across devices and the server fleet.
any One least-loaded eligible target across both. This is the default.

The job.kind is one of ping, api_test, ui_test, performance,
fuzzing, computer_use. A job a fabric cannot execute is excluded with the
reason unsupported_job_kind rather than dispatched and failed later — a ping
has no server-fleet executor, and a load test has no device-mesh executor.

When you choose a compatible Company Desktop for an API collection in Runs on Android, it runs the server definition, even with Desktop synchronization off. Open the run report and select View request results on the Desktop result. The same selection applies to a Mesh Targets api_test job with payload {"collectionId":"<collection uuid>"}. Supplying a device environment keeps the device-local collection path. Repeating the same group key keeps the chosen targets and definition source.

For a pinned Company Desktop you own, add environmentId and, if needed, localEnvironmentName to the Mesh Targets request. With api_test.company_collection, those fields go inside payload. A pinned server runner still resolves environmentId using the server store. Use referencesOnly=true on GET /api/v1/api-tester/environments to select without receiving values. Use ownedName to look up one of your own environments by exact name.

Why a target is not eligible

An ineligible target is shown, not hidden, with one of these stable reasons:

Reason What to do
no_consent The device belongs to another member; its owner must grant you access.
consent_missing_capability A grant exists but does not cover this kind of work; ask for a broader grant.
no_such_capability The target does not advertise the required engine.
label_mismatch Its labels do not satisfy the required selectors.
offline Bring the device or runner online.
draining The target is being retired and takes no new work.
unsupported_job_kind This fabric has no executor for the job.
target_not_found The named target is not visible in this space.
unknown_capability The requested capability is not in the catalogue.
intent_conflict The group key was already used for a different command. Use a new group key for the new command; nothing is re-dispatched.
replay_intent_unavailable A unit already exists under this group key but its original command can no longer be verified (it was created by an older release or by an assigned birth). Use a new group key rather than retrying the old one.
idempotency_conflict The device mesh already holds a command under this group key with a different payload. The device is fine; use a new group key for the new command.

A device owned by another member without a grant appears with a redacted name
(“Another member’s Desktop”) so its identity is not disclosed while the fleet
stays honestly larger than what you may use. A server runner owned by another
space is not listed at all.

Fan-out: partial success is a result, not an error

For devices and fleet, exactly one durable unit is created per eligible
target — one mesh command, or one runner task — with an idempotency key derived
from the group key and the target. Repeating the request with the same
groupKey replays the existing units; it never creates a second lease on a
target. The group is bound to the targets chosen by its first call: a retry
returns those same targets even if load, heartbeat or eligibility has changed
since, and any never moves the work to a different host. If the original
target is gone or revoked, the response reports that honestly — it does not
re-run the work elsewhere. Each target reports independently, and the aggregate is:

queued · running · succeeded · partial · failed · empty · canceled

partial means some targets succeeded and some did not. The successful runs are
real and are not rolled back; every failed target keeps its own reason and
receipt. empty means nothing was eligible, and the response names the best
reason (placementReason).

Shared and device-specific settings

GET …/mesh-targets/settings classifies the existing settings registry by its
declared scope. Installation-, space- and user-scope settings are shared
(the same value wherever the work runs). Desktop-scope settings are
device-specific — local coding provider and model, local API keys, Computer
Use bundles and vision settings. It also names device-runtime facts that are not
registry settings at all: the local workspace path, the device’s access level and
the engines it actually has.

Where this is in the interface

Autonomous missions → Capacity → Where to run. The selector shows the
same eligible/excluded rows and the same typed reasons, offers the six modes, and
prints a per-target result with the durable command or task id.

Review a device’s grants

The owner of a device can list its current grants. The request also needs
device_mesh read permission in the selected namespace; having another user’s
grant does not let you inspect their grantees. An empty list means that no grants
remain, while a non-owner receives 403.

curl -s -H "Authorization: Bearer $TOKEN" \
  "$MOCKARTY_URL/api/v1/namespaces/$NS/device-mesh/devices/$DEVICE/grants"

The response contains grants, with each grant’s user, namespace, device and
optional capability limits. Use the existing grant and revoke operations to
change access.

Follow the mesh live

The console refreshes on its own, and automation can subscribe to the same signal:
GET /api/v1/namespaces/{namespace}/device-mesh/events is a Server-Sent Events stream of
the transitions that matter — a device registered or updated, a command queued, claimed,
running, renewed, cancelled, expired or finished.

curl -N -H "Authorization: Bearer $TOKEN" \
  "$MOCKARTY_URL/api/v1/namespaces/$NS/device-mesh/events"

Only events from the requested namespace are delivered, and the stream carries identifiers
and states — never a command payload, a result body or a credential. It needs the same
device_mesh read permission as the device list. A node that does not run the mesh control
plane answers 503 instead of holding the connection open.

Device visibility is checked again for each presence event. A device grant does not
let you read every command on that device: command events follow the command’s own
read permissions. If the current view cannot be read, the connection closes so the
client can reconnect and read the saved state. With a user session, revoking that
session or its namespace access also ends the stream; changing the active Desktop
profile ends the old stream. Treat events as refresh signals, not a complete history:
after reconnecting, read the device list and command status again.

Drain a device without unplugging it

POST /api/v1/namespaces/{namespace}/device-mesh/devices/{deviceId}/drain with
{"draining": true|false, "reason": "…"} records an operator decision. A drained device
stops receiving new work (an unbound submit skips it, a targeted submit is refused), while
work it already holds may finish.

The decision survives the device’s own heartbeat: an agent announces state:online every
few seconds and that no longer lifts a drain. Only an explicit {"draining": false} does.
A device that chose to drain itself is a different thing — it may go back online on its
own, because no operator asked for that drain.

The owner is told, once

A drain and a return to rotation are availability facts, so they reach the owner’s other
clients through the same durable notification queue the assistant already uses for missions
and coding sessions (GET /api/v1/namespaces/{namespace}/continuity/push/pending). The
queued row carries kind: "device_mesh", objectType: "device_mesh_device",
objectId: <deviceId>, a mockarty://device-mesh/<deviceId> link and the web page
/ui/device-mesh. It is addressed to every client of the owner that registered the
can_receive_push capability.

On Android, a new coding-session or mission notification opens the item in its Space
when that Space and feature are available to the signed-in account. Older links without
a Space open in the currently selected Space.

The delivery is exactly once per transition, even across nodes: both nodes observe the same
database transition and derive the same event key, and the queue keeps one row per
(namespace, device, event key). Ephemeral online/busy changes are deliberately not
notified — they are visible in the device list and the event stream, and paging a phone for
each one would bury the facts that need a person.

Device limits

A licence may cap how many devices an installation registers (max_devices). The cap covers
mesh devices and companion grid devices together and counts only devices that are still
reporting — an abandoned machine does not hold a place forever. Reaching the cap refuses the
registration of a new device (403 device_limit_reached); devices that are already
registered keep working and can re-register as usual. A licence without the field, or with
-1, means no cap.

On Android, a local load or fuzz test keeps its engine while it is running. If a dispatched grid job races with that local run, the device declines the competing job instead of interrupting the current test. Load and fuzz engines each have their own busy state.