@blaxel/core 0.2.54-preview.13 → 0.2.54
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 +107 -1
- package/dist/cjs/sandbox/filesystem/filesystem.js +81 -1
- package/dist/cjs/types/sandbox/client/sdk.gen.d.ts +31 -1
- package/dist/cjs/types/sandbox/client/types.gen.d.ts +305 -0
- package/dist/cjs/types/sandbox/filesystem/filesystem.d.ts +5 -2
- package/dist/cjs/types/sandbox/filesystem/types.d.ts +20 -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 +107 -1
- package/dist/cjs-browser/sandbox/filesystem/filesystem.js +81 -1
- package/dist/cjs-browser/types/sandbox/client/sdk.gen.d.ts +31 -1
- package/dist/cjs-browser/types/sandbox/client/types.gen.d.ts +305 -0
- package/dist/cjs-browser/types/sandbox/filesystem/filesystem.d.ts +5 -2
- package/dist/cjs-browser/types/sandbox/filesystem/types.d.ts +20 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/common/settings.js +2 -2
- package/dist/esm/sandbox/client/sdk.gen.js +100 -0
- package/dist/esm/sandbox/filesystem/filesystem.js +82 -2
- 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 +100 -0
- package/dist/esm-browser/sandbox/filesystem/filesystem.js +82 -2
- package/package.json +1 -1
|
@@ -3,8 +3,8 @@ import { authentication } from "../authentication/index.js";
|
|
|
3
3
|
import { env } from "../common/env.js";
|
|
4
4
|
import { fs, os, path } from "../common/node.js";
|
|
5
5
|
// Build info - these placeholders are replaced at build time by build:replace-imports
|
|
6
|
-
const BUILD_VERSION = "0.2.54
|
|
7
|
-
const BUILD_COMMIT = "
|
|
6
|
+
const BUILD_VERSION = "0.2.54";
|
|
7
|
+
const BUILD_COMMIT = "36d148e9b7f9dd2134c772d954c8297b3c958ec3";
|
|
8
8
|
const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
|
|
9
9
|
// Cache for config.yaml tracking value
|
|
10
10
|
let configTrackingValue = null;
|
|
@@ -164,6 +164,38 @@ export const getCodegenRerankingByPath = (options) => {
|
|
|
164
164
|
...options
|
|
165
165
|
});
|
|
166
166
|
};
|
|
167
|
+
/**
|
|
168
|
+
* Search for text content in files
|
|
169
|
+
* Searches for text content inside files using ripgrep. Returns matching lines with context.
|
|
170
|
+
*/
|
|
171
|
+
export const getFilesystemContentSearchByPath = (options) => {
|
|
172
|
+
return (options.client ?? _heyApiClient).get({
|
|
173
|
+
security: [
|
|
174
|
+
{
|
|
175
|
+
scheme: 'bearer',
|
|
176
|
+
type: 'http'
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
url: '/filesystem-content-search/{path}',
|
|
180
|
+
...options
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Find files and directories
|
|
185
|
+
* Finds files and directories using the find command.
|
|
186
|
+
*/
|
|
187
|
+
export const getFilesystemFindByPath = (options) => {
|
|
188
|
+
return (options.client ?? _heyApiClient).get({
|
|
189
|
+
security: [
|
|
190
|
+
{
|
|
191
|
+
scheme: 'bearer',
|
|
192
|
+
type: 'http'
|
|
193
|
+
}
|
|
194
|
+
],
|
|
195
|
+
url: '/filesystem-find/{path}',
|
|
196
|
+
...options
|
|
197
|
+
});
|
|
198
|
+
};
|
|
167
199
|
/**
|
|
168
200
|
* List multipart uploads
|
|
169
201
|
* List all active multipart uploads
|
|
@@ -273,6 +305,22 @@ export const postFilesystemMultipartInitiateByPath = (options) => {
|
|
|
273
305
|
}
|
|
274
306
|
});
|
|
275
307
|
};
|
|
308
|
+
/**
|
|
309
|
+
* Fuzzy search for files and directories
|
|
310
|
+
* Performs fuzzy search on filesystem paths using fuzzy matching algorithm. Optimized alternative to find and grep commands.
|
|
311
|
+
*/
|
|
312
|
+
export const getFilesystemSearchByPath = (options) => {
|
|
313
|
+
return (options.client ?? _heyApiClient).get({
|
|
314
|
+
security: [
|
|
315
|
+
{
|
|
316
|
+
scheme: 'bearer',
|
|
317
|
+
type: 'http'
|
|
318
|
+
}
|
|
319
|
+
],
|
|
320
|
+
url: '/filesystem-search/{path}',
|
|
321
|
+
...options
|
|
322
|
+
});
|
|
323
|
+
};
|
|
276
324
|
/**
|
|
277
325
|
* Delete file or directory
|
|
278
326
|
* Delete a file or directory
|
|
@@ -325,6 +373,58 @@ export const putFilesystemByPath = (options) => {
|
|
|
325
373
|
}
|
|
326
374
|
});
|
|
327
375
|
};
|
|
376
|
+
/**
|
|
377
|
+
* Delete directory tree
|
|
378
|
+
* Delete a directory tree recursively
|
|
379
|
+
*/
|
|
380
|
+
export const deleteFilesystemTreeByPath = (options) => {
|
|
381
|
+
return (options.client ?? _heyApiClient).delete({
|
|
382
|
+
security: [
|
|
383
|
+
{
|
|
384
|
+
scheme: 'bearer',
|
|
385
|
+
type: 'http'
|
|
386
|
+
}
|
|
387
|
+
],
|
|
388
|
+
url: '/filesystem/tree/{path}',
|
|
389
|
+
...options
|
|
390
|
+
});
|
|
391
|
+
};
|
|
392
|
+
/**
|
|
393
|
+
* Get directory tree
|
|
394
|
+
* Get a recursive directory tree structure starting from the specified path
|
|
395
|
+
*/
|
|
396
|
+
export const getFilesystemTreeByPath = (options) => {
|
|
397
|
+
return (options.client ?? _heyApiClient).get({
|
|
398
|
+
security: [
|
|
399
|
+
{
|
|
400
|
+
scheme: 'bearer',
|
|
401
|
+
type: 'http'
|
|
402
|
+
}
|
|
403
|
+
],
|
|
404
|
+
url: '/filesystem/tree/{path}',
|
|
405
|
+
...options
|
|
406
|
+
});
|
|
407
|
+
};
|
|
408
|
+
/**
|
|
409
|
+
* Create or update directory tree
|
|
410
|
+
* Create or update multiple files within a directory tree structure
|
|
411
|
+
*/
|
|
412
|
+
export const putFilesystemTreeByPath = (options) => {
|
|
413
|
+
return (options.client ?? _heyApiClient).put({
|
|
414
|
+
security: [
|
|
415
|
+
{
|
|
416
|
+
scheme: 'bearer',
|
|
417
|
+
type: 'http'
|
|
418
|
+
}
|
|
419
|
+
],
|
|
420
|
+
url: '/filesystem/tree/{path}',
|
|
421
|
+
...options,
|
|
422
|
+
headers: {
|
|
423
|
+
'Content-Type': 'application/json',
|
|
424
|
+
...options?.headers
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
};
|
|
328
428
|
/**
|
|
329
429
|
* Stop monitoring ports for a process
|
|
330
430
|
* Stop monitoring for new ports opened by a process
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { settings } from "../../common/settings.js";
|
|
2
1
|
import { fs } from "../../common/node.js";
|
|
2
|
+
import { settings } from "../../common/settings.js";
|
|
3
3
|
import { SandboxAction } from "../action.js";
|
|
4
|
-
import { deleteFilesystemByPath, getFilesystemByPath,
|
|
4
|
+
import { deleteFilesystemByPath, deleteFilesystemMultipartByUploadIdAbort, getFilesystemByPath, getFilesystemContentSearchByPath, getFilesystemFindByPath, getFilesystemSearchByPath, getWatchFilesystemByPath, postFilesystemMultipartByUploadIdComplete, postFilesystemMultipartInitiateByPath, putFilesystemByPath, putFilesystemMultipartByUploadIdPart } from "../client/index.js";
|
|
5
5
|
// Multipart upload constants
|
|
6
6
|
const MULTIPART_THRESHOLD = 5 * 1024 * 1024; // 5MB
|
|
7
7
|
const CHUNK_SIZE = 5 * 1024 * 1024; // 5MB per part
|
|
@@ -196,6 +196,86 @@ export class SandboxFileSystem extends SandboxAction {
|
|
|
196
196
|
}
|
|
197
197
|
return data;
|
|
198
198
|
}
|
|
199
|
+
async search(query, path = "/", options) {
|
|
200
|
+
const formattedPath = this.formatPath(path);
|
|
201
|
+
const queryParams = {};
|
|
202
|
+
if (options?.maxResults !== undefined) {
|
|
203
|
+
queryParams.maxResults = options.maxResults;
|
|
204
|
+
}
|
|
205
|
+
if (options?.patterns && options.patterns.length > 0) {
|
|
206
|
+
queryParams.patterns = options.patterns.join(',');
|
|
207
|
+
}
|
|
208
|
+
if (options?.excludeDirs && options.excludeDirs.length > 0) {
|
|
209
|
+
queryParams.excludeDirs = options.excludeDirs.join(',');
|
|
210
|
+
}
|
|
211
|
+
if (options?.excludeHidden !== undefined) {
|
|
212
|
+
queryParams.excludeHidden = options.excludeHidden;
|
|
213
|
+
}
|
|
214
|
+
const result = await getFilesystemSearchByPath({
|
|
215
|
+
path: { path: formattedPath },
|
|
216
|
+
query: queryParams,
|
|
217
|
+
baseUrl: this.url,
|
|
218
|
+
client: this.client,
|
|
219
|
+
});
|
|
220
|
+
this.handleResponseError(result.response, result.data, result.error);
|
|
221
|
+
return result.data;
|
|
222
|
+
}
|
|
223
|
+
async find(path, options) {
|
|
224
|
+
const formattedPath = this.formatPath(path);
|
|
225
|
+
const queryParams = {};
|
|
226
|
+
if (options?.type) {
|
|
227
|
+
queryParams.type = options.type;
|
|
228
|
+
}
|
|
229
|
+
if (options?.patterns && options.patterns.length > 0) {
|
|
230
|
+
queryParams.patterns = options.patterns.join(',');
|
|
231
|
+
}
|
|
232
|
+
if (options?.maxResults !== undefined) {
|
|
233
|
+
queryParams.maxResults = options.maxResults;
|
|
234
|
+
}
|
|
235
|
+
if (options?.excludeDirs && options.excludeDirs.length > 0) {
|
|
236
|
+
queryParams.excludeDirs = options.excludeDirs.join(',');
|
|
237
|
+
}
|
|
238
|
+
if (options?.excludeHidden !== undefined) {
|
|
239
|
+
queryParams.excludeHidden = options.excludeHidden;
|
|
240
|
+
}
|
|
241
|
+
const result = await getFilesystemFindByPath({
|
|
242
|
+
path: { path: formattedPath },
|
|
243
|
+
query: queryParams,
|
|
244
|
+
baseUrl: this.url,
|
|
245
|
+
client: this.client,
|
|
246
|
+
});
|
|
247
|
+
this.handleResponseError(result.response, result.data, result.error);
|
|
248
|
+
return result.data;
|
|
249
|
+
}
|
|
250
|
+
async grep(query, path = "/", options) {
|
|
251
|
+
const formattedPath = this.formatPath(path);
|
|
252
|
+
const queryParams = {
|
|
253
|
+
query,
|
|
254
|
+
};
|
|
255
|
+
if (options?.caseSensitive !== undefined) {
|
|
256
|
+
queryParams.caseSensitive = options.caseSensitive;
|
|
257
|
+
}
|
|
258
|
+
if (options?.contextLines !== undefined) {
|
|
259
|
+
queryParams.contextLines = options.contextLines;
|
|
260
|
+
}
|
|
261
|
+
if (options?.maxResults !== undefined) {
|
|
262
|
+
queryParams.maxResults = options.maxResults;
|
|
263
|
+
}
|
|
264
|
+
if (options?.filePattern) {
|
|
265
|
+
queryParams.filePattern = options.filePattern;
|
|
266
|
+
}
|
|
267
|
+
if (options?.excludeDirs && options.excludeDirs.length > 0) {
|
|
268
|
+
queryParams.excludeDirs = options.excludeDirs.join(',');
|
|
269
|
+
}
|
|
270
|
+
const result = await getFilesystemContentSearchByPath({
|
|
271
|
+
path: { path: formattedPath },
|
|
272
|
+
query: queryParams,
|
|
273
|
+
baseUrl: this.url,
|
|
274
|
+
client: this.client,
|
|
275
|
+
});
|
|
276
|
+
this.handleResponseError(result.response, result.data, result.error);
|
|
277
|
+
return result.data;
|
|
278
|
+
}
|
|
199
279
|
async cp(source, destination, { maxWait = 180000 } = {}) {
|
|
200
280
|
let process = await this.process.exec({
|
|
201
281
|
command: `cp -r ${source} ${destination}`,
|