@bctrl/sdk 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -4,7 +4,7 @@ export type JsonObject = {
4
4
  [key: string]: JsonValue;
5
5
  };
6
6
  import type { V1ManagedRotatingProxyConfig, V1ProxyDnsResolution, V1ProxyProtocol } from './proxyTypes.js';
7
- import type { V1AiModelSelection, V1AiStoredModelSelection } from './aiTypes.js';
7
+ import type { OpenApiQuery, OpenApiSchemas } from './openapi.js';
8
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
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
10
  export type { V1BrowserExtension, V1BrowserExtensionDeleteResponse, V1BrowserExtensionFormat, V1BrowserExtensionImportRequest, V1BrowserExtensionListQuery, V1BrowserExtensionSource, V1BrowserExtensionUpdateRequest, V1BrowserExtensionUploadRequest, } from './browserExtensionTypes.js';
@@ -18,241 +18,53 @@ export interface V1PageQuery {
18
18
  cursor?: string;
19
19
  limit?: number;
20
20
  }
21
- export type V1HelpAudience = 'api' | 'sdk' | 'cli';
22
- export interface V1HelpRequest {
23
- topic?: string;
24
- audience?: V1HelpAudience;
25
- }
26
- export interface V1HelpField {
27
- name: 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;
113
- subaccountId?: string | null;
114
- environment?: V1SpaceEnvironment;
115
- }
116
- export interface V1SpaceUpdateRequest {
117
- name?: string;
118
- }
119
- export interface V1Space {
120
- id: string;
121
- name: string;
122
- subaccountId?: string;
123
- createdAt: string;
124
- updatedAt: string;
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
- }
145
- export interface V1SpaceEnvironment {
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;
156
- }
157
- export interface V1SpaceEnvironmentUpdateRequest {
158
- storage?: V1SpaceStorageMount | null;
159
- vault?: V1SpaceVaultMount | null;
160
- ai?: V1SpaceAiMountUpdate | null;
161
- }
162
- export type V1RuntimeType = 'browser';
163
- export type V1RuntimeStatus = 'active' | 'stopped' | 'failed';
164
- export type V1BrowserStealth = 'medium' | 'high' | 'ultra';
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;
177
- host: string;
178
- port: number;
179
- username?: string;
180
- password?: string;
181
- } | ({
182
- type: 'managed-rotating';
183
- } & V1ManagedRotatingProxyConfig);
184
- export interface V1RuntimeFingerprintCreateConfig {
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[];
203
- }
204
- export interface V1BrowserRuntimeCreateConfig {
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;
210
- stealth?: V1BrowserStealth;
211
- proxy?: V1ProxyInput | null;
212
- fingerprint?: V1RuntimeFingerprintCreateConfig;
213
- extensionIds?: string[];
214
- idleTimeoutMinutes?: number;
215
- webRtcProxyOnly?: boolean;
216
- forceOpenShadowRoots?: boolean;
217
- networkTraffic?: V1BrowserNetworkTrafficConfig;
218
- }
219
- export interface V1RuntimeCreateRequest {
220
- spaceId?: string;
221
- /** Optional; defaults to `'browser'` server-side. Only `'browser'` is accepted today. */
222
- type?: V1RuntimeType;
223
- name?: string;
224
- metadata?: JsonObject;
225
- config?: V1BrowserRuntimeCreateConfig;
226
- }
21
+ export type V1HelpAudience = NonNullable<OpenApiSchemas['HelpRequest']['audience']>;
22
+ export type V1HelpRequest = OpenApiSchemas['HelpRequest'];
23
+ export type V1HelpField = OpenApiSchemas['HelpField'];
24
+ export type V1HelpFlag = OpenApiSchemas['HelpFlag'];
25
+ export type V1HelpIo = OpenApiSchemas['HelpIo'];
26
+ export type V1HelpApiOperation = OpenApiSchemas['HelpApiOperation'];
27
+ export type V1HelpSdkMethod = OpenApiSchemas['HelpSdkMethod'];
28
+ export type V1HelpCliCommand = OpenApiSchemas['HelpCliCommand'];
29
+ export type V1HelpExample = OpenApiSchemas['HelpExample'];
30
+ export type V1HelpNextStep = OpenApiSchemas['HelpNextStep'];
31
+ export type V1HelpTopic = OpenApiSchemas['HelpTopic'];
32
+ export type V1HelpOverviewResponse = OpenApiSchemas['HelpOverviewResponse'];
33
+ export type V1HelpTopicResponse = OpenApiSchemas['HelpTopicResponse'];
34
+ export type V1HelpResponse = OpenApiSchemas['HelpResponse'];
35
+ export type V1SpaceListQuery = OpenApiQuery<'spaces.list'>;
36
+ export type V1SpaceCreateRequest = OpenApiSchemas['SpaceCreateRequest'];
37
+ export type V1SpaceUpdateRequest = OpenApiSchemas['SpaceUpdateRequest'];
38
+ export type V1Space = OpenApiSchemas['Space'];
39
+ export type V1SpaceDeleteResponse = OpenApiSchemas['SpaceDeleteResponse'];
40
+ export type V1SpaceStorageMount = OpenApiSchemas['EnvironmentStorageMountOutput'];
41
+ export type V1SpaceVaultMount = NonNullable<OpenApiSchemas['EnvironmentMountsOutput']['vault']>;
42
+ export type V1SpaceAiMount = NonNullable<OpenApiSchemas['EnvironmentMountsOutput']['ai']>;
43
+ export type V1SpaceEnvironment = OpenApiSchemas['EnvironmentMountsOutput'];
44
+ export type V1SpaceAiMountUpdate = NonNullable<OpenApiSchemas['SpaceEnvironmentUpdateRequest']['ai']>;
45
+ export type V1SpaceEnvironmentUpdateRequest = OpenApiSchemas['SpaceEnvironmentUpdateRequest'];
46
+ export type V1RuntimeType = OpenApiSchemas['Runtime']['type'];
47
+ export type V1RuntimeStatus = OpenApiSchemas['Runtime']['status'];
48
+ export type V1BrowserStealth = NonNullable<OpenApiSchemas['BrowserRuntimeCreateConfig']['stealth']>;
49
+ export type V1ProxyInput = OpenApiSchemas['RuntimeProxyInput'];
50
+ export type V1RuntimeFingerprintCreateConfig = NonNullable<OpenApiSchemas['BrowserRuntimeCreateConfig']['fingerprint']>;
51
+ export type V1BrowserNetworkTrafficSaver = NonNullable<OpenApiSchemas['BrowserNetworkTrafficConfig']['saver']>;
52
+ export type V1BrowserNetworkTrafficResourceType = NonNullable<OpenApiSchemas['BrowserNetworkTrafficConfig']['blockResourceTypes']>[number];
53
+ export type V1BrowserNetworkTrafficConfig = OpenApiSchemas['BrowserNetworkTrafficConfig'];
54
+ export type V1BrowserRuntimeCreateConfig = OpenApiSchemas['BrowserRuntimeCreateConfig'];
55
+ export type V1RuntimeCreateRequest = OpenApiSchemas['RuntimeCreateRequest'];
227
56
  export type V1SpaceRuntimeCreateRequest = Omit<V1RuntimeCreateRequest, 'spaceId'>;
