@loopstack/sandbox-filesystem 0.3.0 → 0.4.0
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/tools/sandbox-create-directory.tool.d.ts +5 -4
- package/dist/tools/sandbox-create-directory.tool.d.ts.map +1 -1
- package/dist/tools/sandbox-create-directory.tool.js +8 -4
- package/dist/tools/sandbox-create-directory.tool.js.map +1 -1
- package/dist/tools/sandbox-delete.tool.d.ts +5 -4
- package/dist/tools/sandbox-delete.tool.d.ts.map +1 -1
- package/dist/tools/sandbox-delete.tool.js +8 -4
- package/dist/tools/sandbox-delete.tool.js.map +1 -1
- package/dist/tools/sandbox-exists.tool.d.ts +5 -4
- package/dist/tools/sandbox-exists.tool.d.ts.map +1 -1
- package/dist/tools/sandbox-exists.tool.js +8 -4
- package/dist/tools/sandbox-exists.tool.js.map +1 -1
- package/dist/tools/sandbox-file-info.tool.d.ts +5 -4
- package/dist/tools/sandbox-file-info.tool.d.ts.map +1 -1
- package/dist/tools/sandbox-file-info.tool.js +8 -4
- package/dist/tools/sandbox-file-info.tool.js.map +1 -1
- package/dist/tools/sandbox-list-directory.tool.d.ts +5 -4
- package/dist/tools/sandbox-list-directory.tool.d.ts.map +1 -1
- package/dist/tools/sandbox-list-directory.tool.js +8 -4
- package/dist/tools/sandbox-list-directory.tool.js.map +1 -1
- package/dist/tools/sandbox-read-file.tool.d.ts +5 -4
- package/dist/tools/sandbox-read-file.tool.d.ts.map +1 -1
- package/dist/tools/sandbox-read-file.tool.js +8 -4
- package/dist/tools/sandbox-read-file.tool.js.map +1 -1
- package/dist/tools/sandbox-write-file.tool.d.ts +5 -4
- package/dist/tools/sandbox-write-file.tool.d.ts.map +1 -1
- package/dist/tools/sandbox-write-file.tool.js +8 -4
- package/dist/tools/sandbox-write-file.tool.js.map +1 -1
- package/package.json +3 -3
- package/src/tools/sandbox-create-directory.tool.ts +7 -8
- package/src/tools/sandbox-delete.tool.ts +7 -5
- package/src/tools/sandbox-exists.tool.ts +7 -5
- package/src/tools/sandbox-file-info.tool.ts +7 -5
- package/src/tools/sandbox-list-directory.tool.ts +7 -8
- package/src/tools/sandbox-read-file.tool.ts +7 -5
- package/src/tools/sandbox-write-file.tool.ts +7 -5
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ToolInterface, ToolResult
|
|
3
|
-
declare const
|
|
2
|
+
import { ToolInterface, ToolResult } from '@loopstack/common';
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
4
|
containerId: z.ZodString;
|
|
5
5
|
path: z.ZodString;
|
|
6
6
|
recursive: z.ZodDefault<z.ZodBoolean>;
|
|
7
7
|
}, z.core.$strict>;
|
|
8
|
-
type SandboxCreateDirectoryArgs = z.infer<typeof
|
|
8
|
+
type SandboxCreateDirectoryArgs = z.infer<typeof inputSchema>;
|
|
9
9
|
interface SandboxCreateDirectoryResult {
|
|
10
10
|
path: string;
|
|
11
11
|
created: boolean;
|
|
@@ -13,7 +13,8 @@ interface SandboxCreateDirectoryResult {
|
|
|
13
13
|
export declare class SandboxCreateDirectory implements ToolInterface<SandboxCreateDirectoryArgs> {
|
|
14
14
|
private readonly logger;
|
|
15
15
|
private sandboxCommand;
|
|
16
|
-
|
|
16
|
+
args: SandboxCreateDirectoryArgs;
|
|
17
|
+
execute(args: SandboxCreateDirectoryArgs): Promise<ToolResult<SandboxCreateDirectoryResult>>;
|
|
17
18
|
}
|
|
18
19
|
export {};
|
|
19
20
|
//# sourceMappingURL=sandbox-create-directory.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-create-directory.tool.d.ts","sourceRoot":"","sources":["../../src/tools/sandbox-create-directory.tool.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"sandbox-create-directory.tool.d.ts","sourceRoot":"","sources":["../../src/tools/sandbox-create-directory.tool.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAA2B,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGvF,QAAA,MAAM,WAAW;;;;kBAMN,CAAC;AAEZ,KAAK,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE9D,UAAU,4BAA4B;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,qBAMa,sBAAuB,YAAW,aAAa,CAAC,0BAA0B,CAAC;IACtF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2C;IAEpD,OAAO,CAAC,cAAc,CAAiB;IAGrD,IAAI,EAAE,0BAA0B,CAAC;IAE3B,OAAO,CAAC,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,UAAU,CAAC,4BAA4B,CAAC,CAAC;CAyCnG"}
|
|
@@ -15,7 +15,7 @@ const common_1 = require("@nestjs/common");
|
|
|
15
15
|
const zod_1 = require("zod");
|
|
16
16
|
const common_2 = require("@loopstack/common");
|
|
17
17
|
const sandbox_tool_1 = require("@loopstack/sandbox-tool");
|
|
18
|
-
const
|
|
18
|
+
const inputSchema = zod_1.z
|
|
19
19
|
.object({
|
|
20
20
|
containerId: zod_1.z.string().describe('The ID of the container to create the directory in'),
|
|
21
21
|
path: zod_1.z.string().describe('The path of the directory to create'),
|
|
@@ -25,7 +25,8 @@ const propertiesSchema = zod_1.z
|
|
|
25
25
|
let SandboxCreateDirectory = SandboxCreateDirectory_1 = class SandboxCreateDirectory {
|
|
26
26
|
logger = new common_1.Logger(SandboxCreateDirectory_1.name);
|
|
27
27
|
sandboxCommand;
|
|
28
|
-
|
|
28
|
+
args;
|
|
29
|
+
async execute(args) {
|
|
29
30
|
const { containerId, path: dirPath, recursive } = args;
|
|
30
31
|
this.logger.debug(`Creating directory ${dirPath} in container ${containerId} (recursive: ${recursive})`);
|
|
31
32
|
const mkdirArgs = recursive ? ['-p', dirPath] : [dirPath];
|
|
@@ -64,13 +65,16 @@ __decorate([
|
|
|
64
65
|
(0, common_2.InjectTool)(),
|
|
65
66
|
__metadata("design:type", sandbox_tool_1.SandboxCommand)
|
|
66
67
|
], SandboxCreateDirectory.prototype, "sandboxCommand", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, common_2.Input)({ schema: inputSchema }),
|
|
70
|
+
__metadata("design:type", Object)
|
|
71
|
+
], SandboxCreateDirectory.prototype, "args", void 0);
|
|
67
72
|
exports.SandboxCreateDirectory = SandboxCreateDirectory = SandboxCreateDirectory_1 = __decorate([
|
|
68
73
|
(0, common_1.Injectable)(),
|
|
69
74
|
(0, common_2.Tool)({
|
|
70
75
|
config: {
|
|
71
76
|
description: 'Create a directory in a sandbox container',
|
|
72
77
|
},
|
|
73
|
-
})
|
|
74
|
-
(0, common_2.WithArguments)(propertiesSchema)
|
|
78
|
+
})
|
|
75
79
|
], SandboxCreateDirectory);
|
|
76
80
|
//# sourceMappingURL=sandbox-create-directory.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-create-directory.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-create-directory.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAeA,2CAAoD;AACpD,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"sandbox-create-directory.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-create-directory.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAeA,2CAAoD;AACpD,6BAAwB;AACxB,8CAAuF;AACvF,0DAAyD;AAEzD,MAAM,WAAW,GAAG,OAAC;KAClB,MAAM,CAAC;IACN,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;IACtF,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCA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QAAQ,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACjD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,OAAO,KAAK,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,eAAe,EAAE,CAAC,CAAC;YACrG,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,KAAK,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,eAAe,EAAE,CAAC,CAAC;QACrG,CAAC;QAED,IAAI,aAAa,EAAE,CAAC;YAClB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,OAAO,iBAAiB,CAAC,CAAC;QAC3D,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kCAAkC,OAAO,iBAAiB,WAAW,EAAE,CAAC,CAAC;QAC3F,CAAC;QAED,OAAO;YACL,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,KAAK,CAAC;aACpC;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAjDY,wDAAsB;AAGX;IAArB,IAAA,mBAAU,GAAE;8BAAyB,6BAAc;8DAAC;AAGrD;IADC,IAAA,cAAK,EAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;;oDACE;iCANtB,sBAAsB;IANlC,IAAA,mBAAU,GAAE;IACZ,IAAA,aAAI,EAAC;QACJ,MAAM,EAAE;YACN,WAAW,EAAE,2CAA2C;SACzD;KACF,CAAC;GACW,sBAAsB,CAiDlC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ToolInterface, ToolResult
|
|
3
|
-
declare const
|
|
2
|
+
import { ToolInterface, ToolResult } from '@loopstack/common';
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
4
|
containerId: z.ZodString;
|
|
5
5
|
path: z.ZodString;
|
|
6
6
|
recursive: z.ZodDefault<z.ZodBoolean>;
|
|
7
7
|
force: z.ZodDefault<z.ZodBoolean>;
|
|
8
8
|
}, z.core.$strict>;
|
|
9
|
-
type SandboxDeleteArgs = z.infer<typeof
|
|
9
|
+
type SandboxDeleteArgs = z.infer<typeof inputSchema>;
|
|
10
10
|
interface SandboxDeleteResult {
|
|
11
11
|
path: string;
|
|
12
12
|
deleted: boolean;
|
|
@@ -14,7 +14,8 @@ interface SandboxDeleteResult {
|
|
|
14
14
|
export declare class SandboxDelete implements ToolInterface<SandboxDeleteArgs> {
|
|
15
15
|
private readonly logger;
|
|
16
16
|
private sandboxCommand;
|
|
17
|
-
|
|
17
|
+
args: SandboxDeleteArgs;
|
|
18
|
+
execute(args: SandboxDeleteArgs): Promise<ToolResult<SandboxDeleteResult>>;
|
|
18
19
|
}
|
|
19
20
|
export {};
|
|
20
21
|
//# sourceMappingURL=sandbox-delete.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-delete.tool.d.ts","sourceRoot":"","sources":["../../src/tools/sandbox-delete.tool.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"sandbox-delete.tool.d.ts","sourceRoot":"","sources":["../../src/tools/sandbox-delete.tool.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAA2B,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGvF,QAAA,MAAM,WAAW;;;;;kBAON,CAAC;AAEZ,KAAK,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAErD,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,qBAMa,aAAc,YAAW,aAAa,CAAC,iBAAiB,CAAC;IACpE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;IAE3C,OAAO,CAAC,cAAc,CAAiB;IAGrD,IAAI,EAAE,iBAAiB,CAAC;IAElB,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;CAqCjF"}
|
|
@@ -15,7 +15,7 @@ const common_1 = require("@nestjs/common");
|
|
|
15
15
|
const zod_1 = require("zod");
|
|
16
16
|
const common_2 = require("@loopstack/common");
|
|
17
17
|
const sandbox_tool_1 = require("@loopstack/sandbox-tool");
|
|
18
|
-
const
|
|
18
|
+
const inputSchema = zod_1.z
|
|
19
19
|
.object({
|
|
20
20
|
containerId: zod_1.z.string().describe('The ID of the container to delete the file/directory from'),
|
|
21
21
|
path: zod_1.z.string().describe('The path to the file or directory to delete'),
|
|
@@ -26,7 +26,8 @@ const propertiesSchema = zod_1.z
|
|
|
26
26
|
let SandboxDelete = SandboxDelete_1 = class SandboxDelete {
|
|
27
27
|
logger = new common_1.Logger(SandboxDelete_1.name);
|
|
28
28
|
sandboxCommand;
|
|
29
|
-
|
|
29
|
+
args;
|
|
30
|
+
async execute(args) {
|
|
30
31
|
const { containerId, path: targetPath, recursive, force } = args;
|
|
31
32
|
this.logger.debug(`Deleting ${targetPath} in container ${containerId} (recursive: ${recursive}, force: ${force})`);
|
|
32
33
|
const rmArgs = [];
|
|
@@ -64,13 +65,16 @@ __decorate([
|
|
|
64
65
|
(0, common_2.InjectTool)(),
|
|
65
66
|
__metadata("design:type", sandbox_tool_1.SandboxCommand)
|
|
66
67
|
], SandboxDelete.prototype, "sandboxCommand", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, common_2.Input)({ schema: inputSchema }),
|
|
70
|
+
__metadata("design:type", Object)
|
|
71
|
+
], SandboxDelete.prototype, "args", void 0);
|
|
67
72
|
exports.SandboxDelete = SandboxDelete = SandboxDelete_1 = __decorate([
|
|
68
73
|
(0, common_1.Injectable)(),
|
|
69
74
|
(0, common_2.Tool)({
|
|
70
75
|
config: {
|
|
71
76
|
description: 'Delete a file or directory in a sandbox container',
|
|
72
77
|
},
|
|
73
|
-
})
|
|
74
|
-
(0, common_2.WithArguments)(propertiesSchema)
|
|
78
|
+
})
|
|
75
79
|
], SandboxDelete);
|
|
76
80
|
//# sourceMappingURL=sandbox-delete.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-delete.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-delete.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAeA,2CAAoD;AACpD,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"sandbox-delete.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-delete.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAeA,2CAAoD;AACpD,6BAAwB;AACxB,8CAAuF;AACvF,0DAAyD;AAEzD,MAAM,WAAW,GAAG,OAAC;KAClB,MAAM,CAAC;IACN,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2DAA2D,CAAC;IAC7F,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;IACxE,SAAS,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,8DAA8D,CAAC;IAC9G,KAAK,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,8DAA8D,CAAC;CAC3G,CAAC;KACD,MAAM,EAAE,CAAC;AAeL,IAAM,aAAa,qBAAnB,MAAM,aAAa;IACP,MAAM,GAAG,IAAI,eAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAC;IAEnC,cAAc,CAAiB;IAGrD,IAAI,CAAoB;IAExB,KAAK,CAAC,OAAO,CAAC,IAAuB;QACnC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAA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,EAAE,IAAI;aACd;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA7CY,sCAAa;AAGF;IAArB,IAAA,mBAAU,GAAE;8BAAyB,6BAAc;qDAAC;AAGrD;IADC,IAAA,cAAK,EAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;;2CACP;wBANb,aAAa;IANzB,IAAA,mBAAU,GAAE;IACZ,IAAA,aAAI,EAAC;QACJ,MAAM,EAAE;YACN,WAAW,EAAE,mDAAmD;SACjE;KACF,CAAC;GACW,aAAa,CA6CzB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ToolInterface, ToolResult
|
|
3
|
-
declare const
|
|
2
|
+
import { ToolInterface, ToolResult } from '@loopstack/common';
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
4
|
containerId: z.ZodString;
|
|
5
5
|
path: z.ZodString;
|
|
6
6
|
}, z.core.$strict>;
|
|
7
|
-
type SandboxExistsArgs = z.infer<typeof
|
|
7
|
+
type SandboxExistsArgs = z.infer<typeof inputSchema>;
|
|
8
8
|
interface SandboxExistsResult {
|
|
9
9
|
path: string;
|
|
10
10
|
exists: boolean;
|
|
@@ -13,7 +13,8 @@ interface SandboxExistsResult {
|
|
|
13
13
|
export declare class SandboxExists implements ToolInterface<SandboxExistsArgs> {
|
|
14
14
|
private readonly logger;
|
|
15
15
|
private sandboxCommand;
|
|
16
|
-
|
|
16
|
+
args: SandboxExistsArgs;
|
|
17
|
+
execute(args: SandboxExistsArgs): Promise<ToolResult<SandboxExistsResult>>;
|
|
17
18
|
private parseFileType;
|
|
18
19
|
}
|
|
19
20
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-exists.tool.d.ts","sourceRoot":"","sources":["../../src/tools/sandbox-exists.tool.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"sandbox-exists.tool.d.ts","sourceRoot":"","sources":["../../src/tools/sandbox-exists.tool.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAA2B,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGvF,QAAA,MAAM,WAAW;;;kBAKN,CAAC;AAEZ,KAAK,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAErD,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,IAAI,CAAC;CACzD;AAED,qBAMa,aAAc,YAAW,aAAa,CAAC,iBAAiB,CAAC;IACpE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;IAGzD,OAAO,CAAC,cAAc,CAAiB;IAGvC,IAAI,EAAE,iBAAiB,CAAC;IAElB,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;IA8ChF,OAAO,CAAC,aAAa;CAOtB"}
|
|
@@ -15,7 +15,7 @@ const common_1 = require("@nestjs/common");
|
|
|
15
15
|
const zod_1 = require("zod");
|
|
16
16
|
const common_2 = require("@loopstack/common");
|
|
17
17
|
const sandbox_tool_1 = require("@loopstack/sandbox-tool");
|
|
18
|
-
const
|
|
18
|
+
const inputSchema = zod_1.z
|
|
19
19
|
.object({
|
|
20
20
|
containerId: zod_1.z.string().describe('The ID of the container to check for file existence'),
|
|
21
21
|
path: zod_1.z.string().describe('The path to check for existence'),
|
|
@@ -24,7 +24,8 @@ const propertiesSchema = zod_1.z
|
|
|
24
24
|
let SandboxExists = SandboxExists_1 = class SandboxExists {
|
|
25
25
|
logger = new common_1.Logger(SandboxExists_1.name);
|
|
26
26
|
sandboxCommand;
|
|
27
|
-
|
|
27
|
+
args;
|
|
28
|
+
async execute(args) {
|
|
28
29
|
const { containerId, path: targetPath } = args;
|
|
29
30
|
this.logger.debug(`Checking existence of ${targetPath} in container ${containerId}`);
|
|
30
31
|
const result = await this.sandboxCommand.execute({
|
|
@@ -76,13 +77,16 @@ __decorate([
|
|
|
76
77
|
(0, common_2.InjectTool)(),
|
|
77
78
|
__metadata("design:type", sandbox_tool_1.SandboxCommand)
|
|
78
79
|
], SandboxExists.prototype, "sandboxCommand", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, common_2.Input)({ schema: inputSchema }),
|
|
82
|
+
__metadata("design:type", Object)
|
|
83
|
+
], SandboxExists.prototype, "args", void 0);
|
|
79
84
|
exports.SandboxExists = SandboxExists = SandboxExists_1 = __decorate([
|
|
80
85
|
(0, common_1.Injectable)(),
|
|
81
86
|
(0, common_2.Tool)({
|
|
82
87
|
config: {
|
|
83
88
|
description: 'Check if a file or directory exists in a sandbox container',
|
|
84
89
|
},
|
|
85
|
-
})
|
|
86
|
-
(0, common_2.WithArguments)(propertiesSchema)
|
|
90
|
+
})
|
|
87
91
|
], SandboxExists);
|
|
88
92
|
//# sourceMappingURL=sandbox-exists.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-exists.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-exists.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAeA,2CAAoD;AACpD,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"sandbox-exists.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-exists.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAeA,2CAAoD;AACpD,6BAAwB;AACxB,8CAAuF;AACvF,0DAAyD;AAEzD,MAAM,WAAW,GAAG,OAAC;KAClB,MAAM,CAAC;IACN,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;IACvF,IAAI,EAAE,OAAC,C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10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ToolInterface, ToolResult
|
|
3
|
-
declare const
|
|
2
|
+
import { ToolInterface, ToolResult } from '@loopstack/common';
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
4
|
containerId: z.ZodString;
|
|
5
5
|
path: z.ZodString;
|
|
6
6
|
}, z.core.$strict>;
|
|
7
|
-
type SandboxFileInfoArgs = z.infer<typeof
|
|
7
|
+
type SandboxFileInfoArgs = z.infer<typeof inputSchema>;
|
|
8
8
|
interface SandboxFileInfoResult {
|
|
9
9
|
path: string;
|
|
10
10
|
name: string;
|
|
@@ -20,7 +20,8 @@ interface SandboxFileInfoResult {
|
|
|
20
20
|
export declare class SandboxFileInfo implements ToolInterface<SandboxFileInfoArgs> {
|
|
21
21
|
private readonly logger;
|
|
22
22
|
private sandboxCommand;
|
|
23
|
-
|
|
23
|
+
args: SandboxFileInfoArgs;
|
|
24
|
+
execute(args: SandboxFileInfoArgs): Promise<ToolResult<SandboxFileInfoResult>>;
|
|
24
25
|
private parseFileType;
|
|
25
26
|
}
|
|
26
27
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-file-info.tool.d.ts","sourceRoot":"","sources":["../../src/tools/sandbox-file-info.tool.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"sandbox-file-info.tool.d.ts","sourceRoot":"","sources":["../../src/tools/sandbox-file-info.tool.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAA2B,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGvF,QAAA,MAAM,WAAW;;;kBAKN,CAAC;AAEZ,KAAK,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEvD,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAMa,eAAgB,YAAW,aAAa,CAAC,mBAAmB,CAAC;IACxE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAE7C,OAAO,CAAC,cAAc,CAAiB;IAGrD,IAAI,EAAE,mBAAmB,CAAC;IAEpB,OAAO,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAwDpF,OAAO,CAAC,aAAa;CAOtB"}
|
|
@@ -15,7 +15,7 @@ const common_1 = require("@nestjs/common");
|
|
|
15
15
|
const zod_1 = require("zod");
|
|
16
16
|
const common_2 = require("@loopstack/common");
|
|
17
17
|
const sandbox_tool_1 = require("@loopstack/sandbox-tool");
|
|
18
|
-
const
|
|
18
|
+
const inputSchema = zod_1.z
|
|
19
19
|
.object({
|
|
20
20
|
containerId: zod_1.z.string().describe('The ID of the container to get file info from'),
|
|
21
21
|
path: zod_1.z.string().describe('The path to the file or directory'),
|
|
@@ -24,7 +24,8 @@ const propertiesSchema = zod_1.z
|
|
|
24
24
|
let SandboxFileInfo = SandboxFileInfo_1 = class SandboxFileInfo {
|
|
25
25
|
logger = new common_1.Logger(SandboxFileInfo_1.name);
|
|
26
26
|
sandboxCommand;
|
|
27
|
-
|
|
27
|
+
args;
|
|
28
|
+
async execute(args) {
|
|
28
29
|
const { containerId, path: targetPath } = args;
|
|
29
30
|
this.logger.debug(`Getting file info for ${targetPath} in container ${containerId}`);
|
|
30
31
|
const result = await this.sandboxCommand.execute({
|
|
@@ -83,13 +84,16 @@ __decorate([
|
|
|
83
84
|
(0, common_2.InjectTool)(),
|
|
84
85
|
__metadata("design:type", sandbox_tool_1.SandboxCommand)
|
|
85
86
|
], SandboxFileInfo.prototype, "sandboxCommand", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, common_2.Input)({ schema: inputSchema }),
|
|
89
|
+
__metadata("design:type", Object)
|
|
90
|
+
], SandboxFileInfo.prototype, "args", void 0);
|
|
86
91
|
exports.SandboxFileInfo = SandboxFileInfo = SandboxFileInfo_1 = __decorate([
|
|
87
92
|
(0, common_1.Injectable)(),
|
|
88
93
|
(0, common_2.Tool)({
|
|
89
94
|
config: {
|
|
90
95
|
description: 'Get detailed information about a file or directory in a sandbox container',
|
|
91
96
|
},
|
|
92
|
-
})
|
|
93
|
-
(0, common_2.WithArguments)(propertiesSchema)
|
|
97
|
+
})
|
|
94
98
|
], SandboxFileInfo);
|
|
95
99
|
//# sourceMappingURL=sandbox-file-info.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-file-info.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-file-info.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAeA,2CAAoD;AACpD,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"sandbox-file-info.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-file-info.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAeA,2CAAoD;AACpD,6BAAwB;AACxB,8CAAuF;AACvF,0DAAyD;AAEzD,MAAM,WAAW,GAAG,OAAC;KAClB,MAAM,CAAC;IACN,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;IACjF,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;CAC/D,CAAC;KACD,MAAM,EAAE,CAAC;AA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AAC;YAAE,OAAO,SAAS,CAAC;QACtD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAA;AAvEY,0CAAe;AAGJ;IAArB,IAAA,mBAAU,GAAE;8BAAyB,6BAAc;uDAAC;AAGrD;IADC,IAAA,cAAK,EAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;;6CACL;0BANf,eAAe;IAN3B,IAAA,mBAAU,GAAE;IACZ,IAAA,aAAI,EAAC;QACJ,MAAM,EAAE;YACN,WAAW,EAAE,2EAA2E;SACzF;KACF,CAAC;GACW,eAAe,CAuE3B"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ToolInterface, ToolResult
|
|
3
|
-
declare const
|
|
2
|
+
import { ToolInterface, ToolResult } from '@loopstack/common';
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
4
|
containerId: z.ZodString;
|
|
5
5
|
path: z.ZodString;
|
|
6
6
|
recursive: z.ZodDefault<z.ZodBoolean>;
|
|
7
7
|
}, z.core.$strict>;
|
|
8
|
-
type SandboxListDirectoryArgs = z.infer<typeof
|
|
8
|
+
type SandboxListDirectoryArgs = z.infer<typeof inputSchema>;
|
|
9
9
|
interface FileEntry {
|
|
10
10
|
name: string;
|
|
11
11
|
type: 'file' | 'directory' | 'symlink' | 'other';
|
|
@@ -19,7 +19,8 @@ interface SandboxListDirectoryResult {
|
|
|
19
19
|
export declare class SandboxListDirectory implements ToolInterface<SandboxListDirectoryArgs> {
|
|
20
20
|
private readonly logger;
|
|
21
21
|
private sandboxCommand;
|
|
22
|
-
|
|
22
|
+
args: SandboxListDirectoryArgs;
|
|
23
|
+
execute(args: SandboxListDirectoryArgs): Promise<ToolResult<SandboxListDirectoryResult>>;
|
|
23
24
|
private parseFileType;
|
|
24
25
|
}
|
|
25
26
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-list-directory.tool.d.ts","sourceRoot":"","sources":["../../src/tools/sandbox-list-directory.tool.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"sandbox-list-directory.tool.d.ts","sourceRoot":"","sources":["../../src/tools/sandbox-list-directory.tool.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAA2B,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGvF,QAAA,MAAM,WAAW;;;;kBAMN,CAAC;AAEZ,KAAK,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE5D,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,0BAA0B;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB;AAED,qBAMa,oBAAqB,YAAW,aAAa,CAAC,wBAAwB,CAAC;IAClF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyC;IAElD,OAAO,CAAC,cAAc,CAAiB;IAGrD,IAAI,EAAE,wBAAwB,CAAC;IAEzB,OAAO,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC;IA4D9F,OAAO,CAAC,aAAa;CAYtB"}
|
|
@@ -15,7 +15,7 @@ const common_1 = require("@nestjs/common");
|
|
|
15
15
|
const zod_1 = require("zod");
|
|
16
16
|
const common_2 = require("@loopstack/common");
|
|
17
17
|
const sandbox_tool_1 = require("@loopstack/sandbox-tool");
|
|
18
|
-
const
|
|
18
|
+
const inputSchema = zod_1.z
|
|
19
19
|
.object({
|
|
20
20
|
containerId: zod_1.z.string().describe('The ID of the container to list the directory from'),
|
|
21
21
|
path: zod_1.z.string().describe('The path to the directory to list'),
|
|
@@ -25,7 +25,8 @@ const propertiesSchema = zod_1.z
|
|
|
25
25
|
let SandboxListDirectory = SandboxListDirectory_1 = class SandboxListDirectory {
|
|
26
26
|
logger = new common_1.Logger(SandboxListDirectory_1.name);
|
|
27
27
|
sandboxCommand;
|
|
28
|
-
|
|
28
|
+
args;
|
|
29
|
+
async execute(args) {
|
|
29
30
|
const { containerId, path: dirPath, recursive } = args;
|
|
30
31
|
this.logger.debug(`Listing directory ${dirPath} in container ${containerId} (recursive: ${recursive})`);
|
|
31
32
|
const command = recursive
|
|
@@ -89,13 +90,16 @@ __decorate([
|
|
|
89
90
|
(0, common_2.InjectTool)(),
|
|
90
91
|
__metadata("design:type", sandbox_tool_1.SandboxCommand)
|
|
91
92
|
], SandboxListDirectory.prototype, "sandboxCommand", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, common_2.Input)({ schema: inputSchema }),
|
|
95
|
+
__metadata("design:type", Object)
|
|
96
|
+
], SandboxListDirectory.prototype, "args", void 0);
|
|
92
97
|
exports.SandboxListDirectory = SandboxListDirectory = SandboxListDirectory_1 = __decorate([
|
|
93
98
|
(0, common_1.Injectable)(),
|
|
94
99
|
(0, common_2.Tool)({
|
|
95
100
|
config: {
|
|
96
101
|
description: 'List files and directories in a sandbox container',
|
|
97
102
|
},
|
|
98
|
-
})
|
|
99
|
-
(0, common_2.WithArguments)(propertiesSchema)
|
|
103
|
+
})
|
|
100
104
|
], SandboxListDirectory);
|
|
101
105
|
//# sourceMappingURL=sandbox-list-directory.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-list-directory.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-list-directory.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAeA,2CAAoD;AACpD,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"sandbox-list-directory.tool.js","sour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C;oBAClC,IAAI,EAAE,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;oBAC3B,IAAI,EAAE,QAAQ;iBACf,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,OAAO,CAAC,MAAM,eAAe,OAAO,EAAE,CAAC,CAAC;QAEpE,OAAO;YACL,IAAI,EAAE;gBACJ,IAAI,EAAE,OAAO;gBACb,OAAO;aACR;SACF,CAAC;IACJ,CAAC;IAEO,aAAa,CAAC,QAAgB;QACpC,QAAQ,QAAQ,EAAE,CAAC;YACjB,KAAK,GAAG;gBACN,OAAO,MAAM,CAAC;YAChB,KAAK,GAAG;gBACN,OAAO,WAAW,CAAC;YACrB,KAAK,GAAG;gBACN,OAAO,SAAS,CAAC;YACnB;gBACE,OAAO,OAAO,CAAC;QACnB,CAAC;IACH,CAAC;CACF,CAAA;AAhFY,oDAAoB;AAGT;IAArB,IAAA,mBAAU,GAAE;8BAAyB,6BAAc;4DAAC;AAGrD;IADC,IAAA,cAAK,EAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;;kDACA;+BANpB,oBAAoB;IANhC,IAAA,mBAAU,GAAE;IACZ,IAAA,aAAI,EAAC;QACJ,MAAM,EAAE;YACN,WAAW,EAAE,mDAAmD;SACjE;KACF,CAAC;GACW,oBAAoB,CAgFhC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ToolInterface, ToolResult
|
|
3
|
-
declare const
|
|
2
|
+
import { ToolInterface, ToolResult } from '@loopstack/common';
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
4
|
containerId: z.ZodString;
|
|
5
5
|
path: z.ZodString;
|
|
6
6
|
encoding: z.ZodDefault<z.ZodEnum<{
|
|
@@ -8,7 +8,7 @@ declare const propertiesSchema: z.ZodObject<{
|
|
|
8
8
|
base64: "base64";
|
|
9
9
|
}>>;
|
|
10
10
|
}, z.core.$strict>;
|
|
11
|
-
type SandboxReadFileArgs = z.infer<typeof
|
|
11
|
+
type SandboxReadFileArgs = z.infer<typeof inputSchema>;
|
|
12
12
|
interface SandboxReadFileResult {
|
|
13
13
|
content: string;
|
|
14
14
|
encoding: string;
|
|
@@ -16,7 +16,8 @@ interface SandboxReadFileResult {
|
|
|
16
16
|
export declare class SandboxReadFile implements ToolInterface<SandboxReadFileArgs> {
|
|
17
17
|
private readonly logger;
|
|
18
18
|
private sandboxCommand;
|
|
19
|
-
|
|
19
|
+
args: SandboxReadFileArgs;
|
|
20
|
+
execute(args: SandboxReadFileArgs): Promise<ToolResult<SandboxReadFileResult>>;
|
|
20
21
|
}
|
|
21
22
|
export {};
|
|
22
23
|
//# sourceMappingURL=sandbox-read-file.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-read-file.tool.d.ts","sourceRoot":"","sources":["../../src/tools/sandbox-read-file.tool.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"sandbox-read-file.tool.d.ts","sourceRoot":"","sources":["../../src/tools/sandbox-read-file.tool.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAA2B,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGvF,QAAA,MAAM,WAAW;;;;;;;kBAMN,CAAC;AAEZ,KAAK,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEvD,UAAU,qBAAqB;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qBAMa,eAAgB,YAAW,aAAa,CAAC,mBAAmB,CAAC;IACxE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAE7C,OAAO,CAAC,cAAc,CAAiB;IAGrD,IAAI,EAAE,mBAAmB,CAAC;IAEpB,OAAO,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;CAiCrF"}
|
|
@@ -15,7 +15,7 @@ const common_1 = require("@nestjs/common");
|
|
|
15
15
|
const zod_1 = require("zod");
|
|
16
16
|
const common_2 = require("@loopstack/common");
|
|
17
17
|
const sandbox_tool_1 = require("@loopstack/sandbox-tool");
|
|
18
|
-
const
|
|
18
|
+
const inputSchema = zod_1.z
|
|
19
19
|
.object({
|
|
20
20
|
containerId: zod_1.z.string().describe('The ID of the container to read the file from'),
|
|
21
21
|
path: zod_1.z.string().describe('The path to the file to read'),
|
|
@@ -25,7 +25,8 @@ const propertiesSchema = zod_1.z
|
|
|
25
25
|
let SandboxReadFile = SandboxReadFile_1 = class SandboxReadFile {
|
|
26
26
|
logger = new common_1.Logger(SandboxReadFile_1.name);
|
|
27
27
|
sandboxCommand;
|
|
28
|
-
|
|
28
|
+
args;
|
|
29
|
+
async execute(args) {
|
|
29
30
|
const { containerId, path, encoding } = args;
|
|
30
31
|
this.logger.debug(`Reading file ${path} from container ${containerId} (encoding: ${encoding})`);
|
|
31
32
|
const executable = encoding === 'base64' ? 'base64' : 'cat';
|
|
@@ -58,13 +59,16 @@ __decorate([
|
|
|
58
59
|
(0, common_2.InjectTool)(),
|
|
59
60
|
__metadata("design:type", sandbox_tool_1.SandboxCommand)
|
|
60
61
|
], SandboxReadFile.prototype, "sandboxCommand", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, common_2.Input)({ schema: inputSchema }),
|
|
64
|
+
__metadata("design:type", Object)
|
|
65
|
+
], SandboxReadFile.prototype, "args", void 0);
|
|
61
66
|
exports.SandboxReadFile = SandboxReadFile = SandboxReadFile_1 = __decorate([
|
|
62
67
|
(0, common_1.Injectable)(),
|
|
63
68
|
(0, common_2.Tool)({
|
|
64
69
|
config: {
|
|
65
70
|
description: 'Read file contents from a sandbox container',
|
|
66
71
|
},
|
|
67
|
-
})
|
|
68
|
-
(0, common_2.WithArguments)(propertiesSchema)
|
|
72
|
+
})
|
|
69
73
|
], SandboxReadFile);
|
|
70
74
|
//# sourceMappingURL=sandbox-read-file.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-read-file.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-read-file.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAeA,2CAAoD;AACpD,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"sandbox-read-file.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-read-file.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAeA,2CAAoD;AACpD,6BAAwB;AACxB,8CAAuF;AACvF,0DAAyD;AAEzD,MAAM,WAAW,GAAG,OAAC;KAClB,MAAM,CAAC;IACN,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;IACjF,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IACzD,QAAQ,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,2CAA2C,CAAC;CAC3G,CAAC;KACD,MAAM,EAAE,CAAC;AAeL,IAAM,eAAe,uBAArB,MAAM,eAAe;IACT,MAAM,GAAG,IAAI,eAAM,CAAC,iBAAe,CAAC,IAAI,CAAC,CAAC;IAErC,cAAc,CAAiB;IAGrD,IAAI,CAAsB;IAE1B,KAAK,CAAC,OAAO,CAAC,IAAyB;QACrC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAE7C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,IAAI,mBAAmB,WAAW,eAAe,QAAQ,GAAG,CAAC,CAAC;Q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A,mBAAU,GAAE;IACZ,IAAA,aAAI,EAAC;QACJ,MAAM,EAAE;YACN,WAAW,EAAE,6CAA6C;SAC3D;KACF,CAAC;GACW,eAAe,CAyC3B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ToolInterface, ToolResult
|
|
3
|
-
declare const
|
|
2
|
+
import { ToolInterface, ToolResult } from '@loopstack/common';
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
4
|
containerId: z.ZodString;
|
|
5
5
|
path: z.ZodString;
|
|
6
6
|
content: z.ZodString;
|
|
@@ -10,7 +10,7 @@ declare const propertiesSchema: z.ZodObject<{
|
|
|
10
10
|
}>>;
|
|
11
11
|
createParentDirs: z.ZodDefault<z.ZodBoolean>;
|
|
12
12
|
}, z.core.$strict>;
|
|
13
|
-
type SandboxWriteFileArgs = z.infer<typeof
|
|
13
|
+
type SandboxWriteFileArgs = z.infer<typeof inputSchema>;
|
|
14
14
|
interface SandboxWriteFileResult {
|
|
15
15
|
path: string;
|
|
16
16
|
bytesWritten: number;
|
|
@@ -18,7 +18,8 @@ interface SandboxWriteFileResult {
|
|
|
18
18
|
export declare class SandboxWriteFile implements ToolInterface<SandboxWriteFileArgs> {
|
|
19
19
|
private readonly logger;
|
|
20
20
|
private sandboxCommand;
|
|
21
|
-
|
|
21
|
+
args: SandboxWriteFileArgs;
|
|
22
|
+
execute(args: SandboxWriteFileArgs): Promise<ToolResult<SandboxWriteFileResult>>;
|
|
22
23
|
}
|
|
23
24
|
export {};
|
|
24
25
|
//# sourceMappingURL=sandbox-write-file.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-write-file.tool.d.ts","sourceRoot":"","sources":["../../src/tools/sandbox-write-file.tool.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"sandbox-write-file.tool.d.ts","sourceRoot":"","sources":["../../src/tools/sandbox-write-file.tool.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAA2B,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGvF,QAAA,MAAM,WAAW;;;;;;;;;kBAQN,CAAC;AAEZ,KAAK,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAExD,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,qBAMa,gBAAiB,YAAW,aAAa,CAAC,oBAAoB,CAAC;IAC1E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqC;IAE9C,OAAO,CAAC,cAAc,CAAiB;IAGrD,IAAI,EAAE,oBAAoB,CAAC;IAErB,OAAO,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;CAqEvF"}
|
|
@@ -49,7 +49,7 @@ const path = __importStar(require("path"));
|
|
|
49
49
|
const zod_1 = require("zod");
|
|
50
50
|
const common_2 = require("@loopstack/common");
|
|
51
51
|
const sandbox_tool_1 = require("@loopstack/sandbox-tool");
|
|
52
|
-
const
|
|
52
|
+
const inputSchema = zod_1.z
|
|
53
53
|
.object({
|
|
54
54
|
containerId: zod_1.z.string().describe('The ID of the container to write the file to'),
|
|
55
55
|
path: zod_1.z.string().describe('The path where the file should be written'),
|
|
@@ -61,7 +61,8 @@ const propertiesSchema = zod_1.z
|
|
|
61
61
|
let SandboxWriteFile = SandboxWriteFile_1 = class SandboxWriteFile {
|
|
62
62
|
logger = new common_1.Logger(SandboxWriteFile_1.name);
|
|
63
63
|
sandboxCommand;
|
|
64
|
-
|
|
64
|
+
args;
|
|
65
|
+
async execute(args) {
|
|
65
66
|
const { containerId, path: filePath, content, encoding, createParentDirs } = args;
|
|
66
67
|
this.logger.debug(`Writing file ${filePath} to container ${containerId} (encoding: ${encoding})`);
|
|
67
68
|
if (createParentDirs) {
|
|
@@ -116,13 +117,16 @@ __decorate([
|
|
|
116
117
|
(0, common_2.InjectTool)(),
|
|
117
118
|
__metadata("design:type", sandbox_tool_1.SandboxCommand)
|
|
118
119
|
], SandboxWriteFile.prototype, "sandboxCommand", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
(0, common_2.Input)({ schema: inputSchema }),
|
|
122
|
+
__metadata("design:type", Object)
|
|
123
|
+
], SandboxWriteFile.prototype, "args", void 0);
|
|
119
124
|
exports.SandboxWriteFile = SandboxWriteFile = SandboxWriteFile_1 = __decorate([
|
|
120
125
|
(0, common_1.Injectable)(),
|
|
121
126
|
(0, common_2.Tool)({
|
|
122
127
|
config: {
|
|
123
128
|
description: 'Write content to a file in a sandbox container',
|
|
124
129
|
},
|
|
125
|
-
})
|
|
126
|
-
(0, common_2.WithArguments)(propertiesSchema)
|
|
130
|
+
})
|
|
127
131
|
], SandboxWriteFile);
|
|
128
132
|
//# sourceMappingURL=sandbox-write-file.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-write-file.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-write-file.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,2CAAoD;AACpD,2CAA6B;AAC7B,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"sandbox-write-file.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-write-file.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,2CAAoD;AACpD,2CAA6B;AAC7B,6BAAwB;AACxB,8CAAuF;AACvF,0DAAyD;AAEzD,MAAM,WAAW,GAAG,OAAC;KAClB,MAAM,CAAC;IACN,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAA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|
|
8
8
|
"sandbox"
|
|
9
9
|
],
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.4.0",
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
12
|
"author": {
|
|
13
13
|
"name": "Tobias Blättermann, Jakob Klippel"
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"watch": "nest build --watch"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@loopstack/common": "^0.
|
|
31
|
-
"@loopstack/sandbox-tool": "^0.
|
|
30
|
+
"@loopstack/common": "^0.20.0",
|
|
31
|
+
"@loopstack/sandbox-tool": "^0.4.0",
|
|
32
32
|
"@nestjs/common": "^11.1.12",
|
|
33
33
|
"zod": "^4.3.5"
|
|
34
34
|
},
|
|
@@ -15,10 +15,10 @@ limitations under the License.
|
|
|
15
15
|
*/
|
|
16
16
|
import { Injectable, Logger } from '@nestjs/common';
|
|
17
17
|
import { z } from 'zod';
|
|
18
|
-
import { InjectTool, Tool, ToolInterface, ToolResult
|
|
18
|
+
import { InjectTool, Input, Tool, ToolInterface, ToolResult } from '@loopstack/common';
|
|
19
19
|
import { SandboxCommand } from '@loopstack/sandbox-tool';
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const inputSchema = z
|
|
22
22
|
.object({
|
|
23
23
|
containerId: z.string().describe('The ID of the container to create the directory in'),
|
|
24
24
|
path: z.string().describe('The path of the directory to create'),
|
|
@@ -26,7 +26,7 @@ const propertiesSchema = z
|
|
|
26
26
|
})
|
|
27
27
|
.strict();
|
|
28
28
|
|
|
29
|
-
type SandboxCreateDirectoryArgs = z.infer<typeof
|
|
29
|
+
type SandboxCreateDirectoryArgs = z.infer<typeof inputSchema>;
|
|
30
30
|
|
|
31
31
|
interface SandboxCreateDirectoryResult {
|
|
32
32
|
path: string;
|
|
@@ -39,16 +39,15 @@ interface SandboxCreateDirectoryResult {
|
|
|
39
39
|
description: 'Create a directory in a sandbox container',
|
|
40
40
|
},
|
|
41
41
|
})
|
|
42
|
-
@WithArguments(propertiesSchema)
|
|
43
42
|
export class SandboxCreateDirectory implements ToolInterface<SandboxCreateDirectoryArgs> {
|
|
44
43
|
private readonly logger = new Logger(SandboxCreateDirectory.name);
|
|
45
44
|
|
|
46
45
|
@InjectTool() private sandboxCommand: SandboxCommand;
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
): Promise<ToolResult<SandboxCreateDirectoryResult>> {
|
|
47
|
+
@Input({ schema: inputSchema })
|
|
48
|
+
args: SandboxCreateDirectoryArgs;
|
|
49
|
+
|
|
50
|
+
async execute(args: SandboxCreateDirectoryArgs): Promise<ToolResult<SandboxCreateDirectoryResult>> {
|
|
52
51
|
const { containerId, path: dirPath, recursive } = args;
|
|
53
52
|
|
|
54
53
|
this.logger.debug(`Creating directory ${dirPath} in container ${containerId} (recursive: ${recursive})`);
|
|
@@ -15,10 +15,10 @@ limitations under the License.
|
|
|
15
15
|
*/
|
|
16
16
|
import { Injectable, Logger } from '@nestjs/common';
|
|
17
17
|
import { z } from 'zod';
|
|
18
|
-
import { InjectTool, Tool, ToolInterface, ToolResult
|
|
18
|
+
import { InjectTool, Input, Tool, ToolInterface, ToolResult } from '@loopstack/common';
|
|
19
19
|
import { SandboxCommand } from '@loopstack/sandbox-tool';
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const inputSchema = z
|
|
22
22
|
.object({
|
|
23
23
|
containerId: z.string().describe('The ID of the container to delete the file/directory from'),
|
|
24
24
|
path: z.string().describe('The path to the file or directory to delete'),
|
|
@@ -27,7 +27,7 @@ const propertiesSchema = z
|
|
|
27
27
|
})
|
|
28
28
|
.strict();
|
|
29
29
|
|
|
30
|
-
type SandboxDeleteArgs = z.infer<typeof
|
|
30
|
+
type SandboxDeleteArgs = z.infer<typeof inputSchema>;
|
|
31
31
|
|
|
32
32
|
interface SandboxDeleteResult {
|
|
33
33
|
path: string;
|
|
@@ -40,13 +40,15 @@ interface SandboxDeleteResult {
|
|
|
40
40
|
description: 'Delete a file or directory in a sandbox container',
|
|
41
41
|
},
|
|
42
42
|
})
|
|
43
|
-
@WithArguments(propertiesSchema)
|
|
44
43
|
export class SandboxDelete implements ToolInterface<SandboxDeleteArgs> {
|
|
45
44
|
private readonly logger = new Logger(SandboxDelete.name);
|
|
46
45
|
|
|
47
46
|
@InjectTool() private sandboxCommand: SandboxCommand;
|
|
48
47
|
|
|
49
|
-
|
|
48
|
+
@Input({ schema: inputSchema })
|
|
49
|
+
args: SandboxDeleteArgs;
|
|
50
|
+
|
|
51
|
+
async execute(args: SandboxDeleteArgs): Promise<ToolResult<SandboxDeleteResult>> {
|
|
50
52
|
const { containerId, path: targetPath, recursive, force } = args;
|
|
51
53
|
|
|
52
54
|
this.logger.debug(`Deleting ${targetPath} in container ${containerId} (recursive: ${recursive}, force: ${force})`);
|
|
@@ -15,17 +15,17 @@ limitations under the License.
|
|
|
15
15
|
*/
|
|
16
16
|
import { Injectable, Logger } from '@nestjs/common';
|
|
17
17
|
import { z } from 'zod';
|
|
18
|
-
import { InjectTool, Tool, ToolInterface, ToolResult
|
|
18
|
+
import { InjectTool, Input, Tool, ToolInterface, ToolResult } from '@loopstack/common';
|
|
19
19
|
import { SandboxCommand } from '@loopstack/sandbox-tool';
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const inputSchema = z
|
|
22
22
|
.object({
|
|
23
23
|
containerId: z.string().describe('The ID of the container to check for file existence'),
|
|
24
24
|
path: z.string().describe('The path to check for existence'),
|
|
25
25
|
})
|
|
26
26
|
.strict();
|
|
27
27
|
|
|
28
|
-
type SandboxExistsArgs = z.infer<typeof
|
|
28
|
+
type SandboxExistsArgs = z.infer<typeof inputSchema>;
|
|
29
29
|
|
|
30
30
|
interface SandboxExistsResult {
|
|
31
31
|
path: string;
|
|
@@ -39,14 +39,16 @@ interface SandboxExistsResult {
|
|
|
39
39
|
description: 'Check if a file or directory exists in a sandbox container',
|
|
40
40
|
},
|
|
41
41
|
})
|
|
42
|
-
@WithArguments(propertiesSchema)
|
|
43
42
|
export class SandboxExists implements ToolInterface<SandboxExistsArgs> {
|
|
44
43
|
private readonly logger = new Logger(SandboxExists.name);
|
|
45
44
|
|
|
46
45
|
@InjectTool()
|
|
47
46
|
private sandboxCommand: SandboxCommand;
|
|
48
47
|
|
|
49
|
-
|
|
48
|
+
@Input({ schema: inputSchema })
|
|
49
|
+
args: SandboxExistsArgs;
|
|
50
|
+
|
|
51
|
+
async execute(args: SandboxExistsArgs): Promise<ToolResult<SandboxExistsResult>> {
|
|
50
52
|
const { containerId, path: targetPath } = args;
|
|
51
53
|
|
|
52
54
|
this.logger.debug(`Checking existence of ${targetPath} in container ${containerId}`);
|
|
@@ -15,17 +15,17 @@ limitations under the License.
|
|
|
15
15
|
*/
|
|
16
16
|
import { Injectable, Logger } from '@nestjs/common';
|
|
17
17
|
import { z } from 'zod';
|
|
18
|
-
import { InjectTool, Tool, ToolInterface, ToolResult
|
|
18
|
+
import { InjectTool, Input, Tool, ToolInterface, ToolResult } from '@loopstack/common';
|
|
19
19
|
import { SandboxCommand } from '@loopstack/sandbox-tool';
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const inputSchema = z
|
|
22
22
|
.object({
|
|
23
23
|
containerId: z.string().describe('The ID of the container to get file info from'),
|
|
24
24
|
path: z.string().describe('The path to the file or directory'),
|
|
25
25
|
})
|
|
26
26
|
.strict();
|
|
27
27
|
|
|
28
|
-
type SandboxFileInfoArgs = z.infer<typeof
|
|
28
|
+
type SandboxFileInfoArgs = z.infer<typeof inputSchema>;
|
|
29
29
|
|
|
30
30
|
interface SandboxFileInfoResult {
|
|
31
31
|
path: string;
|
|
@@ -46,13 +46,15 @@ interface SandboxFileInfoResult {
|
|
|
46
46
|
description: 'Get detailed information about a file or directory in a sandbox container',
|
|
47
47
|
},
|
|
48
48
|
})
|
|
49
|
-
@WithArguments(propertiesSchema)
|
|
50
49
|
export class SandboxFileInfo implements ToolInterface<SandboxFileInfoArgs> {
|
|
51
50
|
private readonly logger = new Logger(SandboxFileInfo.name);
|
|
52
51
|
|
|
53
52
|
@InjectTool() private sandboxCommand: SandboxCommand;
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
@Input({ schema: inputSchema })
|
|
55
|
+
args: SandboxFileInfoArgs;
|
|
56
|
+
|
|
57
|
+
async execute(args: SandboxFileInfoArgs): Promise<ToolResult<SandboxFileInfoResult>> {
|
|
56
58
|
const { containerId, path: targetPath } = args;
|
|
57
59
|
|
|
58
60
|
this.logger.debug(`Getting file info for ${targetPath} in container ${containerId}`);
|
|
@@ -15,10 +15,10 @@ limitations under the License.
|
|
|
15
15
|
*/
|
|
16
16
|
import { Injectable, Logger } from '@nestjs/common';
|
|
17
17
|
import { z } from 'zod';
|
|
18
|
-
import { InjectTool, Tool, ToolInterface, ToolResult
|
|
18
|
+
import { InjectTool, Input, Tool, ToolInterface, ToolResult } from '@loopstack/common';
|
|
19
19
|
import { SandboxCommand } from '@loopstack/sandbox-tool';
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const inputSchema = z
|
|
22
22
|
.object({
|
|
23
23
|
containerId: z.string().describe('The ID of the container to list the directory from'),
|
|
24
24
|
path: z.string().describe('The path to the directory to list'),
|
|
@@ -26,7 +26,7 @@ const propertiesSchema = z
|
|
|
26
26
|
})
|
|
27
27
|
.strict();
|
|
28
28
|
|
|
29
|
-
type SandboxListDirectoryArgs = z.infer<typeof
|
|
29
|
+
type SandboxListDirectoryArgs = z.infer<typeof inputSchema>;
|
|
30
30
|
|
|
31
31
|
interface FileEntry {
|
|
32
32
|
name: string;
|
|
@@ -46,16 +46,15 @@ interface SandboxListDirectoryResult {
|
|
|
46
46
|
description: 'List files and directories in a sandbox container',
|
|
47
47
|
},
|
|
48
48
|
})
|
|
49
|
-
@WithArguments(propertiesSchema)
|
|
50
49
|
export class SandboxListDirectory implements ToolInterface<SandboxListDirectoryArgs> {
|
|
51
50
|
private readonly logger = new Logger(SandboxListDirectory.name);
|
|
52
51
|
|
|
53
52
|
@InjectTool() private sandboxCommand: SandboxCommand;
|
|
54
53
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
): Promise<ToolResult<SandboxListDirectoryResult>> {
|
|
54
|
+
@Input({ schema: inputSchema })
|
|
55
|
+
args: SandboxListDirectoryArgs;
|
|
56
|
+
|
|
57
|
+
async execute(args: SandboxListDirectoryArgs): Promise<ToolResult<SandboxListDirectoryResult>> {
|
|
59
58
|
const { containerId, path: dirPath, recursive } = args;
|
|
60
59
|
|
|
61
60
|
this.logger.debug(`Listing directory ${dirPath} in container ${containerId} (recursive: ${recursive})`);
|
|
@@ -15,10 +15,10 @@ limitations under the License.
|
|
|
15
15
|
*/
|
|
16
16
|
import { Injectable, Logger } from '@nestjs/common';
|
|
17
17
|
import { z } from 'zod';
|
|
18
|
-
import { InjectTool, Tool, ToolInterface, ToolResult
|
|
18
|
+
import { InjectTool, Input, Tool, ToolInterface, ToolResult } from '@loopstack/common';
|
|
19
19
|
import { SandboxCommand } from '@loopstack/sandbox-tool';
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const inputSchema = z
|
|
22
22
|
.object({
|
|
23
23
|
containerId: z.string().describe('The ID of the container to read the file from'),
|
|
24
24
|
path: z.string().describe('The path to the file to read'),
|
|
@@ -26,7 +26,7 @@ const propertiesSchema = z
|
|
|
26
26
|
})
|
|
27
27
|
.strict();
|
|
28
28
|
|
|
29
|
-
type SandboxReadFileArgs = z.infer<typeof
|
|
29
|
+
type SandboxReadFileArgs = z.infer<typeof inputSchema>;
|
|
30
30
|
|
|
31
31
|
interface SandboxReadFileResult {
|
|
32
32
|
content: string;
|
|
@@ -39,13 +39,15 @@ interface SandboxReadFileResult {
|
|
|
39
39
|
description: 'Read file contents from a sandbox container',
|
|
40
40
|
},
|
|
41
41
|
})
|
|
42
|
-
@WithArguments(propertiesSchema)
|
|
43
42
|
export class SandboxReadFile implements ToolInterface<SandboxReadFileArgs> {
|
|
44
43
|
private readonly logger = new Logger(SandboxReadFile.name);
|
|
45
44
|
|
|
46
45
|
@InjectTool() private sandboxCommand: SandboxCommand;
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
@Input({ schema: inputSchema })
|
|
48
|
+
args: SandboxReadFileArgs;
|
|
49
|
+
|
|
50
|
+
async execute(args: SandboxReadFileArgs): Promise<ToolResult<SandboxReadFileResult>> {
|
|
49
51
|
const { containerId, path, encoding } = args;
|
|
50
52
|
|
|
51
53
|
this.logger.debug(`Reading file ${path} from container ${containerId} (encoding: ${encoding})`);
|
|
@@ -16,10 +16,10 @@ limitations under the License.
|
|
|
16
16
|
import { Injectable, Logger } from '@nestjs/common';
|
|
17
17
|
import * as path from 'path';
|
|
18
18
|
import { z } from 'zod';
|
|
19
|
-
import { InjectTool, Tool, ToolInterface, ToolResult
|
|
19
|
+
import { InjectTool, Input, Tool, ToolInterface, ToolResult } from '@loopstack/common';
|
|
20
20
|
import { SandboxCommand } from '@loopstack/sandbox-tool';
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const inputSchema = z
|
|
23
23
|
.object({
|
|
24
24
|
containerId: z.string().describe('The ID of the container to write the file to'),
|
|
25
25
|
path: z.string().describe('The path where the file should be written'),
|
|
@@ -29,7 +29,7 @@ const propertiesSchema = z
|
|
|
29
29
|
})
|
|
30
30
|
.strict();
|
|
31
31
|
|
|
32
|
-
type SandboxWriteFileArgs = z.infer<typeof
|
|
32
|
+
type SandboxWriteFileArgs = z.infer<typeof inputSchema>;
|
|
33
33
|
|
|
34
34
|
interface SandboxWriteFileResult {
|
|
35
35
|
path: string;
|
|
@@ -42,13 +42,15 @@ interface SandboxWriteFileResult {
|
|
|
42
42
|
description: 'Write content to a file in a sandbox container',
|
|
43
43
|
},
|
|
44
44
|
})
|
|
45
|
-
@WithArguments(propertiesSchema)
|
|
46
45
|
export class SandboxWriteFile implements ToolInterface<SandboxWriteFileArgs> {
|
|
47
46
|
private readonly logger = new Logger(SandboxWriteFile.name);
|
|
48
47
|
|
|
49
48
|
@InjectTool() private sandboxCommand: SandboxCommand;
|
|
50
49
|
|
|
51
|
-
|
|
50
|
+
@Input({ schema: inputSchema })
|
|
51
|
+
args: SandboxWriteFileArgs;
|
|
52
|
+
|
|
53
|
+
async execute(args: SandboxWriteFileArgs): Promise<ToolResult<SandboxWriteFileResult>> {
|
|
52
54
|
const { containerId, path: filePath, content, encoding, createParentDirs } = args;
|
|
53
55
|
|
|
54
56
|
this.logger.debug(`Writing file ${filePath} to container ${containerId} (encoding: ${encoding})`);
|