@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.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  export { Bctrl, BctrlV1, type BctrlV1Options } from './bctrl.js';
2
2
  export { V1AccountClient, V1ApiKeysClient, V1AuthClient, V1SubaccountsClient, V1SubaccountUsageClient, V1UsageClient, } from './account.js';
3
- export { V1AiProvidersClient } from './aiProviders.js';
3
+ export { V1AiClient, V1AiCredentialsClient, V1AiModelsClient } from './ai.js';
4
4
  export { V1BrowserExtensionsClient } from './browserExtensions.js';
5
5
  export { BctrlError, BctrlApiError, BctrlAuthenticationError, BctrlConflictError, BctrlNetworkError, BctrlNotFoundError, BctrlNotReadyError, BctrlPermissionError, BctrlRateLimitError, BctrlUnsupportedError, BctrlValidationError, isControllerBusy, } from './errors.js';
6
6
  export { V1FilesClient } from './files.js';
7
7
  export { V1HelpClient } from './help.js';
8
8
  export { V1RuntimeBrowserUseInvocationsNamespaceClient, V1RuntimeInvocationsNamespaceClient, V1RuntimeStagehandInvocationsNamespaceClient, } from './invocations.js';
9
9
  export type { BrowserUseAgentOptions, V1InvocationCreateAndWaitOptions, V1InvocationWaitOptions, V1RuntimeInvocationCreateInput, StagehandActOptions, StagehandAgentOptions, StagehandExtractOptions, StagehandObserveOptions, StagehandVariablePrimitive, StagehandVariableValue, StagehandVariables, } from './invocations.js';
10
- export { V1RuntimeFilesNamespaceClient, V1RuntimeRunsNamespaceClient, V1RuntimesClient, } from './runtimes.js';
10
+ export { V1RuntimeFilesNamespaceClient, V1RuntimeRunsNamespaceClient, V1RuntimeTargetsNamespaceClient, V1RuntimesClient, } from './runtimes.js';
11
11
  export { V1ProxiesClient, V1ProxyPoolsClient } from './proxies.js';
12
12
  export { V1RunActivityNamespaceClient, V1RunEventsNamespaceClient, V1RunFilesNamespaceClient, V1RunInvocationsNamespaceClient, V1RunsClient, } from './runs.js';
13
13
  export { toOutputSchema, type JsonSchemaLike, type JsonSchemaObject } from './schemas.js';
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  export { Bctrl, BctrlV1 } from './bctrl.js';
2
2
  export { V1AccountClient, V1ApiKeysClient, V1AuthClient, V1SubaccountsClient, V1SubaccountUsageClient, V1UsageClient, } from './account.js';
3
- export { V1AiProvidersClient } from './aiProviders.js';
3
+ export { V1AiClient, V1AiCredentialsClient, V1AiModelsClient } from './ai.js';
4
4
  export { V1BrowserExtensionsClient } from './browserExtensions.js';
5
5
  export { BctrlError, BctrlApiError, BctrlAuthenticationError, BctrlConflictError, BctrlNetworkError, BctrlNotFoundError, BctrlNotReadyError, BctrlPermissionError, BctrlRateLimitError, BctrlUnsupportedError, BctrlValidationError, isControllerBusy, } from './errors.js';
6
6
  export { V1FilesClient } from './files.js';
7
7
  export { V1HelpClient } from './help.js';
8
8
  export { V1RuntimeBrowserUseInvocationsNamespaceClient, V1RuntimeInvocationsNamespaceClient, V1RuntimeStagehandInvocationsNamespaceClient, } from './invocations.js';
9
- export { V1RuntimeFilesNamespaceClient, V1RuntimeRunsNamespaceClient, V1RuntimesClient, } from './runtimes.js';
9
+ export { V1RuntimeFilesNamespaceClient, V1RuntimeRunsNamespaceClient, V1RuntimeTargetsNamespaceClient, V1RuntimesClient, } from './runtimes.js';
10
10
  export { V1ProxiesClient, V1ProxyPoolsClient } from './proxies.js';
11
11
  export { V1RunActivityNamespaceClient, V1RunEventsNamespaceClient, V1RunFilesNamespaceClient, V1RunInvocationsNamespaceClient, V1RunsClient, } from './runs.js';
12
12
  export { toOutputSchema } from './schemas.js';
