@bctrl/sdk 1.0.2 → 1.0.4
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 +13 -11
- package/dist/bctrl.d.ts +15 -15
- package/dist/bctrl.js +14 -14
- package/dist/errors.d.ts +14 -14
- package/dist/errors.js +1 -1
- package/dist/files.d.ts +21 -21
- package/dist/files.js +14 -14
- package/dist/http.d.ts +6 -6
- package/dist/http.js +17 -17
- package/dist/index.d.ts +7 -7
- package/dist/index.js +6 -7
- package/dist/invocations.d.ts +78 -16
- package/dist/invocations.js +99 -6
- package/dist/pagination.d.ts +2 -2
- package/dist/pagination.js +1 -1
- package/dist/runs.d.ts +29 -27
- package/dist/runs.js +20 -14
- package/dist/runtimes.d.ts +37 -61
- package/dist/runtimes.js +27 -76
- package/dist/spaces.d.ts +29 -30
- package/dist/spaces.js +22 -22
- package/dist/types.d.ts +124 -118
- package/package.json +4 -4
- package/dist/browsers.d.ts +0 -24
- package/dist/browsers.js +0 -82
package/dist/spaces.d.ts
CHANGED
|
@@ -1,41 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export declare class V2SpaceEnvironmentClient {
|
|
1
|
+
import type { V1HttpClient } from './http.js';
|
|
2
|
+
import { V1RuntimeResource, V1RuntimesClient } from './runtimes.js';
|
|
3
|
+
import type { V1ListEnvelope, V1RuntimeListQuery, V1Space, V1SpaceCreateRequest, V1SpaceEnvironment, V1SpaceEnvironmentUpdateRequest, V1SpaceRuntimeCreateRequest, V1SpaceUpdateRequest } from './types.js';
|
|
4
|
+
export declare class V1SpaceEnvironmentClient {
|
|
6
5
|
private readonly http;
|
|
7
6
|
private readonly spaceId;
|
|
8
|
-
constructor(http:
|
|
9
|
-
get(): Promise<
|
|
10
|
-
update(request:
|
|
7
|
+
constructor(http: V1HttpClient, spaceId: string);
|
|
8
|
+
get(): Promise<V1SpaceEnvironment>;
|
|
9
|
+
update(request: V1SpaceEnvironmentUpdateRequest): Promise<V1SpaceEnvironment>;
|
|
11
10
|
}
|
|
12
|
-
export declare class
|
|
11
|
+
export declare class V1SpaceRuntimesClient {
|
|
13
12
|
private readonly http;
|
|
14
13
|
private readonly spaceId;
|
|
15
|
-
constructor(http:
|
|
16
|
-
list(query?: Omit<
|
|
17
|
-
iter(query?: Omit<
|
|
18
|
-
create(request:
|
|
19
|
-
get(runtimeId: string): Promise<
|
|
20
|
-
stop(runtimeId: string): ReturnType<
|
|
14
|
+
constructor(http: V1HttpClient, spaceId: string);
|
|
15
|
+
list(query?: Omit<V1RuntimeListQuery, 'spaceId'>): ReturnType<V1RuntimesClient['list']>;
|
|
16
|
+
iter(query?: Omit<V1RuntimeListQuery, 'spaceId'>): ReturnType<V1RuntimesClient['iter']>;
|
|
17
|
+
create(request: V1SpaceRuntimeCreateRequest): Promise<V1RuntimeResource>;
|
|
18
|
+
get(runtimeId: string): Promise<V1RuntimeResource>;
|
|
19
|
+
stop(runtimeId: string): ReturnType<V1RuntimesClient['stop']>;
|
|
20
|
+
start(runtimeId: string): ReturnType<V1RuntimesClient['start']>;
|
|
21
21
|
}
|
|
22
|
-
export declare class
|
|
22
|
+
export declare class V1SpaceResource {
|
|
23
23
|
private readonly http;
|
|
24
|
-
readonly data:
|
|
25
|
-
readonly environment:
|
|
26
|
-
readonly runtimes:
|
|
27
|
-
|
|
28
|
-
constructor(http: V2HttpClient, data: V2Space);
|
|
24
|
+
readonly data: V1Space;
|
|
25
|
+
readonly environment: V1SpaceEnvironmentClient;
|
|
26
|
+
readonly runtimes: V1SpaceRuntimesClient;
|
|
27
|
+
constructor(http: V1HttpClient, data: V1Space);
|
|
29
28
|
get id(): string;
|
|
30
|
-
refresh(): Promise<
|
|
31
|
-
update(request:
|
|
29
|
+
refresh(): Promise<V1SpaceResource>;
|
|
30
|
+
update(request: V1SpaceUpdateRequest): Promise<V1SpaceResource>;
|
|
32
31
|
}
|
|
33
|
-
export declare class
|
|
32
|
+
export declare class V1SpacesClient {
|
|
34
33
|
private readonly http;
|
|
35
|
-
constructor(http:
|
|
36
|
-
list(): Promise<
|
|
37
|
-
iter(): AsyncGenerator<
|
|
38
|
-
create(request:
|
|
39
|
-
get(id: string): Promise<
|
|
40
|
-
update(id: string, request:
|
|
34
|
+
constructor(http: V1HttpClient);
|
|
35
|
+
list(): Promise<V1ListEnvelope<V1Space>>;
|
|
36
|
+
iter(): AsyncGenerator<V1Space, void, undefined>;
|
|
37
|
+
create(request: V1SpaceCreateRequest): Promise<V1SpaceResource>;
|
|
38
|
+
get(id: string): Promise<V1SpaceResource>;
|
|
39
|
+
update(id: string, request: V1SpaceUpdateRequest): Promise<V1SpaceResource>;
|
|
41
40
|
}
|
package/dist/spaces.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export class V2SpaceEnvironmentClient {
|
|
1
|
+
import { iterateV1Pages } from './pagination.js';
|
|
2
|
+
import { V1RuntimesClient } from './runtimes.js';
|
|
3
|
+
export class V1SpaceEnvironmentClient {
|
|
5
4
|
http;
|
|
6
5
|
spaceId;
|
|
7
6
|
constructor(http, spaceId) {
|
|
@@ -18,7 +17,7 @@ export class V2SpaceEnvironmentClient {
|
|
|
18
17
|
});
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
|
-
export class
|
|
20
|
+
export class V1SpaceRuntimesClient {
|
|
22
21
|
http;
|
|
23
22
|
spaceId;
|
|
24
23
|
constructor(http, spaceId) {
|
|
@@ -26,45 +25,46 @@ export class V2SpaceRuntimesClient {
|
|
|
26
25
|
this.spaceId = spaceId;
|
|
27
26
|
}
|
|
28
27
|
list(query = {}) {
|
|
29
|
-
return new
|
|
28
|
+
return new V1RuntimesClient(this.http).list({ ...query, spaceId: this.spaceId });
|
|
30
29
|
}
|
|
31
30
|
iter(query = {}) {
|
|
32
|
-
return new
|
|
31
|
+
return new V1RuntimesClient(this.http).iter({ ...query, spaceId: this.spaceId });
|
|
33
32
|
}
|
|
34
33
|
async create(request) {
|
|
35
|
-
return new
|
|
34
|
+
return new V1RuntimesClient(this.http).createInSpace(this.spaceId, request);
|
|
36
35
|
}
|
|
37
36
|
async get(runtimeId) {
|
|
38
|
-
return new
|
|
37
|
+
return new V1RuntimesClient(this.http).get(runtimeId);
|
|
39
38
|
}
|
|
40
39
|
stop(runtimeId) {
|
|
41
|
-
return new
|
|
40
|
+
return new V1RuntimesClient(this.http).stop(runtimeId);
|
|
41
|
+
}
|
|
42
|
+
start(runtimeId) {
|
|
43
|
+
return new V1RuntimesClient(this.http).start(runtimeId);
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
|
-
export class
|
|
46
|
+
export class V1SpaceResource {
|
|
45
47
|
http;
|
|
46
48
|
data;
|
|
47
49
|
environment;
|
|
48
50
|
runtimes;
|
|
49
|
-
browsers;
|
|
50
51
|
constructor(http, data) {
|
|
51
52
|
this.http = http;
|
|
52
53
|
this.data = data;
|
|
53
|
-
this.environment = new
|
|
54
|
-
this.runtimes = new
|
|
55
|
-
this.browsers = new V2SpaceBrowsersClient(http, data.id);
|
|
54
|
+
this.environment = new V1SpaceEnvironmentClient(http, data.id);
|
|
55
|
+
this.runtimes = new V1SpaceRuntimesClient(http, data.id);
|
|
56
56
|
}
|
|
57
57
|
get id() {
|
|
58
58
|
return this.data.id;
|
|
59
59
|
}
|
|
60
60
|
refresh() {
|
|
61
|
-
return new
|
|
61
|
+
return new V1SpacesClient(this.http).get(this.id);
|
|
62
62
|
}
|
|
63
63
|
async update(request) {
|
|
64
|
-
return new
|
|
64
|
+
return new V1SpacesClient(this.http).update(this.id, request);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
export class
|
|
67
|
+
export class V1SpacesClient {
|
|
68
68
|
http;
|
|
69
69
|
constructor(http) {
|
|
70
70
|
this.http = http;
|
|
@@ -73,24 +73,24 @@ export class V2SpacesClient {
|
|
|
73
73
|
return this.http.request('/spaces');
|
|
74
74
|
}
|
|
75
75
|
iter() {
|
|
76
|
-
return
|
|
76
|
+
return iterateV1Pages({}, () => this.list());
|
|
77
77
|
}
|
|
78
78
|
async create(request) {
|
|
79
79
|
const space = await this.http.request('/spaces', {
|
|
80
80
|
method: 'POST',
|
|
81
81
|
body: request,
|
|
82
82
|
});
|
|
83
|
-
return new
|
|
83
|
+
return new V1SpaceResource(this.http, space);
|
|
84
84
|
}
|
|
85
85
|
async get(id) {
|
|
86
86
|
const space = await this.http.request(`/spaces/${encodeURIComponent(id)}`);
|
|
87
|
-
return new
|
|
87
|
+
return new V1SpaceResource(this.http, space);
|
|
88
88
|
}
|
|
89
89
|
async update(id, request) {
|
|
90
90
|
const space = await this.http.request(`/spaces/${encodeURIComponent(id)}`, {
|
|
91
91
|
method: 'PATCH',
|
|
92
92
|
body: request,
|
|
93
93
|
});
|
|
94
|
-
return new
|
|
94
|
+
return new V1SpaceResource(this.http, space);
|
|
95
95
|
}
|
|
96
96
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -3,23 +3,23 @@ export type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
|
|
|
3
3
|
export type JsonObject = {
|
|
4
4
|
[key: string]: JsonValue;
|
|
5
5
|
};
|
|
6
|
-
export interface
|
|
6
|
+
export interface V1ListEnvelope<T> {
|
|
7
7
|
data: T[];
|
|
8
8
|
nextCursor: string | null;
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
10
|
+
export interface V1PageQuery {
|
|
11
11
|
cursor?: string;
|
|
12
12
|
limit?: number;
|
|
13
13
|
}
|
|
14
|
-
export interface
|
|
14
|
+
export interface V1SpaceCreateRequest {
|
|
15
15
|
name: string;
|
|
16
16
|
region: string;
|
|
17
17
|
subaccountId?: string | null;
|
|
18
18
|
}
|
|
19
|
-
export interface
|
|
19
|
+
export interface V1SpaceUpdateRequest {
|
|
20
20
|
name?: string;
|
|
21
21
|
}
|
|
22
|
-
export interface
|
|
22
|
+
export interface V1Space {
|
|
23
23
|
id: string;
|
|
24
24
|
name: string;
|
|
25
25
|
region: string;
|
|
@@ -27,18 +27,18 @@ export interface V2Space {
|
|
|
27
27
|
createdAt: string;
|
|
28
28
|
updatedAt: string;
|
|
29
29
|
}
|
|
30
|
-
export interface
|
|
30
|
+
export interface V1SpaceEnvironment {
|
|
31
31
|
spaceId: string;
|
|
32
32
|
mounts: JsonObject;
|
|
33
33
|
updatedAt: string;
|
|
34
34
|
}
|
|
35
|
-
export interface
|
|
35
|
+
export interface V1SpaceEnvironmentUpdateRequest {
|
|
36
36
|
mounts: JsonObject;
|
|
37
37
|
}
|
|
38
|
-
export type
|
|
39
|
-
export type
|
|
40
|
-
export type
|
|
41
|
-
export type
|
|
38
|
+
export type V1RuntimeType = 'browser';
|
|
39
|
+
export type V1RuntimeStatus = 'active' | 'stopped' | 'failed';
|
|
40
|
+
export type V1BrowserStealth = 'medium' | 'high' | 'ultra';
|
|
41
|
+
export type V1ProxyInput = {
|
|
42
42
|
mode: 'custom';
|
|
43
43
|
protocol: string;
|
|
44
44
|
host: string;
|
|
@@ -50,102 +50,81 @@ export type V2ProxyInput = {
|
|
|
50
50
|
id: string;
|
|
51
51
|
overrides?: JsonObject;
|
|
52
52
|
};
|
|
53
|
-
export interface
|
|
53
|
+
export interface V1RuntimeFingerprintCreateConfig {
|
|
54
54
|
browser?: string;
|
|
55
55
|
locale?: string;
|
|
56
56
|
}
|
|
57
|
-
export interface
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
profile?: boolean;
|
|
63
|
-
};
|
|
64
|
-
stealth?: V2BrowserStealth;
|
|
65
|
-
proxy?: V2ProxyInput | null;
|
|
66
|
-
fingerprint?: V2RuntimeFingerprintCreateConfig;
|
|
57
|
+
export interface V1BrowserRuntimeCreateConfig {
|
|
58
|
+
profile?: boolean;
|
|
59
|
+
stealth?: V1BrowserStealth;
|
|
60
|
+
proxy?: V1ProxyInput | null;
|
|
61
|
+
fingerprint?: V1RuntimeFingerprintCreateConfig;
|
|
67
62
|
extensions?: string[];
|
|
68
|
-
|
|
63
|
+
idleTimeoutMinutes?: number;
|
|
64
|
+
webRtcProxyOnly?: boolean;
|
|
65
|
+
forceOpenShadowRoots?: boolean;
|
|
69
66
|
}
|
|
70
|
-
export interface
|
|
67
|
+
export interface V1RuntimeCreateRequest {
|
|
71
68
|
spaceId: string;
|
|
72
|
-
type:
|
|
69
|
+
type: V1RuntimeType;
|
|
73
70
|
name?: string;
|
|
74
71
|
metadata?: JsonObject;
|
|
75
|
-
config?:
|
|
72
|
+
config?: V1BrowserRuntimeCreateConfig;
|
|
76
73
|
}
|
|
77
|
-
export type
|
|
78
|
-
export interface
|
|
74
|
+
export type V1SpaceRuntimeCreateRequest = Omit<V1RuntimeCreateRequest, 'spaceId'>;
|
|
75
|
+
export interface V1RuntimeListQuery {
|
|
79
76
|
spaceId?: string;
|
|
80
77
|
status?: string | string[];
|
|
81
78
|
limit?: number;
|
|
82
79
|
}
|
|
83
|
-
export interface
|
|
80
|
+
export interface V1RuntimeSummary {
|
|
84
81
|
id: string;
|
|
85
82
|
name: string;
|
|
86
|
-
type:
|
|
87
|
-
status:
|
|
83
|
+
type: V1RuntimeType;
|
|
84
|
+
status: V1RuntimeStatus;
|
|
88
85
|
activeRunId: string | null;
|
|
89
86
|
createdAt: string;
|
|
90
87
|
updatedAt: string;
|
|
91
88
|
}
|
|
92
|
-
export interface
|
|
89
|
+
export interface V1Runtime extends V1RuntimeSummary {
|
|
93
90
|
config?: JsonObject;
|
|
94
91
|
metadata?: JsonObject | null;
|
|
95
92
|
}
|
|
96
|
-
export
|
|
97
|
-
export type V2ConnectionEndpoint = {
|
|
98
|
-
type: 'websocket';
|
|
99
|
-
url: string;
|
|
100
|
-
} | {
|
|
101
|
-
type: 'http';
|
|
102
|
-
baseUrl: string;
|
|
103
|
-
} | {
|
|
104
|
-
type: 'rdp';
|
|
105
|
-
host: string;
|
|
106
|
-
port: number;
|
|
107
|
-
username: string;
|
|
108
|
-
password: string;
|
|
109
|
-
} | {
|
|
110
|
-
type: 'composite';
|
|
111
|
-
endpoints: Record<string, string>;
|
|
112
|
-
};
|
|
113
|
-
export interface V2RuntimeConnectionCreateRequest {
|
|
114
|
-
protocol: 'cdp';
|
|
115
|
-
options?: JsonObject;
|
|
116
|
-
}
|
|
117
|
-
export type V2RuntimeConnectionCreateOptions = Partial<V2RuntimeConnectionCreateRequest>;
|
|
118
|
-
export interface V2RuntimeConnection {
|
|
93
|
+
export interface V1RuntimeStartRuntime {
|
|
119
94
|
id: string;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
createdAt: string;
|
|
124
|
-
expiresAt: string | null;
|
|
125
|
-
closedAt?: string | null;
|
|
126
|
-
revokedAt?: string | null;
|
|
95
|
+
name: string;
|
|
96
|
+
type: V1RuntimeType;
|
|
97
|
+
status: V1RuntimeStatus;
|
|
127
98
|
}
|
|
128
|
-
export interface
|
|
129
|
-
|
|
99
|
+
export interface V1RuntimeStartRun extends V1RunSummary {
|
|
100
|
+
durationMs?: number | null;
|
|
101
|
+
lastSeenAt?: string | null;
|
|
102
|
+
endedReason?: string | null;
|
|
103
|
+
failureReason?: string | null;
|
|
130
104
|
}
|
|
131
|
-
export interface
|
|
132
|
-
|
|
133
|
-
|
|
105
|
+
export interface V1RuntimeStartBrowser {
|
|
106
|
+
cdpUrl: string;
|
|
107
|
+
connectionId: string;
|
|
134
108
|
}
|
|
135
|
-
export interface
|
|
109
|
+
export interface V1RuntimeStartResponse {
|
|
110
|
+
runtime: V1RuntimeStartRuntime;
|
|
111
|
+
run: V1RuntimeStartRun;
|
|
112
|
+
browser: V1RuntimeStartBrowser;
|
|
113
|
+
}
|
|
114
|
+
export interface V1RunListQuery extends V1PageQuery {
|
|
136
115
|
status?: string | string[];
|
|
137
116
|
spaceId?: string;
|
|
138
117
|
runtimeId?: string;
|
|
139
118
|
}
|
|
140
|
-
export type
|
|
141
|
-
export interface
|
|
119
|
+
export type V1RuntimeRunListQuery = Omit<V1RunListQuery, 'spaceId' | 'runtimeId'>;
|
|
120
|
+
export interface V1RunSummary {
|
|
142
121
|
id: string;
|
|
143
122
|
status: string;
|
|
144
123
|
createdAt: string;
|
|
145
124
|
startedAt: string;
|
|
146
125
|
finishedAt?: string | null;
|
|
147
126
|
}
|
|
148
|
-
export interface
|
|
127
|
+
export interface V1Run extends V1RunSummary {
|
|
149
128
|
spaceId: string;
|
|
150
129
|
runtimeId: string;
|
|
151
130
|
runtimeType: string;
|
|
@@ -154,7 +133,44 @@ export interface V2Run extends V2RunSummary {
|
|
|
154
133
|
endedReason?: string | null;
|
|
155
134
|
failureReason?: string | null;
|
|
156
135
|
}
|
|
157
|
-
export interface
|
|
136
|
+
export interface V1RunUsage {
|
|
137
|
+
runId: string;
|
|
138
|
+
runtimeId: string;
|
|
139
|
+
runtimeType: string;
|
|
140
|
+
status: string;
|
|
141
|
+
computedAt: string;
|
|
142
|
+
usage: {
|
|
143
|
+
runtime: {
|
|
144
|
+
seconds: number | null;
|
|
145
|
+
billingClass: string | null;
|
|
146
|
+
};
|
|
147
|
+
aiTokens: {
|
|
148
|
+
input: number | null;
|
|
149
|
+
output: number | null;
|
|
150
|
+
total: number | null;
|
|
151
|
+
};
|
|
152
|
+
proxyBytes: number | null;
|
|
153
|
+
captchaSolves: number;
|
|
154
|
+
files: {
|
|
155
|
+
count: number;
|
|
156
|
+
bytes: number;
|
|
157
|
+
};
|
|
158
|
+
invocations: number;
|
|
159
|
+
toolCalls: number;
|
|
160
|
+
};
|
|
161
|
+
billing: {
|
|
162
|
+
status: 'pending' | 'settled' | 'unavailable';
|
|
163
|
+
creditCost: number | null;
|
|
164
|
+
breakdown: {
|
|
165
|
+
runtime: number | null;
|
|
166
|
+
ai: number | null;
|
|
167
|
+
proxy: number | null;
|
|
168
|
+
captcha: number | null;
|
|
169
|
+
files: number | null;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
export interface V1RunEvent {
|
|
158
174
|
id: string;
|
|
159
175
|
runId: string;
|
|
160
176
|
runtimeId: string;
|
|
@@ -171,48 +187,48 @@ export interface V2RunEvent {
|
|
|
171
187
|
name?: string;
|
|
172
188
|
data?: JsonObject;
|
|
173
189
|
}
|
|
174
|
-
export interface
|
|
190
|
+
export interface V1RunEventsListQuery extends V1PageQuery {
|
|
175
191
|
type?: string | string[];
|
|
176
192
|
category?: string | string[];
|
|
177
193
|
connectionId?: string;
|
|
178
194
|
}
|
|
179
|
-
export interface
|
|
195
|
+
export interface V1RunEventsWaitRequest {
|
|
180
196
|
cursor?: string;
|
|
181
197
|
timeoutMs?: number;
|
|
182
198
|
type?: string[];
|
|
183
199
|
category?: string[];
|
|
184
200
|
connectionId?: string;
|
|
185
201
|
}
|
|
186
|
-
export interface
|
|
187
|
-
data:
|
|
202
|
+
export interface V1RunEventsWaitResponse {
|
|
203
|
+
data: V1RunEvent | null;
|
|
188
204
|
cursor: string | null;
|
|
189
205
|
timedOut: boolean;
|
|
190
206
|
}
|
|
191
|
-
export type
|
|
207
|
+
export type V1RunCommand = V1RunEvent & {
|
|
192
208
|
category: 'command';
|
|
193
209
|
};
|
|
194
|
-
export interface
|
|
210
|
+
export interface V1RunCommandsListQuery extends V1PageQuery {
|
|
195
211
|
type?: string | string[];
|
|
196
212
|
connectionId?: string;
|
|
197
213
|
}
|
|
198
|
-
export interface
|
|
214
|
+
export interface V1RunLiveRequest {
|
|
199
215
|
control?: string;
|
|
200
216
|
expiresInSeconds?: number;
|
|
201
217
|
}
|
|
202
|
-
export interface
|
|
218
|
+
export interface V1RunLiveResponse {
|
|
203
219
|
iframeUrl: string;
|
|
204
220
|
expiresAt: string;
|
|
205
221
|
}
|
|
206
|
-
export interface
|
|
222
|
+
export interface V1RunRecordingRequest {
|
|
207
223
|
expiresInSeconds?: number;
|
|
208
224
|
}
|
|
209
|
-
export interface
|
|
225
|
+
export interface V1RunRecordingResponse {
|
|
210
226
|
iframeUrl: string;
|
|
211
227
|
status: string;
|
|
212
228
|
durationMs?: number;
|
|
213
229
|
expiresAt: string;
|
|
214
230
|
}
|
|
215
|
-
export interface
|
|
231
|
+
export interface V1Invocation {
|
|
216
232
|
id: string;
|
|
217
233
|
runId: string;
|
|
218
234
|
spaceId: string;
|
|
@@ -230,32 +246,32 @@ export interface V2Invocation {
|
|
|
230
246
|
durationMs?: number | null;
|
|
231
247
|
metadata?: JsonObject | null;
|
|
232
248
|
}
|
|
233
|
-
export interface
|
|
234
|
-
data:
|
|
249
|
+
export interface V1InvocationResponse {
|
|
250
|
+
data: V1Invocation;
|
|
235
251
|
}
|
|
236
|
-
export interface
|
|
252
|
+
export interface V1InvocationWaitRequest {
|
|
237
253
|
timeoutMs?: number;
|
|
238
254
|
}
|
|
239
|
-
export interface
|
|
240
|
-
data:
|
|
255
|
+
export interface V1InvocationWaitResponse {
|
|
256
|
+
data: V1Invocation;
|
|
241
257
|
timedOut: boolean;
|
|
242
258
|
}
|
|
243
|
-
export type
|
|
259
|
+
export type V1RuntimeInvocationFileInput = {
|
|
244
260
|
storagePath: string;
|
|
245
261
|
name?: string;
|
|
246
262
|
} | {
|
|
247
263
|
fileId: string;
|
|
248
264
|
name?: string;
|
|
249
265
|
};
|
|
250
|
-
interface
|
|
266
|
+
interface V1RuntimeInvocationAgentFields {
|
|
251
267
|
target?: JsonObject;
|
|
252
268
|
idempotencyKey?: string;
|
|
253
269
|
outputSchema?: JsonObject;
|
|
254
270
|
toolsetId?: string;
|
|
255
271
|
metadata?: JsonObject;
|
|
256
|
-
files?:
|
|
272
|
+
files?: V1RuntimeInvocationFileInput[];
|
|
257
273
|
}
|
|
258
|
-
export type
|
|
274
|
+
export type V1RuntimeInvocationCreateRequest = {
|
|
259
275
|
provider: 'stagehand';
|
|
260
276
|
method: 'act' | 'observe';
|
|
261
277
|
target?: JsonObject;
|
|
@@ -270,13 +286,13 @@ export type V2RuntimeInvocationCreateRequest = {
|
|
|
270
286
|
outputSchema?: JsonObject;
|
|
271
287
|
idempotencyKey?: string;
|
|
272
288
|
metadata?: JsonObject;
|
|
273
|
-
} | (
|
|
289
|
+
} | (V1RuntimeInvocationAgentFields & {
|
|
274
290
|
provider: 'stagehand';
|
|
275
291
|
method: 'agent';
|
|
276
292
|
input: JsonObject;
|
|
277
293
|
config?: JsonObject;
|
|
278
294
|
options?: JsonObject;
|
|
279
|
-
}) | (
|
|
295
|
+
}) | (V1RuntimeInvocationAgentFields & {
|
|
280
296
|
provider: 'browserUse';
|
|
281
297
|
method: 'agent';
|
|
282
298
|
input: JsonObject;
|
|
@@ -290,7 +306,7 @@ export type V2RuntimeInvocationCreateRequest = {
|
|
|
290
306
|
idempotencyKey?: string;
|
|
291
307
|
metadata?: JsonObject;
|
|
292
308
|
};
|
|
293
|
-
export interface
|
|
309
|
+
export interface V1File {
|
|
294
310
|
id: string;
|
|
295
311
|
type: string;
|
|
296
312
|
source: 'upload' | 'runtime' | 'system';
|
|
@@ -306,7 +322,7 @@ export interface V2File {
|
|
|
306
322
|
expiresAt?: string | null;
|
|
307
323
|
downloadUrl?: string;
|
|
308
324
|
}
|
|
309
|
-
export interface
|
|
325
|
+
export interface V1FilesListQuery extends V1PageQuery {
|
|
310
326
|
spaceId: string;
|
|
311
327
|
source?: 'upload' | 'runtime' | 'system';
|
|
312
328
|
path?: string;
|
|
@@ -314,38 +330,38 @@ export interface V2FilesListQuery extends V2PageQuery {
|
|
|
314
330
|
query?: string;
|
|
315
331
|
contentType?: string;
|
|
316
332
|
}
|
|
317
|
-
export interface
|
|
333
|
+
export interface V1FileUpdateRequest {
|
|
318
334
|
name?: string;
|
|
319
335
|
metadata?: JsonObject | null;
|
|
320
336
|
}
|
|
321
|
-
export interface
|
|
337
|
+
export interface V1FileDeleteResponse {
|
|
322
338
|
success: true;
|
|
323
339
|
}
|
|
324
|
-
export interface
|
|
340
|
+
export interface V1FileUploadRequest {
|
|
325
341
|
spaceId: string;
|
|
326
342
|
file: Blob;
|
|
327
343
|
name?: string;
|
|
328
344
|
path?: string;
|
|
329
345
|
metadata?: JsonObject;
|
|
330
346
|
}
|
|
331
|
-
export interface
|
|
347
|
+
export interface V1RunFilesListQuery extends V1PageQuery {
|
|
332
348
|
type?: string | string[];
|
|
333
349
|
}
|
|
334
|
-
export interface
|
|
350
|
+
export interface V1RunFilesExportRequest {
|
|
335
351
|
format: 'zip';
|
|
336
352
|
name: string;
|
|
337
353
|
filter?: {
|
|
338
354
|
type?: string[];
|
|
339
355
|
};
|
|
340
356
|
}
|
|
341
|
-
export type
|
|
357
|
+
export type V1RuntimeFileStageRequest = {
|
|
342
358
|
storagePath: string;
|
|
343
359
|
name?: string;
|
|
344
360
|
} | {
|
|
345
361
|
fileId: string;
|
|
346
362
|
name?: string;
|
|
347
363
|
};
|
|
348
|
-
export interface
|
|
364
|
+
export interface V1RuntimeStagedFile {
|
|
349
365
|
id: string;
|
|
350
366
|
runtimeId: string;
|
|
351
367
|
runtimePath: string;
|
|
@@ -353,17 +369,17 @@ export interface V2RuntimeStagedFile {
|
|
|
353
369
|
sizeBytes: number;
|
|
354
370
|
expiresAt: string | null;
|
|
355
371
|
}
|
|
356
|
-
export interface
|
|
372
|
+
export interface V1RuntimeFileUploadRequest {
|
|
357
373
|
file: Blob;
|
|
358
374
|
name?: string;
|
|
359
375
|
storagePath?: string;
|
|
360
376
|
metadata?: JsonObject;
|
|
361
377
|
}
|
|
362
|
-
export interface
|
|
363
|
-
file:
|
|
364
|
-
staged:
|
|
378
|
+
export interface V1RuntimeFileUploadResponse {
|
|
379
|
+
file: V1File;
|
|
380
|
+
staged: V1RuntimeStagedFile;
|
|
365
381
|
}
|
|
366
|
-
export interface
|
|
382
|
+
export interface V1RuntimeFileCollectRequest {
|
|
367
383
|
path: string;
|
|
368
384
|
storagePath?: string;
|
|
369
385
|
name?: string;
|
|
@@ -373,14 +389,4 @@ export interface V2RuntimeFileCollectRequest {
|
|
|
373
389
|
metadata?: JsonObject;
|
|
374
390
|
};
|
|
375
391
|
}
|
|
376
|
-
export interface BrowserLaunchOptions {
|
|
377
|
-
name: string;
|
|
378
|
-
state?: 'ephemeral' | 'profile';
|
|
379
|
-
metadata?: JsonObject;
|
|
380
|
-
lifecycle?: V2RuntimeLifecycleConfig;
|
|
381
|
-
stealth?: V2BrowserStealth;
|
|
382
|
-
proxy?: V2ProxyInput | null;
|
|
383
|
-
fingerprint?: V2RuntimeFingerprintCreateConfig;
|
|
384
|
-
extensions?: string[];
|
|
385
|
-
}
|
|
386
392
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bctrl/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "BCTRL SDK - Remote browser automation",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"clean": "rm -rf dist",
|
|
30
30
|
"build": "pnpm run clean && tsc -p tsconfig.json",
|
|
31
31
|
"dev": "tsc --watch",
|
|
32
|
-
"test": "tsx --test tests/
|
|
33
|
-
"test:
|
|
34
|
-
"test:
|
|
32
|
+
"test": "tsx --test tests/v1/*.test.ts tests/v1/e2e/*.test.ts",
|
|
33
|
+
"test:v1": "tsx --test tests/v1/*.test.ts tests/v1/e2e/*.test.ts",
|
|
34
|
+
"test:v1:e2e": "BCTRL_E2E=1 tsx --test tests/v1/e2e/**/*.test.ts",
|
|
35
35
|
"typecheck": "tsc --noEmit"
|
|
36
36
|
}
|
|
37
37
|
}
|