@bctrl/sdk 1.0.4 → 1.0.5

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 (57) hide show
  1. package/README.md +0 -1
  2. package/dist/account.d.ts +43 -0
  3. package/dist/account.js +100 -0
  4. package/dist/accountTypes.d.ts +126 -0
  5. package/dist/accountTypes.js +1 -0
  6. package/dist/aiProviderTypes.d.ts +58 -0
  7. package/dist/aiProviderTypes.js +1 -0
  8. package/dist/aiProviders.d.ts +13 -0
  9. package/dist/aiProviders.js +36 -0
  10. package/dist/bctrl.d.ts +35 -3
  11. package/dist/bctrl.js +74 -6
  12. package/dist/browserExtensionTypes.d.ts +45 -0
  13. package/dist/browserExtensionTypes.js +1 -0
  14. package/dist/browserExtensions.d.ts +14 -0
  15. package/dist/browserExtensions.js +53 -0
  16. package/dist/files.d.ts +6 -24
  17. package/dist/files.js +9 -56
  18. package/dist/help.d.ts +7 -0
  19. package/dist/help.js +9 -0
  20. package/dist/http.d.ts +12 -1
  21. package/dist/http.js +73 -10
  22. package/dist/index.d.ts +17 -6
  23. package/dist/index.js +15 -5
  24. package/dist/invocations.d.ts +85 -47
  25. package/dist/invocations.js +144 -102
  26. package/dist/node.d.ts +12 -0
  27. package/dist/node.js +11 -0
  28. package/dist/proxies.d.ts +21 -0
  29. package/dist/proxies.js +55 -0
  30. package/dist/proxyTypes.d.ts +114 -0
  31. package/dist/proxyTypes.js +1 -0
  32. package/dist/runs.d.ts +35 -31
  33. package/dist/runs.js +95 -38
  34. package/dist/runtimes.d.ts +26 -42
  35. package/dist/runtimes.js +64 -65
  36. package/dist/schemas.d.ts +7 -0
  37. package/dist/schemas.js +36 -0
  38. package/dist/spaces.d.ts +20 -32
  39. package/dist/spaces.js +48 -36
  40. package/dist/toolCallTypes.d.ts +41 -0
  41. package/dist/toolCallTypes.js +1 -0
  42. package/dist/toolCalls.d.ts +9 -0
  43. package/dist/toolCalls.js +16 -0
  44. package/dist/tools.d.ts +23 -0
  45. package/dist/tools.js +49 -0
  46. package/dist/toolsetTypes.d.ts +32 -0
  47. package/dist/toolsetTypes.js +1 -0
  48. package/dist/toolsets.d.ts +12 -0
  49. package/dist/toolsets.js +31 -0
  50. package/dist/types.d.ts +499 -155
  51. package/dist/utils.d.ts +2 -1
  52. package/dist/utils.js +28 -3
  53. package/dist/vault.d.ts +14 -0
  54. package/dist/vault.js +37 -0
  55. package/dist/vaultTypes.d.ts +73 -0
  56. package/dist/vaultTypes.js +1 -0
  57. package/package.json +21 -12
@@ -1,55 +1,40 @@
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
- }
1
+ import { v1IdempotencyHeaders } from './http.js';
2
+ import { toOutputSchema } from './schemas.js';
3
+ import { abortableSleep } from './utils.js';
4
+ // Live control is runtime-scoped; observability reads are run-scoped.
5
+ function runtimeInvocationActionPath(runtimeId, invocationId, action) {
6
+ return `/runtimes/${encodeURIComponent(runtimeId)}/invocations/${encodeURIComponent(invocationId)}/${action}`;
29
7
  }