@@ -1,6 +1,6 @@
1
1
  import { type V1HttpClient, type V1IdempotencyOptions } from './http.js';
2
2
  import { type JsonSchemaLike } from './schemas.js';
3
- import type { JsonObject, V1Invocation, V1InvocationPage, V1RuntimeInvocationCreateRequest, V1RuntimeInvocationFileInput, V1InvocationWaitRequest, V1InvocationWaitResponse } from './types.js';
3
+ import type { JsonObject, V1Invocation, V1RuntimeInvocationCreateRequest, V1RuntimeInvocationFileInput, V1RuntimeTargetSelector, V1InvocationWaitRequest, V1InvocationWaitResponse, V1AiModelSelection } from './types.js';
4
4
  export type StagehandVariablePrimitive = string | number | boolean;
5
5
  export type StagehandVariableValue = StagehandVariablePrimitive | {
6
6
  value: StagehandVariablePrimitive;
@@ -8,7 +8,7 @@ export type StagehandVariableValue = StagehandVariablePrimitive | {
8
8
  };
9
9
  export type StagehandVariables = Record<string, StagehandVariableValue>;
10
10
  interface RuntimeInvocationCommonOptions {
11
- page?: V1InvocationPage;
11
+ target?: V1RuntimeTargetSelector;
12
12
  metadata?: JsonObject;
13
13
  }
14
14
  interface RuntimeAgentCommonOptions extends RuntimeInvocationCommonOptions {
@@ -16,17 +16,18 @@ interface RuntimeAgentCommonOptions extends RuntimeInvocationCommonOptions {
16
16
  toolIds?: string[];
17
17
  files?: V1RuntimeInvocationFileInput[];
18
18
  schema?: JsonSchemaLike;
19
- outputSchema?: JsonObject;
20
19
  timeoutMs?: number;
21
20
  }
22
21
  interface AiSelectionOptions {
23
- aiProviderId?: string;
24
- model?: string;
22
+ model?: V1AiModelSelection;
25
23
  temperature?: number;
26
24
  }
25
+ type StagehandActionInput = Extract<V1RuntimeInvocationCreateRequest, {
26
+ action: 'act';
27
+ }>['stagehandAction'];
27
28
  export interface StagehandActOptions extends RuntimeInvocationCommonOptions, AiSelectionOptions {
28
29
  instruction: string;
29
- stagehandAction?: JsonObject;
30
+ stagehandAction?: StagehandActionInput;
30
31
  timeoutMs?: number;
31
32
  }
32
33
  export interface StagehandObserveOptions extends RuntimeInvocationCommonOptions, AiSelectionOptions {
@@ -44,15 +45,15 @@ export interface StagehandAgentOptions extends RuntimeAgentCommonOptions, AiSele
44
45
  instruction: string;
45
46
  maxSteps?: number;
46
47
  variables?: StagehandVariables;
47
- executionAiProviderId?: string;
48
+ executionModel?: V1AiModelSelection;
48
49
  systemPrompt?: string;
49
50
  highlightCursor?: boolean;
50
51
  }
51
52
  export interface BrowserUseAgentOptions extends RuntimeAgentCommonOptions, AiSelectionOptions {
52
53
  instruction: string;
53
54
  maxSteps?: number;
54
- extractionAiProviderId?: string;
55
- fallbackAiProviderId?: string;
55
+ extractionModel?: V1AiModelSelection;
56
+ fallbackModel?: V1AiModelSelection;
56
57
  useVision?: boolean | 'auto';
57
58
  visionDetailLevel?: 'low' | 'high' | 'auto';
58
59
  flashMode?: boolean;
@@ -70,7 +71,6 @@ export interface BrowserUseAgentOptions extends RuntimeAgentCommonOptions, AiSel
70
71
  }
71
72
  type InvocationCreateWithSchema<T extends V1RuntimeInvocationCreateRequest> = Omit<T, 'outputSchema'> & {
72
73
  schema?: JsonSchemaLike;
73
- outputSchema?: JsonObject;
74
74
  };
75
75
  type ExtractInvocationCreateRequest = Extract<V1RuntimeInvocationCreateRequest, {
76
76
  action: 'extract';
@@ -162,9 +162,6 @@ function prepareInvocationCreateRequest(request) {
162
162
  if (!hasInvocationSchema(request)) {
163
163
  return request;
164
164
  }
165
- if ('outputSchema' in request && request.outputSchema !== undefined) {
166
- throw new TypeError('Pass either schema or outputSchema, not both');
167
- }
168
165
  const { schema, ...body } = request;
169
166
  return {
170
167
  ...body,
package/dist/node.d.ts CHANGED
@@ -5,8 +5,106 @@ type V1HostedToolCreateRequest = Extract<V1ToolCreateRequest, {
5
5
  }>;
6
6
  export declare function createHostedToolFromFile(client: BctrlV1, request: Omit<V1HostedToolCreateRequest, 'source'> & {
7
7
  filePath: string;
8
- }): Promise<import("./types.js").V1Tool>;
8
+ }): Promise<{
9
+ builtin: "files" | "vault" | "captcha";
10
+ createdAt: string;
11
+ description: string | null;
12
+ id: string;
13
+ inputSchema: {
14
+ [key: string]: unknown;
15
+ };
16
+ metadata?: import("./generated/openapi-types.js").components["schemas"]["ToolMetadata"] | null;
17
+ name: string;
18
+ outputSchema: {
19
+ [key: string]: unknown;
20
+ };
21
+ spaceId: string | null;
22
+ status: "enabled" | "disabled";
23
+ type: "builtin";
24
+ updatedAt: string;
25
+ } | {
26
+ createdAt: string;
27
+ currentVersionId: string | null;
28
+ description: string | null;
29
+ id: string;
30
+ inputSchema: {
31
+ [key: string]: unknown;
32
+ };
33
+ metadata?: import("./generated/openapi-types.js").components["schemas"]["ToolMetadata"] | null;
34
+ name: string;
35
+ outputSchema: {
36
+ [key: string]: unknown;
37
+ };
38
+ spaceId: string | null;
39
+ status: "enabled" | "disabled";
40
+ type: "hosted";
41
+ updatedAt: string;
42
+ } | {
43
+ createdAt: string;
44
+ description: string | null;
45
+ id: string;
46
+ inputSchema: {
47
+ [key: string]: unknown;
48
+ };
49
+ metadata?: import("./generated/openapi-types.js").components["schemas"]["ToolMetadata"] | null;
50
+ name: string;
51
+ outputSchema: {
52
+ [key: string]: unknown;
53
+ };
54
+ serverId: string;
55
+ spaceId: string | null;
56
+ status: "enabled" | "disabled";
57
+ toolName: string;
58
+ type: "mcp";
59
+ updatedAt: string;
60
+ } | {
61
+ authSecretId?: string;
62
+ createdAt: string;
63
+ description: string | null;
64
+ id: string;
65
+ inputSchema: {
66
+ [key: string]: unknown;
67
+ };
68
+ metadata?: import("./generated/openapi-types.js").components["schemas"]["ToolMetadata"] | null;
69
+ name: string;
70
+ outputSchema: {
71
+ [key: string]: unknown;
72
+ };
73
+ spaceId: string | null;
74
+ status: "enabled" | "disabled";
75
+ timeoutMs?: number;
76
+ type: "webhook";
77
+ updatedAt: string;
78
+ url: string;
79
+ } | {
80
+ createdAt: string;
81
+ description: string | null;
82
+ id: string;
83
+ inputSchema: {
84
+ [key: string]: unknown;
85
+ };
86
+ metadata?: import("./generated/openapi-types.js").components["schemas"]["ToolMetadata"] | null;
87
+ name: string;
88
+ outputSchema: {
89
+ [key: string]: unknown;
90
+ };
91
+ spaceId: string | null;
92
+ status: "enabled" | "disabled";
93
+ type: "workflow";
94
+ updatedAt: string;
95
+ workflowId: string;
96
+ }>;
9
97
  export declare function createToolVersionFromFile(client: BctrlV1, toolId: string, request: Omit<V1ToolVersionCreateRequest, 'source'> & {
10
98
  filePath: string;
11
- }): Promise<import("./types.js").V1ToolVersion>;
99
+ }): Promise<{
100
+ createdAt: string;
101
+ current: boolean;
102
+ envKeys: string[];
103
+ id: string;
104
+ metadata?: import("./generated/openapi-types.js").components["schemas"]["ToolMetadata"] | null;
105
+ source: string;
106
+ timeoutMs: number;
107
+ toolId: string;
108
+ version: number;
109
+ }>;
12
110
  export {};
@@ -0,0 +1,7 @@
1
+ import type { components, operations } from './generated/openapi-types.js';
2
+ export type OpenApiSchemas = components['schemas'];
3
+ export type OpenApiQuery<OperationId extends keyof operations> = operations[OperationId] extends {
4
+ parameters: {
5
+ query?: infer Query;
6
+ };
7
+ } ? NonNullable<Query> : never;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,10 @@
1
- export type V1ProxyProtocol = 'http' | 'socks5';
2
- export type V1ProxyType = 'custom' | 'managed-rotating' | 'managed-static';
3
- export type V1ManagedRotatingPreference = 'balanced' | 'speed' | 'quality' | 'coverage';
4
- export type V1ManagedRotatingRotation = 'sticky' | 'rotating';
5
- export type V1ManagedRotatingDevice = 'windows' | 'macos' | 'linux' | 'android' | 'ios';
1
+ import type { OpenApiQuery, OpenApiSchemas } from './openapi.js';
2
+ export type V1ProxyProtocol = NonNullable<OpenApiSchemas['ProxyManagedRotatingCreateRequest']['protocol']>;
3
+ export type V1ProxyDnsResolution = NonNullable<OpenApiSchemas['ProxyManagedRotatingCreateRequest']['dnsResolution']>;
4
+ export type V1ProxyType = OpenApiSchemas['Proxy']['type'];
5
+ export type V1ManagedRotatingPreference = NonNullable<OpenApiSchemas['ProxyManagedRotatingCreateRequest']['preference']>;
6
+ export type V1ManagedRotatingRotation = NonNullable<OpenApiSchemas['ProxyManagedRotatingCreateRequest']['rotation']>;
7
+ export type V1ManagedRotatingDevice = NonNullable<OpenApiSchemas['ProxyManagedRotatingCreateRequest']['device']>;
6
8
  export interface V1ProxyBase {
7
9
  id: string;
8
10
  name: string;
@@ -10,105 +12,12 @@ export interface V1ProxyBase {
10
12
  createdAt: string;
11
13
  updatedAt: string;
12
14
  }
13
- export interface V1ManagedRotatingProxyConfig {
14
- protocol?: V1ProxyProtocol;
15
- ipFamily?: 'dual-stack' | 'ipv4-only';
16
- preference?: V1ManagedRotatingPreference;
17
- rotation?: V1ManagedRotatingRotation;
18
- stickyKey?: string;
19
- country?: string;
20
- region?: string;
21
- state?: string;
22
- city?: string;
23
- isp?: string;
24
- geoStrict?: boolean;
25
- device?: V1ManagedRotatingDevice;
26
- deviceStrict?: boolean;
27
- }
28
- export type V1Proxy = (V1ProxyBase & {
29
- type: 'custom';
30
- protocol: V1ProxyProtocol;
31
- host: string;
32
- port: number;
33
- username?: string | null;
34
- hasPassword: boolean;
35
- }) | (V1ProxyBase & V1ManagedRotatingProxyConfig & {
36
- type: 'managed-rotating';
37
- }) | (V1ProxyBase & {
38
- type: 'managed-static';
39
- status: 'provisioning' | 'active' | 'expired' | 'renewal_failed';
40
- poolId: string;
41
- autoRenew: boolean;
42
- assignedIp?: string;
43
- location?: {
44
- country: string;
45
- city?: string;
46
- };
47
- expiresAt?: string;
48
- renewsAt?: string | null;
49
- pricing?: {
50
- priceCredits: number;
51
- termDays: number;
52
- };
53
- });
54
- export type V1ProxyCreateRequest = {
55
- type: 'custom';
56
- name?: string;
57
- url?: string;
58
- protocol?: V1ProxyProtocol;
59
- host?: string;
60
- port?: number;
61
- username?: string;
62
- password?: string;
63
- } | ({
64
- type: 'managed-rotating';
65
- name?: string;
66
- } & V1ManagedRotatingProxyConfig) | {
67
- type: 'managed-static';
68
- name?: string;
69
- poolId: string;
70
- autoRenew?: boolean;
71
- };
72
- export interface V1ProxyUpdateRequest extends Partial<V1ManagedRotatingProxyConfig> {
73
- name?: string;
74
- url?: string;
75
- protocol?: V1ProxyProtocol;
76
- host?: string;
77
- port?: number;
78
- username?: string | null;
79
- password?: string | null;
80
- autoRenew?: boolean;
81
- }
82
- interface V1ProxyPageQuery {
83
- cursor?: string;
84
- limit?: number;
85
- }
86
- export interface V1ProxyListQuery extends V1ProxyPageQuery {
87
- }
88
- export interface V1ProxyDeleteResponse {
89
- id: string;
90
- deleted: true;
91
- }
92
- export interface V1ProxyTestResponse {
93
- ok: boolean;
94
- latencyMs?: number;
95
- error?: string;
96
- httpStatus?: number | null;
97
- exitIp?: string | null;
98
- country?: string | null;
99
- }
100
- export interface V1ProxyPool {
101
- id: string;
102
- label: string;
103
- country: string;
104
- category: 'tickets' | 'sneakers' | 'social' | 'retail';
105
- termDays: number;
106
- priceCredits: number;
107
- availableCount: number;
108
- }
109
- export interface V1ProxyPoolListQuery extends V1ProxyPageQuery {
110
- country?: string;
111
- category?: V1ProxyPool['category'];
112
- available?: boolean;
113
- }
114
- export {};
15
+ export type V1ManagedRotatingProxyConfig = Omit<OpenApiSchemas['ProxyManagedRotatingCreateRequest'], 'name' | 'type'>;
16
+ export type V1Proxy = OpenApiSchemas['Proxy'];
17
+ export type V1ProxyCreateRequest = OpenApiSchemas['ProxyCreateRequest'];
18
+ export type V1ProxyUpdateRequest = OpenApiSchemas['ProxyUpdateRequest'];
19
+ export type V1ProxyListQuery = OpenApiQuery<'proxies.list'>;
20
+ export type V1ProxyDeleteResponse = OpenApiSchemas['ProxyDeleteResponse'];
21
+ export type V1ProxyTestResponse = OpenApiSchemas['ProxyTestResponse'];
22
+ export type V1ProxyPool = OpenApiSchemas['ProxyPool'];
23
+ export type V1ProxyPoolListQuery = OpenApiQuery<'proxies.pools.list'>;
package/dist/runs.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type V1HttpClient, type V1IdempotencyOptions } from './http.js';
2
- import type { V1ListEnvelope, V1File, V1InvocationSummary, V1Run, V1RunEvent, V1RunEventsListQuery, V1RunListQuery, V1RunLiveRequest, V1RunLiveResponse, V1RunRecordingRequest, V1RunRecordingResponse, V1RunActivityItem, V1RunActivityListQuery, V1RunFilesExportRequest, V1RunFilesListQuery, V1RunInvocationsListQuery, V1RunUsage } from './types.js';
2
+ import type { V1ListEnvelope, V1File, V1Run, V1RunEvent, V1RunEventsListQuery, V1RunListQuery, V1RunLiveRequest, V1RunLiveResponse, V1RunRecordingRequest, V1RunRecordingResponse, V1RunActivityItem, V1RunActivityListQuery, V1RunFilesExportRequest, V1RunFilesListQuery, V1RunInvocationsListQuery, V1RunUsage } from './types.js';
3
3
  export declare class V1RunsClient {
4
4
  private readonly http;
5
5
  readonly events: V1RunEventsNamespaceClient;
@@ -31,14 +31,94 @@ export declare class V1RunActivityNamespaceClient {
31
31
  export declare class V1RunFilesNamespaceClient {
32
32
  private readonly http;
33
33
  constructor(http: V1HttpClient);
34
- list(runId: string, query?: V1RunFilesListQuery): Promise<V1ListEnvelope<V1File>>;
35
- iter(runId: string, query?: V1RunFilesListQuery): AsyncGenerator<V1File, void, undefined>;
34
+ list(runId: string, query?: V1RunFilesListQuery): Promise<V1ListEnvelope<{
35
+ contentType: string;
36
+ createdAt: string;
37
+ downloadUrl: string;
38
+ expiresAt?: string;
39
+ id: string;
40
+ metadata?: import("./generated/openapi-types.js").components["schemas"]["JsonObject"] | null;
41
+ name: string;
42
+ path: string;
43
+ runId?: string;
44
+ runtimeId?: string;
45
+ sizeBytes: number;
46
+ source: "upload" | "runtime";
47
+ spaceId: string;
48
+ type?: string;
49
+ }>>;
50
+ iter(runId: string, query?: V1RunFilesListQuery): AsyncGenerator<{
51
+ contentType: string;
52
+ createdAt: string;
53
+ downloadUrl: string;
54
+ expiresAt?: string;
55
+ id: string;
56
+ metadata?: import("./generated/openapi-types.js").components["schemas"]["JsonObject"] | null;
57
+ name: string;
58
+ path: string;
59
+ runId?: string;
60
+ runtimeId?: string;
61
+ sizeBytes: number;
62
+ source: "upload" | "runtime";
63
+ spaceId: string;
64
+ type?: string;
65
+ }, void, undefined>;
36
66
  export(runId: string, request?: V1RunFilesExportRequest, options?: V1IdempotencyOptions): Promise<V1File>;
37
67
  }
38
68
  export declare class V1RunInvocationsNamespaceClient {
39
69
  private readonly http;
40
70
  constructor(http: V1HttpClient);
41
- list(runId: string, query?: V1RunInvocationsListQuery): Promise<V1ListEnvelope<V1InvocationSummary>>;
42
- iter(runId: string, query?: V1RunInvocationsListQuery): AsyncGenerator<V1InvocationSummary, void, undefined>;
43
- get(runId: string, invocationId: string): Promise<import("./types.js").V1Invocation>;
71
+ list(runId: string, query?: V1RunInvocationsListQuery): Promise<V1ListEnvelope<{
72
+ action: "act" | "observe" | "extract" | "browserUse" | "stagehandAgent" | "solveCaptcha";
73
+ createdAt: string;
74
+ durationMs?: number | null;
75
+ error?: {
76
+ code?: string;
77
+ details?: {
78
+ [key: string]: unknown;
79
+ };
80
+ message: string;
81
+ } | null;
82
+ finishedAt?: string | null;
83
+ id: string;
84
+ runId: string;
85
+ runtimeId: string;
86
+ status: "queued" | "dispatching" | "running" | "cancelling" | "succeeded" | "failed" | "cancelled" | "timed_out";
87
+ }>>;
88
+ iter(runId: string, query?: V1RunInvocationsListQuery): AsyncGenerator<{
89
+ action: "act" | "observe" | "extract" | "browserUse" | "stagehandAgent" | "solveCaptcha";
90
+ createdAt: string;
91
+ durationMs?: number | null;
92
+ error?: {
93
+ code?: string;
94
+ details?: {
95
+ [key: string]: unknown;
96
+ };
97
+ message: string;
98
+ } | null;
99
+ finishedAt?: string | null;
100
+ id: string;
101
+ runId: string;
102
+ runtimeId: string;
103
+ status: "queued" | "dispatching" | "running" | "cancelling" | "succeeded" | "failed" | "cancelled" | "timed_out";
104
+ }, void, undefined>;
105
+ get(runId: string, invocationId: string): Promise<{
106
+ action: "act" | "observe" | "extract" | "browserUse" | "stagehandAgent" | "solveCaptcha";
107
+ createdAt: string;
108
+ durationMs?: number | null;
109
+ error?: {
110
+ code: "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";
111
+ details?: {
112
+ [key: string]: unknown;
113
+ };
114
+ message: string;
115
+ } | null;
116
+ finishedAt?: string | null;
117
+ id: string;
118
+ output?: import("./generated/openapi-types.js").components["schemas"]["JsonValue"];
119
+ runId: string;
120
+ runtimeId: string;
121
+ startedAt?: string | null;
122
+ status: "queued" | "dispatching" | "running" | "cancelling" | "succeeded" | "failed" | "cancelled" | "timed_out";
123
+ }>;
44
124
  }
@@ -1,17 +1,22 @@
1
1
  import { type V1HttpClient, type V1IdempotencyOptions } from './http.js';
2
2
  import { V1RuntimeInvocationsNamespaceClient } from './invocations.js';
3
- import type { V1ListEnvelope, V1File, V1Runtime, V1RuntimeCreateRequest, V1RuntimeFileCollectRequest, V1RuntimeFilesListQuery, V1RuntimeFileStageRequest, V1RuntimeFileUploadRequest, V1RuntimeStagedFile, V1RuntimeListQuery, V1RuntimeRunListQuery, V1RuntimeStartResponse, V1RuntimeStopResponse, V1RunSummary, V1SpaceRuntimeCreateRequest } from './types.js';
3
+ import type { V1ListEnvelope, V1File, V1Runtime, V1RuntimeCreateRequest, V1RuntimeDeleteResponse, V1RuntimeFileCollectRequest, V1RuntimeFilesListQuery, V1RuntimeFileStageRequest, V1RuntimeFileUploadRequest, V1RuntimeStagedFile, V1RuntimeListQuery, V1RuntimeRunListQuery, V1RuntimeStartResponse, V1RuntimeStopResponse, V1RuntimeTarget, V1RuntimeTargetCreateRequest, V1RuntimeUpdateRequest, V1RunSummary, V1SpaceRuntimeCreateRequest } from './types.js';
4
4
  export type V1RuntimeStartResult = V1RuntimeStartResponse;
5
5
  export declare class V1RuntimesClient {
6
6
  private readonly http;
7
7
  readonly files: V1RuntimeFilesNamespaceClient;
8
8
  readonly runs: V1RuntimeRunsNamespaceClient;
9
9
  readonly invocations: V1RuntimeInvocationsNamespaceClient;
10
+ readonly targets: V1RuntimeTargetsNamespaceClient;
10
11
  constructor(http: V1HttpClient);
11
12
  list(query?: V1RuntimeListQuery): Promise<V1ListEnvelope<V1Runtime>>;
12
13
  iter(query?: V1RuntimeListQuery): AsyncGenerator<V1Runtime, void, undefined>;
13
14
  create(request: V1RuntimeCreateRequest): Promise<V1Runtime>;
14
15
  createInSpace(spaceId: string, request: V1SpaceRuntimeCreateRequest): Promise<V1Runtime>;
16
+ update(id: string, request: V1RuntimeUpdateRequest): Promise<V1Runtime>;
17
+ delete(id: string, options?: {
18
+ force?: boolean;
19
+ }): Promise<V1RuntimeDeleteResponse>;
15
20
  get(id: string): Promise<V1Runtime>;
16
21
  stop(id: string): Promise<V1RuntimeStopResponse>;
17
22
  start(id: string, options?: V1IdempotencyOptions): Promise<V1RuntimeStartResult>;
@@ -31,3 +36,15 @@ export declare class V1RuntimeFilesNamespaceClient {
31
36
  stage(runtimeId: string, request: V1RuntimeFileStageRequest): Promise<V1RuntimeStagedFile>;
32
37
  collect(runtimeId: string, request: V1RuntimeFileCollectRequest): Promise<V1File>;
33
38
  }
39
+ export declare class V1RuntimeTargetsNamespaceClient {
40
+ private readonly http;
41
+ constructor(http: V1HttpClient);
42
+ list(runtimeId: string): Promise<V1ListEnvelope<V1RuntimeTarget>>;
43
+ create(runtimeId: string, request?: V1RuntimeTargetCreateRequest): Promise<V1RuntimeTarget>;
44
+ get(runtimeId: string, targetId: string): Promise<V1RuntimeTarget>;
45
+ activate(runtimeId: string, targetId: string): Promise<V1RuntimeTarget>;
46
+ delete(runtimeId: string, targetId: string): Promise<{
47
+ id: string;
48
+ deleted: boolean;
49
+ }>;
50
+ }
package/dist/runtimes.js CHANGED
@@ -1,4 +1,3 @@
1
- import { BctrlValidationError } from './errors.js';
2
1
  import { v1IdempotencyHeaders } from './http.js';
3
2
  import { V1RuntimeInvocationsNamespaceClient } from './invocations.js';
4
3
  import { iterateV1Pages } from './pagination.js';
@@ -62,16 +61,30 @@ class V1RuntimeFilesClient {
62
61
  });
63
62
  }
64
63
  }
65
- function validateRuntimeCreateRequest(request) {
66
- const profileBacked = request.config?.profile === true;
67
- if (!profileBacked)
68
- return;
69
- if (!request.name?.trim()) {
70
- throw new BctrlValidationError('name is required when config.profile is true', 'runtime.profile_name_required');
64
+ class V1RuntimeTargetsClient {
65
+ http;
66
+ runtimeId;
67
+ constructor(http, runtimeId) {
68
+ this.http = http;
69
+ this.runtimeId = runtimeId;
71
70
  }
72
- const unsupported = ['stealth', 'proxy', 'fingerprint', 'extensionIds'].filter((key) => request.config?.[key] !== undefined);
73
- if (unsupported.length > 0) {
74
- throw new BctrlValidationError('Only config.profile, config.idleTimeoutMinutes, config.webRtcProxyOnly, config.forceOpenShadowRoots, and config.networkTraffic are supported for profile-backed browser runtimes', 'runtime.profile_config_unsupported', { unsupported });
71
+ list() {
72
+ return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/targets`);
73
+ }
74
+ create(request = {}) {
75
+ return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/targets`, {
76
+ method: 'POST',
77
+ body: request,
78
+ });
79
+ }
80
+ get(targetId) {
81
+ return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/targets/${encodeURIComponent(targetId)}`);
82
+ }
83
+ activate(targetId) {
84
+ return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/targets/${encodeURIComponent(targetId)}/activate`, { method: 'POST' });
85
+ }
86
+ delete(targetId) {
87
+ return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/targets/${encodeURIComponent(targetId)}`, { method: 'DELETE' });
75
88
  }
76
89
  }
77
90
  export class V1RuntimesClient {
@@ -79,11 +92,13 @@ export class V1RuntimesClient {
79
92
  files;
80
93
  runs;
81
94
  invocations;
95
+ targets;
82
96
  constructor(http) {
83
97
  this.http = http;
84
98
  this.files = new V1RuntimeFilesNamespaceClient(http);
85
99
  this.runs = new V1RuntimeRunsNamespaceClient(http);
86
100
  this.invocations = new V1RuntimeInvocationsNamespaceClient(http);
101
+ this.targets = new V1RuntimeTargetsNamespaceClient(http);
87
102
  }
88
103
  list(query = {}) {
89
104
  return this.http.request('/runtimes', { query });
@@ -92,19 +107,26 @@ export class V1RuntimesClient {
92
107
  return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
93
108
  }
94
109
  async create(request) {
95
- validateRuntimeCreateRequest(request);
96
110
  return this.http.request('/runtimes', {
97
111
  method: 'POST',
98
112
  body: request,
99
113
  });
100
114
  }
101
115
  async createInSpace(spaceId, request) {
102
- validateRuntimeCreateRequest(request);
103
116
  return this.http.request('/runtimes', {
104
117
  method: 'POST',
105
118
  body: { ...request, spaceId },
106
119
  });
107
120
  }
121
+ update(id, request) {
122
+ return this.http.request(`/runtimes/${encodeURIComponent(id)}`, {
123
+ method: 'PATCH',
124
+ body: request,
125
+ });
126
+ }
127
+ delete(id, options = {}) {
128
+ return this.http.request(`/runtimes/${encodeURIComponent(id)}${options.force ? '?force=true' : ''}`, { method: 'DELETE' });
129
+ }
108
130
  get(id) {
109
131
  return this.http.request(`/runtimes/${encodeURIComponent(id)}`);
110
132
  }
@@ -153,3 +175,24 @@ export class V1RuntimeFilesNamespaceClient {
153
175
  return new V1RuntimeFilesClient(this.http, runtimeId).collect(request);
154
176
  }
155
177
  }
178
+ export class V1RuntimeTargetsNamespaceClient {
179
+ http;
180
+ constructor(http) {
181
+ this.http = http;
182
+ }
183
+ list(runtimeId) {
184
+ return new V1RuntimeTargetsClient(this.http, runtimeId).list();
185
+ }
186
+ create(runtimeId, request = {}) {
187
+ return new V1RuntimeTargetsClient(this.http, runtimeId).create(request);
188
+ }
189
+ get(runtimeId, targetId) {
190
+ return new V1RuntimeTargetsClient(this.http, runtimeId).get(targetId);
191
+ }
192
+ activate(runtimeId, targetId) {
193
+ return new V1RuntimeTargetsClient(this.http, runtimeId).activate(targetId);
194
+ }
195
+ delete(runtimeId, targetId) {
196
+ return new V1RuntimeTargetsClient(this.http, runtimeId).delete(targetId);
197
+ }
198
+ }