@tangle-network/sandbox 0.13.0-develop.20260726090409.d0d19a2 → 0.13.0-develop.20260726131324.13697aa

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.
@@ -1,5 +1,192 @@
1
1
  import { AgentProfile, AgentProfileCapabilities, AgentProfileConfidential, AgentProfileValidationResult } from "@tangle-network/agent-interface";
2
+ import { z } from "zod";
2
3
 
4
+ //#region ../../../packages/runtime-contracts/dist/batch-events.d.ts
5
+ /** Token and tool usage emitted when one batch task completes. */
6
+ interface BatchTaskUsage {
7
+ inputTokens: number;
8
+ outputTokens: number;
9
+ cacheReadTokens?: number;
10
+ cacheWriteTokens?: number;
11
+ toolCallCount?: number;
12
+ reasoningTokens?: number;
13
+ cost?: number;
14
+ }
15
+ /** Per-backend aggregate emitted by `batch.completed`. */
16
+ interface BatchBackendStats {
17
+ backend: string;
18
+ backendLabel?: string;
19
+ backendModel?: string;
20
+ success: number;
21
+ failure: number;
22
+ retries: number;
23
+ successRate: number;
24
+ }
25
+ /** One sidecar allocated to a backend group. */
26
+ interface BatchSidecarGroup {
27
+ backend: string;
28
+ sidecarId: string;
29
+ variants: number;
30
+ }
31
+ interface BatchTaskEventIdentity {
32
+ taskId: string;
33
+ backend: string;
34
+ backendLabel?: string;
35
+ backendModel?: string;
36
+ }
37
+ /** Whether a streamed text value appends to or replaces prior text. */
38
+ type BatchTextValueMode = "delta" | "snapshot";
39
+ /** Data payloads keyed by the SSE event name emitted by `/batch/run`. */
40
+ interface BatchEventDataMap {
41
+ "batch.provisioning": {
42
+ desiredCapacity: number;
43
+ currentCapacity: number;
44
+ provisionTimeoutMs: number;
45
+ };
46
+ "batch.provisioned": {
47
+ capacity: number;
48
+ };
49
+ "batch.started": {
50
+ taskCount: number;
51
+ backendCount: number;
52
+ totalExecutions: number;
53
+ backends: string[];
54
+ backendGroups: number;
55
+ executionClass: string;
56
+ maxConcurrentPerSidecar: number;
57
+ maxSidecarsTotal: number;
58
+ driverCapacity: number;
59
+ policyMaxConcurrentPerSidecar: number | null;
60
+ policyMaxSidecarsPerHost: number | null;
61
+ };
62
+ "sidecars.allocated": {
63
+ count: number;
64
+ groups: BatchSidecarGroup[];
65
+ executionClass: string;
66
+ maxConcurrentPerSidecar: number;
67
+ maxSidecarsTotal: number;
68
+ driverCapacity: number;
69
+ policyMaxConcurrentPerSidecar: number | null;
70
+ policyMaxSidecarsPerHost: number | null;
71
+ };
72
+ "batch.completed": {
73
+ taskCount: number;
74
+ backendCount: number;
75
+ totalExecutions: number;
76
+ totalSuccess: number;
77
+ totalFailure: number;
78
+ totalRetries: number;
79
+ successRate: number;
80
+ byBackend: BatchBackendStats[];
81
+ };
82
+ "batch.failed": {
83
+ error: string;
84
+ backends?: string[];
85
+ };
86
+ "batch.persistent": {
87
+ message: string;
88
+ sidecarCount: number;
89
+ };
90
+ "batch.grace_period": {
91
+ message: string;
92
+ sidecarCount: number;
93
+ graceMs: number;
94
+ sidecarIds: string[];
95
+ };
96
+ "task.started": BatchTaskEventIdentity & {
97
+ index: number;
98
+ total: number;
99
+ attempt: number;
100
+ retries: number;
101
+ sidecarId: string;
102
+ projectRef?: string;
103
+ };
104
+ "task.message.delta": BatchTaskEventIdentity & {
105
+ sidecarId: string;
106
+ projectRef?: string;
107
+ value: string;
108
+ valueMode: BatchTextValueMode;
109
+ part: Record<string, unknown>;
110
+ };
111
+ "task.reasoning": BatchTaskEventIdentity & {
112
+ sidecarId: string;
113
+ projectRef?: string;
114
+ value: string;
115
+ valueMode: BatchTextValueMode;
116
+ part: Record<string, unknown>;
117
+ };
118
+ "task.tool.updated": BatchTaskEventIdentity & {
119
+ sidecarId: string;
120
+ projectRef?: string;
121
+ part: Record<string, unknown>;
122
+ };
123
+ "task.completed": BatchTaskEventIdentity & {
124
+ durationMs: number;
125
+ attempt: number;
126
+ retries: number;
127
+ sidecarId: string;
128
+ projectRef?: string;
129
+ resultSummary?: string;
130
+ sessionId?: string;
131
+ usage: BatchTaskUsage;
132
+ };
133
+ "task.failed": BatchTaskEventIdentity & {
134
+ durationMs: number;
135
+ attempt: number;
136
+ retries: number;
137
+ error: string;
138
+ sidecarId?: string;
139
+ projectRef?: string;
140
+ };
141
+ "task.retry": BatchTaskEventIdentity & {
142
+ attempt: number;
143
+ maxRetries: number;
144
+ error: string;
145
+ delayMs: number;
146
+ executionClass: string;
147
+ sidecarId: string;
148
+ projectRef?: string;
149
+ };
150
+ "backend.completed": {
151
+ backend: string;
152
+ backendLabel?: string;
153
+ backendModel?: string;
154
+ sidecarIds?: string[];
155
+ success: number;
156
+ failure: number;
157
+ retries: number;
158
+ successRate: number;
159
+ };
160
+ "sidecar.releasing": {
161
+ sidecarId: string;
162
+ };
163
+ }
164
+ /** Discriminated SSE event from a batch execution. */
165
+ type BatchEvent = { [K in keyof BatchEventDataMap]: {
166
+ type: K;
167
+ data: BatchEventDataMap[K]; /** Optional SSE id used by reconnecting consumers. */
168
+ id?: string;
169
+ } }[keyof BatchEventDataMap];
170
+ //#endregion
171
+ //#region ../../../packages/cli-agent-registry/src/backend-types.d.ts
172
+ declare const BACKEND_TYPE: {
173
+ readonly OPENCODE: "opencode";
174
+ readonly CLAUDE_CODE: "claude-code";
175
+ readonly KIMI_CODE: "kimi-code";
176
+ readonly CODEX: "codex";
177
+ readonly AMP: "amp";
178
+ readonly FACTORY_DROIDS: "factory-droids";
179
+ readonly PI: "pi";
180
+ readonly HERMES: "hermes";
181
+ readonly FORGE: "forge";
182
+ readonly OPENCLAW: "openclaw";
183
+ readonly NANOCLAW: "nanoclaw";
184
+ readonly ACP: "acp";
185
+ readonly CURSOR: "cursor";
186
+ readonly CLI_BASE: "cli-base";
187
+ };
188
+ type BackendType$1 = (typeof BACKEND_TYPE)[keyof typeof BACKEND_TYPE];
189
+ //#endregion
3
190
  //#region src/terminal-stream.d.ts
