@bctrl/sdk 1.0.5 → 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
@@ -3,8 +3,10 @@ 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 { OpenApiQuery, OpenApiSchemas } from './openapi.js';
6
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';
7
- export type { V1AiProvider, V1AiProviderCreateRequest, V1AiProviderDeleteResponse, V1AiProviderGetQuery, V1AiProviderListQuery, V1AiProviderModel, V1AiProviderProvider, V1AiProviderStatus, V1AiProviderTestResponse, V1AiProviderUpdateRequest, } from './aiProviderTypes.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';
8
10
  export type { V1BrowserExtension, V1BrowserExtensionDeleteResponse, V1BrowserExtensionFormat, V1BrowserExtensionImportRequest, V1BrowserExtensionListQuery, V1BrowserExtensionSource, V1BrowserExtensionUpdateRequest, V1BrowserExtensionUploadRequest, } from './browserExtensionTypes.js';
9
11
  export type { V1ToolCall, V1ToolCallActor, V1ToolCallListQuery, V1ToolCallStatus, V1ToolCallTool, } from './toolCallTypes.js';
10
12
  export type { V1Toolset, V1ToolsetBuiltinName, V1ToolsetCreateRequest, V1ToolsetDeleteResponse, V1ToolsetListQuery, V1ToolsetUpdateRequest, } from './toolsetTypes.js';
@@ -16,249 +18,78 @@ export interface V1PageQuery {
16
18
  cursor?: string;
17
19
  limit?: number;
18
20
  }
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 {
32
- name: 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;
111
- subaccountId?: string | null;
112
- environment?: V1SpaceEnvironment;
113
- }
114
- export interface V1SpaceUpdateRequest {
115
- name?: string;
116
- }
117
- export interface V1Space {
118
- id: string;
119
- name: string;
120
- subaccountId?: string;
121
- createdAt: string;
122
- updatedAt: string;
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
- }
143
- export interface V1SpaceEnvironment {
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;
154
- }
155
- export interface V1SpaceEnvironmentUpdateRequest {
156
- storage?: V1SpaceStorageMount | null;
157
- vault?: V1SpaceVaultMount | null;
158
- ai?: V1SpaceAiMountUpdate | null;
159
- }
160
- export type V1RuntimeType = 'browser';
161
- export type V1RuntimeStatus = 'active' | 'stopped' | 'failed';
162
- export type V1BrowserStealth = 'medium' | 'high' | 'ultra';
163
- export type V1ProxyInput = {
164
- mode: 'custom';
165
- protocol: string;
166
- host: string;
167
- port: number;
168
- username?: string;
169
- password?: string;
170
- } | {
171
- mode: 'saved';
172
- id: string;
173
- overrides?: JsonObject;
174
- };
175
- export interface V1RuntimeFingerprintCreateConfig {
176
- browser?: string;
177
- locale?: string;
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
- }
189
- export interface V1BrowserRuntimeCreateConfig {
190
- profile?: boolean;
191
- stealth?: V1BrowserStealth;
192
- proxy?: V1ProxyInput | null;
193
- fingerprint?: V1RuntimeFingerprintCreateConfig;
194
- extensionIds?: string[];
195
- idleTimeoutMinutes?: number;
196
- webRtcProxyOnly?: boolean;
197
- forceOpenShadowRoots?: boolean;
198
- networkTraffic?: V1BrowserNetworkTrafficConfig;
199
- }
200
- export interface V1RuntimeCreateRequest {
201
- spaceId?: string;
202
- /** Optional; defaults to `'browser'` server-side. Only `'browser'` is accepted today. */
203
- type?: V1RuntimeType;
204
- name?: string;
205
- metadata?: JsonObject;
206
- config?: V1BrowserRuntimeCreateConfig;
207
- }
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'];
208
56
  export type V1SpaceRuntimeCreateRequest = Omit<V1RuntimeCreateRequest, 'spaceId'>;
57
+ /** PATCH /v1/runtimes/{runtimeId} — name and idleTimeoutMinutes are editable
58
+ * any time; `config` only while the runtime is stopped. */
59
+ export type V1RuntimeUpdateRequest = OpenApiSchemas['RuntimeUpdateRequest'];
60
+ export type V1RuntimeDeleteResponse = OpenApiSchemas['RuntimeDeleteResponse'];
209
61
  export interface V1RuntimeListQuery {
210
62
  spaceId?: string;
211
63
  status?: V1RuntimeStatus | V1RuntimeStatus[];
212
64
  cursor?: string;
213
65
  limit?: number;
214
66
  }
