@bctrl/sdk 1.0.4 → 1.0.6

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