@ducci/jarvis 1.0.43 → 1.0.44

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/server/tools.js +20 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ducci/jarvis",
3
- "version": "1.0.43",
3
+ "version": "1.0.44",
4
4
  "description": "A fully automated agent system that lives on a server.",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -11,35 +11,40 @@ const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
11
11
  const TOOL_TIMEOUT_MS = 60_000;
12
12
 
13
13
  const SEED_TOOLS = {
14
- list_dir: {
14
+ read_file: {
15
15
  definition: {
16
16
  type: 'function',
17
17
  function: {
18
- name: 'list_dir',
19
- description: 'List directory contents (similar to ls -la). Use this to explore the filesystem and see what files and directories exist at a given path.',
18
+ name: 'read_file',
19
+ description: 'Read a file from disk. Returns the file content as a string. Use offset and limit to read large files in chunks instead of loading everything at once.',
20
20
  parameters: {
21
21
  type: 'object',
22
22
  properties: {
23
23
  path: {
24
24
  type: 'string',
25
- description: 'Directory path to list. Defaults to the current working directory if omitted.',
25
+ description: 'Absolute or relative path to the file to read.',
26
+ },
27
+ offset: {
28
+ type: 'number',
29
+ description: 'Line number to start reading from (1-based). Omit to start from the beginning.',
30
+ },
31
+ limit: {
32
+ type: 'number',
33
+ description: 'Maximum number of lines to return. Omit to read the entire file (or remainder from offset).',
26
34
  },
27
35
  },
28
- required: [],
36
+ required: ['path'],
29
37
  },
30
38
  },
31
39
  },
32
40
  code: `
33
- const { execFile } = require("child_process");
34
- const { promisify } = require("util");
35
- const execFileAsync = promisify(execFile);
36
- const targetPath = args.path || process.cwd();
37
- const resolved = path.resolve(targetPath);
38
- const { stdout: output } = await execFileAsync("ls", ["-la", resolved], {
39
- encoding: "utf8",
40
- timeout: 10000,
41
- });
42
- return { status: "ok", path: resolved, output };
41
+ const targetPath = path.resolve(args.path);
42
+ const raw = await fs.promises.readFile(targetPath, 'utf8');
43
+ const lines = raw.split('\\n');
44
+ const offset = args.offset ? args.offset - 1 : 0;
45
+ const slice = args.limit ? lines.slice(offset, offset + args.limit) : lines.slice(offset);
46
+ const totalLines = lines.length;
47
+ return { status: 'ok', path: targetPath, content: slice.join('\\n'), totalLines, returnedLines: slice.length, offset: offset + 1 };
43
48
  `,
44
49
  },
45
50
  exec: {