Skip to content

Commit b4cd7e4

Browse files
committed
-
1 parent ab624e7 commit b4cd7e4

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

core/tool-runner.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,25 @@ const ToolRunner = {
2323

2424
const builtIns = {
2525
// VFS Ops
26-
read_file: async ({ path }) => {
26+
read_file: async (args) => {
27+
const path = args.path || args.file;
2728
if (!path) throw new Errors.ValidationError('Missing path');
2829
return await VFS.read(path);
2930
},
30-
write_file: async ({ path, content }) => {
31+
write_file: async (args) => {
32+
const path = args.path || args.file;
33+
const content = args.content;
3134
if (!path || content === undefined) throw new Errors.ValidationError('Missing args');
3235
await VFS.write(path, content);
3336
return `Wrote ${path} (${content.length} bytes)`;
3437
},
35-
list_files: async ({ path }) => {
38+
list_files: async (args) => {
39+
const path = args.path || args.directory || args.dir;
3640
return await VFS.list(path || '/');
3741
},
38-
delete_file: async ({ path }) => {
42+
delete_file: async (args) => {
43+
const path = args.path || args.file;
44+
if (!path) throw new Errors.ValidationError('Missing path');
3945
await VFS.delete(path);
4046
return `Deleted ${path}`;
4147
},

0 commit comments

Comments
 (0)