4
191
  /**
5
192
  * TerminalStream — typed client for the sandbox terminal WebSocket protocol.
@@ -207,173 +394,6 @@ declare class TerminalStream {
207
394
  private assertOpen;
208
395
  }
209
396
  //#endregion
210
- //#region ../../../packages/runtime-contracts/dist/batch-events.d.ts
211
- /** Token and tool usage emitted when one batch task completes. */
212
- interface BatchTaskUsage {
213
- inputTokens: number;
214
- outputTokens: number;
215
- cacheReadTokens?: number;
216
- cacheWriteTokens?: number;
217
- toolCallCount?: number;
218
- reasoningTokens?: number;
219
- cost?: number;
220
- }
221
- /** Per-backend aggregate emitted by `batch.completed`. */
222
- interface BatchBackendStats {
223
- backend: string;
224
- backendLabel?: string;
225
- backendModel?: string;
226
- success: number;
227
- failure: number;
228
- retries: number;
229
- successRate: number;
230
- }
231
- /** One sidecar allocated to a backend group. */
232
- interface BatchSidecarGroup {
233
- backend: string;
234
- sidecarId: string;
235
- variants: number;
236
- }
237
- interface BatchTaskEventIdentity {
238
- taskId: string;
239
- backend: string;
240
- backendLabel?: string;
241
- backendModel?: string;
242
- }
243
- /** Whether a streamed text value appends to or replaces prior text. */
244
- type BatchTextValueMode = "delta" | "snapshot";
245
- /** Data payloads keyed by the SSE event name emitted by `/batch/run`. */
246
- interface BatchEventDataMap {
247
- "batch.provisioning": {
248
- desiredCapacity: number;
249
- currentCapacity: number;
250
- provisionTimeoutMs: number;
251
- };
252
- "batch.provisioned": {
253
- capacity: number;
254
- };
255
- "batch.started": {
256
- taskCount: number;
257
- backendCount: number;
258
- totalExecutions: number;
259
- backends: string[];
260
- backendGroups: number;
261
- executionClass: string;
262
- maxConcurrentPerSidecar: number;
263
- maxSidecarsTotal: number;
264
- driverCapacity: number;
265
- policyMaxConcurrentPerSidecar: number | null;
266
- policyMaxSidecarsPerHost: number | null;
267
- };
268
- "sidecars.allocated": {
269
- count: number;
270
- groups: BatchSidecarGroup[];
271
- executionClass: string;
272
- maxConcurrentPerSidecar: number;
273
- maxSidecarsTotal: number;
274
- driverCapacity: number;
275
- policyMaxConcurrentPerSidecar: number | null;
276
- policyMaxSidecarsPerHost: number | null;
277
- };
278
- "batch.completed": {
279
- taskCount: number;
280
- backendCount: number;
281
- totalExecutions: number;
282
- totalSuccess: number;
283
- totalFailure: number;
284
- totalRetries: number;
285
- successRate: number;
286
- byBackend: BatchBackendStats[];
287
- };
288
- "batch.failed": {
289
- error: string;
290
- backends?: string[];
291
- };
292
- "batch.persistent": {
293
- message: string;
294
- sidecarCount: number;
295
- };
296
- "batch.grace_period": {
297
- message: string;
298
- sidecarCount: number;
299
- graceMs: number;
300
- sidecarIds: string[];
301
- };
302
- "task.started": BatchTaskEventIdentity & {
303
- index: number;
304
- total: number;
305
- attempt: number;
306
- retries: number;
307
- sidecarId: string;
308
- projectRef?: string;
309
- };
310
- "task.message.delta": BatchTaskEventIdentity & {
311
- sidecarId: string;
312
- projectRef?: string;
313
- value: string;
314
- valueMode: BatchTextValueMode;
315
- part: Record<string, unknown>;
316
- };
317
- "task.reasoning": BatchTaskEventIdentity & {
318
- sidecarId: string;
319
- projectRef?: string;
320
- value: string;
321
- valueMode: BatchTextValueMode;
322
- part: Record<string, unknown>;
323
- };
324
- "task.tool.updated": BatchTaskEventIdentity & {
325
- sidecarId: string;
326
- projectRef?: string;
327
- part: Record<string, unknown>;
328
- };
329
- "task.completed": BatchTaskEventIdentity & {
330
- durationMs: number;
331
- attempt: number;
332
- retries: number;
333
- sidecarId: string;
334
- projectRef?: string;
335
- resultSummary?: string;
336
- sessionId?: string;
337
- usage: BatchTaskUsage;
338
- };
339
- "task.failed": BatchTaskEventIdentity & {
340
- durationMs: number;
341
- attempt: number;
342
- retries: number;
343
- error: string;
344
- sidecarId?: string;
345
- projectRef?: string;
346
- };
347
- "task.retry": BatchTaskEventIdentity & {
348
- attempt: number;
349
- maxRetries: number;
350
- error: string;
351
- delayMs: number;
352
- executionClass: string;
353
- sidecarId: string;
354
- projectRef?: string;
355
- };
356
- "backend.completed": {
357
- backend: string;
358
- backendLabel?: string;
359
- backendModel?: string;
360
- sidecarIds?: string[];
361
- success: number;
362
- failure: number;
363
- retries: number;
364
- successRate: number;
365
- };
366
- "sidecar.releasing": {
367
- sidecarId: string;
368
- };
369
- }
370
- /** Discriminated SSE event from a batch execution. */
371
- type BatchEvent = { [K in keyof BatchEventDataMap]: {
372
- type: K;
373
- data: BatchEventDataMap[K]; /** Optional SSE id used by reconnecting consumers. */
374
- id?: string;
375
- } }[keyof BatchEventDataMap];
376
- //#endregion
377
397
  //#region src/types.d.ts
