@bctrl/sdk 1.0.9 → 1.0.11

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.
Files changed (45) hide show
  1. package/README.md +43 -72
  2. package/dist/account.d.ts +4 -1
  3. package/dist/account.js +12 -0
  4. package/dist/aiTypes.d.ts +0 -3
  5. package/dist/bctrl.d.ts +9 -3
  6. package/dist/bctrl.js +18 -6
  7. package/dist/browserExtensionTypes.d.ts +2 -2
  8. package/dist/browserExtensions.js +6 -6
  9. package/dist/conversations.d.ts +27 -0
  10. package/dist/conversations.js +63 -0
  11. package/dist/generated/openapi-types.d.ts +7404 -6023
  12. package/dist/generated/tool-types.d.ts +60 -0
  13. package/dist/http.d.ts +5 -0
  14. package/dist/http.js +44 -0
  15. package/dist/index.d.ts +8 -7
  16. package/dist/index.js +7 -6
  17. package/dist/node.d.ts +43 -101
  18. package/dist/node.js +6 -8
  19. package/dist/proxies.d.ts +15 -1
  20. package/dist/proxies.js +28 -0
  21. package/dist/proxyTypes.d.ts +8 -2
  22. package/dist/runs.d.ts +13 -102
  23. package/dist/runs.js +21 -114
  24. package/dist/runtimes.d.ts +11 -53
  25. package/dist/runtimes.js +18 -221
  26. package/dist/spaces.d.ts +1 -17
  27. package/dist/spaces.js +0 -75
  28. package/dist/toolCallTypes.d.ts +2 -2
  29. package/dist/toolCalls.d.ts +4 -1
  30. package/dist/toolCalls.js +14 -0
  31. package/dist/tools.d.ts +13 -15
  32. package/dist/tools.js +24 -19
  33. package/dist/toolsetTypes.d.ts +1 -1
  34. package/dist/types.d.ts +64 -183
  35. package/dist/views.d.ts +12 -0
  36. package/dist/views.js +34 -0
  37. package/dist/webhooks.d.ts +30 -0
  38. package/dist/webhooks.js +71 -0
  39. package/package.json +14 -12
  40. package/dist/invocations.d.ts +0 -125
  41. package/dist/invocations.js +0 -199
  42. package/dist/vault.d.ts +0 -14
  43. package/dist/vault.js +0 -37
  44. package/dist/vaultTypes.d.ts +0 -9
  45. /package/dist/{vaultTypes.js → generated/tool-types.js} +0 -0
package/dist/toolCalls.js CHANGED
@@ -13,4 +13,18 @@ export class V1ToolCallsClient {
13
13
  get(toolCallId) {
14
14
  return this.http.request(`/tool-calls/${encodeURIComponent(toolCallId)}`);
15
15
  }
16
+ cancel(toolCallId) {
17
+ return this.http.request(`/tool-calls/${encodeURIComponent(toolCallId)}/cancel`, {
18
+ method: 'POST',
19
+ });
20
+ }
21
+ respond(toolCallId, response) {
22
+ return this.http.request(`/tool-calls/${encodeURIComponent(toolCallId)}/respond`, {
23
+ method: 'POST',
24
+ body: response,
25
+ });
26
+ }
27
+ result(toolCallId, query = {}) {
28
+ return this.http.request(`/tool-calls/${encodeURIComponent(toolCallId)}/result`, { query });
29
+ }
16
30
  }
package/dist/tools.d.ts CHANGED
@@ -1,23 +1,21 @@
1
- import type { V1HttpClient } from './http.js';
2
- import type { JsonObject, V1ListEnvelope, V1PageQuery, V1Tool, V1ToolCreateRequest, V1ToolUpdateRequest, V1ToolVersion, V1ToolVersionCreateRequest } from './types.js';
3
- export interface V1ToolListQuery extends V1PageQuery {
4
- spaceId?: string;
5
- }
6
- export type V1ToolVersionListQuery = V1PageQuery;
1
+ import { type V1HttpClient, type V1ToolInvocationOptions } from './http.js';
2
+ import type { AsyncBuiltinToolName, BuiltinToolInputMap, BuiltinToolOutputMap, SyncBuiltinToolName } from './generated/tool-types.js';
3
+ import type { JsonObject, JsonValue, V1ListEnvelope, V1Tool, V1ToolCall, V1ToolCreateRequest, V1ToolListQuery, V1ToolUpdateRequest } from './types.js';
7
4
  export declare class V1ToolsClient {
8
5
  private readonly http;
9
6
  constructor(http: V1HttpClient);
10
7
  list(query?: V1ToolListQuery): Promise<V1ListEnvelope<V1Tool>>;
11
8
  iter(query?: V1ToolListQuery): AsyncGenerator<V1Tool, void, undefined>;
12
9
  create(request: V1ToolCreateRequest): Promise<V1Tool>;
13
- get(id: string): Promise<V1Tool>;
14
- update(id: string, request: V1ToolUpdateRequest): Promise<V1Tool>;
15
- test(id: string, request?: {
16
- input?: unknown;
17
- }): Promise<unknown>;
18
- listVersions(id: string, query?: V1ToolVersionListQuery): Promise<V1ListEnvelope<V1ToolVersion>>;
19
- createVersion(id: string, request: V1ToolVersionCreateRequest): Promise<V1ToolVersion>;
20
- getVersion(id: string, versionId: string): Promise<V1ToolVersion>;
21
- promoteVersion(id: string, versionId: string): Promise<V1ToolVersion>;
10
+ get(toolRef: string): Promise<V1Tool>;
11
+ update(toolRef: string, request: V1ToolUpdateRequest): Promise<V1Tool>;
12
+ delete(toolRef: string): Promise<{
13
+ id: string;
14
+ deleted: true;
15
+ }>;
16
+ call<Name extends SyncBuiltinToolName>(toolRef: Name, input: BuiltinToolInputMap[Name], options?: V1ToolInvocationOptions): Promise<BuiltinToolOutputMap[Name]>;
17
+ call(toolRef: `tool_${string}`, input: JsonObject, options?: V1ToolInvocationOptions): Promise<JsonValue>;
18
+ start<Name extends AsyncBuiltinToolName>(toolRef: Name, input: BuiltinToolInputMap[Name], options?: V1ToolInvocationOptions): Promise<V1ToolCall>;
19
+ start(toolRef: `tool_${string}`, input: JsonObject, options?: V1ToolInvocationOptions): Promise<V1ToolCall>;
22
20
  }
