@rama_nigg/open-cursor 2.3.16 → 2.3.18
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 +4 -37
- package/dist/cli/mcptool.js +637 -5574
- package/dist/index.js +2688 -20260
- package/dist/plugin-entry.js +2464 -20036
- package/package.json +3 -3
- package/src/tools/defaults.ts +50 -18
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rama_nigg/open-cursor",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.18",
|
|
4
4
|
"description": "No prompt limits. No broken streams. Full thinking + tool support. Your Cursor subscription, properly integrated.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/plugin-entry.js",
|
|
7
7
|
"module": "src/plugin-entry.ts",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "bun build ./src/index.ts ./src/plugin-entry.ts ./src/cli/discover.ts ./src/cli/opencode-cursor.ts ./src/cli/mcptool.ts --outdir ./dist --target node",
|
|
10
|
-
"dev": "bun build ./src/index.ts ./src/plugin-entry.ts ./src/cli/discover.ts ./src/cli/opencode-cursor.ts ./src/cli/mcptool.ts --outdir ./dist --target node --watch",
|
|
9
|
+
"build": "bun build ./src/index.ts ./src/plugin-entry.ts ./src/cli/discover.ts ./src/cli/opencode-cursor.ts ./src/cli/mcptool.ts --outdir ./dist --target node --external @opencode-ai/plugin --external zod",
|
|
10
|
+
"dev": "bun build ./src/index.ts ./src/plugin-entry.ts ./src/cli/discover.ts ./src/cli/opencode-cursor.ts ./src/cli/mcptool.ts --outdir ./dist --target node --watch --external @opencode-ai/plugin --external zod",
|
|
11
11
|
"test": "bun test",
|
|
12
12
|
"test:unit": "bun test tests/unit",
|
|
13
13
|
"test:integration": "bun test tests/integration",
|
package/src/tools/defaults.ts
CHANGED
|
@@ -18,7 +18,7 @@ export function registerDefaultTools(registry: ToolRegistry): void {
|
|
|
18
18
|
},
|
|
19
19
|
timeout: {
|
|
20
20
|
type: "number",
|
|
21
|
-
description: "Timeout in
|
|
21
|
+
description: "Timeout in seconds (default: 30)"
|
|
22
22
|
},
|
|
23
23
|
cwd: {
|
|
24
24
|
type: "string",
|
|
@@ -29,25 +29,49 @@ export function registerDefaultTools(registry: ToolRegistry): void {
|
|
|
29
29
|
},
|
|
30
30
|
source: "local" as const
|
|
31
31
|
}, async (args) => {
|
|
32
|
-
const {
|
|
33
|
-
const { promisify } = await import("util");
|
|
34
|
-
const execAsync = promisify(exec);
|
|
32
|
+
const { spawn } = await import("child_process");
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
throw new Error("bash: missing required argument 'command'");
|
|
40
|
-
}
|
|
41
|
-
const timeout = resolveTimeout(args.timeout);
|
|
42
|
-
const cwd = resolveWorkingDirectory(args);
|
|
43
|
-
const { stdout, stderr } = await execAsync(command, {
|
|
44
|
-
timeout: timeout ?? 30000,
|
|
45
|
-
cwd: cwd
|
|
46
|
-
});
|
|
47
|
-
return stdout || stderr || "Command executed successfully";
|
|
48
|
-
} catch (error: any) {
|
|
49
|
-
throw error;
|
|
34
|
+
const command = resolveBashCommand(args);
|
|
35
|
+
if (!command) {
|
|
36
|
+
throw new Error("bash: missing required argument 'command'");
|
|
50
37
|
}
|
|
38
|
+
const timeoutMs = resolveTimeoutMs(args.timeout);
|
|
39
|
+
const cwd = resolveWorkingDirectory(args);
|
|
40
|
+
|
|
41
|
+
return new Promise<string>((resolve, reject) => {
|
|
42
|
+
const proc = spawn(command, {
|
|
43
|
+
shell: process.env.SHELL || "/bin/bash",
|
|
44
|
+
cwd,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const stdoutChunks: Buffer[] = [];
|
|
48
|
+
const stderrChunks: Buffer[] = [];
|
|
49
|
+
let timedOut = false;
|
|
50
|
+
|
|
51
|
+
const timer = setTimeout(() => {
|
|
52
|
+
timedOut = true;
|
|
53
|
+
proc.kill("SIGTERM");
|
|
54
|
+
}, timeoutMs);
|
|
55
|
+
|
|
56
|
+
proc.stdout.on("data", (chunk: Buffer) => stdoutChunks.push(chunk));
|
|
57
|
+
proc.stderr.on("data", (chunk: Buffer) => stderrChunks.push(chunk));
|
|
58
|
+
|
|
59
|
+
proc.on("close", (code) => {
|
|
60
|
+
clearTimeout(timer);
|
|
61
|
+
const stdout = Buffer.concat(stdoutChunks).toString("utf8");
|
|
62
|
+
const stderr = Buffer.concat(stderrChunks).toString("utf8");
|
|
63
|
+
const output = stdout || stderr || "Command executed successfully";
|
|
64
|
+
if (timedOut) {
|
|
65
|
+
resolve(`Command timed out after ${timeoutMs / 1000}s\n${output}`);
|
|
66
|
+
} else if (code !== 0) {
|
|
67
|
+
resolve(`${output}\n[Exit code: ${code}]`);
|
|
68
|
+
} else {
|
|
69
|
+
resolve(output);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
proc.on("error", reject);
|
|
74
|
+
});
|
|
51
75
|
});
|
|
52
76
|
|
|
53
77
|
// 2. Read tool - Read file contents
|
|
@@ -598,6 +622,14 @@ function resolveTimeout(value: unknown): number | undefined {
|
|
|
598
622
|
return undefined;
|
|
599
623
|
}
|
|
600
624
|
|
|
625
|
+
// Convert model-supplied timeout (seconds) to milliseconds. Falls back to 30s.
|
|
626
|
+
function resolveTimeoutMs(value: unknown): number {
|
|
627
|
+
const raw = resolveTimeout(value);
|
|
628
|
+
if (raw === undefined) return 30_000;
|
|
629
|
+
// Values ≤ 600 are treated as seconds (no real use case for a <600ms shell timeout).
|
|
630
|
+
return raw <= 600 ? raw * 1000 : raw;
|
|
631
|
+
}
|
|
632
|
+
|
|
601
633
|
function resolveBoolean(value: unknown, defaultValue: boolean): boolean {
|
|
602
634
|
if (typeof value === "boolean") {
|
|
603
635
|
return value;
|