orbitx 0.1.5 → 0.1.6
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 +23 -1
- package/dist/tools/fs/list-dir.d.ts.map +1 -1
- package/dist/tools/fs/list-dir.js +57 -22
- package/dist/tools/fs/list-dir.js.map +1 -1
- package/package.json +3 -3
package/Readme.md
CHANGED
|
@@ -6,6 +6,28 @@
|
|
|
6
6
|
npm install orbitx
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
+
## Demo
|
|
10
|
+
|
|
11
|
+
<table>
|
|
12
|
+
<tr>
|
|
13
|
+
<td align="center">
|
|
14
|
+
<a href="https://www.youtube.com/watch?v=nuIhIBdBjTI">
|
|
15
|
+
<img src="https://img.youtube.com/vi/nuIhIBdBjTI/maxresdefault.jpg" width="400" alt="Demo 1">
|
|
16
|
+
</a>
|
|
17
|
+
<br>
|
|
18
|
+
<b>Demo 1</b>
|
|
19
|
+
</td>
|
|
20
|
+
<td align="center">
|
|
21
|
+
<a href="https://www.youtube.com/watch?v=Go1PIYo0sFw">
|
|
22
|
+
<img src="https://img.youtube.com/vi/Go1PIYo0sFw/maxresdefault.jpg" width="400" alt="Demo 2">
|
|
23
|
+
</a>
|
|
24
|
+
<br>
|
|
25
|
+
<b>Demo 2</b>
|
|
26
|
+
</td>
|
|
27
|
+
</tr>
|
|
28
|
+
</table>
|
|
29
|
+
|
|
30
|
+
|
|
9
31
|
## Quick Start
|
|
10
32
|
|
|
11
33
|
The fastest way to get an agent running is `SimpleAgent` — give it a provider, an instruction, and a list of tools/skills.
|
|
@@ -398,7 +420,7 @@ const computer = new MCPComputer("/path/to/mount", [3000, 8080]);
|
|
|
398
420
|
await computer.start();
|
|
399
421
|
|
|
400
422
|
const connection = computer.getConnection();
|
|
401
|
-
computer.stop();
|
|
423
|
+
await computer.stop();
|
|
402
424
|
```
|
|
403
425
|
|
|
404
426
|
- **`mountPath`**: host directory mounted into the container
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-dir.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/list-dir.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"list-dir.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/list-dir.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAmEjD,eAAO,MAAM,aAAa,8BAuFxB,CAAC;AAEH,eAAe,aAAa,CAAC"}
|
|
@@ -3,9 +3,52 @@ import { join } from "path";
|
|
|
3
3
|
import { MCPTool } from "../../core/mcp.js";
|
|
4
4
|
import { FsInteraction } from "./interaction.js";
|
|
5
5
|
import { resolvePath } from "./utils.js";
|
|
6
|
+
const DEFAULT_EXCLUDED_DIRS = [
|
|
7
|
+
"node_modules",
|
|
8
|
+
".git",
|
|
9
|
+
".next",
|
|
10
|
+
".turbo",
|
|
11
|
+
"dist",
|
|
12
|
+
"build",
|
|
13
|
+
".cache",
|
|
14
|
+
"coverage",
|
|
15
|
+
".vscode",
|
|
16
|
+
".idea",
|
|
17
|
+
];
|
|
18
|
+
async function walk(dirPath, recursive, excludeSet, depth = 0) {
|
|
19
|
+
const dirents = await readdir(dirPath, { withFileTypes: true });
|
|
20
|
+
const results = [];
|
|
21
|
+
for (const d of dirents) {
|
|
22
|
+
const entryPath = join(dirPath, d.name);
|
|
23
|
+
const isDirectory = d.isDirectory();
|
|
24
|
+
const isExcluded = isDirectory && excludeSet.has(d.name);
|
|
25
|
+
let size;
|
|
26
|
+
if (d.isFile()) {
|
|
27
|
+
try {
|
|
28
|
+
size = (await stat(entryPath)).size;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
size = undefined;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const entry = {
|
|
35
|
+
name: d.name,
|
|
36
|
+
path: entryPath,
|
|
37
|
+
type: isDirectory ? "directory" : d.isSymbolicLink() ? "symlink" : "file",
|
|
38
|
+
size,
|
|
39
|
+
...(isExcluded ? { excluded: true } : {}),
|
|
40
|
+
};
|
|
41
|
+
results.push(entry);
|
|
42
|
+
if (recursive && isDirectory && !isExcluded) {
|
|
43
|
+
const children = await walk(entryPath, recursive, excludeSet, depth + 1);
|
|
44
|
+
results.push(...children);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return results;
|
|
48
|
+
}
|
|
6
49
|
export const FsListDirTool = () => new MCPTool({
|
|
7
50
|
name: "fs-list-dir",
|
|
8
|
-
description: "list the entries (files and directories) inside a directory, optionally paging through the results by entry index so very large directories (especially with recursive: true) never need to be returned in one shot",
|
|
51
|
+
description: "list the entries (files and directories) inside a directory, optionally paging through the results by entry index so very large directories (especially with recursive: true) never need to be returned in one shot. certain directories (node_modules, .git, etc) are excluded from recursion by default via excludeDirs",
|
|
9
52
|
inputs: [
|
|
10
53
|
{
|
|
11
54
|
name: "path",
|
|
@@ -20,6 +63,13 @@ export const FsListDirTool = () => new MCPTool({
|
|
|
20
63
|
required: false,
|
|
21
64
|
default: false,
|
|
22
65
|
},
|
|
66
|
+
{
|
|
67
|
+
name: "excludeDirs",
|
|
68
|
+
type: "array",
|
|
69
|
+
description: "directory names to exclude from recursive traversal (their contents are skipped, but the directory itself still appears as an entry tagged 'excluded: true'). only applies when recursive is true",
|
|
70
|
+
required: false,
|
|
71
|
+
default: DEFAULT_EXCLUDED_DIRS,
|
|
72
|
+
},
|
|
23
73
|
{
|
|
24
74
|
name: "offsetResult",
|
|
25
75
|
type: "number",
|
|
@@ -37,12 +87,15 @@ export const FsListDirTool = () => new MCPTool({
|
|
|
37
87
|
],
|
|
38
88
|
customClass: new FsInteraction(),
|
|
39
89
|
execute: async (_envID, inputs, _mcp, customClass) => {
|
|
40
|
-
const { path, recursive = false, offsetResult = 0, limitResult = 500 } = inputs;
|
|
90
|
+
const { path, recursive = false, excludeDirs = DEFAULT_EXCLUDED_DIRS, offsetResult = 0, limitResult = 500, } = inputs;
|
|
41
91
|
const fullPath = resolvePath(path);
|
|
42
92
|
customClass?.emitFsEvent({ type: "listing", path: fullPath });
|
|
43
|
-
|
|
93
|
+
const excludeSet = new Set(excludeDirs);
|
|
94
|
+
let entries;
|
|
44
95
|
try {
|
|
45
|
-
|
|
96
|
+
entries = recursive
|
|
97
|
+
? await walk(fullPath, true, excludeSet)
|
|
98
|
+
: await walk(fullPath, false, excludeSet);
|
|
46
99
|
}
|
|
47
100
|
catch (err) {
|
|
48
101
|
if (err.code === "ENOENT")
|
|
@@ -51,24 +104,6 @@ export const FsListDirTool = () => new MCPTool({
|
|
|
51
104
|
throw new Error(`"${path}" is a file, not a directory`);
|
|
52
105
|
throw err;
|
|
53
106
|
}
|
|
54
|
-
const entries = await Promise.all(dirents.map(async (d) => {
|
|
55
|
-
const entryPath = join(d.parentPath || d.path || fullPath, d.name);
|
|
56
|
-
let size;
|
|
57
|
-
if (d.isFile()) {
|
|
58
|
-
try {
|
|
59
|
-
size = (await stat(entryPath)).size;
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
size = undefined;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
name: d.name,
|
|
67
|
-
path: entryPath,
|
|
68
|
-
type: d.isDirectory() ? "directory" : d.isSymbolicLink() ? "symlink" : "file",
|
|
69
|
-
size,
|
|
70
|
-
};
|
|
71
|
-
}));
|
|
72
107
|
const totalResult = entries.length;
|
|
73
108
|
const start = Math.max(0, Math.min(offsetResult, totalResult));
|
|
74
109
|
const end = Math.max(start, Math.min(start + limitResult, totalResult));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-dir.js","sourceRoot":"","sources":["../../../src/tools/fs/list-dir.ts"],"names":[],"mappings":"AAAA,OAAO,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BACxC,CAAC,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAChB,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;gBAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,GAAG,CAAC,CAAC;YAC9E,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,8BAA8B,CAAC,CAAC;YACpF,MAAM,GAAG,CAAC;QACd,CAAC;QAED,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;QACnC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;QAC/D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;QACxE,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAEvC,OAAO;YACH,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,WAAW;YAClB,WAAW;YACX,YAAY,EAAE,KAAK;YACnB,WAAW;SACd,CAAC;IACN,CAAC;CACJ,CAAC,CAAC;AAEH,eAAe,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orbitx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "An AI SDK providing agents, swarms, planners, skills, MCP tools, workflows, and multi-provider AI integrations.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@anthropic-ai/sdk": "^0.115.0",
|
|
44
44
|
"ollama": "^0.6.3",
|
|
45
45
|
"openai": "^6.45.0",
|
|
46
|
-
"puppeteer-core": "^
|
|
46
|
+
"puppeteer-core": "^25.6.0",
|
|
47
47
|
"ws": "^8.21.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
@@ -54,4 +54,4 @@
|
|
|
54
54
|
"tsx": "^4.22.4",
|
|
55
55
|
"typescript": "^6.0.3"
|
|
56
56
|
}
|
|
57
|
-
}
|
|
57
|
+
}
|