@bctrl/sdk 1.0.1 → 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 +28 -29
- package/dist/bctrl.d.ts +22 -36
- package/dist/bctrl.js +40 -75
- package/dist/errors.d.ts +49 -43
- package/dist/errors.js +83 -120
- package/dist/files.d.ts +31 -0
- package/dist/files.js +97 -0
- package/dist/http.d.ts +18 -0
- package/dist/http.js +135 -0
- package/dist/index.d.ts +9 -12
- package/dist/index.js +7 -23
- package/dist/invocations.d.ts +86 -0
- package/dist/invocations.js +159 -0
- package/dist/pagination.d.ts +2 -0
- package/dist/pagination.js +13 -0
- package/dist/runs.d.ts +40 -0
- package/dist/runs.js +105 -0
- package/dist/runtimes.d.ts +69 -0
- package/dist/runtimes.js +202 -0
- package/dist/spaces.d.ts +40 -0
- package/dist/spaces.js +96 -0
- package/dist/types.d.ts +413 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +27 -0
- package/dist/version.js +2 -2
- package/package.json +4 -21
- package/dist/agents/browser-use/index.d.ts +0 -1
- package/dist/agents/browser-use/index.js +0 -9
- package/dist/agents/browser-use/namespace.d.ts +0 -39
- package/dist/agents/browser-use/namespace.js +0 -93
- package/dist/agents/index.d.ts +0 -2
- package/dist/agents/index.js +0 -17
- package/dist/agents/stagehand/core.d.ts +0 -93
- package/dist/agents/stagehand/core.js +0 -144
- package/dist/agents/stagehand/index.d.ts +0 -3
- package/dist/agents/stagehand/index.js +0 -24
- package/dist/agents/stagehand/namespace.d.ts +0 -51
- package/dist/agents/stagehand/namespace.js +0 -65
- package/dist/ai-credentials/client.d.ts +0 -12
- package/dist/ai-credentials/client.js +0 -70
- package/dist/ai-credentials/index.d.ts +0 -1
- package/dist/ai-credentials/index.js +0 -1
- package/dist/base/event-binding.d.ts +0 -7
- package/dist/base/event-binding.js +0 -23
- package/dist/base/types.d.ts +0 -109
- package/dist/base/types.js +0 -4
- package/dist/browser-extensions/client.d.ts +0 -15
- package/dist/browser-extensions/client.js +0 -72
- package/dist/browser-extensions/index.d.ts +0 -2
- package/dist/browser-extensions/index.js +0 -1
- package/dist/browser-profiles/client.d.ts +0 -11
- package/dist/browser-profiles/client.js +0 -63
- package/dist/browser-profiles/index.d.ts +0 -1
- package/dist/browser-profiles/index.js +0 -1
- package/dist/captcha/index.d.ts +0 -1
- package/dist/captcha/index.js +0 -1
- package/dist/captcha/namespace.d.ts +0 -34
- package/dist/captcha/namespace.js +0 -41
- package/dist/client/index.d.ts +0 -1
- package/dist/client/index.js +0 -1
- package/dist/client/rpc.d.ts +0 -83
- package/dist/client/rpc.js +0 -354
- package/dist/config.d.ts +0 -5
- package/dist/config.js +0 -28
- package/dist/constants/browser.d.ts +0 -2
- package/dist/constants/browser.js +0 -1
- package/dist/contracts/agent-tools.d.ts +0 -45
- package/dist/contracts/agent-tools.js +0 -31
- package/dist/contracts/automation.d.ts +0 -265
- package/dist/contracts/automation.js +0 -109
- package/dist/contracts/browser-management.d.ts +0 -179
- package/dist/contracts/browser-management.js +0 -95
- package/dist/contracts/browser-use.d.ts +0 -136
- package/dist/contracts/browser-use.js +0 -93
- package/dist/contracts/captcha.d.ts +0 -114
- package/dist/contracts/captcha.js +0 -40
- package/dist/contracts/desktop.d.ts +0 -223
- package/dist/contracts/desktop.js +0 -121
- package/dist/contracts/drivers/playwright.d.ts +0 -2008
- package/dist/contracts/drivers/playwright.js +0 -2033
- package/dist/contracts/drivers/puppeteer.d.ts +0 -1221
- package/dist/contracts/drivers/puppeteer.js +0 -941
- package/dist/contracts/drivers/selenium.d.ts +0 -156
- package/dist/contracts/drivers/selenium.js +0 -61
- package/dist/contracts/drivers/stagehand.d.ts +0 -155
- package/dist/contracts/drivers/stagehand.js +0 -7
- package/dist/contracts/extensions.d.ts +0 -13
- package/dist/contracts/extensions.js +0 -9
- package/dist/contracts/index.d.ts +0 -13
- package/dist/contracts/index.js +0 -13
- package/dist/contracts/public-api.d.ts +0 -360
- package/dist/contracts/public-api.js +0 -17
- package/dist/contracts/runtime.d.ts +0 -81
- package/dist/contracts/runtime.js +0 -16
- package/dist/contracts/stagehand.d.ts +0 -253
- package/dist/contracts/stagehand.js +0 -145
- package/dist/contracts/storage.d.ts +0 -51
- package/dist/contracts/storage.js +0 -56
- package/dist/contracts/vault.d.ts +0 -119
- package/dist/contracts/vault.js +0 -112
- package/dist/contracts/version.d.ts +0 -3
- package/dist/contracts/version.js +0 -16
- package/dist/desktop.d.ts +0 -2
- package/dist/desktop.js +0 -3
- package/dist/drivers/desktop/index.d.ts +0 -65
- package/dist/drivers/desktop/index.js +0 -68
- package/dist/drivers/desktop/session.d.ts +0 -313
- package/dist/drivers/desktop/session.js +0 -432
- package/dist/drivers/playwright/event-emitter.d.ts +0 -160
- package/dist/drivers/playwright/event-emitter.js +0 -297
- package/dist/drivers/playwright/generated/api-request-context.d.ts +0 -137
- package/dist/drivers/playwright/generated/api-request-context.js +0 -154
- package/dist/drivers/playwright/generated/api-response.d.ts +0 -119
- package/dist/drivers/playwright/generated/api-response.js +0 -123
- package/dist/drivers/playwright/generated/browser-context.d.ts +0 -284
- package/dist/drivers/playwright/generated/browser-context.js +0 -458
- package/dist/drivers/playwright/generated/browser.d.ts +0 -120
- package/dist/drivers/playwright/generated/browser.js +0 -151
- package/dist/drivers/playwright/generated/clock.d.ts +0 -80
- package/dist/drivers/playwright/generated/clock.js +0 -94
- package/dist/drivers/playwright/generated/console-message.d.ts +0 -94
- package/dist/drivers/playwright/generated/console-message.js +0 -89
- package/dist/drivers/playwright/generated/coverage.d.ts +0 -57
- package/dist/drivers/playwright/generated/coverage.js +0 -66
- package/dist/drivers/playwright/generated/dialog.d.ts +0 -79
- package/dist/drivers/playwright/generated/dialog.js +0 -80
- package/dist/drivers/playwright/generated/element-handle.d.ts +0 -399
- package/dist/drivers/playwright/generated/element-handle.js +0 -501
- package/dist/drivers/playwright/generated/frame-locator.d.ts +0 -34
- package/dist/drivers/playwright/generated/frame-locator.js +0 -63
- package/dist/drivers/playwright/generated/frame.d.ts +0 -557
- package/dist/drivers/playwright/generated/frame.js +0 -634
- package/dist/drivers/playwright/generated/js-handle.d.ts +0 -72
- package/dist/drivers/playwright/generated/js-handle.js +0 -92
- package/dist/drivers/playwright/generated/keyboard.d.ts +0 -103
- package/dist/drivers/playwright/generated/keyboard.js +0 -113
- package/dist/drivers/playwright/generated/locator.d.ts +0 -795
- package/dist/drivers/playwright/generated/locator.js +0 -974
- package/dist/drivers/playwright/generated/mouse.d.ts +0 -97
- package/dist/drivers/playwright/generated/mouse.js +0 -109
- package/dist/drivers/playwright/generated/page.d.ts +0 -762
- package/dist/drivers/playwright/generated/page.js +0 -988
- package/dist/drivers/playwright/generated/touchscreen.d.ts +0 -34
- package/dist/drivers/playwright/generated/touchscreen.js +0 -37
- package/dist/drivers/playwright/generated/tracing.d.ts +0 -78
- package/dist/drivers/playwright/generated/tracing.js +0 -80
- package/dist/drivers/playwright/generated/worker.d.ts +0 -53
- package/dist/drivers/playwright/generated/worker.js +0 -59
- package/dist/drivers/playwright/index.d.ts +0 -19
- package/dist/drivers/playwright/index.js +0 -20
- package/dist/drivers/playwright/remote-base.d.ts +0 -62
- package/dist/drivers/playwright/remote-base.js +0 -86
- package/dist/drivers/playwright/types.d.ts +0 -148
- package/dist/drivers/playwright/types.js +0 -8
- package/dist/drivers/puppeteer/errors.d.ts +0 -50
- package/dist/drivers/puppeteer/errors.js +0 -71
- package/dist/drivers/puppeteer/event-emitter.d.ts +0 -145
- package/dist/drivers/puppeteer/event-emitter.js +0 -259
- package/dist/drivers/puppeteer/generated/accessibility.d.ts +0 -77
- package/dist/drivers/puppeteer/generated/accessibility.js +0 -74
- package/dist/drivers/puppeteer/generated/browser-context.d.ts +0 -116
- package/dist/drivers/puppeteer/generated/browser-context.js +0 -168
- package/dist/drivers/puppeteer/generated/browser.d.ts +0 -169
- package/dist/drivers/puppeteer/generated/browser.js +0 -246
- package/dist/drivers/puppeteer/generated/console-message.d.ts +0 -54
- package/dist/drivers/puppeteer/generated/console-message.js +0 -69
- package/dist/drivers/puppeteer/generated/coverage.d.ts +0 -49
- package/dist/drivers/puppeteer/generated/coverage.js +0 -57
- package/dist/drivers/puppeteer/generated/dialog.d.ts +0 -46
- package/dist/drivers/puppeteer/generated/dialog.js +0 -60
- package/dist/drivers/puppeteer/generated/element-handle.d.ts +0 -261
- package/dist/drivers/puppeteer/generated/element-handle.js +0 -341
- package/dist/drivers/puppeteer/generated/file-chooser.d.ts +0 -34
- package/dist/drivers/puppeteer/generated/file-chooser.js +0 -43
- package/dist/drivers/puppeteer/generated/frame.d.ts +0 -221
- package/dist/drivers/puppeteer/generated/frame.js +0 -302
- package/dist/drivers/puppeteer/generated/http-request.d.ts +0 -195
- package/dist/drivers/puppeteer/generated/http-request.js +0 -243
- package/dist/drivers/puppeteer/generated/http-response.d.ts +0 -142
- package/dist/drivers/puppeteer/generated/http-response.js +0 -169
- package/dist/drivers/puppeteer/generated/js-handle.d.ts +0 -104
- package/dist/drivers/puppeteer/generated/js-handle.js +0 -125
- package/dist/drivers/puppeteer/generated/keyboard.d.ts +0 -79
- package/dist/drivers/puppeteer/generated/keyboard.js +0 -89
- package/dist/drivers/puppeteer/generated/locator.d.ts +0 -141
- package/dist/drivers/puppeteer/generated/locator.js +0 -164
- package/dist/drivers/puppeteer/generated/mouse.d.ts +0 -74
- package/dist/drivers/puppeteer/generated/mouse.js +0 -94
- package/dist/drivers/puppeteer/generated/page.d.ts +0 -604
- package/dist/drivers/puppeteer/generated/page.js +0 -776
- package/dist/drivers/puppeteer/generated/target.d.ts +0 -105
- package/dist/drivers/puppeteer/generated/target.js +0 -123
- package/dist/drivers/puppeteer/generated/touchscreen.d.ts +0 -87
- package/dist/drivers/puppeteer/generated/touchscreen.js +0 -103
- package/dist/drivers/puppeteer/generated/tracing.d.ts +0 -38
- package/dist/drivers/puppeteer/generated/tracing.js +0 -43
- package/dist/drivers/puppeteer/generated/web-worker.d.ts +0 -63
- package/dist/drivers/puppeteer/generated/web-worker.js +0 -73
- package/dist/drivers/puppeteer/index.d.ts +0 -21
- package/dist/drivers/puppeteer/index.js +0 -23
- package/dist/drivers/puppeteer/remote-base.d.ts +0 -57
- package/dist/drivers/puppeteer/remote-base.js +0 -79
- package/dist/drivers/puppeteer/types.d.ts +0 -178
- package/dist/drivers/puppeteer/types.js +0 -8
- package/dist/drivers/selenium/driver.d.ts +0 -28
- package/dist/drivers/selenium/driver.js +0 -169
- package/dist/drivers/selenium/element.d.ts +0 -34
- package/dist/drivers/selenium/element.js +0 -73
- package/dist/drivers/selenium/index.d.ts +0 -3
- package/dist/drivers/selenium/index.js +0 -5
- package/dist/drivers/selenium/types.d.ts +0 -2
- package/dist/drivers/selenium/types.js +0 -12
- package/dist/drivers/stagehand/generated/context.d.ts +0 -127
- package/dist/drivers/stagehand/generated/context.js +0 -153
- package/dist/drivers/stagehand/generated/locator.d.ts +0 -324
- package/dist/drivers/stagehand/generated/locator.js +0 -368
- package/dist/drivers/stagehand/generated/page.d.ts +0 -377
- package/dist/drivers/stagehand/generated/page.js +0 -439
- package/dist/drivers/stagehand/generated/response.d.ts +0 -197
- package/dist/drivers/stagehand/generated/response.js +0 -232
- package/dist/drivers/stagehand/index.d.ts +0 -5
- package/dist/drivers/stagehand/index.js +0 -8
- package/dist/drivers/stagehand/types.d.ts +0 -1
- package/dist/drivers/stagehand/types.js +0 -7
- package/dist/extensions/client.d.ts +0 -47
- package/dist/extensions/client.js +0 -154
- package/dist/extensions/index.d.ts +0 -1
- package/dist/extensions/index.js +0 -1
- package/dist/internal/dev-client.d.ts +0 -5
- package/dist/internal/dev-client.js +0 -9
- package/dist/internal/rpc-targets.d.ts +0 -17
- package/dist/internal/rpc-targets.js +0 -58
- package/dist/internal/serialization.d.ts +0 -32
- package/dist/internal/serialization.js +0 -42
- package/dist/internal/transport.d.ts +0 -24
- package/dist/internal/transport.js +0 -29
- package/dist/playwright.d.ts +0 -1
- package/dist/playwright.js +0 -2
- package/dist/puppeteer.d.ts +0 -1
- package/dist/puppeteer.js +0 -2
- package/dist/selenium.d.ts +0 -1
- package/dist/selenium.js +0 -2
- package/dist/stagehand.d.ts +0 -1
- package/dist/stagehand.js +0 -2
- package/dist/storage/client.d.ts +0 -151
- package/dist/storage/client.js +0 -329
- package/dist/storage/index.d.ts +0 -2
- package/dist/storage/index.js +0 -4
- package/dist/telemetry.d.ts +0 -18
- package/dist/telemetry.js +0 -93
- package/dist/updates/client.d.ts +0 -8
- package/dist/updates/client.js +0 -128
- package/dist/updates/index.d.ts +0 -1
- package/dist/updates/index.js +0 -1
- package/dist/utils/http.d.ts +0 -39
- package/dist/utils/http.js +0 -88
- package/dist/utils/index.d.ts +0 -4
- package/dist/utils/index.js +0 -4
- package/dist/utils/logger.d.ts +0 -27
- package/dist/utils/logger.js +0 -74
- package/dist/utils/schema.d.ts +0 -17
- package/dist/utils/schema.js +0 -31
- package/dist/utils/url.d.ts +0 -5
- package/dist/utils/url.js +0 -7
- package/dist/vault/client.d.ts +0 -43
- package/dist/vault/client.js +0 -123
- package/dist/vault/index.d.ts +0 -1
- package/dist/vault/index.js +0 -1
- package/dist/workspaces/browser-runtime.d.ts +0 -251
- package/dist/workspaces/browser-runtime.js +0 -1025
- package/dist/workspaces/client.d.ts +0 -48
- package/dist/workspaces/client.js +0 -222
- package/dist/workspaces/index.d.ts +0 -2
- package/dist/workspaces/index.js +0 -2
- package/dist/workspaces/runtime-event-pump.d.ts +0 -65
- package/dist/workspaces/runtime-event-pump.js +0 -716
package/dist/files.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { iterateV1Pages } from './pagination.js';
|
|
2
|
+
export class V1FileResource {
|
|
3
|
+
http;
|
|
4
|
+
data;
|
|
5
|
+
constructor(http, data) {
|
|
6
|
+
this.http = http;
|
|
7
|
+
this.data = data;
|
|
8
|
+
}
|
|
9
|
+
get id() {
|
|
10
|
+
return this.data.id;
|
|
11
|
+
}
|
|
12
|
+
refresh() {
|
|
13
|
+
return new V1FilesClient(this.http).get(this.id);
|
|
14
|
+
}
|
|
15
|
+
async content() {
|
|
16
|
+
return new V1FilesClient(this.http).content(this.id);
|
|
17
|
+
}
|
|
18
|
+
async update(request) {
|
|
19
|
+
return new V1FilesClient(this.http).update(this.id, request);
|
|
20
|
+
}
|
|
21
|
+
delete() {
|
|
22
|
+
return new V1FilesClient(this.http).delete(this.id);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export class V1FilesClient {
|
|
26
|
+
http;
|
|
27
|
+
constructor(http) {
|
|
28
|
+
this.http = http;
|
|
29
|
+
}
|
|
30
|
+
list(query) {
|
|
31
|
+
return this.http.request('/files', { query });
|
|
32
|
+
}
|
|
33
|
+
iter(query) {
|
|
34
|
+
return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
|
|
35
|
+
}
|
|
36
|
+
async get(id) {
|
|
37
|
+
const file = await this.http.request(`/files/${encodeURIComponent(id)}`);
|
|
38
|
+
return new V1FileResource(this.http, file);
|
|
39
|
+
}
|
|
40
|
+
async update(id, request) {
|
|
41
|
+
const file = await this.http.request(`/files/${encodeURIComponent(id)}`, {
|
|
42
|
+
method: 'PATCH',
|
|
43
|
+
body: request,
|
|
44
|
+
});
|
|
45
|
+
return new V1FileResource(this.http, file);
|
|
46
|
+
}
|
|
47
|
+
content(id) {
|
|
48
|
+
return this.http.raw(`/files/${encodeURIComponent(id)}/content`);
|
|
49
|
+
}
|
|
50
|
+
delete(id) {
|
|
51
|
+
return this.http.request(`/files/${encodeURIComponent(id)}`, {
|
|
52
|
+
method: 'DELETE',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async upload(request) {
|
|
56
|
+
const form = new FormData();
|
|
57
|
+
if (request.name) {
|
|
58
|
+
form.set('file', request.file, request.name);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
form.set('file', request.file);
|
|
62
|
+
}
|
|
63
|
+
if (request.name)
|
|
64
|
+
form.set('name', request.name);
|
|
65
|
+
if (request.path)
|
|
66
|
+
form.set('path', request.path);
|
|
67
|
+
if (request.metadata)
|
|
68
|
+
form.set('metadata', JSON.stringify(request.metadata));
|
|
69
|
+
const file = await this.http.request('/files', {
|
|
70
|
+
method: 'POST',
|
|
71
|
+
query: { spaceId: request.spaceId },
|
|
72
|
+
body: form,
|
|
73
|
+
});
|
|
74
|
+
return new V1FileResource(this.http, file);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export class V1RunFilesClient {
|
|
78
|
+
http;
|
|
79
|
+
runId;
|
|
80
|
+
constructor(http, runId) {
|
|
81
|
+
this.http = http;
|
|
82
|
+
this.runId = runId;
|
|
83
|
+
}
|
|
84
|
+
list(query = {}) {
|
|
85
|
+
return this.http.request(`/runs/${encodeURIComponent(this.runId)}/files`, { query });
|
|
86
|
+
}
|
|
87
|
+
iter(query = {}) {
|
|
88
|
+
return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
|
|
89
|
+
}
|
|
90
|
+
async export(request) {
|
|
91
|
+
const file = await this.http.request(`/runs/${encodeURIComponent(this.runId)}/files/export`, {
|
|
92
|
+
method: 'POST',
|
|
93
|
+
body: request,
|
|
94
|
+
});
|
|
95
|
+
return new V1FileResource(this.http, file);
|
|
96
|
+
}
|
|
97
|
+
}
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface V1ClientOptions {
|
|
2
|
+
apiKey?: string;
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface V1RequestOptions {
|
|
6
|
+
method?: 'GET' | 'POST' | 'PATCH' | 'DELETE';
|
|
7
|
+
query?: object;
|
|
8
|
+
body?: unknown;
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare class V1HttpClient {
|
|
13
|
+
readonly baseUrl: string;
|
|
14
|
+
readonly apiKey: string;
|
|
15
|
+
constructor(options: V1ClientOptions);
|
|
16
|
+
request<T>(path: string, options?: V1RequestOptions): Promise<T>;
|
|
17
|
+
raw(path: string, options?: V1RequestOptions): Promise<Response>;
|
|
18
|
+
}
|
package/dist/http.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { BctrlNetworkError, createV1HttpError } from './errors.js';
|
|
2
|
+
import { BCTRL_PRODUCTION_ORIGIN, fetchWithTimeout, resolveApiKey, stripTrailingSlash, } from './utils.js';
|
|
3
|
+
import { SDK_VERSION } from './version.js';
|
|
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)) {
|
|
11
|
+
return raw;
|
|
12
|
+
}
|
|
13
|
+
return `${raw}${API_PREFIX}`;
|
|
14
|
+
}
|
|
15
|
+
function resolveV1ApiKey(apiKey) {
|
|
16
|
+
return resolveApiKey(apiKey ?? process.env.BCTRL_API_KEY ?? '');
|
|
17
|
+
}
|
|
18
|
+
function appendQuery(params, key, value) {
|
|
19
|
+
if (value === undefined) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (Array.isArray(value)) {
|
|
23
|
+
for (const item of value) {
|
|
24
|
+
if (item !== undefined)
|
|
25
|
+
params.append(key, String(item));
|
|
26
|
+
}
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (typeof value === 'object') {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
params.set(key, String(value));
|
|
33
|
+
}
|
|
34
|
+
function parseResponseBody(text) {
|
|
35
|
+
if (!text.trim()) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
return JSON.parse(text);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return text;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function responseRequestId(response) {
|
|
46
|
+
return (response.headers.get('x-request-id') ??
|
|
47
|
+
response.headers.get('x-bctrl-request-id') ??
|
|
48
|
+
undefined);
|
|
49
|
+
}
|
|
50
|
+
function isRecord(value) {
|
|
51
|
+
return Boolean(value && typeof value === 'object' && !Array.isArray(value));
|
|
52
|
+
}
|
|
53
|
+
function parseV1ErrorBody(parsed, fallbackText) {
|
|
54
|
+
if (isRecord(parsed) && typeof parsed.error === 'string') {
|
|
55
|
+
return {
|
|
56
|
+
error: parsed.error,
|
|
57
|
+
...(typeof parsed.code === 'string' ? { code: parsed.code } : {}),
|
|
58
|
+
...(typeof parsed.requestId === 'string' ? { requestId: parsed.requestId } : {}),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (typeof parsed === 'string' && parsed.trim()) {
|
|
62
|
+
return { error: parsed.trim() };
|
|
63
|
+
}
|
|
64
|
+
return { error: fallbackText.trim() || 'Unknown error' };
|
|
65
|
+
}
|
|
66
|
+
function isBodyInit(value) {
|
|
67
|
+
return (typeof value === 'string' ||
|
|
68
|
+
value instanceof Blob ||
|
|
69
|
+
value instanceof FormData ||
|
|
70
|
+
value instanceof URLSearchParams ||
|
|
71
|
+
value instanceof ArrayBuffer);
|
|
72
|
+
}
|
|
73
|
+
export class V1HttpClient {
|
|
74
|
+
baseUrl;
|
|
75
|
+
apiKey;
|
|
76
|
+
constructor(options) {
|
|
77
|
+
this.baseUrl = resolveV1ApiBaseUrl(options.baseUrl);
|
|
78
|
+
this.apiKey = resolveV1ApiKey(options.apiKey);
|
|
79
|
+
}
|
|
80
|
+
async request(path, options = {}) {
|
|
81
|
+
const response = await this.raw(path, options);
|
|
82
|
+
const text = await response.text();
|
|
83
|
+
return parseResponseBody(text);
|
|
84
|
+
}
|
|
85
|
+
async raw(path, options = {}) {
|
|
86
|
+
const url = new URL(`${this.baseUrl}${path.startsWith('/') ? path : `/${path}`}`);
|
|
87
|
+
const query = options.query ?? {};
|
|
88
|
+
for (const [key, value] of Object.entries(query)) {
|
|
89
|
+
appendQuery(url.searchParams, key, value);
|
|
90
|
+
}
|
|
91
|
+
const headers = {
|
|
92
|
+
Accept: 'application/json',
|
|
93
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
94
|
+
'x-sdk-version': SDK_VERSION,
|
|
95
|
+
'User-Agent': `@bctrl/sdk/${SDK_VERSION} v1`,
|
|
96
|
+
...options.headers,
|
|
97
|
+
};
|
|
98
|
+
const init = {
|
|
99
|
+
method: options.method ?? 'GET',
|
|
100
|
+
headers,
|
|
101
|
+
};
|
|
102
|
+
if (options.body !== undefined) {
|
|
103
|
+
if (isBodyInit(options.body)) {
|
|
104
|
+
init.body = options.body;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
headers['Content-Type'] = 'application/json';
|
|
108
|
+
init.body = JSON.stringify(options.body);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
let response;
|
|
112
|
+
try {
|
|
113
|
+
response = await fetchWithTimeout(url.toString(), init, options.timeoutMs);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
if (error instanceof Error) {
|
|
117
|
+
throw new BctrlNetworkError(error.message, { cause: error });
|
|
118
|
+
}
|
|
119
|
+
throw new BctrlNetworkError('Network request failed');
|
|
120
|
+
}
|
|
121
|
+
if (!response.ok) {
|
|
122
|
+
const text = await response.text();
|
|
123
|
+
const parsed = parseResponseBody(text);
|
|
124
|
+
const errorBody = parseV1ErrorBody(parsed, text);
|
|
125
|
+
throw createV1HttpError({
|
|
126
|
+
status: response.status,
|
|
127
|
+
message: errorBody.error,
|
|
128
|
+
code: errorBody.code,
|
|
129
|
+
requestId: errorBody.requestId ?? responseRequestId(response),
|
|
130
|
+
body: parsed,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return response;
|
|
134
|
+
}
|
|
135
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './workspaces/index.js';
|
|
11
|
-
export type { BctrlOptions } from './bctrl.js';
|
|
12
|
-
export { Bctrl } from './bctrl.js';
|
|
1
|
+
export { Bctrl, BctrlV1, type BctrlV1Options } from './bctrl.js';
|
|
2
|
+
export { BctrlError, BctrlApiError, BctrlAuthenticationError, BctrlConflictError, BctrlNetworkError, BctrlNotFoundError, BctrlNotReadyError, BctrlPermissionError, BctrlRateLimitError, BctrlUnsupportedError, BctrlValidationError, isControllerBusy, } from './errors.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
|
+
export type * from './types.js';
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// - <package>/playwright
|
|
9
|
-
// - <package>/stagehand
|
|
10
|
-
// - <package>/selenium
|
|
11
|
-
//
|
|
12
|
-
export { z } from 'zod';
|
|
13
|
-
// Core errors
|
|
14
|
-
export { BctrlError, AutomationError, AutomationError as SdkAutomationError, SessionError, TimeoutError, AuthenticationError, fromErrorResponse, isBctrlError, isAutomationError, isSessionError, isTimeoutError, isAuthenticationError, getAutomationHint, } from './errors.js';
|
|
15
|
-
// Service clients
|
|
16
|
-
export * from './storage/index.js';
|
|
17
|
-
export * from './ai-credentials/index.js';
|
|
18
|
-
export * from './browser-extensions/index.js';
|
|
19
|
-
export * from './browser-profiles/index.js';
|
|
20
|
-
export * from './vault/index.js';
|
|
21
|
-
export * from './updates/index.js';
|
|
22
|
-
export * from './workspaces/index.js';
|
|
23
|
-
export { Bctrl } from './bctrl.js';
|
|
1
|
+
export { Bctrl, BctrlV1 } from './bctrl.js';
|
|
2
|
+
export { BctrlError, BctrlApiError, BctrlAuthenticationError, BctrlConflictError, BctrlNetworkError, BctrlNotFoundError, BctrlNotReadyError, BctrlPermissionError, BctrlRateLimitError, BctrlUnsupportedError, BctrlValidationError, isControllerBusy, } from './errors.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';
|
|
@@ -0,0 +1,86 @@
|
|
|
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 {
|
|
50
|
+
private readonly http;
|
|
51
|
+
readonly data: V1Invocation;
|
|
52
|
+
constructor(http: V1HttpClient, data: V1Invocation);
|
|
53
|
+
get id(): string;
|
|
54
|
+
refresh(): Promise<V1Invocation>;
|
|
55
|
+
wait(request?: V1InvocationWaitRequest): Promise<V1InvocationWaitResponse>;
|
|
56
|
+
cancel(): Promise<V1Invocation>;
|
|
57
|
+
}
|
|
58
|
+
export declare class V1InvocationsClient {
|
|
59
|
+
private readonly http;
|
|
60
|
+
constructor(http: V1HttpClient);
|
|
61
|
+
get(id: string): Promise<V1InvocationResource>;
|
|
62
|
+
wait(id: string, request?: V1InvocationWaitRequest): Promise<V1InvocationWaitResponse>;
|
|
63
|
+
cancel(id: string): Promise<V1InvocationResource>;
|
|
64
|
+
}
|
|
65
|
+
export declare class V1RuntimeInvocationsClient {
|
|
66
|
+
private readonly http;
|
|
67
|
+
private readonly runtimeId;
|
|
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>;
|
|
85
|
+
}
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
export class V1InvocationResource {
|
|
2
|
+
http;
|
|
3
|
+
data;
|
|
4
|
+
constructor(http, data) {
|
|
5
|
+
this.http = http;
|
|
6
|
+
this.data = data;
|
|
7
|
+
}
|
|
8
|
+
get id() {
|
|
9
|
+
return this.data.id;
|
|
10
|
+
}
|
|
11
|
+
refresh() {
|
|
12
|
+
return this.http
|
|
13
|
+
.request(`/invocations/${encodeURIComponent(this.id)}`)
|
|
14
|
+
.then((response) => response.data);
|
|
15
|
+
}
|
|
16
|
+
wait(request) {
|
|
17
|
+
return this.http.request(`/invocations/${encodeURIComponent(this.id)}/wait`, {
|
|
18
|
+
method: 'POST',
|
|
19
|
+
body: request ?? {},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
cancel() {
|
|
23
|
+
return this.http
|
|
24
|
+
.request(`/invocations/${encodeURIComponent(this.id)}/cancel`, {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
})
|
|
27
|
+
.then((response) => response.data);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export class V1InvocationsClient {
|
|
31
|
+
http;
|
|
32
|
+
constructor(http) {
|
|
33
|
+
this.http = http;
|
|
34
|
+
}
|
|
35
|
+
async get(id) {
|
|
36
|
+
const response = await this.http.request(`/invocations/${encodeURIComponent(id)}`);
|
|
37
|
+
return new V1InvocationResource(this.http, response.data);
|
|
38
|
+
}
|
|
39
|
+
wait(id, request) {
|
|
40
|
+
return this.http.request(`/invocations/${encodeURIComponent(id)}/wait`, {
|
|
41
|
+
method: 'POST',
|
|
42
|
+
body: request ?? {},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async cancel(id) {
|
|
46
|
+
const response = await this.http.request(`/invocations/${encodeURIComponent(id)}/cancel`, {
|
|
47
|
+
method: 'POST',
|
|
48
|
+
});
|
|
49
|
+
return new V1InvocationResource(this.http, response.data);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export class V1RuntimeInvocationsClient {
|
|
53
|
+
http;
|
|
54
|
+
runtimeId;
|
|
55
|
+
stagehand;
|
|
56
|
+
browserUse;
|
|
57
|
+
constructor(http, runtimeId) {
|
|
58
|
+
this.http = http;
|
|
59
|
+
this.runtimeId = runtimeId;
|
|
60
|
+
this.stagehand = new V1RuntimeStagehandInvocationsClient(this);
|
|
61
|
+
this.browserUse = new V1RuntimeBrowserUseInvocationsClient(this);
|
|
62
|
+
}
|
|
63
|
+
async create(request) {
|
|
64
|
+
const response = await this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/invocations`, {
|
|
65
|
+
method: 'POST',
|
|
66
|
+
body: request,
|
|
67
|
+
});
|
|
68
|
+
return new V1InvocationResource(this.http, response.data);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export class V1RuntimeStagehandInvocationsClient {
|
|
72
|
+
invocations;
|
|
73
|
+
constructor(invocations) {
|
|
74
|
+
this.invocations = invocations;
|
|
75
|
+
}
|
|
76
|
+
act(options) {
|
|
77
|
+
const { instruction, timeoutMs, ...common } = options;
|
|
78
|
+
return this.invocations.create({
|
|
79
|
+
provider: 'stagehand',
|
|
80
|
+
method: 'act',
|
|
81
|
+
...common,
|
|
82
|
+
input: {
|
|
83
|
+
instruction,
|
|
84
|
+
...(timeoutMs !== undefined ? { timeoutMs } : {}),
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
observe(options) {
|
|
89
|
+
const { instruction, selector, timeoutMs, ...common } = options;
|
|
90
|
+
return this.invocations.create({
|
|
91
|
+
provider: 'stagehand',
|
|
92
|
+
method: 'observe',
|
|
93
|
+
...common,
|
|
94
|
+
input: {
|
|
95
|
+
instruction,
|
|
96
|
+
...(selector !== undefined ? { selector } : {}),
|
|
97
|
+
...(timeoutMs !== undefined ? { timeoutMs } : {}),
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
extract(options) {
|
|
102
|
+
const { instruction, schema, ...common } = options;
|
|
103
|
+
return this.invocations.create({
|
|
104
|
+
provider: 'stagehand',
|
|
105
|
+
method: 'extract',
|
|
106
|
+
...common,
|
|
107
|
+
input: { instruction },
|
|
108
|
+
...(schema !== undefined ? { outputSchema: toJsonSchemaObject(schema) } : {}),
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
agent(options) {
|
|
112
|
+
const { instruction, maxSteps, timeoutMs, variables, config, options: agentOptions, ...common } = options;
|
|
113
|
+
return this.invocations.create({
|
|
114
|
+
provider: 'stagehand',
|
|
115
|
+
method: 'agent',
|
|
116
|
+
...common,
|
|
117
|
+
input: {
|
|
118
|
+
instruction,
|
|
119
|
+
...(maxSteps !== undefined ? { maxSteps } : {}),
|
|
120
|
+
...(timeoutMs !== undefined ? { timeoutMs } : {}),
|
|
121
|
+
...(variables !== undefined ? { variables } : {}),
|
|
122
|
+
},
|
|
123
|
+
...(config !== undefined ? { config } : {}),
|
|
124
|
+
...(agentOptions !== undefined ? { options: agentOptions } : {}),
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
export class V1RuntimeBrowserUseInvocationsClient {
|
|
129
|
+
invocations;
|
|
130
|
+
constructor(invocations) {
|
|
131
|
+
this.invocations = invocations;
|
|
132
|
+
}
|
|
133
|
+
agent(options) {
|
|
134
|
+
const { instruction, maxSteps, config, options: agentOptions, ...common } = options;
|
|
135
|
+
return this.invocations.create({
|
|
136
|
+
provider: 'browserUse',
|
|
137
|
+
method: 'agent',
|
|
138
|
+
...common,
|
|
139
|
+
input: {
|
|
140
|
+
instruction,
|
|
141
|
+
...(maxSteps !== undefined ? { maxSteps } : {}),
|
|
142
|
+
},
|
|
143
|
+
...(config !== undefined ? { config } : {}),
|
|
144
|
+
...(agentOptions !== undefined ? { options: agentOptions } : {}),
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function toJsonSchemaObject(schema) {
|
|
149
|
+
const value = typeof schema.toJSONSchema === 'function' ? schema.toJSONSchema() : schema;
|
|
150
|
+
if (!isJsonObject(value)) {
|
|
151
|
+
throw new TypeError('Stagehand extract schema must resolve to a JSON object');
|
|
152
|
+
}
|
|
153
|
+
const { $schema, ...jsonSchema } = value;
|
|
154
|
+
void $schema;
|
|
155
|
+
return jsonSchema;
|
|
156
|
+
}
|
|
157
|
+
function isJsonObject(value) {
|
|
158
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
159
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export async function* iterateV1Pages(initialQuery, fetchPage) {
|
|
2
|
+
let cursor = initialQuery.cursor;
|
|
3
|
+
for (;;) {
|
|
4
|
+
const page = await fetchPage({ ...initialQuery, cursor });
|
|
5
|
+
for (const item of page.data) {
|
|
6
|
+
yield item;
|
|
7
|
+
}
|
|
8
|
+
if (!page.nextCursor) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
cursor = page.nextCursor;
|
|
12
|
+
}
|
|
13
|
+
}
|
package/dist/runs.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { V1HttpClient } from './http.js';
|
|
2
|
+
import { V1RunFilesClient } from './files.js';
|
|
3
|
+
import type { V1ListEnvelope, V1Run, V1RunCommand, V1RunCommandsListQuery, V1RunEvent, V1RunEventsListQuery, V1RunEventsWaitRequest, V1RunEventsWaitResponse, V1RunListQuery, V1RunLiveRequest, V1RunLiveResponse, V1RunRecordingRequest, V1RunRecordingResponse, V1RunUsage } from './types.js';
|
|
4
|
+
export declare class V1RunEventsClient {
|
|
5
|
+
private readonly http;
|
|
6
|
+
private readonly runId;
|
|
7
|
+
constructor(http: V1HttpClient, runId: string);
|
|
8
|
+
list(query?: V1RunEventsListQuery): Promise<V1ListEnvelope<V1RunEvent>>;
|
|
9
|
+
iter(query?: V1RunEventsListQuery): AsyncGenerator<V1RunEvent, void, undefined>;
|
|
10
|
+
wait(request?: V1RunEventsWaitRequest): Promise<V1RunEventsWaitResponse>;
|
|
11
|
+
streamUrl(query?: Pick<V1RunEventsListQuery, 'type' | 'category' | 'connectionId'>): string;
|
|
12
|
+
}
|
|
13
|
+
export declare class V1RunCommandsClient {
|
|
14
|
+
private readonly http;
|
|
15
|
+
private readonly runId;
|
|
16
|
+
constructor(http: V1HttpClient, runId: string);
|
|
17
|
+
list(query?: V1RunCommandsListQuery): Promise<V1ListEnvelope<V1RunCommand>>;
|
|
18
|
+
iter(query?: V1RunCommandsListQuery): AsyncGenerator<V1RunCommand, void, undefined>;
|
|
19
|
+
}
|
|
20
|
+
export declare class V1RunResource {
|
|
21
|
+
private readonly http;
|
|
22
|
+
readonly data: V1Run;
|
|
23
|
+
readonly events: V1RunEventsClient;
|
|
24
|
+
readonly commands: V1RunCommandsClient;
|
|
25
|
+
readonly files: V1RunFilesClient;
|
|
26
|
+
constructor(http: V1HttpClient, data: V1Run);
|
|
27
|
+
get id(): string;
|
|
28
|
+
refresh(): Promise<V1RunResource>;
|
|
29
|
+
live(request?: V1RunLiveRequest): Promise<V1RunLiveResponse>;
|
|
30
|
+
recording(request?: V1RunRecordingRequest): Promise<V1RunRecordingResponse>;
|
|
31
|
+
usage(): Promise<V1RunUsage>;
|
|
32
|
+
}
|
|
33
|
+
export declare class V1RunsClient {
|
|
34
|
+
private readonly http;
|
|
35
|
+
constructor(http: V1HttpClient);
|
|
36
|
+
list(query?: V1RunListQuery): Promise<V1ListEnvelope<V1Run>>;
|
|
37
|
+
iter(query?: V1RunListQuery): AsyncGenerator<V1Run, void, undefined>;
|
|
38
|
+
get(id: string): Promise<V1RunResource>;
|
|
39
|
+
usage(id: string): Promise<V1RunUsage>;
|
|
40
|
+
}
|