@blaxel/core 0.2.46 → 0.2.47-preview.105
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/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/common/settings.js +2 -2
- package/dist/cjs/sandbox/client/sdk.gen.js +173 -36
- package/dist/cjs/sandbox/codegen/codegen.js +31 -0
- package/dist/cjs/sandbox/codegen/index.js +17 -0
- package/dist/cjs/sandbox/filesystem/filesystem.js +28 -1
- package/dist/cjs/sandbox/index.js +4 -1
- package/dist/cjs/sandbox/sandbox.js +4 -1
- package/dist/cjs/types/sandbox/client/sdk.gen.d.ts +74 -13
- package/dist/cjs/types/sandbox/client/types.gen.d.ts +203 -50
- package/dist/cjs/types/sandbox/codegen/codegen.d.ts +8 -0
- package/dist/cjs/types/sandbox/codegen/index.d.ts +1 -0
- package/dist/cjs/types/sandbox/filesystem/filesystem.d.ts +5 -1
- package/dist/cjs/types/sandbox/index.d.ts +2 -1
- package/dist/cjs/types/sandbox/sandbox.d.ts +2 -0
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/common/settings.js +2 -2
- package/dist/cjs-browser/sandbox/client/sdk.gen.js +173 -36
- package/dist/cjs-browser/sandbox/codegen/codegen.js +31 -0
- package/dist/cjs-browser/sandbox/codegen/index.js +17 -0
- package/dist/cjs-browser/sandbox/filesystem/filesystem.js +28 -1
- package/dist/cjs-browser/sandbox/index.js +4 -1
- package/dist/cjs-browser/sandbox/sandbox.js +4 -1
- package/dist/cjs-browser/types/sandbox/client/sdk.gen.d.ts +74 -13
- package/dist/cjs-browser/types/sandbox/client/types.gen.d.ts +203 -50
- package/dist/cjs-browser/types/sandbox/codegen/codegen.d.ts +8 -0
- package/dist/cjs-browser/types/sandbox/codegen/index.d.ts +1 -0
- package/dist/cjs-browser/types/sandbox/filesystem/filesystem.d.ts +5 -1
- package/dist/cjs-browser/types/sandbox/index.d.ts +2 -1
- package/dist/cjs-browser/types/sandbox/sandbox.d.ts +2 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/common/settings.js +2 -2
- package/dist/esm/sandbox/client/sdk.gen.js +164 -33
- package/dist/esm/sandbox/codegen/codegen.js +27 -0
- package/dist/esm/sandbox/codegen/index.js +1 -0
- package/dist/esm/sandbox/filesystem/filesystem.js +28 -1
- package/dist/esm/sandbox/index.js +2 -1
- package/dist/esm/sandbox/sandbox.js +4 -1
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/common/settings.js +2 -2
- package/dist/esm-browser/sandbox/client/sdk.gen.js +164 -33
- package/dist/esm-browser/sandbox/codegen/codegen.js +27 -0
- package/dist/esm-browser/sandbox/codegen/index.js +1 -0
- package/dist/esm-browser/sandbox/filesystem/filesystem.js +28 -1
- package/dist/esm-browser/sandbox/index.js +2 -1
- package/dist/esm-browser/sandbox/sandbox.js +4 -1
- package/package.json +2 -2
|
@@ -1,8 +1,179 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.getWatchFilesystemByPath = exports.getProcessByIdentifierLogsStream = exports.getProcessByIdentifierLogs = exports.deleteProcessByIdentifierKill = exports.getProcessByIdentifier = exports.deleteProcessByIdentifier = exports.postProcess = exports.getProcess = exports.getNetworkProcessByPidPorts = exports.postNetworkProcessByPidMonitor = exports.deleteNetworkProcessByPidMonitor = exports.putFilesystemByPath = exports.getFilesystemByPath = exports.deleteFilesystemByPath = exports.getCodegenRerankingByPath = exports.putCodegenFastapplyByPath = exports.put = exports.post = exports.patch = exports.options = exports.get = exports.delete_ = void 0;
|
|
5
5
|
const client_gen_1 = require("./client.gen");
|
|
6
|
+
/**
|
|
7
|
+
* Welcome message
|
|
8
|
+
* Returns a welcome message with links to documentation
|
|
9
|
+
*/
|
|
10
|
+
const delete_ = (options) => {
|
|
11
|
+
return (options?.client ?? client_gen_1.client).delete({
|
|
12
|
+
security: [
|
|
13
|
+
{
|
|
14
|
+
scheme: 'bearer',
|
|
15
|
+
type: 'http'
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
url: '/',
|
|
19
|
+
...options
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
exports.delete_ = delete_;
|
|
23
|
+
/**
|
|
24
|
+
* Welcome message
|
|
25
|
+
* Returns a welcome message with links to documentation
|
|
26
|
+
*/
|
|
27
|
+
const get = (options) => {
|
|
28
|
+
return (options?.client ?? client_gen_1.client).get({
|
|
29
|
+
security: [
|
|
30
|
+
{
|
|
31
|
+
scheme: 'bearer',
|
|
32
|
+
type: 'http'
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
url: '/',
|
|
36
|
+
...options
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
exports.get = get;
|
|
40
|
+
/**
|
|
41
|
+
* Welcome message
|
|
42
|
+
* Returns a welcome message with links to documentation
|
|
43
|
+
*/
|
|
44
|
+
const options = (options) => {
|
|
45
|
+
return (options?.client ?? client_gen_1.client).options({
|
|
46
|
+
security: [
|
|
47
|
+
{
|
|
48
|
+
scheme: 'bearer',
|
|
49
|
+
type: 'http'
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
url: '/',
|
|
53
|
+
...options
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
exports.options = options;
|
|
57
|
+
/**
|
|
58
|
+
* Welcome message
|
|
59
|
+
* Returns a welcome message with links to documentation
|
|
60
|
+
*/
|
|
61
|
+
const patch = (options) => {
|
|
62
|
+
return (options?.client ?? client_gen_1.client).patch({
|
|
63
|
+
security: [
|
|
64
|
+
{
|
|
65
|
+
scheme: 'bearer',
|
|
66
|
+
type: 'http'
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
url: '/',
|
|
70
|
+
...options
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
exports.patch = patch;
|
|
74
|
+
/**
|
|
75
|
+
* Welcome message
|
|
76
|
+
* Returns a welcome message with links to documentation
|
|
77
|
+
*/
|
|
78
|
+
const post = (options) => {
|
|
79
|
+
return (options?.client ?? client_gen_1.client).post({
|
|
80
|
+
security: [
|
|
81
|
+
{
|
|
82
|
+
scheme: 'bearer',
|
|
83
|
+
type: 'http'
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
url: '/',
|
|
87
|
+
...options
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
exports.post = post;
|
|
91
|
+
/**
|
|
92
|
+
* Welcome message
|
|
93
|
+
* Returns a welcome message with links to documentation
|
|
94
|
+
*/
|
|
95
|
+
const put = (options) => {
|
|
96
|
+
return (options?.client ?? client_gen_1.client).put({
|
|
97
|
+
security: [
|
|
98
|
+
{
|
|
99
|
+
scheme: 'bearer',
|
|
100
|
+
type: 'http'
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
url: '/',
|
|
104
|
+
...options
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
exports.put = put;
|
|
108
|
+
/**
|
|
109
|
+
* Apply code edit
|
|
110
|
+
* Uses the configured LLM provider (Relace or Morph) to apply a code edit to the original content.
|
|
111
|
+
*
|
|
112
|
+
* To use this endpoint as an agent tool, follow these guidelines:
|
|
113
|
+
*
|
|
114
|
+
* Use this tool to make an edit to an existing file. This will be read by a less intelligent model, which will quickly apply the edit. You should make it clear what the edit is, while also minimizing the unchanged code you write.
|
|
115
|
+
*
|
|
116
|
+
* When writing the edit, you should specify each edit in sequence, with the special comment "// ... existing code ..." to represent unchanged code in between edited lines.
|
|
117
|
+
*
|
|
118
|
+
* Example format:
|
|
119
|
+
* // ... existing code ...
|
|
120
|
+
* FIRST_EDIT
|
|
121
|
+
* // ... existing code ...
|
|
122
|
+
* SECOND_EDIT
|
|
123
|
+
* // ... existing code ...
|
|
124
|
+
* THIRD_EDIT
|
|
125
|
+
* // ... existing code ...
|
|
126
|
+
*
|
|
127
|
+
* You should still bias towards repeating as few lines of the original file as possible to convey the change. But, each edit should contain minimally sufficient context of unchanged lines around the code you're editing to resolve ambiguity.
|
|
128
|
+
*
|
|
129
|
+
* DO NOT omit spans of pre-existing code (or comments) without using the "// ... existing code ..." comment to indicate its absence. If you omit the existing code comment, the model may inadvertently delete these lines.
|
|
130
|
+
*
|
|
131
|
+
* If you plan on deleting a section, you must provide context before and after to delete it. If the initial code is "Block 1\nBlock 2\nBlock 3", and you want to remove Block 2, you would output "// ... existing code ...\nBlock 1\nBlock 3\n// ... existing code ...".
|
|
132
|
+
*
|
|
133
|
+
* Make sure it is clear what the edit should be, and where it should be applied. Make edits to a file in a single edit_file call instead of multiple edit_file calls to the same file. The apply model can handle many distinct edits at once.
|
|
134
|
+
*/
|
|
135
|
+
const putCodegenFastapplyByPath = (options) => {
|
|
136
|
+
return (options.client ?? client_gen_1.client).put({
|
|
137
|
+
security: [
|
|
138
|
+
{
|
|
139
|
+
scheme: 'bearer',
|
|
140
|
+
type: 'http'
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
url: '/codegen/fastapply/{path}',
|
|
144
|
+
...options,
|
|
145
|
+
headers: {
|
|
146
|
+
'Content-Type': 'application/json',
|
|
147
|
+
...options?.headers
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
exports.putCodegenFastapplyByPath = putCodegenFastapplyByPath;
|
|
152
|
+
/**
|
|
153
|
+
* Code reranking/semantic search
|
|
154
|
+
* Uses Relace's code reranking model to find the most relevant files for a given query. This is useful as a first pass in agentic exploration to narrow down the search space.
|
|
155
|
+
*
|
|
156
|
+
* Based on: https://docs.relace.ai/docs/code-reranker/agent
|
|
157
|
+
*
|
|
158
|
+
* Query Construction: The query can be a short question or a more detailed conversation with the user request included. For a first pass, use the full conversation; for subsequent calls, use more targeted questions.
|
|
159
|
+
*
|
|
160
|
+
* Token Limit and Score Threshold: For 200k token context models like Claude 4 Sonnet, recommended defaults are scoreThreshold=0.5 and tokenLimit=30000.
|
|
161
|
+
*
|
|
162
|
+
* The response will be a list of file paths and contents ordered from most relevant to least relevant.
|
|
163
|
+
*/
|
|
164
|
+
const getCodegenRerankingByPath = (options) => {
|
|
165
|
+
return (options.client ?? client_gen_1.client).get({
|
|
166
|
+
security: [
|
|
167
|
+
{
|
|
168
|
+
scheme: 'bearer',
|
|
169
|
+
type: 'http'
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
url: '/codegen/reranking/{path}',
|
|
173
|
+
...options
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
exports.getCodegenRerankingByPath = getCodegenRerankingByPath;
|
|
6
177
|
/**
|
|
7
178
|
* Delete file or directory
|
|
8
179
|
* Delete a file or directory
|
|
@@ -22,7 +193,7 @@ const deleteFilesystemByPath = (options) => {
|
|
|
22
193
|
exports.deleteFilesystemByPath = deleteFilesystemByPath;
|
|
23
194
|
/**
|
|
24
195
|
* Get file or directory information
|
|
25
|
-
* Get content of a file or listing of a directory
|
|
196
|
+
* Get content of a file or listing of a directory. Use Accept header to control response format for files.
|
|
26
197
|
*/
|
|
27
198
|
const getFilesystemByPath = (options) => {
|
|
28
199
|
return (options.client ?? client_gen_1.client).get({
|
|
@@ -253,37 +424,3 @@ const getWatchFilesystemByPath = (options) => {
|
|
|
253
424
|
});
|
|
254
425
|
};
|
|
255
426
|
exports.getWatchFilesystemByPath = getWatchFilesystemByPath;
|
|
256
|
-
/**
|
|
257
|
-
* Stream process logs in real time via WebSocket
|
|
258
|
-
* Streams the stdout and stderr output of a process in real time as JSON messages.
|
|
259
|
-
*/
|
|
260
|
-
const getWsProcessByIdentifierLogsStream = (options) => {
|
|
261
|
-
return (options.client ?? client_gen_1.client).get({
|
|
262
|
-
security: [
|
|
263
|
-
{
|
|
264
|
-
scheme: 'bearer',
|
|
265
|
-
type: 'http'
|
|
266
|
-
}
|
|
267
|
-
],
|
|
268
|
-
url: '/ws/process/{identifier}/logs/stream',
|
|
269
|
-
...options
|
|
270
|
-
});
|
|
271
|
-
};
|
|
272
|
-
exports.getWsProcessByIdentifierLogsStream = getWsProcessByIdentifierLogsStream;
|
|
273
|
-
/**
|
|
274
|
-
* Stream file modification events in a directory via WebSocket
|
|
275
|
-
* Streams JSON events of modified files in the given directory. Closes when the client disconnects.
|
|
276
|
-
*/
|
|
277
|
-
const getWsWatchFilesystemByPath = (options) => {
|
|
278
|
-
return (options.client ?? client_gen_1.client).get({
|
|
279
|
-
security: [
|
|
280
|
-
{
|
|
281
|
-
scheme: 'bearer',
|
|
282
|
-
type: 'http'
|
|
283
|
-
}
|
|
284
|
-
],
|
|
285
|
-
url: '/ws/watch/filesystem/{path}',
|
|
286
|
-
...options
|
|
287
|
-
});
|
|
288
|
-
};
|
|
289
|
-
exports.getWsWatchFilesystemByPath = getWsWatchFilesystemByPath;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SandboxCodegen = void 0;
|
|
4
|
+
const action_js_1 = require("../action.js");
|
|
5
|
+
const sdk_gen_js_1 = require("../client/sdk.gen.js");
|
|
6
|
+
class SandboxCodegen extends action_js_1.SandboxAction {
|
|
7
|
+
constructor(sandbox) {
|
|
8
|
+
super(sandbox);
|
|
9
|
+
}
|
|
10
|
+
async fastapply(path, codeEdit, model) {
|
|
11
|
+
const result = await (0, sdk_gen_js_1.putCodegenFastapplyByPath)({
|
|
12
|
+
path: { path },
|
|
13
|
+
body: { codeEdit, model },
|
|
14
|
+
baseUrl: this.url,
|
|
15
|
+
client: this.client,
|
|
16
|
+
});
|
|
17
|
+
this.handleResponseError(result.response, result.data, result.error);
|
|
18
|
+
return result.data;
|
|
19
|
+
}
|
|
20
|
+
async reranking(path, query, scoreThreshold, tokenLimit, filePattern) {
|
|
21
|
+
const result = await (0, sdk_gen_js_1.getCodegenRerankingByPath)({
|
|
22
|
+
path: { path },
|
|
23
|
+
query: { query, scoreThreshold, tokenLimit, filePattern },
|
|
24
|
+
baseUrl: this.url,
|
|
25
|
+
client: this.client,
|
|
26
|
+
});
|
|
27
|
+
this.handleResponseError(result.response, result.data, result.error);
|
|
28
|
+
return result.data;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.SandboxCodegen = SandboxCodegen;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./codegen.js"), exports);
|
|
@@ -4,6 +4,7 @@ exports.SandboxFileSystem = void 0;
|
|
|
4
4
|
const settings_js_1 = require("../../common/settings.js");
|
|
5
5
|
const action_js_1 = require("../action.js");
|
|
6
6
|
const index_js_1 = require("../client/index.js");
|
|
7
|
+
const promises_1 = require("fs/promises");
|
|
7
8
|
class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
8
9
|
process;
|
|
9
10
|
constructor(sandbox, process) {
|
|
@@ -49,6 +50,10 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
49
50
|
// Convert Uint8Array to Blob
|
|
50
51
|
fileBlob = new Blob([content]);
|
|
51
52
|
}
|
|
53
|
+
else if (typeof content === 'string') {
|
|
54
|
+
const buffer = await (0, promises_1.readFile)(content);
|
|
55
|
+
fileBlob = new Blob([buffer]);
|
|
56
|
+
}
|
|
52
57
|
else {
|
|
53
58
|
throw new Error("Unsupported content type");
|
|
54
59
|
}
|
|
@@ -110,6 +115,28 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
110
115
|
}
|
|
111
116
|
throw new Error("Unsupported file type");
|
|
112
117
|
}
|
|
118
|
+
async readBinary(path) {
|
|
119
|
+
path = this.formatPath(path);
|
|
120
|
+
const { response, data, error } = await (0, index_js_1.getFilesystemByPath)({
|
|
121
|
+
path: { path },
|
|
122
|
+
baseUrl: this.url,
|
|
123
|
+
client: this.client,
|
|
124
|
+
headers: {
|
|
125
|
+
'Accept': 'application/octet-stream',
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
this.handleResponseError(response, data, error);
|
|
129
|
+
if (typeof data === 'string') {
|
|
130
|
+
return new Blob([data]);
|
|
131
|
+
}
|
|
132
|
+
return data;
|
|
133
|
+
}
|
|
134
|
+
async download(src, destinationPath, { mode = 0o644 } = {}) {
|
|
135
|
+
const blob = await this.readBinary(src);
|
|
136
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
137
|
+
const buffer = Buffer.from(arrayBuffer);
|
|
138
|
+
await (0, promises_1.writeFile)(destinationPath, buffer, { mode: mode ?? 0o644 });
|
|
139
|
+
}
|
|
113
140
|
async rm(path, recursive = false) {
|
|
114
141
|
path = this.formatPath(path);
|
|
115
142
|
const { response, data, error } = await (0, index_js_1.deleteFilesystemByPath)({
|
|
@@ -200,7 +227,7 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
200
227
|
filePath = fileEvent.path + "/" + fileEvent.name;
|
|
201
228
|
}
|
|
202
229
|
const content = await this.read(filePath);
|
|
203
|
-
await callback({ ...fileEvent, content });
|
|
230
|
+
await callback({ ...fileEvent, content: content });
|
|
204
231
|
}
|
|
205
232
|
catch {
|
|
206
233
|
await callback({ ...fileEvent, content: undefined });
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.putFilesystemByPath = exports.postProcess = exports.postNetworkProcessByPidMonitor = exports.getProcessByIdentifierLogsStream = exports.getProcessByIdentifierLogs = exports.getProcessByIdentifier = exports.getProcess = exports.getNetworkProcessByPidPorts = exports.getFilesystemByPath = exports.deleteProcessByIdentifierKill = exports.deleteProcessByIdentifier = exports.deleteNetworkProcessByPidMonitor = exports.deleteFilesystemByPath = void 0;
|
|
17
|
+
exports.putFilesystemByPath = exports.postProcess = exports.postNetworkProcessByPidMonitor = exports.getProcessByIdentifierLogsStream = exports.getProcessByIdentifierLogs = exports.getProcessByIdentifier = exports.getProcess = exports.getCodegenRerankingByPath = exports.putCodegenFastapplyByPath = exports.getNetworkProcessByPidPorts = exports.getFilesystemByPath = exports.deleteProcessByIdentifierKill = exports.deleteProcessByIdentifier = exports.deleteNetworkProcessByPidMonitor = exports.deleteFilesystemByPath = void 0;
|
|
18
18
|
var index_js_1 = require("./client/index.js");
|
|
19
19
|
/* Export SDK functions */
|
|
20
20
|
Object.defineProperty(exports, "deleteFilesystemByPath", { enumerable: true, get: function () { return index_js_1.deleteFilesystemByPath; } });
|
|
@@ -23,6 +23,8 @@ Object.defineProperty(exports, "deleteProcessByIdentifier", { enumerable: true,
|
|
|
23
23
|
Object.defineProperty(exports, "deleteProcessByIdentifierKill", { enumerable: true, get: function () { return index_js_1.deleteProcessByIdentifierKill; } });
|
|
24
24
|
Object.defineProperty(exports, "getFilesystemByPath", { enumerable: true, get: function () { return index_js_1.getFilesystemByPath; } });
|
|
25
25
|
Object.defineProperty(exports, "getNetworkProcessByPidPorts", { enumerable: true, get: function () { return index_js_1.getNetworkProcessByPidPorts; } });
|
|
26
|
+
Object.defineProperty(exports, "putCodegenFastapplyByPath", { enumerable: true, get: function () { return index_js_1.putCodegenFastapplyByPath; } });
|
|
27
|
+
Object.defineProperty(exports, "getCodegenRerankingByPath", { enumerable: true, get: function () { return index_js_1.getCodegenRerankingByPath; } });
|
|
26
28
|
Object.defineProperty(exports, "getProcess", { enumerable: true, get: function () { return index_js_1.getProcess; } });
|
|
27
29
|
Object.defineProperty(exports, "getProcessByIdentifier", { enumerable: true, get: function () { return index_js_1.getProcessByIdentifier; } });
|
|
28
30
|
Object.defineProperty(exports, "getProcessByIdentifierLogs", { enumerable: true, get: function () { return index_js_1.getProcessByIdentifierLogs; } });
|
|
@@ -31,6 +33,7 @@ Object.defineProperty(exports, "postNetworkProcessByPidMonitor", { enumerable: t
|
|
|
31
33
|
Object.defineProperty(exports, "postProcess", { enumerable: true, get: function () { return index_js_1.postProcess; } });
|
|
32
34
|
Object.defineProperty(exports, "putFilesystemByPath", { enumerable: true, get: function () { return index_js_1.putFilesystemByPath; } });
|
|
33
35
|
__exportStar(require("./filesystem/index.js"), exports);
|
|
36
|
+
__exportStar(require("./codegen/index.js"), exports);
|
|
34
37
|
__exportStar(require("./sandbox.js"), exports);
|
|
35
38
|
__exportStar(require("./types.js"), exports);
|
|
36
39
|
// Re-export everything from client except ClientOptions to avoid conflict
|
|
@@ -8,6 +8,7 @@ const index_js_2 = require("./filesystem/index.js");
|
|
|
8
8
|
const index_js_3 = require("./network/index.js");
|
|
9
9
|
const preview_js_1 = require("./preview.js");
|
|
10
10
|
const index_js_4 = require("./process/index.js");
|
|
11
|
+
const index_js_5 = require("./codegen/index.js");
|
|
11
12
|
const session_js_1 = require("./session.js");
|
|
12
13
|
const types_js_1 = require("./types.js");
|
|
13
14
|
class SandboxInstance {
|
|
@@ -17,6 +18,7 @@ class SandboxInstance {
|
|
|
17
18
|
process;
|
|
18
19
|
previews;
|
|
19
20
|
sessions;
|
|
21
|
+
codegen;
|
|
20
22
|
constructor(sandbox) {
|
|
21
23
|
this.sandbox = sandbox;
|
|
22
24
|
this.process = new index_js_4.SandboxProcess(sandbox);
|
|
@@ -24,6 +26,7 @@ class SandboxInstance {
|
|
|
24
26
|
this.network = new index_js_3.SandboxNetwork(sandbox);
|
|
25
27
|
this.previews = new preview_js_1.SandboxPreviews(sandbox);
|
|
26
28
|
this.sessions = new session_js_1.SandboxSessions(sandbox);
|
|
29
|
+
this.codegen = new index_js_5.SandboxCodegen(sandbox);
|
|
27
30
|
}
|
|
28
31
|
get metadata() {
|
|
29
32
|
return this.sandbox.metadata;
|
|
@@ -44,7 +47,7 @@ class SandboxInstance {
|
|
|
44
47
|
}
|
|
45
48
|
static async create(sandbox, { safe = true } = {}) {
|
|
46
49
|
const defaultName = `sandbox-${(0, uuid_1.v4)().replace(/-/g, '').substring(0, 8)}`;
|
|
47
|
-
const defaultImage = `blaxel/base:latest`;
|
|
50
|
+
const defaultImage = `blaxel/base-image:latest`;
|
|
48
51
|
const defaultMemory = 4096;
|
|
49
52
|
// Handle SandboxCreateConfiguration or simple dict with name/image/memory/ports/envs/volumes keys
|
|
50
53
|
if (!sandbox ||
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
|
|
2
|
-
import type { DeleteFilesystemByPathData, GetFilesystemByPathData, PutFilesystemByPathData, DeleteNetworkProcessByPidMonitorData, PostNetworkProcessByPidMonitorData, GetNetworkProcessByPidPortsData, GetProcessData, PostProcessData, DeleteProcessByIdentifierData, GetProcessByIdentifierData, DeleteProcessByIdentifierKillData, GetProcessByIdentifierLogsData, GetProcessByIdentifierLogsStreamData, GetWatchFilesystemByPathData
|
|
2
|
+
import type { DeleteData, GetData, OptionsData, PatchData, PostData, PutData, PutCodegenFastapplyByPathData, GetCodegenRerankingByPathData, DeleteFilesystemByPathData, GetFilesystemByPathData, PutFilesystemByPathData, DeleteNetworkProcessByPidMonitorData, PostNetworkProcessByPidMonitorData, GetNetworkProcessByPidPortsData, GetProcessData, PostProcessData, DeleteProcessByIdentifierData, GetProcessByIdentifierData, DeleteProcessByIdentifierKillData, GetProcessByIdentifierLogsData, GetProcessByIdentifierLogsStreamData, GetWatchFilesystemByPathData } from './types.gen';
|
|
3
3
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
|
|
4
4
|
/**
|
|
5
5
|
* You can provide a client instance returned by `createClient()` instead of
|
|
@@ -13,6 +13,77 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
|
|
|
13
13
|
*/
|
|
14
14
|
meta?: Record<string, unknown>;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Welcome message
|
|
18
|
+
* Returns a welcome message with links to documentation
|
|
19
|
+
*/
|
|
20
|
+
export declare const delete_: <ThrowOnError extends boolean = false>(options?: Options<DeleteData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").WelcomeResponse, unknown, ThrowOnError>;
|
|
21
|
+
/**
|
|
22
|
+
* Welcome message
|
|
23
|
+
* Returns a welcome message with links to documentation
|
|
24
|
+
*/
|
|
25
|
+
export declare const get: <ThrowOnError extends boolean = false>(options?: Options<GetData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").WelcomeResponse, unknown, ThrowOnError>;
|
|
26
|
+
/**
|
|
27
|
+
* Welcome message
|
|
28
|
+
* Returns a welcome message with links to documentation
|
|
29
|
+
*/
|
|
30
|
+
export declare const options: <ThrowOnError extends boolean = false>(options?: Options<OptionsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").WelcomeResponse, unknown, ThrowOnError>;
|
|
31
|
+
/**
|
|
32
|
+
* Welcome message
|
|
33
|
+
* Returns a welcome message with links to documentation
|
|
34
|
+
*/
|
|
35
|
+
export declare const patch: <ThrowOnError extends boolean = false>(options?: Options<PatchData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").WelcomeResponse, unknown, ThrowOnError>;
|
|
36
|
+
/**
|
|
37
|
+
* Welcome message
|
|
38
|
+
* Returns a welcome message with links to documentation
|
|
39
|
+
*/
|
|
40
|
+
export declare const post: <ThrowOnError extends boolean = false>(options?: Options<PostData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").WelcomeResponse, unknown, ThrowOnError>;
|
|
41
|
+
/**
|
|
42
|
+
* Welcome message
|
|
43
|
+
* Returns a welcome message with links to documentation
|
|
44
|
+
*/
|
|
45
|
+
export declare const put: <ThrowOnError extends boolean = false>(options?: Options<PutData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").WelcomeResponse, unknown, ThrowOnError>;
|
|
46
|
+
/**
|
|
47
|
+
* Apply code edit
|
|
48
|
+
* Uses the configured LLM provider (Relace or Morph) to apply a code edit to the original content.
|
|
49
|
+
*
|
|
50
|
+
* To use this endpoint as an agent tool, follow these guidelines:
|
|
51
|
+
*
|
|
52
|
+
* Use this tool to make an edit to an existing file. This will be read by a less intelligent model, which will quickly apply the edit. You should make it clear what the edit is, while also minimizing the unchanged code you write.
|
|
53
|
+
*
|
|
54
|
+
* When writing the edit, you should specify each edit in sequence, with the special comment "// ... existing code ..." to represent unchanged code in between edited lines.
|
|
55
|
+
*
|
|
56
|
+
* Example format:
|
|
57
|
+
* // ... existing code ...
|
|
58
|
+
* FIRST_EDIT
|
|
59
|
+
* // ... existing code ...
|
|
60
|
+
* SECOND_EDIT
|
|
61
|
+
* // ... existing code ...
|
|
62
|
+
* THIRD_EDIT
|
|
63
|
+
* // ... existing code ...
|
|
64
|
+
*
|
|
65
|
+
* You should still bias towards repeating as few lines of the original file as possible to convey the change. But, each edit should contain minimally sufficient context of unchanged lines around the code you're editing to resolve ambiguity.
|
|
66
|
+
*
|
|
67
|
+
* DO NOT omit spans of pre-existing code (or comments) without using the "// ... existing code ..." comment to indicate its absence. If you omit the existing code comment, the model may inadvertently delete these lines.
|
|
68
|
+
*
|
|
69
|
+
* If you plan on deleting a section, you must provide context before and after to delete it. If the initial code is "Block 1\nBlock 2\nBlock 3", and you want to remove Block 2, you would output "// ... existing code ...\nBlock 1\nBlock 3\n// ... existing code ...".
|
|
70
|
+
*
|
|
71
|
+
* Make sure it is clear what the edit should be, and where it should be applied. Make edits to a file in a single edit_file call instead of multiple edit_file calls to the same file. The apply model can handle many distinct edits at once.
|
|
72
|
+
*/
|
|
73
|
+
export declare const putCodegenFastapplyByPath: <ThrowOnError extends boolean = false>(options: Options<PutCodegenFastapplyByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ApplyEditResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
74
|
+
/**
|
|
75
|
+
* Code reranking/semantic search
|
|
76
|
+
* Uses Relace's code reranking model to find the most relevant files for a given query. This is useful as a first pass in agentic exploration to narrow down the search space.
|
|
77
|
+
*
|
|
78
|
+
* Based on: https://docs.relace.ai/docs/code-reranker/agent
|
|
79
|
+
*
|
|
80
|
+
* Query Construction: The query can be a short question or a more detailed conversation with the user request included. For a first pass, use the full conversation; for subsequent calls, use more targeted questions.
|
|
81
|
+
*
|
|
82
|
+
* Token Limit and Score Threshold: For 200k token context models like Claude 4 Sonnet, recommended defaults are scoreThreshold=0.5 and tokenLimit=30000.
|
|
83
|
+
*
|
|
84
|
+
* The response will be a list of file paths and contents ordered from most relevant to least relevant.
|
|
85
|
+
*/
|
|
86
|
+
export declare const getCodegenRerankingByPath: <ThrowOnError extends boolean = false>(options: Options<GetCodegenRerankingByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").RerankingResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
16
87
|
/**
|
|
17
88
|
* Delete file or directory
|
|
18
89
|
* Delete a file or directory
|
|
@@ -20,9 +91,9 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
|
|
|
20
91
|
export declare const deleteFilesystemByPath: <ThrowOnError extends boolean = false>(options: Options<DeleteFilesystemByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").SuccessResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
21
92
|
/**
|
|
22
93
|
* Get file or directory information
|
|
23
|
-
* Get content of a file or listing of a directory
|
|
94
|
+
* Get content of a file or listing of a directory. Use Accept header to control response format for files.
|
|
24
95
|
*/
|
|
25
|
-
export declare const getFilesystemByPath: <ThrowOnError extends boolean = false>(options: Options<GetFilesystemByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Directory | import("./types.gen").FileWithContent, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
96
|
+
export declare const getFilesystemByPath: <ThrowOnError extends boolean = false>(options: Options<GetFilesystemByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").File | import("./types.gen").Directory | import("./types.gen").FileWithContent | Blob, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
26
97
|
/**
|
|
27
98
|
* Create or update a file or directory
|
|
28
99
|
* Create or update a file or directory
|
|
@@ -89,13 +160,3 @@ export declare const getProcessByIdentifierLogsStream: <ThrowOnError extends boo
|
|
|
89
160
|
* Streams the path of modified files (one per line) in the given directory. Closes when the client disconnects.
|
|
90
161
|
*/
|
|
91
162
|
export declare const getWatchFilesystemByPath: <ThrowOnError extends boolean = false>(options: Options<GetWatchFilesystemByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<string, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
92
|
-
/**
|
|
93
|
-
* Stream process logs in real time via WebSocket
|
|
94
|
-
* Streams the stdout and stderr output of a process in real time as JSON messages.
|
|
95
|
-
*/
|
|
96
|
-
export declare const getWsProcessByIdentifierLogsStream: <ThrowOnError extends boolean = false>(options: Options<GetWsProcessByIdentifierLogsStreamData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
97
|
-
/**
|
|
98
|
-
* Stream file modification events in a directory via WebSocket
|
|
99
|
-
* Streams JSON events of modified files in the given directory. Closes when the client disconnects.
|
|
100
|
-
*/
|
|
101
|
-
export declare const getWsWatchFilesystemByPath: <ThrowOnError extends boolean = false>(options: Options<GetWsWatchFilesystemByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, import("./types.gen").ErrorResponse, ThrowOnError>;
|