@blaxel/core 0.2.10-dev.80 → 0.2.10-dev.81
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.
|
@@ -5,11 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SandboxFileSystem = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const zod_1 = __importDefault(require("zod"));
|
|
9
8
|
const node_js_1 = require("../../common/node.js");
|
|
10
9
|
const settings_js_1 = require("../../common/settings.js");
|
|
11
10
|
const action_js_1 = require("../action.js");
|
|
12
11
|
const index_js_1 = require("../client/index.js");
|
|
12
|
+
const types_js_1 = require("./types.js");
|
|
13
13
|
class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
14
14
|
constructor(sandbox) {
|
|
15
15
|
super(sandbox);
|
|
@@ -294,43 +294,27 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
294
294
|
return {
|
|
295
295
|
cp: {
|
|
296
296
|
description: "Copy a file or directory",
|
|
297
|
-
parameters:
|
|
298
|
-
source: zod_1.default.string(),
|
|
299
|
-
destination: zod_1.default.string(),
|
|
300
|
-
}),
|
|
297
|
+
parameters: types_js_1.CpParamsSchema,
|
|
301
298
|
},
|
|
302
299
|
mkdir: {
|
|
303
300
|
description: "Create a directory",
|
|
304
|
-
parameters:
|
|
305
|
-
path: zod_1.default.string(),
|
|
306
|
-
permissions: zod_1.default.string().optional().default("0755"),
|
|
307
|
-
}),
|
|
301
|
+
parameters: types_js_1.MkdirParamsSchema,
|
|
308
302
|
},
|
|
309
303
|
ls: {
|
|
310
304
|
description: "List a directory",
|
|
311
|
-
parameters:
|
|
312
|
-
path: zod_1.default.string(),
|
|
313
|
-
}),
|
|
305
|
+
parameters: types_js_1.LsParamsSchema,
|
|
314
306
|
},
|
|
315
307
|
rm: {
|
|
316
308
|
description: "Remove a file or directory",
|
|
317
|
-
parameters:
|
|
318
|
-
path: zod_1.default.string(),
|
|
319
|
-
recursive: zod_1.default.boolean().optional().default(false),
|
|
320
|
-
}),
|
|
309
|
+
parameters: types_js_1.RmParamsSchema,
|
|
321
310
|
},
|
|
322
311
|
read: {
|
|
323
312
|
description: "Read a file",
|
|
324
|
-
parameters:
|
|
325
|
-
path: zod_1.default.string(),
|
|
326
|
-
}),
|
|
313
|
+
parameters: types_js_1.ReadParamsSchema,
|
|
327
314
|
},
|
|
328
315
|
write: {
|
|
329
316
|
description: "Write a file",
|
|
330
|
-
parameters:
|
|
331
|
-
path: zod_1.default.string(),
|
|
332
|
-
content: zod_1.default.string(),
|
|
333
|
-
}),
|
|
317
|
+
parameters: types_js_1.WriteParamsSchema,
|
|
334
318
|
}
|
|
335
319
|
};
|
|
336
320
|
}
|
|
@@ -338,10 +322,7 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
338
322
|
return {
|
|
339
323
|
cp: {
|
|
340
324
|
description: "Copy a file or directory",
|
|
341
|
-
parameters:
|
|
342
|
-
source: zod_1.default.string(),
|
|
343
|
-
destination: zod_1.default.string(),
|
|
344
|
-
}),
|
|
325
|
+
parameters: types_js_1.CpParamsSchema,
|
|
345
326
|
execute: async (args) => {
|
|
346
327
|
try {
|
|
347
328
|
const result = await this.cp(args.source, args.destination);
|
|
@@ -361,10 +342,7 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
361
342
|
},
|
|
362
343
|
mkdir: {
|
|
363
344
|
description: "Create a directory",
|
|
364
|
-
parameters:
|
|
365
|
-
path: zod_1.default.string(),
|
|
366
|
-
permissions: zod_1.default.string().optional().default("0755"),
|
|
367
|
-
}),
|
|
345
|
+
parameters: types_js_1.MkdirParamsSchema,
|
|
368
346
|
execute: async (args) => {
|
|
369
347
|
try {
|
|
370
348
|
const result = await this.mkdir(args.path, args.permissions);
|
|
@@ -384,9 +362,7 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
384
362
|
},
|
|
385
363
|
ls: {
|
|
386
364
|
description: "List a directory",
|
|
387
|
-
parameters:
|
|
388
|
-
path: zod_1.default.string(),
|
|
389
|
-
}),
|
|
365
|
+
parameters: types_js_1.LsParamsSchema,
|
|
390
366
|
execute: async (args) => {
|
|
391
367
|
try {
|
|
392
368
|
const result = await this.ls(args.path);
|
|
@@ -405,10 +381,7 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
405
381
|
},
|
|
406
382
|
rm: {
|
|
407
383
|
description: "Remove a file or directory",
|
|
408
|
-
parameters:
|
|
409
|
-
path: zod_1.default.string(),
|
|
410
|
-
recursive: zod_1.default.boolean().optional().default(false),
|
|
411
|
-
}),
|
|
384
|
+
parameters: types_js_1.RmParamsSchema,
|
|
412
385
|
execute: async (args) => {
|
|
413
386
|
try {
|
|
414
387
|
const result = await this.rm(args.path, args.recursive);
|
|
@@ -428,9 +401,7 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
428
401
|
},
|
|
429
402
|
read: {
|
|
430
403
|
description: "Read a file",
|
|
431
|
-
parameters:
|
|
432
|
-
path: zod_1.default.string(),
|
|
433
|
-
}),
|
|
404
|
+
parameters: types_js_1.ReadParamsSchema,
|
|
434
405
|
execute: async (args) => {
|
|
435
406
|
try {
|
|
436
407
|
const result = await this.read(args.path);
|
|
@@ -449,10 +420,7 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
449
420
|
},
|
|
450
421
|
write: {
|
|
451
422
|
description: "Write a file",
|
|
452
|
-
parameters:
|
|
453
|
-
path: zod_1.default.string(),
|
|
454
|
-
content: zod_1.default.string(),
|
|
455
|
-
}),
|
|
423
|
+
parameters: types_js_1.WriteParamsSchema,
|
|
456
424
|
execute: async (args) => {
|
|
457
425
|
try {
|
|
458
426
|
const result = await this.write(args.path, args.content);
|