@bctrl/sdk 1.0.4 → 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 +0 -1
  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 -42
  35. package/dist/runtimes.js +64 -65
  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 +499 -155
  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 +21 -12
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,19 +176,31 @@ export interface V1RuntimeFingerprintCreateConfig {
54
176
  browser?: string;
55
177
  locale?: string;
56
178
  }
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[];
188
+ }
57
189
  export interface V1BrowserRuntimeCreateConfig {
58
190
  profile?: boolean;
59
191
  stealth?: V1BrowserStealth;
60
192
  proxy?: V1ProxyInput | null;
61
193
  fingerprint?: V1RuntimeFingerprintCreateConfig;
62
- extensions?: string[];
194
+ extensionIds?: string[];
63
195
  idleTimeoutMinutes?: number;
64
196
  webRtcProxyOnly?: boolean;
65
197
  forceOpenShadowRoots?: boolean;
198
+ networkTraffic?: V1BrowserNetworkTrafficConfig;
66
199
  }
67
200
  export interface V1RuntimeCreateRequest {
68
- spaceId: string;
69
- type: V1RuntimeType;
201
+ spaceId?: string;
202
+ /** Optional; defaults to `'browser'` server-side. Only `'browser'` is accepted today. */
203
+ type?: V1RuntimeType;
70
204
  name?: string;
71
205
  metadata?: JsonObject;
72
206
  config?: V1BrowserRuntimeCreateConfig;
@@ -74,42 +208,88 @@ export interface V1RuntimeCreateRequest {
74
208
  export type V1SpaceRuntimeCreateRequest = Omit<V1RuntimeCreateRequest, 'spaceId'>;
75
209
  export interface V1RuntimeListQuery {
76
210
  spaceId?: string;
77
- status?: string | string[];
211
+ status?: V1RuntimeStatus | V1RuntimeStatus[];
212
+ cursor?: string;
78
213
  limit?: number;
79
214
  }
80
215
  export interface V1RuntimeSummary {
81
216
  id: string;
217
+ spaceId: string;
82
218
  name: string;
83
219
  type: V1RuntimeType;
84
220
  status: V1RuntimeStatus;
85
221
  activeRunId: string | null;
222
+ lastActivityAt?: string;
86
223
  createdAt: string;
87
224
  updatedAt: string;
88
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
+ }
89
258
  export interface V1Runtime extends V1RuntimeSummary {
90
- config?: JsonObject;
259
+ config?: V1BrowserRuntimeConfig;
91
260
  metadata?: JsonObject | null;
92
261
  }
93
262
  export interface V1RuntimeStartRuntime {
94
263
  id: string;
264
+ spaceId: string;
95
265
  name: string;
96
266
  type: V1RuntimeType;
97
267
  status: V1RuntimeStatus;
98
268
  }
99
269
  export interface V1RuntimeStartRun extends V1RunSummary {
100
270
  durationMs?: number | null;
101
- lastSeenAt?: string | null;
102
- endedReason?: string | null;
103
271
  failureReason?: string | null;
104
272
  }
105
- export interface V1RuntimeStartBrowser {
106
- cdpUrl: string;
107
- connectionId: string;
108
- }
273
+ export type V1ConnectionProtocol = 'cdp';
109
274
  export interface V1RuntimeStartResponse {
110
- runtime: V1RuntimeStartRuntime;
111
- run: V1RuntimeStartRun;
112
- browser: V1RuntimeStartBrowser;
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;
113
293
  }
114
294
  export interface V1RunListQuery extends V1PageQuery {
115
295
  status?: string | string[];
@@ -129,39 +309,31 @@ export interface V1Run extends V1RunSummary {
129
309
  runtimeId: string;
130
310
  runtimeType: string;
131
311
  durationMs?: number | null;
132
- lastSeenAt?: string | null;
133
- endedReason?: string | null;
134
312
  failureReason?: string | null;
135
313
  }
314
+ export type V1RunUsageBillingStatus = 'pending' | 'settled' | 'unavailable';
136
315
  export interface V1RunUsage {
137
316
  runId: string;
138
317
  runtimeId: string;
139
318
  runtimeType: string;
140
319
  status: string;
141
320
  computedAt: string;
142
- usage: {
143
- runtime: {
144
- seconds: number | null;
145
- billingClass: string | null;
146
- };
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: {
147
332
  aiTokens: {
148
333
  input: number | null;
149
334
  output: number | null;
150
- total: number | null;
151
- };
152
- proxyBytes: number | null;
153
- captchaSolves: number;
154
- files: {
155
- count: number;
156
- bytes: number;
157
335
  };
158
- invocations: number;
159
- toolCalls: number;
160
- };
161
- billing: {
162
- status: 'pending' | 'settled' | 'unavailable';
163
- creditCost: number | null;
164
- breakdown: {
336
+ credits: {
165
337
  runtime: number | null;
166
338
  ai: number | null;
167
339
  proxy: number | null;
@@ -170,46 +342,52 @@ export interface V1RunUsage {
170
342
  };
171
343
  };
172
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';
173
347
  export interface V1RunEvent {
174
348
  id: string;
175
- runId: string;
176
- runtimeId: string;
177
- runtimeType: string;
178
- type: string;
179
- category: string;
180
349
  time: string;
181
- status?: string;
182
- connectionId?: string;
183
- commandId?: string;
184
- invocationId?: string;
185
- toolCallId?: string;
186
- fileId?: string;
350
+ type: V1RunEventType;
351
+ status?: V1RunEventStatus;
352
+ durationMs?: number;
353
+ pageId?: string;
354
+ contextId?: string;
187
355
  name?: string;
188
356
  data?: JsonObject;
189
357
  }
190
358
  export interface V1RunEventsListQuery extends V1PageQuery {
191
359
  type?: string | string[];
192
- category?: string | string[];
193
- connectionId?: string;
360
+ status?: string | string[];
361
+ pageId?: string;
362
+ contextId?: string;
194
363
  }
195
- export interface V1RunEventsWaitRequest {
196
- cursor?: string;
197
- timeoutMs?: number;
198
- type?: string[];
199
- category?: string[];
200
- 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;
201
370
  }
202
- export interface V1RunEventsWaitResponse {
203
- data: V1RunEvent | null;
204
- cursor: string | null;
205
- 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[];
206
384
  }
207
- export type V1RunCommand = V1RunEvent & {
208
- category: 'command';
209
- };
210
- export interface V1RunCommandsListQuery extends V1PageQuery {
385
+ export interface V1RunActivityListQuery extends V1PageQuery {
211
386
  type?: string | string[];
212
- connectionId?: string;
387
+ category?: V1RunActivityCategory | V1RunActivityCategory[];
388
+ severity?: V1RunActivitySeverity | V1RunActivitySeverity[];
389
+ invocationId?: string;
390
+ fileId?: string;
213
391
  }
214
392
  export interface V1RunLiveRequest {
215
393
  control?: string;
@@ -228,117 +406,182 @@ export interface V1RunRecordingResponse {
228
406
  durationMs?: number;
229
407
  expiresAt: string;
230
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
+ }
231
417
  export interface V1Invocation {
232
418
  id: string;
233
419
  runId: string;
234
- spaceId: string;
235
420
  runtimeId: string;
236
- runtimeType: string;
237
- type: string;
421
+ action: V1InvocationAction;
238
422
  status: string;
239
- result?: JsonValue | null;
240
- error?: JsonObject | null;
241
- progress?: JsonObject | null;
242
- artifactCount: number;
423
+ output?: JsonValue;
424
+ error?: V1InvocationError | null;
243
425
  createdAt: string;
244
426
  startedAt?: string | null;
245
427
  finishedAt?: string | null;
246
428
  durationMs?: number | null;
247
- metadata?: JsonObject | null;
248
- }
249
- export interface V1InvocationResponse {
250
- data: V1Invocation;
251
429
  }
430
+ export type V1InvocationResponse = V1Invocation;
252
431
  export interface V1InvocationWaitRequest {
253
432
  timeoutMs?: number;
254
433
  }
255
- export interface V1InvocationWaitResponse {
256
- data: V1Invocation;
257
- timedOut: boolean;
434
+ export interface V1InvocationWaitResponse extends V1Invocation {
435
+ waitStatus: 'completed' | 'timeout';
436
+ retryAfterMs?: number;
258
437
  }
259
- export type V1RuntimeInvocationFileInput = {
260
- storagePath: string;
261
- name?: string;
262
- } | {
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 {
263
456
  fileId: string;
457
+ runtimePath?: string;
264
458
  name?: string;
265
- };
459
+ }
266
460
  interface V1RuntimeInvocationAgentFields {
267
- target?: JsonObject;
268
- idempotencyKey?: string;
461
+ page?: V1InvocationPage;
269
462
  outputSchema?: JsonObject;
270
463
  toolsetId?: string;
464
+ toolIds?: string[];
271
465
  metadata?: JsonObject;
272
466
  files?: V1RuntimeInvocationFileInput[];
467
+ timeoutMs?: number;
468
+ }
469
+ interface V1RuntimeInvocationAiSelectionFields {
470
+ aiProviderId?: string;
471
+ model?: string;
472
+ temperature?: number;
273
473
  }
274
474
  export type V1RuntimeInvocationCreateRequest = {
275
- provider: 'stagehand';
276
- method: 'act' | 'observe';
277
- target?: JsonObject;
278
- input: JsonObject;
279
- 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;
280
503
  metadata?: JsonObject;
281
504
  } | {
282
- provider: 'stagehand';
283
- method: 'extract';
284
- target?: JsonObject;
285
- input?: JsonObject;
505
+ action: 'extract';
506
+ page?: V1InvocationPage;
507
+ instruction?: string;
508
+ selector?: string;
286
509
  outputSchema?: JsonObject;
287
- idempotencyKey?: string;
510
+ timeoutMs?: number;
511
+ aiProviderId?: string;
512
+ model?: string;
513
+ temperature?: number;
288
514
  metadata?: JsonObject;
289
- } | (V1RuntimeInvocationAgentFields & {
290
- provider: 'stagehand';
291
- method: 'agent';
292
- input: JsonObject;
293
- config?: JsonObject;
294
- options?: JsonObject;
295
- }) | (V1RuntimeInvocationAgentFields & {
296
- provider: 'browserUse';
297
- method: 'agent';
298
- input: JsonObject;
299
- config?: JsonObject;
300
- 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>>;
301
543
  }) | {
302
- provider: 'bctrl';
303
- method: 'solveCaptcha';
304
- target?: JsonObject;
305
- input?: JsonObject;
306
- idempotencyKey?: string;
544
+ action: 'solveCaptcha';
545
+ page?: 'active';
546
+ timeoutMs?: number;
307
547
  metadata?: JsonObject;
308
548
  };
309
549
  export interface V1File {
310
550
  id: string;
311
- type: string;
312
- source: 'upload' | 'runtime' | 'system';
551
+ source: 'upload' | 'runtime';
313
552
  name: string;
314
553
  path: string;
315
554
  contentType: string;
316
555
  sizeBytes: number;
317
- spaceId?: string;
318
- runtimeId?: string | null;
319
- runId?: string | null;
320
- metadata?: JsonObject | null;
321
556
  createdAt: string;
322
- expiresAt?: string | null;
323
- downloadUrl?: string;
557
+ spaceId: string;
558
+ downloadUrl: string;
559
+ runId?: string;
560
+ runtimeId?: string;
561
+ type?: string;
562
+ metadata?: JsonObject | null;
563
+ expiresAt?: string;
324
564
  }
325
565
  export interface V1FilesListQuery extends V1PageQuery {
326
- spaceId: string;
327
- source?: 'upload' | 'runtime' | 'system';
566
+ spaceId?: string;
567
+ source?: 'upload' | 'runtime';
568
+ type?: string | string[];
569
+ runId?: string;
570
+ runtimeId?: string;
328
571
  path?: string;
329
572
  prefix?: string;
330
- query?: string;
331
- contentType?: string;
573
+ q?: string;
332
574
  }
333
575
  export interface V1FileUpdateRequest {
334
576
  name?: string;
335
577
  metadata?: JsonObject | null;
336
578
  }
337
579
  export interface V1FileDeleteResponse {
338
- success: true;
580
+ id: string;
581
+ deleted: true;
339
582
  }
340
583
  export interface V1FileUploadRequest {
341
- spaceId: string;
584
+ spaceId?: string;
342
585
  file: Blob;
343
586
  name?: string;
344
587
  path?: string;
@@ -347,20 +590,18 @@ export interface V1FileUploadRequest {
347
590
  export interface V1RunFilesListQuery extends V1PageQuery {
348
591
  type?: string | string[];
349
592
  }
350
- export interface V1RunFilesExportRequest {
351
- format: 'zip';
352
- name: string;
353
- filter?: {
354
- type?: string[];
355
- };
593
+ export interface V1RuntimeFilesListQuery extends V1PageQuery {
594
+ type?: string | string[];
356
595
  }
357
- export type V1RuntimeFileStageRequest = {
358
- storagePath: string;
596
+ export interface V1RunFilesExportRequest {
359
597
  name?: string;
360
- } | {
598
+ type?: string[];
599
+ }
600
+ export interface V1RuntimeFileStageRequest {
361
601
  fileId: string;
602
+ runtimePath?: string;
362
603
  name?: string;
363
- };
604
+ }
364
605
  export interface V1RuntimeStagedFile {
365
606
  id: string;
366
607
  runtimeId: string;
@@ -372,21 +613,124 @@ export interface V1RuntimeStagedFile {
372
613
  export interface V1RuntimeFileUploadRequest {
373
614
  file: Blob;
374
615
  name?: string;
375
- storagePath?: string;
616
+ /** Durable BCTRL storage destination. */
617
+ destinationPath?: string;
618
+ runtimePath?: string;
376
619
  metadata?: JsonObject;
377
620
  }
378
- export interface V1RuntimeFileUploadResponse {
379
- file: V1File;
380
- staged: V1RuntimeStagedFile;
381
- }
382
621
  export interface V1RuntimeFileCollectRequest {
383
- path: string;
384
- storagePath?: string;
622
+ runtimePath: string;
623
+ /** Durable BCTRL storage destination. */
624
+ destinationPath?: string;
385
625
  name?: string;
386
- artifact?: {
387
- kind?: string;
388
- name?: string;
389
- 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;
390
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;
391
736
  }
392
- export {};