@bctrl/sdk 1.0.3 → 1.0.5

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.
Files changed (57) hide show
  1. package/README.md +5 -8
  2. package/dist/account.d.ts +43 -0
  3. package/dist/account.js +100 -0
  4. package/dist/accountTypes.d.ts +126 -0
  5. package/dist/accountTypes.js +1 -0
  6. package/dist/aiProviderTypes.d.ts +58 -0
  7. package/dist/aiProviderTypes.js +1 -0
  8. package/dist/aiProviders.d.ts +13 -0
  9. package/dist/aiProviders.js +36 -0
  10. package/dist/bctrl.d.ts +35 -3
  11. package/dist/bctrl.js +74 -6
  12. package/dist/browserExtensionTypes.d.ts +45 -0
  13. package/dist/browserExtensionTypes.js +1 -0
  14. package/dist/browserExtensions.d.ts +14 -0
  15. package/dist/browserExtensions.js +53 -0
  16. package/dist/files.d.ts +6 -24
  17. package/dist/files.js +9 -56
  18. package/dist/help.d.ts +7 -0
  19. package/dist/help.js +9 -0
  20. package/dist/http.d.ts +12 -1
  21. package/dist/http.js +73 -10
  22. package/dist/index.d.ts +17 -6
  23. package/dist/index.js +15 -5
  24. package/dist/invocations.d.ts +85 -47
  25. package/dist/invocations.js +144 -102
  26. package/dist/node.d.ts +12 -0
  27. package/dist/node.js +11 -0
  28. package/dist/proxies.d.ts +21 -0
  29. package/dist/proxies.js +55 -0
  30. package/dist/proxyTypes.d.ts +114 -0
  31. package/dist/proxyTypes.js +1 -0
  32. package/dist/runs.d.ts +35 -31
  33. package/dist/runs.js +95 -38
  34. package/dist/runtimes.d.ts +26 -62
  35. package/dist/runtimes.js +65 -112
  36. package/dist/schemas.d.ts +7 -0
  37. package/dist/schemas.js +36 -0
  38. package/dist/spaces.d.ts +20 -32
  39. package/dist/spaces.js +48 -36
  40. package/dist/toolCallTypes.d.ts +41 -0
  41. package/dist/toolCallTypes.js +1 -0
  42. package/dist/toolCalls.d.ts +9 -0
  43. package/dist/toolCalls.js +16 -0
  44. package/dist/tools.d.ts +23 -0
  45. package/dist/tools.js +49 -0
  46. package/dist/toolsetTypes.d.ts +32 -0
  47. package/dist/toolsetTypes.js +1 -0
  48. package/dist/toolsets.d.ts +12 -0
  49. package/dist/toolsets.js +31 -0
  50. package/dist/types.d.ts +509 -186
  51. package/dist/utils.d.ts +2 -1
  52. package/dist/utils.js +28 -3
  53. package/dist/vault.d.ts +14 -0
  54. package/dist/vault.js +37 -0
  55. package/dist/vaultTypes.d.ts +73 -0
  56. package/dist/vaultTypes.js +1 -0
  57. package/package.json +8 -1
package/dist/types.d.ts CHANGED
@@ -3,6 +3,11 @@ export type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
3
3
  export type JsonObject = {
4
4
  [key: string]: JsonValue;
5
5
  };
