@loopstack/sandbox-filesystem 0.4.6 → 0.5.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/README.md +2 -2
- package/dist/tools/sandbox-create-directory.tool.d.ts +3 -4
- package/dist/tools/sandbox-create-directory.tool.d.ts.map +1 -1
- package/dist/tools/sandbox-create-directory.tool.js +5 -9
- package/dist/tools/sandbox-create-directory.tool.js.map +1 -1
- package/dist/tools/sandbox-delete.tool.d.ts +3 -4
- package/dist/tools/sandbox-delete.tool.d.ts.map +1 -1
- package/dist/tools/sandbox-delete.tool.js +5 -9
- package/dist/tools/sandbox-delete.tool.js.map +1 -1
- package/dist/tools/sandbox-exists.tool.d.ts +3 -4
- package/dist/tools/sandbox-exists.tool.d.ts.map +1 -1
- package/dist/tools/sandbox-exists.tool.js +5 -9
- package/dist/tools/sandbox-exists.tool.js.map +1 -1
- package/dist/tools/sandbox-file-info.tool.d.ts +3 -4
- package/dist/tools/sandbox-file-info.tool.d.ts.map +1 -1
- package/dist/tools/sandbox-file-info.tool.js +5 -9
- package/dist/tools/sandbox-file-info.tool.js.map +1 -1
- package/dist/tools/sandbox-list-directory.tool.d.ts +3 -4
- package/dist/tools/sandbox-list-directory.tool.d.ts.map +1 -1
- package/dist/tools/sandbox-list-directory.tool.js +5 -9
- package/dist/tools/sandbox-list-directory.tool.js.map +1 -1
- package/dist/tools/sandbox-read-file.tool.d.ts +3 -4
- package/dist/tools/sandbox-read-file.tool.d.ts.map +1 -1
- package/dist/tools/sandbox-read-file.tool.js +5 -9
- package/dist/tools/sandbox-read-file.tool.js.map +1 -1
- package/dist/tools/sandbox-write-file.tool.d.ts +3 -4
- package/dist/tools/sandbox-write-file.tool.d.ts.map +1 -1
- package/dist/tools/sandbox-write-file.tool.js +6 -10
- package/dist/tools/sandbox-write-file.tool.js.map +1 -1
- package/package.json +3 -3
- package/src/tools/sandbox-create-directory.tool.ts +6 -8
- package/src/tools/sandbox-delete.tool.ts +6 -8
- package/src/tools/sandbox-exists.tool.ts +6 -8
- package/src/tools/sandbox-file-info.tool.ts +6 -8
- package/src/tools/sandbox-list-directory.tool.ts +6 -8
- package/src/tools/sandbox-read-file.tool.ts +6 -8
- package/src/tools/sandbox-write-file.tool.ts +7 -9
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
import { SandboxDestroy, SandboxInit } from '@loopstack/sandbox-tool';
|
|
48
48
|
|
|
49
49
|
@Workflow({
|
|
50
|
-
|
|
50
|
+
uiConfig: __dirname + '/my.ui.yaml',
|
|
51
51
|
})
|
|
52
52
|
export class MyWorkflow {
|
|
53
53
|
@Input({
|
|
@@ -84,7 +84,7 @@ export class MyWorkflow {
|
|
|
84
84
|
And use them in your YAML workflow configuration:
|
|
85
85
|
|
|
86
86
|
```yaml
|
|
87
|
-
# src/my.
|
|
87
|
+
# src/my.ui.yaml
|
|
88
88
|
transitions:
|
|
89
89
|
# Initialize the sandbox container (required before filesystem operations)
|
|
90
90
|
- id: init_sandbox
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseTool, ToolResult } from '@loopstack/common';
|
|
3
3
|
declare const inputSchema: z.ZodObject<{
|
|
4
4
|
containerId: z.ZodString;
|
|
5
5
|
path: z.ZodString;
|
|
@@ -10,11 +10,10 @@ interface SandboxCreateDirectoryResult {
|
|
|
10
10
|
path: string;
|
|
11
11
|
created: boolean;
|
|
12
12
|
}
|
|
13
|
-
export declare class SandboxCreateDirectory
|
|
13
|
+
export declare class SandboxCreateDirectory extends BaseTool {
|
|
14
14
|
private readonly logger;
|
|
15
15
|
private sandboxCommand;
|
|
16
|
-
args: SandboxCreateDirectoryArgs
|
|
17
|
-
execute(args: SandboxCreateDirectoryArgs): Promise<ToolResult<SandboxCreateDirectoryResult>>;
|
|
16
|
+
call(args: SandboxCreateDirectoryArgs): Promise<ToolResult<SandboxCreateDirectoryResult>>;
|
|
18
17
|
}
|
|
19
18
|
export {};
|
|
20
19
|
//# 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,EAAE,QAAQ,EAAoB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG3E,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,SAAQ,QAAQ;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2C;IAEpD,OAAO,CAAC,cAAc,CAAiB;IAE/C,IAAI,CAAC,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,UAAU,CAAC,4BAA4B,CAAC,CAAC;CAyChG"}
|
|
@@ -22,15 +22,14 @@ const inputSchema = zod_1.z
|
|
|
22
22
|
recursive: zod_1.z.boolean().default(true).describe("Whether to create parent directories if they don't exist"),
|
|
23
23
|
})
|
|
24
24
|
.strict();
|
|
25
|
-
let SandboxCreateDirectory = SandboxCreateDirectory_1 = class SandboxCreateDirectory {
|
|
25
|
+
let SandboxCreateDirectory = SandboxCreateDirectory_1 = class SandboxCreateDirectory extends common_2.BaseTool {
|
|
26
26
|
logger = new common_1.Logger(SandboxCreateDirectory_1.name);
|
|
27
27
|
sandboxCommand;
|
|
28
|
-
args
|
|
29
|
-
async execute(args) {
|
|
28
|
+
async call(args) {
|
|
30
29
|
const { containerId, path: dirPath, recursive } = args;
|
|
31
30
|
this.logger.debug(`Creating directory ${dirPath} in container ${containerId} (recursive: ${recursive})`);
|
|
32
31
|
const mkdirArgs = recursive ? ['-p', dirPath] : [dirPath];
|
|
33
|
-
const result = await this.sandboxCommand.
|
|
32
|
+
const result = await this.sandboxCommand.call({
|
|
34
33
|
containerId,
|
|
35
34
|
executable: 'mkdir',
|
|
36
35
|
args: mkdirArgs,
|
|
@@ -65,15 +64,12 @@ __decorate([
|
|
|
65
64
|
(0, common_2.InjectTool)(),
|
|
66
65
|
__metadata("design:type", sandbox_tool_1.SandboxCommand)
|
|
67
66
|
], 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);
|
|
72
67
|
exports.SandboxCreateDirectory = SandboxCreateDirectory = SandboxCreateDirectory_1 = __decorate([
|
|
73
68
|
(0, common_2.Tool)({
|
|
74
|
-
|
|
69
|
+
uiConfig: {
|
|
75
70
|
description: 'Create a directory in a sandbox container',
|
|
76
71
|
},
|
|
72
|
+
schema: inputSchema,
|
|
77
73
|
})
|
|
78
74
|
], SandboxCreateDirectory);
|
|
79
75
|
//# 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,2CAAwC;AACxC,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"sandbox-create-directory.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-create-directory.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAeA,2CA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stack/common';
|
|
3
3
|
declare const inputSchema: z.ZodObject<{
|
|
4
4
|
containerId: z.ZodString;
|
|
5
5
|
path: z.ZodString;
|
|
@@ -11,11 +11,10 @@ interface SandboxDeleteResult {
|
|
|
11
11
|
path: string;
|
|
12
12
|
deleted: boolean;
|
|
13
13
|
}
|
|
14
|
-
export declare class SandboxDelete
|
|
14
|
+
export declare class SandboxDelete extends BaseTool {
|
|
15
15
|
private readonly logger;
|
|
16
16
|
private sandboxCommand;
|
|
17
|
-
args: SandboxDeleteArgs
|
|
18
|
-
execute(args: SandboxDeleteArgs): Promise<ToolResult<SandboxDeleteResult>>;
|
|
17
|
+
call(args: SandboxDeleteArgs): Promise<ToolResult<SandboxDeleteResult>>;
|
|
19
18
|
}
|
|
20
19
|
export {};
|
|
21
20
|
//# 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,EAAE,QAAQ,EAAoB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG3E,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,SAAQ,QAAQ;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;IAE3C,OAAO,CAAC,cAAc,CAAiB;IAE/C,IAAI,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;CAqC9E"}
|
|
@@ -23,11 +23,10 @@ const inputSchema = zod_1.z
|
|
|
23
23
|
force: zod_1.z.boolean().default(false).describe('Whether to force deletion without prompting for confirmation'),
|
|
24
24
|
})
|
|
25
25
|
.strict();
|
|
26
|
-
let SandboxDelete = SandboxDelete_1 = class SandboxDelete {
|
|
26
|
+
let SandboxDelete = SandboxDelete_1 = class SandboxDelete extends common_2.BaseTool {
|
|
27
27
|
logger = new common_1.Logger(SandboxDelete_1.name);
|
|
28
28
|
sandboxCommand;
|
|
29
|
-
args
|
|
30
|
-
async execute(args) {
|
|
29
|
+
async call(args) {
|
|
31
30
|
const { containerId, path: targetPath, recursive, force } = args;
|
|
32
31
|
this.logger.debug(`Deleting ${targetPath} in container ${containerId} (recursive: ${recursive}, force: ${force})`);
|
|
33
32
|
const rmArgs = [];
|
|
@@ -36,7 +35,7 @@ let SandboxDelete = SandboxDelete_1 = class SandboxDelete {
|
|
|
36
35
|
if (force)
|
|
37
36
|
rmArgs.push('-f');
|
|
38
37
|
rmArgs.push(targetPath);
|
|
39
|
-
const result = await this.sandboxCommand.
|
|
38
|
+
const result = await this.sandboxCommand.call({
|
|
40
39
|
containerId,
|
|
41
40
|
executable: 'rm',
|
|
42
41
|
args: rmArgs,
|
|
@@ -65,15 +64,12 @@ __decorate([
|
|
|
65
64
|
(0, common_2.InjectTool)(),
|
|
66
65
|
__metadata("design:type", sandbox_tool_1.SandboxCommand)
|
|
67
66
|
], 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);
|
|
72
67
|
exports.SandboxDelete = SandboxDelete = SandboxDelete_1 = __decorate([
|
|
73
68
|
(0, common_2.Tool)({
|
|
74
|
-
|
|
69
|
+
uiConfig: {
|
|
75
70
|
description: 'Delete a file or directory in a sandbox container',
|
|
76
71
|
},
|
|
72
|
+
schema: inputSchema,
|
|
77
73
|
})
|
|
78
74
|
], SandboxDelete);
|
|
79
75
|
//# 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,2CAAwC;AACxC,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"sandbox-delete.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-delete.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAeA,2CAAwC;AACxC,6BAAwB;AACxB,8CAA2E;AAC3E,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,aAAc,SAAQ,iBAAQ;IACxB,MAAM,GAAG,IAAI,eAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAC;IAEnC,cAAc,CAAiB;IAErD,KAAK,CAAC,IAAI,CAAC,IAAuB;QAChC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAA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;aACd;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA1CY,sCAAa;AAGF;IAArB,IAAA,mBAAU,GAAE;8BAAyB,6BAAc;qDAAC;wBAH1C,aAAa;IANzB,IAAA,aAAI,EAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EAAE,mDAAmD;SACjE;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,aAAa,CA0CzB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseTool, ToolResult } from '@loopstack/common';
|
|
3
3
|
declare const inputSchema: z.ZodObject<{
|
|
4
4
|
containerId: z.ZodString;
|
|
5
5
|
path: z.ZodString;
|
|
@@ -10,11 +10,10 @@ interface SandboxExistsResult {
|
|
|
10
10
|
exists: boolean;
|
|
11
11
|
type: 'file' | 'directory' | 'symlink' | 'other' | null;
|
|
12
12
|
}
|
|
13
|
-
export declare class SandboxExists
|
|
13
|
+
export declare class SandboxExists extends BaseTool {
|
|
14
14
|
private readonly logger;
|
|
15
15
|
private sandboxCommand;
|
|
16
|
-
args: SandboxExistsArgs
|
|
17
|
-
execute(args: SandboxExistsArgs): Promise<ToolResult<SandboxExistsResult>>;
|
|
16
|
+
call(args: SandboxExistsArgs): Promise<ToolResult<SandboxExistsResult>>;
|
|
18
17
|
private parseFileType;
|
|
19
18
|
}
|
|
20
19
|
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,EAAE,QAAQ,EAAoB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG3E,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,SAAQ,QAAQ;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;IAGzD,OAAO,CAAC,cAAc,CAAiB;IAEjC,IAAI,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;IA8C7E,OAAO,CAAC,aAAa;CAOtB"}
|
|
@@ -21,14 +21,13 @@ const inputSchema = zod_1.z
|
|
|
21
21
|
path: zod_1.z.string().describe('The path to check for existence'),
|
|
22
22
|
})
|
|
23
23
|
.strict();
|
|
24
|
-
let SandboxExists = SandboxExists_1 = class SandboxExists {
|
|
24
|
+
let SandboxExists = SandboxExists_1 = class SandboxExists extends common_2.BaseTool {
|
|
25
25
|
logger = new common_1.Logger(SandboxExists_1.name);
|
|
26
26
|
sandboxCommand;
|
|
27
|
-
args
|
|
28
|
-
async execute(args) {
|
|
27
|
+
async call(args) {
|
|
29
28
|
const { containerId, path: targetPath } = args;
|
|
30
29
|
this.logger.debug(`Checking existence of ${targetPath} in container ${containerId}`);
|
|
31
|
-
const result = await this.sandboxCommand.
|
|
30
|
+
const result = await this.sandboxCommand.call({
|
|
32
31
|
containerId,
|
|
33
32
|
executable: 'sh',
|
|
34
33
|
args: [
|
|
@@ -77,15 +76,12 @@ __decorate([
|
|
|
77
76
|
(0, common_2.InjectTool)(),
|
|
78
77
|
__metadata("design:type", sandbox_tool_1.SandboxCommand)
|
|
79
78
|
], 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);
|
|
84
79
|
exports.SandboxExists = SandboxExists = SandboxExists_1 = __decorate([
|
|
85
80
|
(0, common_2.Tool)({
|
|
86
|
-
|
|
81
|
+
uiConfig: {
|
|
87
82
|
description: 'Check if a file or directory exists in a sandbox container',
|
|
88
83
|
},
|
|
84
|
+
schema: inputSchema,
|
|
89
85
|
})
|
|
90
86
|
], SandboxExists);
|
|
91
87
|
//# 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,2CAAwC;AACxC,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"sandbox-exists.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-exists.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAeA,2CAAwC;AACxC,6BAAwB;AACxB,8CAA2E;AAC3E,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,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;CAC7D,CAAC;KACD,MAAM,EAAE,CAAC;AAgBL,IAAM,aAAa,qBAAnB,MAAM,aAAc,SAAQ,iBAAQ;IACxB,MAAM,GAAG,IAAI,eAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAC;IAGjD,cAAc,CAAiB;IAEvC,KAAK,CAAC,IAAI,CAAC,IAAuB;QAChC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IA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,MAAM,CAAC,KAAK,CAAC,QAAQ,UAAU,YAAY,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAE5F,OAAO;YACL,IAAI,EAAE;gBACJ,IAAI,EAAE,UAAU;gBAChB,MAAM;gBACN,IAAI;aACL;SACF,CAAC;IACJ,CAAC;IAEO,aAAa,CAAC,UAAkB;QACtC,MAAM,KAAK,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;QACvC,IAAI,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC;YAAE,OAAO,MAAM,CAAC;QAC7C,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC;YAAE,OAAO,WAAW,CAAC;QACpD,IAAI,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC;YAAE,OAAO,SAAS,CAAC;QACtD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAA;AA3DY,sCAAa;AAIhB;IADP,IAAA,mBAAU,GAAE;8BACW,6BAAc;qDAAC;wBAJ5B,aAAa;IANzB,IAAA,aAAI,EAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EAAE,4DAA4D;SAC1E;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,aAAa,CA2DzB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseTool, ToolResult } from '@loopstack/common';
|
|
3
3
|
declare const inputSchema: z.ZodObject<{
|
|
4
4
|
containerId: z.ZodString;
|
|
5
5
|
path: z.ZodString;
|
|
@@ -17,11 +17,10 @@ interface SandboxFileInfoResult {
|
|
|
17
17
|
accessedAt: string;
|
|
18
18
|
createdAt: string;
|
|
19
19
|
}
|
|
20
|
-
export declare class SandboxFileInfo
|
|
20
|
+
export declare class SandboxFileInfo extends BaseTool {
|
|
21
21
|
private readonly logger;
|
|
22
22
|
private sandboxCommand;
|
|
23
|
-
args: SandboxFileInfoArgs
|
|
24
|
-
execute(args: SandboxFileInfoArgs): Promise<ToolResult<SandboxFileInfoResult>>;
|
|
23
|
+
call(args: SandboxFileInfoArgs): Promise<ToolResult<SandboxFileInfoResult>>;
|
|
25
24
|
private parseFileType;
|
|
26
25
|
}
|
|
27
26
|
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,EAAE,QAAQ,EAAoB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG3E,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,SAAQ,QAAQ;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAE7C,OAAO,CAAC,cAAc,CAAiB;IAE/C,IAAI,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAwDjF,OAAO,CAAC,aAAa;CAOtB"}
|
|
@@ -21,14 +21,13 @@ const inputSchema = zod_1.z
|
|
|
21
21
|
path: zod_1.z.string().describe('The path to the file or directory'),
|
|
22
22
|
})
|
|
23
23
|
.strict();
|
|
24
|
-
let SandboxFileInfo = SandboxFileInfo_1 = class SandboxFileInfo {
|
|
24
|
+
let SandboxFileInfo = SandboxFileInfo_1 = class SandboxFileInfo extends common_2.BaseTool {
|
|
25
25
|
logger = new common_1.Logger(SandboxFileInfo_1.name);
|
|
26
26
|
sandboxCommand;
|
|
27
|
-
args
|
|
28
|
-
async execute(args) {
|
|
27
|
+
async call(args) {
|
|
29
28
|
const { containerId, path: targetPath } = args;
|
|
30
29
|
this.logger.debug(`Getting file info for ${targetPath} in container ${containerId}`);
|
|
31
|
-
const result = await this.sandboxCommand.
|
|
30
|
+
const result = await this.sandboxCommand.call({
|
|
32
31
|
containerId,
|
|
33
32
|
executable: 'stat',
|
|
34
33
|
args: ['-c', '%F|%s|%A|%U|%G|%y|%x|%w', targetPath],
|
|
@@ -84,15 +83,12 @@ __decorate([
|
|
|
84
83
|
(0, common_2.InjectTool)(),
|
|
85
84
|
__metadata("design:type", sandbox_tool_1.SandboxCommand)
|
|
86
85
|
], 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);
|
|
91
86
|
exports.SandboxFileInfo = SandboxFileInfo = SandboxFileInfo_1 = __decorate([
|
|
92
87
|
(0, common_2.Tool)({
|
|
93
|
-
|
|
88
|
+
uiConfig: {
|
|
94
89
|
description: 'Get detailed information about a file or directory in a sandbox container',
|
|
95
90
|
},
|
|
91
|
+
schema: inputSchema,
|
|
96
92
|
})
|
|
97
93
|
], SandboxFileInfo);
|
|
98
94
|
//# 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,2CAAwC;AACxC,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"sandbox-file-info.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-file-info.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAeA,2CAAwC;AACxC,6BAAwB;AACxB,8CAA2E;AAC3E,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;AAuBL,IAAM,eAAe,uBAArB,MAAM,eAAgB,SAAQ,iBAAQ;IAC1B,MAAM,GAAG,IAAI,eAAM,CAAC,iBAAe,CAAC,IAAI,CAAC,CAAC;IAErC,cAAc,CAAiB;IAErD,KAAK,CAAC,IAAI,CAAC,IAAyB;QAClC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QAE/C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAyB,UAAU,iBAAiB,WAAW,EAAE,CAAC,CAAC;QAIrF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC;YAC5C,WAAW;YACX,UAAU,EAAE,MAAM;YAClB,IAAI,EAAE,CAAC,IAAI,EAAE,yBAAyB,EAAE,UAAU,CAAC;YACnD,gBAAgB,EAAE,GAAG;YACrB,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,C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O;YACL,IAAI,EAAE;gBACJ,IAAI,EAAE,UAAU;gBAChB,IAAI;gBACJ,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;gBAC3B,WAAW;gBACX,KAAK;gBACL,KAAK;gBACL,UAAU,EAAE,KAAK;gBACjB,UAAU,EAAE,KAAK;gBACjB,SAAS,EAAE,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK;aACzC;SACF,CAAC;IACJ,CAAC;IAEO,aAAa,CAAC,OAAe;QACnC,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;QACpC,IAAI,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC;YAAE,OAAO,MAAM,CAAC;QAC7C,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC;YAAE,OAAO,WAAW,CAAC;QACpD,IAAI,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC;YAAE,OAAO,SAAS,CAAC;QACtD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAA;AApEY,0CAAe;AAGJ;IAArB,IAAA,mBAAU,GAAE;8BAAyB,6BAAc;uDAAC;0BAH1C,eAAe;IAN3B,IAAA,aAAI,EAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EAAE,2EAA2E;SACzF;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,eAAe,CAoE3B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseTool, ToolResult } from '@loopstack/common';
|
|
3
3
|
declare const inputSchema: z.ZodObject<{
|
|
4
4
|
containerId: z.ZodString;
|
|
5
5
|
path: z.ZodString;
|
|
@@ -16,11 +16,10 @@ interface SandboxListDirectoryResult {
|
|
|
16
16
|
path: string;
|
|
17
17
|
entries: FileEntry[];
|
|
18
18
|
}
|
|
19
|
-
export declare class SandboxListDirectory
|
|
19
|
+
export declare class SandboxListDirectory extends BaseTool {
|
|
20
20
|
private readonly logger;
|
|
21
21
|
private sandboxCommand;
|
|
22
|
-
args: SandboxListDirectoryArgs
|
|
23
|
-
execute(args: SandboxListDirectoryArgs): Promise<ToolResult<SandboxListDirectoryResult>>;
|
|
22
|
+
call(args: SandboxListDirectoryArgs): Promise<ToolResult<SandboxListDirectoryResult>>;
|
|
24
23
|
private parseFileType;
|
|
25
24
|
}
|
|
26
25
|
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,EAAE,QAAQ,EAAoB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG3E,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,SAAQ,QAAQ;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyC;IAElD,OAAO,CAAC,cAAc,CAAiB;IAE/C,IAAI,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC;IA4D3F,OAAO,CAAC,aAAa;CAYtB"}
|
|
@@ -22,17 +22,16 @@ const inputSchema = zod_1.z
|
|
|
22
22
|
recursive: zod_1.z.boolean().default(false).describe('Whether to list directories recursively'),
|
|
23
23
|
})
|
|
24
24
|
.strict();
|
|
25
|
-
let SandboxListDirectory = SandboxListDirectory_1 = class SandboxListDirectory {
|
|
25
|
+
let SandboxListDirectory = SandboxListDirectory_1 = class SandboxListDirectory extends common_2.BaseTool {
|
|
26
26
|
logger = new common_1.Logger(SandboxListDirectory_1.name);
|
|
27
27
|
sandboxCommand;
|
|
28
|
-
args
|
|
29
|
-
async execute(args) {
|
|
28
|
+
async call(args) {
|
|
30
29
|
const { containerId, path: dirPath, recursive } = args;
|
|
31
30
|
this.logger.debug(`Listing directory ${dirPath} in container ${containerId} (recursive: ${recursive})`);
|
|
32
31
|
const command = recursive
|
|
33
32
|
? `find '${dirPath.replace(/'/g, "'\\''")}' -printf '%y %s %p\\n'`
|
|
34
33
|
: `find '${dirPath.replace(/'/g, "'\\''")}' -maxdepth 1 -printf '%y %s %p\\n'`;
|
|
35
|
-
const result = await this.sandboxCommand.
|
|
34
|
+
const result = await this.sandboxCommand.call({
|
|
36
35
|
containerId,
|
|
37
36
|
executable: 'sh',
|
|
38
37
|
args: ['-c', command],
|
|
@@ -90,15 +89,12 @@ __decorate([
|
|
|
90
89
|
(0, common_2.InjectTool)(),
|
|
91
90
|
__metadata("design:type", sandbox_tool_1.SandboxCommand)
|
|
92
91
|
], 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);
|
|
97
92
|
exports.SandboxListDirectory = SandboxListDirectory = SandboxListDirectory_1 = __decorate([
|
|
98
93
|
(0, common_2.Tool)({
|
|
99
|
-
|
|
94
|
+
uiConfig: {
|
|
100
95
|
description: 'List files and directories in a sandbox container',
|
|
101
96
|
},
|
|
97
|
+
schema: inputSchema,
|
|
102
98
|
})
|
|
103
99
|
], SandboxListDirectory);
|
|
104
100
|
//# 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,2CAAwC;AACxC,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"sandbox-list-directory.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-list-directory.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAeA,2CAAwC;AACxC,6BAAwB;AACxB,8CAA2E;AAC3E,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,mCAAmC,CAAC;IAC9D,SAAS,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,yCAAyC,CAAC;CAC1F,CAAC;KACD,MAAM,EAAE,CAAC;AAsBL,IAAM,oBAAoB,4BAA1B,MAAM,oBAAqB,SAAQ,iBAAQ;IAC/B,MAAM,GAAG,IAAI,eAAM,CAAC,sBAAoB,CAAC,IAAI,CAAC,CAAC;IAE1C,cAAc,CAAiB;IAErD,KAAK,CAAC,IAAI,CAAC,IAA8B;QACvC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;QAEvD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,OAAO,iBAAiB,WAAW,gBAAg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z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseTool, ToolResult } from '@loopstack/common';
|
|
3
3
|
declare const inputSchema: z.ZodObject<{
|
|
4
4
|
containerId: z.ZodString;
|
|
5
5
|
path: z.ZodString;
|
|
@@ -13,11 +13,10 @@ interface SandboxReadFileResult {
|
|
|
13
13
|
content: string;
|
|
14
14
|
encoding: string;
|
|
15
15
|
}
|
|
16
|
-
export declare class SandboxReadFile
|
|
16
|
+
export declare class SandboxReadFile extends BaseTool {
|
|
17
17
|
private readonly logger;
|
|
18
18
|
private sandboxCommand;
|
|
19
|
-
args: SandboxReadFileArgs
|
|
20
|
-
execute(args: SandboxReadFileArgs): Promise<ToolResult<SandboxReadFileResult>>;
|
|
19
|
+
call(args: SandboxReadFileArgs): Promise<ToolResult<SandboxReadFileResult>>;
|
|
21
20
|
}
|
|
22
21
|
export {};
|
|
23
22
|
//# 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,EAAE,QAAQ,EAAoB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG3E,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,SAAQ,QAAQ;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAE7C,OAAO,CAAC,cAAc,CAAiB;IAE/C,IAAI,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;CAiClF"}
|
|
@@ -22,15 +22,14 @@ const inputSchema = zod_1.z
|
|
|
22
22
|
encoding: zod_1.z.enum(['utf8', 'base64']).default('utf8').describe('The encoding to use when reading the file'),
|
|
23
23
|
})
|
|
24
24
|
.strict();
|
|
25
|
-
let SandboxReadFile = SandboxReadFile_1 = class SandboxReadFile {
|
|
25
|
+
let SandboxReadFile = SandboxReadFile_1 = class SandboxReadFile extends common_2.BaseTool {
|
|
26
26
|
logger = new common_1.Logger(SandboxReadFile_1.name);
|
|
27
27
|
sandboxCommand;
|
|
28
|
-
args
|
|
29
|
-
async execute(args) {
|
|
28
|
+
async call(args) {
|
|
30
29
|
const { containerId, path, encoding } = args;
|
|
31
30
|
this.logger.debug(`Reading file ${path} from container ${containerId} (encoding: ${encoding})`);
|
|
32
31
|
const executable = encoding === 'base64' ? 'base64' : 'cat';
|
|
33
|
-
const result = await this.sandboxCommand.
|
|
32
|
+
const result = await this.sandboxCommand.call({
|
|
34
33
|
containerId,
|
|
35
34
|
executable,
|
|
36
35
|
args: [path],
|
|
@@ -59,15 +58,12 @@ __decorate([
|
|
|
59
58
|
(0, common_2.InjectTool)(),
|
|
60
59
|
__metadata("design:type", sandbox_tool_1.SandboxCommand)
|
|
61
60
|
], 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);
|
|
66
61
|
exports.SandboxReadFile = SandboxReadFile = SandboxReadFile_1 = __decorate([
|
|
67
62
|
(0, common_2.Tool)({
|
|
68
|
-
|
|
63
|
+
uiConfig: {
|
|
69
64
|
description: 'Read file contents from a sandbox container',
|
|
70
65
|
},
|
|
66
|
+
schema: inputSchema,
|
|
71
67
|
})
|
|
72
68
|
], SandboxReadFile);
|
|
73
69
|
//# 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,2CAAwC;AACxC,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"sandbox-read-file.tool.js","sourceRoot":"","sources":["../../src/tools/sandbox-read-file.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAeA,2CAAwC;AACxC,6BAAwB;AACxB,8CAA2E;AAC3E,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,eAAgB,SAAQ,iBAAQ;IAC1B,MAAM,GAAG,IAAI,eAAM,CAAC,iBAAe,CAAC,IAAI,CAAC,CAAC;IAErC,cAAc,CAAiB;IAErD,KAAK,CAAC,IAAI,CAAC,IAAyB;QAClC,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;QAEhG,MA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AE,WAAW;KACpB,CAAC;GACW,eAAe,CAsC3B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseTool, ToolResult } from '@loopstack/common';
|
|
3
3
|
declare const inputSchema: z.ZodObject<{
|
|
4
4
|
containerId: z.ZodString;
|
|
5
5
|
path: z.ZodString;
|
|
@@ -15,11 +15,10 @@ interface SandboxWriteFileResult {
|
|
|
15
15
|
path: string;
|
|
16
16
|
bytesWritten: number;
|
|
17
17
|
}
|
|
18
|
-
export declare class SandboxWriteFile
|
|
18
|
+
export declare class SandboxWriteFile extends BaseTool {
|
|
19
19
|
private readonly logger;
|
|
20
20
|
private sandboxCommand;
|
|
21
|
-
args: SandboxWriteFileArgs
|
|
22
|
-
execute(args: SandboxWriteFileArgs): Promise<ToolResult<SandboxWriteFileResult>>;
|
|
21
|
+
call(args: SandboxWriteFileArgs): Promise<ToolResult<SandboxWriteFileResult>>;
|
|
23
22
|
}
|
|
24
23
|
export {};
|
|
25
24
|
//# 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,EAAE,QAAQ,EAAoB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG3E,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,SAAQ,QAAQ;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqC;IAE9C,OAAO,CAAC,cAAc,CAAiB;IAE/C,IAAI,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;CAqEpF"}
|
|
@@ -58,18 +58,17 @@ const inputSchema = zod_1.z
|
|
|
58
58
|
createParentDirs: zod_1.z.boolean().default(true).describe("Whether to create parent directories if they don't exist"),
|
|
59
59
|
})
|
|
60
60
|
.strict();
|
|
61
|
-
let SandboxWriteFile = SandboxWriteFile_1 = class SandboxWriteFile {
|
|
61
|
+
let SandboxWriteFile = SandboxWriteFile_1 = class SandboxWriteFile extends common_2.BaseTool {
|
|
62
62
|
logger = new common_1.Logger(SandboxWriteFile_1.name);
|
|
63
63
|
sandboxCommand;
|
|
64
|
-
args
|
|
65
|
-
async execute(args) {
|
|
64
|
+
async call(args) {
|
|
66
65
|
const { containerId, path: filePath, content, encoding, createParentDirs } = args;
|
|
67
66
|
this.logger.debug(`Writing file ${filePath} to container ${containerId} (encoding: ${encoding})`);
|
|
68
67
|
if (createParentDirs) {
|
|
69
68
|
const parentDir = path.posix.dirname(filePath);
|
|
70
69
|
if (parentDir !== '/' && parentDir !== '.') {
|
|
71
70
|
this.logger.debug(`Creating parent directory ${parentDir}`);
|
|
72
|
-
const mkdirResult = await this.sandboxCommand.
|
|
71
|
+
const mkdirResult = await this.sandboxCommand.call({
|
|
73
72
|
containerId,
|
|
74
73
|
executable: 'mkdir',
|
|
75
74
|
args: ['-p', parentDir],
|
|
@@ -87,7 +86,7 @@ let SandboxWriteFile = SandboxWriteFile_1 = class SandboxWriteFile {
|
|
|
87
86
|
}
|
|
88
87
|
}
|
|
89
88
|
const base64Content = encoding === 'utf8' ? Buffer.from(content, 'utf8').toString('base64') : content.replace(/[^A-Za-z0-9+/=]/g, '');
|
|
90
|
-
const result = await this.sandboxCommand.
|
|
89
|
+
const result = await this.sandboxCommand.call({
|
|
91
90
|
containerId,
|
|
92
91
|
executable: 'sh',
|
|
93
92
|
args: ['-c', `echo '${base64Content}' | base64 -d > '${filePath.replace(/'/g, "'\\''")}'`],
|
|
@@ -117,15 +116,12 @@ __decorate([
|
|
|
117
116
|
(0, common_2.InjectTool)(),
|
|
118
117
|
__metadata("design:type", sandbox_tool_1.SandboxCommand)
|
|
119
118
|
], 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);
|
|
124
119
|
exports.SandboxWriteFile = SandboxWriteFile = SandboxWriteFile_1 = __decorate([
|
|
125
120
|
(0, common_2.Tool)({
|
|
126
|
-
|
|
121
|
+
uiConfig: {
|
|
127
122
|
description: 'Write content to a file in a sandbox container',
|
|
128
123
|
},
|
|
124
|
+
schema: inputSchema,
|
|
129
125
|
})
|
|
130
126
|
], SandboxWriteFile);
|
|
131
127
|
//# 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,2CAAwC;AACxC,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,2CAAwC;AACxC,2CAA6B;AAC7B,6BAAwB;AACxB,8CAA2E;AAC3E,0DAAyD;AAEzD,MAAM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|
"filesystem",
|
|
8
8
|
"sandbox"
|
|
9
9
|
],
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.5.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.25.0",
|
|
31
|
+
"@loopstack/sandbox-tool": "^0.5.0",
|
|
32
32
|
"@nestjs/common": "^11.1.14",
|
|
33
33
|
"zod": "^4.3.6"
|
|
34
34
|
},
|
|
@@ -15,7 +15,7 @@ limitations under the License.
|
|
|
15
15
|
*/
|
|
16
16
|
import { Logger } from '@nestjs/common';
|
|
17
17
|
import { z } from 'zod';
|
|
18
|
-
import {
|
|
18
|
+
import { BaseTool, InjectTool, Tool, ToolResult } from '@loopstack/common';
|
|
19
19
|
import { SandboxCommand } from '@loopstack/sandbox-tool';
|
|
20
20
|
|
|
21
21
|
const inputSchema = z
|
|
@@ -34,26 +34,24 @@ interface SandboxCreateDirectoryResult {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
@Tool({
|
|
37
|
-
|
|
37
|
+
uiConfig: {
|
|
38
38
|
description: 'Create a directory in a sandbox container',
|
|
39
39
|
},
|
|
40
|
+
schema: inputSchema,
|
|
40
41
|
})
|
|
41
|
-
export class SandboxCreateDirectory
|
|
42
|
+
export class SandboxCreateDirectory extends BaseTool {
|
|
42
43
|
private readonly logger = new Logger(SandboxCreateDirectory.name);
|
|
43
44
|
|
|
44
45
|
@InjectTool() private sandboxCommand: SandboxCommand;
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
args: SandboxCreateDirectoryArgs;
|
|
48
|
-
|
|
49
|
-
async execute(args: SandboxCreateDirectoryArgs): Promise<ToolResult<SandboxCreateDirectoryResult>> {
|
|
47
|
+
async call(args: SandboxCreateDirectoryArgs): Promise<ToolResult<SandboxCreateDirectoryResult>> {
|
|
50
48
|
const { containerId, path: dirPath, recursive } = args;
|
|
51
49
|
|
|
52
50
|
this.logger.debug(`Creating directory ${dirPath} in container ${containerId} (recursive: ${recursive})`);
|
|
53
51
|
|
|
54
52
|
const mkdirArgs = recursive ? ['-p', dirPath] : [dirPath];
|
|
55
53
|
|
|
56
|
-
const result = await this.sandboxCommand.
|
|
54
|
+
const result = await this.sandboxCommand.call({
|
|
57
55
|
containerId,
|
|
58
56
|
executable: 'mkdir',
|
|
59
57
|
args: mkdirArgs,
|
|
@@ -15,7 +15,7 @@ limitations under the License.
|
|
|
15
15
|
*/
|
|
16
16
|
import { Logger } from '@nestjs/common';
|
|
17
17
|
import { z } from 'zod';
|
|
18
|
-
import {
|
|
18
|
+
import { BaseTool, InjectTool, Tool, ToolResult } from '@loopstack/common';
|
|
19
19
|
import { SandboxCommand } from '@loopstack/sandbox-tool';
|
|
20
20
|
|
|
21
21
|
const inputSchema = z
|
|
@@ -35,19 +35,17 @@ interface SandboxDeleteResult {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
@Tool({
|
|
38
|
-
|
|
38
|
+
uiConfig: {
|
|
39
39
|
description: 'Delete a file or directory in a sandbox container',
|
|
40
40
|
},
|
|
41
|
+
schema: inputSchema,
|
|
41
42
|
})
|
|
42
|
-
export class SandboxDelete
|
|
43
|
+
export class SandboxDelete extends BaseTool {
|
|
43
44
|
private readonly logger = new Logger(SandboxDelete.name);
|
|
44
45
|
|
|
45
46
|
@InjectTool() private sandboxCommand: SandboxCommand;
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
args: SandboxDeleteArgs;
|
|
49
|
-
|
|
50
|
-
async execute(args: SandboxDeleteArgs): Promise<ToolResult<SandboxDeleteResult>> {
|
|
48
|
+
async call(args: SandboxDeleteArgs): Promise<ToolResult<SandboxDeleteResult>> {
|
|
51
49
|
const { containerId, path: targetPath, recursive, force } = args;
|
|
52
50
|
|
|
53
51
|
this.logger.debug(`Deleting ${targetPath} in container ${containerId} (recursive: ${recursive}, force: ${force})`);
|
|
@@ -57,7 +55,7 @@ export class SandboxDelete implements ToolInterface<SandboxDeleteArgs> {
|
|
|
57
55
|
if (force) rmArgs.push('-f');
|
|
58
56
|
rmArgs.push(targetPath);
|
|
59
57
|
|
|
60
|
-
const result = await this.sandboxCommand.
|
|
58
|
+
const result = await this.sandboxCommand.call({
|
|
61
59
|
containerId,
|
|
62
60
|
executable: 'rm',
|
|
63
61
|
args: rmArgs,
|
|
@@ -15,7 +15,7 @@ limitations under the License.
|
|
|
15
15
|
*/
|
|
16
16
|
import { Logger } from '@nestjs/common';
|
|
17
17
|
import { z } from 'zod';
|
|
18
|
-
import {
|
|
18
|
+
import { BaseTool, InjectTool, Tool, ToolResult } from '@loopstack/common';
|
|
19
19
|
import { SandboxCommand } from '@loopstack/sandbox-tool';
|
|
20
20
|
|
|
21
21
|
const inputSchema = z
|
|
@@ -34,26 +34,24 @@ interface SandboxExistsResult {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
@Tool({
|
|
37
|
-
|
|
37
|
+
uiConfig: {
|
|
38
38
|
description: 'Check if a file or directory exists in a sandbox container',
|
|
39
39
|
},
|
|
40
|
+
schema: inputSchema,
|
|
40
41
|
})
|
|
41
|
-
export class SandboxExists
|
|
42
|
+
export class SandboxExists extends BaseTool {
|
|
42
43
|
private readonly logger = new Logger(SandboxExists.name);
|
|
43
44
|
|
|
44
45
|
@InjectTool()
|
|
45
46
|
private sandboxCommand: SandboxCommand;
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
args: SandboxExistsArgs;
|
|
49
|
-
|
|
50
|
-
async execute(args: SandboxExistsArgs): Promise<ToolResult<SandboxExistsResult>> {
|
|
48
|
+
async call(args: SandboxExistsArgs): Promise<ToolResult<SandboxExistsResult>> {
|
|
51
49
|
const { containerId, path: targetPath } = args;
|
|
52
50
|
|
|
53
51
|
this.logger.debug(`Checking existence of ${targetPath} in container ${containerId}`);
|
|
54
52
|
|
|
55
53
|
// Use test command to check existence and stat to get type
|
|
56
|
-
const result = await this.sandboxCommand.
|
|
54
|
+
const result = await this.sandboxCommand.call({
|
|
57
55
|
containerId,
|
|
58
56
|
executable: 'sh',
|
|
59
57
|
args: [
|
|
@@ -15,7 +15,7 @@ limitations under the License.
|
|
|
15
15
|
*/
|
|
16
16
|
import { Logger } from '@nestjs/common';
|
|
17
17
|
import { z } from 'zod';
|
|
18
|
-
import {
|
|
18
|
+
import { BaseTool, InjectTool, Tool, ToolResult } from '@loopstack/common';
|
|
19
19
|
import { SandboxCommand } from '@loopstack/sandbox-tool';
|
|
20
20
|
|
|
21
21
|
const inputSchema = z
|
|
@@ -41,26 +41,24 @@ interface SandboxFileInfoResult {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
@Tool({
|
|
44
|
-
|
|
44
|
+
uiConfig: {
|
|
45
45
|
description: 'Get detailed information about a file or directory in a sandbox container',
|
|
46
46
|
},
|
|
47
|
+
schema: inputSchema,
|
|
47
48
|
})
|
|
48
|
-
export class SandboxFileInfo
|
|
49
|
+
export class SandboxFileInfo extends BaseTool {
|
|
49
50
|
private readonly logger = new Logger(SandboxFileInfo.name);
|
|
50
51
|
|
|
51
52
|
@InjectTool() private sandboxCommand: SandboxCommand;
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
args: SandboxFileInfoArgs;
|
|
55
|
-
|
|
56
|
-
async execute(args: SandboxFileInfoArgs): Promise<ToolResult<SandboxFileInfoResult>> {
|
|
54
|
+
async call(args: SandboxFileInfoArgs): Promise<ToolResult<SandboxFileInfoResult>> {
|
|
57
55
|
const { containerId, path: targetPath } = args;
|
|
58
56
|
|
|
59
57
|
this.logger.debug(`Getting file info for ${targetPath} in container ${containerId}`);
|
|
60
58
|
|
|
61
59
|
// Use stat to get detailed file information
|
|
62
60
|
// Format: type|size|permissions|owner|group|mtime|atime|ctime
|
|
63
|
-
const result = await this.sandboxCommand.
|
|
61
|
+
const result = await this.sandboxCommand.call({
|
|
64
62
|
containerId,
|
|
65
63
|
executable: 'stat',
|
|
66
64
|
args: ['-c', '%F|%s|%A|%U|%G|%y|%x|%w', targetPath],
|
|
@@ -15,7 +15,7 @@ limitations under the License.
|
|
|
15
15
|
*/
|
|
16
16
|
import { Logger } from '@nestjs/common';
|
|
17
17
|
import { z } from 'zod';
|
|
18
|
-
import {
|
|
18
|
+
import { BaseTool, InjectTool, Tool, ToolResult } from '@loopstack/common';
|
|
19
19
|
import { SandboxCommand } from '@loopstack/sandbox-tool';
|
|
20
20
|
|
|
21
21
|
const inputSchema = z
|
|
@@ -41,19 +41,17 @@ interface SandboxListDirectoryResult {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
@Tool({
|
|
44
|
-
|
|
44
|
+
uiConfig: {
|
|
45
45
|
description: 'List files and directories in a sandbox container',
|
|
46
46
|
},
|
|
47
|
+
schema: inputSchema,
|
|
47
48
|
})
|
|
48
|
-
export class SandboxListDirectory
|
|
49
|
+
export class SandboxListDirectory extends BaseTool {
|
|
49
50
|
private readonly logger = new Logger(SandboxListDirectory.name);
|
|
50
51
|
|
|
51
52
|
@InjectTool() private sandboxCommand: SandboxCommand;
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
args: SandboxListDirectoryArgs;
|
|
55
|
-
|
|
56
|
-
async execute(args: SandboxListDirectoryArgs): Promise<ToolResult<SandboxListDirectoryResult>> {
|
|
54
|
+
async call(args: SandboxListDirectoryArgs): Promise<ToolResult<SandboxListDirectoryResult>> {
|
|
57
55
|
const { containerId, path: dirPath, recursive } = args;
|
|
58
56
|
|
|
59
57
|
this.logger.debug(`Listing directory ${dirPath} in container ${containerId} (recursive: ${recursive})`);
|
|
@@ -64,7 +62,7 @@ export class SandboxListDirectory implements ToolInterface<SandboxListDirectoryA
|
|
|
64
62
|
? `find '${dirPath.replace(/'/g, "'\\''")}' -printf '%y %s %p\\n'`
|
|
65
63
|
: `find '${dirPath.replace(/'/g, "'\\''")}' -maxdepth 1 -printf '%y %s %p\\n'`;
|
|
66
64
|
|
|
67
|
-
const result = await this.sandboxCommand.
|
|
65
|
+
const result = await this.sandboxCommand.call({
|
|
68
66
|
containerId,
|
|
69
67
|
executable: 'sh',
|
|
70
68
|
args: ['-c', command],
|
|
@@ -15,7 +15,7 @@ limitations under the License.
|
|
|
15
15
|
*/
|
|
16
16
|
import { Logger } from '@nestjs/common';
|
|
17
17
|
import { z } from 'zod';
|
|
18
|
-
import {
|
|
18
|
+
import { BaseTool, InjectTool, Tool, ToolResult } from '@loopstack/common';
|
|
19
19
|
import { SandboxCommand } from '@loopstack/sandbox-tool';
|
|
20
20
|
|
|
21
21
|
const inputSchema = z
|
|
@@ -34,25 +34,23 @@ interface SandboxReadFileResult {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
@Tool({
|
|
37
|
-
|
|
37
|
+
uiConfig: {
|
|
38
38
|
description: 'Read file contents from a sandbox container',
|
|
39
39
|
},
|
|
40
|
+
schema: inputSchema,
|
|
40
41
|
})
|
|
41
|
-
export class SandboxReadFile
|
|
42
|
+
export class SandboxReadFile extends BaseTool {
|
|
42
43
|
private readonly logger = new Logger(SandboxReadFile.name);
|
|
43
44
|
|
|
44
45
|
@InjectTool() private sandboxCommand: SandboxCommand;
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
args: SandboxReadFileArgs;
|
|
48
|
-
|
|
49
|
-
async execute(args: SandboxReadFileArgs): Promise<ToolResult<SandboxReadFileResult>> {
|
|
47
|
+
async call(args: SandboxReadFileArgs): Promise<ToolResult<SandboxReadFileResult>> {
|
|
50
48
|
const { containerId, path, encoding } = args;
|
|
51
49
|
|
|
52
50
|
this.logger.debug(`Reading file ${path} from container ${containerId} (encoding: ${encoding})`);
|
|
53
51
|
|
|
54
52
|
const executable = encoding === 'base64' ? 'base64' : 'cat';
|
|
55
|
-
const result = await this.sandboxCommand.
|
|
53
|
+
const result = await this.sandboxCommand.call({
|
|
56
54
|
containerId,
|
|
57
55
|
executable,
|
|
58
56
|
args: [path],
|
|
@@ -16,7 +16,7 @@ limitations under the License.
|
|
|
16
16
|
import { Logger } from '@nestjs/common';
|
|
17
17
|
import * as path from 'path';
|
|
18
18
|
import { z } from 'zod';
|
|
19
|
-
import {
|
|
19
|
+
import { BaseTool, InjectTool, Tool, ToolResult } from '@loopstack/common';
|
|
20
20
|
import { SandboxCommand } from '@loopstack/sandbox-tool';
|
|
21
21
|
|
|
22
22
|
const inputSchema = z
|
|
@@ -37,19 +37,17 @@ interface SandboxWriteFileResult {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
@Tool({
|
|
40
|
-
|
|
40
|
+
uiConfig: {
|
|
41
41
|
description: 'Write content to a file in a sandbox container',
|
|
42
42
|
},
|
|
43
|
+
schema: inputSchema,
|
|
43
44
|
})
|
|
44
|
-
export class SandboxWriteFile
|
|
45
|
+
export class SandboxWriteFile extends BaseTool {
|
|
45
46
|
private readonly logger = new Logger(SandboxWriteFile.name);
|
|
46
47
|
|
|
47
48
|
@InjectTool() private sandboxCommand: SandboxCommand;
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
args: SandboxWriteFileArgs;
|
|
51
|
-
|
|
52
|
-
async execute(args: SandboxWriteFileArgs): Promise<ToolResult<SandboxWriteFileResult>> {
|
|
50
|
+
async call(args: SandboxWriteFileArgs): Promise<ToolResult<SandboxWriteFileResult>> {
|
|
53
51
|
const { containerId, path: filePath, content, encoding, createParentDirs } = args;
|
|
54
52
|
|
|
55
53
|
this.logger.debug(`Writing file ${filePath} to container ${containerId} (encoding: ${encoding})`);
|
|
@@ -59,7 +57,7 @@ export class SandboxWriteFile implements ToolInterface<SandboxWriteFileArgs> {
|
|
|
59
57
|
const parentDir = path.posix.dirname(filePath);
|
|
60
58
|
if (parentDir !== '/' && parentDir !== '.') {
|
|
61
59
|
this.logger.debug(`Creating parent directory ${parentDir}`);
|
|
62
|
-
const mkdirResult = await this.sandboxCommand.
|
|
60
|
+
const mkdirResult = await this.sandboxCommand.call({
|
|
63
61
|
containerId,
|
|
64
62
|
executable: 'mkdir',
|
|
65
63
|
args: ['-p', parentDir],
|
|
@@ -88,7 +86,7 @@ export class SandboxWriteFile implements ToolInterface<SandboxWriteFileArgs> {
|
|
|
88
86
|
encoding === 'utf8' ? Buffer.from(content, 'utf8').toString('base64') : content.replace(/[^A-Za-z0-9+/=]/g, '');
|
|
89
87
|
|
|
90
88
|
// Write file using base64 decode
|
|
91
|
-
const result = await this.sandboxCommand.
|
|
89
|
+
const result = await this.sandboxCommand.call({
|
|
92
90
|
containerId,
|
|
93
91
|
executable: 'sh',
|
|
94
92
|
args: ['-c', `echo '${base64Content}' | base64 -d > '${filePath.replace(/'/g, "'\\''")}'`],
|