228
57
  /** PATCH /v1/runtimes/{runtimeId} — name and idleTimeoutMinutes are editable
229
58
  * 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
- }
59
+ export type V1RuntimeUpdateRequest = OpenApiSchemas['RuntimeUpdateRequest'];
60
+ export type V1RuntimeDeleteResponse = OpenApiSchemas['RuntimeDeleteResponse'];
239
61
  export interface V1RuntimeListQuery {
240
62
  spaceId?: string;
241
63
  status?: V1RuntimeStatus | V1RuntimeStatus[];
242
64
  cursor?: string;
243
65
  limit?: number;
244
66
  }
245
- export interface V1RuntimeSummary {
246
- id: string;
247
- spaceId: string;
248
- name: string;
249
- type: V1RuntimeType;
250
- status: V1RuntimeStatus;
251
- activeRunId: string | null;
252
- lastActivityAt?: string;
253
- createdAt: string;
254
- updatedAt: string;
255
- }
67
+ export type V1RuntimeSummary = OpenApiSchemas['RuntimeSummary'];
256
68
  /** Saved-resource reference for a proxy attached to a runtime (response side). */
257
69
  export interface V1RuntimeProxyRef {
258
70
  id: string;
@@ -271,39 +83,13 @@ export type V1RuntimeInlineProxyConfig = {
271
83
  type: 'managed-rotating';
272
84
  } & V1ManagedRotatingProxyConfig);