378
398
  type JsonValue = string | number | boolean | null | JsonValue[] | {
379
399
  [key: string]: JsonValue;
@@ -514,14 +534,14 @@ interface GitConfig {
514
534
  * @example
515
535
  * ```typescript
516
536
  * const client = new Sandbox({
517
- * apiKey: "sk_sandbox_abc123",
537
+ * apiKey: "sk-tan-...",
518
538
  * baseUrl: "https://your-sandbox-api.example.com",
519
539
  * timeoutMs: 60000,
520
540
  * });
521
541
  * ```
522
542
  */
523
- interface SandboxClientConfig {
524
- /** API key for authentication. Must start with `sk_sandbox_` */
543
+ interface SandboxConfig {
544
+ /** API key for authentication */
525
545
  apiKey: string;
526
546
  /** Base URL for the Sandbox API */
527
547
  baseUrl: string;
@@ -679,7 +699,10 @@ interface CreateSandboxOptions {
679
699
  *
680
700
  * @example OpenCode with profile
681
701
  * ```typescript
682
- * backend: { type: "opencode", profile: "with-web-search" }
702
+ * backend: {
703
+ * type: "opencode",
704
+ * profile: { name: "with-web-search" },
705
+ * }
683
706
  * ```
684
707
  */
685
708
  backend?: BackendConfig;
@@ -743,8 +766,6 @@ interface CreateSandboxOptions {
743
766
  * @default false
744
767
  */
745
768
  sshEnabled?: boolean;
746
- /** Custom SSH public key for access (optional) */
747
- sshPublicKey?: string;
748
769
  /** Custom SSH public keys for access (optional) */
749
770
  sshPublicKeys?: string[];
750
771
  /** Stored SSH key IDs or names to authorize at creation time */
@@ -861,7 +882,7 @@ interface CreateSandboxOptions {
861
882
  * container. Billing is by reserved capacity (not measured RSS), so
862
883
  * this comes out of your sandbox's RAM envelope rather than adding
863
884
  * a separate line item. On a 1 GB sandbox that is ~10% of your
864
- * workload's headroom; bump `resources.memoryMb` to 1.5–2 GB if
885
+ * workload's headroom; bump `resources.memoryMB` to 1.5–2 GB if
865
886
  * the agent will run anything memory-hungry alongside it.
866
887
  *
867
888
  * @example
@@ -979,7 +1000,7 @@ interface CreateSandboxOptions {
979
1000
  autoDeferProfile?: boolean;
980
1001
  }
981
1002
  /**
982
- * Per-call overrides for {@link SandboxClient.create}.
1003
+ * Per-call overrides for {@link Sandbox.create}.
983
1004
  */
984
1005
  interface CreateRequestOptions {
985
1006
  /**
@@ -1219,28 +1240,6 @@ interface SandboxTerminalAttachOptions {
1219
1240
  interface SandboxTerminals extends SandboxTerminalManager {
1220
1241
  attach(connectionId: string, options?: SandboxTerminalAttachOptions): Promise<TerminalStream>;
1221
1242
  }
1222
- /** Runtime-local agent profile. */
1223
- interface SandboxRuntimeProfile {
1224
- id: string;
1225
- name: string;
1226
- description?: string;
1227
- model?: string;
1228
- tags?: string[];
1229
- }
1230
- /** Runtime-local profile listing and selected default. */
1231
- interface SandboxRuntimeProfileList {
1232
- profiles: SandboxRuntimeProfile[];
1233
- defaultProfile: string;
1234
- }
1235
- /** Profile summary returned before a sandbox runtime exists. */
1236
- interface SandboxProfileSummary {
1237
- id: string;
1238
- name: string;
1239
- description?: string;
1240
- model?: string;
1241
- tags?: string[];
1242
- extends?: string;
1243
- }
1244
1243
  /**
1245
1244
  * Raw TEE attestation evidence returned by the sandbox runtime.
1246
1245
  *
@@ -1600,11 +1599,9 @@ type PromptInputPart = {
1600
1599
  path?: string;
1601
1600
  } | {
1602
1601
  type: "file";
1603
- filename?: string;
1602
+ filename: string;
1604
1603
  mediaType?: string;
1605
- url?: string;
1606
- path?: string;
1607
- content?: string;
1604
+ url: string;
1608
1605
  };
1609
1606
  /**
1610
1607
  * Options for sending a prompt.
@@ -1612,13 +1609,11 @@ type PromptInputPart = {
1612
1609
  interface PromptOptions {
1613
1610
  /** Session ID for conversation continuity */
1614
1611
  sessionId?: string;
1615
- /** Model to use (format: provider/model, e.g., anthropic/claude-sonnet-4-20250514) */
1616
- model?: string;
1617
1612
  /**
1618
1613
  * Per-run backend override.
1619
1614
  *
1620
- * Use `backend.profile` with a string for a named profile or a provider-neutral
1621
- * `AgentProfile` object for inline profile configuration.
1615
+ * Set `backend.model` for a model override and `backend.profile` for an
1616
+ * inline provider-neutral `AgentProfile`.
1622
1617
  */
1623
1618
  backend?: Partial<BackendConfig>;
1624
1619
  /** Timeout in milliseconds */
@@ -2037,22 +2032,6 @@ interface StorageConfig {
2037
2032
  /** Path prefix within bucket (default: sandbox-snapshots/) */
2038
2033
  prefix?: string;
2039
2034
  }
2040
- /**
2041
- * Options for running a multi-turn task.
2042
- */
2043
- interface TaskOptions extends PromptOptions {
2044
- /** Maximum number of agent turns (default: 10, 0 = unlimited) */
2045
- maxTurns?: number;
2046
- }
2047
- /**
2048
- * Result of a multi-turn task execution.
2049
- */
2050
- interface TaskResult extends PromptResult {
2051
- /** Number of agent turns used */
2052
- turnsUsed: number;
2053
- /** Session ID for the task (can be used to continue) */
2054
- sessionId: string;
2055
- }
2056
2035
  /**
2057
2036
  * Live whole-sandbox resource usage, read from the container cgroup.
2058
2037
  *
@@ -2114,7 +2093,7 @@ interface SessionListOptions {
2114
2093
  /** Filter by status. */
2115
2094
  status?: SessionStatus;
2116
2095
  /** Filter by backend identifier. */
2117
- backend?: string;
2096
+ backend?: BackendType;
2118
2097
  }
2119
2098
  /** Options for creating a runtime agent session. */
2120
2099
  interface CreateSessionOptions {
@@ -2562,9 +2541,9 @@ interface BatchTask {
2562
2541
  /** Per-task timeout in milliseconds */
2563
2542
  timeoutMs?: number;
2564
2543
  }
2565
- /** Backend configuration accepted by batch execution, including named profiles. */
2544
+ /** Backend configuration accepted by batch execution. */
2566
2545
  type BatchBackend = Omit<Partial<BackendConfig>, "type"> & {
2567
- type?: BackendType | `${BackendType}:${string}`;
2546
+ type?: BackendType;
2568
2547
  };
2569
2548
  /**
2570
2549
  * Options for batch execution.
@@ -2577,8 +2556,7 @@ interface BatchOptions {
2577
2556
  /**
2578
2557
  * Shared backend override for the batch.
2579
2558
  *
2580
- * Use `backend.profile` with a string for a named profile or a provider-neutral
2581
- * `AgentProfile` object for inline profile configuration.
2559
+ * Use `backend.profile` for an inline provider-neutral `AgentProfile`.
2582
2560
  */
2583
2561
  backend?: BatchBackend;
2584
2562
  /** Run every task against each backend for comparison. */
@@ -2639,8 +2617,8 @@ interface BatchTaskResult {
2639
2617
  taskId: string;
2640
2618
  /** Whether the task succeeded */
2641
2619
  success: boolean;
2642
- /** Task response if successful */
2643
- response?: string;
2620
+ /** Task result summary if successful */
2621
+ resultSummary?: string;
2644
2622
  /** Error message if failed */
2645
2623
  error?: string;
2646
2624
  /** Duration in milliseconds */
@@ -2648,7 +2626,7 @@ interface BatchTaskResult {
2648
2626
  /** Number of retries */
2649
2627
  retries: number;
2650
2628
  /** Token usage if available */
2651
- tokensUsed?: number;
2629
+ usage?: BatchTaskUsage;
2652
2630
  /** Backend identifier for multi-backend batches. */
2653
2631
  backend?: string;
2654
2632
  /** Human-readable backend label emitted by the server. */
@@ -2711,8 +2689,8 @@ interface SandboxFleetPolicy {
2711
2689
  maxSpendUsd?: number;
2712
2690
  /** Allowed infrastructure drivers for fleet machines. */
2713
2691
  allowedDrivers?: DriverType[];
2714
- /** Allowed images/environments for fleet machines. */
2715
- allowedImages?: string[];
2692
+ /** Allowed environments for fleet machines. */
2693
+ allowedEnvironments?: string[];
2716
2694
  /** Allowed personal or public template identifiers for fleet machines. */
2717
2695
  allowedTemplateIds?: string[];
2718
2696
  /** Whether machines may request accelerator devices. Defaults to allowed. */
@@ -2821,7 +2799,7 @@ interface FleetExecDispatchResult {
2821
2799
  retryAfterMs?: number;
2822
2800
  };
2823
2801
  }
2824
- interface FleetPromptDispatchOptions extends Pick<PromptOptions, "sessionId" | "model" | "backend" | "timeoutMs" | "context"> {
2802
+ interface FleetPromptDispatchOptions extends Pick<PromptOptions, "sessionId" | "backend" | "timeoutMs" | "context"> {
2825
2803
  machines?: FleetMachineId[];
2826
2804
  maxConcurrent?: number;
2827
2805
  retry?: {
@@ -2907,7 +2885,6 @@ interface AttachSandboxFleetMachineOptions {
2907
2885
  status?: string;
2908
2886
  role?: SandboxFleetMachineRole;
2909
2887
  driverType?: DriverType;
2910
- image?: string;
2911
2888
  environment?: string;
2912
2889
  templateId?: string;
2913
2890
  publicTemplateId?: string;
@@ -2926,7 +2903,6 @@ interface SandboxFleetManifestMachine {
2926
2903
  role?: SandboxFleetMachineRole;
2927
2904
  status?: string;
2928
2905
  driverType?: DriverType;
2929
- image?: string;
2930
2906
  environment?: string;
2931
2907
  templateId?: string;
2932
2908
  publicTemplateId?: string;
@@ -3525,33 +3501,10 @@ interface DriverInfo {
3525
3501
  /**
3526
3502
  * Backend type identifier. Controls which AI agent runtime runs inside the sandbox.
3527
3503
  *
3528
- * The public-SDK source of truth. Kept in lock-step with the private
3529
- * `@tangle-network/cli-agent-registry` spec list via the parity check in
3530
- * `packages/cli-agent-registry/tests/specs.test.ts` (adding a new CLI spec
3531
- * without updating this union surfaces as a test failure at PR review
3532
- * time). Inlined here so the published SDK doesn't carry an unpublished
3533
- * internal package as a runtime dep.
3534
- *
3535
- * - `"opencode"` — Default. Multi-provider, profile system, MCP support.
3536
- * - `"claude-code"` — Anthropic Claude Code CLI. Requires an Anthropic API key.
3537
- * - `"kimi-code"` — Moonshot Kimi Code CLI. Uses the operator's Kimi Code
3538
- * subscription OAuth (shipped via authFiles) by default; falls back to
3539
- * `MOONSHOT_API_KEY` when an apiKey is supplied.
3540
- * - `"codex"` — OpenAI Codex CLI. Requires an OpenAI API key.
3541
- * - `"amp"` — Sourcegraph AMP agent.
3542
- * - `"factory-droids"` — Factory Droid agent.
3543
- * - `"pi"` — Pi coding-agent CLI.
3544
- * - `"hermes"` — Hermes inference-router agent.
3545
- * - `"forge"` — Forge (forgecode.dev, tailcallhq) multi-provider coding agent.
3546
- * - `"openclaw"` — OpenClaw dispatcher that routes to claude-cli/codex-cli/gemini-cli.
3547
- * - `"nanoclaw"` — NanoClaw local socket bridge backend.
3548
- * - `"acp"` — Agent Client Protocol bridge — fronts any ACP-compliant
3549
- * agent binary (claude-agent-acp, codex-acp, gemini, openclaw acp).
3550
- * Pick the backing agent via config.subAgent.
3551
- * - `"cursor"` — Cursor Agent SDK local/cloud backend.
3552
- * - `"cli-base"` — Minimal CLI-only (no AI agent).
3553
- */
3554
- type BackendType = "opencode" | "claude-code" | "kimi-code" | "codex" | "amp" | "factory-droids" | "pi" | "hermes" | "forge" | "openclaw" | "nanoclaw" | "acp" | "cursor" | "cli-base";
3504
+ * Derived from the CLI agent registry so runtime validation and public
3505
+ * TypeScript inputs use one canonical provider list.
3506
+ */
3507
+ type BackendType = BackendType$1;
3555
3508
  /**
3556
3509
  * MCP (Model Context Protocol) server configuration.
3557
3510
  */
@@ -3577,14 +3530,6 @@ interface McpServerConfig {
3577
3530
  * backend: { type: "opencode" }
3578
3531
  * ```
3579
3532
  *
3580
- * @example OpenCode with named profile
3581
- * ```typescript
3582
- * backend: {
3583
- * type: "opencode",
3584
- * profile: "with-web-search",
3585
- * }
3586
- * ```
3587
- *
3588
3533
  * @example Claude Code with BYOK
3589
3534
  * ```typescript
3590
3535
  * backend: {
@@ -3606,10 +3551,10 @@ interface BackendConfig {
3606
3551
  /**
3607
3552
  * Backend profile selection.
3608
3553
  *
3609
- * Use a string for a named provider/backend profile, or an `AgentProfile`
3610
- * object for an inline provider-neutral profile definition.
3554
+ * Use an `AgentProfile` object for an inline provider-neutral profile
3555
+ * definition.
3611
3556
  */
3612
- profile?: string | AgentProfile;
3557
+ profile?: AgentProfile;
3613
3558
  /**
3614
3559
  * Model configuration override.
3615
3560
  */
@@ -3713,12 +3658,6 @@ interface BackendInfo {
3713
3658
  available: boolean;
3714
3659
  /** Backend capabilities */
3715
3660
  capabilities: BackendCapabilities;
3716
- /** Available profiles (for opencode) */
3717
- profiles?: Array<{
3718
- name: string;
3719
- description?: string;
3720
- tags?: string[];
3721
- }>;
3722
3661
  }
3723
3662
  interface BackendListOptions {
3724
3663
  limit?: number;
@@ -4242,25 +4181,6 @@ interface ExactProcessSpawnOptions extends ProcessSpawnOptions {
4242
4181
  interface ProcessListOptions {
4243
4182
  idempotencyKey?: string;
4244
4183
  }
4245
- /**
4246
- * Options for running Python code.
4247
- *
4248
- * @example Simple code execution
4249
- * ```typescript
4250
- * const result = await box.process.runCode(`
4251
- * import numpy as np
4252
- * print(np.random.rand(10))
4253
- * `);
4254
- * ```
4255
- */
4256
- interface RunCodeOptions {
4257
- /** Working directory */
4258
- cwd?: string;
4259
- /** Environment variables */
4260
- env?: Record<string, string>;
4261
- /** Timeout in milliseconds */
4262
- timeoutMs?: number;
4263
- }
4264
4184
  /**
4265
4185
  * Status of a spawned process.
4266
4186
  */
@@ -4329,21 +4249,6 @@ interface ProcessLogEntry {
4329
4249
  /** Timestamp in milliseconds */
4330
4250
  timestamp: number;
4331
4251
  }
4332
- /**
4333
- * Result of running code or a blocking process.
4334
- */
4335
- interface CodeResult {
4336
- /** Process ID */
4337
- pid: number;
4338
- /** Exit code */
4339
- exitCode: number;
4340
- /** Standard output */
4341
- stdout: string;
4342
- /** Standard error */
4343
- stderr: string;
4344
- /** Execution duration in milliseconds */
4345
- durationMs: number;
4346
- }
4347
4252
  /**
4348
4253
  * Signal types for killing processes.
4349
4254
  */
@@ -4440,15 +4345,6 @@ interface Process {
4440
4345
  * await proc.kill();
4441
4346
  * ```
4442
4347
  *
4443
- * @example Run Python code directly
4444
- * ```typescript
4445
- * const result = await box.process.runCode(`
4446
- * import numpy as np
4447
- * print(np.random.rand(10).mean())
4448
- * `);
4449
- * console.log(result.stdout); // Prints the mean
4450
- * ```
4451
- *
4452
4348
  * @example List and manage processes
4453
4349
  * ```typescript
4454
4350
  * const procs = await box.process.list();
@@ -4481,15 +4377,6 @@ interface ProcessManager {
4481
4377
  spawn(command: string, options?: ProcessSpawnOptions): Promise<Process>;
4482
4378
  /** Spawn an executable with exact argument boundaries and no shell parsing. */
4483
4379
  spawnExact(executable: string, args: readonly string[], options?: ExactProcessSpawnOptions): Promise<Process>;
4484
- /**
4485
- * Run Python code directly.
4486
- * Blocks until completion and returns result.
4487
- *
4488
- * @param code - Python code to execute
4489
- * @param options - Execution options
4490
- * @returns Execution result with stdout/stderr
4491
- */
4492
- runCode(code: string, options?: RunCodeOptions): Promise<CodeResult>;
4493
4380
  /**
4494
4381
  * List all tracked processes.
4495
4382
  *
@@ -5285,4 +5172,4 @@ interface CodeExecutionOptions {
5285
5172
  idempotencyKey?: string;
5286
5173
  }
5287
5174
  //#endregion
5288
- export { EventStreamOptions as $, TerminalStreamHandlers as $i, SandboxFleetCostEstimate as $n, SendSessionMessageOptions as $r, ListSandboxFleetOptions as $t, CreateIntelligenceReportOptions as A, TokenRefreshHandler as Ai, ReapExpiredSandboxFleetsOptions as An, SandboxResourceUsage as Ar, GitCommit as At, DirectoryPermission as B, WriteManyFile as Bi, RolloutScorer as Bn, SandboxTerminalRequestOptions as Br, GpuLeaseProviderName as Bt, CodeExecutionResult as C, TaskSessionInfo as Ci, ProvisionResult as Cn, SandboxFleetWorkspaceSnapshotResult as Cr, FleetExecDispatchResult as Ct, CommitTaskSessionOptions as D, TeeAttestationResponse as Di, PublicTemplateVersionInfo as Dn, SandboxPortBinding as Dr, GPU_LEASE_PROVIDER_NAMES as Dt, CodeResultPart as E, TeeAttestationReport as Ei, PublicTemplateInfo as En, SandboxIntelligenceEnvelope as Er, FleetPromptDispatchResult as Et, CreateSandboxOptions as F, UploadProgress as Fi, RestoreSnapshotOptions as Fn, SandboxStatus as Fr, GpuLeaseBilling as Ft, DriveTurnOptions as G, BatchSidecarGroup as Gi, SSHCommandDescriptor as Gn, SandboxTraceOptions as Gr, IntelligenceReport as Gt, DispatchedSession as H, BatchBackendStats as Hi, RolloutStatus as Hn, SandboxTraceBundle as Hr, HostAgentDriverConfig as Ht, CreateSessionOptions as I, UsageInfo as Ii, ResumeOptions as In, SandboxTerminalAttachOptions as Ir, GpuLeaseCommandResult as It, DriverType as J, TerminalExitInfo as Ji, SandboxConnection as Jn, ScopedTokenScope as Jr, IntelligenceReportSubjectType as Jt, DriverConfig as K, BatchTaskUsage as Ki, SSHCredentials as Kn, SandboxUser as Kr, IntelligenceReportBudget as Kt, CreateTaskSessionOptions as L, WaitForOptions as Li, Rollout as Ln, SandboxTerminalCreateOptions as Lr, GpuLeaseExecOptions as Lt, CreateSandboxFleetOptions as M, TurnDriveResult as Mi, ReconcileSandboxFleetsOptions as Mn, SandboxRuntimeHealth as Mr, GitDiff as Mt, CreateSandboxFleetTokenOptions as N, UpdateUserOptions as Ni, ReconcileSandboxFleetsResult as Nn, SandboxRuntimeProfile as Nr, GitStatus as Nt, CompletedTurnResult as O, TeePublicKey as Oi, PublishPublicTemplateOptions as On, SandboxPortPreviewLink as Or, GitAuth as Ot, CreateSandboxFleetWithCoordinatorOptions as P, UploadOptions as Pi, RenameOptions as Pn, SandboxRuntimeProfileList as Pr, GpuLease as Pt, EnsureDevServerOptions as Q, TerminalStreamError as Qi, SandboxFleetArtifactSpec as Qn, SecretsManager as Qr, ListOptions as Qt, DeleteOptions as R, WaitForRolloutOptions as Ri, RolloutChildResult as Rn, SandboxTerminalInfo as Rr, GpuLeaseExecResult as Rt, CodeExecutionOptions as S, TaskSessionFileChange as Si, ProvisionEvent as Sn, SandboxFleetWorkspaceRestoreResult as Sr, FleetExecDispatchOptions as St, CodeResult as T, TeeAttestationOptions as Ti, ProvisionStep as Tn, SandboxInfo as Tr, FleetPromptDispatchOptions as Tt, DownloadOptions as U, BatchEvent as Ui, RolloutTurnPart as Un, SandboxTraceEvent as Ur, HostAgentRuntimeBackend as Ut, DispatchPromptOptions as V, WriteManyOptions as Vi, RolloutStartResult as Vn, SandboxTerminals as Vr, GpuLeaseStatus as Vt, DownloadProgress as W, BatchEventDataMap as Wi, RunCodeOptions as Wn, SandboxTraceExport as Wr, InstalledTool as Wt, EgressManager as X, TerminalStream as Xi, SandboxEvent as Xn, SearchOptions as Xr, JsonValue as Xt, DurablePlan as Y, TerminalReadyInfo as Yi, SandboxEnvironment as Yn, SearchMatch as Yr, IntelligenceReportWindow as Yt, EgressPolicy as Z, TerminalStreamAuthFormat as Zi, SandboxFleetArtifact as Zn, SecretInfo as Zr, ListMessagesOptions as Zt, BatchTask as _, SubscriptionInfo as _i, ProcessSpawnOptions as _n, SandboxFleetTraceExport as _r, FleetDispatchResultBuffer as _t, AttachSandboxFleetMachineOptions as a, SessionInfo as ai, NetworkManager as an, SandboxFleetIntelligenceEnvelope as ar, FileReadBatchResult as at, ChunkedUploadOptions as b, TaskSessionChanges as bi, PromptOptions as bn, SandboxFleetWorkspace as br, FleetDriveTurnOutcome as bt, BackendInfo as c, SessionMessageInputPart as ci, PermissionsManager as cn, SandboxFleetMachineRecord as cr, FileRenameResult as ct, BackendType as d, SnapshotOptions as di, Process as dn, SandboxFleetManifestMachine as dr, FileTreeOptions as dt, TerminalStreamOptions as ea, SendSessionMessageRequest as ei, ListSandboxOptions as en, SandboxFleetDispatchFailureClass as er, ExactProcessSpawnOptions as et, BatchBackend as f, SnapshotResult as fi, ProcessInfo as fn, SandboxFleetOperationsSummary as fr, FileTreeResult as ft, BatchRunRequest as g, StorageConfig as gi, ProcessSignal as gn, SandboxFleetTraceEvent as gr, FleetDispatchCancelResult as gt, BatchRunOptions as h, StartupOperation as hi, ProcessManager as hn, SandboxFleetTraceBundle as hr, FileWriteResult as ht, AttachGpuLeaseOptions as i, SessionForkOptions as ii, NetworkConfig as in, SandboxFleetInfo as ir, FileReadBatchOptions as it, CreateRequestOptions as j, TokenUsage as ji, ReapExpiredSandboxFleetsResult as jn, SandboxResources as jr, GitConfig as jt, CreateGpuLeaseOptions as k, TeePublicKeyResponse as ki, PublishPublicTemplateVersionOptions as kn, SandboxProfileSummary as kr, GitBranch as kt, BackendManager as l, SessionStatus as li, PreviewLinkInfo as ln, SandboxFleetMachineSpec as lr, FileSystem as lt, BatchResult as m, StartupDiagnostics as mi, ProcessLogEntry as mn, SandboxFleetToken as mr, FileUsageResult as mt, AccessPolicyRule as n, SessionBackendCredentials as ni, MintScopedTokenOptions as nn, SandboxFleetDriverCapability as nr, ExecResult as nt, BackendCapabilities as o, SessionListOptions as oi, NonHostAgentDriverConfig as on, SandboxFleetMachine as or, FileReadError as ot, BatchOptions as p, SshKeysManager as pi, ProcessListOptions as pn, SandboxFleetPolicy as pr, FileUsageOptions as pt, DriverInfo as q, TERMINAL_WS_ECHO_SUBPROTOCOL as qi, SandboxClientConfig as qn, ScopedToken as qr, IntelligenceReportCompareTo as qt, AddUserOptions as r, SessionEventStreamOptions as ri, MkdirOptions as rn, SandboxFleetDriverTimings as rr, FileInfo as rt, BackendConfig as s, SessionMessage as si, PermissionLevel as sn, SandboxFleetMachineMeteredUsage as sr, FileReadResult as st, AcceleratorKind as t, TerminalStreamToken as ta, SentSessionMessage as ti, McpServerConfig as tn, SandboxFleetDispatchResponse as tr, ExecOptions as tt, BackendStatus as u, SnapshotInfo as ui, PreviewLinkManager as un, SandboxFleetManifest as ur, FileTreeFile as ut, BatchTaskResult as v, TaskOptions as vi, ProcessStatus as vn, SandboxFleetTraceOptions as vr, FleetDispatchResultBufferOptions as vt, CodeLanguage as w, TaskSessionProfile as wi, ProvisionStatus as wn, SandboxIdentity as wr, FleetMachineId as wt, ChunkedUploadResult as x, TaskSessionCommitResult as xi, PromptResult as xn, SandboxFleetWorkspaceReconcileResult as xr, FleetDriveTurnRequest as xt, BranchOptions as y, TaskResult as yi, PromptInputPart as yn, SandboxFleetUsage as yr, FleetDispatchStreamOptions as yt, DevServerInfo as z, WriteFileOptions as zi, RolloutOptions as zn, SandboxTerminalManager as zr, GpuLeaseManager as zt };
5175
+ export { ExactProcessSpawnOptions as $, SandboxFleetDispatchResponse as $n, SessionForkOptions as $r, ListSandboxOptions as $t, CreateRequestOptions as A, WaitForOptions as Ai, ReapExpiredSandboxFleetsResult as An, SandboxStatus as Ar, GitConfig as At, DispatchPromptOptions as B, TerminalStreamError as Bi, RolloutStartResult as Bn, SandboxTraceOptions as Br, GpuLeaseStatus as Bt, CodeExecutionResult as C, TokenRefreshHandler as Ci, ProvisionStatus as Cn, SandboxInfo as Cr, FleetMachineId as Ct, CompletedTurnResult as D, UploadOptions as Di, PublishPublicTemplateOptions as Dn, SandboxResourceUsage as Dr, GitAuth as Dt, CommitTaskSessionOptions as E, UpdateUserOptions as Ei, PublicTemplateVersionInfo as En, SandboxPortPreviewLink as Er, GPU_LEASE_PROVIDER_NAMES as Et, CreateSessionOptions as F, TERMINAL_WS_ECHO_SUBPROTOCOL as Fi, ResumeOptions as Fn, SandboxTerminalRequestOptions as Fr, GpuLeaseCommandResult as Ft, DriverConfig as G, BatchEvent as Gi, SandboxConfig as Gn, SearchOptions as Gr, IntelligenceReportBudget as Gt, DownloadOptions as H, TerminalStreamOptions as Hi, RolloutTurnPart as Hn, ScopedToken as Hr, HostAgentRuntimeBackend as Ht, CreateTaskSessionOptions as I, TerminalExitInfo as Ii, Rollout as In, SandboxTerminals as Ir, GpuLeaseExecOptions as It, DurablePlan as J, BatchTaskUsage as Ji, SandboxEvent as Jn, SendSessionMessageOptions as Jr, IntelligenceReportWindow as Jt, DriverInfo as K, BatchEventDataMap as Ki, SandboxConnection as Kn, SecretInfo as Kr, IntelligenceReportCompareTo as Kt, DeleteOptions as L, TerminalReadyInfo as Li, RolloutChildResult as Ln, SandboxTraceBundle as Lr, GpuLeaseExecResult as Lt, CreateSandboxFleetTokenOptions as M, WriteFileOptions as Mi, ReconcileSandboxFleetsResult as Mn, SandboxTerminalCreateOptions as Mr, GitStatus as Mt, CreateSandboxFleetWithCoordinatorOptions as N, WriteManyFile as Ni, RenameOptions as Nn, SandboxTerminalInfo as Nr, GpuLease as Nt, CreateGpuLeaseOptions as O, UploadProgress as Oi, PublishPublicTemplateVersionOptions as On, SandboxResources as Or, GitBranch as Ot, CreateSandboxOptions as P, WriteManyOptions as Pi, RestoreSnapshotOptions as Pn, SandboxTerminalManager as Pr, GpuLeaseBilling as Pt, EventStreamOptions as Q, SandboxFleetDispatchFailureClass as Qn, SessionEventStreamOptions as Qr, ListSandboxFleetOptions as Qt, DevServerInfo as R, TerminalStream as Ri, RolloutOptions as Rn, SandboxTraceEvent as Rr, GpuLeaseManager as Rt, CodeExecutionOptions as S, TeePublicKeyResponse as Si, ProvisionResult as Sn, SandboxIdentity as Sr, FleetExecDispatchResult as St, CodeResultPart as T, TurnDriveResult as Ti, PublicTemplateInfo as Tn, SandboxPortBinding as Tr, FleetPromptDispatchResult as Tt, DownloadProgress as U, TerminalStreamToken as Ui, SSHCommandDescriptor as Un, ScopedTokenScope as Ur, InstalledTool as Ut, DispatchedSession as V, TerminalStreamHandlers as Vi, RolloutStatus as Vn, SandboxUser as Vr, HostAgentDriverConfig as Vt, DriveTurnOptions as W, BatchBackendStats as Wi, SSHCredentials as Wn, SearchMatch as Wr, IntelligenceReport as Wt, EgressPolicy as X, SandboxFleetArtifactSpec as Xn, SentSessionMessage as Xr, ListMessagesOptions as Xt, EgressManager as Y, SandboxFleetArtifact as Yn, SendSessionMessageRequest as Yr, JsonValue as Yt, EnsureDevServerOptions as Z, SandboxFleetCostEstimate as Zn, SessionBackendCredentials as Zr, ListOptions as Zt, BatchTask as _, TaskSessionProfile as _i, ProcessStatus as _n, SandboxFleetUsage as _r, FleetDispatchResultBufferOptions as _t, AttachSandboxFleetMachineOptions as a, SnapshotInfo as ai, NonHostAgentDriverConfig as an, SandboxFleetMachineMeteredUsage as ar, FileReadError as at, ChunkedUploadOptions as b, TeeAttestationResponse as bi, PromptResult as bn, SandboxFleetWorkspaceRestoreResult as br, FleetDriveTurnRequest as bt, BackendInfo as c, SshKeysManager as ci, PreviewLinkInfo as cn, SandboxFleetManifest as cr, FileSystem as ct, BackendType as d, StorageConfig as di, ProcessInfo as dn, SandboxFleetPolicy as dr, FileTreeResult as dt, SessionInfo as ei, McpServerConfig as en, SandboxFleetDriverCapability as er, ExecOptions as et, BatchBackend as f, SubscriptionInfo as fi, ProcessListOptions as fn, SandboxFleetToken as fr, FileUsageOptions as ft, BatchRunRequest as g, TaskSessionInfo as gi, ProcessSpawnOptions as gn, SandboxFleetTraceOptions as gr, FleetDispatchResultBuffer as gt, BatchRunOptions as h, TaskSessionFileChange as hi, ProcessSignal as hn, SandboxFleetTraceExport as hr, FleetDispatchCancelResult as ht, AttachGpuLeaseOptions as i, SessionStatus as ii, NetworkManager as in, SandboxFleetMachine as ir, FileReadBatchResult as it, CreateSandboxFleetOptions as j, WaitForRolloutOptions as ji, ReconcileSandboxFleetsOptions as jn, SandboxTerminalAttachOptions as jr, GitDiff as jt, CreateIntelligenceReportOptions as k, UsageInfo as ki, ReapExpiredSandboxFleetsOptions as kn, SandboxRuntimeHealth as kr, GitCommit as kt, BackendManager as l, StartupDiagnostics as li, PreviewLinkManager as ln, SandboxFleetManifestMachine as lr, FileTreeFile as lt, BatchResult as m, TaskSessionCommitResult as mi, ProcessManager as mn, SandboxFleetTraceEvent as mr, FileWriteResult as mt, AccessPolicyRule as n, SessionMessage as ni, MkdirOptions as nn, SandboxFleetInfo as nr, FileInfo as nt, BackendCapabilities as o, SnapshotOptions as oi, PermissionLevel as on, SandboxFleetMachineRecord as or, FileReadResult as ot, BatchOptions as p, TaskSessionChanges as pi, ProcessLogEntry as pn, SandboxFleetTraceBundle as pr, FileUsageResult as pt, DriverType as q, BatchSidecarGroup as qi, SandboxEnvironment as qn, SecretsManager as qr, IntelligenceReportSubjectType as qt, AddUserOptions as r, SessionMessageInputPart as ri, NetworkConfig as rn, SandboxFleetIntelligenceEnvelope as rr, FileReadBatchOptions as rt, BackendConfig as s, SnapshotResult as si, PermissionsManager as sn, SandboxFleetMachineSpec as sr, FileRenameResult as st, AcceleratorKind as t, SessionListOptions as ti, MintScopedTokenOptions as tn, SandboxFleetDriverTimings as tr, ExecResult as tt, BackendStatus as u, StartupOperation as ui, Process as un, SandboxFleetOperationsSummary as ur, FileTreeOptions as ut, BatchTaskResult as v, TeeAttestationOptions as vi, PromptInputPart as vn, SandboxFleetWorkspace as vr, FleetDispatchStreamOptions as vt, CodeLanguage as w, TokenUsage as wi, ProvisionStep as wn, SandboxIntelligenceEnvelope as wr, FleetPromptDispatchOptions as wt, ChunkedUploadResult as x, TeePublicKey as xi, ProvisionEvent as xn, SandboxFleetWorkspaceSnapshotResult as xr, FleetExecDispatchOptions as xt, BranchOptions as y, TeeAttestationReport as yi, PromptOptions as yn, SandboxFleetWorkspaceReconcileResult as yr, FleetDriveTurnOutcome as yt, DirectoryPermission as z, TerminalStreamAuthFormat as zi, RolloutScorer as zn, SandboxTraceExport as zr, GpuLeaseProviderName as zt };