30
- export class V1InvocationsClient {
8
+ function createRuntimeInvocation(http, runtimeId, request, options) {
9
+ return http.request(`/runtimes/${encodeURIComponent(runtimeId)}/invocations`, {
10
+ method: 'POST',
11
+ body: prepareInvocationCreateRequest(request),
12
+ headers: v1IdempotencyHeaders(options),
13
+ });
14
+ }
15
+ export class V1RuntimeInvocationsNamespaceClient {
31
16
  http;
17
+ stagehand;
18
+ browserUse;
32
19
  constructor(http) {
33
20
  this.http = http;
21
+ this.stagehand = new V1RuntimeStagehandInvocationsNamespaceClient(this);
22
+ this.browserUse = new V1RuntimeBrowserUseInvocationsNamespaceClient(this);
34
23
  }
35
- async get(id) {
36
- const response = await this.http.request(`/invocations/${encodeURIComponent(id)}`);
37
- return new V1InvocationResource(this.http, response.data);
24
+ create(runtimeId, request, options) {
25
+ return createRuntimeInvocation(this.http, runtimeId, request, options);
38
26
  }
39
- wait(id, request) {
40
- return this.http.request(`/invocations/${encodeURIComponent(id)}/wait`, {
41
- method: 'POST',
42
- body: request ?? {},
43
- });
27
+ wait(runtimeId, invocationId, request = {}) {
28
+ return new V1RuntimeInvocationsClient(this.http, runtimeId).wait(invocationId, request);
44
29
  }
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);
30
+ cancel(runtimeId, invocationId) {
31
+ return new V1RuntimeInvocationsClient(this.http, runtimeId).cancel(invocationId);
32
+ }
33
+ createAndWait(runtimeId, request, options = {}) {
34
+ return new V1RuntimeInvocationsClient(this.http, runtimeId).createAndWait(request, options);
50
35
  }
51
36
  }
52
- export class V1RuntimeInvocationsClient {
37
+ class V1RuntimeInvocationsClient {
53
38
  http;
54
39
  runtimeId;
55
40
  stagehand;
@@ -60,100 +45,157 @@ export class V1RuntimeInvocationsClient {
60
45
  this.stagehand = new V1RuntimeStagehandInvocationsClient(this);
61
46
  this.browserUse = new V1RuntimeBrowserUseInvocationsClient(this);
62
47
  }
63
- async create(request) {
64
- const response = await this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/invocations`, {
48
+ async create(request, options) {
49
+ return createRuntimeInvocation(this.http, this.runtimeId, request, options);
50
+ }
51
+ wait(invocationId, request = {}) {
52
+ const { signal, ...body } = request;
53
+ return this.http.request(runtimeInvocationActionPath(this.runtimeId, invocationId, 'wait'), {
65
54
  method: 'POST',
66
- body: request,
55
+ body,
56
+ signal,
67
57
  });
68
- return new V1InvocationResource(this.http, response.data);
58
+ }
59
+ cancel(invocationId) {
60
+ return this.http.request(runtimeInvocationActionPath(this.runtimeId, invocationId, 'cancel'), {
61
+ method: 'POST',
62
+ });
63
+ }
64
+ async createAndWait(request, options = {}) {
65
+ const invocation = await this.create(request, options);
66
+ return waitForInvocation(this, invocation.id, options);
69
67
  }
70
68
  }
71
- export class V1RuntimeStagehandInvocationsClient {
69
+ class V1RuntimeStagehandInvocationsClient {
72
70
  invocations;
73
71
  constructor(invocations) {
74
72
  this.invocations = invocations;
75
73
  }
76
74
  act(options) {
77
- const { instruction, timeoutMs, ...common } = options;
78
75
  return this.invocations.create({
79
- provider: 'stagehand',
80
- method: 'act',
81
- ...common,
82
- input: {
83
- instruction,
84
- ...(timeoutMs !== undefined ? { timeoutMs } : {}),
85
- },
76
+ action: 'act',
77
+ ...options,
86
78
  });
87
79
  }
88
80
  observe(options) {
89
- const { instruction, selector, timeoutMs, ...common } = options;
90
81
  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
- },
82
+ action: 'observe',
83
+ ...options,
99
84
  });
100
85
  }
101
86
  extract(options) {
102
- const { instruction, schema, ...common } = options;
87
+ const { schema, ...common } = options;
103
88
  return this.invocations.create({
104
- provider: 'stagehand',
105
- method: 'extract',
89
+ action: 'extract',
106
90
  ...common,
107
- input: { instruction },
108
- ...(schema !== undefined ? { outputSchema: toJsonSchemaObject(schema) } : {}),
91
+ ...(schema !== undefined
92
+ ? { outputSchema: toOutputSchema(schema, 'Stagehand extract schema') }
93
+ : {}),
109
94
  });
110
95
  }
111
96
  agent(options) {
112
- const { instruction, maxSteps, timeoutMs, variables, config, options: agentOptions, ...common } = options;
113
97
  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 } : {}),
98
+ action: 'stagehandAgent',
99
+ ...options,
125
100
  });
126
101
  }
127
102
  }
128
- export class V1RuntimeBrowserUseInvocationsClient {
103
+ class V1RuntimeBrowserUseInvocationsClient {
129
104
  invocations;
130
105
  constructor(invocations) {
131
106
  this.invocations = invocations;
132
107
  }
133
108
  agent(options) {
134
- const { instruction, maxSteps, config, options: agentOptions, ...common } = options;
135
109
  return this.invocations.create({
136
- provider: 'browserUse',
137
- method: 'agent',
110
+ action: 'browserUse',
111
+ ...options,
112
+ });
113
+ }
114
+ }
115
+ export class V1RuntimeStagehandInvocationsNamespaceClient {
116
+ invocations;
117
+ constructor(invocations) {
118
+ this.invocations = invocations;
119
+ }
120
+ act(runtimeId, options) {
121
+ return this.invocations.create(runtimeId, {
122
+ action: 'act',
123
+ ...options,
124
+ });
125
+ }
126
+ observe(runtimeId, options) {
127
+ return this.invocations.create(runtimeId, {
128
+ action: 'observe',
129
+ ...options,
130
+ });
131
+ }
132
+ extract(runtimeId, options) {
133
+ const { schema, ...common } = options;
134
+ return this.invocations.create(runtimeId, {
135
+ action: 'extract',
138
136
  ...common,
139
- input: {
140
- instruction,
141
- ...(maxSteps !== undefined ? { maxSteps } : {}),
142
- },
143
- ...(config !== undefined ? { config } : {}),
144
- ...(agentOptions !== undefined ? { options: agentOptions } : {}),
137
+ ...(schema !== undefined
138
+ ? { outputSchema: toOutputSchema(schema, 'Stagehand extract schema') }
139
+ : {}),
140
+ });
141
+ }
142
+ agent(runtimeId, options) {
143
+ return this.invocations.create(runtimeId, {
144
+ action: 'stagehandAgent',
145
+ ...options,
146
+ });
147
+ }
148
+ }
149
+ export class V1RuntimeBrowserUseInvocationsNamespaceClient {
150
+ invocations;
151
+ constructor(invocations) {
152
+ this.invocations = invocations;
153
+ }
154
+ agent(runtimeId, options) {
155
+ return this.invocations.create(runtimeId, {
156
+ action: 'browserUse',
157
+ ...options,
145
158
  });
146
159
  }
147
160
  }
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;
161
+ function prepareInvocationCreateRequest(request) {
162
+ if (!hasInvocationSchema(request)) {
163
+ return request;
164
+ }
165
+ if ('outputSchema' in request && request.outputSchema !== undefined) {
166
+ throw new TypeError('Pass either schema or outputSchema, not both');
167
+ }
168
+ const { schema, ...body } = request;
169
+ return {
170
+ ...body,
171
+ outputSchema: toOutputSchema(schema, 'Invocation schema'),
172
+ };
156
173
  }
157
- function isJsonObject(value) {
158
- return value !== null && typeof value === 'object' && !Array.isArray(value);
174
+ function hasInvocationSchema(request) {
175
+ return 'schema' in request && request.schema !== undefined;
176
+ }
177
+ async function waitForInvocation(client, invocationId, options) {
178
+ const deadline = options.timeoutMs === undefined ? undefined : Date.now() + options.timeoutMs;
179
+ for (;;) {
180
+ if (deadline !== undefined && Date.now() >= deadline) {
181
+ throw new Error(`Invocation ${invocationId} did not finish before timeout`);
182
+ }
183
+ const remaining = deadline === undefined ? undefined : Math.max(1, deadline - Date.now());
184
+ const timeoutMs = options.pollTimeoutMs === undefined
185
+ ? remaining
186
+ : remaining === undefined
187
+ ? options.pollTimeoutMs
188
+ : Math.min(options.pollTimeoutMs, remaining);
189
+ const result = await client.wait(invocationId, {
190
+ ...(timeoutMs === undefined ? {} : { timeoutMs }),
191
+ signal: options.signal,
192
+ });
193
+ if (result.waitStatus === 'completed') {
194
+ return result;
195
+ }
196
+ const sleepMs = deadline === undefined
197
+ ? (result.retryAfterMs ?? 1000)
198
+ : Math.min(result.retryAfterMs ?? 1000, Math.max(0, deadline - Date.now()));
199
+ await abortableSleep(sleepMs, options.signal);
200
+ }
159
201
  }
package/dist/node.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { BctrlV1 } from './bctrl.js';
2
+ import type { V1ToolCreateRequest, V1ToolVersionCreateRequest } from './types.js';
3
+ type V1HostedToolCreateRequest = Extract<V1ToolCreateRequest, {
4
+ type: 'hosted';
5
+ }>;
6
+ export declare function createHostedToolFromFile(client: BctrlV1, request: Omit<V1HostedToolCreateRequest, 'source'> & {
7
+ filePath: string;
8
+ }): Promise<import("./types.js").V1Tool>;
9
+ export declare function createToolVersionFromFile(client: BctrlV1, toolId: string, request: Omit<V1ToolVersionCreateRequest, 'source'> & {
10
+ filePath: string;
11
+ }): Promise<import("./types.js").V1ToolVersion>;
12
+ export {};
package/dist/node.js ADDED
@@ -0,0 +1,11 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ export async function createHostedToolFromFile(client, request) {
3
+ const source = await readFile(request.filePath, 'utf8');
4
+ const { filePath: _filePath, ...rest } = request;
5
+ return client.tools.create({ ...rest, source });
6
+ }
7
+ export async function createToolVersionFromFile(client, toolId, request) {
8
+ const source = await readFile(request.filePath, 'utf8');
9
+ const { filePath: _filePath, ...rest } = request;
10
+ return client.tools.createVersion(toolId, { ...rest, source });
11
+ }
@@ -0,0 +1,21 @@
1
+ import type { V1HttpClient } from './http.js';
2
+ import type { V1ListEnvelope, V1Proxy, V1ProxyCreateRequest, V1ProxyDeleteResponse, V1ProxyListQuery, V1ProxyPool, V1ProxyPoolListQuery, V1ProxyTestResponse, V1ProxyUpdateRequest } from './types.js';
3
+ export declare class V1ProxyPoolsClient {
4
+ private readonly http;
5
+ constructor(http: V1HttpClient);
6
+ list(query?: V1ProxyPoolListQuery): Promise<V1ListEnvelope<V1ProxyPool>>;
7
+ iter(query?: V1ProxyPoolListQuery): AsyncGenerator<V1ProxyPool, void, undefined>;
8
+ get(poolId: string): Promise<V1ProxyPool>;
9
+ }
10
+ export declare class V1ProxiesClient {
11
+ private readonly http;
12
+ readonly pools: V1ProxyPoolsClient;
13
+ constructor(http: V1HttpClient);
14
+ list(query?: V1ProxyListQuery): Promise<V1ListEnvelope<V1Proxy>>;
15
+ iter(query?: V1ProxyListQuery): AsyncGenerator<V1Proxy, void, undefined>;
16
+ create(request: V1ProxyCreateRequest): Promise<V1Proxy>;
17
+ get(proxyId: string): Promise<V1Proxy>;
18
+ update(proxyId: string, request: V1ProxyUpdateRequest): Promise<V1Proxy>;
19
+ test(proxyId: string): Promise<V1ProxyTestResponse>;
20
+ delete(proxyId: string): Promise<V1ProxyDeleteResponse>;
21
+ }
@@ -0,0 +1,55 @@
1
+ import { iterateV1Pages } from './pagination.js';
2
+ export class V1ProxyPoolsClient {
3
+ http;
4
+ constructor(http) {
5
+ this.http = http;
6
+ }
7
+ list(query = {}) {
8
+ return this.http.request('/proxies/pools', { query });
9
+ }
10
+ iter(query = {}) {
11
+ return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
12
+ }
13
+ get(poolId) {
14
+ return this.http.request(`/proxies/pools/${encodeURIComponent(poolId)}`);
15
+ }
16
+ }
17
+ export class V1ProxiesClient {
18
+ http;
19
+ pools;
20
+ constructor(http) {
21
+ this.http = http;
22
+ this.pools = new V1ProxyPoolsClient(http);
23
+ }
24
+ list(query = {}) {
25
+ return this.http.request('/proxies', { query });
26
+ }
27
+ iter(query = {}) {
28
+ return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
29
+ }
30
+ create(request) {
31
+ return this.http.request('/proxies', {
32
+ method: 'POST',
33
+ body: request,
34
+ });
35
+ }
36
+ get(proxyId) {
37
+ return this.http.request(`/proxies/${encodeURIComponent(proxyId)}`);
38
+ }
39
+ update(proxyId, request) {
40
+ return this.http.request(`/proxies/${encodeURIComponent(proxyId)}`, {
41
+ method: 'PATCH',
42
+ body: request,
43
+ });
44
+ }
45
+ test(proxyId) {
46
+ return this.http.request(`/proxies/${encodeURIComponent(proxyId)}/test`, {
47
+ method: 'POST',
48
+ });
49
+ }
50
+ delete(proxyId) {
51
+ return this.http.request(`/proxies/${encodeURIComponent(proxyId)}`, {
52
+ method: 'DELETE',
53
+ });
54
+ }
55
+ }
@@ -0,0 +1,114 @@
1
+ export type V1ProxyProtocol = 'http' | 'socks5';
2
+ export type V1ProxyType = 'custom' | 'managed-rotating' | 'managed-static';
3
+ export type V1ManagedRotatingPreference = 'balanced' | 'speed' | 'quality' | 'coverage';
4
+ export type V1ManagedRotatingRotation = 'sticky' | 'rotating';
5
+ export type V1ManagedRotatingDevice = 'windows' | 'macos' | 'linux' | 'android' | 'ios';
6
+ export interface V1ProxyBase {
7
+ id: string;
8
+ name: string;
9
+ subaccountId?: string | null;
10
+ createdAt: string;
11
+ updatedAt: string;
12
+ }
13
+ export interface V1ManagedRotatingProxyConfig {
14
+ protocol?: V1ProxyProtocol;
15
+ ipFamily?: 'dual-stack' | 'ipv4-only';
16
+ preference?: V1ManagedRotatingPreference;
17
+ rotation?: V1ManagedRotatingRotation;
18
+ stickyKey?: string;
19
+ country?: string;
20
+ region?: string;
21
+ state?: string;
22
+ city?: string;
23
+ isp?: string;
24
+ geoStrict?: boolean;
25
+ device?: V1ManagedRotatingDevice;
26
+ deviceStrict?: boolean;
27
+ }
28
+ export type V1Proxy = (V1ProxyBase & {
29
+ type: 'custom';
30
+ protocol: V1ProxyProtocol;
31
+ host: string;
32
+ port: number;
33
+ username?: string | null;
34
+ hasPassword: boolean;
35
+ }) | (V1ProxyBase & V1ManagedRotatingProxyConfig & {
36
+ type: 'managed-rotating';
37
+ }) | (V1ProxyBase & {
38
+ type: 'managed-static';
39
+ status: 'provisioning' | 'active' | 'expired' | 'renewal_failed';
40
+ poolId: string;
41
+ autoRenew: boolean;
42
+ assignedIp?: string;
43
+ location?: {
44
+ country: string;
45
+ city?: string;
46
+ };
47
+ expiresAt?: string;
48
+ renewsAt?: string | null;
49
+ pricing?: {
50
+ priceCredits: number;
51
+ termDays: number;
52
+ };
53
+ });
54
+ export type V1ProxyCreateRequest = {
55
+ type: 'custom';
56
+ name?: string;
57
+ url?: string;
58
+ protocol?: V1ProxyProtocol;
59
+ host?: string;
60
+ port?: number;
61
+ username?: string;
62
+ password?: string;
63
+ } | ({
64
+ type: 'managed-rotating';
65
+ name?: string;
66
+ } & V1ManagedRotatingProxyConfig) | {
67
+ type: 'managed-static';
68
+ name?: string;
69
+ poolId: string;
70
+ autoRenew?: boolean;
71
+ };
72
+ export interface V1ProxyUpdateRequest extends Partial<V1ManagedRotatingProxyConfig> {
73
+ name?: string;
74
+ url?: string;
75
+ protocol?: V1ProxyProtocol;
76
+ host?: string;
77
+ port?: number;
78
+ username?: string | null;
79
+ password?: string | null;
80
+ autoRenew?: boolean;
81
+ }
82
+ interface V1ProxyPageQuery {
83
+ cursor?: string;
84
+ limit?: number;
85
+ }
86
+ export interface V1ProxyListQuery extends V1ProxyPageQuery {
87
+ }
88
+ export interface V1ProxyDeleteResponse {
89
+ id: string;
90
+ deleted: true;
91
+ }
92
+ export interface V1ProxyTestResponse {
93
+ ok: boolean;
94
+ latencyMs?: number;
95
+ error?: string;
96
+ httpStatus?: number | null;
97
+ exitIp?: string | null;
98
+ country?: string | null;
99
+ }
100
+ export interface V1ProxyPool {
101
+ id: string;
102
+ label: string;
103
+ country: string;
104
+ category: 'tickets' | 'sneakers' | 'social' | 'retail';
105
+ termDays: number;
106
+ priceCredits: number;
107
+ availableCount: number;
108
+ }
109
+ export interface V1ProxyPoolListQuery extends V1ProxyPageQuery {
110
+ country?: string;
111
+ category?: V1ProxyPool['category'];
112
+ available?: boolean;
113
+ }
114
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/runs.d.ts CHANGED
@@ -1,40 +1,44 @@
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, V1RuntimeStartRun, V1RunUsage } from './types.js';
4
- export declare class V1RunEventsClient {
1
+ import { type V1HttpClient, type V1IdempotencyOptions } from './http.js';
2
+ import type { V1ListEnvelope, V1File, V1InvocationSummary, V1Run, V1RunEvent, V1RunEventsListQuery, V1RunListQuery, V1RunLiveRequest, V1RunLiveResponse, V1RunRecordingRequest, V1RunRecordingResponse, V1RunActivityItem, V1RunActivityListQuery, V1RunFilesExportRequest, V1RunFilesListQuery, V1RunInvocationsListQuery, V1RunUsage } from './types.js';
3
+ export declare class V1RunsClient {
4
+ private readonly http;
5
+ readonly events: V1RunEventsNamespaceClient;
6
+ readonly activity: V1RunActivityNamespaceClient;
7
+ readonly files: V1RunFilesNamespaceClient;
8
+ readonly invocations: V1RunInvocationsNamespaceClient;
9
+ constructor(http: V1HttpClient);
10
+ list(query?: V1RunListQuery): Promise<V1ListEnvelope<V1Run>>;
11
+ iter(query?: V1RunListQuery): AsyncGenerator<V1Run, void, undefined>;
12
+ get(id: string): Promise<V1Run>;
13
+ usage(id: string): Promise<V1RunUsage>;
14
+ live(id: string, request?: V1RunLiveRequest): Promise<V1RunLiveResponse>;
15
+ recording(id: string, request?: V1RunRecordingRequest): Promise<V1RunRecordingResponse>;
16
+ }
17
+ export declare class V1RunEventsNamespaceClient {
5
18
  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;
19
+ constructor(http: V1HttpClient);
20
+ list(runId: string, query?: V1RunEventsListQuery): Promise<V1ListEnvelope<V1RunEvent>>;
21
+ iter(runId: string, query?: V1RunEventsListQuery): AsyncGenerator<V1RunEvent, void, undefined>;
22
+ streamUrl(runId: string, query?: Pick<V1RunEventsListQuery, 'type' | 'status' | 'pageId' | 'contextId'>): string;
12
23
  }
13
- export declare class V1RunCommandsClient {
24
+ export declare class V1RunActivityNamespaceClient {
14
25
  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>;
26
+ constructor(http: V1HttpClient);
27
+ list(runId: string, query?: V1RunActivityListQuery): Promise<V1ListEnvelope<V1RunActivityItem>>;
28
+ iter(runId: string, query?: V1RunActivityListQuery): AsyncGenerator<V1RunActivityItem, void, undefined>;
29
+ streamUrl(runId: string, query?: V1RunActivityListQuery): string;
19
30
  }
20
- export declare class V1RunResource {
31
+ export declare class V1RunFilesNamespaceClient {
21
32
  private readonly http;
22
- readonly data: V1Run | V1RuntimeStartRun;
23
- readonly events: V1RunEventsClient;
24
- readonly commands: V1RunCommandsClient;
25
- readonly files: V1RunFilesClient;
26
- constructor(http: V1HttpClient, data: V1Run | V1RuntimeStartRun);
27
- get id(): string;
28
- refresh(): Promise<V1RunResource>;
29
- live(request?: V1RunLiveRequest): Promise<V1RunLiveResponse>;
30
- recording(request?: V1RunRecordingRequest): Promise<V1RunRecordingResponse>;
31
- usage(): Promise<V1RunUsage>;
33
+ constructor(http: V1HttpClient);
34
+ list(runId: string, query?: V1RunFilesListQuery): Promise<V1ListEnvelope<V1File>>;
35
+ iter(runId: string, query?: V1RunFilesListQuery): AsyncGenerator<V1File, void, undefined>;
36
+ export(runId: string, request?: V1RunFilesExportRequest, options?: V1IdempotencyOptions): Promise<V1File>;
32
37
  }
33
- export declare class V1RunsClient {
38
+ export declare class V1RunInvocationsNamespaceClient {
34
39
  private readonly http;
35
40
  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>;
41
+ list(runId: string, query?: V1RunInvocationsListQuery): Promise<V1ListEnvelope<V1InvocationSummary>>;
42
+ iter(runId: string, query?: V1RunInvocationsListQuery): AsyncGenerator<V1InvocationSummary, void, undefined>;
43
+ get(runId: string, invocationId: string): Promise<import("./types.js").V1Invocation>;
40
44
  }