process.start, process.read, process.write, process.interrupt, process.terminate, process.list, process.status) and interactive PTY terminal streams (terminal.open, terminal.attach, terminal.close).
Methods overview
| Method | Direction | Kind | Since | Capability | Summary |
|---|---|---|---|---|---|
process.start | Platform → Executor | request | bma.executor.v1.1 | process.enabled | Start a process. |
process.read | Platform → Executor | request | bma.executor.v1.1 | process.enabled | Read process output from a cursor. |
process.write | Platform → Executor | request | bma.executor.v1.1 | process.enabled | Write to process stdin. |
process.interrupt | Platform → Executor | request | bma.executor.v1.1 | process.enabled | Interrupt a process (SIGINT). |
process.terminate | Platform → Executor | request | bma.executor.v1.1 | process.enabled | Terminate a process (SIGTERM, then SIGKILL after grace_ms). |
process.list | Platform → Executor | request | bma.executor.v1.1 | process.enabled | List the processes of a session. |
process.status | Executor → Platform | notification | bma.executor.v1.1 | process.enabled | Advise a process state change. |
terminal.open | Platform → Executor | request | bma.executor.v1.1 | terminal.enabled | Create or reuse a PTY. |
terminal.attach | Platform → Executor | request | bma.executor.v1.1 | terminal.enabled | Attach one consumer to a live PTY. |
terminal.close | Platform → Executor | request | bma.executor.v1.1 | terminal.enabled | Close a PTY. |
process.start
Direction: Platform → Executor · Kind: request · Since: bma.executor.v1.1 · Capability: process.enabled · Idempotent by: session_id+process_id
Harness to executor request (v1.1 §3.3). Idempotent by (session_id, process_id): a repeat returns the live state. wait_ms waits up to that long for the process to end before answering. A spawn failure is an error with data.reason “spawn_failed”. io_mode, file_transfer, package_install and git_credentials each require the matching process capability bit.
Parameters (Input)
| Name | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
session_id | string | yes | — | Target BMA session identifier (ses_...). |
process_id | string | yes | — | Managed background process identifier. |
argv | array of string | yes | — | Command and arguments (at most 256 entries, 4 KiB each, 16 KiB total). Must be empty when file_transfer or package_install is set. |
cwd | string | no | — | Working directory path. |
env | object | no | — | Environment variable key-value overrides. |
stdin | string | no | enum: open, closed | process.start stdin mode. Empty or “closed” closes stdin at start; “open” keeps it open for process.write. |
stderr | string | no | enum: merge | Empty keeps separate stdout/stderr streams. |
wait_ms | integer | no | range: 0..300000 | Duration of wait in milliseconds. |
timeout_ms | integer | no | range: 0..86400000 | Kills the process and ends it as failed with reason “timeout”. |
metadata | object | no | — | Who started the process. A process an agent tool started (a command, a file transfer, a package install) always carries agent_session_id (the public agent session id) and tool_call_id; it carries no initiator. A process the platform started on its own carries initiator “platform” and no agent_session_id. A process with neither is not started by the harness: an executor that resolves a directory, files or owner per session refuses it (reason session_rejected) instead of using a default. Human console terminals are terminal.attach, not process.start. |
io_mode | string | no | enum: pty | Requires capability process.pty. |
file_transfer | ProcessFileTransfer | no | — | Requires capability process.file_transfer. Excludes argv entries, io_mode and git_credentials. |
file_transfer.direction | string | yes | enum: upload, download | File transfer direction relative to the machine. |
file_transfer.local_path | string | yes | — | Value for local_path. |
package_install | ProcessPackageInstall | no | — | Requires capability process.package_install. Excludes argv entries, io_mode, file_transfer and git_credentials. |
package_install.manager | string | yes | enum: apt, pip, npm | Package manager for process.start package_install. |
package_install.packages | array of string | yes | — | List of packages entries. |
git_credentials | boolean | no | — | Installs a per-process Git credential helper for https://github.com that fetches short-lived tokens for this process while it runs. Requires capability process.git_credentials. |
Result (Output)
| Field | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
process_id | string | yes | — | Managed background process identifier. |
state | string | yes | enum: running, exited, failed, killed | Process state (v1.1 §3.3). |
pid | integer | no | — | OS process ID on the executor host. |
started_at | string | no | — | Timestamp when started occurred (RFC 3339, UTC). |
ended_at | string | no | — | Timestamp when ended occurred (RFC 3339, UTC). |
reason | string | no | — | Human-readable reason for the stop, cancel, or close action. |
cursors | Cursors | yes | — | Per-stream byte cursors. |
cursors.stdout | integer | yes | — | Captured standard output chunk. |
cursors.stderr | integer | yes | — | Captured standard error chunk. |
exit_code | integer | null | yes | — | Process exit status code (0 on success). |
exit_signal | string | null | yes | — | Value for exit_signal. |
stderr | string | no | — | Captured standard error chunk. |
accepted | boolean | no | — | Whether the request was accepted. |
file_transfer | FileTransferResult | no | — | Ended file transfer outcome: the uploaded path and digest, the downloaded digest, or an error. |
file_transfer.path | string | no | — | Absolute filesystem path on the executor host. |
file_transfer.digest | string | no | — | Value for digest. |
file_transfer.error | FileTransferError | no | — | Failed file transfer. |
file_transfer.error.code | string | yes | — | Value for code. |
file_transfer.error.error | string | yes | — | Value for error. |
file_transfer.error.current_digest | string | no | — | Value for current_digest. |
Errors
| JSON-RPC Code | Name | When |
|---|---|---|
-32012 | capability_unavailable | Executor did not advertise capability process.enabled. |
-32602 | invalid_params | Missing required parameter or invalid field schema. |
-32001 | unauthorized | Invalid or expired executor JWT. |
-32003 | not_found | Target session, process, terminal, or tool call does not exist. |
-32004 | timeout | Operation exceeded its deadline. |
-32009 | executor_busy | Transient backpressure; retry with backoff. |
Wire frame & SDK usage
// Request
{
"jsonrpc": "2.0",
"id": "1",
"method": "process.start",
"params": {
"session_id": "ses_01j9example000000000000000",
"process_id": "proc_01j9example00000000000000",
"argv": [],
"cwd": "/workspace"
}
}
// Response
{
"jsonrpc": "2.0",
"id": "1",
"result": {
"process_id": "proc_01j9example00000000000000",
"state": "running",
"cursors": {
"stdout": 1,
"stderr": 1
},
"exit_code": 1
}
}
// Executor end — handle `process.start` sent by the platform / harness
client.onRequest("process.start", async (params) => {
return {
"process_id": "proc_01j9example00000000000000",
"state": "running",
"cursors": {
"stdout": 1,
"stderr": 1
},
"exit_code": 1
};
});
# Executor end — handle `process.start` sent by the platform / harness
@client.on_request("process.start")
async def handle(params: dict) -> dict:
return {
"process_id": "proc_01j9example00000000000000",
"state": "running",
"cursors": {
"stdout": 1,
"stderr": 1
},
"exit_code": 1
}
// Executor end — handle `process.start` sent by the platform / harness
bmaexecutor.Requests.ProcessStart.Handle(client, func(ctx context.Context, params bmaexecutor.ProcessStartParams) (bmaexecutor.ProcessStartResult, error) {
return bmaexecutor.ProcessStartResult{
ProcessID: "proc_01j9example00000000000000",
State: "running",
ExitCode: 1,
}, nil
})
process.read
Direction: Platform → Executor · Kind: request · Since: bma.executor.v1.1 · Capability: process.enabled
Harness to executor request (v1.1 §3.4). Long-polls up to wait_ms for new bytes. gap=true when bytes before earliest_cursor were dropped from the ring buffer.
Parameters (Input)
| Name | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
session_id | string | yes | — | Target BMA session identifier (ses_...). |
process_id | string | yes | — | Managed background process identifier. |
stream | string | yes | enum: stdout, stderr | Process output stream (v1.1 §3.2). |
cursor | integer | yes | range: 0.. | Monotonic byte/frame offset cursor for incremental reads. |
max_bytes | integer | no | range: 1..32768 | Size of max in bytes. |
wait_ms | integer | no | range: 0..300000 | Duration of wait in milliseconds. |
Result (Output)
| Field | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
process_id | string | yes | — | Managed background process identifier. |
stream | string | yes | enum: stdout, stderr | Process output stream (v1.1 §3.2). |
data | string | yes | — | Base64 bytes from from_cursor to next_cursor. |
from_cursor | integer | yes | — | Value for from_cursor. |
next_cursor | integer | yes | — | Value for next_cursor. |
earliest_cursor | integer | yes | — | Value for earliest_cursor. |
gap | boolean | yes | — | Whether gap is enabled or true. |
truncated | boolean | yes | — | Whether truncated is enabled or true. |
eof | boolean | yes | — | Whether end-of-stream has been reached. |
state | string | yes | enum: running, exited, failed, killed | Process state (v1.1 §3.3). |
ended_at | string | no | — | Timestamp when ended occurred (RFC 3339, UTC). |
reason | string | no | — | Human-readable reason for the stop, cancel, or close action. |
exit_code | integer | null | yes | — | Process exit status code (0 on success). |
exit_signal | string | null | yes | — | Value for exit_signal. |
file_transfer | FileTransferResult | no | — | Ended file transfer outcome: the uploaded path and digest, the downloaded digest, or an error. |
file_transfer.path | string | no | — | Absolute filesystem path on the executor host. |
file_transfer.digest | string | no | — | Value for digest. |
file_transfer.error | FileTransferError | no | — | Failed file transfer. |
file_transfer.error.code | string | yes | — | Value for code. |
file_transfer.error.error | string | yes | — | Value for error. |
file_transfer.error.current_digest | string | no | — | Value for current_digest. |
Errors
| JSON-RPC Code | Name | When |
|---|---|---|
-32012 | capability_unavailable | Executor did not advertise capability process.enabled. |
-32602 | invalid_params | Missing required parameter or invalid field schema. |
-32001 | unauthorized | Invalid or expired executor JWT. |
-32003 | not_found | Target session, process, terminal, or tool call does not exist. |
-32004 | timeout | Operation exceeded its deadline. |
-32009 | executor_busy | Transient backpressure; retry with backoff. |
Wire frame & SDK usage
// Request
{
"jsonrpc": "2.0",
"id": "1",
"method": "process.read",
"params": {
"session_id": "ses_01j9example000000000000000",
"process_id": "proc_01j9example00000000000000",
"stream": "stdout",
"cursor": 0
}
}
// Response
{
"jsonrpc": "2.0",
"id": "1",
"result": {
"process_id": "proc_01j9example00000000000000",
"stream": "stdout",
"data": "example_data",
"from_cursor": 1
}
}
// Executor end — handle `process.read` sent by the platform / harness
client.onRequest("process.read", async (params) => {
return {
"process_id": "proc_01j9example00000000000000",
"stream": "stdout",
"data": "example_data",
"from_cursor": 1
};
});
# Executor end — handle `process.read` sent by the platform / harness
@client.on_request("process.read")
async def handle(params: dict) -> dict:
return {
"process_id": "proc_01j9example00000000000000",
"stream": "stdout",
"data": "example_data",
"from_cursor": 1
}
// Executor end — handle `process.read` sent by the platform / harness
bmaexecutor.Requests.ProcessRead.Handle(client, func(ctx context.Context, params bmaexecutor.ProcessReadParams) (bmaexecutor.ProcessReadResult, error) {
return bmaexecutor.ProcessReadResult{
ProcessID: "proc_01j9example00000000000000",
Stream: "stdout",
Data: "example_data",
FromCursor: 1,
}, nil
})
process.write
Direction: Platform → Executor · Kind: request · Since: bma.executor.v1.1 · Capability: process.enabled
Harness to executor request (v1.1 §3.5). Exactly one of data (base64, at most 32 KiB decoded) or close_stdin. close_stdin is rejected for io_mode “pty”.
Parameters (Input)
| Name | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
session_id | string | yes | — | Target BMA session identifier (ses_...). |
process_id | string | yes | — | Managed background process identifier. |
data | string | no | — | Base64-encoded binary data payload. |
close_stdin | boolean | no | — | Whether close stdin is enabled or true. |
Result (Output)
| Field | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
accepted | boolean | yes | — | Whether the request was accepted. |
Errors
| JSON-RPC Code | Name | When |
|---|---|---|
-32012 | capability_unavailable | Executor did not advertise capability process.enabled. |
-32602 | invalid_params | Missing required parameter or invalid field schema. |
-32001 | unauthorized | Invalid or expired executor JWT. |
-32003 | not_found | Target session, process, terminal, or tool call does not exist. |
-32004 | timeout | Operation exceeded its deadline. |
-32009 | executor_busy | Transient backpressure; retry with backoff. |
Wire frame & SDK usage
// Request
{
"jsonrpc": "2.0",
"id": "1",
"method": "process.write",
"params": {
"session_id": "ses_01j9example000000000000000",
"process_id": "proc_01j9example00000000000000",
"data": "example_data",
"close_stdin": true
}
}
// Response
{
"jsonrpc": "2.0",
"id": "1",
"result": {
"accepted": true
}
}
// Executor end — handle `process.write` sent by the platform / harness
client.onRequest("process.write", async (params) => {
return {
"accepted": true
};
});
# Executor end — handle `process.write` sent by the platform / harness
@client.on_request("process.write")
async def handle(params: dict) -> dict:
return {
"accepted": True
}
// Executor end — handle `process.write` sent by the platform / harness
bmaexecutor.Requests.ProcessWrite.Handle(client, func(ctx context.Context, params bmaexecutor.ProcessWriteParams) (bmaexecutor.ProcessWriteResult, error) {
return bmaexecutor.ProcessWriteResult{
Accepted: true,
}, nil
})
process.interrupt
Direction: Platform → Executor · Kind: request · Since: bma.executor.v1.1 · Capability: process.enabled
Harness to executor request (v1.1 §3.6).
Parameters (Input)
| Name | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
session_id | string | yes | — | Target BMA session identifier (ses_...). |
process_id | string | yes | — | Managed background process identifier. |
grace_ms | integer | null | no | range: 0..30000 | Only meaningful for process.terminate. |
Result (Output)
| Field | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
process_id | string | yes | — | Managed background process identifier. |
state | string | yes | enum: running, exited, failed, killed | Process state (v1.1 §3.3). |
pid | integer | no | — | OS process ID on the executor host. |
started_at | string | no | — | Timestamp when started occurred (RFC 3339, UTC). |
ended_at | string | no | — | Timestamp when ended occurred (RFC 3339, UTC). |
reason | string | no | — | Human-readable reason for the stop, cancel, or close action. |
cursors | Cursors | yes | — | Per-stream byte cursors. |
cursors.stdout | integer | yes | — | Captured standard output chunk. |
cursors.stderr | integer | yes | — | Captured standard error chunk. |
exit_code | integer | null | yes | — | Process exit status code (0 on success). |
exit_signal | string | null | yes | — | Value for exit_signal. |
stderr | string | no | — | Captured standard error chunk. |
accepted | boolean | no | — | Whether the request was accepted. |
file_transfer | FileTransferResult | no | — | Ended file transfer outcome: the uploaded path and digest, the downloaded digest, or an error. |
file_transfer.path | string | no | — | Absolute filesystem path on the executor host. |
file_transfer.digest | string | no | — | Value for digest. |
file_transfer.error | FileTransferError | no | — | Failed file transfer. |
file_transfer.error.code | string | yes | — | Value for code. |
file_transfer.error.error | string | yes | — | Value for error. |
file_transfer.error.current_digest | string | no | — | Value for current_digest. |
Errors
| JSON-RPC Code | Name | When |
|---|---|---|
-32012 | capability_unavailable | Executor did not advertise capability process.enabled. |
-32602 | invalid_params | Missing required parameter or invalid field schema. |
-32001 | unauthorized | Invalid or expired executor JWT. |
-32003 | not_found | Target session, process, terminal, or tool call does not exist. |
-32004 | timeout | Operation exceeded its deadline. |
-32009 | executor_busy | Transient backpressure; retry with backoff. |
Wire frame & SDK usage
// Request
{
"jsonrpc": "2.0",
"id": "1",
"method": "process.interrupt",
"params": {
"session_id": "ses_01j9example000000000000000",
"process_id": "proc_01j9example00000000000000",
"grace_ms": 0
}
}
// Response
{
"jsonrpc": "2.0",
"id": "1",
"result": {
"process_id": "proc_01j9example00000000000000",
"state": "running",
"cursors": {
"stdout": 1,
"stderr": 1
},
"exit_code": 1
}
}
// Executor end — handle `process.interrupt` sent by the platform / harness
client.onRequest("process.interrupt", async (params) => {
return {
"process_id": "proc_01j9example00000000000000",
"state": "running",
"cursors": {
"stdout": 1,
"stderr": 1
},
"exit_code": 1
};
});
# Executor end — handle `process.interrupt` sent by the platform / harness
@client.on_request("process.interrupt")
async def handle(params: dict) -> dict:
return {
"process_id": "proc_01j9example00000000000000",
"state": "running",
"cursors": {
"stdout": 1,
"stderr": 1
},
"exit_code": 1
}
// Executor end — handle `process.interrupt` sent by the platform / harness
bmaexecutor.Requests.ProcessInterrupt.Handle(client, func(ctx context.Context, params bmaexecutor.ProcessInterruptParams) (bmaexecutor.ProcessInterruptResult, error) {
return bmaexecutor.ProcessInterruptResult{
ProcessID: "proc_01j9example00000000000000",
State: "running",
ExitCode: 1,
}, nil
})
process.terminate
Direction: Platform → Executor · Kind: request · Since: bma.executor.v1.1 · Capability: process.enabled
Harness to executor request (v1.1 §3.6).
Parameters (Input)
| Name | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
session_id | string | yes | — | Target BMA session identifier (ses_...). |
process_id | string | yes | — | Managed background process identifier. |
grace_ms | integer | null | no | range: 0..30000 | Only meaningful for process.terminate. |
Result (Output)
| Field | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
process_id | string | yes | — | Managed background process identifier. |
state | string | yes | enum: running, exited, failed, killed | Process state (v1.1 §3.3). |
pid | integer | no | — | OS process ID on the executor host. |
started_at | string | no | — | Timestamp when started occurred (RFC 3339, UTC). |
ended_at | string | no | — | Timestamp when ended occurred (RFC 3339, UTC). |
reason | string | no | — | Human-readable reason for the stop, cancel, or close action. |
cursors | Cursors | yes | — | Per-stream byte cursors. |
cursors.stdout | integer | yes | — | Captured standard output chunk. |
cursors.stderr | integer | yes | — | Captured standard error chunk. |
exit_code | integer | null | yes | — | Process exit status code (0 on success). |
exit_signal | string | null | yes | — | Value for exit_signal. |
stderr | string | no | — | Captured standard error chunk. |
accepted | boolean | no | — | Whether the request was accepted. |
file_transfer | FileTransferResult | no | — | Ended file transfer outcome: the uploaded path and digest, the downloaded digest, or an error. |
file_transfer.path | string | no | — | Absolute filesystem path on the executor host. |
file_transfer.digest | string | no | — | Value for digest. |
file_transfer.error | FileTransferError | no | — | Failed file transfer. |
file_transfer.error.code | string | yes | — | Value for code. |
file_transfer.error.error | string | yes | — | Value for error. |
file_transfer.error.current_digest | string | no | — | Value for current_digest. |
Errors
| JSON-RPC Code | Name | When |
|---|---|---|
-32012 | capability_unavailable | Executor did not advertise capability process.enabled. |
-32602 | invalid_params | Missing required parameter or invalid field schema. |
-32001 | unauthorized | Invalid or expired executor JWT. |
-32003 | not_found | Target session, process, terminal, or tool call does not exist. |
-32004 | timeout | Operation exceeded its deadline. |
-32009 | executor_busy | Transient backpressure; retry with backoff. |
Wire frame & SDK usage
// Request
{
"jsonrpc": "2.0",
"id": "1",
"method": "process.terminate",
"params": {
"session_id": "ses_01j9example000000000000000",
"process_id": "proc_01j9example00000000000000",
"grace_ms": 0
}
}
// Response
{
"jsonrpc": "2.0",
"id": "1",
"result": {
"process_id": "proc_01j9example00000000000000",
"state": "running",
"cursors": {
"stdout": 1,
"stderr": 1
},
"exit_code": 1
}
}
// Executor end — handle `process.terminate` sent by the platform / harness
client.onRequest("process.terminate", async (params) => {
return {
"process_id": "proc_01j9example00000000000000",
"state": "running",
"cursors": {
"stdout": 1,
"stderr": 1
},
"exit_code": 1
};
});
# Executor end — handle `process.terminate` sent by the platform / harness
@client.on_request("process.terminate")
async def handle(params: dict) -> dict:
return {
"process_id": "proc_01j9example00000000000000",
"state": "running",
"cursors": {
"stdout": 1,
"stderr": 1
},
"exit_code": 1
}
// Executor end — handle `process.terminate` sent by the platform / harness
bmaexecutor.Requests.ProcessTerminate.Handle(client, func(ctx context.Context, params bmaexecutor.ProcessTerminateParams) (bmaexecutor.ProcessTerminateResult, error) {
return bmaexecutor.ProcessTerminateResult{
ProcessID: "proc_01j9example00000000000000",
State: "running",
ExitCode: 1,
}, nil
})
process.list
Direction: Platform → Executor · Kind: request · Since: bma.executor.v1.1 · Capability: process.enabled
Harness to executor request (v1.1 §3.7). A new connection starts with an empty process table.
Parameters (Input)
| Name | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
session_id | string | yes | — | Target BMA session identifier (ses_...). |
Result (Output)
| Field | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
processes | array of ProcessState | yes | — | List of processes entries. |
processes[].process_id | string | yes | — | Managed background process identifier. |
processes[].state | string | yes | enum: running, exited, failed, killed | Process state (v1.1 §3.3). |
processes[].pid | integer | no | — | OS process ID on the executor host. |
processes[].started_at | string | no | — | Timestamp when started occurred (RFC 3339, UTC). |
processes[].ended_at | string | no | — | Timestamp when ended occurred (RFC 3339, UTC). |
processes[].reason | string | no | — | Human-readable reason for the stop, cancel, or close action. |
processes[].cursors | Cursors | yes | — | Per-stream byte cursors. |
processes[].cursors.stdout | integer | yes | — | Captured standard output chunk. |
processes[].cursors.stderr | integer | yes | — | Captured standard error chunk. |
processes[].exit_code | integer | null | yes | — | Process exit status code (0 on success). |
processes[].exit_signal | string | null | yes | — | Value for exit_signal. |
processes[].stderr | string | no | — | Captured standard error chunk. |
processes[].accepted | boolean | no | — | Whether the request was accepted. |
processes[].file_transfer | FileTransferResult | no | — | Ended file transfer outcome: the uploaded path and digest, the downloaded digest, or an error. |
processes[].file_transfer.path | string | no | — | Absolute filesystem path on the executor host. |
processes[].file_transfer.digest | string | no | — | Value for digest. |
processes[].file_transfer.error | FileTransferError | no | — | Failed file transfer. |
Errors
| JSON-RPC Code | Name | When |
|---|---|---|
-32012 | capability_unavailable | Executor did not advertise capability process.enabled. |
-32602 | invalid_params | Missing required parameter or invalid field schema. |
-32001 | unauthorized | Invalid or expired executor JWT. |
-32003 | not_found | Target session, process, terminal, or tool call does not exist. |
-32004 | timeout | Operation exceeded its deadline. |
-32009 | executor_busy | Transient backpressure; retry with backoff. |
Wire frame & SDK usage
// Request
{
"jsonrpc": "2.0",
"id": "1",
"method": "process.list",
"params": {
"session_id": "ses_01j9example000000000000000"
}
}
// Response
{
"jsonrpc": "2.0",
"id": "1",
"result": {
"processes": []
}
}
// Executor end — handle `process.list` sent by the platform / harness
client.onRequest("process.list", async (params) => {
return {
"processes": []
};
});
# Executor end — handle `process.list` sent by the platform / harness
@client.on_request("process.list")
async def handle(params: dict) -> dict:
return {
"processes": []
}
// Executor end — handle `process.list` sent by the platform / harness
bmaexecutor.Requests.ProcessList.Handle(client, func(ctx context.Context, params bmaexecutor.ProcessListParams) (bmaexecutor.ProcessListResult, error) {
return bmaexecutor.ProcessListResult{}, nil
})
process.status
Direction: Executor → Platform · Kind: notification · Since: bma.executor.v1.1 · Capability: process.enabled
Executor to harness notification (v1.1 §3.8). Advisory: the harness confirms state with process.read or process.list.
Parameters (Input)
| Name | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
session_id | string | yes | — | Target BMA session identifier (ses_...). |
process_id | string | yes | — | Managed background process identifier. |
state | string | yes | enum: running, exited, failed, killed | Process state (v1.1 §3.3). |
exit_code | integer | null | no | — | Process exit status code (0 on success). |
exit_signal | string | null | no | — | Value for exit_signal. |
ended_at | string | no | — | Timestamp when ended occurred (RFC 3339, UTC). |
reason | string | no | — | Human-readable reason for the stop, cancel, or close action. |
observed_at | string | yes | — | Timestamp when observed occurred (RFC 3339, UTC). |
Result (Output)
Notification — no JSON-RPC response frame.Errors
| JSON-RPC Code | Name | When |
|---|---|---|
-32012 | capability_unavailable | Executor did not advertise capability process.enabled. |
-32602 | invalid_params | Missing required parameter or invalid field schema. |
Wire frame & SDK usage
{
"jsonrpc": "2.0",
"method": "process.status",
"params": {
"session_id": "ses_01j9example000000000000000",
"process_id": "proc_01j9example00000000000000",
"state": "running",
"exit_code": 1,
"observed_at": "2026-11-25T00:00:00Z"
}
}
// Executor end — send `process.status` notification
await client.notify("process.status", {
"session_id": "ses_01j9example000000000000000",
"process_id": "proc_01j9example00000000000000",
"state": "running",
"exit_code": 1,
"observed_at": "2026-11-25T00:00:00Z"
});
# Executor end — send `process.status` notification
await client.notify("process.status", {
"session_id": "ses_01j9example000000000000000",
"process_id": "proc_01j9example00000000000000",
"state": "running",
"exit_code": 1,
"observed_at": "2026-11-25T00:00:00Z"
})
// Executor end — send `process.status` notification
err := bmaexecutor.Notifications.ProcessStatus.Notify(ctx, client, bmaexecutor.ProcessStatusParams{
SessionID: "ses_01j9example000000000000000",
ProcessID: "proc_01j9example00000000000000",
State: "running",
ExitCode: 1,
})
terminal.open
Direction: Platform → Executor · Kind: request · Since: bma.executor.v1.1 · Capability: terminal.enabled · Idempotent by: terminal_id
Harness to executor request (machine-scoped). Returns the live PTY with the same terminal_id; rows/cols only size a new PTY, and the rest of the spec must match a live terminal or the executor answers -32013.
Parameters (Input)
| Name | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
terminal_id | string | yes | — | Interactive PTY terminal identifier. |
kind | string | yes | — | human or agent. |
shell | string | no | — | Value for shell. |
argv | array of string | no | — | List of argv entries. |
cwd | string | no | — | Working directory path. |
env | object | no | — | Environment variable key-value overrides. |
rows | integer | no | — | Terminal height in rows. |
cols | integer | no | — | Terminal width in columns. |
Result (Output)
| Field | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
terminal_id | string | yes | — | Interactive PTY terminal identifier. |
epoch | integer | yes | — | Value for epoch. |
pid | integer | yes | — | OS process ID on the executor host. |
rows | integer | yes | — | Terminal height in rows. |
cols | integer | yes | — | Terminal width in columns. |
earliest_seq | integer | yes | — | Value for earliest_seq. |
latest_seq | integer | yes | — | Value for latest_seq. |
created_at | string | yes | — | Timestamp when created occurred (RFC 3339, UTC). |
Errors
| JSON-RPC Code | Name | When |
|---|---|---|
-32012 | capability_unavailable | Executor did not advertise capability terminal.enabled. |
-32602 | invalid_params | Missing required parameter or invalid field schema. |
-32001 | unauthorized | Invalid or expired executor JWT. |
-32003 | not_found | Target session, process, terminal, or tool call does not exist. |
-32004 | timeout | Operation exceeded its deadline. |
-32009 | executor_busy | Transient backpressure; retry with backoff. |
Wire frame & SDK usage
// Request
{
"jsonrpc": "2.0",
"id": "1",
"method": "terminal.open",
"params": {
"terminal_id": "term_01j9example00000000000000",
"kind": "example_kind",
"shell": "example_shell",
"argv": []
}
}
// Response
{
"jsonrpc": "2.0",
"id": "1",
"result": {
"terminal_id": "term_01j9example00000000000000",
"epoch": 1,
"pid": 1,
"rows": 1
}
}
// Executor end — handle `terminal.open` sent by the platform / harness
client.onRequest("terminal.open", async (params) => {
return {
"terminal_id": "term_01j9example00000000000000",
"epoch": 1,
"pid": 1,
"rows": 1
};
});
# Executor end — handle `terminal.open` sent by the platform / harness
@client.on_request("terminal.open")
async def handle(params: dict) -> dict:
return {
"terminal_id": "term_01j9example00000000000000",
"epoch": 1,
"pid": 1,
"rows": 1
}
// Executor end — handle `terminal.open` sent by the platform / harness
bmaexecutor.Requests.TerminalOpen.Handle(client, func(ctx context.Context, params bmaexecutor.TerminalOpenParams) (bmaexecutor.TerminalOpenResult, error) {
return bmaexecutor.TerminalOpenResult{
TerminalID: "term_01j9example00000000000000",
Epoch: 1,
PID: 1,
Rows: 1,
}, nil
})
terminal.attach
Direction: Platform → Executor · Kind: request · Since: bma.executor.v1.1 · Capability: terminal.enabled
Harness to executor request. The executor dials host.url with the ticket, offering subprotocol bma.terminal.v1, and answers after the attached frame was written. from_seq/ack_seq resume output exactly as the bma.terminal.v1 attach frame does; can_write requests the single writer lease. Closing the host socket detaches; the PTY survives.
Parameters (Input)
| Name | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
terminal_id | string | yes | — | Interactive PTY terminal identifier. |
epoch | integer | yes | — | Value for epoch. |
stream_id | string | yes | — | Identifier of the stream. |
can_write | boolean | yes | — | Whether can write is enabled or true. |
from_seq | integer | yes | — | Value for from_seq. |
ack_seq | integer | yes | — | Value for ack_seq. |
host | TerminalHost | yes | — | Outbound host socket for one attach. The ticket is a single-use, short-lived bearer credential sent only in the Authorization header, never in the URL. |
host.url | string | yes | — | Resource URL. |
host.ticket | string | yes | — | Value for ticket. |
Result (Output)
| Field | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
accepted | boolean | yes | — | Whether the request was accepted. |
writer_epoch | integer | yes | — | Value for writer_epoch. |
Errors
| JSON-RPC Code | Name | When |
|---|---|---|
-32012 | capability_unavailable | Executor did not advertise capability terminal.enabled. |
-32602 | invalid_params | Missing required parameter or invalid field schema. |
-32001 | unauthorized | Invalid or expired executor JWT. |
-32003 | not_found | Target session, process, terminal, or tool call does not exist. |
-32004 | timeout | Operation exceeded its deadline. |
-32009 | executor_busy | Transient backpressure; retry with backoff. |
Wire frame & SDK usage
// Request
{
"jsonrpc": "2.0",
"id": "1",
"method": "terminal.attach",
"params": {
"terminal_id": "term_01j9example00000000000000",
"epoch": 1,
"stream_id": "example_stream_id",
"can_write": true,
"from_seq": 1,
"ack_seq": 1,
"host": {
"url": "example_url",
"ticket": "example_ticket"
}
}
}
// Response
{
"jsonrpc": "2.0",
"id": "1",
"result": {
"accepted": true,
"writer_epoch": 1
}
}
// Executor end — handle `terminal.attach` sent by the platform / harness
client.onRequest("terminal.attach", async (params) => {
return {
"accepted": true,
"writer_epoch": 1
};
});
# Executor end — handle `terminal.attach` sent by the platform / harness
@client.on_request("terminal.attach")
async def handle(params: dict) -> dict:
return {
"accepted": True,
"writer_epoch": 1
}
// Executor end — handle `terminal.attach` sent by the platform / harness
bmaexecutor.Requests.TerminalAttach.Handle(client, func(ctx context.Context, params bmaexecutor.TerminalAttachParams) (bmaexecutor.TerminalAttachResult, error) {
return bmaexecutor.TerminalAttachResult{
Accepted: true,
WriterEpoch: 1,
}, nil
})
terminal.close
Direction: Platform → Executor · Kind: request · Since: bma.executor.v1.1 · Capability: terminal.enabled · Idempotent by: terminal_id
Harness to executor request. Idempotent.
Parameters (Input)
| Name | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
terminal_id | string | yes | — | Interactive PTY terminal identifier. |
reason | string | no | — | Human-readable reason for the stop, cancel, or close action. |
Result (Output)
| Field | Type | Required | Enum / Constraints | Description |
|---|---|---|---|---|
closed | boolean | yes | — | Whether closed is enabled or true. |
exit_code | integer | null | no | — | Process exit status code (0 on success). |
Errors
| JSON-RPC Code | Name | When |
|---|---|---|
-32012 | capability_unavailable | Executor did not advertise capability terminal.enabled. |
-32602 | invalid_params | Missing required parameter or invalid field schema. |
-32001 | unauthorized | Invalid or expired executor JWT. |
-32003 | not_found | Target session, process, terminal, or tool call does not exist. |
-32004 | timeout | Operation exceeded its deadline. |
-32009 | executor_busy | Transient backpressure; retry with backoff. |
Wire frame & SDK usage
// Request
{
"jsonrpc": "2.0",
"id": "1",
"method": "terminal.close",
"params": {
"terminal_id": "term_01j9example00000000000000",
"reason": "example_reason"
}
}
// Response
{
"jsonrpc": "2.0",
"id": "1",
"result": {
"closed": true
}
}
// Executor end — handle `terminal.close` sent by the platform / harness
client.onRequest("terminal.close", async (params) => {
return {
"closed": true
};
});
# Executor end — handle `terminal.close` sent by the platform / harness
@client.on_request("terminal.close")
async def handle(params: dict) -> dict:
return {
"closed": True
}
// Executor end — handle `terminal.close` sent by the platform / harness
bmaexecutor.Requests.TerminalClose.Handle(client, func(ctx context.Context, params bmaexecutor.TerminalCloseParams) (bmaexecutor.TerminalCloseResult, error) {
return bmaexecutor.TerminalCloseResult{
Closed: true,
}, nil
})