@bctrl/sdk 1.0.2 → 1.0.3

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @bctrl/sdk
2
2
 
3
- TypeScript SDK for BCTRL v2 spaces, browser runtimes, invocations, runs, and files.
3
+ TypeScript SDK for BCTRL v1 spaces, browser runtimes, invocations, runs, and files.
4
4
 
5
5
  ## Install
6
6
 
@@ -24,10 +24,14 @@ const space = await bctrl.spaces.create({
24
24
  region: 'us-east-1',
25
25
  });
26
26
 
27
- const browser = await space.browsers.launch({
27
+ const runtime = await space.runtimes.create({
28
+ type: 'browser',
28
29
  name: 'browser-task',
29
- state: 'ephemeral',
30
+ config: {
31
+ browser: { profile: false },
32
+ },
30
33
  });
34
+ const { runtime: browser } = await runtime.start();
31
35
 
32
36
  const connection = await browser.connect();
33
37
  console.log(connection.wsUrl);
@@ -42,8 +46,8 @@ const result = await invocation.wait({ timeoutMs: 60_000 });
42
46
  console.log(result.data.status);
43
47
  ```
44
48
 
45
- The public SDK targets `https://api.bctrl.ai/v2`. For local development, pass a
46
- local origin or v2 base URL:
49
+ The public SDK targets `https://api.bctrl.ai/v1`. For local development, pass a
50
+ local origin or v1 base URL:
47
51
 
48
52
  ```ts
49
53
  const bctrl = new Bctrl({
@@ -52,11 +56,11 @@ const bctrl = new Bctrl({
52
56
  });
53
57
  ```
54
58
 
55
- `baseUrl` may include or omit `/v2`; the client normalizes either form.
59
+ `baseUrl` may include or omit `/v1`; the client normalizes either form.
56
60
 
57
61
  ## Entry points
58
62
 
59
- - `@bctrl/sdk`: v2 client, resources, errors, and public types
63
+ - `@bctrl/sdk`: v1 client, resources, errors, and public types
60
64
 
61
65
  ## Documentation
62
66
 
package/dist/bctrl.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { V2FilesClient } from './files.js';
2
- import { type V2ClientOptions } from './http.js';
3
- import { V2InvocationsClient } from './invocations.js';
4
- import { V2RunsClient } from './runs.js';
5
- import { V2RuntimesClient } from './runtimes.js';
6
- import { V2SpacesClient } from './spaces.js';
7
- export type BctrlV2Options = V2ClientOptions;
8
- export declare class BctrlV2 {
1
+ import { V1FilesClient } from './files.js';
2
+ import { type V1ClientOptions } from './http.js';
3
+ import { V1InvocationsClient } from './invocations.js';
4
+ import { V1RunsClient } from './runs.js';
5
+ import { V1RuntimesClient } from './runtimes.js';
6
+ import { V1SpacesClient } from './spaces.js';
7
+ export type BctrlV1Options = V1ClientOptions;
8
+ export declare class BctrlV1 {
9
9
  private readonly http;
10
10
  private _spaces;
11
11
  private _runtimes;
@@ -13,11 +13,11 @@ export declare class BctrlV2 {
13
13
  private _invocations;
14
14
  private _files;
15
15
  static isControllerBusy(error: unknown): boolean;
16
- constructor(options?: BctrlV2Options);
17
- get spaces(): V2SpacesClient;
18
- get runtimes(): V2RuntimesClient;
19
- get runs(): V2RunsClient;
20
- get invocations(): V2InvocationsClient;
21
- get files(): V2FilesClient;
16
+ constructor(options?: BctrlV1Options);
17
+ get spaces(): V1SpacesClient;
18
+ get runtimes(): V1RuntimesClient;
19
+ get runs(): V1RunsClient;
20
+ get invocations(): V1InvocationsClient;
21
+ get files(): V1FilesClient;
22
22
  }
23
- export { BctrlV2 as Bctrl };
23
+ export { BctrlV1 as Bctrl };
package/dist/bctrl.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { isControllerBusy } from './errors.js';
2
- import { V2FilesClient } from './files.js';
3
- import { V2HttpClient } from './http.js';
4
- import { V2InvocationsClient } from './invocations.js';
5
- import { V2RunsClient } from './runs.js';
6
- import { V2RuntimesClient } from './runtimes.js';
7
- import { V2SpacesClient } from './spaces.js';
8
- export class BctrlV2 {
2
+ import { V1FilesClient } from './files.js';
3
+ import { V1HttpClient } from './http.js';
4
+ import { V1InvocationsClient } from './invocations.js';
5
+ import { V1RunsClient } from './runs.js';
6
+ import { V1RuntimesClient } from './runtimes.js';
7
+ import { V1SpacesClient } from './spaces.js';
8
+ export class BctrlV1 {
9
9
  http;
10
10
  _spaces = null;
11
11
  _runtimes = null;
@@ -16,27 +16,27 @@ export class BctrlV2 {
16
16
  return isControllerBusy(error);
17
17
  }
18
18
  constructor(options = {}) {
19
- this.http = new V2HttpClient(options);
19
+ this.http = new V1HttpClient(options);
20
20
  }
21
21
  get spaces() {
22
- this._spaces ??= new V2SpacesClient(this.http);
22
+ this._spaces ??= new V1SpacesClient(this.http);
23
23
  return this._spaces;
24
24
  }
25
25
  get runtimes() {
26
- this._runtimes ??= new V2RuntimesClient(this.http);
26
+ this._runtimes ??= new V1RuntimesClient(this.http);
27
27
  return this._runtimes;
28
28
  }
29
29
  get runs() {
30
- this._runs ??= new V2RunsClient(this.http);
30
+ this._runs ??= new V1RunsClient(this.http);
31
31
  return this._runs;
32
32
  }
33
33
  get invocations() {
34
- this._invocations ??= new V2InvocationsClient(this.http);
34
+ this._invocations ??= new V1InvocationsClient(this.http);
35
35
  return this._invocations;
36
36
  }
37
37
  get files() {
38
- this._files ??= new V2FilesClient(this.http);
38
+ this._files ??= new V1FilesClient(this.http);
39
39
  return this._files;
40
40
  }
41
41
  }
42
- export { BctrlV2 as Bctrl };
42
+ export { BctrlV1 as Bctrl };
package/dist/errors.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export interface V2ErrorContext {
1
+ export interface V1ErrorContext {
2
2
  status?: number;
3
3
  code?: string;
4
4
  requestId?: string;
@@ -7,43 +7,43 @@ export interface V2ErrorContext {
7
7
  }
8
8
  export declare class BctrlError extends Error {
9
9
  readonly code: string;
10
- readonly context?: V2ErrorContext;
11
- constructor(message: string, code: string, context?: V2ErrorContext);
10
+ readonly context?: V1ErrorContext;
11
+ constructor(message: string, code: string, context?: V1ErrorContext);
12
12
  toJSON(): Record<string, unknown>;
13
13
  }
14
14
  export declare class BctrlApiError extends BctrlError {
15
- constructor(message: string, code?: string, context?: V2ErrorContext);
15
+ constructor(message: string, code?: string, context?: V1ErrorContext);
16
16
  get status(): number | undefined;
17
17
  get requestId(): string | undefined;
18
18
  }
19
19
  export declare class BctrlAuthenticationError extends BctrlApiError {
20
- constructor(message: string, code?: string, context?: V2ErrorContext);
20
+ constructor(message: string, code?: string, context?: V1ErrorContext);
21
21
  }
22
22
  export declare class BctrlPermissionError extends BctrlApiError {
23
- constructor(message: string, code?: string, context?: V2ErrorContext);
23
+ constructor(message: string, code?: string, context?: V1ErrorContext);
24
24
  }
25
25
  export declare class BctrlNotFoundError extends BctrlApiError {
26
- constructor(message: string, code?: string, context?: V2ErrorContext);
26
+ constructor(message: string, code?: string, context?: V1ErrorContext);
27
27
  }
28
28
  export declare class BctrlConflictError extends BctrlApiError {
29
- constructor(message: string, code?: string, context?: V2ErrorContext);
29
+ constructor(message: string, code?: string, context?: V1ErrorContext);
30
30
  }
31
31
  export declare class BctrlRateLimitError extends BctrlApiError {
32
- constructor(message: string, code?: string, context?: V2ErrorContext);
32
+ constructor(message: string, code?: string, context?: V1ErrorContext);
33
33
  }
34
34
  export declare class BctrlValidationError extends BctrlApiError {
35
- constructor(message: string, code?: string, context?: V2ErrorContext);
35
+ constructor(message: string, code?: string, context?: V1ErrorContext);
36
36
  }
37
37
  export declare class BctrlNetworkError extends BctrlError {
38
- constructor(message: string, context?: V2ErrorContext);
38
+ constructor(message: string, context?: V1ErrorContext);
39
39
  }
40
40
  export declare class BctrlNotReadyError extends BctrlError {
41
- constructor(message: string, context?: V2ErrorContext);
41
+ constructor(message: string, context?: V1ErrorContext);
42
42
  }
43
43
  export declare class BctrlUnsupportedError extends BctrlError {
44
- constructor(message: string, context?: V2ErrorContext);
44
+ constructor(message: string, context?: V1ErrorContext);
45
45
  }
46
- export declare function createV2HttpError(input: {
46
+ export declare function createV1HttpError(input: {
47
47
  status: number;
48
48
  message: string;
49
49
  code?: string;
package/dist/errors.js CHANGED
@@ -82,7 +82,7 @@ export class BctrlUnsupportedError extends BctrlError {
82
82
  this.name = 'BctrlUnsupportedError';
83
83
  }
84
84
  }
85
- export function createV2HttpError(input) {
85
+ export function createV1HttpError(input) {
86
86
  const context = {
87
87
  status: input.status,
88
88
  requestId: input.requestId,
package/dist/files.d.ts CHANGED
@@ -1,31 +1,31 @@
1
- import type { V2HttpClient } from './http.js';
2
- import type { V2File, V2FileDeleteResponse, V2FilesListQuery, V2FileUpdateRequest, V2FileUploadRequest, V2ListEnvelope, V2RunFilesExportRequest, V2RunFilesListQuery } from './types.js';
3
- export declare class V2FileResource {
1
+ import type { V1HttpClient } from './http.js';
2
+ import type { V1File, V1FileDeleteResponse, V1FilesListQuery, V1FileUpdateRequest, V1FileUploadRequest, V1ListEnvelope, V1RunFilesExportRequest, V1RunFilesListQuery } from './types.js';
3
+ export declare class V1FileResource {
4
4
  private readonly http;
5
- readonly data: V2File;
6
- constructor(http: V2HttpClient, data: V2File);
5
+ readonly data: V1File;
6
+ constructor(http: V1HttpClient, data: V1File);
7
7
  get id(): string;
8
- refresh(): Promise<V2FileResource>;
8
+ refresh(): Promise<V1FileResource>;
9
9
  content(): Promise<Response>;
10
- update(request: V2FileUpdateRequest): Promise<V2FileResource>;
11
- delete(): Promise<V2FileDeleteResponse>;
10
+ update(request: V1FileUpdateRequest): Promise<V1FileResource>;
11
+ delete(): Promise<V1FileDeleteResponse>;
12
12
  }
13
- export declare class V2FilesClient {
13
+ export declare class V1FilesClient {
14
14
  private readonly http;
15
- constructor(http: V2HttpClient);
16
- list(query: V2FilesListQuery): Promise<V2ListEnvelope<V2File>>;
17
- iter(query: V2FilesListQuery): AsyncGenerator<V2File, void, undefined>;
18
- get(id: string): Promise<V2FileResource>;
19
- update(id: string, request: V2FileUpdateRequest): Promise<V2FileResource>;
15
+ constructor(http: V1HttpClient);
16
+ list(query: V1FilesListQuery): Promise<V1ListEnvelope<V1File>>;
17
+ iter(query: V1FilesListQuery): AsyncGenerator<V1File, void, undefined>;
18
+ get(id: string): Promise<V1FileResource>;
19
+ update(id: string, request: V1FileUpdateRequest): Promise<V1FileResource>;
20
20
  content(id: string): Promise<Response>;
21
- delete(id: string): Promise<V2FileDeleteResponse>;
22
- upload(request: V2FileUploadRequest): Promise<V2FileResource>;
21
+ delete(id: string): Promise<V1FileDeleteResponse>;
22
+ upload(request: V1FileUploadRequest): Promise<V1FileResource>;
23
23
  }
24
- export declare class V2RunFilesClient {
24
+ export declare class V1RunFilesClient {
25
25
  private readonly http;
26
26
  private readonly runId;
27
- constructor(http: V2HttpClient, runId: string);
28
- list(query?: V2RunFilesListQuery): Promise<V2ListEnvelope<V2File>>;
29
- iter(query?: V2RunFilesListQuery): AsyncGenerator<V2File, void, undefined>;
30
- export(request: V2RunFilesExportRequest): Promise<V2FileResource>;
27
+ constructor(http: V1HttpClient, runId: string);
28
+ list(query?: V1RunFilesListQuery): Promise<V1ListEnvelope<V1File>>;
29
+ iter(query?: V1RunFilesListQuery): AsyncGenerator<V1File, void, undefined>;
30
+ export(request: V1RunFilesExportRequest): Promise<V1FileResource>;
31
31
  }
package/dist/files.js CHANGED
@@ -1,5 +1,5 @@
1
- import { iterateV2Pages } from './pagination.js';
2
- export class V2FileResource {
1
+ import { iterateV1Pages } from './pagination.js';
2
+ export class V1FileResource {
3
3
  http;
4
4
  data;
5
5
  constructor(http, data) {
@@ -10,19 +10,19 @@ export class V2FileResource {
10
10
  return this.data.id;
11
11
  }
12
12
  refresh() {
13
- return new V2FilesClient(this.http).get(this.id);
13
+ return new V1FilesClient(this.http).get(this.id);
14
14
  }
15
15
  async content() {
16
- return new V2FilesClient(this.http).content(this.id);
16
+ return new V1FilesClient(this.http).content(this.id);
17
17
  }
18
18
  async update(request) {
19
- return new V2FilesClient(this.http).update(this.id, request);
19
+ return new V1FilesClient(this.http).update(this.id, request);
20
20
  }
21
21
  delete() {
22
- return new V2FilesClient(this.http).delete(this.id);
22
+ return new V1FilesClient(this.http).delete(this.id);
23
23
  }
24
24
  }
25
- export class V2FilesClient {
25
+ export class V1FilesClient {
26
26
  http;
27
27
  constructor(http) {
28
28
  this.http = http;
@@ -31,18 +31,18 @@ export class V2FilesClient {
31
31
  return this.http.request('/files', { query });
32
32
  }
33
33
  iter(query) {
34
- return iterateV2Pages(query, (pageQuery) => this.list(pageQuery));
34
+ return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
35
35
  }
36
36
  async get(id) {
37
37
  const file = await this.http.request(`/files/${encodeURIComponent(id)}`);
38
- return new V2FileResource(this.http, file);
38
+ return new V1FileResource(this.http, file);
39
39
  }
40
40
  async update(id, request) {
41
41
  const file = await this.http.request(`/files/${encodeURIComponent(id)}`, {
42
42
  method: 'PATCH',
43
43
  body: request,
44
44
  });
45
- return new V2FileResource(this.http, file);
45
+ return new V1FileResource(this.http, file);
46
46
  }
47
47
  content(id) {
48
48
  return this.http.raw(`/files/${encodeURIComponent(id)}/content`);
@@ -71,10 +71,10 @@ export class V2FilesClient {
71
71
  query: { spaceId: request.spaceId },
72
72
  body: form,
73
73
  });
74
- return new V2FileResource(this.http, file);
74
+ return new V1FileResource(this.http, file);
75
75
  }
76
76
  }
77
- export class V2RunFilesClient {
77
+ export class V1RunFilesClient {
78
78
  http;
79
79
  runId;
80
80
  constructor(http, runId) {
@@ -85,13 +85,13 @@ export class V2RunFilesClient {
85
85
  return this.http.request(`/runs/${encodeURIComponent(this.runId)}/files`, { query });
86
86
  }
87
87
  iter(query = {}) {
88
- return iterateV2Pages(query, (pageQuery) => this.list(pageQuery));
88
+ return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
89
89
  }
90
90
  async export(request) {
91
91
  const file = await this.http.request(`/runs/${encodeURIComponent(this.runId)}/files/export`, {
92
92
  method: 'POST',
93
93
  body: request,
94
94
  });
95
- return new V2FileResource(this.http, file);
95
+ return new V1FileResource(this.http, file);
96
96
  }
97
97
  }
package/dist/http.d.ts CHANGED
@@ -1,18 +1,18 @@
1
- export interface V2ClientOptions {
1
+ export interface V1ClientOptions {
2
2
  apiKey?: string;
3
3
  baseUrl?: string;
4
4
  }
5
- export interface V2RequestOptions {
5
+ export interface V1RequestOptions {
6
6
  method?: 'GET' | 'POST' | 'PATCH' | 'DELETE';
7
7
  query?: object;
8
8
  body?: unknown;
9
9
  headers?: Record<string, string>;
10
10
  timeoutMs?: number;
11
11
  }
12
- export declare class V2HttpClient {
12
+ export declare class V1HttpClient {
13
13
  readonly baseUrl: string;
14
14
  readonly apiKey: string;
15
- constructor(options: V2ClientOptions);
16
- request<T>(path: string, options?: V2RequestOptions): Promise<T>;
17
- raw(path: string, options?: V2RequestOptions): Promise<Response>;
15
+ constructor(options: V1ClientOptions);
16
+ request<T>(path: string, options?: V1RequestOptions): Promise<T>;
17
+ raw(path: string, options?: V1RequestOptions): Promise<Response>;
18
18
  }
package/dist/http.js CHANGED
@@ -1,18 +1,18 @@
1
- import { BctrlNetworkError, createV2HttpError } from './errors.js';
1
+ import { BctrlNetworkError, createV1HttpError } from './errors.js';
2
2
  import { BCTRL_PRODUCTION_ORIGIN, fetchWithTimeout, resolveApiKey, stripTrailingSlash, } from './utils.js';
3
3
  import { SDK_VERSION } from './version.js';
4
- const V2_PREFIX = '/v2';
5
- function resolveV2ApiBaseUrl(baseUrl) {
6
- const raw = stripTrailingSlash(baseUrl?.trim() || BCTRL_PRODUCTION_ORIGIN);
7
- if (raw.endsWith(V2_PREFIX)) {
4
+ const API_PREFIX = '/v1';
5
+ function resolveV1ApiBaseUrl(baseUrl) {
6
+ const raw = stripTrailingSlash(baseUrl?.trim() ||
7
+ process.env.BCTRL_BASE_URL?.trim() ||
8
+ process.env.BCTRL_API_BASE_URL?.trim() ||
9
+ BCTRL_PRODUCTION_ORIGIN);
10
+ if (raw.endsWith(API_PREFIX)) {
8
11
  return raw;
9
12
  }
10
- if (raw.endsWith('/v1')) {
11
- return `${raw.slice(0, -3)}${V2_PREFIX}`;
12
- }
13
- return `${raw}${V2_PREFIX}`;
13
+ return `${raw}${API_PREFIX}`;
14
14
  }
15
- function resolveV2ApiKey(apiKey) {
15
+ function resolveV1ApiKey(apiKey) {
16
16
  return resolveApiKey(apiKey ?? process.env.BCTRL_API_KEY ?? '');
17
17
  }
18
18
  function appendQuery(params, key, value) {
@@ -50,7 +50,7 @@ function responseRequestId(response) {
50
50
  function isRecord(value) {
51
51
  return Boolean(value && typeof value === 'object' && !Array.isArray(value));
52
52
  }
53
- function parseV2ErrorBody(parsed, fallbackText) {
53
+ function parseV1ErrorBody(parsed, fallbackText) {
54
54
  if (isRecord(parsed) && typeof parsed.error === 'string') {
55
55
  return {
56
56
  error: parsed.error,
@@ -70,12 +70,12 @@ function isBodyInit(value) {
70
70
  value instanceof URLSearchParams ||
71
71
  value instanceof ArrayBuffer);
72
72
  }
73
- export class V2HttpClient {
73
+ export class V1HttpClient {
74
74
  baseUrl;
75
75
  apiKey;
76
76
  constructor(options) {
77
- this.baseUrl = resolveV2ApiBaseUrl(options.baseUrl);
78
- this.apiKey = resolveV2ApiKey(options.apiKey);
77
+ this.baseUrl = resolveV1ApiBaseUrl(options.baseUrl);
78
+ this.apiKey = resolveV1ApiKey(options.apiKey);
79
79
  }
80
80
  async request(path, options = {}) {
81
81
  const response = await this.raw(path, options);
@@ -92,7 +92,7 @@ export class V2HttpClient {
92
92
  Accept: 'application/json',
93
93
  Authorization: `Bearer ${this.apiKey}`,
94
94
  'x-sdk-version': SDK_VERSION,
95
- 'User-Agent': `@bctrl/sdk/${SDK_VERSION} v2`,
95
+ 'User-Agent': `@bctrl/sdk/${SDK_VERSION} v1`,
96
96
  ...options.headers,
97
97
  };
98
98
  const init = {
@@ -121,8 +121,8 @@ export class V2HttpClient {
121
121
  if (!response.ok) {
122
122
  const text = await response.text();
123
123
  const parsed = parseResponseBody(text);
124
- const errorBody = parseV2ErrorBody(parsed, text);
125
- throw createV2HttpError({
124
+ const errorBody = parseV1ErrorBody(parsed, text);
125
+ throw createV1HttpError({
126
126
  status: response.status,
127
127
  message: errorBody.error,
128
128
  code: errorBody.code,
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { Bctrl, BctrlV2, type BctrlV2Options } from './bctrl.js';
1
+ export { Bctrl, BctrlV1, type BctrlV1Options } from './bctrl.js';
2
2
  export { BctrlError, BctrlApiError, BctrlAuthenticationError, BctrlConflictError, BctrlNetworkError, BctrlNotFoundError, BctrlNotReadyError, BctrlPermissionError, BctrlRateLimitError, BctrlUnsupportedError, BctrlValidationError, isControllerBusy, } from './errors.js';
3
- export { V2BrowserResource, V2SpaceBrowsersClient } from './browsers.js';
4
- export { V2FileResource, V2FilesClient, V2RunFilesClient } from './files.js';
5
- export { V2InvocationsClient, V2InvocationResource, V2RuntimeInvocationsClient, } from './invocations.js';
6
- export { V2RuntimeConnectionResource, V2RuntimeConnectionsClient, V2RuntimeFilesClient, V2RuntimeResource, V2RuntimeRunsClient, V2RuntimesClient, } from './runtimes.js';
7
- export { V2RunCommandsClient, V2RunEventsClient, V2RunResource, V2RunsClient, } from './runs.js';
8
- export { V2SpaceEnvironmentClient, V2SpaceResource, V2SpaceRuntimesClient, V2SpacesClient, } from './spaces.js';
3
+ export { V1FileResource, V1FilesClient, V1RunFilesClient } from './files.js';
4
+ export { V1InvocationsClient, V1InvocationResource, V1RuntimeBrowserUseInvocationsClient, V1RuntimeInvocationsClient, V1RuntimeStagehandInvocationsClient, } from './invocations.js';
5
+ export type { BrowserUseAgentOptions, StagehandActOptions, StagehandAgentOptions, StagehandExtractOptions, StagehandObserveOptions, StagehandVariablePrimitive, StagehandVariableValue, StagehandVariables, } from './invocations.js';
6
+ export { V1RuntimeConnectionResource, V1RuntimeConnectionsClient, V1RuntimeFilesClient, V1RuntimeResource, V1RuntimeRunsClient, V1RuntimesClient, } from './runtimes.js';
7
+ export { V1RunCommandsClient, V1RunEventsClient, V1RunResource, V1RunsClient, } from './runs.js';
8
+ export { V1SpaceEnvironmentClient, V1SpaceResource, V1SpaceRuntimesClient, V1SpacesClient, } from './spaces.js';
9
9
  export type * from './types.js';
package/dist/index.js CHANGED
@@ -1,8 +1,7 @@
1
- export { Bctrl, BctrlV2 } from './bctrl.js';
1
+ export { Bctrl, BctrlV1 } from './bctrl.js';
2
2
  export { BctrlError, BctrlApiError, BctrlAuthenticationError, BctrlConflictError, BctrlNetworkError, BctrlNotFoundError, BctrlNotReadyError, BctrlPermissionError, BctrlRateLimitError, BctrlUnsupportedError, BctrlValidationError, isControllerBusy, } from './errors.js';
3
- export { V2BrowserResource, V2SpaceBrowsersClient } from './browsers.js';
4
- export { V2FileResource, V2FilesClient, V2RunFilesClient } from './files.js';
5
- export { V2InvocationsClient, V2InvocationResource, V2RuntimeInvocationsClient, } from './invocations.js';
6
- export { V2RuntimeConnectionResource, V2RuntimeConnectionsClient, V2RuntimeFilesClient, V2RuntimeResource, V2RuntimeRunsClient, V2RuntimesClient, } from './runtimes.js';
7
- export { V2RunCommandsClient, V2RunEventsClient, V2RunResource, V2RunsClient, } from './runs.js';
8
- export { V2SpaceEnvironmentClient, V2SpaceResource, V2SpaceRuntimesClient, V2SpacesClient, } from './spaces.js';
3
+ export { V1FileResource, V1FilesClient, V1RunFilesClient } from './files.js';
4
+ export { V1InvocationsClient, V1InvocationResource, V1RuntimeBrowserUseInvocationsClient, V1RuntimeInvocationsClient, V1RuntimeStagehandInvocationsClient, } from './invocations.js';
5
+ export { V1RuntimeConnectionResource, V1RuntimeConnectionsClient, V1RuntimeFilesClient, V1RuntimeResource, V1RuntimeRunsClient, V1RuntimesClient, } from './runtimes.js';
6
+ export { V1RunCommandsClient, V1RunEventsClient, V1RunResource, V1RunsClient, } from './runs.js';
7
+ export { V1SpaceEnvironmentClient, V1SpaceResource, V1SpaceRuntimesClient, V1SpacesClient, } from './spaces.js';
@@ -1,24 +1,86 @@
1
- import type { V2HttpClient } from './http.js';
2
- import type { V2Invocation, V2RuntimeInvocationCreateRequest, V2InvocationWaitRequest, V2InvocationWaitResponse } from './types.js';
3
- export declare class V2InvocationResource {
1
+ import type { V1HttpClient } from './http.js';
2
+ import type { JsonObject, V1Invocation, V1RuntimeInvocationCreateRequest, V1RuntimeInvocationFileInput, V1InvocationWaitRequest, V1InvocationWaitResponse } from './types.js';
3
+ type JsonSchemaLike = JsonObject | {
4
+ toJSONSchema: () => unknown;
5
+ };
6
+ export type StagehandVariablePrimitive = string | number | boolean;
7
+ export type StagehandVariableValue = StagehandVariablePrimitive | {
8
+ value: StagehandVariablePrimitive;
9
+ description?: string;
10
+ };
11
+ export type StagehandVariables = Record<string, StagehandVariableValue>;
12
+ interface RuntimeInvocationCommonOptions {
13
+ target?: JsonObject;
14
+ idempotencyKey?: string;
15
+ metadata?: JsonObject;
16
+ }
17
+ interface RuntimeAgentCommonOptions extends RuntimeInvocationCommonOptions {
18
+ toolsetId?: string;
19
+ files?: V1RuntimeInvocationFileInput[];
20
+ outputSchema?: JsonObject;
21
+ }
22
+ export interface StagehandActOptions extends RuntimeInvocationCommonOptions {
23
+ instruction: string;
24
+ timeoutMs?: number;
25
+ }
26
+ export interface StagehandObserveOptions extends RuntimeInvocationCommonOptions {
27
+ instruction: string;
28
+ selector?: string;
29
+ timeoutMs?: number;
30
+ }
31
+ export type StagehandExtractOptions<TSchema extends JsonSchemaLike | undefined = undefined> = RuntimeInvocationCommonOptions & {
32
+ instruction: string;
33
+ schema?: TSchema;
34
+ };
35
+ export interface StagehandAgentOptions extends RuntimeAgentCommonOptions {
36
+ instruction: string;
37
+ maxSteps?: number;
38
+ timeoutMs?: number;
39
+ variables?: StagehandVariables;
40
+ config?: JsonObject;
41
+ options?: JsonObject;
42
+ }
43
+ export interface BrowserUseAgentOptions extends RuntimeAgentCommonOptions {
44
+ instruction: string;
45
+ maxSteps?: number;
46
+ config?: JsonObject;
47
+ options?: JsonObject;
48
+ }
49
+ export declare class V1InvocationResource {
4
50
  private readonly http;
5
- readonly data: V2Invocation;
6
- constructor(http: V2HttpClient, data: V2Invocation);
51
+ readonly data: V1Invocation;
52
+ constructor(http: V1HttpClient, data: V1Invocation);
7
53
  get id(): string;
8
- refresh(): Promise<V2Invocation>;
9
- wait(request?: V2InvocationWaitRequest): Promise<V2InvocationWaitResponse>;
10
- cancel(): Promise<V2Invocation>;
54
+ refresh(): Promise<V1Invocation>;
55
+ wait(request?: V1InvocationWaitRequest): Promise<V1InvocationWaitResponse>;
56
+ cancel(): Promise<V1Invocation>;
11
57
  }
12
- export declare class V2InvocationsClient {
58
+ export declare class V1InvocationsClient {
13
59
  private readonly http;
14
- constructor(http: V2HttpClient);
15
- get(id: string): Promise<V2InvocationResource>;
16
- wait(id: string, request?: V2InvocationWaitRequest): Promise<V2InvocationWaitResponse>;
17
- cancel(id: string): Promise<V2InvocationResource>;
60
+ constructor(http: V1HttpClient);
61
+ get(id: string): Promise<V1InvocationResource>;
62
+ wait(id: string, request?: V1InvocationWaitRequest): Promise<V1InvocationWaitResponse>;
63
+ cancel(id: string): Promise<V1InvocationResource>;
18
64
  }
19
- export declare class V2RuntimeInvocationsClient {
65
+ export declare class V1RuntimeInvocationsClient {
20
66
  private readonly http;
21
67
  private readonly runtimeId;
22
- constructor(http: V2HttpClient, runtimeId: string);
23
- create(request: V2RuntimeInvocationCreateRequest): Promise<V2InvocationResource>;
68
+ readonly stagehand: V1RuntimeStagehandInvocationsClient;
69
+ readonly browserUse: V1RuntimeBrowserUseInvocationsClient;
70
+ constructor(http: V1HttpClient, runtimeId: string);
71
+ create(request: V1RuntimeInvocationCreateRequest): Promise<V1InvocationResource>;
72
+ }
73
+ export declare class V1RuntimeStagehandInvocationsClient {
74
+ private readonly invocations;
75
+ constructor(invocations: V1RuntimeInvocationsClient);
76
+ act(options: StagehandActOptions): Promise<V1InvocationResource>;
77
+ observe(options: StagehandObserveOptions): Promise<V1InvocationResource>;
78
+ extract<TSchema extends JsonSchemaLike | undefined = undefined>(options: StagehandExtractOptions<TSchema>): Promise<V1InvocationResource>;
79
+ agent(options: StagehandAgentOptions): Promise<V1InvocationResource>;
80
+ }
81
+ export declare class V1RuntimeBrowserUseInvocationsClient {
82
+ private readonly invocations;
83
+ constructor(invocations: V1RuntimeInvocationsClient);
84
+ agent(options: BrowserUseAgentOptions): Promise<V1InvocationResource>;
24
85
  }
86
+ export {};