@bctrl/sdk 1.0.4 → 1.0.6
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 +72 -72
- package/dist/account.d.ts +43 -0
- package/dist/account.js +100 -0
- package/dist/accountTypes.d.ts +126 -0
- package/dist/accountTypes.js +1 -0
- package/dist/ai.d.ts +23 -0
- package/dist/ai.js +51 -0
- package/dist/aiTypes.d.ts +97 -0
- package/dist/aiTypes.js +1 -0
- package/dist/bctrl.d.ts +35 -3
- package/dist/bctrl.js +74 -6
- package/dist/browserExtensionTypes.d.ts +45 -0
- package/dist/browserExtensionTypes.js +1 -0
- package/dist/browserExtensions.d.ts +14 -0
- package/dist/browserExtensions.js +53 -0
- package/dist/files.d.ts +6 -24
- package/dist/files.js +9 -56
- package/dist/help.d.ts +7 -0
- package/dist/help.js +9 -0
- package/dist/http.d.ts +12 -1
- package/dist/http.js +73 -10
- package/dist/index.d.ts +17 -6
- package/dist/index.js +15 -5
- package/dist/invocations.d.ts +83 -48
- package/dist/invocations.js +141 -102
- package/dist/node.d.ts +12 -0
- package/dist/node.js +11 -0
- package/dist/proxies.d.ts +21 -0
- package/dist/proxies.js +55 -0
- package/dist/proxyTypes.d.ts +119 -0
- package/dist/proxyTypes.js +1 -0
- package/dist/runs.d.ts +35 -31
- package/dist/runs.js +95 -38
- package/dist/runtimes.d.ts +41 -40
- package/dist/runtimes.js +115 -61
- package/dist/schemas.d.ts +7 -0
- package/dist/schemas.js +36 -0
- package/dist/spaces.d.ts +20 -32
- package/dist/spaces.js +48 -36
- package/dist/toolCallTypes.d.ts +41 -0
- package/dist/toolCallTypes.js +1 -0
- package/dist/toolCalls.d.ts +9 -0
- package/dist/toolCalls.js +16 -0
- package/dist/tools.d.ts +23 -0
- package/dist/tools.js +49 -0
- package/dist/toolsetTypes.d.ts +32 -0
- package/dist/toolsetTypes.js +1 -0
- package/dist/toolsets.d.ts +12 -0
- package/dist/toolsets.js +31 -0
- package/dist/types.d.ts +586 -167
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +28 -3
- package/dist/vault.d.ts +14 -0
- package/dist/vault.js +37 -0
- package/dist/vaultTypes.d.ts +73 -0
- package/dist/vaultTypes.js +1 -0
- package/package.json +46 -37
package/dist/runtimes.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BctrlValidationError } from './errors.js';
|
|
2
|
-
import {
|
|
2
|
+
import { v1IdempotencyHeaders } from './http.js';
|
|
3
|
+
import { V1RuntimeInvocationsNamespaceClient } from './invocations.js';
|
|
3
4
|
import { iterateV1Pages } from './pagination.js';
|
|
4
|
-
|
|
5
|
-
export class V1RuntimeRunsClient {
|
|
5
|
+
class V1RuntimeRunsClient {
|
|
6
6
|
http;
|
|
7
7
|
runtimeId;
|
|
8
8
|
constructor(http, runtimeId) {
|
|
@@ -16,13 +16,19 @@ export class V1RuntimeRunsClient {
|
|
|
16
16
|
return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
class V1RuntimeFilesClient {
|
|
20
20
|
http;
|
|
21
21
|
runtimeId;
|
|
22
22
|
constructor(http, runtimeId) {
|
|
23
23
|
this.http = http;
|
|
24
24
|
this.runtimeId = runtimeId;
|
|
25
25
|
}
|
|
26
|
+
list(query = {}) {
|
|
27
|
+
return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/files`, { query });
|
|
28
|
+
}
|
|
29
|
+
iter(query = {}) {
|
|
30
|
+
return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
|
|
31
|
+
}
|
|
26
32
|
async upload(request) {
|
|
27
33
|
const form = new FormData();
|
|
28
34
|
if (request.name) {
|
|
@@ -32,8 +38,10 @@ export class V1RuntimeFilesClient {
|
|
|
32
38
|
else {
|
|
33
39
|
form.set('file', request.file);
|
|
34
40
|
}
|
|
35
|
-
if (request.
|
|
36
|
-
form.set('
|
|
41
|
+
if (request.destinationPath)
|
|
42
|
+
form.set('destinationPath', request.destinationPath);
|
|
43
|
+
if (request.runtimePath)
|
|
44
|
+
form.set('runtimePath', request.runtimePath);
|
|
37
45
|
if (request.metadata)
|
|
38
46
|
form.set('metadata', JSON.stringify(request.metadata));
|
|
39
47
|
return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/files/upload`, {
|
|
@@ -54,69 +62,53 @@ export class V1RuntimeFilesClient {
|
|
|
54
62
|
});
|
|
55
63
|
}
|
|
56
64
|
}
|
|
57
|
-
|
|
65
|
+
class V1RuntimeTargetsClient {
|
|
58
66
|
http;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
runs;
|
|
62
|
-
invocations;
|
|
63
|
-
constructor(http, data) {
|
|
67
|
+
runtimeId;
|
|
68
|
+
constructor(http, runtimeId) {
|
|
64
69
|
this.http = http;
|
|
65
|
-
this.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return this.
|
|
72
|
-
}
|
|
73
|
-
get activeRunId() {
|
|
74
|
-
return 'activeRunId' in this.data ? this.data.activeRunId : null;
|
|
75
|
-
}
|
|
76
|
-
refresh() {
|
|
77
|
-
return new V1RuntimesClient(this.http).get(this.id);
|
|
78
|
-
}
|
|
79
|
-
async start() {
|
|
80
|
-
const response = await this.http.request(`/runtimes/${encodeURIComponent(this.id)}/start`, { method: 'POST' });
|
|
81
|
-
return {
|
|
82
|
-
runtime: new V1RuntimeResource(this.http, response.runtime),
|
|
83
|
-
run: new V1RunResource(this.http, response.run),
|
|
84
|
-
browser: response.browser,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
stop() {
|
|
88
|
-
return this.http.request(`/runtimes/${encodeURIComponent(this.id)}/stop`, {
|
|
70
|
+
this.runtimeId = runtimeId;
|
|
71
|
+
}
|
|
72
|
+
list() {
|
|
73
|
+
return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/targets`);
|
|
74
|
+
}
|
|
75
|
+
create(request = {}) {
|
|
76
|
+
return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/targets`, {
|
|
89
77
|
method: 'POST',
|
|
78
|
+
body: request,
|
|
90
79
|
});
|
|
91
80
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
const run = await this.http.request(`/runs/${encodeURIComponent(activeRunId)}`);
|
|
101
|
-
return new V1RunResource(this.http, run);
|
|
81
|
+
get(targetId) {
|
|
82
|
+
return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/targets/${encodeURIComponent(targetId)}`);
|
|
83
|
+
}
|
|
84
|
+
activate(targetId) {
|
|
85
|
+
return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/targets/${encodeURIComponent(targetId)}/activate`, { method: 'POST' });
|
|
86
|
+
}
|
|
87
|
+
delete(targetId) {
|
|
88
|
+
return this.http.request(`/runtimes/${encodeURIComponent(this.runtimeId)}/targets/${encodeURIComponent(targetId)}`, { method: 'DELETE' });
|
|
102
89
|
}
|
|
103
90
|
}
|
|
104
91
|
function validateRuntimeCreateRequest(request) {
|
|
105
92
|
const profileBacked = request.config?.profile === true;
|
|
106
93
|
if (!profileBacked)
|
|
107
94
|
return;
|
|
108
|
-
|
|
109
|
-
throw new BctrlValidationError('name is required when config.profile is true', 'runtime.profile_name_required');
|
|
110
|
-
}
|
|
111
|
-
const unsupported = ['stealth', 'proxy', 'fingerprint', 'extensions'].filter((key) => request.config?.[key] !== undefined);
|
|
95
|
+
const unsupported = ['stealth', 'fingerprint', 'extensionIds'].filter((key) => request.config?.[key] !== undefined);
|
|
112
96
|
if (unsupported.length > 0) {
|
|
113
|
-
throw new BctrlValidationError('Only config.profile, config.idleTimeoutMinutes, config.webRtcProxyOnly, and config.
|
|
97
|
+
throw new BctrlValidationError('Only config.profile, config.proxy, config.autoUpgrade, config.idleTimeoutMinutes, config.webRtcProxyOnly, config.forceOpenShadowRoots, and config.networkTraffic are supported for profile-backed browser runtimes', 'runtime.profile_config_unsupported', { unsupported });
|
|
114
98
|
}
|
|
115
99
|
}
|
|
116
100
|
export class V1RuntimesClient {
|
|
117
101
|
http;
|
|
102
|
+
files;
|
|
103
|
+
runs;
|
|
104
|
+
invocations;
|
|
105
|
+
targets;
|
|
118
106
|
constructor(http) {
|
|
119
107
|
this.http = http;
|
|
108
|
+
this.files = new V1RuntimeFilesNamespaceClient(http);
|
|
109
|
+
this.runs = new V1RuntimeRunsNamespaceClient(http);
|
|
110
|
+
this.invocations = new V1RuntimeInvocationsNamespaceClient(http);
|
|
111
|
+
this.targets = new V1RuntimeTargetsNamespaceClient(http);
|
|
120
112
|
}
|
|
121
113
|
list(query = {}) {
|
|
122
114
|
return this.http.request('/runtimes', { query });
|
|
@@ -126,31 +118,93 @@ export class V1RuntimesClient {
|
|
|
126
118
|
}
|
|
127
119
|
async create(request) {
|
|
128
120
|
validateRuntimeCreateRequest(request);
|
|
129
|
-
|
|
121
|
+
return this.http.request('/runtimes', {
|
|
130
122
|
method: 'POST',
|
|
131
123
|
body: request,
|
|
132
124
|
});
|
|
133
|
-
return new V1RuntimeResource(this.http, runtime);
|
|
134
125
|
}
|
|
135
126
|
async createInSpace(spaceId, request) {
|
|
136
127
|
validateRuntimeCreateRequest(request);
|
|
137
|
-
|
|
128
|
+
return this.http.request('/runtimes', {
|
|
138
129
|
method: 'POST',
|
|
139
130
|
body: { ...request, spaceId },
|
|
140
131
|
});
|
|
141
|
-
return new V1RuntimeResource(this.http, runtime);
|
|
142
132
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
133
|
+
update(id, request) {
|
|
134
|
+
return this.http.request(`/runtimes/${encodeURIComponent(id)}`, {
|
|
135
|
+
method: 'PATCH',
|
|
136
|
+
body: request,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
delete(id, options = {}) {
|
|
140
|
+
return this.http.request(`/runtimes/${encodeURIComponent(id)}${options.force ? '?force=true' : ''}`, { method: 'DELETE' });
|
|
141
|
+
}
|
|
142
|
+
get(id) {
|
|
143
|
+
return this.http.request(`/runtimes/${encodeURIComponent(id)}`);
|
|
146
144
|
}
|
|
147
145
|
stop(id) {
|
|
148
146
|
return this.http.request(`/runtimes/${encodeURIComponent(id)}/stop`, {
|
|
149
147
|
method: 'POST',
|
|
150
148
|
});
|
|
151
149
|
}
|
|
152
|
-
async start(id) {
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
async start(id, options) {
|
|
151
|
+
return this.http.request(`/runtimes/${encodeURIComponent(id)}/start`, {
|
|
152
|
+
method: 'POST',
|
|
153
|
+
headers: v1IdempotencyHeaders(options),
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
export class V1RuntimeRunsNamespaceClient {
|
|
158
|
+
http;
|
|
159
|
+
constructor(http) {
|
|
160
|
+
this.http = http;
|
|
161
|
+
}
|
|
162
|
+
list(runtimeId, query = {}) {
|
|
163
|
+
return new V1RuntimeRunsClient(this.http, runtimeId).list(query);
|
|
164
|
+
}
|
|
165
|
+
iter(runtimeId, query = {}) {
|
|
166
|
+
return new V1RuntimeRunsClient(this.http, runtimeId).iter(query);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
export class V1RuntimeFilesNamespaceClient {
|
|
170
|
+
http;
|
|
171
|
+
constructor(http) {
|
|
172
|
+
this.http = http;
|
|
173
|
+
}
|
|
174
|
+
list(runtimeId, query = {}) {
|
|
175
|
+
return new V1RuntimeFilesClient(this.http, runtimeId).list(query);
|
|
176
|
+
}
|
|
177
|
+
iter(runtimeId, query = {}) {
|
|
178
|
+
return new V1RuntimeFilesClient(this.http, runtimeId).iter(query);
|
|
179
|
+
}
|
|
180
|
+
upload(runtimeId, request) {
|
|
181
|
+
return new V1RuntimeFilesClient(this.http, runtimeId).upload(request);
|
|
182
|
+
}
|
|
183
|
+
stage(runtimeId, request) {
|
|
184
|
+
return new V1RuntimeFilesClient(this.http, runtimeId).stage(request);
|
|
185
|
+
}
|
|
186
|
+
collect(runtimeId, request) {
|
|
187
|
+
return new V1RuntimeFilesClient(this.http, runtimeId).collect(request);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
export class V1RuntimeTargetsNamespaceClient {
|
|
191
|
+
http;
|
|
192
|
+
constructor(http) {
|
|
193
|
+
this.http = http;
|
|
194
|
+
}
|
|
195
|
+
list(runtimeId) {
|
|
196
|
+
return new V1RuntimeTargetsClient(this.http, runtimeId).list();
|
|
197
|
+
}
|
|
198
|
+
create(runtimeId, request = {}) {
|
|
199
|
+
return new V1RuntimeTargetsClient(this.http, runtimeId).create(request);
|
|
200
|
+
}
|
|
201
|
+
get(runtimeId, targetId) {
|
|
202
|
+
return new V1RuntimeTargetsClient(this.http, runtimeId).get(targetId);
|
|
203
|
+
}
|
|
204
|
+
activate(runtimeId, targetId) {
|
|
205
|
+
return new V1RuntimeTargetsClient(this.http, runtimeId).activate(targetId);
|
|
206
|
+
}
|
|
207
|
+
delete(runtimeId, targetId) {
|
|
208
|
+
return new V1RuntimeTargetsClient(this.http, runtimeId).delete(targetId);
|
|
155
209
|
}
|
|
156
210
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { JsonObject } from './types.js';
|
|
3
|
+
export type JsonSchemaObject = JsonObject;
|
|
4
|
+
export type JsonSchemaLike = JsonSchemaObject | {
|
|
5
|
+
toJSONSchema: () => unknown;
|
|
6
|
+
} | z.ZodType;
|
|
7
|
+
export declare function toOutputSchema(schema: JsonSchemaLike, label?: string): JsonSchemaObject;
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function toOutputSchema(schema, label = 'schema') {
|
|
3
|
+
const value = resolveSchema(schema);
|
|
4
|
+
if (!isJsonObject(value)) {
|
|
5
|
+
throw new TypeError(`${label} must resolve to a JSON Schema object`);
|
|
6
|
+
}
|
|
7
|
+
const { $schema, ...jsonSchema } = value;
|
|
8
|
+
void $schema;
|
|
9
|
+
return jsonSchema;
|
|
10
|
+
}
|
|
11
|
+
function resolveSchema(schema) {
|
|
12
|
+
if (hasToJSONSchema(schema)) {
|
|
13
|
+
return schema.toJSONSchema();
|
|
14
|
+
}
|
|
15
|
+
const zodJsonSchema = tryZodToJsonSchema(schema);
|
|
16
|
+
if (zodJsonSchema !== undefined)
|
|
17
|
+
return zodJsonSchema;
|
|
18
|
+
return schema;
|
|
19
|
+
}
|
|
20
|
+
function hasToJSONSchema(value) {
|
|
21
|
+
return Boolean(value &&
|
|
22
|
+
typeof value === 'object' &&
|
|
23
|
+
'toJSONSchema' in value &&
|
|
24
|
+
typeof value.toJSONSchema === 'function');
|
|
25
|
+
}
|
|
26
|
+
function tryZodToJsonSchema(value) {
|
|
27
|
+
try {
|
|
28
|
+
return z.toJSONSchema(value);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function isJsonObject(value) {
|
|
35
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
36
|
+
}
|
package/dist/spaces.d.ts
CHANGED
|
@@ -1,40 +1,28 @@
|
|
|
1
1
|
import type { V1HttpClient } from './http.js';
|
|
2
|
-
import {
|
|
3
|
-
import type { V1ListEnvelope, V1RuntimeListQuery, V1Space, V1SpaceCreateRequest, V1SpaceEnvironment, V1SpaceEnvironmentUpdateRequest, V1SpaceRuntimeCreateRequest, V1SpaceUpdateRequest } from './types.js';
|
|
4
|
-
export declare class
|
|
5
|
-
private readonly http;
|
|
6
|
-
private readonly spaceId;
|
|
7
|
-
constructor(http: V1HttpClient, spaceId: string);
|
|
8
|
-
get(): Promise<V1SpaceEnvironment>;
|
|
9
|
-
update(request: V1SpaceEnvironmentUpdateRequest): Promise<V1SpaceEnvironment>;
|
|
10
|
-
}
|
|
11
|
-
export declare class V1SpaceRuntimesClient {
|
|
2
|
+
import { V1RuntimesClient } from './runtimes.js';
|
|
3
|
+
import type { V1ListEnvelope, V1Runtime, V1RuntimeListQuery, V1Space, V1SpaceCreateRequest, V1SpaceDeleteResponse, V1SpaceEnvironment, V1SpaceEnvironmentUpdateRequest, V1SpaceListQuery, V1SpaceRuntimeCreateRequest, V1SpaceUpdateRequest } from './types.js';
|
|
4
|
+
export declare class V1SpacesClient {
|
|
12
5
|
private readonly http;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
readonly environment: V1SpaceEnvironmentNamespaceClient;
|
|
7
|
+
readonly runtimes: V1SpaceRuntimesNamespaceClient;
|
|
8
|
+
constructor(http: V1HttpClient);
|
|
9
|
+
list(query?: V1SpaceListQuery): Promise<V1ListEnvelope<V1Space>>;
|
|
10
|
+
iter(query?: V1SpaceListQuery): AsyncGenerator<V1Space, void, undefined>;
|
|
11
|
+
create(request: V1SpaceCreateRequest): Promise<V1Space>;
|
|
12
|
+
get(id: string): Promise<V1Space>;
|
|
13
|
+
update(id: string, request: V1SpaceUpdateRequest): Promise<V1Space>;
|
|
14
|
+
delete(id: string): Promise<V1SpaceDeleteResponse>;
|
|
21
15
|
}
|
|
22
|
-
export declare class
|
|
16
|
+
export declare class V1SpaceEnvironmentNamespaceClient {
|
|
23
17
|
private readonly http;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
constructor(http: V1HttpClient, data: V1Space);
|
|
28
|
-
get id(): string;
|
|
29
|
-
refresh(): Promise<V1SpaceResource>;
|
|
30
|
-
update(request: V1SpaceUpdateRequest): Promise<V1SpaceResource>;
|
|
18
|
+
constructor(http: V1HttpClient);
|
|
19
|
+
get(spaceId: string): Promise<V1SpaceEnvironment>;
|
|
20
|
+
update(spaceId: string, request: V1SpaceEnvironmentUpdateRequest): Promise<V1SpaceEnvironment>;
|
|
31
21
|
}
|
|
32
|
-
export declare class
|
|
22
|
+
export declare class V1SpaceRuntimesNamespaceClient {
|
|
33
23
|
private readonly http;
|
|
34
24
|
constructor(http: V1HttpClient);
|
|
35
|
-
list():
|
|
36
|
-
iter(
|
|
37
|
-
create(request:
|
|
38
|
-
get(id: string): Promise<V1SpaceResource>;
|
|
39
|
-
update(id: string, request: V1SpaceUpdateRequest): Promise<V1SpaceResource>;
|
|
25
|
+
list(spaceId: string, query?: Omit<V1RuntimeListQuery, 'spaceId'>): ReturnType<V1RuntimesClient['list']>;
|
|
26
|
+
iter(spaceId: string, query?: Omit<V1RuntimeListQuery, 'spaceId'>): ReturnType<V1RuntimesClient['iter']>;
|
|
27
|
+
create(spaceId: string, request: V1SpaceRuntimeCreateRequest): Promise<V1Runtime>;
|
|
40
28
|
}
|
package/dist/spaces.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { iterateV1Pages } from './pagination.js';
|
|
2
2
|
import { V1RuntimesClient } from './runtimes.js';
|
|
3
|
-
|
|
3
|
+
class V1SpaceEnvironmentClient {
|
|
4
4
|
http;
|
|
5
5
|
spaceId;
|
|
6
6
|
constructor(http, spaceId) {
|
|
@@ -17,7 +17,7 @@ export class V1SpaceEnvironmentClient {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
class V1SpaceRuntimesClient {
|
|
21
21
|
http;
|
|
22
22
|
spaceId;
|
|
23
23
|
constructor(http, spaceId) {
|
|
@@ -30,10 +30,10 @@ export class V1SpaceRuntimesClient {
|
|
|
30
30
|
iter(query = {}) {
|
|
31
31
|
return new V1RuntimesClient(this.http).iter({ ...query, spaceId: this.spaceId });
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
create(request) {
|
|
34
34
|
return new V1RuntimesClient(this.http).createInSpace(this.spaceId, request);
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
get(runtimeId) {
|
|
37
37
|
return new V1RuntimesClient(this.http).get(runtimeId);
|
|
38
38
|
}
|
|
39
39
|
stop(runtimeId) {
|
|
@@ -43,54 +43,66 @@ export class V1SpaceRuntimesClient {
|
|
|
43
43
|
return new V1RuntimesClient(this.http).start(runtimeId);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
export class
|
|
46
|
+
export class V1SpacesClient {
|
|
47
47
|
http;
|
|
48
|
-
data;
|
|
49
48
|
environment;
|
|
50
49
|
runtimes;
|
|
51
|
-
constructor(http
|
|
50
|
+
constructor(http) {
|
|
52
51
|
this.http = http;
|
|
53
|
-
this.
|
|
54
|
-
this.
|
|
55
|
-
this.runtimes = new V1SpaceRuntimesClient(http, data.id);
|
|
52
|
+
this.environment = new V1SpaceEnvironmentNamespaceClient(http);
|
|
53
|
+
this.runtimes = new V1SpaceRuntimesNamespaceClient(http);
|
|
56
54
|
}
|
|
57
|
-
|
|
58
|
-
return this.
|
|
55
|
+
list(query = {}) {
|
|
56
|
+
return this.http.request('/spaces', { query });
|
|
59
57
|
}
|
|
60
|
-
|
|
61
|
-
return
|
|
58
|
+
iter(query = {}) {
|
|
59
|
+
return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
|
|
60
|
+
}
|
|
61
|
+
create(request) {
|
|
62
|
+
return this.http.request('/spaces', {
|
|
63
|
+
method: 'POST',
|
|
64
|
+
body: request,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
get(id) {
|
|
68
|
+
return this.http.request(`/spaces/${encodeURIComponent(id)}`);
|
|
69
|
+
}
|
|
70
|
+
update(id, request) {
|
|
71
|
+
return this.http.request(`/spaces/${encodeURIComponent(id)}`, {
|
|
72
|
+
method: 'PATCH',
|
|
73
|
+
body: request,
|
|
74
|
+
});
|
|
62
75
|
}
|
|
63
|
-
|
|
64
|
-
return
|
|
76
|
+
delete(id) {
|
|
77
|
+
return this.http.request(`/spaces/${encodeURIComponent(id)}`, {
|
|
78
|
+
method: 'DELETE',
|
|
79
|
+
});
|
|
65
80
|
}
|
|
66
81
|
}
|
|
67
|
-
export class
|
|
82
|
+
export class V1SpaceEnvironmentNamespaceClient {
|
|
68
83
|
http;
|
|
69
84
|
constructor(http) {
|
|
70
85
|
this.http = http;
|
|
71
86
|
}
|
|
72
|
-
|
|
73
|
-
return this.http.
|
|
87
|
+
get(spaceId) {
|
|
88
|
+
return new V1SpaceEnvironmentClient(this.http, spaceId).get();
|
|
74
89
|
}
|
|
75
|
-
|
|
76
|
-
return
|
|
90
|
+
update(spaceId, request) {
|
|
91
|
+
return new V1SpaceEnvironmentClient(this.http, spaceId).update(request);
|
|
77
92
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return new V1SpaceResource(this.http, space);
|
|
93
|
+
}
|
|
94
|
+
export class V1SpaceRuntimesNamespaceClient {
|
|
95
|
+
http;
|
|
96
|
+
constructor(http) {
|
|
97
|
+
this.http = http;
|
|
84
98
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return new V1SpaceResource(this.http, space);
|
|
99
|
+
list(spaceId, query = {}) {
|
|
100
|
+
return new V1RuntimesClient(this.http).list({ ...query, spaceId });
|
|
88
101
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return new V1SpaceResource(this.http, space);
|
|
102
|
+
iter(spaceId, query = {}) {
|
|
103
|
+
return new V1RuntimesClient(this.http).iter({ ...query, spaceId });
|
|
104
|
+
}
|
|
105
|
+
create(spaceId, request) {
|
|
106
|
+
return new V1RuntimesClient(this.http).createInSpace(spaceId, request);
|
|
95
107
|
}
|
|
96
108
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { JsonObject, JsonValue, V1PageQuery, V1ToolType } from './types.js';
|
|
2
|
+
export type V1ToolCallActor = 'test' | 'agent' | 'invocation';
|
|
3
|
+
export type V1ToolCallStatus = 'succeeded' | 'failed';
|
|
4
|
+
export interface V1ToolCallTool {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
type: V1ToolType;
|
|
8
|
+
}
|
|
9
|
+
export interface V1ToolCall {
|
|
10
|
+
id: string;
|
|
11
|
+
toolCallId: string;
|
|
12
|
+
spaceId: string;
|
|
13
|
+
runId?: string | null;
|
|
14
|
+
invocationId?: string | null;
|
|
15
|
+
toolsetId?: string | null;
|
|
16
|
+
tool: V1ToolCallTool;
|
|
17
|
+
actor: V1ToolCallActor;
|
|
18
|
+
status: V1ToolCallStatus;
|
|
19
|
+
redactedInput?: JsonValue;
|
|
20
|
+
redactedOutput?: JsonValue;
|
|
21
|
+
redactedError?: JsonObject | null;
|
|
22
|
+
inputSummary?: JsonObject | null;
|
|
23
|
+
outputSummary?: JsonObject | null;
|
|
24
|
+
error?: {
|
|
25
|
+
code: string;
|
|
26
|
+
message: string;
|
|
27
|
+
details?: JsonObject;
|
|
28
|
+
} | null;
|
|
29
|
+
startedAt: string;
|
|
30
|
+
finishedAt: string;
|
|
31
|
+
durationMs: number;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
}
|
|
34
|
+
export interface V1ToolCallListQuery extends V1PageQuery {
|
|
35
|
+
spaceId?: string;
|
|
36
|
+
runId?: string;
|
|
37
|
+
invocationId?: string;
|
|
38
|
+
toolId?: string;
|
|
39
|
+
status?: V1ToolCallStatus;
|
|
40
|
+
actor?: V1ToolCallActor;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { V1HttpClient } from './http.js';
|
|
2
|
+
import type { V1ListEnvelope, V1ToolCall, V1ToolCallListQuery } from './types.js';
|
|
3
|
+
export declare class V1ToolCallsClient {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: V1HttpClient);
|
|
6
|
+
list(query?: V1ToolCallListQuery): Promise<V1ListEnvelope<V1ToolCall>>;
|
|
7
|
+
iter(query?: V1ToolCallListQuery): AsyncGenerator<V1ToolCall, void, undefined>;
|
|
8
|
+
get(toolCallId: string): Promise<V1ToolCall>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { iterateV1Pages } from './pagination.js';
|
|
2
|
+
export class V1ToolCallsClient {
|
|
3
|
+
http;
|
|
4
|
+
constructor(http) {
|
|
5
|
+
this.http = http;
|
|
6
|
+
}
|
|
7
|
+
list(query = {}) {
|
|
8
|
+
return this.http.request('/tool-calls', { query });
|
|
9
|
+
}
|
|
10
|
+
iter(query = {}) {
|
|
11
|
+
return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
|
|
12
|
+
}
|
|
13
|
+
get(toolCallId) {
|
|
14
|
+
return this.http.request(`/tool-calls/${encodeURIComponent(toolCallId)}`);
|
|
15
|
+
}
|
|
16
|
+
}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
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;
|
|
7
|
+
export declare class V1ToolsClient {
|
|
8
|
+
private readonly http;
|
|
9
|
+
constructor(http: V1HttpClient);
|
|
10
|
+
list(query?: V1ToolListQuery): Promise<V1ListEnvelope<V1Tool>>;
|
|
11
|
+
iter(query?: V1ToolListQuery): AsyncGenerator<V1Tool, void, undefined>;
|
|
12
|
+
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>;
|
|
22
|
+
}
|
|
23
|
+
export declare function passthroughJsonSchema(): JsonObject;
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { iterateV1Pages } from './pagination.js';
|
|
2
|
+
export class V1ToolsClient {
|
|
3
|
+
http;
|
|
4
|
+
constructor(http) {
|
|
5
|
+
this.http = http;
|
|
6
|
+
}
|
|
7
|
+
list(query = {}) {
|
|
8
|
+
return this.http.request('/tools', { query });
|
|
9
|
+
}
|
|
10
|
+
iter(query = {}) {
|
|
11
|
+
return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
|
|
12
|
+
}
|
|
13
|
+
create(request) {
|
|
14
|
+
return this.http.request('/tools', { method: 'POST', body: request });
|
|
15
|
+
}
|
|
16
|
+
get(id) {
|
|
17
|
+
return this.http.request(`/tools/${encodeURIComponent(id)}`);
|
|
18
|
+
}
|
|
19
|
+
update(id, request) {
|
|
20
|
+
return this.http.request(`/tools/${encodeURIComponent(id)}`, {
|
|
21
|
+
method: 'PATCH',
|
|
22
|
+
body: request,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
test(id, request = {}) {
|
|
26
|
+
return this.http.request(`/tools/${encodeURIComponent(id)}/test`, {
|
|
27
|
+
method: 'POST',
|
|
28
|
+
body: request,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
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`, {
|
|
36
|
+
method: 'POST',
|
|
37
|
+
body: request,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
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
|
+
}
|
|
47
|
+
export function passthroughJsonSchema() {
|
|
48
|
+
return { type: 'object', additionalProperties: true };
|
|
49
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { JsonObject, V1PageQuery } from './types.js';
|
|
2
|
+
export type V1ToolsetBuiltinName = 'files' | 'vault' | 'captcha';
|
|
3
|
+
export interface V1Toolset {
|
|
4
|
+
id: string;
|
|
5
|
+
spaceId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
builtins: V1ToolsetBuiltinName[];
|
|
8
|
+
toolIds: string[];
|
|
9
|
+
metadata?: JsonObject | null;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
updatedAt: string;
|
|
12
|
+
}
|
|
13
|
+
export interface V1ToolsetListQuery extends V1PageQuery {
|
|
14
|
+
spaceId?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface V1ToolsetCreateRequest {
|
|
17
|
+
spaceId?: string;
|
|
18
|
+
name: string;
|
|
19
|
+
builtins?: V1ToolsetBuiltinName[];
|
|
20
|
+
toolIds?: string[];
|
|
21
|
+
metadata?: JsonObject | null;
|
|
22
|
+
}
|
|
23
|
+
export interface V1ToolsetUpdateRequest {
|
|
24
|
+
name?: string;
|
|
25
|
+
builtins?: V1ToolsetBuiltinName[];
|
|
26
|
+
toolIds?: string[];
|
|
27
|
+
metadata?: JsonObject | null;
|
|
28
|
+
}
|
|
29
|
+
export interface V1ToolsetDeleteResponse {
|
|
30
|
+
id: string;
|
|
31
|
+
deleted: true;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|