@beeos-ai/bma-executor-sdk 1.16.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/generated/executor.d.ts +8 -8
- package/dist/generated/executor.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ socket or Windows named pipe (`unix://`, `npipe://`), in-process.
|
|
|
18
18
|
| Version | 1.0.0 (tag `v1.0.0`), see [CHANGELOG](../CHANGELOG.md) |
|
|
19
19
|
| Protocol | `bma.executor.v1.1` (contract 1.1.0, [`lock.json`](../contracts/bma/executor/lock.json)) |
|
|
20
20
|
| Node.js | 20 or newer; ESM, depends on `ws` and `@types/ws` (the declarations use `ws` types) |
|
|
21
|
-
| Integration guide | [docs/executor](../docs/executor/README.md)
|
|
21
|
+
| Integration guide | [docs/executor](../docs/executor/README.md) |
|
|
22
22
|
|
|
23
23
|
```sh
|
|
24
24
|
npm install @beeos-ai/bma-executor-sdk@1.0.2
|
|
@@ -23,15 +23,15 @@ export interface AgentCapability {
|
|
|
23
23
|
max_sessions?: number;
|
|
24
24
|
/** The executor keeps the state of its turns across a process restart. When it registers again without a session whose turn was running, the platform starts the same turn again in a new event epoch (turn.start with the same turn_id, input_id and executor_session_ref, then the turn.input the turn already received) and the executor continues the turn from its own state. Without it such a turn ends failed (session.error, session.status_idle retries_exhausted) and is not sent again: an executor without that state would run the turn again from its opening input and repeat tool calls whose effects already happened. */
|
|
25
25
|
turn_resume?: boolean;
|
|
26
|
-
/** Per-turn credentials the executor asks the platform to hand it in turn.start metadata: brain_tools (tools_mcp_url, tools_mcp_token: the session's tools endpoint) and harness_model (model_base_url, model_token: the session's model endpoint; optionally model_context_window and model_max_output_tokens, positive integer strings: the resolved model's context window and output ceiling, absent when the platform has no catalog entry for the model, in which case the executor uses its own defaults; contract 1.27.0: model_input_images, true or false (strings): whether the turn's model accepts images, from its provider's model list, absent when unknown; with false the brain sends the model no image of a tool result (screenshots, generate_image previews), only their text). A declaration only states what the executor can use; the platform decides by the executor's identity: a platform service executor gets what it declares; on a platform-managed pool machine an ACP harness turn gets harness_model by default, without a declaration; a BYO machine gets harness_model only when it declares it, and an undeclared BYO machine gets nothing, so it keeps using the model endpoint configured on it and the platform never overrides that upstream. brain_tools (contract 1.4.0) is handed to a tenant executor only when the session binds this machine as the brain machine and a different machine as the hands machine (brain and hands apart, ADR-0029) and the executor declared brain_tools; the token is bound to the org, the session, the turn, this machine and the brain epoch of the turn (the event epoch of the turn.start that carries it), so a turn started again in a new epoch gets a new token and calls made with the previous epoch's token are refused. When one machine is both brain and hands nothing is handed (the executor runs its tools itself); a platform service executor and an executor that did not declare brain_tools never get it. Until contract 1.4.0 brain_tools was never handed to a tenant executor. The harness_model token is a bma-model token bound to the turn's org, session, turn and machine (model_base_url is the machine's proxy path). Tokens are computed for each turn.start, are valid until the turn ends, and are never stored. */
|
|
27
|
-
platform_credentials?: Array<'brain_tools' | 'harness_model'>;
|
|
26
|
+
/** Per-turn credentials the executor asks the platform to hand it in turn.start metadata: brain_tools (tools_mcp_url, tools_mcp_token: the session's tools endpoint) and harness_model (model_base_url, model_token: the session's model endpoint; optionally model_context_window and model_max_output_tokens, positive integer strings: the resolved model's context window and output ceiling, absent when the platform has no catalog entry for the model, in which case the executor uses its own defaults; contract 1.27.0: model_input_images, true or false (strings): whether the turn's model accepts images, from its provider's model list, absent when unknown; with false the brain sends the model no image of a tool result (screenshots, generate_image previews), only their text). A declaration only states what the executor can use; the platform decides by the executor's identity: a platform service executor gets what it declares; on a platform-managed pool machine an ACP harness turn gets harness_model by default, without a declaration; a BYO machine gets harness_model only when it declares it, and an undeclared BYO machine gets nothing, so it keeps using the model endpoint configured on it and the platform never overrides that upstream. brain_tools (contract 1.4.0) is handed to a tenant executor only when the session binds this machine as the brain machine and a different machine as the hands machine (brain and hands apart, ADR-0029) and the executor declared brain_tools; the token is bound to the org, the session, the turn, this machine and the brain epoch of the turn (the event epoch of the turn.start that carries it), so a turn started again in a new epoch gets a new token and calls made with the previous epoch's token are refused. When one machine is both brain and hands nothing is handed (the executor runs its tools itself); a platform service executor and an executor that did not declare brain_tools never get it. Until contract 1.4.0 brain_tools was never handed to a tenant executor. The harness_model token is a bma-model token bound to the turn's org, session, turn and machine (model_base_url is the machine's proxy path). Tokens are computed for each turn.start, are valid until the turn ends, and are never stored. platform_tools (contract 2.4.0): for a turn whose brain runs on this machine and runs its own tools here (no tools_mcp_*), platform_tools_mcp_url (the platform tools endpoint of this machine, https://executor.<domain>/v1/machines/{machine_id}/mcp), platform_tools_mcp_token and platform_tools_mcp_token_expires_at, handed with AgentTurnConfig.platform_tools only, to an executor that also declares agent.platform_tools, when the turn's agent enables a platform tool offered to brains on a machine (web_search, web_fetch). The token is bound to the org, the session, the turn, this machine and the turn's epoch, lives 1 hour and is renewed with tools_token.refresh; with it the endpoint lists and runs only the turn's platform_tools (any other tool name answers invalid params), so it can be handed to a tenant executor: it never reaches a machine tool. An executor that does not declare it gets neither the credential nor those tools and its turns run as before. */
|
|
27
|
+
platform_credentials?: Array<'brain_tools' | 'harness_model' | 'platform_tools'>;
|
|
28
28
|
/** The executor runs custom tools defined by the platform agent: it emits agent.custom_tool_use for a call to one and waits for agent.custom_tool_result. The platform sends the definitions of the turn's agent with every turn.start (AgentTurnConfig.custom_tools, contract 1.7.0) and only to an executor that declares this member. Without it the platform never sends agent.custom_tool_result and answers a user.custom_tool_result for the session with an error; a turn of an agent that has custom tools sent to an executor without it ends failed with session.error (bma_error_code custom_tools_unsupported), never with the tools silently dropped. */
|
|
29
29
|
custom_tools?: boolean;
|
|
30
30
|
/** Contract 1.8.0. The executor's brain offers the model the host tools a turn.start declares (AgentTurnConfig.host_tools) and runs them through the turn's tools endpoint. Without it the platform does not send host_tools, and a session whose hands machine has computer use gets no computer use tools from this brain. Absent means false. */
|
|
31
31
|
host_tools?: boolean;
|
|
32
32
|
/** Contract 1.14.0. The executor's brain offers the model the MCP tools a turn.start declares (AgentTurnConfig.mcp_tools), runs them through the turn's tools endpoint under their name, and reports each call as agent.mcp_tool_use and agent.mcp_tool_result (not agent.tool_use). Without it the platform does not send mcp_tools, and a turn of an agent whose mcp_toolset enables tools, sent with tools_mcp_* to this executor, ends failed with session.error (bma_error_code mcp_tools_unsupported), never with the tools silently dropped. An executor that runs its tools itself (no tools_mcp_* in turn.start) is never sent the agent's MCP tools, declared or not, and its turns run without them. Absent means false. */
|
|
33
33
|
mcp_tools?: boolean;
|
|
34
|
-
/** Contract 1.26.0. The executor's brain offers the model the platform tools a turn.start declares (AgentTurnConfig.platform_tools), runs them through the turn's tools endpoint under their name, reports each call as agent.tool_use and agent.tool_result, and copies the files of the answer's structuredContent.files into agent.tool_result.bma_files. Without it the platform does not send platform_tools and the turn runs without them (they are added by the platform, not declared tools of the executor). Absent means false. */
|
|
34
|
+
/** Contract 1.26.0. The executor's brain offers the model the platform tools a turn.start declares (AgentTurnConfig.platform_tools), runs them through the turn's tools endpoint under their name, reports each call as agent.tool_use and agent.tool_result, and copies the files of the answer's structuredContent.files into agent.tool_result.bma_files. Without it the platform does not send platform_tools and the turn runs without them (they are added by the platform, not declared tools of the executor). Absent means false. Contract 2.4.0: on an executor whose brain runs its tools on its own machine, with platform_credentials platform_tools, the tools endpoint of those calls is platform_tools_mcp_url with platform_tools_mcp_token; only these calls leave the machine. */
|
|
35
35
|
platform_tools?: boolean;
|
|
36
36
|
/** Deprecated: one hosted agent. Use harnesses; an executor that sets both lists this one in harnesses too. */
|
|
37
37
|
harness?: AgentHarnessCapability;
|
|
@@ -206,7 +206,7 @@ export interface AgentTurnConfig {
|
|
|
206
206
|
host_tools?: Array<HostTool>;
|
|
207
207
|
/** Contract 1.14.0. Requested only, sent only to an executor that declared agent.mcp_tools and only with tools_mcp_* in metadata (omitted when the turn has none). The enabled tools of the MCP servers of the turn's agent version (official mcp_servers with an mcp_toolset): the platform connects each server with its credential (the server's bma_auth, else the session's vaults), lists its tools when the turn starts and evaluates the mcp_toolset permission of each. The brain offers every entry to the model under name with input_schema exactly, next to its own tools, and runs a call like its other tools through tools_mcp_url under that name; the brain never connects an MCP server itself and never sees its credential. A server that could not be listed contributes no entry; the platform reports it as session.error (mcp_connection_failed_error or mcp_authentication_failed_error) and the turn goes on. A name that collides with one of the brain's own tools answers -32602 invalid params. The set may differ from turn to turn; a turn sees the set of its own turn.start. */
|
|
208
208
|
mcp_tools?: Array<McpToolDefinition>;
|
|
209
|
-
/** Contract 1.26.0. Requested only, sent only to an executor that declared agent.platform_tools and only with tools_mcp_* in metadata (omitted when the turn has none). Tools the platform runs itself, on no machine, that the turn's agent enables (generate_image: agent tools entry bma_image_generation_20261201 and a session model route that lists image models). The brain offers every entry to the model under name with input_schema exactly (the platform fills turn-specific values such as the generate_image model enum), next to its own tools, and runs a call like its other tools through tools_mcp_url under that name, with the same _meta approval, idempotency key and sync_wait_ms; ask is asked once per call (interaction kind permission). A result image (an image content block of the answer, the preview of a generated image) reaches the model with that result only when the model accepts images and is never written to a session event; the brain copies structuredContent.files of the answer into agent.tool_result.bma_files. A name that collides with one of the brain's own tools answers -32602 invalid params. The set may differ from turn to turn; a turn sees the set of its own turn.start. */
|
|
209
|
+
/** Contract 1.26.0. Requested only, sent only to an executor that declared agent.platform_tools and only with tools_mcp_* in metadata (omitted when the turn has none). Tools the platform runs itself, on no machine, that the turn's agent enables (generate_image: agent tools entry bma_image_generation_20261201 and a session model route that lists image models). The brain offers every entry to the model under name with input_schema exactly (the platform fills turn-specific values such as the generate_image model enum), next to its own tools, and runs a call like its other tools through tools_mcp_url under that name, with the same _meta approval, idempotency key and sync_wait_ms; ask is asked once per call (interaction kind permission). A result image (an image content block of the answer, the preview of a generated image) reaches the model with that result only when the model accepts images and is never written to a session event; the brain copies structuredContent.files of the answer into agent.tool_result.bma_files. A name that collides with one of the brain's own tools answers -32602 invalid params. The set may differ from turn to turn; a turn sees the set of its own turn.start. Contract 2.4.0: also sent, with platform_tools_mcp_* in metadata instead, to a brain that runs its tools on the session's machine (its executor declared agent.platform_tools and platform_credentials platform_tools), with only web_search and web_fetch; that brain runs these entries through platform_tools_mcp_url exactly like a brain with tools_mcp_* runs them through tools_mcp_url (same _meta, approval, idempotency key and events) and keeps running every other tool on its machine. */
|
|
210
210
|
platform_tools?: Array<PlatformTool>;
|
|
211
211
|
/** Id of the hosted agent (one of the capability harnesses[].id) the turn runs on. Omitted: the executor's only harness. An id the executor does not host answers -32012 capability_unavailable. */
|
|
212
212
|
harness?: string;
|
|
@@ -481,14 +481,14 @@ export interface ExecutorTokenRefreshResult {
|
|
|
481
481
|
/** RFC 3339 time of the new connection deadline. */
|
|
482
482
|
expires_at: string;
|
|
483
483
|
}
|
|
484
|
-
/** Token request body for POST /v1/machines/{machine_id}/token (bearer: machine daemon token) and POST /v1/environments/{environment_id}/token (bearer: environment key); the legacy
|
|
484
|
+
/** Token request body for POST /v1/machines/{machine_id}/token (bearer: machine daemon token) and POST /v1/environments/{environment_id}/token (bearer: environment key); the legacy aliases take one bearer each: POST /api/v1/executors/token a machine daemon token, POST /v1/executors/token an environment key (the other kind is answered 401). The id in the path must equal the credential's machine or environment, otherwise 404; on the new paths environment_id may be empty or absent for a machine and, when sent for an environment, must equal the path id. An empty environment_id with a machine token requests a machine-scoped executor: its executor_id is exec_<machine_id>, stable across refreshes, and the JWT carries machine_id and daemon_token_id. */
|
|
485
485
|
export interface ExecutorTokenRequest {
|
|
486
486
|
environment_id: string;
|
|
487
487
|
executor: ExecutorInfo;
|
|
488
488
|
/** Contract 1.23.0, optional (ADR-0083). One instance of a platform brain fleet: the instances of a platform brain machine share its machine credential, and each exchanges it for a token of its own instance (for example its pod name), so each holds its own control channel and the platform spreads sessions over them. Only the deployment's platform brain machines may send it (others: 400 invalid_request_error). Omitted: the machine's own executor. */
|
|
489
489
|
instance_id?: string;
|
|
490
490
|
}
|
|
491
|
-
/** Token response of POST /v1/machines/{machine_id}/token, POST /v1/environments/{environment_id}/token and the legacy
|
|
491
|
+
/** Token response of POST /v1/machines/{machine_id}/token, POST /v1/environments/{environment_id}/token and the legacy aliases POST /api/v1/executors/token and POST /v1/executors/token. */
|
|
492
492
|
export interface ExecutorTokenResponse {
|
|
493
493
|
executor_id: string;
|
|
494
494
|
/** Short-lived executor JWT, sent only in the Authorization header of the channel upgrade. */
|
|
@@ -1420,7 +1420,7 @@ export interface ToolResultFile {
|
|
|
1420
1420
|
/** The model that generated the file (generated files only). */
|
|
1421
1421
|
model?: string;
|
|
1422
1422
|
}
|
|
1423
|
-
/** Contract 1.4.0. tools_token.refresh result: the credential for the turn's next platform tool calls, in the form of the turn.start metadata tools_mcp_url, tools_mcp_token and tools_mcp_token_expires_at. */
|
|
1423
|
+
/** Contract 1.4.0. tools_token.refresh result: the credential for the turn's next platform tool calls, in the form of the turn.start metadata tools_mcp_url, tools_mcp_token and tools_mcp_token_expires_at. Contract 2.4.0: for a turn started with platform_tools_mcp_* it is that credential renewed (the same members, used as platform_tools_mcp_url and platform_tools_mcp_token). */
|
|
1424
1424
|
export interface ToolsTokenRefreshResult {
|
|
1425
1425
|
/** Bearer token for tools_mcp_url, bound to the org, session, turn, brain machine and brain epoch of the turn. Valid until expires_at. */
|
|
1426
1426
|
tools_mcp_token: string;
|
|
@@ -1897,7 +1897,7 @@ export interface TurnStartParams {
|
|
|
1897
1897
|
executor_session_ref?: string;
|
|
1898
1898
|
config?: AgentTurnConfig;
|
|
1899
1899
|
deadline_ms?: number;
|
|
1900
|
-
/** String key/value pairs the platform adds to the turn. Per-turn credentials the executor declared in AgentCapability.platform_credentials: model_base_url, model_token (and optionally model_context_window, model_max_output_tokens, model_input_images) for harness_model; for brain_tools (contract 1.4.0, only when this machine is the brain and a different machine the hands of the session) tools_mcp_url (https://executor.<domain>/v1/machines/{brain_machine_id}/mcp), tools_mcp_token and tools_mcp_token_expires_at (RFC 3339, 1 hour after turn.start). With tools_mcp_* present every tool call of the turn must go to that endpoint as an MCP tools/call (tools bash, read, write, edit, glob, grep) and none may run on this machine: when the endpoint cannot be reached or refuses the token the call fails and the executor never falls back to running the tool locally (fail closed). The token is bound to the turn's event epoch: the same turn started again after an executor restart (turn.start with the same turn_id, a new epoch) carries a new token and the previous token is refused. Refresh with tools_token.refresh. tool_policy is a JSON object of tool name to allow, ask or deny (for example {"bash":"ask","write":"deny"}): the permission of those tools for this turn, applied over AgentTurnConfig.permission_mode; an executor may only make a tool stricter than its own ceiling, never looser, and a tool the object does not name keeps the mode's permission. Keys the executor does not know are ignored. egress (contract 1.9.0, only to an executor that declared egress.forwarder): the JSON text of the session's EgressHandoff (schemas/executor.json) for an executor that runs the turn and its tools itself; it replaces the session's handoff as session.assign metadata egress does, and a turn.start without it removes the handoff. */
|
|
1900
|
+
/** String key/value pairs the platform adds to the turn. Per-turn credentials the executor declared in AgentCapability.platform_credentials: model_base_url, model_token (and optionally model_context_window, model_max_output_tokens, model_input_images) for harness_model; for brain_tools (contract 1.4.0, only when this machine is the brain and a different machine the hands of the session) tools_mcp_url (https://executor.<domain>/v1/machines/{brain_machine_id}/mcp), tools_mcp_token and tools_mcp_token_expires_at (RFC 3339, 1 hour after turn.start). With tools_mcp_* present every tool call of the turn must go to that endpoint as an MCP tools/call (tools bash, read, write, edit, glob, grep) and none may run on this machine: when the endpoint cannot be reached or refuses the token the call fails and the executor never falls back to running the tool locally (fail closed). The token is bound to the turn's event epoch: the same turn started again after an executor restart (turn.start with the same turn_id, a new epoch) carries a new token and the previous token is refused. Refresh with tools_token.refresh. tool_policy is a JSON object of tool name to allow, ask or deny (for example {"bash":"ask","write":"deny"}): the permission of those tools for this turn, applied over AgentTurnConfig.permission_mode; an executor may only make a tool stricter than its own ceiling, never looser, and a tool the object does not name keeps the mode's permission. Keys the executor does not know are ignored. For platform_tools (contract 2.4.0, only when this machine runs the turn's brain and its tools itself and the turn's config.platform_tools is not empty): platform_tools_mcp_url (the same endpoint, https://executor.<domain>/v1/machines/{machine_id}/mcp), platform_tools_mcp_token and platform_tools_mcp_token_expires_at (RFC 3339, 1 hour after turn.start). Only the calls of config.platform_tools go there, as an MCP tools/call with the same _meta as with tools_mcp_*; every other tool of the turn runs on this machine as before. The endpoint answers this token's tools/list with the turn's platform_tools only and any other tool name with invalid params. When the endpoint cannot be reached or refuses the token the platform tool call fails; it never runs on this machine. egress (contract 1.9.0, only to an executor that declared egress.forwarder): the JSON text of the session's EgressHandoff (schemas/executor.json) for an executor that runs the turn and its tools itself; it replaces the session's handoff as session.assign metadata egress does, and a turn.start without it removes the handoff. */
|
|
1901
1901
|
metadata?: Record<string, string>;
|
|
1902
1902
|
}
|
|
1903
1903
|
/** Params object of turn.input. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
// Code generated by tools/contract/gen-ts.mjs from contracts/bma (executor protocol 2.
|
|
2
|
+
// Code generated by tools/contract/gen-ts.mjs from contracts/bma (executor protocol 2.4.0). DO NOT EDIT.
|
|
3
3
|
export const AgentErrorCode = {
|
|
4
4
|
OutputLimitReached: 'output_limit_reached',
|
|
5
5
|
ContextTooLarge: 'context_too_large',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beeos-ai/bma-executor-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "BMA executor protocol (bma.executor.v1.1): executor, harness and agent ends with WebSocket, local socket and in-process transports.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|