@beeos-ai/bma-executor-sdk 1.1.0 → 1.3.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 +3 -1
- package/dist/agent.d.ts +19 -1
- package/dist/agent.js +50 -0
- package/dist/agent.js.map +1 -1
- package/dist/client.d.ts +15 -3
- package/dist/client.js +22 -4
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +8 -8
- package/dist/errors.js.map +1 -1
- package/dist/generated/executor.d.ts +263 -113
- package/dist/generated/executor.js +52 -1
- package/dist/generated/executor.js.map +1 -1
- package/dist/harness.d.ts +3 -1
- package/dist/harness.js +5 -0
- package/dist/harness.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/rpc.js.map +1 -1
- package/dist/session-context.js.map +1 -1
- package/dist/transport.js.map +1 -1
- package/package.json +3 -3
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export interface Ack {
|
|
3
3
|
accepted: boolean;
|
|
4
4
|
}
|
|
5
|
-
/** agent capability. Present with enabled=true when the executor runs a complete agent and accepts turn.start, turn.input, turn.cancel, session.close and interaction.response. */
|
|
5
|
+
/** agent capability. Present with enabled=true when the executor runs a complete agent and accepts turn.start, turn.input, turn.cancel, session.close and interaction.response (and agent.custom_tool_result when custom_tools is true). */
|
|
6
6
|
export interface AgentCapability {
|
|
7
7
|
enabled: boolean;
|
|
8
8
|
/** Models the local agent can run. An empty list means the executor picks its own model and ignores AgentTurnConfig.model. */
|
|
@@ -17,27 +17,53 @@ export interface AgentCapability {
|
|
|
17
17
|
max_sessions?: number;
|
|
18
18
|
/** 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. */
|
|
19
19
|
turn_resume?: boolean;
|
|
20
|
+
/** 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). 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. */
|
|
21
|
+
platform_credentials?: Array<'brain_tools' | 'harness_model'>;
|
|
22
|
+
/** 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. Without it the platform never sends agent.custom_tool_result and answers a user.custom_tool_result for the session with an error. */
|
|
23
|
+
custom_tools?: boolean;
|
|
24
|
+
/** Deprecated: one hosted agent. Use harnesses; an executor that sets both lists this one in harnesses too. */
|
|
20
25
|
harness?: AgentHarnessCapability;
|
|
26
|
+
/** Every third-party agent the executor can host, by distinct id (for example dsh and claude-code). The platform picks one per turn with AgentTurnConfig.harness; an executor declares only agents that are installed and passed their self-check. */
|
|
27
|
+
harnesses?: Array<AgentHarnessCapability>;
|
|
21
28
|
}
|
|
29
|
+
/** A custom tool the local agent is calling: a tool the user's application runs and answers (capability agent.custom_tools). Its event_id is the tool_use_id. The platform shows the session as waiting (session.status_idle with stop_reason requires_action naming the event) and delivers the user's result with agent.custom_tool_result. The turn stays open while the executor waits: the executor does not send session.status_idle for it. If its own timeout passes first, the executor ends the call with a failed agent.tool_result naming this event. */
|
|
30
|
+
export interface AgentCustomToolUseEvent {
|
|
31
|
+
type: 'agent.custom_tool_use';
|
|
32
|
+
name: string;
|
|
33
|
+
input: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
/** Stop code table: the error types an agent executor reports for a turn that ended failed, so every agent (Go ACP harness, brain hosts, local desktop agents) says the same thing for the same cause. output_limit_reached: the model reply was cut at its output-token limit (ACP stopReason max_tokens, DSH max-tokens, finish_reason length). context_too_large: the conversation does not fit the model context window even after compaction. model_stream_idle: the model stream sent no data for the idle limit (default 90 s). agent_error: any other failure of the agent. agent_unavailable: the agent process is gone or did not answer a cancel in time. agent_auth_required: the agent needs credentials it does not have. agent_protocol_error: the agent rejected the request as malformed or unsupported. A code is the type of session.error; an executor whose SDK cannot set the type yet (structured_errors false) puts it first in the message as '<code>: <detail>', and the platform reads both forms. The platform keeps the code in error.code and projects a type outside the official session.error union to unknown_error; a platform may map a code to an official type itself (context_too_large to compaction_limit_reached_error, ADR-0010). Executors report only these values; a new cause adds a value here first. */
|
|
36
|
+
export type AgentErrorCode = 'output_limit_reached' | 'context_too_large' | 'model_stream_idle' | 'agent_error' | 'agent_unavailable' | 'agent_auth_required' | 'agent_protocol_error';
|
|
37
|
+
export declare const AgentErrorCode: {
|
|
38
|
+
readonly OutputLimitReached: 'output_limit_reached';
|
|
39
|
+
readonly ContextTooLarge: 'context_too_large';
|
|
40
|
+
readonly ModelStreamIdle: 'model_stream_idle';
|
|
41
|
+
readonly AgentError: 'agent_error';
|
|
42
|
+
readonly AgentUnavailable: 'agent_unavailable';
|
|
43
|
+
readonly AgentAuthRequired: 'agent_auth_required';
|
|
44
|
+
readonly AgentProtocolError: 'agent_protocol_error';
|
|
45
|
+
};
|
|
22
46
|
/** Typed session error. */
|
|
23
47
|
export interface AgentErrorInfo {
|
|
48
|
+
/** An AgentErrorCode value; other strings are tolerated (objects accept unknown members) and projected as unknown_error. */
|
|
24
49
|
type: string;
|
|
25
50
|
message?: string;
|
|
26
51
|
}
|
|
27
52
|
/** One durable agent event. The event id is the session.event event_id; agent.tool_result.tool_use_id references the event_id of its agent.tool_use. */
|
|
28
|
-
export type AgentEvent = AgentMessageEvent | AgentThinkingEvent | AgentToolUseEvent | AgentToolResultEvent | AgentMcpToolUseEvent | AgentMcpToolResultEvent | SessionStatusRunningEvent | SessionStatusIdleEvent | SessionErrorEvent;
|
|
53
|
+
export type AgentEvent = AgentMessageEvent | AgentThinkingEvent | AgentToolUseEvent | AgentToolResultEvent | AgentCustomToolUseEvent | AgentMcpToolUseEvent | AgentMcpToolResultEvent | SessionStatusRunningEvent | SessionStatusIdleEvent | SessionErrorEvent;
|
|
29
54
|
/** Durable events an agent executor emits with session.event. Names and members follow Anthropic Managed Agents session events. user.* events are written by the platform, never by the executor. */
|
|
30
|
-
export type AgentEventType = 'agent.message' | 'agent.thinking' | 'agent.tool_use' | 'agent.tool_result' | 'agent.mcp_tool_use' | 'agent.mcp_tool_result' | 'session.status_running' | 'session.status_idle' | 'session.error';
|
|
55
|
+
export type AgentEventType = 'agent.message' | 'agent.thinking' | 'agent.tool_use' | 'agent.tool_result' | 'agent.custom_tool_use' | 'agent.mcp_tool_use' | 'agent.mcp_tool_result' | 'session.status_running' | 'session.status_idle' | 'session.error';
|
|
31
56
|
export declare const AgentEventType: {
|
|
32
|
-
readonly AgentMessage:
|
|
33
|
-
readonly AgentThinking:
|
|
34
|
-
readonly AgentToolUse:
|
|
35
|
-
readonly AgentToolResult:
|
|
36
|
-
readonly
|
|
37
|
-
readonly
|
|
38
|
-
readonly
|
|
39
|
-
readonly
|
|
40
|
-
readonly
|
|
57
|
+
readonly AgentMessage: 'agent.message';
|
|
58
|
+
readonly AgentThinking: 'agent.thinking';
|
|
59
|
+
readonly AgentToolUse: 'agent.tool_use';
|
|
60
|
+
readonly AgentToolResult: 'agent.tool_result';
|
|
61
|
+
readonly AgentCustomToolUse: 'agent.custom_tool_use';
|
|
62
|
+
readonly AgentMcpToolUse: 'agent.mcp_tool_use';
|
|
63
|
+
readonly AgentMcpToolResult: 'agent.mcp_tool_result';
|
|
64
|
+
readonly SessionStatusRunning: 'session.status_running';
|
|
65
|
+
readonly SessionStatusIdle: 'session.status_idle';
|
|
66
|
+
readonly SessionError: 'session.error';
|
|
41
67
|
};
|
|
42
68
|
/** What the third-party agent the executor hosts (for example an ACP agent) supports; an omitted boolean is false. Sent with executor.capabilities.update once the agent has started; absent until then and after a reconnect until the next turn. Informational: the platform records it and reflects it in the session harness capabilities. */
|
|
43
69
|
export interface AgentHarnessCapability {
|
|
@@ -78,8 +104,8 @@ export interface AgentInputBlock {
|
|
|
78
104
|
/** Agent input block type. */
|
|
79
105
|
export type AgentInputBlockType = 'text' | 'file';
|
|
80
106
|
export declare const AgentInputBlockType: {
|
|
81
|
-
readonly Text:
|
|
82
|
-
readonly File:
|
|
107
|
+
readonly Text: 'text';
|
|
108
|
+
readonly File: 'file';
|
|
83
109
|
};
|
|
84
110
|
/** Result of an agent.mcp_tool_use. */
|
|
85
111
|
export interface AgentMcpToolResultEvent {
|
|
@@ -133,17 +159,21 @@ export interface AgentTurnConfig {
|
|
|
133
159
|
model?: string;
|
|
134
160
|
thinking_level?: string;
|
|
135
161
|
permission_mode?: string;
|
|
136
|
-
/** Working directory on the executor host. The executor rejects a directory outside its allowed roots with -32001 forbidden. */
|
|
162
|
+
/** Working directory on the executor host. The executor rejects a directory outside its allowed roots with -32001 forbidden. When turn.start metadata carries tools_mcp_* (brain and hands on different machines, contract 1.4.0) cwd is a path on the hands machine: the executor does not check it against its own allowed roots and does not create a workspace for it on this machine; the hands machine's own policy applies when a tool runs there. */
|
|
137
163
|
cwd?: string;
|
|
164
|
+
/** Contract 1.4.0, optional. Sent only when brain and hands are on different machines (turn.start metadata carries tools_mcp_*): describes the hands machine, so the brain can tell the model where its tools run. Omitted when brain and hands are the same machine, and absent from TurnStartResult.effective. */
|
|
165
|
+
environment_info?: EnvironmentInfo;
|
|
138
166
|
/** Extra system instructions from the platform agent definition. */
|
|
139
167
|
system?: string;
|
|
168
|
+
/** 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. */
|
|
169
|
+
harness?: string;
|
|
140
170
|
}
|
|
141
|
-
/** v1.1 artifact upload (POST /v1/executors/artifacts). Environment-scoped executors only. */
|
|
171
|
+
/** v1.1 artifact upload (POST /v1/environments/{environment_id}/artifacts; legacy alias POST /v1/executors/artifacts). Environment-scoped executors only. */
|
|
142
172
|
export interface ArtifactCapability {
|
|
143
173
|
upload: boolean;
|
|
144
174
|
max_bytes?: number;
|
|
145
175
|
}
|
|
146
|
-
/** Artifact reference returned by POST /v1/executors/artifacts and listed in tool.result artifacts (v1.1 §6.5). */
|
|
176
|
+
/** Artifact reference returned by POST /v1/environments/{environment_id}/artifacts (legacy alias POST /v1/executors/artifacts) and listed in tool.result artifacts (v1.1 §6.5). */
|
|
147
177
|
export interface ArtifactRef {
|
|
148
178
|
artifact_id: string;
|
|
149
179
|
name?: string;
|
|
@@ -180,21 +210,23 @@ export interface Capabilities {
|
|
|
180
210
|
workspace?: WorkspaceCapability;
|
|
181
211
|
agent?: AgentCapability;
|
|
182
212
|
session_files?: SessionFilesCapability;
|
|
213
|
+
fs?: FsCapability;
|
|
214
|
+
remote_brain?: RemoteBrainCapability;
|
|
183
215
|
}
|
|
184
216
|
/** Channels a short-lived executor JWT may open. */
|
|
185
217
|
export type ChannelScope = 'control' | 'mcp';
|
|
186
218
|
export declare const ChannelScope: {
|
|
187
|
-
readonly Control:
|
|
188
|
-
readonly Mcp:
|
|
219
|
+
readonly Control: 'control';
|
|
220
|
+
readonly Mcp: 'mcp';
|
|
189
221
|
};
|
|
190
222
|
/** Input actions accepted by the computer_action tool. */
|
|
191
223
|
export type ComputerAction = 'click' | 'type' | 'key' | 'scroll' | 'drag';
|
|
192
224
|
export declare const ComputerAction: {
|
|
193
|
-
readonly Click:
|
|
194
|
-
readonly Type:
|
|
195
|
-
readonly Key:
|
|
196
|
-
readonly Scroll:
|
|
197
|
-
readonly Drag:
|
|
225
|
+
readonly Click: 'click';
|
|
226
|
+
readonly Type: 'type';
|
|
227
|
+
readonly Key: 'key';
|
|
228
|
+
readonly Scroll: 'scroll';
|
|
229
|
+
readonly Drag: 'drag';
|
|
198
230
|
};
|
|
199
231
|
/** computer_action input. */
|
|
200
232
|
export interface ComputerActionInput {
|
|
@@ -210,12 +242,12 @@ export interface ComputerObserveInput {
|
|
|
210
242
|
/** Executor control channel state machine. */
|
|
211
243
|
export type ConnectionState = 'disconnected' | 'connecting' | 'registered' | 'ready' | 'draining' | 'closed';
|
|
212
244
|
export declare const ConnectionState: {
|
|
213
|
-
readonly Disconnected:
|
|
214
|
-
readonly Connecting:
|
|
215
|
-
readonly Registered:
|
|
216
|
-
readonly Ready:
|
|
217
|
-
readonly Draining:
|
|
218
|
-
readonly Closed:
|
|
245
|
+
readonly Disconnected: 'disconnected';
|
|
246
|
+
readonly Connecting: 'connecting';
|
|
247
|
+
readonly Registered: 'registered';
|
|
248
|
+
readonly Ready: 'ready';
|
|
249
|
+
readonly Draining: 'draining';
|
|
250
|
+
readonly Closed: 'closed';
|
|
219
251
|
};
|
|
220
252
|
/** Tool result content block. An artifact block carries artifact_id and mime_type instead of text (v1.1 §6.5). */
|
|
221
253
|
export interface ContentBlock {
|
|
@@ -229,16 +261,20 @@ export interface ContentBlock {
|
|
|
229
261
|
/** Tool result content block type. */
|
|
230
262
|
export type ContentBlockType = 'text' | 'image' | 'resource' | 'artifact';
|
|
231
263
|
export declare const ContentBlockType: {
|
|
232
|
-
readonly Text:
|
|
233
|
-
readonly Image:
|
|
234
|
-
readonly Resource:
|
|
235
|
-
readonly Artifact:
|
|
264
|
+
readonly Text: 'text';
|
|
265
|
+
readonly Image: 'image';
|
|
266
|
+
readonly Resource: 'resource';
|
|
267
|
+
readonly Artifact: 'artifact';
|
|
236
268
|
};
|
|
237
269
|
/** Per-stream byte cursors. */
|
|
238
270
|
export interface Cursors {
|
|
239
271
|
stdout: number;
|
|
240
272
|
stderr: number;
|
|
241
273
|
}
|
|
274
|
+
/** agent.custom_tool_result result. accepted=true: the executor took the result for the call it was waiting on. accepted=false: it no longer waits (unknown tool_use_id, already answered, timed out, or canceled with its turn); the platform marks its copy stale and does not send it again. */
|
|
275
|
+
export interface CustomToolResultResult {
|
|
276
|
+
accepted: boolean;
|
|
277
|
+
}
|
|
242
278
|
/** v1.1 display object. v1 sent a boolean; the server accepts both. */
|
|
243
279
|
export interface DisplayCapability {
|
|
244
280
|
rfb?: boolean;
|
|
@@ -254,6 +290,19 @@ export interface EditInput {
|
|
|
254
290
|
/** Replacement text. */
|
|
255
291
|
new_string: string;
|
|
256
292
|
}
|
|
293
|
+
/** Contract 1.4.0. The hands machine as the platform knows it (AgentTurnConfig.environment_info), from the hands executor's registration and the session's file mounts. Every member is optional; an omitted member is unknown, not empty. Values describe the machine at the time of turn.start. */
|
|
294
|
+
export interface EnvironmentInfo {
|
|
295
|
+
/** Operating system of the hands machine, as ExecutorInfo.os (for example linux, darwin, windows). */
|
|
296
|
+
os?: string;
|
|
297
|
+
/** CPU architecture, as ExecutorInfo.arch. */
|
|
298
|
+
arch?: string;
|
|
299
|
+
/** Shell the bash tool runs commands with on the hands machine (for example bash, zsh, powershell). */
|
|
300
|
+
shell?: string;
|
|
301
|
+
/** Default working directory of tools on the hands machine; the same value as AgentTurnConfig.cwd when that is set. */
|
|
302
|
+
cwd?: string;
|
|
303
|
+
/** Directory on the hands machine where the session's files are mounted, when the hands executor declared session_files. */
|
|
304
|
+
session_files_root?: string;
|
|
305
|
+
}
|
|
257
306
|
/** Permission decision the executor applied to a tool use. ask means the executor opened an interaction.request for it. */
|
|
258
307
|
export interface EvaluatedPermission {
|
|
259
308
|
type: 'allow' | 'ask' | 'deny';
|
|
@@ -261,8 +310,8 @@ export interface EvaluatedPermission {
|
|
|
261
310
|
/** Durable event type a streaming preview belongs to. */
|
|
262
311
|
export type EventDeltaType = 'agent.message' | 'agent.thinking';
|
|
263
312
|
export declare const EventDeltaType: {
|
|
264
|
-
readonly AgentMessage:
|
|
265
|
-
readonly AgentThinking:
|
|
313
|
+
readonly AgentMessage: 'agent.message';
|
|
314
|
+
readonly AgentThinking: 'agent.thinking';
|
|
266
315
|
};
|
|
267
316
|
/** executor.drain result. */
|
|
268
317
|
export interface ExecutorDrainResult {
|
|
@@ -281,6 +330,8 @@ export interface ExecutorInfo {
|
|
|
281
330
|
os: string;
|
|
282
331
|
arch: string;
|
|
283
332
|
version: string;
|
|
333
|
+
/** Contract 1.4.0, optional. Labels the executor reports about itself (at most 32, each 1-64 characters of a-z 0-9 . _ -), set by the machine's owner in the executor's local configuration (for example BMA_LABELS or the SDK Options.Labels). The platform accepts them as given and does not validate their meaning, and it adds its own os:<os> and arch:<arch> labels from os and arch. Labels only narrow a choice among machines the project is already authorized to use (environment placement selectors); no authorization or security decision depends on them. Omitted: no labels. */
|
|
334
|
+
labels?: Array<string>;
|
|
284
335
|
}
|
|
285
336
|
/** Advisory executor load reported with executor.heartbeat. The server does not act on it. */
|
|
286
337
|
export interface ExecutorLoad {
|
|
@@ -311,12 +362,12 @@ export interface ExecutorTokenRefreshResult {
|
|
|
311
362
|
/** RFC 3339 time of the new connection deadline. */
|
|
312
363
|
expires_at: string;
|
|
313
364
|
}
|
|
314
|
-
/** POST /v1/executors/token
|
|
365
|
+
/** 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 alias POST /v1/executors/token takes either bearer. 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. */
|
|
315
366
|
export interface ExecutorTokenRequest {
|
|
316
367
|
environment_id: string;
|
|
317
368
|
executor: ExecutorInfo;
|
|
318
369
|
}
|
|
319
|
-
/** POST /v1/executors/token
|
|
370
|
+
/** Token response of POST /v1/machines/{machine_id}/token, POST /v1/environments/{environment_id}/token and the legacy alias POST /v1/executors/token. */
|
|
320
371
|
export interface ExecutorTokenResponse {
|
|
321
372
|
executor_id: string;
|
|
322
373
|
/** Short-lived executor JWT, sent only in the Authorization header of the channel upgrade. */
|
|
@@ -329,8 +380,8 @@ export interface ExecutorTokenResponse {
|
|
|
329
380
|
/** File transfer direction relative to the machine. */
|
|
330
381
|
export type FileTransferDirection = 'upload' | 'download';
|
|
331
382
|
export declare const FileTransferDirection: {
|
|
332
|
-
readonly Upload:
|
|
333
|
-
readonly Download:
|
|
383
|
+
readonly Upload: 'upload';
|
|
384
|
+
readonly Download: 'download';
|
|
334
385
|
};
|
|
335
386
|
/** Failed file transfer. */
|
|
336
387
|
export interface FileTransferError {
|
|
@@ -350,6 +401,34 @@ export interface FilesCapability {
|
|
|
350
401
|
read_roots?: Array<string>;
|
|
351
402
|
write_roots?: Array<string>;
|
|
352
403
|
}
|
|
404
|
+
/** Session file views mounted by the executor as FUSE file systems backed by bma-file (docs/adr/0021). Declared only after the executor probed that it can mount. Absent or fuse=false: the session files stay on the copy-and-scan protocol (session_files). views lists the views the executor can mount; the harness only mounts those. Machine-scoped executors only. */
|
|
405
|
+
export interface FsCapability {
|
|
406
|
+
fuse: boolean;
|
|
407
|
+
views?: Array<string>;
|
|
408
|
+
}
|
|
409
|
+
/** One view to mount. path is the absolute mount point on the executor host (derived from session_files by the harness). readonly is also fixed inside token; the executor mounts read-only when it is true. token is a capability token for this session and machine: keep it in memory only, never write it to disk, argv, environment or logs. */
|
|
410
|
+
export interface FsMount {
|
|
411
|
+
/** uploads (FS1). Open enum: outputs, skills and memory follow. */
|
|
412
|
+
view: string;
|
|
413
|
+
path: string;
|
|
414
|
+
readonly: boolean;
|
|
415
|
+
token: string;
|
|
416
|
+
/** Reserved mount tuning (string values); unknown keys are ignored. */
|
|
417
|
+
options?: Record<string, string>;
|
|
418
|
+
}
|
|
419
|
+
/** fs.mount result. state is "mounted" once every listed view is mounted and serving, or "failed" with error_code and error (nothing stays half-mounted). */
|
|
420
|
+
export interface FsMountResult {
|
|
421
|
+
state: 'mounted' | 'failed';
|
|
422
|
+
error_code?: string;
|
|
423
|
+
error?: string;
|
|
424
|
+
}
|
|
425
|
+
/** fs.unmount result. pending_bytes is data not yet committed to bma-file when flush was requested (always 0 for read-only views). */
|
|
426
|
+
export interface FsUnmountResult {
|
|
427
|
+
state: 'unmounted' | 'failed';
|
|
428
|
+
pending_bytes: number;
|
|
429
|
+
error_code?: string;
|
|
430
|
+
error?: string;
|
|
431
|
+
}
|
|
353
432
|
/** glob input: list paths matching pattern. */
|
|
354
433
|
export interface GlobInput {
|
|
355
434
|
/** Glob pattern. */
|
|
@@ -369,30 +448,30 @@ export interface GrepInput {
|
|
|
369
448
|
/** process.start io_mode. "pty" runs the command on a 24x80 pseudo-terminal: stdout is the PTY output, stdin writes go to the PTY and close_stdin is rejected. Requires process.pty. */
|
|
370
449
|
export type IOMode = 'pty';
|
|
371
450
|
export declare const IOMode: {
|
|
372
|
-
readonly Pty:
|
|
451
|
+
readonly Pty: 'pty';
|
|
373
452
|
};
|
|
374
453
|
/** Why the executor withdrew an open interaction. */
|
|
375
454
|
export type InteractionCancelReason = 'resolved_locally' | 'turn_canceled' | 'expired' | 'tool_canceled';
|
|
376
455
|
export declare const InteractionCancelReason: {
|
|
377
|
-
readonly ResolvedLocally:
|
|
378
|
-
readonly TurnCanceled:
|
|
379
|
-
readonly Expired:
|
|
380
|
-
readonly ToolCanceled:
|
|
456
|
+
readonly ResolvedLocally: 'resolved_locally';
|
|
457
|
+
readonly TurnCanceled: 'turn_canceled';
|
|
458
|
+
readonly Expired: 'expired';
|
|
459
|
+
readonly ToolCanceled: 'tool_canceled';
|
|
381
460
|
};
|
|
382
461
|
/** Interaction kinds; they map 1:1 to platform agent interactions. */
|
|
383
462
|
export type InteractionKind = 'permission' | 'question';
|
|
384
463
|
export declare const InteractionKind: {
|
|
385
|
-
readonly Permission:
|
|
386
|
-
readonly Question:
|
|
464
|
+
readonly Permission: 'permission';
|
|
465
|
+
readonly Question: 'question';
|
|
387
466
|
};
|
|
388
467
|
/** How the platform resolved an interaction. allow/deny answer permission, answered answers question, expired and canceled close either kind without an answer. */
|
|
389
468
|
export type InteractionOutcome = 'allow' | 'deny' | 'answered' | 'expired' | 'canceled';
|
|
390
469
|
export declare const InteractionOutcome: {
|
|
391
|
-
readonly Allow:
|
|
392
|
-
readonly Deny:
|
|
393
|
-
readonly Answered:
|
|
394
|
-
readonly Expired:
|
|
395
|
-
readonly Canceled:
|
|
470
|
+
readonly Allow: 'allow';
|
|
471
|
+
readonly Deny: 'deny';
|
|
472
|
+
readonly Answered: 'answered';
|
|
473
|
+
readonly Expired: 'expired';
|
|
474
|
+
readonly Canceled: 'canceled';
|
|
396
475
|
};
|
|
397
476
|
/** Question shown to the user. */
|
|
398
477
|
export interface InteractionQuestion {
|
|
@@ -406,7 +485,7 @@ export interface InteractionQuestionOption {
|
|
|
406
485
|
id: string;
|
|
407
486
|
label: string;
|
|
408
487
|
}
|
|
409
|
-
/** interaction.request result. Idempotent by interaction_id: a repeat returns the same platform interaction. */
|
|
488
|
+
/** interaction.request result. Idempotent by interaction_id: a repeat returns the same platform interaction. platform_interaction_id equals interaction_id when that is an appr_ plus 24 lower-case hex id (adopted); otherwise it is the platform-assigned int_ id. */
|
|
410
489
|
export interface InteractionRequestResult {
|
|
411
490
|
accepted: boolean;
|
|
412
491
|
platform_interaction_id: string;
|
|
@@ -423,8 +502,8 @@ export interface InteractionResponseResult {
|
|
|
423
502
|
/** How long a permission grant lasts on the executor: this tool use only, or the rest of the session. */
|
|
424
503
|
export type InteractionScope = 'once' | 'session';
|
|
425
504
|
export declare const InteractionScope: {
|
|
426
|
-
readonly Once:
|
|
427
|
-
readonly Session:
|
|
505
|
+
readonly Once: 'once';
|
|
506
|
+
readonly Session: 'session';
|
|
428
507
|
};
|
|
429
508
|
/** JSON-RPC 2.0 error object. */
|
|
430
509
|
export interface JsonRpcError {
|
|
@@ -462,7 +541,7 @@ export interface JsonRpcErrorData {
|
|
|
462
541
|
detail?: string;
|
|
463
542
|
/** Missing capability for -32012, for example "tool:read" or "process.pty". */
|
|
464
543
|
capability?: string;
|
|
465
|
-
/** Machine-readable cause; an open set that the harness passes through unchanged (process.start: the tool result error_code and the process state reason; turn.start: the session.error code). Recommended values: workspace_unavailable, workspace_boundary, workspace_read_only, session_rejected, local_confirmation_denied, local_confirmation_expired,
|
|
544
|
+
/** Machine-readable cause; an open set that the harness passes through unchanged (process.start: the tool result error_code and the process state reason; turn.start: the session.error code). Recommended values: workspace_unavailable, workspace_boundary, workspace_read_only, session_rejected, local_confirmation_denied, local_confirmation_expired, spawn_failed / process_id_spec_mismatch for process.start, capability_missing for executor.register, and turn_inactive / forbidden / model_token_unavailable for model_token.refresh and turn_inactive / forbidden / tools_token_unavailable for tools_token.refresh (contract 1.4.0). The tool result error_code of a platform tool call (the platform tools endpoint, ToolErrorCode in the AsyncAPI x-bma-platform-tools) is an open set that also includes environment_unavailable, permission_denied, approval_required, approval_invalid, in_progress and idempotency_key_reused (contract 1.4.0). Receivers must accept values they do not know. */
|
|
466
545
|
reason?: string;
|
|
467
546
|
/** bma.terminal.v1 error code for a failed terminal.* call. */
|
|
468
547
|
terminal_code?: string;
|
|
@@ -526,8 +605,8 @@ export interface McpCapability {
|
|
|
526
605
|
/** Who connects the MCP server. environment means the executor starts/connects it; service means the harness connects. */
|
|
527
606
|
export type McpConnectionOrigin = 'service' | 'environment';
|
|
528
607
|
export declare const McpConnectionOrigin: {
|
|
529
|
-
readonly Service:
|
|
530
|
-
readonly Environment:
|
|
608
|
+
readonly Service: 'service';
|
|
609
|
+
readonly Environment: 'environment';
|
|
531
610
|
};
|
|
532
611
|
/** MCP tool content block. Large binary content must go to artifact storage. */
|
|
533
612
|
export interface McpContentBlock {
|
|
@@ -629,21 +708,30 @@ export interface McpToolsListResult {
|
|
|
629
708
|
}
|
|
630
709
|
export type McpTransportType = 'stdio' | 'http';
|
|
631
710
|
export declare const McpTransportType: {
|
|
632
|
-
readonly Stdio:
|
|
633
|
-
readonly Http:
|
|
711
|
+
readonly Stdio: 'stdio';
|
|
712
|
+
readonly Http: 'http';
|
|
634
713
|
};
|
|
714
|
+
/** model_token.refresh result: the credential for the turn's next model calls, in the form of the turn.start metadata model_base_url and model_token. */
|
|
715
|
+
export interface ModelTokenRefreshResult {
|
|
716
|
+
/** Bearer token for model_base_url. Valid until expires_at. */
|
|
717
|
+
model_token: string;
|
|
718
|
+
/** Base URL the token is for (an OpenAI / Anthropic base URL path). */
|
|
719
|
+
model_base_url: string;
|
|
720
|
+
/** RFC 3339 time the token stops being accepted. */
|
|
721
|
+
expires_at: string;
|
|
722
|
+
}
|
|
635
723
|
/** Package manager for process.start package_install. */
|
|
636
724
|
export type PackageManager = 'apt' | 'pip' | 'npm';
|
|
637
725
|
export declare const PackageManager: {
|
|
638
|
-
readonly Apt:
|
|
639
|
-
readonly Pip:
|
|
640
|
-
readonly Npm:
|
|
726
|
+
readonly Apt: 'apt';
|
|
727
|
+
readonly Pip: 'pip';
|
|
728
|
+
readonly Npm: 'npm';
|
|
641
729
|
};
|
|
642
730
|
/** Tool permission mode; always_ask means the harness already resolved approval. */
|
|
643
731
|
export type PermissionMode = 'always_allow' | 'always_ask';
|
|
644
732
|
export declare const PermissionMode: {
|
|
645
|
-
readonly AlwaysAllow:
|
|
646
|
-
readonly AlwaysAsk:
|
|
733
|
+
readonly AlwaysAllow: 'always_allow';
|
|
734
|
+
readonly AlwaysAsk: 'always_ask';
|
|
647
735
|
};
|
|
648
736
|
/** v1.1 process.* support. pty, file_transfer, package_install and git_credentials are additive: the harness only sends the matching process.start fields to an executor that set them, and fails the process explicitly otherwise. */
|
|
649
737
|
export interface ProcessCapability {
|
|
@@ -710,16 +798,16 @@ export interface ProcessState {
|
|
|
710
798
|
/** Process state (v1.1 §3.3). */
|
|
711
799
|
export type ProcessStateName = 'running' | 'exited' | 'failed' | 'killed';
|
|
712
800
|
export declare const ProcessStateName: {
|
|
713
|
-
readonly Running:
|
|
714
|
-
readonly Exited:
|
|
715
|
-
readonly Failed:
|
|
716
|
-
readonly Killed:
|
|
801
|
+
readonly Running: 'running';
|
|
802
|
+
readonly Exited: 'exited';
|
|
803
|
+
readonly Failed: 'failed';
|
|
804
|
+
readonly Killed: 'killed';
|
|
717
805
|
};
|
|
718
806
|
/** Process output stream (v1.1 §3.2). */
|
|
719
807
|
export type ProcessStream = 'stdout' | 'stderr';
|
|
720
808
|
export declare const ProcessStream: {
|
|
721
|
-
readonly Stdout:
|
|
722
|
-
readonly Stderr:
|
|
809
|
+
readonly Stdout: 'stdout';
|
|
810
|
+
readonly Stderr: 'stderr';
|
|
723
811
|
};
|
|
724
812
|
/** process.write result. */
|
|
725
813
|
export interface ProcessWriteResult {
|
|
@@ -728,8 +816,8 @@ export interface ProcessWriteResult {
|
|
|
728
816
|
/** Value of both the WebSocket subprotocol and executor.register protocol. A v1.1 server serves v1 executors and never sends them v1.1 methods. */
|
|
729
817
|
export type ProtocolVersion = 'bma.executor.v1' | 'bma.executor.v1.1';
|
|
730
818
|
export declare const ProtocolVersion: {
|
|
731
|
-
readonly BmaExecutorV1:
|
|
732
|
-
readonly BmaExecutorV11:
|
|
819
|
+
readonly BmaExecutorV1: 'bma.executor.v1';
|
|
820
|
+
readonly BmaExecutorV11: 'bma.executor.v1.1';
|
|
733
821
|
};
|
|
734
822
|
/** read input: return lines of a text file. */
|
|
735
823
|
export interface ReadInput {
|
|
@@ -740,6 +828,10 @@ export interface ReadInput {
|
|
|
740
828
|
/** Maximum number of lines. */
|
|
741
829
|
limit?: number;
|
|
742
830
|
}
|
|
831
|
+
/** Contract 1.4.0. The machine's owner allows a brain that runs on another machine to use this machine as its hands (platform tools routed here for a session whose brain machine is a different one). Set only by the executor's local configuration (bmad configuration or SDK Options.RemoteBrain); the platform reads it back and cannot switch it on through any API. Absent or enabled=false: off, which is also what an executor that predates 1.4.0 means. It applies to a BYO (tenant-owned) machine; a platform pool machine does not need it. It does not restrict a platform-hosted brain driving this machine (project authorization is enough there), and a brain and hands on one machine never need it. */
|
|
832
|
+
export interface RemoteBrainCapability {
|
|
833
|
+
enabled: boolean;
|
|
834
|
+
}
|
|
743
835
|
/** session.assign result. */
|
|
744
836
|
export interface SessionAssignResult {
|
|
745
837
|
accepted: boolean;
|
|
@@ -769,17 +861,18 @@ export interface SessionEventResult {
|
|
|
769
861
|
acked_sequence?: number;
|
|
770
862
|
}
|
|
771
863
|
/** Durable event types an executor may emit. Event names follow Anthropic Managed Agents; the executor must not invent new names. A tool executor emits agent.tool_result only; an agent executor (capability agent) emits every type, shaped as schemas/agent.json AgentEvent. */
|
|
772
|
-
export type SessionEventType = 'agent.tool_result' | 'agent.message' | 'agent.thinking' | 'agent.tool_use' | 'agent.mcp_tool_use' | 'agent.mcp_tool_result' | 'session.status_running' | 'session.status_idle' | 'session.error';
|
|
864
|
+
export type SessionEventType = 'agent.tool_result' | 'agent.message' | 'agent.thinking' | 'agent.tool_use' | 'agent.custom_tool_use' | 'agent.mcp_tool_use' | 'agent.mcp_tool_result' | 'session.status_running' | 'session.status_idle' | 'session.error';
|
|
773
865
|
export declare const SessionEventType: {
|
|
774
|
-
readonly AgentToolResult:
|
|
775
|
-
readonly AgentMessage:
|
|
776
|
-
readonly AgentThinking:
|
|
777
|
-
readonly AgentToolUse:
|
|
778
|
-
readonly
|
|
779
|
-
readonly
|
|
780
|
-
readonly
|
|
781
|
-
readonly
|
|
782
|
-
readonly
|
|
866
|
+
readonly AgentToolResult: 'agent.tool_result';
|
|
867
|
+
readonly AgentMessage: 'agent.message';
|
|
868
|
+
readonly AgentThinking: 'agent.thinking';
|
|
869
|
+
readonly AgentToolUse: 'agent.tool_use';
|
|
870
|
+
readonly AgentCustomToolUse: 'agent.custom_tool_use';
|
|
871
|
+
readonly AgentMcpToolUse: 'agent.mcp_tool_use';
|
|
872
|
+
readonly AgentMcpToolResult: 'agent.mcp_tool_result';
|
|
873
|
+
readonly SessionStatusRunning: 'session.status_running';
|
|
874
|
+
readonly SessionStatusIdle: 'session.status_idle';
|
|
875
|
+
readonly SessionError: 'session.error';
|
|
783
876
|
};
|
|
784
877
|
/** Executor-owned per-session file layout. The harness derives <root>/<agent_session_id>/uploads (read-only session inputs) and <root>/<agent_session_id>/outputs (deliverables) from it, with agent_session_id as sent in process.start metadata, and uses these real paths in prompts, tool descriptions, write rules and the session files manifest. Absent: the harness keeps /mnt/session/uploads and /mnt/session/outputs. Fixed at executor.register: executor.capabilities.update does not change it. Machine-scoped executors only. */
|
|
785
878
|
export interface SessionFilesCapability {
|
|
@@ -795,12 +888,12 @@ export interface SessionMemoryResource {
|
|
|
795
888
|
/** Lifecycle status reported by the executor. */
|
|
796
889
|
export type SessionStatus = 'starting' | 'running' | 'idle' | 'stopping' | 'stopped' | 'error';
|
|
797
890
|
export declare const SessionStatus: {
|
|
798
|
-
readonly Starting:
|
|
799
|
-
readonly Running:
|
|
800
|
-
readonly Idle:
|
|
801
|
-
readonly Stopping:
|
|
802
|
-
readonly Stopped:
|
|
803
|
-
readonly Error:
|
|
891
|
+
readonly Starting: 'starting';
|
|
892
|
+
readonly Running: 'running';
|
|
893
|
+
readonly Idle: 'idle';
|
|
894
|
+
readonly Stopping: 'stopping';
|
|
895
|
+
readonly Stopped: 'stopped';
|
|
896
|
+
readonly Error: 'error';
|
|
804
897
|
};
|
|
805
898
|
/** The turn ended. It is the last event of its turn_id; the platform publishes the turn as finished only after it accepted this event and every lower sequence. */
|
|
806
899
|
export interface SessionStatusIdleEvent {
|
|
@@ -833,13 +926,13 @@ export interface SkillsCapability {
|
|
|
833
926
|
/** process.start stderr mode. "merge" redirects stderr into stdout at the OS level so one cursor covers both. */
|
|
834
927
|
export type StderrMode = 'merge';
|
|
835
928
|
export declare const StderrMode: {
|
|
836
|
-
readonly Merge:
|
|
929
|
+
readonly Merge: 'merge';
|
|
837
930
|
};
|
|
838
931
|
/** process.start stdin mode. Empty or "closed" closes stdin at start; "open" keeps it open for process.write. */
|
|
839
932
|
export type StdinMode = 'open' | 'closed';
|
|
840
933
|
export declare const StdinMode: {
|
|
841
|
-
readonly Open:
|
|
842
|
-
readonly Closed:
|
|
934
|
+
readonly Open: 'open';
|
|
935
|
+
readonly Closed: 'closed';
|
|
843
936
|
};
|
|
844
937
|
/** Why the turn stopped. */
|
|
845
938
|
export interface StopReason {
|
|
@@ -848,8 +941,8 @@ export interface StopReason {
|
|
|
848
941
|
/** Anthropic stop_reason types an executor may report. requires_action is not in the list: the platform projects it from open interactions. */
|
|
849
942
|
export type StopReasonType = 'end_turn' | 'retries_exhausted';
|
|
850
943
|
export declare const StopReasonType: {
|
|
851
|
-
readonly EndTurn:
|
|
852
|
-
readonly RetriesExhausted:
|
|
944
|
+
readonly EndTurn: 'end_turn';
|
|
945
|
+
readonly RetriesExhausted: 'retries_exhausted';
|
|
853
946
|
};
|
|
854
947
|
/** terminal.attach result, returned after the host socket is connected and the attached frame was written on it. */
|
|
855
948
|
export interface TerminalAttachResult {
|
|
@@ -911,27 +1004,36 @@ export interface ToolInput {
|
|
|
911
1004
|
/** Built-in tool names. bmad serves bash only and answers -32012 for the rest. */
|
|
912
1005
|
export type ToolName = 'bash' | 'read' | 'write' | 'edit' | 'glob' | 'grep' | 'list_files' | 'computer_observe' | 'computer_action';
|
|
913
1006
|
export declare const ToolName: {
|
|
914
|
-
readonly Bash:
|
|
915
|
-
readonly Read:
|
|
916
|
-
readonly Write:
|
|
917
|
-
readonly Edit:
|
|
918
|
-
readonly Glob:
|
|
919
|
-
readonly Grep:
|
|
920
|
-
readonly ListFiles:
|
|
921
|
-
readonly ComputerObserve:
|
|
922
|
-
readonly ComputerAction:
|
|
1007
|
+
readonly Bash: 'bash';
|
|
1008
|
+
readonly Read: 'read';
|
|
1009
|
+
readonly Write: 'write';
|
|
1010
|
+
readonly Edit: 'edit';
|
|
1011
|
+
readonly Glob: 'glob';
|
|
1012
|
+
readonly Grep: 'grep';
|
|
1013
|
+
readonly ListFiles: 'list_files';
|
|
1014
|
+
readonly ComputerObserve: 'computer_observe';
|
|
1015
|
+
readonly ComputerAction: 'computer_action';
|
|
923
1016
|
};
|
|
924
1017
|
/** Tool outcome. */
|
|
925
1018
|
export type ToolOutcome = 'succeeded' | 'failed' | 'canceled';
|
|
926
1019
|
export declare const ToolOutcome: {
|
|
927
|
-
readonly Succeeded:
|
|
928
|
-
readonly Failed:
|
|
929
|
-
readonly Canceled:
|
|
1020
|
+
readonly Succeeded: 'succeeded';
|
|
1021
|
+
readonly Failed: 'failed';
|
|
1022
|
+
readonly Canceled: 'canceled';
|
|
930
1023
|
};
|
|
931
1024
|
/** Tool permission resolved by the harness. */
|
|
932
1025
|
export interface ToolPermission {
|
|
933
1026
|
mode: PermissionMode;
|
|
934
1027
|
}
|
|
1028
|
+
/** 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. */
|
|
1029
|
+
export interface ToolsTokenRefreshResult {
|
|
1030
|
+
/** Bearer token for tools_mcp_url, bound to the org, session, turn, brain machine and brain epoch of the turn. Valid until expires_at. */
|
|
1031
|
+
tools_mcp_token: string;
|
|
1032
|
+
/** The session's platform tools endpoint the token is for (https://<executor host>/v1/machines/{brain_machine_id}/mcp). */
|
|
1033
|
+
tools_mcp_url: string;
|
|
1034
|
+
/** RFC 3339 time the token stops being accepted. */
|
|
1035
|
+
expires_at: string;
|
|
1036
|
+
}
|
|
935
1037
|
/** turn.cancel result. canceled=false when the turn is unknown or already ended; the turn still ends with its own session.status_idle event. */
|
|
936
1038
|
export interface TurnCancelResult {
|
|
937
1039
|
canceled: boolean;
|
|
@@ -939,9 +1041,9 @@ export interface TurnCancelResult {
|
|
|
939
1041
|
/** BMA extension on session.status_idle: how the turn ended. */
|
|
940
1042
|
export type TurnOutcome = 'completed' | 'canceled' | 'failed';
|
|
941
1043
|
export declare const TurnOutcome: {
|
|
942
|
-
readonly Completed:
|
|
943
|
-
readonly Canceled:
|
|
944
|
-
readonly Failed:
|
|
1044
|
+
readonly Completed: 'completed';
|
|
1045
|
+
readonly Canceled: 'canceled';
|
|
1046
|
+
readonly Failed: 'failed';
|
|
945
1047
|
};
|
|
946
1048
|
/** turn.start result. Idempotent by turn_id: a repeated turn.start for a turn the executor already accepted returns the same result without starting a second run. */
|
|
947
1049
|
export interface TurnStartResult {
|
|
@@ -1033,6 +1135,8 @@ export interface SessionEventParams {
|
|
|
1033
1135
|
event_id?: string;
|
|
1034
1136
|
/** Agent sessions; starts at 1 and increases by 1 per durable event within the session. */
|
|
1035
1137
|
sequence?: number;
|
|
1138
|
+
/** Agent sessions; optional key the executor keeps for this event across process restarts (its outbox entry id, for example). A new executor epoch renumbers sequence and suffixes event_id, so only this key lets the harness recognize an event it stored just before the executor crashed. The harness acknowledges an event whose key the session already stored as a duplicate (sequence advanced, nothing added to the session log), in any epoch. Without it an event resent in a new epoch is stored again (at-least-once). */
|
|
1139
|
+
idempotency_key?: string;
|
|
1036
1140
|
event: SessionEvent;
|
|
1037
1141
|
}
|
|
1038
1142
|
/** Params object of session.status. */
|
|
@@ -1204,6 +1308,18 @@ export interface WorkspaceBackupParams {
|
|
|
1204
1308
|
exclude?: Array<string>;
|
|
1205
1309
|
skip_if_fingerprint?: string;
|
|
1206
1310
|
}
|
|
1311
|
+
/** Params object of fs.mount. */
|
|
1312
|
+
export interface FsMountParams {
|
|
1313
|
+
session_id: string;
|
|
1314
|
+
/** Complete prefix of the bma-file routes for this machine, ending in /v1/machines/{machine_id}/fs (for example https://executor.example.com/v1/machines/mach_01/fs). The executor appends "/<op>" and nothing else; it does not compose the machine id itself. The previous <origin>/v1/fs/<op> routes stay as an alias until they are removed. */
|
|
1315
|
+
service_url: string;
|
|
1316
|
+
mounts: Array<FsMount>;
|
|
1317
|
+
}
|
|
1318
|
+
/** Params object of fs.unmount. */
|
|
1319
|
+
export interface FsUnmountParams {
|
|
1320
|
+
session_id: string;
|
|
1321
|
+
flush?: boolean;
|
|
1322
|
+
}
|
|
1207
1323
|
/** Params object of turn.start. */
|
|
1208
1324
|
export interface TurnStartParams {
|
|
1209
1325
|
/** Platform session id. */
|
|
@@ -1215,6 +1331,7 @@ export interface TurnStartParams {
|
|
|
1215
1331
|
executor_session_ref?: string;
|
|
1216
1332
|
config?: AgentTurnConfig;
|
|
1217
1333
|
deadline_ms?: number;
|
|
1334
|
+
/** 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) 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. Keys the executor does not know are ignored. */
|
|
1218
1335
|
metadata?: Record<string, string>;
|
|
1219
1336
|
}
|
|
1220
1337
|
/** Params object of turn.input. */
|
|
@@ -1250,7 +1367,7 @@ export interface SessionEventDeltaParams {
|
|
|
1250
1367
|
export interface InteractionRequestParams {
|
|
1251
1368
|
session_id: string;
|
|
1252
1369
|
turn_id: string;
|
|
1253
|
-
/** Executor-assigned, unique within the session. */
|
|
1370
|
+
/** Executor-assigned, unique within the session and stable for the same tool call or question across executor and brain restarts (derive it from the session, the turn and the call, for example appr_ + the first 24 hex chars of sha256(session_id, NUL, turn_id, NUL, call_id); the turn is part of it because some providers reuse call ids such as call_0 in every turn), so a restarted executor asks again with the same id and gets the same platform interaction, and an answer given while it was offline, back. The platform interaction is the one card every client of the session shows; a local UI shows the same interaction rather than a separate local prompt. */
|
|
1254
1371
|
interaction_id: string;
|
|
1255
1372
|
kind: InteractionKind;
|
|
1256
1373
|
/** Required for permission. */
|
|
@@ -1276,17 +1393,40 @@ export interface InteractionResponseParams {
|
|
|
1276
1393
|
answers?: Array<string>;
|
|
1277
1394
|
responder?: InteractionResponder;
|
|
1278
1395
|
}
|
|
1396
|
+
/** Params object of agent.custom_tool_result. */
|
|
1397
|
+
export interface AgentCustomToolResultParams {
|
|
1398
|
+
session_id: string;
|
|
1399
|
+
/** The event_id of the agent.custom_tool_use this result answers. */
|
|
1400
|
+
tool_use_id: string;
|
|
1401
|
+
content: Array<ContentBlock>;
|
|
1402
|
+
/** The user's application reports the call failed; the content explains why. */
|
|
1403
|
+
is_error?: boolean;
|
|
1404
|
+
}
|
|
1279
1405
|
/** Params object of interaction.cancel. */
|
|
1280
1406
|
export interface InteractionCancelParams {
|
|
1281
1407
|
session_id: string;
|
|
1282
1408
|
interaction_id: string;
|
|
1283
1409
|
reason: InteractionCancelReason;
|
|
1284
1410
|
}
|
|
1411
|
+
/** Params object of model_token.refresh. */
|
|
1412
|
+
export interface ModelTokenRefreshParams {
|
|
1413
|
+
/** Platform session id of the turn. */
|
|
1414
|
+
session_id: string;
|
|
1415
|
+
/** Platform id of the running turn the token is for. */
|
|
1416
|
+
turn_id: string;
|
|
1417
|
+
}
|
|
1418
|
+
/** Params object of tools_token.refresh. */
|
|
1419
|
+
export interface ToolsTokenRefreshParams {
|
|
1420
|
+
/** Platform session id of the turn. */
|
|
1421
|
+
session_id: string;
|
|
1422
|
+
/** Platform id of the running turn the token is for. */
|
|
1423
|
+
turn_id: string;
|
|
1424
|
+
}
|
|
1285
1425
|
/** Every executor protocol method. */
|
|
1286
|
-
export type MethodName = 'executor.register' | 'executor.heartbeat' | 'executor.token.refresh' | 'executor.capabilities.update' | 'executor.drain' | 'executor.close' | 'session.assign' | 'session.ready' | 'session.event' | 'session.status' | 'session.stop' | 'session.ended' | 'tool.call' | 'tool.result' | 'tool.cancel' | 'tool.progress' | 'process.start' | 'process.read' | 'process.write' | 'process.interrupt' | 'process.terminate' | 'process.list' | 'process.status' | 'terminal.open' | 'terminal.attach' | 'terminal.close' | 'skill.install' | 'workspace.backup' | 'turn.start' | 'turn.input' | 'turn.cancel' | 'session.close' | 'session.event_delta' | 'interaction.request' | 'interaction.response' | 'interaction.cancel';
|
|
1287
|
-
export type ExecutorToHarnessRequestMethod = 'executor.register' | 'executor.heartbeat' | 'executor.token.refresh' | 'session.ready' | 'session.event' | 'session.ended' | 'tool.result' | 'interaction.request' | 'interaction.cancel';
|
|
1426
|
+
export type MethodName = 'executor.register' | 'executor.heartbeat' | 'executor.token.refresh' | 'executor.capabilities.update' | 'executor.drain' | 'executor.close' | 'session.assign' | 'session.ready' | 'session.event' | 'session.status' | 'session.stop' | 'session.ended' | 'tool.call' | 'tool.result' | 'tool.cancel' | 'tool.progress' | 'process.start' | 'process.read' | 'process.write' | 'process.interrupt' | 'process.terminate' | 'process.list' | 'process.status' | 'terminal.open' | 'terminal.attach' | 'terminal.close' | 'skill.install' | 'workspace.backup' | 'fs.mount' | 'fs.unmount' | 'turn.start' | 'turn.input' | 'turn.cancel' | 'session.close' | 'session.event_delta' | 'interaction.request' | 'interaction.response' | 'agent.custom_tool_result' | 'interaction.cancel' | 'model_token.refresh' | 'tools_token.refresh';
|
|
1427
|
+
export type ExecutorToHarnessRequestMethod = 'executor.register' | 'executor.heartbeat' | 'executor.token.refresh' | 'session.ready' | 'session.event' | 'session.ended' | 'tool.result' | 'interaction.request' | 'interaction.cancel' | 'model_token.refresh' | 'tools_token.refresh';
|
|
1288
1428
|
export type ExecutorToHarnessNotificationMethod = 'executor.capabilities.update' | 'executor.close' | 'session.status' | 'tool.progress' | 'process.status' | 'session.event_delta';
|
|
1289
|
-
export type HarnessToExecutorRequestMethod = 'executor.drain' | 'session.assign' | 'session.stop' | 'tool.call' | 'tool.cancel' | 'process.start' | 'process.read' | 'process.write' | 'process.interrupt' | 'process.terminate' | 'process.list' | 'terminal.open' | 'terminal.attach' | 'terminal.close' | 'skill.install' | 'workspace.backup' | 'turn.start' | 'turn.input' | 'turn.cancel' | 'session.close' | 'interaction.response';
|
|
1429
|
+
export type HarnessToExecutorRequestMethod = 'executor.drain' | 'session.assign' | 'session.stop' | 'tool.call' | 'tool.cancel' | 'process.start' | 'process.read' | 'process.write' | 'process.interrupt' | 'process.terminate' | 'process.list' | 'terminal.open' | 'terminal.attach' | 'terminal.close' | 'skill.install' | 'workspace.backup' | 'fs.mount' | 'fs.unmount' | 'turn.start' | 'turn.input' | 'turn.cancel' | 'session.close' | 'interaction.response' | 'agent.custom_tool_result';
|
|
1290
1430
|
export type HarnessToExecutorNotificationMethod = 'executor.close';
|
|
1291
1431
|
export interface MethodParamsMap {
|
|
1292
1432
|
'executor.register': ExecutorRegisterParams;
|
|
@@ -1317,6 +1457,8 @@ export interface MethodParamsMap {
|
|
|
1317
1457
|
'terminal.close': TerminalCloseParams;
|
|
1318
1458
|
'skill.install': SkillInstallParams;
|
|
1319
1459
|
'workspace.backup': WorkspaceBackupParams;
|
|
1460
|
+
'fs.mount': FsMountParams;
|
|
1461
|
+
'fs.unmount': FsUnmountParams;
|
|
1320
1462
|
'turn.start': TurnStartParams;
|
|
1321
1463
|
'turn.input': TurnInputParams;
|
|
1322
1464
|
'turn.cancel': TurnCancelParams;
|
|
@@ -1324,7 +1466,10 @@ export interface MethodParamsMap {
|
|
|
1324
1466
|
'session.event_delta': SessionEventDeltaParams;
|
|
1325
1467
|
'interaction.request': InteractionRequestParams;
|
|
1326
1468
|
'interaction.response': InteractionResponseParams;
|
|
1469
|
+
'agent.custom_tool_result': AgentCustomToolResultParams;
|
|
1327
1470
|
'interaction.cancel': InteractionCancelParams;
|
|
1471
|
+
'model_token.refresh': ModelTokenRefreshParams;
|
|
1472
|
+
'tools_token.refresh': ToolsTokenRefreshParams;
|
|
1328
1473
|
}
|
|
1329
1474
|
export interface MethodResultMap {
|
|
1330
1475
|
'executor.register': ExecutorRegisterResult;
|
|
@@ -1350,13 +1495,18 @@ export interface MethodResultMap {
|
|
|
1350
1495
|
'terminal.close': TerminalCloseResult;
|
|
1351
1496
|
'skill.install': SkillInstallResult;
|
|
1352
1497
|
'workspace.backup': WorkspaceBackupResult;
|
|
1498
|
+
'fs.mount': FsMountResult;
|
|
1499
|
+
'fs.unmount': FsUnmountResult;
|
|
1353
1500
|
'turn.start': TurnStartResult;
|
|
1354
1501
|
'turn.input': Ack;
|
|
1355
1502
|
'turn.cancel': TurnCancelResult;
|
|
1356
1503
|
'session.close': SessionCloseResult;
|
|
1357
1504
|
'interaction.request': InteractionRequestResult;
|
|
1358
1505
|
'interaction.response': InteractionResponseResult;
|
|
1506
|
+
'agent.custom_tool_result': CustomToolResultResult;
|
|
1359
1507
|
'interaction.cancel': Ack;
|
|
1508
|
+
'model_token.refresh': ModelTokenRefreshResult;
|
|
1509
|
+
'tools_token.refresh': ToolsTokenRefreshResult;
|
|
1360
1510
|
}
|
|
1361
1511
|
/** since is the first protocol that has the method; capability is the capability bit the harness checks before sending it. */
|
|
1362
1512
|
export interface MethodSpec {
|