@bctrl/sdk 1.0.8 → 1.0.9
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/LICENSE +15 -0
- package/README.md +1 -1
- package/dist/account.d.ts +2 -0
- package/dist/account.js +3 -0
- package/dist/bctrl.d.ts +5 -0
- package/dist/bctrl.js +12 -1
- package/dist/browserExtensionTypes.d.ts +0 -2
- package/dist/browserExtensions.js +0 -3
- package/dist/generated/openapi-types.d.ts +2688 -883
- package/dist/http.d.ts +3 -0
- package/dist/http.js +17 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/invocations.d.ts +9 -8
- package/dist/invocations.js +11 -10
- package/dist/node.d.ts +3 -3
- package/dist/notificationRecipients.d.ts +11 -0
- package/dist/notificationRecipients.js +32 -0
- package/dist/runs.d.ts +3 -3
- package/dist/runtimes.d.ts +12 -1
- package/dist/runtimes.js +54 -0
- package/dist/types.d.ts +18 -6
- package/package.json +51 -46
package/dist/http.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export interface V1ClientOptions {
|
|
2
2
|
apiKey?: string;
|
|
3
3
|
baseUrl?: string;
|
|
4
|
+
subaccountId?: string;
|
|
4
5
|
timeoutMs?: number;
|
|
5
6
|
maxRetries?: number;
|
|
6
7
|
fetch?: typeof fetch;
|
|
@@ -22,7 +23,9 @@ export declare class V1HttpClient {
|
|
|
22
23
|
private readonly timeoutMs?;
|
|
23
24
|
private readonly maxRetries;
|
|
24
25
|
private readonly fetchImpl;
|
|
26
|
+
private readonly subaccountId?;
|
|
25
27
|
constructor(options: V1ClientOptions);
|
|
28
|
+
withSubaccount(subaccountId: string): V1HttpClient;
|
|
26
29
|
request<T>(path: string, options?: V1RequestOptions): Promise<T>;
|
|
27
30
|
raw(path: string, options?: V1RequestOptions): Promise<Response>;
|
|
28
31
|
}
|
package/dist/http.js
CHANGED
|
@@ -74,12 +74,28 @@ export class V1HttpClient {
|
|
|
74
74
|
timeoutMs;
|
|
75
75
|
maxRetries;
|
|
76
76
|
fetchImpl;
|
|
77
|
+
subaccountId;
|
|
77
78
|
constructor(options) {
|
|
78
79
|
this.baseUrl = resolveV1ApiBaseUrl(options.baseUrl);
|
|
79
80
|
this.apiKey = resolveV1ApiKey(options.apiKey);
|
|
80
81
|
this.timeoutMs = options.timeoutMs;
|
|
81
82
|
this.maxRetries = options.maxRetries ?? 2;
|
|
82
83
|
this.fetchImpl = options.fetch ?? fetch;
|
|
84
|
+
this.subaccountId = options.subaccountId?.trim() || undefined;
|
|
85
|
+
}
|
|
86
|
+
withSubaccount(subaccountId) {
|
|
87
|
+
const trimmed = subaccountId.trim();
|
|
88
|
+
if (!trimmed) {
|
|
89
|
+
throw new TypeError('subaccountId must be a non-empty string');
|
|
90
|
+
}
|
|
91
|
+
return new V1HttpClient({
|
|
92
|
+
apiKey: this.apiKey,
|
|
93
|
+
baseUrl: this.baseUrl,
|
|
94
|
+
subaccountId: trimmed,
|
|
95
|
+
timeoutMs: this.timeoutMs,
|
|
96
|
+
maxRetries: this.maxRetries,
|
|
97
|
+
fetch: this.fetchImpl,
|
|
98
|
+
});
|
|
83
99
|
}
|
|
84
100
|
async request(path, options = {}) {
|
|
85
101
|
const response = await this.raw(path, options);
|
|
@@ -97,6 +113,7 @@ export class V1HttpClient {
|
|
|
97
113
|
Authorization: `Bearer ${this.apiKey}`,
|
|
98
114
|
'x-sdk-version': SDK_VERSION,
|
|
99
115
|
'User-Agent': `@bctrl/sdk/${SDK_VERSION} v1`,
|
|
116
|
+
...(this.subaccountId ? { 'BCTRL-Subaccount-Id': this.subaccountId } : {}),
|
|
100
117
|
...options.headers,
|
|
101
118
|
};
|
|
102
119
|
const method = options.method ?? 'GET';
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export { V1FilesClient } from './files.js';
|
|
|
7
7
|
export { V1HelpClient } from './help.js';
|
|
8
8
|
export { V1RuntimeBrowserUseInvocationsNamespaceClient, V1RuntimeInvocationsNamespaceClient, V1RuntimeStagehandInvocationsNamespaceClient, } from './invocations.js';
|
|
9
9
|
export type { BrowserUseAgentOptions, V1InvocationCreateAndWaitOptions, V1InvocationWaitOptions, V1RuntimeInvocationCreateInput, StagehandActOptions, StagehandAgentOptions, StagehandExtractOptions, StagehandObserveOptions, StagehandVariablePrimitive, StagehandVariableValue, StagehandVariables, } from './invocations.js';
|
|
10
|
-
export { V1RuntimeFilesNamespaceClient, V1RuntimeRunsNamespaceClient, V1RuntimeTargetsNamespaceClient, V1RuntimesClient, } from './runtimes.js';
|
|
10
|
+
export { V1RuntimeFilesNamespaceClient, V1RuntimeHumanActionsNamespaceClient, V1RuntimeRunsNamespaceClient, V1RuntimeTargetsNamespaceClient, V1RuntimesClient, } from './runtimes.js';
|
|
11
|
+
export { V1NotificationRecipientsClient } from './notificationRecipients.js';
|
|
11
12
|
export { V1ProxiesClient, V1ProxyPoolsClient } from './proxies.js';
|
|
12
13
|
export { V1RunActivityNamespaceClient, V1RunEventsNamespaceClient, V1RunFilesNamespaceClient, V1RunInvocationsNamespaceClient, V1RunsClient, } from './runs.js';
|
|
13
14
|
export { toOutputSchema, type JsonSchemaLike, type JsonSchemaObject } from './schemas.js';
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,8 @@ export { BctrlError, BctrlApiError, BctrlAuthenticationError, BctrlConflictError
|
|
|
6
6
|
export { V1FilesClient } from './files.js';
|
|
7
7
|
export { V1HelpClient } from './help.js';
|
|
8
8
|
export { V1RuntimeBrowserUseInvocationsNamespaceClient, V1RuntimeInvocationsNamespaceClient, V1RuntimeStagehandInvocationsNamespaceClient, } from './invocations.js';
|
|
9
|
-
export { V1RuntimeFilesNamespaceClient, V1RuntimeRunsNamespaceClient, V1RuntimeTargetsNamespaceClient, V1RuntimesClient, } from './runtimes.js';
|
|
9
|
+
export { V1RuntimeFilesNamespaceClient, V1RuntimeHumanActionsNamespaceClient, V1RuntimeRunsNamespaceClient, V1RuntimeTargetsNamespaceClient, V1RuntimesClient, } from './runtimes.js';
|
|
10
|
+
export { V1NotificationRecipientsClient } from './notificationRecipients.js';
|
|
10
11
|
export { V1ProxiesClient, V1ProxyPoolsClient } from './proxies.js';
|
|
11
12
|
export { V1RunActivityNamespaceClient, V1RunEventsNamespaceClient, V1RunFilesNamespaceClient, V1RunInvocationsNamespaceClient, V1RunsClient, } from './runs.js';
|
|
12
13
|
export { toOutputSchema } from './schemas.js';
|
package/dist/invocations.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type V1HttpClient, type V1IdempotencyOptions } from './http.js';
|
|
2
2
|
import { type JsonSchemaLike } from './schemas.js';
|
|
3
|
-
import type { JsonObject, V1Invocation, V1RuntimeInvocationCreateRequest, V1RuntimeInvocationFileInput, V1RuntimeTargetSelector, V1InvocationWaitRequest, V1InvocationWaitResponse, V1AiModelSelection } from './types.js';
|
|
3
|
+
import type { JsonObject, V1Invocation, V1RuntimeInvocationCreateRequest, V1RuntimeInvocationFileInput, V1RuntimeInvocationManagedTools, V1RuntimeTargetSelector, V1InvocationWaitRequest, V1InvocationWaitResponse, V1AiModelSelection } from './types.js';
|
|
4
4
|
export type StagehandVariablePrimitive = string | number | boolean;
|
|
5
5
|
export type StagehandVariableValue = StagehandVariablePrimitive | {
|
|
6
6
|
value: StagehandVariablePrimitive;
|
|
@@ -14,9 +14,10 @@ interface RuntimeInvocationCommonOptions {
|
|
|
14
14
|
interface RuntimeAgentCommonOptions extends RuntimeInvocationCommonOptions {
|
|
15
15
|
toolsetId?: string;
|
|
16
16
|
toolIds?: string[];
|
|
17
|
+
tools?: V1RuntimeInvocationManagedTools;
|
|
17
18
|
files?: V1RuntimeInvocationFileInput[];
|
|
18
19
|
schema?: JsonSchemaLike;
|
|
19
|
-
|
|
20
|
+
timeoutSeconds?: number;
|
|
20
21
|
}
|
|
21
22
|
interface AiSelectionOptions {
|
|
22
23
|
model?: V1AiModelSelection;
|
|
@@ -28,18 +29,18 @@ type StagehandActionInput = Extract<V1RuntimeInvocationCreateRequest, {
|
|
|
28
29
|
export interface StagehandActOptions extends RuntimeInvocationCommonOptions, AiSelectionOptions {
|
|
29
30
|
instruction: string;
|
|
30
31
|
stagehandAction?: StagehandActionInput;
|
|
31
|
-
|
|
32
|
+
timeoutSeconds?: number;
|
|
32
33
|
}
|
|
33
34
|
export interface StagehandObserveOptions extends RuntimeInvocationCommonOptions, AiSelectionOptions {
|
|
34
35
|
instruction: string;
|
|
35
36
|
selector?: string;
|
|
36
|
-
|
|
37
|
+
timeoutSeconds?: number;
|
|
37
38
|
}
|
|
38
39
|
export type StagehandExtractOptions<TSchema extends JsonSchemaLike | undefined = undefined> = RuntimeInvocationCommonOptions & AiSelectionOptions & {
|
|
39
40
|
instruction?: string;
|
|
40
41
|
selector?: string;
|
|
41
42
|
schema?: TSchema;
|
|
42
|
-
|
|
43
|
+
timeoutSeconds?: number;
|
|
43
44
|
};
|
|
44
45
|
export interface StagehandAgentOptions extends RuntimeAgentCommonOptions, AiSelectionOptions {
|
|
45
46
|
instruction: string;
|
|
@@ -59,7 +60,7 @@ export interface BrowserUseAgentOptions extends RuntimeAgentCommonOptions, AiSel
|
|
|
59
60
|
flashMode?: boolean;
|
|
60
61
|
enablePlanning?: boolean;
|
|
61
62
|
maxFailures?: number;
|
|
62
|
-
|
|
63
|
+
stepTimeoutSeconds?: number;
|
|
63
64
|
maxActionsPerStep?: number;
|
|
64
65
|
maxHistoryItems?: number | null;
|
|
65
66
|
useThinking?: boolean;
|
|
@@ -91,11 +92,11 @@ export interface V1InvocationCreateAndWaitOptions extends V1IdempotencyOptions {
|
|
|
91
92
|
* Overall client-side wait budget across repeated long-poll requests.
|
|
92
93
|
* The server-side invocation timeout still belongs in the invocation body.
|
|
93
94
|
*/
|
|
94
|
-
|
|
95
|
+
timeoutSeconds?: number;
|
|
95
96
|
/**
|
|
96
97
|
* Per-request long-poll timeout sent to the wait endpoint.
|
|
97
98
|
*/
|
|
98
|
-
|
|
99
|
+
pollTimeoutSeconds?: number;
|
|
99
100
|
signal?: AbortSignal;
|
|
100
101
|
}
|
|
101
102
|
export declare class V1RuntimeInvocationsNamespaceClient {
|
package/dist/invocations.js
CHANGED
|
@@ -172,27 +172,28 @@ function hasInvocationSchema(request) {
|
|
|
172
172
|
return 'schema' in request && request.schema !== undefined;
|
|
173
173
|
}
|
|
174
174
|
async function waitForInvocation(client, invocationId, options) {
|
|
175
|
-
const deadline = options.
|
|
175
|
+
const deadline = options.timeoutSeconds === undefined ? undefined : Date.now() + options.timeoutSeconds * 1000;
|
|
176
176
|
for (;;) {
|
|
177
177
|
if (deadline !== undefined && Date.now() >= deadline) {
|
|
178
178
|
throw new Error(`Invocation ${invocationId} did not finish before timeout`);
|
|
179
179
|
}
|
|
180
|
-
const
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
180
|
+
const remainingMs = deadline === undefined ? undefined : Math.max(1, deadline - Date.now());
|
|
181
|
+
const remainingSeconds = remainingMs === undefined ? undefined : Math.max(1, Math.ceil(remainingMs / 1000));
|
|
182
|
+
const timeoutSeconds = options.pollTimeoutSeconds === undefined
|
|
183
|
+
? remainingSeconds
|
|
184
|
+
: remainingSeconds === undefined
|
|
185
|
+
? options.pollTimeoutSeconds
|
|
186
|
+
: Math.min(options.pollTimeoutSeconds, remainingSeconds);
|
|
186
187
|
const result = await client.wait(invocationId, {
|
|
187
|
-
...(
|
|
188
|
+
...(timeoutSeconds === undefined ? {} : { timeoutSeconds }),
|
|
188
189
|
signal: options.signal,
|
|
189
190
|
});
|
|
190
191
|
if (result.waitStatus === 'completed') {
|
|
191
192
|
return result;
|
|
192
193
|
}
|
|
193
194
|
const sleepMs = deadline === undefined
|
|
194
|
-
? (result.
|
|
195
|
-
: Math.min(result.
|
|
195
|
+
? (result.retryAfterSeconds ?? 1) * 1000
|
|
196
|
+
: Math.min((result.retryAfterSeconds ?? 1) * 1000, Math.max(0, deadline - Date.now()));
|
|
196
197
|
await abortableSleep(sleepMs, options.signal);
|
|
197
198
|
}
|
|
198
199
|
}
|
package/dist/node.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ type V1HostedToolCreateRequest = Extract<V1ToolCreateRequest, {
|
|
|
6
6
|
export declare function createHostedToolFromFile(client: BctrlV1, request: Omit<V1HostedToolCreateRequest, 'source'> & {
|
|
7
7
|
filePath: string;
|
|
8
8
|
}): Promise<{
|
|
9
|
-
builtin: "files" | "vault" | "captcha";
|
|
9
|
+
builtin: "files" | "vault" | "captcha" | "human_action";
|
|
10
10
|
createdAt: string;
|
|
11
11
|
description: string | null;
|
|
12
12
|
id: string;
|
|
@@ -72,7 +72,7 @@ export declare function createHostedToolFromFile(client: BctrlV1, request: Omit<
|
|
|
72
72
|
};
|
|
73
73
|
spaceId: string | null;
|
|
74
74
|
status: "enabled" | "disabled";
|
|
75
|
-
|
|
75
|
+
timeoutSeconds?: number;
|
|
76
76
|
type: "webhook";
|
|
77
77
|
updatedAt: string;
|
|
78
78
|
url: string;
|
|
@@ -103,7 +103,7 @@ export declare function createToolVersionFromFile(client: BctrlV1, toolId: strin
|
|
|
103
103
|
id: string;
|
|
104
104
|
metadata?: import("./generated/openapi-types.js").components["schemas"]["ToolMetadata"] | null;
|
|
105
105
|
source: string;
|
|
106
|
-
|
|
106
|
+
timeoutSeconds: number;
|
|
107
107
|
toolId: string;
|
|
108
108
|
version: number;
|
|
109
109
|
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { V1HttpClient } from './http.js';
|
|
2
|
+
import type { V1ListEnvelope, V1NotificationRecipient, V1NotificationRecipientCreateRequest, V1NotificationRecipientDeleteResponse, V1NotificationRecipientListQuery, V1NotificationRecipientUpdateRequest } from './types.js';
|
|
3
|
+
export declare class V1NotificationRecipientsClient {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: V1HttpClient);
|
|
6
|
+
list(query?: V1NotificationRecipientListQuery): Promise<V1ListEnvelope<V1NotificationRecipient>>;
|
|
7
|
+
iter(query?: V1NotificationRecipientListQuery): AsyncGenerator<V1NotificationRecipient, void, undefined>;
|
|
8
|
+
create(request: V1NotificationRecipientCreateRequest): Promise<V1NotificationRecipient>;
|
|
9
|
+
update(recipientId: string, request: V1NotificationRecipientUpdateRequest): Promise<V1NotificationRecipient>;
|
|
10
|
+
delete(recipientId: string): Promise<V1NotificationRecipientDeleteResponse>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { iterateV1Pages } from './pagination.js';
|
|
2
|
+
export class V1NotificationRecipientsClient {
|
|
3
|
+
http;
|
|
4
|
+
constructor(http) {
|
|
5
|
+
this.http = http;
|
|
6
|
+
}
|
|
7
|
+
list(query = {}) {
|
|
8
|
+
return this.http.request('/notification-recipients', {
|
|
9
|
+
query,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
iter(query = {}) {
|
|
13
|
+
return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
|
|
14
|
+
}
|
|
15
|
+
create(request) {
|
|
16
|
+
return this.http.request('/notification-recipients', {
|
|
17
|
+
method: 'POST',
|
|
18
|
+
body: request,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
update(recipientId, request) {
|
|
22
|
+
return this.http.request(`/notification-recipients/${encodeURIComponent(recipientId)}`, {
|
|
23
|
+
method: 'PATCH',
|
|
24
|
+
body: request,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
delete(recipientId) {
|
|
28
|
+
return this.http.request(`/notification-recipients/${encodeURIComponent(recipientId)}`, {
|
|
29
|
+
method: 'DELETE',
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
package/dist/runs.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ export declare class V1RunInvocationsNamespaceClient {
|
|
|
71
71
|
list(runId: string, query?: V1RunInvocationsListQuery): Promise<V1ListEnvelope<{
|
|
72
72
|
action: "act" | "observe" | "extract" | "browserUse" | "stagehandAgent" | "solveCaptcha";
|
|
73
73
|
createdAt: string;
|
|
74
|
-
|
|
74
|
+
durationSeconds?: number | null;
|
|
75
75
|
error?: {
|
|
76
76
|
code?: string;
|
|
77
77
|
details?: {
|
|
@@ -88,7 +88,7 @@ export declare class V1RunInvocationsNamespaceClient {
|
|
|
88
88
|
iter(runId: string, query?: V1RunInvocationsListQuery): AsyncGenerator<{
|
|
89
89
|
action: "act" | "observe" | "extract" | "browserUse" | "stagehandAgent" | "solveCaptcha";
|
|
90
90
|
createdAt: string;
|
|
91
|
-
|
|
91
|
+
durationSeconds?: number | null;
|
|
92
92
|
error?: {
|
|
93
93
|
code?: string;
|
|
94
94
|
details?: {
|
|
@@ -105,7 +105,7 @@ export declare class V1RunInvocationsNamespaceClient {
|
|
|
105
105
|
get(runId: string, invocationId: string): Promise<{
|
|
106
106
|
action: "act" | "observe" | "extract" | "browserUse" | "stagehandAgent" | "solveCaptcha";
|
|
107
107
|
createdAt: string;
|
|
108
|
-
|
|
108
|
+
durationSeconds?: number | null;
|
|
109
109
|
error?: {
|
|
110
110
|
code: "invocation.failed" | "invocation.cancelled" | "invocation.timed_out" | "invocation.dispatch_preparation_failed" | "invocation.dispatch_unavailable" | "invocation.captcha_not_found" | "invocation.captcha_solve_failed" | "invocation.output_validation_failed" | "invocation.stagehand_failed" | "invocation.stagehand_incomplete" | "invocation.browser_use_failed" | "invocation.browser_use_interrupted" | "invocation.browser_use_incomplete";
|
|
111
111
|
details?: {
|
package/dist/runtimes.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type V1HttpClient, type V1IdempotencyOptions } from './http.js';
|
|
2
2
|
import { V1RuntimeInvocationsNamespaceClient } from './invocations.js';
|
|
3
|
-
import type { V1ListEnvelope, V1File, V1Runtime, V1RuntimeCreateRequest, V1RuntimeDeleteResponse, V1RuntimeFileCollectRequest, V1RuntimeFilesListQuery, V1RuntimeFileStageRequest, V1RuntimeFileUploadRequest, V1RuntimeStagedFile, V1RuntimeListQuery, V1RuntimeRunListQuery, V1RuntimeStartResponse, V1RuntimeStopResponse, V1RuntimeTarget, V1RuntimeTargetCreateRequest, V1RuntimeUpdateRequest, V1RunSummary, V1SpaceRuntimeCreateRequest } from './types.js';
|
|
3
|
+
import type { V1ListEnvelope, V1File, V1HumanAction, V1HumanActionCreateRequest, V1HumanActionWaitRequest, V1HumanActionWaitResponse, V1Runtime, V1RuntimeCreateRequest, V1RuntimeDeleteResponse, V1RuntimeFileCollectRequest, V1RuntimeFilesListQuery, V1RuntimeFileStageRequest, V1RuntimeFileUploadRequest, V1RuntimeStagedFile, V1RuntimeListQuery, V1RuntimeRunListQuery, V1RuntimeStartResponse, V1RuntimeStopResponse, V1RuntimeTarget, V1RuntimeTargetCreateRequest, V1RuntimeUpdateRequest, V1RunSummary, V1SpaceRuntimeCreateRequest } from './types.js';
|
|
4
4
|
export type V1RuntimeStartResult = V1RuntimeStartResponse;
|
|
5
5
|
export declare class V1RuntimesClient {
|
|
6
6
|
private readonly http;
|
|
@@ -8,6 +8,8 @@ export declare class V1RuntimesClient {
|
|
|
8
8
|
readonly runs: V1RuntimeRunsNamespaceClient;
|
|
9
9
|
readonly invocations: V1RuntimeInvocationsNamespaceClient;
|
|
10
10
|
readonly targets: V1RuntimeTargetsNamespaceClient;
|
|
11
|
+
readonly humanAction: V1RuntimeHumanActionsNamespaceClient;
|
|
12
|
+
readonly humanActions: V1RuntimeHumanActionsNamespaceClient;
|
|
11
13
|
constructor(http: V1HttpClient);
|
|
12
14
|
list(query?: V1RuntimeListQuery): Promise<V1ListEnvelope<V1Runtime>>;
|
|
13
15
|
iter(query?: V1RuntimeListQuery): AsyncGenerator<V1Runtime, void, undefined>;
|
|
@@ -36,6 +38,15 @@ export declare class V1RuntimeFilesNamespaceClient {
|
|
|
36
38
|
stage(runtimeId: string, request: V1RuntimeFileStageRequest): Promise<V1RuntimeStagedFile>;
|
|
37
39
|
collect(runtimeId: string, request: V1RuntimeFileCollectRequest): Promise<V1File>;
|
|
38
40
|
}
|
|
41
|
+
export declare class V1RuntimeHumanActionsNamespaceClient {
|
|
42
|
+
private readonly http;
|
|
43
|
+
constructor(http: V1HttpClient);
|
|
44
|
+
create(runtimeId: string, request: V1HumanActionCreateRequest): Promise<V1HumanAction>;
|
|
45
|
+
get(runtimeId: string): Promise<V1HumanAction>;
|
|
46
|
+
complete(runtimeId: string): Promise<V1HumanAction>;
|
|
47
|
+
cancel(runtimeId: string): Promise<V1HumanAction>;
|
|
48
|
+
wait(runtimeId: string, request?: V1HumanActionWaitRequest): Promise<V1HumanActionWaitResponse>;
|
|
49
|
+
}
|
|
39
50
|
export declare class V1RuntimeTargetsNamespaceClient {
|
|
40
51
|
private readonly http;
|
|
41
52
|
constructor(http: V1HttpClient);
|
package/dist/runtimes.js
CHANGED
|
@@ -87,18 +87,51 @@ class V1RuntimeTargetsClient {
|
|
|
87
87
|
return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/targets/${encodeURIComponent(targetId)}`, { method: 'DELETE' });
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
+
class V1RuntimeHumanActionsClient {
|
|
91
|
+
http;
|
|
92
|
+
runtimeId;
|
|
93
|
+
constructor(http, runtimeId) {
|
|
94
|
+
this.http = http;
|
|
95
|
+
this.runtimeId = runtimeId;
|
|
96
|
+
}
|
|
97
|
+
create(request) {
|
|
98
|
+
return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/human-actions`, {
|
|
99
|
+
method: 'POST',
|
|
100
|
+
body: request,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
get() {
|
|
104
|
+
return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/human-actions`);
|
|
105
|
+
}
|
|
106
|
+
complete() {
|
|
107
|
+
return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/human-actions/complete`, { method: 'POST' });
|
|
108
|
+
}
|
|
109
|
+
cancel() {
|
|
110
|
+
return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/human-actions/cancel`, { method: 'POST' });
|
|
111
|
+
}
|
|
112
|
+
wait(request = {}) {
|
|
113
|
+
return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/human-actions/wait`, {
|
|
114
|
+
method: 'POST',
|
|
115
|
+
body: request,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
90
119
|
export class V1RuntimesClient {
|
|
91
120
|
http;
|
|
92
121
|
files;
|
|
93
122
|
runs;
|
|
94
123
|
invocations;
|
|
95
124
|
targets;
|
|
125
|
+
humanAction;
|
|
126
|
+
humanActions;
|
|
96
127
|
constructor(http) {
|
|
97
128
|
this.http = http;
|
|
98
129
|
this.files = new V1RuntimeFilesNamespaceClient(http);
|
|
99
130
|
this.runs = new V1RuntimeRunsNamespaceClient(http);
|
|
100
131
|
this.invocations = new V1RuntimeInvocationsNamespaceClient(http);
|
|
101
132
|
this.targets = new V1RuntimeTargetsNamespaceClient(http);
|
|
133
|
+
this.humanAction = new V1RuntimeHumanActionsNamespaceClient(http);
|
|
134
|
+
this.humanActions = this.humanAction;
|
|
102
135
|
}
|
|
103
136
|
list(query = {}) {
|
|
104
137
|
return this.http.request('/runtimes', { query });
|
|
@@ -175,6 +208,27 @@ export class V1RuntimeFilesNamespaceClient {
|
|
|
175
208
|
return new V1RuntimeFilesClient(this.http, runtimeId).collect(request);
|
|
176
209
|
}
|
|
177
210
|
}
|
|
211
|
+
export class V1RuntimeHumanActionsNamespaceClient {
|
|
212
|
+
http;
|
|
213
|
+
constructor(http) {
|
|
214
|
+
this.http = http;
|
|
215
|
+
}
|
|
216
|
+
create(runtimeId, request) {
|
|
217
|
+
return new V1RuntimeHumanActionsClient(this.http, runtimeId).create(request);
|
|
218
|
+
}
|
|
219
|
+
get(runtimeId) {
|
|
220
|
+
return new V1RuntimeHumanActionsClient(this.http, runtimeId).get();
|
|
221
|
+
}
|
|
222
|
+
complete(runtimeId) {
|
|
223
|
+
return new V1RuntimeHumanActionsClient(this.http, runtimeId).complete();
|
|
224
|
+
}
|
|
225
|
+
cancel(runtimeId) {
|
|
226
|
+
return new V1RuntimeHumanActionsClient(this.http, runtimeId).cancel();
|
|
227
|
+
}
|
|
228
|
+
wait(runtimeId, request = {}) {
|
|
229
|
+
return new V1RuntimeHumanActionsClient(this.http, runtimeId).wait(request);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
178
232
|
export class V1RuntimeTargetsNamespaceClient {
|
|
179
233
|
http;
|
|
180
234
|
constructor(http) {
|
package/dist/types.d.ts
CHANGED
|
@@ -18,8 +18,8 @@ export interface V1PageQuery {
|
|
|
18
18
|
cursor?: string;
|
|
19
19
|
limit?: number;
|
|
20
20
|
}
|
|
21
|
-
export type V1HelpAudience = NonNullable<
|
|
22
|
-
export type V1HelpRequest =
|
|
21
|
+
export type V1HelpAudience = NonNullable<OpenApiQuery<'help'>['audience']>;
|
|
22
|
+
export type V1HelpRequest = OpenApiQuery<'help'>;
|
|
23
23
|
export type V1HelpField = OpenApiSchemas['HelpField'];
|
|
24
24
|
export type V1HelpFlag = OpenApiSchemas['HelpFlag'];
|
|
25
25
|
export type V1HelpIo = OpenApiSchemas['HelpIo'];
|
|
@@ -54,7 +54,7 @@ export type V1BrowserNetworkTrafficConfig = OpenApiSchemas['BrowserNetworkTraffi
|
|
|
54
54
|
export type V1BrowserRuntimeCreateConfig = OpenApiSchemas['BrowserRuntimeCreateConfig'];
|
|
55
55
|
export type V1RuntimeCreateRequest = OpenApiSchemas['RuntimeCreateRequest'];
|
|
56
56
|
export type V1SpaceRuntimeCreateRequest = Omit<V1RuntimeCreateRequest, 'spaceId'>;
|
|
57
|
-
/** PATCH /v1/runtimes/{runtimeId} — name and
|
|
57
|
+
/** PATCH /v1/runtimes/{runtimeId} — name and idleTimeoutSeconds are editable
|
|
58
58
|
* any time; `config` only while the runtime is stopped. */
|
|
59
59
|
export type V1RuntimeUpdateRequest = OpenApiSchemas['RuntimeUpdateRequest'];
|
|
60
60
|
export type V1RuntimeDeleteResponse = OpenApiSchemas['RuntimeDeleteResponse'];
|
|
@@ -98,7 +98,7 @@ export interface V1RuntimeStartRuntime {
|
|
|
98
98
|
status: V1RuntimeStatus;
|
|
99
99
|
}
|
|
100
100
|
export interface V1RuntimeStartRun extends V1RunSummary {
|
|
101
|
-
|
|
101
|
+
durationSeconds?: number | null;
|
|
102
102
|
failureReason?: string | null;
|
|
103
103
|
}
|
|
104
104
|
export type V1ConnectionProtocol = 'cdp';
|
|
@@ -180,6 +180,9 @@ export interface V1RuntimeInvocationFileInput {
|
|
|
180
180
|
name?: string;
|
|
181
181
|
}
|
|
182
182
|
export type V1RuntimeInvocationCreateRequest = OpenApiSchemas['RuntimeInvocationCreateRequest'];
|
|
183
|
+
export type V1RuntimeInvocationManagedTools = NonNullable<Extract<V1RuntimeInvocationCreateRequest, {
|
|
184
|
+
action: 'browserUse';
|
|
185
|
+
}>['tools']>;
|
|
183
186
|
export type V1File = OpenApiSchemas['File'];
|
|
184
187
|
export type V1FilesListQuery = OpenApiQuery<'files.list'>;
|
|
185
188
|
/** Immediate-subfolder rollup returned by files.list with `include: 'folders'`. */
|
|
@@ -208,6 +211,15 @@ export interface V1RuntimeFileUploadRequest {
|
|
|
208
211
|
metadata?: JsonObject;
|
|
209
212
|
}
|
|
210
213
|
export type V1RuntimeFileCollectRequest = OpenApiSchemas['RuntimeFileCollectRequest'];
|
|
214
|
+
export type V1HumanAction = OpenApiSchemas['HumanAction'];
|
|
215
|
+
export type V1HumanActionCreateRequest = OpenApiSchemas['HumanActionCreateRequest'];
|
|
216
|
+
export type V1HumanActionWaitRequest = OpenApiSchemas['HumanActionWaitRequest'];
|
|
217
|
+
export type V1HumanActionWaitResponse = OpenApiSchemas['HumanActionWait'];
|
|
218
|
+
export type V1NotificationRecipient = OpenApiSchemas['NotificationRecipient'];
|
|
219
|
+
export type V1NotificationRecipientCreateRequest = OpenApiSchemas['NotificationRecipientCreateRequest'];
|
|
220
|
+
export type V1NotificationRecipientUpdateRequest = OpenApiSchemas['NotificationRecipientUpdateRequest'];
|
|
221
|
+
export type V1NotificationRecipientDeleteResponse = OpenApiSchemas['NotificationRecipientDeleteResponse'];
|
|
222
|
+
export type V1NotificationRecipientListQuery = OpenApiQuery<'notification-recipients.list'>;
|
|
211
223
|
export type { V1ManagedRotatingDevice, V1ManagedRotatingPreference, V1ManagedRotatingProxyConfig, V1ManagedRotatingRotation, V1Proxy, V1ProxyBase, V1ProxyCreateRequest, V1ProxyDeleteResponse, V1ProxyDnsResolution, V1ProxyListQuery, V1ProxyPool, V1ProxyPoolListQuery, V1ProxyProtocol, V1ProxyTestResponse, V1ProxyType, V1ProxyUpdateRequest, } from './proxyTypes.js';
|
|
212
224
|
export type { V1VaultSecret, V1VaultSecretDeleteResponse, V1VaultSecretListQuery, V1VaultSecretPatchRequest, V1VaultSecretType, V1VaultSecretUpsertRequest, V1VaultSecretValue, V1VaultTotpResponse, } from './vaultTypes.js';
|
|
213
225
|
export type V1ToolExecutionType = OpenApiSchemas['ToolCallTool']['executionType'];
|
|
@@ -220,7 +232,7 @@ export type V1ToolExecution = {
|
|
|
220
232
|
type: 'hmac';
|
|
221
233
|
secretId: string;
|
|
222
234
|
};
|
|
223
|
-
|
|
235
|
+
timeoutSeconds?: number;
|
|
224
236
|
} | {
|
|
225
237
|
type: 'hosted_function';
|
|
226
238
|
functionVersionId: string;
|
|
@@ -234,7 +246,7 @@ export type V1ToolExecution = {
|
|
|
234
246
|
workflowId: string;
|
|
235
247
|
} | {
|
|
236
248
|
type: 'bctrl_builtin';
|
|
237
|
-
name:
|
|
249
|
+
name: V1RuntimeInvocationManagedTools[number];
|
|
238
250
|
};
|
|
239
251
|
export type V1ToolType = OpenApiSchemas['Tool']['type'];
|
|
240
252
|
export type V1ToolBase = Pick<OpenApiSchemas['BuiltinTool'], 'id' | 'spaceId' | 'name' | 'description' | 'inputSchema' | 'outputSchema' | 'status' | 'metadata' | 'createdAt' | 'updatedAt'>;
|
package/package.json
CHANGED
|
@@ -1,46 +1,51 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bctrl/sdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "BCTRL SDK - Remote browser automation",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"types": "./dist/
|
|
15
|
-
"import": "./dist/
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
},
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@bctrl/sdk",
|
|
3
|
+
"version": "1.0.9",
|
|
4
|
+
"description": "BCTRL SDK - Remote browser automation",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/bctrlhq/sdk-js.git"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./node": {
|
|
18
|
+
"types": "./dist/node.d.ts",
|
|
19
|
+
"import": "./dist/node.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"keywords": [],
|
|
23
|
+
"author": "",
|
|
24
|
+
"license": "ISC",
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=22.14.0"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"zod": "^4.4.3"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^25.0.3",
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
34
|
+
"@typescript-eslint/parser": "^8.56.0",
|
|
35
|
+
"eslint": "^10.0.0",
|
|
36
|
+
"tsx": "^4.21.0",
|
|
37
|
+
"typescript": "^5.9.3"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist"
|
|
41
|
+
],
|
|
42
|
+
"scripts": {
|
|
43
|
+
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
44
|
+
"build": "pnpm run clean && tsc -p tsconfig.json",
|
|
45
|
+
"dev": "tsc --watch",
|
|
46
|
+
"test": "tsx --test tests/v1/*.test.ts tests/v1/e2e/*.test.ts",
|
|
47
|
+
"test:v1": "tsx --test tests/v1/*.test.ts tests/v1/e2e/*.test.ts",
|
|
48
|
+
"test:v1:e2e": "BCTRL_E2E=1 tsx --test tests/v1/e2e/**/*.test.ts",
|
|
49
|
+
"typecheck": "tsc --noEmit"
|
|
50
|
+
}
|
|
51
|
+
}
|