273
85
  /** 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
- }
86
+ export type V1RuntimeFingerprint = OpenApiSchemas['RuntimeFingerprint'];
287
87
  /**
288
88
  * Type-specific browser runtime config returned on the runtime resource. No open
289
89
  * JSON fallback arm — only the documented browser knobs are surfaced.
290
90
  */
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
- }
303
- export interface V1Runtime extends V1RuntimeSummary {
304
- config?: V1BrowserRuntimeConfig;
305
- metadata?: JsonObject | null;
306
- }
91
+ export type V1BrowserRuntimeConfig = OpenApiSchemas['BrowserRuntimeConfig'];
92
+ export type V1Runtime = OpenApiSchemas['Runtime'];
307
93
  export interface V1RuntimeStartRuntime {
308
94
  id: string;
309
95
  spaceId: string;
@@ -316,96 +102,42 @@ export interface V1RuntimeStartRun extends V1RunSummary {
316
102
  failureReason?: string | null;
317
103
  }
318
104
  export type V1ConnectionProtocol = 'cdp';
319
- export interface V1RuntimeStartResponse {
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;
338
- }
105
+ export type V1RuntimeStartResponse = OpenApiSchemas['RuntimeStartResponse'];
106
+ export type V1RuntimeStopResponse = OpenApiSchemas['RuntimeStopResponse'];
339
107
  export interface V1RunListQuery extends V1PageQuery {
340
108
  status?: string | string[];
341
109
  spaceId?: string;
342
110
  runtimeId?: string;
343
111
  }
344
112
  export type V1RuntimeRunListQuery = Omit<V1RunListQuery, 'spaceId' | 'runtimeId'>;
345
- export interface V1RunSummary {
346
- id: string;
347
- status: string;
348
- createdAt: string;
349
- startedAt: string;
350
- finishedAt?: string | null;
351
- }
352
- export interface V1Run extends V1RunSummary {
353
- spaceId: string;
354
- runtimeId: string;
355
- runtimeType: string;
356
- durationMs?: number | null;
357
- failureReason?: string | null;
358
- }
113
+ export type V1RunSummary = OpenApiSchemas['RunSummary'];
114
+ export type V1Run = OpenApiSchemas['Run'];
359
115
  export type V1RunUsageBillingStatus = 'pending' | 'settled' | 'unavailable';
360
- export interface V1RunUsage {
361
- runId: string;
362
- runtimeId: string;
363
- runtimeType: string;
364
- status: string;
365
- computedAt: string;
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: {
377
- aiTokens: {
378
- input: number | null;
379
- output: number | null;
380
- };
381
- credits: {
382
- runtime: number | null;
383
- ai: number | null;
384
- proxy: number | null;
385
- captcha: number | null;
386
- files: number | null;
387
- };
388
- };
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';
392
- export interface V1RunEvent {
393
- id: string;
116
+ export type V1RunUsage = OpenApiSchemas['RunUsage'];
117
+ export type V1RunEventType = OpenApiSchemas['RunEvent']['type'];
118
+ export type V1RunEventStatus = NonNullable<OpenApiSchemas['RunEvent']['status']>;
119
+ export type V1RunEvent = OpenApiSchemas['RunEvent'];
120
+ export type V1RunEventsListQuery = OpenApiQuery<'runs.events.list'>;
121
+ export interface V1RunStreamHeartbeat {
394
122
  time: string;
395
- type: V1RunEventType;
396
- status?: V1RunEventStatus;
397
- durationMs?: number;
398
- pageId?: string;
399
- contextId?: string;
400
- name?: string;
401
- data?: JsonObject;
402
123
  }
403
- export interface V1RunEventsListQuery extends V1PageQuery {
404
- type?: string | string[];
405
- status?: string | string[];
406
- pageId?: string;
407
- contextId?: string;
124
+ export interface V1RunStreamEnded {
125
+ runId: string;
126
+ status: V1Run['status'];
127
+ finishedAt: string | null;
128
+ failure: NonNullable<V1Run['failure']> | null;
408
129
  }
130
+ export type V1RunEventStreamFrame = {
131
+ event: 'run.event';
132
+ id: string;
133
+ data: V1RunEvent;
134
+ } | {
135
+ event: 'heartbeat';
136
+ data: V1RunStreamHeartbeat;
137
+ } | {
138
+ event: 'run.ended';
139
+ data: V1RunStreamEnded;
140
+ };
409
141
  export type V1RunActivityCategory = 'runtime' | 'browser' | 'network' | 'console' | 'file' | 'invocation' | 'tool' | 'captcha' | 'agent' | 'llm' | 'system';
410
142
  export type V1RunActivitySeverity = 'info' | 'warning' | 'error';
411
143
  export interface V1RunActivityLinks {
@@ -413,248 +145,48 @@ export interface V1RunActivityLinks {
413
145
  toolCallId?: string;
414
146
  fileId?: string;
415
147
  }
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[];
429
- }
430
- export interface V1RunActivityListQuery extends V1PageQuery {
431
- type?: string | string[];
432
- category?: V1RunActivityCategory | V1RunActivityCategory[];
433
- severity?: V1RunActivitySeverity | V1RunActivitySeverity[];
434
- invocationId?: string;
435
- fileId?: string;
436
- }
437
- export interface V1RunLiveRequest {
438
- control?: string;
439
- expiresInSeconds?: number;
440
- }
441
- export interface V1RunLiveResponse {
442
- url: string;
443
- expiresAt: string;
444
- }
445
- export interface V1RunRecordingRequest {
446
- expiresInSeconds?: number;
447
- }
448
- export interface V1RunRecordingResponse {
449
- url: string;
450
- status: string;
451
- durationMs?: number;
452
- expiresAt: string;
453
- }
454
- export type V1InvocationAction = 'act' | 'observe' | 'extract' | 'browserUse' | 'stagehandAgent' | 'solveCaptcha';
455
- export type V1RuntimeTargetSelector = 'active' | 'new' | {
148
+ export type V1RunActivityItem = OpenApiSchemas['RunActivityItem'];
149
+ export type V1RunActivityListQuery = OpenApiQuery<'runs.activity.list'>;
150
+ export type V1RunActivityStreamFrame = {
151
+ event: 'run.activity';
456
152
  id: string;
153
+ data: V1RunActivityItem;
154
+ } | {
155
+ event: 'heartbeat';
156
+ data: V1RunStreamHeartbeat;
157
+ } | {
158
+ event: 'run.ended';
159
+ data: V1RunStreamEnded;
457
160
  };
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
- }
478
- export interface V1Invocation {
479
- id: string;
480
- runId: string;
481
- runtimeId: string;
482
- action: V1InvocationAction;
483
- status: string;
484
- output?: JsonValue;
485
- error?: V1InvocationError | null;
486
- createdAt: string;
487
- startedAt?: string | null;
488
- finishedAt?: string | null;
489
- durationMs?: number | null;
490
- }
161
+ export type V1RunLiveRequest = OpenApiSchemas['RunLiveRequest'];
162
+ export type V1RunLiveResponse = OpenApiSchemas['RunLiveResponse'];
163
+ export type V1RunRecordingRequest = OpenApiSchemas['RunRecordingRequest'];
164
+ export type V1RunRecordingResponse = OpenApiSchemas['RunRecordingResponse'];
165
+ export type V1InvocationAction = OpenApiSchemas['Invocation']['action'];
166
+ export type V1RuntimeTargetSelector = OpenApiSchemas['RuntimeTargetSelector'];
167
+ export type V1RuntimeTarget = OpenApiSchemas['RuntimeTarget'];
168
+ export type V1RuntimeTargetCreateRequest = OpenApiSchemas['RuntimeTargetCreateRequest'];
169
+ export type V1InvocationErrorCode = NonNullable<NonNullable<OpenApiSchemas['Invocation']['error']>['code']>;
170
+ export type V1InvocationError = NonNullable<OpenApiSchemas['Invocation']['error']>;
171
+ export type V1Invocation = OpenApiSchemas['Invocation'];
491
172
  export type V1InvocationResponse = V1Invocation;
492
- export interface V1InvocationWaitRequest {
493
- timeoutMs?: number;
494
- }
495
- export interface V1InvocationWaitResponse extends V1Invocation {
496
- waitStatus: 'completed' | 'timeout';
497
- retryAfterMs?: number;
498
- }
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
- }
173
+ export type V1InvocationWaitRequest = OpenApiSchemas['InvocationWaitRequest'];
174
+ export type V1InvocationWaitResponse = OpenApiSchemas['InvocationWait'];
175
+ export type V1InvocationSummary = OpenApiSchemas['InvocationSummary'];
176
+ export type V1RunInvocationsListQuery = OpenApiQuery<'runs.invocations.list'>;
516
177
  export interface V1RuntimeInvocationFileInput {
517
178
  fileId: string;
518
179
  runtimePath?: string;
519
180
  name?: string;
520
181
  }
521
- interface V1RuntimeInvocationAgentFields {
522
- target?: V1RuntimeTargetSelector;
523
- outputSchema?: JsonObject;
524
- toolsetId?: string;
525
- toolIds?: string[];
526
- metadata?: JsonObject;
527
- files?: V1RuntimeInvocationFileInput[];
528
- timeoutMs?: number;
529
- }
530
- interface V1RuntimeInvocationAiSelectionFields {
531
- model?: V1AiModelSelection;
532
- temperature?: number;
533
- }
534
- export type V1RuntimeInvocationCreateRequest = {
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;
560
- metadata?: JsonObject;
561
- } | {
562
- action: 'extract';
563
- target?: V1RuntimeTargetSelector;
564
- instruction?: string;
565
- selector?: string;
566
- outputSchema?: JsonObject;
567
- timeoutMs?: number;
568
- model?: V1AiModelSelection;
569
- temperature?: number;
570
- metadata?: 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>>;
599
- }) | {
600
- action: 'solveCaptcha';
601
- target?: 'active' | {
602
- id: string;
603
- };
604
- timeoutMs?: number;
605
- metadata?: JsonObject;
606
- };
607
- export interface V1File {
608
- id: string;
609
- source: 'upload' | 'runtime';
610
- name: string;
611
- path: string;
612
- contentType: string;
613
- sizeBytes: number;
614
- createdAt: string;
615
- spaceId: string;
616
- downloadUrl: string;
617
- runId?: string;
618
- runtimeId?: string;
619
- type?: string;
620
- metadata?: JsonObject | null;
621
- expiresAt?: string;
622
- }
623
- export interface V1FilesListQuery extends V1PageQuery {
624
- spaceId?: string;
625
- source?: 'upload' | 'runtime';
626
- type?: string | string[];
627
- runId?: string;
628
- runtimeId?: string;
629
- path?: string;
630
- prefix?: 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
- }
182
+ export type V1RuntimeInvocationCreateRequest = OpenApiSchemas['RuntimeInvocationCreateRequest'];
183
+ export type V1File = OpenApiSchemas['File'];
184
+ export type V1FilesListQuery = OpenApiQuery<'files.list'>;
639
185
  /** 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;
646
- }
647
- export type V1FilesListResponse = V1ListEnvelope<V1File> & {
648
- folders?: V1FileFolder[];
649
- };
650
- export interface V1FileUpdateRequest {
651
- name?: string;
652
- metadata?: JsonObject | null;
653
- }
654
- export interface V1FileDeleteResponse {
655
- id: string;
656
- deleted: true;
657
- }
186
+ export type V1FileFolder = OpenApiSchemas['FileFolder'];
187
+ export type V1FilesListResponse = OpenApiSchemas['FileListResponse'];
188
+ export type V1FileUpdateRequest = OpenApiSchemas['FileUpdateRequest'];
189
+ export type V1FileDeleteResponse = OpenApiSchemas['FileDeleteResponse'];
658
190
  export interface V1FileUploadRequest {
659
191
  spaceId?: string;
660
192
  file: Blob;
@@ -662,29 +194,11 @@ export interface V1FileUploadRequest {
662
194
  path?: string;
663
195
  metadata?: JsonObject;
664
196
  }
665
- export interface V1RunFilesListQuery extends V1PageQuery {
666
- type?: string | string[];
667
- }
668
- export interface V1RuntimeFilesListQuery extends V1PageQuery {
669
- type?: string | string[];
670
- }
671
- export interface V1RunFilesExportRequest {
672
- name?: string;
673
- type?: string[];
674
- }
675
- export interface V1RuntimeFileStageRequest {
676
- fileId: string;
677
- runtimePath?: string;
678
- name?: string;
679
- }
680
- export interface V1RuntimeStagedFile {
681
- id: string;
682
- runtimeId: string;
683
- runtimePath: string;
684
- name: string;
685
- sizeBytes: number;
686
- expiresAt: string | null;
687
- }
197
+ export type V1RunFilesListQuery = OpenApiQuery<'runs.files.list'>;
198
+ export type V1RuntimeFilesListQuery = OpenApiQuery<'runtimes.files.list'>;
199
+ export type V1RunFilesExportRequest = OpenApiSchemas['RunsFilesExportRequest'];
200
+ export type V1RuntimeFileStageRequest = OpenApiSchemas['RuntimeFileStageRequest'];
201
+ export type V1RuntimeStagedFile = OpenApiSchemas['RuntimeStagedFile'];
688
202
  export interface V1RuntimeFileUploadRequest {
689
203
  file: Blob;
690
204
  name?: string;
@@ -693,17 +207,10 @@ export interface V1RuntimeFileUploadRequest {
693
207
  runtimePath?: string;
694
208
  metadata?: JsonObject;
695
209
  }
696
- export interface V1RuntimeFileCollectRequest {
697
- runtimePath: string;
698
- /** Durable BCTRL storage destination. */
699
- destinationPath?: string;
700
- name?: string;
701
- type?: string;
702
- metadata?: JsonObject;
703
- }
210
+ export type V1RuntimeFileCollectRequest = OpenApiSchemas['RuntimeFileCollectRequest'];
704
211
  export type { V1ManagedRotatingDevice, V1ManagedRotatingPreference, V1ManagedRotatingProxyConfig, V1ManagedRotatingRotation, V1Proxy, V1ProxyBase, V1ProxyCreateRequest, V1ProxyDeleteResponse, V1ProxyDnsResolution, V1ProxyListQuery, V1ProxyPool, V1ProxyPoolListQuery, V1ProxyProtocol, V1ProxyTestResponse, V1ProxyType, V1ProxyUpdateRequest, } from './proxyTypes.js';
705
212
  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';
213
+ export type V1ToolExecutionType = OpenApiSchemas['ToolCallTool']['executionType'];
707
214
  export type V1ToolExecution = {
708
215
  type: 'webhook';
709
216
  url: string;
@@ -729,83 +236,10 @@ export type V1ToolExecution = {
729
236
  type: 'bctrl_builtin';
730
237
  name: 'files' | 'vault' | 'captcha';
731
238
  };
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;
811
- }
239
+ export type V1ToolType = OpenApiSchemas['Tool']['type'];
240
+ export type V1ToolBase = Pick<OpenApiSchemas['BuiltinTool'], 'id' | 'spaceId' | 'name' | 'description' | 'inputSchema' | 'outputSchema' | 'status' | 'metadata' | 'createdAt' | 'updatedAt'>;
241
+ export type V1Tool = OpenApiSchemas['Tool'];
242
+ export type V1ToolCreateRequest = OpenApiSchemas['ToolCreateRequest'];
243
+ export type V1ToolUpdateRequest = OpenApiSchemas['ToolUpdateRequest'];
244
+ export type V1ToolVersion = OpenApiSchemas['ToolVersion'];
245
+ export type V1ToolVersionCreateRequest = OpenApiSchemas['ToolVersionCreateRequest'];