The harness is the brain end: it accepts executors and drives them exactly as the BMA service does, so an executor cannot tell a local harness from the cloud. Assign a session, wait for it to be ready, call tools (typed session.tools.<name>.call or callTool), cancel them, open MCP channels and stop the session. A disconnected executor keeps its sessions and pending calls for the lease (60 s by default).
Generated from bma-executor-sdk 1.3.0 and its contract (contracts/bma/executor, protocol bma.executor.v1.1). Install, credentials and quick starts are on the bma-executor-sdk overview; the protocol itself is described in Executor Protocol.

Create a harness

A harness with defaults applied; authenticate verifies each upgrade request and may pin the executor identity (omit it only on loopback or in-process).

Serve executors

Accept executor connections: on a TCP port, a local Unix socket or Windows named pipe, an existing HTTP server, or in-process.

dialExecutor

Connects this harness to an executor that listens on a local socket or named pipe, so a local brain drives the hand already running on the machine.

waitExecutor

Returns a connected executor, waiting for one to register.

executors

The executors currently registered (connected or within their reconnect lease).

Executor identity and state

The id, executor info, negotiated protocol, advertised capabilities, connection state and bound sessions of one executor.

assignSession

Binds a session to the executor and sends session.assign; the work id and lease token are generated when empty. The session is bound before the request is sent, so a racing session.ready is accepted.

drain

Asks the executor to stop accepting sessions; existing sessions run to completion.

call

Sends a harness-to-executor capability request (process.*, terminal.*, skill.install, …) and decodes its result; a JSON-RPC error answer is an RPC error.

ready

Waits for the executor’s session.ready.

callTool

Sends tool.call and waits for its tool.result. Idempotent by tool_call_id (generated when empty); canceling the wait does not abort the tool, use cancelTool for that.

cancelTool

Sends tool.cancel; the waiting call still receives the executor’s tool.result (outcome canceled when the abort won).

stop

Sends session.stop; the executor terminates the session’s processes and MCP servers before answering.

Session end

Resolves when the session ends, with the end reason.

mcp

Waits for the MCP channel of one session.assign MCP server and returns it; frames are raw MCP JSON-RPC and the harness is the MCP client. A newer channel for the same key replaces the old one.