6
+ export type { V1AccountUsage, V1ApiKey, V1ApiKeyCreateRequest, V1ApiKeyCreateResponse, V1ApiKeyDeleteResponse, V1ApiKeyListQuery, V1AuthScope, V1AuthWhoamiResponse, V1Plan, V1Subaccount, V1SubaccountArchiveResponse, V1SubaccountCreateRequest, V1SubaccountGetQuery, V1SubaccountLimits, V1SubaccountListQuery, V1SubaccountUpdateRequest, V1SubaccountUsage, V1SubaccountUsageListQuery, V1SubaccountUsageListResponse, } from './accountTypes.js';
7
+ export type { V1AiProvider, V1AiProviderCreateRequest, V1AiProviderDeleteResponse, V1AiProviderGetQuery, V1AiProviderListQuery, V1AiProviderModel, V1AiProviderProvider, V1AiProviderStatus, V1AiProviderTestResponse, V1AiProviderUpdateRequest, } from './aiProviderTypes.js';
8
+ export type { V1BrowserExtension, V1BrowserExtensionDeleteResponse, V1BrowserExtensionFormat, V1BrowserExtensionImportRequest, V1BrowserExtensionListQuery, V1BrowserExtensionSource, V1BrowserExtensionUpdateRequest, V1BrowserExtensionUploadRequest, } from './browserExtensionTypes.js';
9
+ export type { V1ToolCall, V1ToolCallActor, V1ToolCallListQuery, V1ToolCallStatus, V1ToolCallTool, } from './toolCallTypes.js';
10
+ export type { V1Toolset, V1ToolsetBuiltinName, V1ToolsetCreateRequest, V1ToolsetDeleteResponse, V1ToolsetListQuery, V1ToolsetUpdateRequest, } from './toolsetTypes.js';
6
11
  export interface V1ListEnvelope<T> {
7
12
  data: T[];
8
13
  nextCursor: string | null;
@@ -11,10 +16,100 @@ export interface V1PageQuery {
11
16
  cursor?: string;
12
17
  limit?: number;
13
18
  }
14
- export interface V1SpaceCreateRequest {
19
+ export type V1HelpAudience = 'api' | 'sdk' | 'cli';
20
+ export interface V1HelpRequest {
21
+ topic?: string;
22
+ audience?: V1HelpAudience;
23
+ }
24
+ export interface V1HelpField {
25
+ name: string;
26
+ type: string;
27
+ required?: boolean;
28
+ description?: string;
29
+ values?: string[];
30
+ }
31
+ export interface V1HelpFlag {
15
32
  name: string;
16
- region: string;
33
+ value?: string;
34
+ description: string;
35
+ }
36
+ export interface V1HelpIo {
37
+ fields: V1HelpField[];
38
+ }
39
+ export interface V1HelpApiOperation {
40
+ method: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
41
+ path: string;
42
+ operationId?: string;
43
+ requestFields?: string[];
44
+ responseFields?: string[];
45
+ }
46
+ export interface V1HelpSdkMethod {
47
+ language: string;
48
+ method: string;
49
+ package?: string;
50
+ }
51
+ export interface V1HelpCliCommand {
52
+ command: string;
53
+ usage: string;
54
+ flags?: V1HelpFlag[];
55
+ }
56
+ export interface V1HelpExample {
57
+ title?: string;
58
+ audience?: V1HelpAudience;
59
+ command?: string;
60
+ language?: string;
61
+ code?: string;
62
+ request?: JsonObject;
63
+ }
64
+ export interface V1HelpNextStep {
65
+ title?: string;
66
+ topic?: string;
67
+ audience?: V1HelpAudience;
68
+ method?: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
69
+ path?: string;
70
+ command?: string;
71
+ }
72
+ export interface V1HelpTopic {
73
+ topic: string;
74
+ aliases?: string[];
75
+ title: string;
76
+ summary: string;
77
+ audiences: V1HelpAudience[];
78
+ method?: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
79
+ path?: string;
80
+ operationId?: string;
81
+ }
82
+ export interface V1HelpOverviewResponse {
83
+ kind: 'overview';
84
+ audience?: V1HelpAudience;
85
+ summary: string;
86
+ topics: V1HelpTopic[];
87
+ examples?: V1HelpExample[];
88
+ next?: V1HelpNextStep[];
89
+ }
90
+ export interface V1HelpTopicResponse {
91
+ kind: 'topic';
92
+ topic: string;
93
+ aliases?: string[];
94
+ audience?: V1HelpAudience;
95
+ title?: string;
96
+ summary: string;
97
+ input?: V1HelpIo;
98
+ output?: V1HelpIo;
99
+ api?: V1HelpApiOperation;
100
+ sdk?: V1HelpSdkMethod[];
101
+ cli?: V1HelpCliCommand;
102
+ examples?: V1HelpExample[];
103
+ next?: V1HelpNextStep[];
104
+ }
105
+ export type V1HelpResponse = V1HelpOverviewResponse | V1HelpTopicResponse;
106
+ export interface V1SpaceListQuery extends V1PageQuery {
107
+ subaccountId?: string;
108
+ }
109
+ export interface V1SpaceCreateRequest {
110
+ name?: string;
17
111
  subaccountId?: string | null;
112
+ environment?: V1SpaceEnvironment;
18
113
  }
19
114
  export interface V1SpaceUpdateRequest {
20
115
  name?: string;
@@ -22,18 +117,45 @@ export interface V1SpaceUpdateRequest {
22
117
  export interface V1Space {
23
118
  id: string;
24
119
  name: string;
25
- region: string;
26
- subaccountId?: string | null;
120
+ subaccountId?: string;
27
121
  createdAt: string;
28
122
  updatedAt: string;
29
123
  }
124
+ export interface V1SpaceDeleteResponse {
125
+ id: string;
126
+ deleted: true;
127
+ }
128
+ export interface V1SpaceStorageMount {
129
+ namespace: string;
130
+ }
131
+ export interface V1SpaceVaultMount {
132
+ allow?: string[];
133
+ deny?: string[];
134
+ allowRawReads?: boolean;
135
+ }
136
+ export interface V1SpaceAiMount {
137
+ aiProviderIds?: string[];
138
+ defaults?: {
139
+ stagehand?: string;
140
+ browserUse?: string;
141
+ };
142
+ }
30
143
  export interface V1SpaceEnvironment {
31
- spaceId: string;
32
- mounts: JsonObject;
33
- updatedAt: string;
144
+ storage?: V1SpaceStorageMount;
145
+ vault?: V1SpaceVaultMount;
146
+ ai?: V1SpaceAiMount;
147
+ }
148
+ export interface V1SpaceAiMountUpdate {
149
+ aiProviderIds?: string[] | null;
150
+ defaults?: {
151
+ stagehand?: string | null;
152
+ browserUse?: string | null;
153
+ } | null;
34
154
  }
35
155
  export interface V1SpaceEnvironmentUpdateRequest {
36
- mounts: JsonObject;
156
+ storage?: V1SpaceStorageMount | null;
157
+ vault?: V1SpaceVaultMount | null;
158
+ ai?: V1SpaceAiMountUpdate | null;
37
159
  }
38
160
  export type V1RuntimeType = 'browser';
39
161
  export type V1RuntimeStatus = 'active' | 'stopped' | 'failed';
@@ -54,22 +176,31 @@ export interface V1RuntimeFingerprintCreateConfig {
54
176
  browser?: string;
55
177
  locale?: string;
56
178
  }
57
- export interface V1RuntimeLifecycleConfig {
58
- idleTimeoutMinutes?: number;
179
+ export type V1BrowserNetworkTrafficSaver = 'none' | 'light' | 'medium' | 'high';
180
+ export type V1BrowserNetworkTrafficResourceType = 'media' | 'texttrack' | 'font' | 'image' | 'ping' | 'prefetch' | 'beacon';
181
+ export interface V1BrowserNetworkTrafficConfig {
182
+ saver?: V1BrowserNetworkTrafficSaver;
183
+ blockAds?: boolean;
184
+ blockTrackers?: boolean;
185
+ blockResourceTypes?: V1BrowserNetworkTrafficResourceType[];
186
+ urlAllowlist?: string[];
187
+ urlBlocklist?: string[];
59
188
  }
60
189
  export interface V1BrowserRuntimeCreateConfig {
61
- browser?: {
62
- profile?: boolean;
63
- };
190
+ profile?: boolean;
64
191
  stealth?: V1BrowserStealth;
65
192
  proxy?: V1ProxyInput | null;
66
193
  fingerprint?: V1RuntimeFingerprintCreateConfig;
67
- extensions?: string[];
68
- lifecycle?: V1RuntimeLifecycleConfig;
194
+ extensionIds?: string[];
195
+ idleTimeoutMinutes?: number;
196
+ webRtcProxyOnly?: boolean;
197
+ forceOpenShadowRoots?: boolean;
198
+ networkTraffic?: V1BrowserNetworkTrafficConfig;
69
199
  }
70
200
  export interface V1RuntimeCreateRequest {
71
- spaceId: string;
72
- type: V1RuntimeType;
201
+ spaceId?: string;
202
+ /** Optional; defaults to `'browser'` server-side. Only `'browser'` is accepted today. */
203
+ type?: V1RuntimeType;
73
204
  name?: string;
74
205
  metadata?: JsonObject;
75
206
  config?: V1BrowserRuntimeCreateConfig;
@@ -77,60 +208,88 @@ export interface V1RuntimeCreateRequest {
77
208
  export type V1SpaceRuntimeCreateRequest = Omit<V1RuntimeCreateRequest, 'spaceId'>;
78
209
  export interface V1RuntimeListQuery {
79
210
  spaceId?: string;
80
- status?: string | string[];
211
+ status?: V1RuntimeStatus | V1RuntimeStatus[];
212
+ cursor?: string;
81
213
  limit?: number;
82
214
  }
83
215
  export interface V1RuntimeSummary {
84
216
  id: string;
217
+ spaceId: string;
85
218
  name: string;
86
219
  type: V1RuntimeType;
87
220
  status: V1RuntimeStatus;
88
221
  activeRunId: string | null;
222
+ lastActivityAt?: string;
89
223
  createdAt: string;
90
224
  updatedAt: string;
91
225
  }
226
+ /** Saved-resource reference for a proxy attached to a runtime (response side). */
227
+ export interface V1RuntimeProxyRef {
228
+ id: string;
229
+ type: 'custom' | 'managed-rotating' | 'managed-static';
230
+ name: string;
231
+ }
232
+ /** Resolved fingerprint reported on a runtime's config (response side). */
233
+ export interface V1RuntimeFingerprint {
234
+ userAgent?: string;
235
+ locale?: string;
236
+ timezone?: string;
237
+ viewport?: {
238
+ width: number;
239
+ height: number;
240
+ };
241
+ browser?: string;
242
+ }
243
+ /**
244
+ * Type-specific browser runtime config returned on the runtime resource. No open
245
+ * JSON fallback arm — only the documented browser knobs are surfaced.
246
+ */
247
+ export interface V1BrowserRuntimeConfig {
248
+ profile: boolean;
249
+ stealth?: V1BrowserStealth;
250
+ proxy?: V1RuntimeProxyRef | null;
251
+ fingerprint?: V1RuntimeFingerprint;
252
+ extensionIds?: string[];
253
+ idleTimeoutMinutes?: number;
254
+ webRtcProxyOnly?: boolean;
255
+ forceOpenShadowRoots?: boolean;
256
+ networkTraffic?: V1BrowserNetworkTrafficConfig;
257
+ }
92
258
  export interface V1Runtime extends V1RuntimeSummary {
93
- config?: JsonObject;
259
+ config?: V1BrowserRuntimeConfig;
94
260
  metadata?: JsonObject | null;
95
261
  }
96
- export type V1ConnectionProtocol = 'cdp' | 'cua' | 'rdp' | 'vnc' | 'mcp' | 'http';
97
- export type V1ConnectionEndpoint = {
98
- type: 'websocket';
99
- url: string;
100
- } | {
101
- type: 'http';
102
- baseUrl: string;
103
- } | {
104
- type: 'rdp';
105
- host: string;
106
- port: number;
107
- username: string;
108
- password: string;
109
- } | {
110
- type: 'composite';
111
- endpoints: Record<string, string>;
112
- };
113
- export interface V1RuntimeConnectionCreateRequest {
114
- protocol: 'cdp';
115
- options?: JsonObject;
116
- }
117
- export type V1RuntimeConnectionCreateOptions = Partial<V1RuntimeConnectionCreateRequest>;
118
- export interface V1RuntimeConnection {
262
+ export interface V1RuntimeStartRuntime {
119
263
  id: string;
120
- protocol: V1ConnectionProtocol;
121
- status: string;
122
- runId: string;
123
- createdAt: string;
124
- expiresAt: string | null;
125
- closedAt?: string | null;
126
- revokedAt?: string | null;
264
+ spaceId: string;
265
+ name: string;
266
+ type: V1RuntimeType;
267
+ status: V1RuntimeStatus;
127
268
  }
128
- export interface V1RuntimeConnectionCreateResponse extends V1RuntimeConnection {
129
- endpoint: V1ConnectionEndpoint;
269
+ export interface V1RuntimeStartRun extends V1RunSummary {
270
+ durationMs?: number | null;
271
+ failureReason?: string | null;
130
272
  }
273
+ export type V1ConnectionProtocol = 'cdp';
131
274
  export interface V1RuntimeStartResponse {
132
- runtime: V1Runtime;
133
- run: V1Run;
275
+ runtimeId: string;
276
+ runId: string;
277
+ status: V1RuntimeStatus;
278
+ /**
279
+ * The minted public, credentialed, run-scoped connect endpoint — the product's
280
+ * entry point. Protocol-neutral (see `protocol`). A start ALWAYS mints a fresh
281
+ * connection, so this is required (unlike the optional field on the runtime
282
+ * detail). The connection is run-lifetime, so no expiry is surfaced.
283
+ */
284
+ connectUrl: string;
285
+ protocol: V1ConnectionProtocol;
286
+ started: boolean;
287
+ }
288
+ export interface V1RuntimeStopResponse {
289
+ runtimeId: string;
290
+ runId: string | null;
291
+ status: V1RuntimeStatus;
292
+ stopped: boolean;
134
293
  }
135
294
  export interface V1RunListQuery extends V1PageQuery {
136
295
  status?: string | string[];
@@ -150,39 +309,31 @@ export interface V1Run extends V1RunSummary {
150
309
  runtimeId: string;
151
310
  runtimeType: string;
152
311
  durationMs?: number | null;
153
- lastSeenAt?: string | null;
154
- endedReason?: string | null;
155
312
  failureReason?: string | null;
156
313
  }
314
+ export type V1RunUsageBillingStatus = 'pending' | 'settled' | 'unavailable';
157
315
  export interface V1RunUsage {
158
316
  runId: string;
159
317
  runtimeId: string;
160
318
  runtimeType: string;
161
319
  status: string;
162
320
  computedAt: string;
163
- usage: {
164
- runtime: {
165
- seconds: number | null;
166
- billingClass: string | null;
167
- };
321
+ creditsUsed: number | null;
322
+ billingStatus: V1RunUsageBillingStatus;
323
+ runtimeSeconds: number | null;
324
+ proxyBytes: number | null;
325
+ aiTokensTotal: number | null;
326
+ captchaSolves: number;
327
+ invocations: number;
328
+ toolCalls: number;
329
+ filesCount: number;
330
+ filesBytes: number;
331
+ breakdown: {
168
332
  aiTokens: {
169
333
  input: number | null;
170
334
  output: number | null;
171
- total: number | null;
172
335
  };
173
- proxyBytes: number | null;
174
- captchaSolves: number;
175
- files: {
176
- count: number;
177
- bytes: number;
178
- };
179
- invocations: number;
180
- toolCalls: number;
181
- };
182
- billing: {
183
- status: 'pending' | 'settled' | 'unavailable';
184
- creditCost: number | null;
185
- breakdown: {
336
+ credits: {
186
337
  runtime: number | null;
187
338
  ai: number | null;
188
339
  proxy: number | null;
@@ -191,46 +342,52 @@ export interface V1RunUsage {
191
342
  };
192
343
  };
193
344
  }
345
+ export type V1RunEventType = 'runtime.lifecycle' | 'navigation' | 'network.request' | 'network.response' | 'network.failed' | 'console.message';
346
+ export type V1RunEventStatus = 'started' | 'stopped' | 'failed' | 'finished' | 'received';
194
347
  export interface V1RunEvent {
195
348
  id: string;
196
- runId: string;
197
- runtimeId: string;
198
- runtimeType: string;
199
- type: string;
200
- category: string;
201
349
  time: string;
202
- status?: string;
203
- connectionId?: string;
204
- commandId?: string;
205
- invocationId?: string;
206
- toolCallId?: string;
207
- fileId?: string;
350
+ type: V1RunEventType;
351
+ status?: V1RunEventStatus;
352
+ durationMs?: number;
353
+ pageId?: string;
354
+ contextId?: string;
208
355
  name?: string;
209
356
  data?: JsonObject;
210
357
  }
211
358
  export interface V1RunEventsListQuery extends V1PageQuery {
212
359
  type?: string | string[];
213
- category?: string | string[];
214
- connectionId?: string;
360
+ status?: string | string[];
361
+ pageId?: string;
362
+ contextId?: string;
215
363
  }
216
- export interface V1RunEventsWaitRequest {
217
- cursor?: string;
218
- timeoutMs?: number;
219
- type?: string[];
220
- category?: string[];
221
- connectionId?: string;
364
+ export type V1RunActivityCategory = 'runtime' | 'browser' | 'network' | 'console' | 'file' | 'invocation' | 'tool' | 'captcha' | 'agent' | 'llm' | 'system';
365
+ export type V1RunActivitySeverity = 'info' | 'warning' | 'error';
366
+ export interface V1RunActivityLinks {
367
+ invocationId?: string;
368
+ toolCallId?: string;
369
+ fileId?: string;
222
370
  }
223
- export interface V1RunEventsWaitResponse {
224
- data: V1RunEvent | null;
225
- cursor: string | null;
226
- timedOut: boolean;
371
+ export interface V1RunActivityItem {
372
+ id: string;
373
+ type: string;
374
+ category: V1RunActivityCategory;
375
+ message: string;
376
+ time: string;
377
+ status?: string;
378
+ severity?: V1RunActivitySeverity;
379
+ durationMs?: number;
380
+ parentId?: string;
381
+ data?: JsonObject;
382
+ links?: V1RunActivityLinks;
383
+ children?: V1RunActivityItem[];
227
384
  }
228
- export type V1RunCommand = V1RunEvent & {
229
- category: 'command';
230
- };
231
- export interface V1RunCommandsListQuery extends V1PageQuery {
385
+ export interface V1RunActivityListQuery extends V1PageQuery {
232
386
  type?: string | string[];
233
- connectionId?: string;
387
+ category?: V1RunActivityCategory | V1RunActivityCategory[];
388
+ severity?: V1RunActivitySeverity | V1RunActivitySeverity[];
389
+ invocationId?: string;
390
+ fileId?: string;
234
391
  }
235
392
  export interface V1RunLiveRequest {
236
393
  control?: string;
@@ -249,117 +406,182 @@ export interface V1RunRecordingResponse {
249
406
  durationMs?: number;
250
407
  expiresAt: string;
251
408
  }
409
+ export type V1InvocationAction = 'act' | 'observe' | 'extract' | 'browserUse' | 'stagehandAgent' | 'solveCaptcha';
410
+ export type V1InvocationPage = 'active' | 'new';
411
+ export type V1InvocationErrorCode = 'invocation.failed' | 'invocation.cancelled' | 'invocation.timed_out' | 'invocation.dispatch_preparation_failed' | 'invocation.dispatch_unavailable' | 'invocation.target_create_failed' | 'invocation.captcha_solve_failed' | 'invocation.output_validation_failed' | 'invocation.stagehand_failed' | 'invocation.stagehand_incomplete' | 'invocation.browser_use_failed' | 'invocation.browser_use_interrupted' | 'invocation.browser_use_incomplete';
412
+ export interface V1InvocationError {
413
+ code: V1InvocationErrorCode;
414
+ message: string;
415
+ details?: JsonObject;
416
+ }
252
417
  export interface V1Invocation {
253
418
  id: string;
254
419
  runId: string;
255
- spaceId: string;
256
420
  runtimeId: string;
257
- runtimeType: string;
258
- type: string;
421
+ action: V1InvocationAction;
259
422
  status: string;
260
- result?: JsonValue | null;
261
- error?: JsonObject | null;
262
- progress?: JsonObject | null;
263
- artifactCount: number;
423
+ output?: JsonValue;
424
+ error?: V1InvocationError | null;
264
425
  createdAt: string;
265
426
  startedAt?: string | null;
266
427
  finishedAt?: string | null;
267
428
  durationMs?: number | null;
268
- metadata?: JsonObject | null;
269
- }
270
- export interface V1InvocationResponse {
271
- data: V1Invocation;
272
429
  }
430
+ export type V1InvocationResponse = V1Invocation;
273
431
  export interface V1InvocationWaitRequest {
274
432
  timeoutMs?: number;
275
433
  }
276
- export interface V1InvocationWaitResponse {
277
- data: V1Invocation;
278
- timedOut: boolean;
434
+ export interface V1InvocationWaitResponse extends V1Invocation {
435
+ waitStatus: 'completed' | 'timeout';
436
+ retryAfterMs?: number;
279
437
  }
280
- export type V1RuntimeInvocationFileInput = {
281
- storagePath: string;
282
- name?: string;
283
- } | {
438
+ export interface V1InvocationSummary {
439
+ id: string;
440
+ runId: string;
441
+ runtimeId: string;
442
+ action: V1InvocationAction;
443
+ status: string;
444
+ createdAt: string;
445
+ finishedAt?: string | null;
446
+ durationMs?: number | null;
447
+ error?: V1InvocationError | null;
448
+ }
449
+ export interface V1RunInvocationsListQuery {
450
+ cursor?: string;
451
+ limit?: number;
452
+ status?: string | string[];
453
+ action?: V1InvocationAction | V1InvocationAction[];
454
+ }
455
+ export interface V1RuntimeInvocationFileInput {
284
456
  fileId: string;
457
+ runtimePath?: string;
285
458
  name?: string;
286
- };
459
+ }
287
460
  interface V1RuntimeInvocationAgentFields {
288
- target?: JsonObject;
289
- idempotencyKey?: string;
461
+ page?: V1InvocationPage;
290
462
  outputSchema?: JsonObject;
291
463
  toolsetId?: string;
464
+ toolIds?: string[];
292
465
  metadata?: JsonObject;
293
466
  files?: V1RuntimeInvocationFileInput[];
467
+ timeoutMs?: number;
468
+ }
469
+ interface V1RuntimeInvocationAiSelectionFields {
470
+ aiProviderId?: string;
471
+ model?: string;
472
+ temperature?: number;
294
473
  }
295
474
  export type V1RuntimeInvocationCreateRequest = {
296
- provider: 'stagehand';
297
- method: 'act' | 'observe';
298
- target?: JsonObject;
299
- input: JsonObject;
300
- idempotencyKey?: string;
475
+ action: 'act';
476
+ page?: V1InvocationPage;
477
+ instruction: string;
478
+ stagehandAction?: JsonObject;
479
+ timeoutMs?: number;
480
+ aiProviderId?: string;
481
+ model?: string;
482
+ temperature?: number;
483
+ metadata?: JsonObject;
484
+ } | {
485
+ action: 'act';
486
+ page?: V1InvocationPage;
487
+ stagehandAction: JsonObject;
488
+ instruction?: string;
489
+ timeoutMs?: number;
490
+ aiProviderId?: string;
491
+ model?: string;
492
+ temperature?: number;
493
+ metadata?: JsonObject;
494
+ } | {
495
+ action: 'observe';
496
+ page?: V1InvocationPage;
497
+ instruction: string;
498
+ selector?: string;
499
+ timeoutMs?: number;
500
+ aiProviderId?: string;
501
+ model?: string;
502
+ temperature?: number;
301
503
  metadata?: JsonObject;
302
504
  } | {
303
- provider: 'stagehand';
304
- method: 'extract';
305
- target?: JsonObject;
306
- input?: JsonObject;
505
+ action: 'extract';
506
+ page?: V1InvocationPage;
507
+ instruction?: string;
508
+ selector?: string;
307
509
  outputSchema?: JsonObject;
308
- idempotencyKey?: string;
510
+ timeoutMs?: number;
511
+ aiProviderId?: string;
512
+ model?: string;
513
+ temperature?: number;
309
514
  metadata?: JsonObject;
310
- } | (V1RuntimeInvocationAgentFields & {
311
- provider: 'stagehand';
312
- method: 'agent';
313
- input: JsonObject;
314
- config?: JsonObject;
315
- options?: JsonObject;
316
- }) | (V1RuntimeInvocationAgentFields & {
317
- provider: 'browserUse';
318
- method: 'agent';
319
- input: JsonObject;
320
- config?: JsonObject;
321
- options?: JsonObject;
515
+ } | (V1RuntimeInvocationAgentFields & V1RuntimeInvocationAiSelectionFields & {
516
+ action: 'stagehandAgent';
517
+ instruction: string;
518
+ maxSteps?: number;
519
+ variables?: JsonObject;
520
+ executionAiProviderId?: string;
521
+ systemPrompt?: string;
522
+ highlightCursor?: boolean;
523
+ }) | (V1RuntimeInvocationAgentFields & V1RuntimeInvocationAiSelectionFields & {
524
+ action: 'browserUse';
525
+ instruction: string;
526
+ maxSteps?: number;
527
+ extractionAiProviderId?: string;
528
+ fallbackAiProviderId?: string;
529
+ useVision?: boolean | 'auto';
530
+ visionDetailLevel?: 'low' | 'high' | 'auto';
531
+ flashMode?: boolean;
532
+ enablePlanning?: boolean;
533
+ maxFailures?: number;
534
+ stepTimeoutMs?: number;
535
+ maxActionsPerStep?: number;
536
+ maxHistoryItems?: number | null;
537
+ useThinking?: boolean;
538
+ directlyOpenUrl?: boolean;
539
+ includeAttributes?: string[];
540
+ overrideSystemMessage?: string;
541
+ extendSystemMessage?: string;
542
+ sensitiveData?: Record<string, string | Record<string, string>>;
322
543
  }) | {
323
- provider: 'bctrl';
324
- method: 'solveCaptcha';
325
- target?: JsonObject;
326
- input?: JsonObject;
327
- idempotencyKey?: string;
544
+ action: 'solveCaptcha';
545
+ page?: 'active';
546
+ timeoutMs?: number;
328
547
  metadata?: JsonObject;
329
548
  };
330
549
  export interface V1File {
331
550
  id: string;
332
- type: string;
333
- source: 'upload' | 'runtime' | 'system';
551
+ source: 'upload' | 'runtime';
334
552
  name: string;
335
553
  path: string;
336
554
  contentType: string;
337
555
  sizeBytes: number;
338
- spaceId?: string;
339
- runtimeId?: string | null;
340
- runId?: string | null;
341
- metadata?: JsonObject | null;
342
556
  createdAt: string;
343
- expiresAt?: string | null;
344
- downloadUrl?: string;
557
+ spaceId: string;
558
+ downloadUrl: string;
559
+ runId?: string;
560
+ runtimeId?: string;
561
+ type?: string;
562
+ metadata?: JsonObject | null;
563
+ expiresAt?: string;
345
564
  }
346
565
  export interface V1FilesListQuery extends V1PageQuery {
347
- spaceId: string;
348
- source?: 'upload' | 'runtime' | 'system';
566
+ spaceId?: string;
567
+ source?: 'upload' | 'runtime';
568
+ type?: string | string[];
569
+ runId?: string;
570
+ runtimeId?: string;
349
571
  path?: string;
350
572
  prefix?: string;
351
- query?: string;
352
- contentType?: string;
573
+ q?: string;
353
574
  }
354
575
  export interface V1FileUpdateRequest {
355
576
  name?: string;
356
577
  metadata?: JsonObject | null;
357
578
  }
358
579
  export interface V1FileDeleteResponse {
359
- success: true;
580
+ id: string;
581
+ deleted: true;
360
582
  }
361
583
  export interface V1FileUploadRequest {
362
- spaceId: string;
584
+ spaceId?: string;
363
585
  file: Blob;
364
586
  name?: string;
365
587
  path?: string;
@@ -368,20 +590,18 @@ export interface V1FileUploadRequest {
368
590
  export interface V1RunFilesListQuery extends V1PageQuery {
369
591
  type?: string | string[];
370
592
  }
371
- export interface V1RunFilesExportRequest {
372
- format: 'zip';
373
- name: string;
374
- filter?: {
375
- type?: string[];
376
- };
593
+ export interface V1RuntimeFilesListQuery extends V1PageQuery {
594
+ type?: string | string[];
377
595
  }
378
- export type V1RuntimeFileStageRequest = {
379
- storagePath: string;
596
+ export interface V1RunFilesExportRequest {
380
597
  name?: string;
381
- } | {
598
+ type?: string[];
599
+ }
600
+ export interface V1RuntimeFileStageRequest {
382
601
  fileId: string;
602
+ runtimePath?: string;
383
603
  name?: string;
384
- };
604
+ }
385
605
  export interface V1RuntimeStagedFile {
386
606
  id: string;
387
607
  runtimeId: string;
@@ -393,21 +613,124 @@ export interface V1RuntimeStagedFile {
393
613
  export interface V1RuntimeFileUploadRequest {
394
614
  file: Blob;
395
615
  name?: string;
396
- storagePath?: string;
616
+ /** Durable BCTRL storage destination. */
617
+ destinationPath?: string;
618
+ runtimePath?: string;
397
619
  metadata?: JsonObject;
398
620
  }
399
- export interface V1RuntimeFileUploadResponse {
400
- file: V1File;
401
- staged: V1RuntimeStagedFile;
402
- }
403
621
  export interface V1RuntimeFileCollectRequest {
404
- path: string;
405
- storagePath?: string;
622
+ runtimePath: string;
623
+ /** Durable BCTRL storage destination. */
624
+ destinationPath?: string;
406
625
  name?: string;
407
- artifact?: {
408
- kind?: string;
409
- name?: string;
410
- metadata?: JsonObject;
626
+ type?: string;
627
+ metadata?: JsonObject;
628
+ }
629
+ export type { V1ManagedRotatingDevice, V1ManagedRotatingPreference, V1ManagedRotatingProxyConfig, V1ManagedRotatingRotation, V1Proxy, V1ProxyBase, V1ProxyCreateRequest, V1ProxyDeleteResponse, V1ProxyListQuery, V1ProxyPool, V1ProxyPoolListQuery, V1ProxyProtocol, V1ProxyTestResponse, V1ProxyType, V1ProxyUpdateRequest, } from './proxyTypes.js';
630
+ export type { V1VaultSecret, V1VaultSecretDeleteResponse, V1VaultSecretListQuery, V1VaultSecretPatchRequest, V1VaultSecretType, V1VaultSecretUpsertRequest, V1VaultSecretValue, V1VaultTotpResponse, } from './vaultTypes.js';
631
+ export type V1ToolExecutionType = 'webhook' | 'mcp_tool' | 'hosted_function' | 'hosted_workflow' | 'bctrl_builtin';
632
+ export type V1ToolExecution = {
633
+ type: 'webhook';
634
+ url: string;
635
+ auth?: {
636
+ type: 'none';
637
+ } | {
638
+ type: 'hmac';
639
+ secretId: string;
411
640
  };
641
+ timeoutMs?: number;
642
+ } | {
643
+ type: 'hosted_function';
644
+ functionVersionId: string;
645
+ functionId?: string;
646
+ } | {
647
+ type: 'mcp_tool';
648
+ serverId: string;
649
+ toolName: string;
650
+ } | {
651
+ type: 'hosted_workflow';
652
+ workflowId: string;
653
+ } | {
654
+ type: 'bctrl_builtin';
655
+ name: 'files' | 'vault' | 'captcha';
656
+ };
657
+ export type V1ToolType = 'webhook' | 'hosted' | 'mcp' | 'workflow' | 'builtin';
658
+ export interface V1ToolBase {
659
+ id: string;
660
+ spaceId: string | null;
661
+ name: string;
662
+ description: string | null;
663
+ inputSchema: JsonObject;
664
+ outputSchema: JsonObject;
665
+ status: 'enabled' | 'disabled';
666
+ metadata?: JsonObject | null;
667
+ createdAt: string;
668
+ updatedAt: string;
669
+ }
670
+ export type V1Tool = (V1ToolBase & {
671
+ type: 'webhook';
672
+ url: string;
673
+ authSecretId?: string;
674
+ timeoutMs?: number;
675
+ }) | (V1ToolBase & {
676
+ type: 'hosted';
677
+ currentVersionId: string | null;
678
+ }) | (V1ToolBase & {
679
+ type: 'mcp';
680
+ serverId: string;
681
+ toolName: string;
682
+ }) | (V1ToolBase & {
683
+ type: 'workflow';
684
+ workflowId: string;
685
+ }) | (V1ToolBase & {
686
+ type: 'builtin';
687
+ builtin: 'files' | 'vault' | 'captcha';
688
+ });
689
+ interface V1ToolBaseCreateRequest {
690
+ spaceId?: string;
691
+ name: string;
692
+ description?: string | null;
693
+ inputSchema?: JsonObject;
694
+ outputSchema?: JsonObject;
695
+ status?: 'enabled' | 'disabled';
696
+ metadata?: JsonObject | null;
697
+ }
698
+ export type V1ToolCreateRequest = (V1ToolBaseCreateRequest & {
699
+ type: 'webhook';
700
+ url: string;
701
+ authSecretId?: string;
702
+ timeoutMs?: number;
703
+ }) | (V1ToolBaseCreateRequest & {
704
+ type: 'hosted';
705
+ source: string;
706
+ timeoutMs?: number;
707
+ env?: Record<string, string>;
708
+ });
709
+ export interface V1ToolUpdateRequest {
710
+ name?: string;
711
+ description?: string | null;
712
+ inputSchema?: JsonObject;
713
+ outputSchema?: JsonObject;
714
+ status?: 'enabled' | 'disabled';
715
+ timeoutMs?: number;
716
+ authSecretId?: string | null;
717
+ metadata?: JsonObject | null;
718
+ }
719
+ export interface V1ToolVersion {
720
+ id: string;
721
+ toolId: string;
722
+ version: number;
723
+ source: string;
724
+ timeoutMs: number;
725
+ envKeys: string[];
726
+ metadata?: JsonObject | null;
727
+ current: boolean;
728
+ createdAt: string;
729
+ }
730
+ export interface V1ToolVersionCreateRequest {
731
+ source: string;
732
+ timeoutMs?: number;
733
+ env?: Record<string, string>;
734
+ metadata?: JsonObject | null;
735
+ promote?: boolean;
412
736
  }
413
- export {};