215
- export interface V1RuntimeSummary {
216
- id: string;
217
- spaceId: string;
218
- name: string;
219
- type: V1RuntimeType;
220
- status: V1RuntimeStatus;
221
- activeRunId: string | null;
222
- lastActivityAt?: string;
223
- createdAt: string;
224
- updatedAt: string;
225
- }
67
+ export type V1RuntimeSummary = OpenApiSchemas['RuntimeSummary'];
226
68
  /** Saved-resource reference for a proxy attached to a runtime (response side). */
227
69
  export interface V1RuntimeProxyRef {
228
70
  id: string;
229
71
  type: 'custom' | 'managed-rotating' | 'managed-static';
230
72
  name: string;
231
73
  }
74
+ export type V1RuntimeInlineProxyConfig = {
75
+ type: 'custom';
76
+ protocol: V1ProxyProtocol;
77
+ dnsResolution?: V1ProxyDnsResolution;
78
+ host: string;
79
+ port: number;
80
+ username?: string | null;
81
+ hasPassword: boolean;
82
+ } | ({
83
+ type: 'managed-rotating';
84
+ } & V1ManagedRotatingProxyConfig);
232
85
  /** 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
- }
86
+ export type V1RuntimeFingerprint = OpenApiSchemas['RuntimeFingerprint'];
243
87
  /**
244
88
  * Type-specific browser runtime config returned on the runtime resource. No open
245
89
  * JSON fallback arm — only the documented browser knobs are surfaced.
246
90
  */
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
- }
258
- export interface V1Runtime extends V1RuntimeSummary {
259
- config?: V1BrowserRuntimeConfig;
260
- metadata?: JsonObject | null;
261
- }
91
+ export type V1BrowserRuntimeConfig = OpenApiSchemas['BrowserRuntimeConfig'];
92
+ export type V1Runtime = OpenApiSchemas['Runtime'];
262
93
  export interface V1RuntimeStartRuntime {
263
94
  id: string;
264
95
  spaceId: string;
@@ -271,96 +102,42 @@ export interface V1RuntimeStartRun extends V1RunSummary {
271
102
  failureReason?: string | null;
272
103
  }
273
104
  export type V1ConnectionProtocol = 'cdp';
274
- export interface V1RuntimeStartResponse {
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;
293
- }
105
+ export type V1RuntimeStartResponse = OpenApiSchemas['RuntimeStartResponse'];
106
+ export type V1RuntimeStopResponse = OpenApiSchemas['RuntimeStopResponse'];
294
107
  export interface V1RunListQuery extends V1PageQuery {
295
108
  status?: string | string[];
296
109
  spaceId?: string;
297
110
  runtimeId?: string;
298
111
  }
299
112
  export type V1RuntimeRunListQuery = Omit<V1RunListQuery, 'spaceId' | 'runtimeId'>;
300
- export interface V1RunSummary {
301
- id: string;
302
- status: string;
303
- createdAt: string;
304
- startedAt: string;
305
- finishedAt?: string | null;
306
- }
307
- export interface V1Run extends V1RunSummary {
308
- spaceId: string;
309
- runtimeId: string;
310
- runtimeType: string;
311
- durationMs?: number | null;
312
- failureReason?: string | null;
313
- }
113
+ export type V1RunSummary = OpenApiSchemas['RunSummary'];
114
+ export type V1Run = OpenApiSchemas['Run'];
314
115
  export type V1RunUsageBillingStatus = 'pending' | 'settled' | 'unavailable';
315
- export interface V1RunUsage {
316
- runId: string;
317
- runtimeId: string;
318
- runtimeType: string;
319
- status: string;
320
- computedAt: string;
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: {
332
- aiTokens: {
333
- input: number | null;
334
- output: number | null;
335
- };
336
- credits: {
337
- runtime: number | null;
338
- ai: number | null;
339
- proxy: number | null;
340
- captcha: number | null;
341
- files: number | null;
342
- };
343
- };
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';
347
- export interface V1RunEvent {
348
- 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 {
349
122
  time: string;
350
- type: V1RunEventType;
351
- status?: V1RunEventStatus;
352
- durationMs?: number;
353
- pageId?: string;
354
- contextId?: string;
355
- name?: string;
356
- data?: JsonObject;
357
123
  }
358
- export interface V1RunEventsListQuery extends V1PageQuery {
359
- type?: string | string[];
360
- status?: string | string[];
361
- pageId?: string;
362
- contextId?: string;
124
+ export interface V1RunStreamEnded {
125
+ runId: string;
126
+ status: V1Run['status'];
127
+ finishedAt: string | null;
128
+ failure: NonNullable<V1Run['failure']> | null;
363
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
+ };
364
141
  export type V1RunActivityCategory = 'runtime' | 'browser' | 'network' | 'console' | 'file' | 'invocation' | 'tool' | 'captcha' | 'agent' | 'llm' | 'system';
365
142
  export type V1RunActivitySeverity = 'info' | 'warning' | 'error';
366
143
  export interface V1RunActivityLinks {
@@ -368,218 +145,48 @@ export interface V1RunActivityLinks {
368
145
  toolCallId?: string;
369
146
  fileId?: string;
370
147
  }
371
- export interface V1RunActivityItem {
148
+ export type V1RunActivityItem = OpenApiSchemas['RunActivityItem'];
149
+ export type V1RunActivityListQuery = OpenApiQuery<'runs.activity.list'>;
150
+ export type V1RunActivityStreamFrame = {
151
+ event: 'run.activity';
372
152
  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[];
384
- }
385
- export interface V1RunActivityListQuery extends V1PageQuery {
386
- type?: string | string[];
387
- category?: V1RunActivityCategory | V1RunActivityCategory[];
388
- severity?: V1RunActivitySeverity | V1RunActivitySeverity[];
389
- invocationId?: string;
390
- fileId?: string;
391
- }
392
- export interface V1RunLiveRequest {
393
- control?: string;
394
- expiresInSeconds?: number;
395
- }
396
- export interface V1RunLiveResponse {
397
- iframeUrl: string;
398
- expiresAt: string;
399
- }
400
- export interface V1RunRecordingRequest {
401
- expiresInSeconds?: number;
402
- }
403
- export interface V1RunRecordingResponse {
404
- iframeUrl: string;
405
- status: string;
406
- durationMs?: number;
407
- expiresAt: string;
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
- }
417
- export interface V1Invocation {
418
- id: string;
419
- runId: string;
420
- runtimeId: string;
421
- action: V1InvocationAction;
422
- status: string;
423
- output?: JsonValue;
424
- error?: V1InvocationError | null;
425
- createdAt: string;
426
- startedAt?: string | null;
427
- finishedAt?: string | null;
428
- durationMs?: number | null;
429
- }
153
+ data: V1RunActivityItem;
154
+ } | {
155
+ event: 'heartbeat';
156
+ data: V1RunStreamHeartbeat;
157
+ } | {
158
+ event: 'run.ended';
159
+ data: V1RunStreamEnded;
160
+ };
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'];
430
172
  export type V1InvocationResponse = V1Invocation;
431
- export interface V1InvocationWaitRequest {
432
- timeoutMs?: number;
433
- }
434
- export interface V1InvocationWaitResponse extends V1Invocation {
435
- waitStatus: 'completed' | 'timeout';
436
- retryAfterMs?: number;
437
- }
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
- }
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'>;
455
177
  export interface V1RuntimeInvocationFileInput {
456
178
  fileId: string;
457
179
  runtimePath?: string;
458
180
  name?: string;
459
181
  }
460
- interface V1RuntimeInvocationAgentFields {
461
- page?: V1InvocationPage;
462
- outputSchema?: JsonObject;
463
- toolsetId?: string;
464
- toolIds?: string[];
465
- metadata?: JsonObject;
466
- files?: V1RuntimeInvocationFileInput[];
467
- timeoutMs?: number;
468
- }
469
- interface V1RuntimeInvocationAiSelectionFields {
470
- aiProviderId?: string;
471
- model?: string;
472
- temperature?: number;
473
- }
474
- export type V1RuntimeInvocationCreateRequest = {
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;
503
- metadata?: JsonObject;
504
- } | {
505
- action: 'extract';
506
- page?: V1InvocationPage;
507
- instruction?: string;
508
- selector?: string;
509
- outputSchema?: JsonObject;
510
- timeoutMs?: number;
511
- aiProviderId?: string;
512
- model?: string;
513
- temperature?: number;
514
- metadata?: 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>>;
543
- }) | {
544
- action: 'solveCaptcha';
545
- page?: 'active';
546
- timeoutMs?: number;
547
- metadata?: JsonObject;
548
- };
549
- export interface V1File {
550
- id: string;
551
- source: 'upload' | 'runtime';
552
- name: string;
553
- path: string;
554
- contentType: string;
555
- sizeBytes: number;
556
- createdAt: string;
557
- spaceId: string;
558
- downloadUrl: string;
559
- runId?: string;
560
- runtimeId?: string;
561
- type?: string;
562
- metadata?: JsonObject | null;
563
- expiresAt?: string;
564
- }
565
- export interface V1FilesListQuery extends V1PageQuery {
566
- spaceId?: string;
567
- source?: 'upload' | 'runtime';
568
- type?: string | string[];
569
- runId?: string;
570
- runtimeId?: string;
571
- path?: string;
572
- prefix?: string;
573
- q?: string;
574
- }
575
- export interface V1FileUpdateRequest {
576
- name?: string;
577
- metadata?: JsonObject | null;
578
- }
579
- export interface V1FileDeleteResponse {
580
- id: string;
581
- deleted: true;
582
- }
182
+ export type V1RuntimeInvocationCreateRequest = OpenApiSchemas['RuntimeInvocationCreateRequest'];
183
+ export type V1File = OpenApiSchemas['File'];
184
+ export type V1FilesListQuery = OpenApiQuery<'files.list'>;
185
+ /** Immediate-subfolder rollup returned by files.list with `include: 'folders'`. */
186
+ export type V1FileFolder = OpenApiSchemas['FileFolder'];
187
+ export type V1FilesListResponse = OpenApiSchemas['FileListResponse'];
188
+ export type V1FileUpdateRequest = OpenApiSchemas['FileUpdateRequest'];
189
+ export type V1FileDeleteResponse = OpenApiSchemas['FileDeleteResponse'];
583
190
  export interface V1FileUploadRequest {
584
191
  spaceId?: string;
585
192
  file: Blob;
@@ -587,29 +194,11 @@ export interface V1FileUploadRequest {
587
194
  path?: string;
588
195
  metadata?: JsonObject;
589
196
  }
590
- export interface V1RunFilesListQuery extends V1PageQuery {
591
- type?: string | string[];
592
- }
593
- export interface V1RuntimeFilesListQuery extends V1PageQuery {
594
- type?: string | string[];
595
- }
596
- export interface V1RunFilesExportRequest {
597
- name?: string;
598
- type?: string[];
599
- }
600
- export interface V1RuntimeFileStageRequest {
601
- fileId: string;
602
- runtimePath?: string;
603
- name?: string;
604
- }
605
- export interface V1RuntimeStagedFile {
606
- id: string;
607
- runtimeId: string;
608
- runtimePath: string;
609
- name: string;
610
- sizeBytes: number;
611
- expiresAt: string | null;
612
- }
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'];
613
202
  export interface V1RuntimeFileUploadRequest {
614
203
  file: Blob;
615
204
  name?: string;
@@ -618,17 +207,10 @@ export interface V1RuntimeFileUploadRequest {
618
207
  runtimePath?: string;
619
208
  metadata?: JsonObject;
620
209
  }
621
- export interface V1RuntimeFileCollectRequest {
622
- runtimePath: string;
623
- /** Durable BCTRL storage destination. */
624
- destinationPath?: string;
625
- name?: string;
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';
210
+ export type V1RuntimeFileCollectRequest = OpenApiSchemas['RuntimeFileCollectRequest'];
211
+ export type { V1ManagedRotatingDevice, V1ManagedRotatingPreference, V1ManagedRotatingProxyConfig, V1ManagedRotatingRotation, V1Proxy, V1ProxyBase, V1ProxyCreateRequest, V1ProxyDeleteResponse, V1ProxyDnsResolution, V1ProxyListQuery, V1ProxyPool, V1ProxyPoolListQuery, V1ProxyProtocol, V1ProxyTestResponse, V1ProxyType, V1ProxyUpdateRequest, } from './proxyTypes.js';
630
212
  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';
213
+ export type V1ToolExecutionType = OpenApiSchemas['ToolCallTool']['executionType'];
632
214
  export type V1ToolExecution = {
633
215
  type: 'webhook';
634
216
  url: string;
@@ -654,83 +236,10 @@ export type V1ToolExecution = {
654
236
  type: 'bctrl_builtin';
655
237
  name: 'files' | 'vault' | 'captcha';
656
238
  };
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;
736
- }
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'];