@rama_nigg/open-cursor 2.3.16 → 2.3.17
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/dist/index.js +43 -17
- package/dist/plugin-entry.js +43 -17
- package/package.json +1 -1
- package/src/tools/defaults.ts +50 -18
package/dist/index.js
CHANGED
|
@@ -31001,7 +31001,7 @@ function registerDefaultTools(registry3) {
|
|
|
31001
31001
|
},
|
|
31002
31002
|
timeout: {
|
|
31003
31003
|
type: "number",
|
|
31004
|
-
description: "Timeout in
|
|
31004
|
+
description: "Timeout in seconds (default: 30)"
|
|
31005
31005
|
},
|
|
31006
31006
|
cwd: {
|
|
31007
31007
|
type: "string",
|
|
@@ -31012,24 +31012,44 @@ function registerDefaultTools(registry3) {
|
|
|
31012
31012
|
},
|
|
31013
31013
|
source: "local"
|
|
31014
31014
|
}, async (args) => {
|
|
31015
|
-
const {
|
|
31016
|
-
const
|
|
31017
|
-
|
|
31018
|
-
|
|
31019
|
-
|
|
31020
|
-
|
|
31021
|
-
|
|
31022
|
-
|
|
31023
|
-
const
|
|
31024
|
-
|
|
31025
|
-
const { stdout, stderr } = await execAsync(command, {
|
|
31026
|
-
timeout: timeout ?? 30000,
|
|
31015
|
+
const { spawn: spawn3 } = await import("child_process");
|
|
31016
|
+
const command = resolveBashCommand(args);
|
|
31017
|
+
if (!command) {
|
|
31018
|
+
throw new Error("bash: missing required argument 'command'");
|
|
31019
|
+
}
|
|
31020
|
+
const timeoutMs = resolveTimeoutMs(args.timeout);
|
|
31021
|
+
const cwd = resolveWorkingDirectory(args);
|
|
31022
|
+
return new Promise((resolve2, reject) => {
|
|
31023
|
+
const proc = spawn3(command, {
|
|
31024
|
+
shell: process.env.SHELL || "/bin/bash",
|
|
31027
31025
|
cwd
|
|
31028
31026
|
});
|
|
31029
|
-
|
|
31030
|
-
|
|
31031
|
-
|
|
31032
|
-
|
|
31027
|
+
const stdoutChunks = [];
|
|
31028
|
+
const stderrChunks = [];
|
|
31029
|
+
let timedOut = false;
|
|
31030
|
+
const timer = setTimeout(() => {
|
|
31031
|
+
timedOut = true;
|
|
31032
|
+
proc.kill("SIGTERM");
|
|
31033
|
+
}, timeoutMs);
|
|
31034
|
+
proc.stdout.on("data", (chunk) => stdoutChunks.push(chunk));
|
|
31035
|
+
proc.stderr.on("data", (chunk) => stderrChunks.push(chunk));
|
|
31036
|
+
proc.on("close", (code) => {
|
|
31037
|
+
clearTimeout(timer);
|
|
31038
|
+
const stdout = Buffer.concat(stdoutChunks).toString("utf8");
|
|
31039
|
+
const stderr = Buffer.concat(stderrChunks).toString("utf8");
|
|
31040
|
+
const output = stdout || stderr || "Command executed successfully";
|
|
31041
|
+
if (timedOut) {
|
|
31042
|
+
resolve2(`Command timed out after ${timeoutMs / 1000}s
|
|
31043
|
+
${output}`);
|
|
31044
|
+
} else if (code !== 0) {
|
|
31045
|
+
resolve2(`${output}
|
|
31046
|
+
[Exit code: ${code}]`);
|
|
31047
|
+
} else {
|
|
31048
|
+
resolve2(output);
|
|
31049
|
+
}
|
|
31050
|
+
});
|
|
31051
|
+
proc.on("error", reject);
|
|
31052
|
+
});
|
|
31033
31053
|
});
|
|
31034
31054
|
registry3.register({
|
|
31035
31055
|
id: "read",
|
|
@@ -31504,6 +31524,12 @@ function resolveTimeout(value) {
|
|
|
31504
31524
|
}
|
|
31505
31525
|
return;
|
|
31506
31526
|
}
|
|
31527
|
+
function resolveTimeoutMs(value) {
|
|
31528
|
+
const raw = resolveTimeout(value);
|
|
31529
|
+
if (raw === undefined)
|
|
31530
|
+
return 30000;
|
|
31531
|
+
return raw <= 600 ? raw * 1000 : raw;
|
|
31532
|
+
}
|
|
31507
31533
|
function resolveBoolean(value, defaultValue) {
|
|
31508
31534
|
if (typeof value === "boolean") {
|
|
31509
31535
|
return value;
|
package/dist/plugin-entry.js
CHANGED
|
@@ -31001,7 +31001,7 @@ function registerDefaultTools(registry3) {
|
|
|
31001
31001
|
},
|
|
31002
31002
|
timeout: {
|
|
31003
31003
|
type: "number",
|
|
31004
|
-
description: "Timeout in
|
|
31004
|
+
description: "Timeout in seconds (default: 30)"
|
|
31005
31005
|
},
|
|
31006
31006
|
cwd: {
|
|
31007
31007
|
type: "string",
|
|
@@ -31012,24 +31012,44 @@ function registerDefaultTools(registry3) {
|
|
|
31012
31012
|
},
|
|
31013
31013
|
source: "local"
|
|
31014
31014
|
}, async (args) => {
|
|
31015
|
-
const {
|
|
31016
|
-
const
|
|
31017
|
-
|
|
31018
|
-
|
|
31019
|
-
|
|
31020
|
-
|
|
31021
|
-
|
|
31022
|
-
|
|
31023
|
-
const
|
|
31024
|
-
|
|
31025
|
-
const { stdout, stderr } = await execAsync(command, {
|
|
31026
|
-
timeout: timeout ?? 30000,
|
|
31015
|
+
const { spawn: spawn3 } = await import("child_process");
|
|
31016
|
+
const command = resolveBashCommand(args);
|
|
31017
|
+
if (!command) {
|
|
31018
|
+
throw new Error("bash: missing required argument 'command'");
|
|
31019
|
+
}
|
|
31020
|
+
const timeoutMs = resolveTimeoutMs(args.timeout);
|
|
31021
|
+
const cwd = resolveWorkingDirectory(args);
|
|
31022
|
+
return new Promise((resolve2, reject) => {
|
|
31023
|
+
const proc = spawn3(command, {
|
|
31024
|
+
shell: process.env.SHELL || "/bin/bash",
|
|
31027
31025
|
cwd
|
|
31028
31026
|
});
|
|
31029
|
-
|
|
31030
|
-
|
|
31031
|
-
|
|
31032
|
-
|
|
31027
|
+
const stdoutChunks = [];
|
|
31028
|
+
const stderrChunks = [];
|
|
31029
|
+
let timedOut = false;
|
|
31030
|
+
const timer = setTimeout(() => {
|
|
31031
|
+
timedOut = true;
|
|
31032
|
+
proc.kill("SIGTERM");
|
|
31033
|
+
}, timeoutMs);
|
|
31034
|
+
proc.stdout.on("data", (chunk) => stdoutChunks.push(chunk));
|
|
31035
|
+
proc.stderr.on("data", (chunk) => stderrChunks.push(chunk));
|
|
31036
|
+
proc.on("close", (code) => {
|
|
31037
|
+
clearTimeout(timer);
|
|
31038
|
+
const stdout = Buffer.concat(stdoutChunks).toString("utf8");
|
|
31039
|
+
const stderr = Buffer.concat(stderrChunks).toString("utf8");
|
|
31040
|
+
const output = stdout || stderr || "Command executed successfully";
|
|
31041
|
+
if (timedOut) {
|
|
31042
|
+
resolve2(`Command timed out after ${timeoutMs / 1000}s
|
|
31043
|
+
${output}`);
|
|
31044
|
+
} else if (code !== 0) {
|
|
31045
|
+
resolve2(`${output}
|
|
31046
|
+
[Exit code: ${code}]`);
|
|
31047
|
+
} else {
|
|
31048
|
+
resolve2(output);
|
|
31049
|
+
}
|
|
31050
|
+
});
|
|
31051
|
+
proc.on("error", reject);
|
|
31052
|
+
});
|
|
31033
31053
|
});
|
|
31034
31054
|
registry3.register({
|
|
31035
31055
|
id: "read",
|
|
@@ -31504,6 +31524,12 @@ function resolveTimeout(value) {
|
|
|
31504
31524
|
}
|
|
31505
31525
|
return;
|
|
31506
31526
|
}
|
|
31527
|
+
function resolveTimeoutMs(value) {
|
|
31528
|
+
const raw = resolveTimeout(value);
|
|
31529
|
+
if (raw === undefined)
|
|
31530
|
+
return 30000;
|
|
31531
|
+
return raw <= 600 ? raw * 1000 : raw;
|
|
31532
|
+
}
|
|
31507
31533
|
function resolveBoolean(value, defaultValue) {
|
|
31508
31534
|
if (typeof value === "boolean") {
|
|
31509
31535
|
return value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rama_nigg/open-cursor",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.17",
|
|
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",
|
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;
|