Lifecycle methods that establish, maintain, update and cleanly terminate an executor control channel (?channel=control). Every executor registers immediately after the WebSocket handshake and renews its lease via periodic heartbeats.

Methods overview

executor.register

Direction: Executor → Platform · Kind: request · Since: bma.executor.v1 Executor to harness request, the first frame on the control channel. protocol MUST equal the negotiated WebSocket subprotocol; otherwise the server answers -32010 and closes with 4003. A machine-scoped executor sends an empty environment_id. resume.active_sessions reattaches sessions after reconnect. A machine-scoped executor that declares neither capabilities.process nor capabilities.agent is answered -32012 with data.reason “capability_missing” and data.capability “process” instead of a result; no runtime is bound and the connection stays unregistered.

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

executor.heartbeat

Direction: Executor → Platform · Kind: request · Since: bma.executor.v1 Executor to harness request, sent every heartbeat_interval_ms. Two missed heartbeats expire the lease server-side. drain=true means the executor must stop accepting new sessions and finish current work.

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

executor.token.refresh

Direction: Executor → Platform · Kind: request · Since: bma.executor.v1.1 Executor to harness request. Before the current token expires the executor fetches a new one from POST /v1/machines/{machine_id}/token or POST /v1/environments/{environment_id}/token (legacy aliases POST /api/v1/executors/token, POST /v1/executors/token) with its original credential and sends it on the open control channel. The harness verifies that it names the same executor, scope and machine credential as the connection and moves the connection’s 4001 deadline to the new token’s expiry; nothing else about the connection changes. A rejected token leaves the old deadline in place. A harness without the method answers -32601; the executor then keeps reconnecting on 4001.

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

executor.capabilities.update

Direction: Executor → Platform · Kind: notification · Since: bma.executor.v1 Executor to harness notification. It may change capabilities, not the protocol version.

Parameters (Input)

Result (Output)

Notification — no JSON-RPC response frame.

Errors

Wire frame & SDK usage

executor.drain

Direction: Platform → Executor · Kind: request · Since: bma.executor.v1 Harness to executor request. The executor stops accepting new sessions, finishes current work, and reports active_sessions.

Parameters (Input)

Result (Output)

Errors

Wire frame & SDK usage

executor.close

Direction: Bidirectional · Kind: notification · Since: bma.executor.v1 Either side notification, followed by WebSocket close code 1000 or 1001.

Parameters (Input)

Result (Output)

Notification — no JSON-RPC response frame.

Errors

Wire frame & SDK usage