23
21
  export declare function passthroughJsonSchema(): JsonObject;
package/dist/tools.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { v1IdempotencyHeaders, } from './http.js';
1
2
  import { iterateV1Pages } from './pagination.js';
2
3
  export class V1ToolsClient {
3
4
  http;
@@ -13,36 +14,40 @@ export class V1ToolsClient {
13
14
  create(request) {
14
15
  return this.http.request('/tools', { method: 'POST', body: request });
15
16
  }
16
- get(id) {
17
- return this.http.request(`/tools/${encodeURIComponent(id)}`);
17
+ get(toolRef) {
18
+ return this.http.request(`/tools/${encodeURIComponent(toolRef)}`);
18
19
  }
19
- update(id, request) {
20
- return this.http.request(`/tools/${encodeURIComponent(id)}`, {
20
+ update(toolRef, request) {
21
+ return this.http.request(`/tools/${encodeURIComponent(toolRef)}`, {
21
22
  method: 'PATCH',
22
23
  body: request,
23
24
  });
24
25
  }
25
- test(id, request = {}) {
26
- return this.http.request(`/tools/${encodeURIComponent(id)}/test`, {
26
+ delete(toolRef) {
27
+ return this.http.request(`/tools/${encodeURIComponent(toolRef)}`, { method: 'DELETE' });
28
+ }
29
+ call(toolRef, input, options) {
30
+ const headers = {
31
+ ...v1IdempotencyHeaders(options),
32
+ ...(options?.runtimeId ? { 'BCTRL-Runtime-Id': options.runtimeId } : {}),
33
+ };
34
+ return this.http.request(`/tools/${encodeURIComponent(toolRef)}/call`, {
27
35
  method: 'POST',
28
- body: request,
36
+ body: input,
37
+ headers,
29
38
  });
30
39
  }
31
- listVersions(id, query = {}) {
32
- return this.http.request(`/tools/${encodeURIComponent(id)}/versions`, { query });
33
- }
34
- createVersion(id, request) {
35
- return this.http.request(`/tools/${encodeURIComponent(id)}/versions`, {
40
+ start(toolRef, input, options) {
41
+ const headers = {
42
+ ...v1IdempotencyHeaders(options),
43
+ ...(options?.runtimeId ? { 'BCTRL-Runtime-Id': options.runtimeId } : {}),
44
+ };
45
+ return this.http.request(`/tools/${encodeURIComponent(toolRef)}/calls`, {
36
46
  method: 'POST',
37
- body: request,
47
+ body: input,
48
+ headers,
38
49
  });
39
50
  }
40
- getVersion(id, versionId) {
41
- return this.http.request(`/tools/${encodeURIComponent(id)}/versions/${encodeURIComponent(versionId)}`);
42
- }
43
- promoteVersion(id, versionId) {
44
- return this.http.request(`/tools/${encodeURIComponent(id)}/versions/${encodeURIComponent(versionId)}/promote`, { method: 'POST' });
45
- }
46
51
  }
47
52
  export function passthroughJsonSchema() {
48
53
  return { type: 'object', additionalProperties: true };
@@ -1,5 +1,5 @@
1
1
  import type { OpenApiQuery, OpenApiSchemas } from './openapi.js';
2
- export type V1ToolsetBuiltinName = OpenApiSchemas['Toolset']['builtins'][number];
2
+ export type V1ToolsetToolName = OpenApiSchemas['Toolset']['tools'][number];
3
3
  export type V1Toolset = OpenApiSchemas['Toolset'];
4
4
  export type V1ToolsetListQuery = OpenApiQuery<'toolsets.list'>;
5
5
  export type V1ToolsetCreateRequest = OpenApiSchemas['ToolsetCreateRequest'];
package/dist/types.d.ts CHANGED
@@ -1,15 +1,9 @@
1
+ import type { OpenApiQuery, OpenApiSchemas } from './openapi.js';
1
2
  export type JsonPrimitive = string | number | boolean | null;
2
3
  export type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
3
4
  export type JsonObject = {
4
5
  [key: string]: JsonValue;
5
6
  };
6
- import type { V1ManagedRotatingProxyConfig, V1ProxyDnsResolution, V1ProxyProtocol } from './proxyTypes.js';
7
- import type { OpenApiQuery, OpenApiSchemas } from './openapi.js';
8
- export type { V1AccountUsage, V1ApiKey, V1ApiKeyCreateRequest, V1ApiKeyCreateResponse, V1ApiKeyDeleteResponse, V1ApiKeyListQuery, V1AuthScope, V1AuthWhoamiResponse, V1Plan, V1Subaccount, V1SubaccountArchiveResponse, V1SubaccountCreateRequest, V1SubaccountGetQuery, V1SubaccountLimits, V1SubaccountListQuery, V1SubaccountUpdateRequest, V1SubaccountUsage, V1SubaccountUsageListQuery, V1SubaccountUsageListResponse, } from './accountTypes.js';
9
- export type { V1AiCredential, V1AiCredentialCreateRequest, V1AiCredentialDeleteResponse, V1AiCredentialListQuery, V1AiCredentialProvider, V1AiCredentialStatus, V1AiCredentialTestResponse, V1AiCredentialUpdateRequest, V1AiModel, V1AiModelEngine, V1AiModelListQuery, V1AiModelListResponse, V1AiModelSelection, V1AiModelSelectionAuth, V1AiModelSelectionObject, V1AiModelStatus, V1AiStoredModelSelection, V1AiStoredModelSelectionAuth, } from './aiTypes.js';
10
- export type { V1BrowserExtension, V1BrowserExtensionDeleteResponse, V1BrowserExtensionFormat, V1BrowserExtensionImportRequest, V1BrowserExtensionListQuery, V1BrowserExtensionSource, V1BrowserExtensionUpdateRequest, V1BrowserExtensionUploadRequest, } from './browserExtensionTypes.js';
11
- export type { V1ToolCall, V1ToolCallActor, V1ToolCallListQuery, V1ToolCallStatus, V1ToolCallTool, } from './toolCallTypes.js';
12
- export type { V1Toolset, V1ToolsetBuiltinName, V1ToolsetCreateRequest, V1ToolsetDeleteResponse, V1ToolsetListQuery, V1ToolsetUpdateRequest, } from './toolsetTypes.js';
13
7
  export interface V1ListEnvelope<T> {
14
8
  data: T[];
15
9
  nextCursor: string | null;
@@ -18,6 +12,11 @@ export interface V1PageQuery {
18
12
  cursor?: string;
19
13
  limit?: number;
20
14
  }
15
+ export type { V1AccountUsage, V1ApiKey, V1ApiKeyCreateRequest, V1ApiKeyCreateResponse, V1ApiKeyDeleteResponse, V1ApiKeyListQuery, V1AuthScope, V1AuthWhoamiResponse, V1Plan, V1Subaccount, V1SubaccountArchiveResponse, V1SubaccountCreateRequest, V1SubaccountGetQuery, V1SubaccountLimits, V1SubaccountListQuery, V1SubaccountUpdateRequest, V1SubaccountUsage, V1SubaccountUsageListQuery, V1SubaccountUsageListResponse, } from './accountTypes.js';
16
+ export type { V1AiCredential, V1AiCredentialCreateRequest, V1AiCredentialDeleteResponse, V1AiCredentialListQuery, V1AiCredentialProvider, V1AiCredentialStatus, V1AiCredentialTestResponse, V1AiCredentialUpdateRequest, V1AiModel, V1AiModelEngine, V1AiModelListQuery, V1AiModelListResponse, V1AiModelStatus, V1AiStoredModelSelection, V1AiStoredModelSelectionAuth, } from './aiTypes.js';
17
+ export type { V1BrowserExtension, V1BrowserExtensionDeleteResponse, V1BrowserExtensionFormat, V1BrowserExtensionImportRequest, V1BrowserExtensionListQuery, V1BrowserExtensionSource, V1BrowserExtensionUpdateRequest, V1BrowserExtensionUploadRequest, } from './browserExtensionTypes.js';
18
+ export type { V1ToolCall, V1ToolCallCallerType, V1ToolCallListQuery, V1ToolCallStatus, V1ToolName, } from './toolCallTypes.js';
19
+ export type { V1Toolset, V1ToolsetCreateRequest, V1ToolsetDeleteResponse, V1ToolsetListQuery, V1ToolsetToolName, V1ToolsetUpdateRequest, } from './toolsetTypes.js';
21
20
  export type V1HelpAudience = NonNullable<OpenApiQuery<'help'>['audience']>;
22
21
  export type V1HelpRequest = OpenApiQuery<'help'>;
23
22
  export type V1HelpField = OpenApiSchemas['HelpField'];
@@ -41,10 +40,9 @@ export type V1SpaceStorageMount = OpenApiSchemas['EnvironmentStorageMountOutput'
41
40
  export type V1SpaceVaultMount = NonNullable<OpenApiSchemas['EnvironmentMountsOutput']['vault']>;
42
41
  export type V1SpaceAiMount = NonNullable<OpenApiSchemas['EnvironmentMountsOutput']['ai']>;
43
42
  export type V1SpaceEnvironment = OpenApiSchemas['EnvironmentMountsOutput'];
44
- export type V1SpaceAiMountUpdate = NonNullable<OpenApiSchemas['SpaceEnvironmentUpdateRequest']['ai']>;
45
- export type V1SpaceEnvironmentUpdateRequest = OpenApiSchemas['SpaceEnvironmentUpdateRequest'];
46
- export type V1RuntimeType = OpenApiSchemas['Runtime']['type'];
47
- export type V1RuntimeStatus = OpenApiSchemas['Runtime']['status'];
43
+ export type V1SpaceEnvironmentPatch = OpenApiSchemas['SpaceEnvironmentPatch'];
44
+ export type V1RuntimeType = OpenApiSchemas['RuntimeSummary']['type'];
45
+ export type V1RuntimeStatus = OpenApiSchemas['RuntimeSummary']['status'];
48
46
  export type V1BrowserStealth = NonNullable<OpenApiSchemas['BrowserRuntimeCreateConfig']['stealth']>;
49
47
  export type V1ProxyInput = OpenApiSchemas['RuntimeProxyInput'];
50
48
  export type V1RuntimeFingerprintCreateConfig = NonNullable<OpenApiSchemas['BrowserRuntimeCreateConfig']['fingerprint']>;
@@ -52,140 +50,33 @@ export type V1BrowserNetworkTrafficSaver = NonNullable<OpenApiSchemas['BrowserNe
52
50
  export type V1BrowserNetworkTrafficResourceType = NonNullable<OpenApiSchemas['BrowserNetworkTrafficConfig']['blockResourceTypes']>[number];
53
51
  export type V1BrowserNetworkTrafficConfig = OpenApiSchemas['BrowserNetworkTrafficConfig'];
54
52
  export type V1BrowserRuntimeCreateConfig = OpenApiSchemas['BrowserRuntimeCreateConfig'];
53
+ export type V1BrowserRuntimeConfig = OpenApiSchemas['BrowserRuntimeConfig'];
54
+ export type V1RuntimeFingerprint = OpenApiSchemas['RuntimeFingerprint'];
55
55
  export type V1RuntimeCreateRequest = OpenApiSchemas['RuntimeCreateRequest'];
56
- export type V1SpaceRuntimeCreateRequest = Omit<V1RuntimeCreateRequest, 'spaceId'>;
57
- /** PATCH /v1/runtimes/{runtimeId} — name and idleTimeoutSeconds are editable
58
- * any time; `config` only while the runtime is stopped. */
59
56
  export type V1RuntimeUpdateRequest = OpenApiSchemas['RuntimeUpdateRequest'];
60
57
  export type V1RuntimeDeleteResponse = OpenApiSchemas['RuntimeDeleteResponse'];
61
- export interface V1RuntimeListQuery {
62
- spaceId?: string;
63
- status?: V1RuntimeStatus | V1RuntimeStatus[];
64
- cursor?: string;
65
- limit?: number;
66
- }
58
+ export type V1RuntimeListQuery = OpenApiQuery<'runtimes.list'>;
59
+ export type V1RuntimeGetQuery = OpenApiQuery<'runtimes.get'>;
67
60
  export type V1RuntimeSummary = OpenApiSchemas['RuntimeSummary'];
68
- /** Saved-resource reference for a proxy attached to a runtime (response side). */
69
- export interface V1RuntimeProxyRef {
70
- id: string;
71
- type: 'custom' | 'managed-rotating' | 'managed-static';
72
- name: string;
73
- }
74
- export type V1RuntimeInlineProxyConfig = {
75
- type: 'custom';
76
- protocol: V1ProxyProtocol;
77
- dnsResolution?: V1ProxyDnsResolution;
78
- host: string;
79
- port: number;
80
- username?: string | null;
81
- hasPassword: boolean;
82
- } | ({
83
- type: 'managed-rotating';
84
- } & V1ManagedRotatingProxyConfig);
85
- /** Resolved fingerprint reported on a runtime's config (response side). */
86
- export type V1RuntimeFingerprint = OpenApiSchemas['RuntimeFingerprint'];
87
- /**
88
- * Type-specific browser runtime config returned on the runtime resource. No open
89
- * JSON fallback arm — only the documented browser knobs are surfaced.
90
- */
91
- export type V1BrowserRuntimeConfig = OpenApiSchemas['BrowserRuntimeConfig'];
92
- export type V1Runtime = OpenApiSchemas['Runtime'];
93
- export interface V1RuntimeStartRuntime {
94
- id: string;
95
- spaceId: string;
96
- name: string;
97
- type: V1RuntimeType;
98
- status: V1RuntimeStatus;
99
- }
100
- export interface V1RuntimeStartRun extends V1RunSummary {
101
- durationSeconds?: number | null;
102
- failureReason?: string | null;
103
- }
104
- export type V1ConnectionProtocol = 'cdp';
61
+ export type V1Runtime = OpenApiSchemas['RuntimeDetail'];
62
+ export type V1RuntimeCreateResponse = OpenApiSchemas['RuntimeCreateResponse'];
105
63
  export type V1RuntimeStartResponse = OpenApiSchemas['RuntimeStartResponse'];
106
64
  export type V1RuntimeStopResponse = OpenApiSchemas['RuntimeStopResponse'];
107
- export interface V1RunListQuery extends V1PageQuery {
108
- status?: string | string[];
109
- spaceId?: string;
110
- runtimeId?: string;
111
- }
112
- export type V1RuntimeRunListQuery = Omit<V1RunListQuery, 'spaceId' | 'runtimeId'>;
65
+ export type V1RunListQuery = OpenApiQuery<'runs.list'>;
113
66
  export type V1RunSummary = OpenApiSchemas['RunSummary'];
114
- export type V1Run = OpenApiSchemas['Run'];
115
- export type V1RunUsageBillingStatus = 'pending' | 'settled' | 'unavailable';
67
+ export type V1Run = OpenApiSchemas['RunSummary'];
68
+ export type V1RunDetail = OpenApiSchemas['RunDetail'];
69
+ export type V1RunGetQuery = OpenApiQuery<'runs.get'>;
116
70
  export type V1RunUsage = OpenApiSchemas['RunUsage'];
117
- export type V1RunEventType = OpenApiSchemas['RunEvent']['type'];
118
- export type V1RunEventStatus = NonNullable<OpenApiSchemas['RunEvent']['status']>;
119
71
  export type V1RunEvent = OpenApiSchemas['RunEvent'];
120
72
  export type V1RunEventsListQuery = OpenApiQuery<'runs.events.list'>;
121
- export interface V1RunStreamHeartbeat {
122
- time: string;
123
- }
124
- export interface V1RunStreamEnded {
125
- runId: string;
126
- status: V1Run['status'];
127
- finishedAt: string | null;
128
- failure: NonNullable<V1Run['failure']> | null;
129
- }
130
- export type V1RunEventStreamFrame = {
131
- event: 'run.event';
132
- id: string;
133
- data: V1RunEvent;
134
- } | {
135
- event: 'heartbeat';
136
- data: V1RunStreamHeartbeat;
137
- } | {
138
- event: 'run.ended';
139
- data: V1RunStreamEnded;
140
- };
141
- export type V1RunActivityCategory = 'runtime' | 'browser' | 'network' | 'console' | 'file' | 'invocation' | 'tool' | 'captcha' | 'agent' | 'llm' | 'system';
142
- export type V1RunActivitySeverity = 'info' | 'warning' | 'error';
143
- export interface V1RunActivityLinks {
144
- invocationId?: string;
145
- toolCallId?: string;
146
- fileId?: string;
147
- }
148
- export type V1RunActivityItem = OpenApiSchemas['RunActivityItem'];
149
- export type V1RunActivityListQuery = OpenApiQuery<'runs.activity.list'>;
150
- export type V1RunActivityStreamFrame = {
151
- event: 'run.activity';
152
- id: string;
153
- data: V1RunActivityItem;
154
- } | {
155
- event: 'heartbeat';
156
- data: V1RunStreamHeartbeat;
157
- } | {
158
- event: 'run.ended';
159
- data: V1RunStreamEnded;
160
- };
161
- export type V1RunLiveRequest = OpenApiSchemas['RunLiveRequest'];
162
- export type V1RunLiveResponse = OpenApiSchemas['RunLiveResponse'];
163
- export type V1RunRecordingRequest = OpenApiSchemas['RunRecordingRequest'];
164
- export type V1RunRecordingResponse = OpenApiSchemas['RunRecordingResponse'];
165
- export type V1InvocationAction = OpenApiSchemas['Invocation']['action'];
166
- export type V1RuntimeTargetSelector = OpenApiSchemas['RuntimeTargetSelector'];
167
- export type V1RuntimeTarget = OpenApiSchemas['RuntimeTarget'];
168
- export type V1RuntimeTargetCreateRequest = OpenApiSchemas['RuntimeTargetCreateRequest'];
169
- export type V1InvocationErrorCode = NonNullable<NonNullable<OpenApiSchemas['Invocation']['error']>['code']>;
170
- export type V1InvocationError = NonNullable<OpenApiSchemas['Invocation']['error']>;
171
- export type V1Invocation = OpenApiSchemas['Invocation'];
172
- export type V1InvocationResponse = V1Invocation;
173
- export type V1InvocationWaitRequest = OpenApiSchemas['InvocationWaitRequest'];
174
- export type V1InvocationWaitResponse = OpenApiSchemas['InvocationWait'];
175
- export type V1InvocationSummary = OpenApiSchemas['InvocationSummary'];
176
- export type V1RunInvocationsListQuery = OpenApiQuery<'runs.invocations.list'>;
177
- export interface V1RuntimeInvocationFileInput {
178
- fileId: string;
179
- runtimePath?: string;
180
- name?: string;
181
- }
182
- export type V1RuntimeInvocationCreateRequest = OpenApiSchemas['RuntimeInvocationCreateRequest'];
183
- export type V1RuntimeInvocationManagedTools = NonNullable<Extract<V1RuntimeInvocationCreateRequest, {
184
- action: 'browserUse';
185
- }>['tools']>;
73
+ export type V1TraceSpan = OpenApiSchemas['TraceSpan'];
74
+ export type V1RunTraceListQuery = OpenApiQuery<'runs.trace.list'>;
75
+ export type V1RunStreamEvent = OpenApiSchemas['RunStreamEvent'];
76
+ export type V1RunStreamQuery = OpenApiQuery<'runs.stream'>;
77
+ export type V1RunFile = OpenApiSchemas['RunFile'];
186
78
  export type V1File = OpenApiSchemas['File'];
187
79
  export type V1FilesListQuery = OpenApiQuery<'files.list'>;
188
- /** Immediate-subfolder rollup returned by files.list with `include: 'folders'`. */
189
80
  export type V1FileFolder = OpenApiSchemas['FileFolder'];
190
81
  export type V1FilesListResponse = OpenApiSchemas['FileListResponse'];
191
82
  export type V1FileUpdateRequest = OpenApiSchemas['FileUpdateRequest'];
@@ -197,61 +88,51 @@ export interface V1FileUploadRequest {
197
88
  path?: string;
198
89
  metadata?: JsonObject;
199
90
  }
200
- export type V1RunFilesListQuery = OpenApiQuery<'runs.files.list'>;
201
- export type V1RuntimeFilesListQuery = OpenApiQuery<'runtimes.files.list'>;
202
- export type V1RunFilesExportRequest = OpenApiSchemas['RunsFilesExportRequest'];
203
- export type V1RuntimeFileStageRequest = OpenApiSchemas['RuntimeFileStageRequest'];
204
- export type V1RuntimeStagedFile = OpenApiSchemas['RuntimeStagedFile'];
205
- export interface V1RuntimeFileUploadRequest {
206
- file: Blob;
207
- name?: string;
208
- /** Durable BCTRL storage destination. */
209
- destinationPath?: string;
210
- runtimePath?: string;
211
- metadata?: JsonObject;
212
- }
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'];
91
+ export type V1Account = OpenApiSchemas['Account'];
92
+ export type V1AccountPatchRequest = OpenApiSchemas['AccountPatchRequest'];
93
+ export type V1AccountUpdateQuery = OpenApiQuery<'account.update'>;
94
+ export type V1AgentId = OpenApiSchemas['Conversation']['agent'];
95
+ export type V1Conversation = OpenApiSchemas['Conversation'];
96
+ export type V1ConversationDetail = OpenApiSchemas['ConversationDetail'];
97
+ export type V1ConversationCreateRequest = OpenApiSchemas['ConversationCreateRequest'];
98
+ export type V1ConversationUpdateRequest = OpenApiSchemas['ConversationUpdateRequest'];
99
+ export type V1ConversationMessageCreateRequest = OpenApiSchemas['ConversationMessageCreateRequest'];
100
+ export type V1ConversationTurn = OpenApiSchemas['AgentTurnAccepted'];
101
+ export type V1ConversationCancelResponse = OpenApiSchemas['ConversationCancelResponse'];
102
+ export type V1ConversationEvent = OpenApiSchemas['ConversationEvent'];
103
+ export type V1ConversationStreamEvent = OpenApiSchemas['ConversationEvent'];
104
+ export type V1ConversationListQuery = OpenApiQuery<'conversations.list'>;
105
+ export type V1ConversationStreamQuery = OpenApiQuery<'conversations.stream'>;
106
+ export type V1Message = OpenApiSchemas['Message'];
107
+ export type V1View = OpenApiSchemas['View'];
108
+ export type V1ViewCreateRequest = OpenApiSchemas['ViewCreateRequest'];
109
+ export type V1ViewCreateResponse = OpenApiSchemas['ViewCreateResponse'];
110
+ export type V1ViewDeleteResponse = OpenApiSchemas['ViewDeleteResponse'];
111
+ export type V1ViewSessionCreateRequest = OpenApiSchemas['ViewSessionCreateRequest'];
112
+ export type V1ViewSession = OpenApiSchemas['ViewSession'];
113
+ export type V1ViewsListQuery = OpenApiQuery<'views.list'>;
114
+ export type V1Webhook = OpenApiSchemas['Webhook'];
115
+ export type V1WebhookCreateRequest = OpenApiSchemas['WebhookCreateRequest'];
116
+ export type V1WebhookCreateResponse = OpenApiSchemas['WebhookCreateResponse'];
117
+ export type V1WebhookUpdateRequest = OpenApiSchemas['WebhookUpdateRequest'];
118
+ export type V1WebhookDeleteResponse = OpenApiSchemas['WebhookDeleteResponse'];
119
+ export type V1WebhookDelivery = OpenApiSchemas['WebhookDelivery'];
120
+ export type V1WebhookRotateSecretResponse = OpenApiSchemas['WebhookRotateSecretResponse'];
121
+ export type V1WebhooksListQuery = OpenApiQuery<'webhooks.list'>;
122
+ export type V1WebhookDeliveriesListQuery = OpenApiQuery<'webhooks.deliveries.list'>;
218
123
  export type V1NotificationRecipient = OpenApiSchemas['NotificationRecipient'];
219
124
  export type V1NotificationRecipientCreateRequest = OpenApiSchemas['NotificationRecipientCreateRequest'];
220
125
  export type V1NotificationRecipientUpdateRequest = OpenApiSchemas['NotificationRecipientUpdateRequest'];
221
126
  export type V1NotificationRecipientDeleteResponse = OpenApiSchemas['NotificationRecipientDeleteResponse'];
222
127
  export type V1NotificationRecipientListQuery = OpenApiQuery<'notification-recipients.list'>;
223
- export type { V1ManagedRotatingDevice, V1ManagedRotatingPreference, V1ManagedRotatingProxyConfig, V1ManagedRotatingRotation, V1Proxy, V1ProxyBase, V1ProxyCreateRequest, V1ProxyDeleteResponse, V1ProxyDnsResolution, V1ProxyListQuery, V1ProxyPool, V1ProxyPoolListQuery, V1ProxyProtocol, V1ProxyTestResponse, V1ProxyType, V1ProxyUpdateRequest, } from './proxyTypes.js';
224
- export type { V1VaultSecret, V1VaultSecretDeleteResponse, V1VaultSecretListQuery, V1VaultSecretPatchRequest, V1VaultSecretType, V1VaultSecretUpsertRequest, V1VaultSecretValue, V1VaultTotpResponse, } from './vaultTypes.js';
225
- export type V1ToolExecutionType = OpenApiSchemas['ToolCallTool']['executionType'];
226
- export type V1ToolExecution = {
227
- type: 'webhook';
228
- url: string;
229
- auth?: {
230
- type: 'none';
231
- } | {
232
- type: 'hmac';
233
- secretId: string;
234
- };
235
- timeoutSeconds?: number;
236
- } | {
237
- type: 'hosted_function';
238
- functionVersionId: string;
239
- functionId?: string;
240
- } | {
241
- type: 'mcp_tool';
242
- serverId: string;
243
- toolName: string;
244
- } | {
245
- type: 'hosted_workflow';
246
- workflowId: string;
247
- } | {
248
- type: 'bctrl_builtin';
249
- name: V1RuntimeInvocationManagedTools[number];
250
- };
251
- export type V1ToolType = OpenApiSchemas['Tool']['type'];
252
- export type V1ToolBase = Pick<OpenApiSchemas['BuiltinTool'], 'id' | 'spaceId' | 'name' | 'description' | 'inputSchema' | 'outputSchema' | 'status' | 'metadata' | 'createdAt' | 'updatedAt'>;
128
+ export type { V1ManagedRotatingDevice, V1ManagedRotatingPreference, V1ManagedRotatingProxyConfig, V1ManagedRotatingRotation, V1Proxy, V1ProxyBase, V1ProxyCreateRequest, V1ProxyDeleteResponse, V1ProxyDnsResolution, V1ProxyGeoListQuery, V1ProxyListQuery, V1ProxyLocation, V1ProxyLocationListResponse, V1ProxyLocationsListQuery, V1ProxyPool, V1ProxyPoolListQuery, V1ProxyProtocol, V1ProxyTestResponse, V1ProxyType, V1ProxyUpdateRequest, } from './proxyTypes.js';
253
129
  export type V1Tool = OpenApiSchemas['Tool'];
254
130
  export type V1ToolCreateRequest = OpenApiSchemas['ToolCreateRequest'];
255
131
  export type V1ToolUpdateRequest = OpenApiSchemas['ToolUpdateRequest'];
256
- export type V1ToolVersion = OpenApiSchemas['ToolVersion'];
257
- export type V1ToolVersionCreateRequest = OpenApiSchemas['ToolVersionCreateRequest'];
132
+ export type V1ToolListQuery = OpenApiQuery<'tools.list'>;
133
+ export type V1ToolCallRequest = JsonObject;
134
+ export type V1ToolCallResult = JsonValue;
135
+ export type V1ToolCallResponseRequest = {
136
+ response: unknown;
137
+ };
138
+ export type V1ToolCallResultQuery = OpenApiQuery<'tool-calls.result'>;
@@ -0,0 +1,12 @@
1
+ import type { V1HttpClient } from './http.js';
2
+ import type { V1ListEnvelope, V1View, V1ViewCreateRequest, V1ViewCreateResponse, V1ViewDeleteResponse, V1ViewSession, V1ViewSessionCreateRequest, V1ViewsListQuery } from './types.js';
3
+ export declare class V1ViewsClient {
4
+ private readonly http;
5
+ constructor(http: V1HttpClient);
6
+ list(query?: V1ViewsListQuery): Promise<V1ListEnvelope<V1View>>;
7
+ iter(query?: V1ViewsListQuery): AsyncGenerator<V1View, void, undefined>;
8
+ create(request: V1ViewCreateRequest): Promise<V1ViewCreateResponse>;
9
+ get(viewId: string): Promise<V1View>;
10
+ delete(viewId: string): Promise<V1ViewDeleteResponse>;
11
+ createSession(viewId: string, request: V1ViewSessionCreateRequest, viewToken: string): Promise<V1ViewSession>;
12
+ }
package/dist/views.js ADDED
@@ -0,0 +1,34 @@
1
+ import { iterateV1Pages } from './pagination.js';
2
+ export class V1ViewsClient {
3
+ http;
4
+ constructor(http) {
5
+ this.http = http;
6
+ }
7
+ list(query = {}) {
8
+ return this.http.request('/views', { query });
9
+ }
10
+ iter(query = {}) {
11
+ return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
12
+ }
13
+ create(request) {
14
+ return this.http.request('/views', {
15
+ method: 'POST',
16
+ body: request,
17
+ });
18
+ }
19
+ get(viewId) {
20
+ return this.http.request(`/views/${encodeURIComponent(viewId)}`);
21
+ }
22
+ delete(viewId) {
23
+ return this.http.request(`/views/${encodeURIComponent(viewId)}`, {
24
+ method: 'DELETE',
25
+ });
26
+ }
27
+ createSession(viewId, request, viewToken) {
28
+ return this.http.request(`/views/${encodeURIComponent(viewId)}/sessions`, {
29
+ method: 'POST',
30
+ body: request,
31
+ headers: { Authorization: `Bearer ${viewToken}` },
32
+ });
33
+ }
34
+ }
@@ -0,0 +1,30 @@
1
+ import type { V1HttpClient } from './http.js';
2
+ import type { V1ListEnvelope, V1Webhook, V1WebhookCreateRequest, V1WebhookCreateResponse, V1WebhookDeleteResponse, V1WebhookDeliveriesListQuery, V1WebhookDelivery, V1WebhookRotateSecretResponse, V1WebhooksListQuery, V1WebhookUpdateRequest } from './types.js';
3
+ export declare class V1WebhookDeliveriesClient {
4
+ private readonly http;
5
+ private readonly webhookId;
6
+ constructor(http: V1HttpClient, webhookId: string);
7
+ list(query?: V1WebhookDeliveriesListQuery): Promise<V1ListEnvelope<V1WebhookDelivery>>;
8
+ iter(query?: V1WebhookDeliveriesListQuery): AsyncGenerator<V1WebhookDelivery, void, undefined>;
9
+ redeliver(deliveryId: string): Promise<V1WebhookDelivery>;
10
+ }
11
+ export declare class V1WebhookDeliveriesNamespaceClient {
12
+ private readonly http;
13
+ constructor(http: V1HttpClient);
14
+ list(webhookId: string, query?: V1WebhookDeliveriesListQuery): Promise<V1ListEnvelope<V1WebhookDelivery>>;
15
+ iter(webhookId: string, query?: V1WebhookDeliveriesListQuery): AsyncGenerator<V1WebhookDelivery, void, undefined>;
16
+ redeliver(webhookId: string, deliveryId: string): Promise<V1WebhookDelivery>;
17
+ }
18
+ export declare class V1WebhooksClient {
19
+ private readonly http;
20
+ readonly deliveries: V1WebhookDeliveriesNamespaceClient;
21
+ constructor(http: V1HttpClient);
22
+ list(query?: V1WebhooksListQuery): Promise<V1ListEnvelope<V1Webhook>>;
23
+ iter(query?: V1WebhooksListQuery): AsyncGenerator<V1Webhook, void, undefined>;
24
+ create(request: V1WebhookCreateRequest): Promise<V1WebhookCreateResponse>;
25
+ get(webhookId: string): Promise<V1Webhook>;
26
+ update(webhookId: string, request: V1WebhookUpdateRequest): Promise<V1Webhook>;
27
+ delete(webhookId: string): Promise<V1WebhookDeleteResponse>;
28
+ rotateSecret(webhookId: string): Promise<V1WebhookRotateSecretResponse>;
29
+ test(webhookId: string): Promise<V1WebhookDelivery>;
30
+ }
@@ -0,0 +1,71 @@
1
+ import { iterateV1Pages } from './pagination.js';
2
+ export class V1WebhookDeliveriesClient {
3
+ http;
4
+ webhookId;
5
+ constructor(http, webhookId) {
6
+ this.http = http;
7
+ this.webhookId = webhookId;
8
+ }
9
+ list(query = {}) {
10
+ return this.http.request(`/webhooks/${encodeURIComponent(this.webhookId)}/deliveries`, { query });
11
+ }
12
+ iter(query = {}) {
13
+ return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
14
+ }
15
+ redeliver(deliveryId) {
16
+ return this.http.request(`/webhooks/${encodeURIComponent(this.webhookId)}/deliveries/${encodeURIComponent(deliveryId)}/redeliver`, { method: 'POST' });
17
+ }
18
+ }
19
+ export class V1WebhookDeliveriesNamespaceClient {
20
+ http;
21
+ constructor(http) {
22
+ this.http = http;
23
+ }
24
+ list(webhookId, query = {}) {
25
+ return new V1WebhookDeliveriesClient(this.http, webhookId).list(query);
26
+ }
27
+ iter(webhookId, query = {}) {
28
+ return new V1WebhookDeliveriesClient(this.http, webhookId).iter(query);
29
+ }
30
+ redeliver(webhookId, deliveryId) {
31
+ return new V1WebhookDeliveriesClient(this.http, webhookId).redeliver(deliveryId);
32
+ }
33
+ }
34
+ export class V1WebhooksClient {
35
+ http;
36
+ deliveries;
37
+ constructor(http) {
38
+ this.http = http;
39
+ this.deliveries = new V1WebhookDeliveriesNamespaceClient(http);
40
+ }
41
+ list(query = {}) {
42
+ return this.http.request('/webhooks', { query });
43
+ }
44
+ iter(query = {}) {
45
+ return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
46
+ }
47
+ create(request) {
48
+ return this.http.request('/webhooks', {
49
+ method: 'POST',
50
+ body: request,
51
+ });
52
+ }
53
+ get(webhookId) {
54
+ return this.http.request(`/webhooks/${encodeURIComponent(webhookId)}`);
55
+ }
56
+ update(webhookId, request) {
57
+ return this.http.request(`/webhooks/${encodeURIComponent(webhookId)}`, {
58
+ method: 'PATCH',
59
+ body: request,
60
+ });
61
+ }
62
+ delete(webhookId) {
63
+ return this.http.request(`/webhooks/${encodeURIComponent(webhookId)}`, { method: 'DELETE' });
64
+ }
65
+ rotateSecret(webhookId) {
66
+ return this.http.request(`/webhooks/${encodeURIComponent(webhookId)}/rotate-secret`, { method: 'POST' });
67
+ }
68
+ test(webhookId) {
69
+ return this.http.request(`/webhooks/${encodeURIComponent(webhookId)}/test`, { method: 'POST' });
70
+ }
71
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bctrl/sdk",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "BCTRL SDK - Remote browser automation",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,6 +19,16 @@
19
19
  "import": "./dist/node.js"
20
20
  }
21
21
  },
22
+ "scripts": {
23
+ "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
24
+ "build": "pnpm run clean && tsc -p tsconfig.json",
25
+ "prepack": "pnpm run build",
26
+ "dev": "tsc --watch",
27
+ "test": "tsx --test tests/v1/*.test.ts tests/v1/e2e/*.test.ts",
28
+ "test:v1": "tsx --test tests/v1/*.test.ts tests/v1/e2e/*.test.ts",
29
+ "test:v1:e2e": "BCTRL_E2E=1 tsx --test tests/v1/e2e/**/*.test.ts",
30
+ "typecheck": "tsc --noEmit"
31
+ },
22
32
  "keywords": [],
23
33
  "author": "",
24
34
  "license": "ISC",
@@ -28,6 +38,7 @@
28
38
  "dependencies": {
29
39
  "zod": "^4.4.3"
30
40
  },
41
+ "packageManager": "pnpm@10.12.4",
31
42
  "devDependencies": {
32
43
  "@types/node": "^25.0.3",
33
44
  "@typescript-eslint/eslint-plugin": "^8.56.0",
@@ -38,14 +49,5 @@
38
49
  },
39
50
  "files": [
40
51
  "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
- }
52
+ ]
53
+ }