granttap-mcp 0.8.136 → 0.8.138
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.
|
@@ -16,7 +16,30 @@ export function providerUsageFailure(stderr: string): string | undefined {
|
|
|
16
16
|
return 'Grok usage limit reached: Grok Build usage balance exhausted. Check your Grok usage before retrying.';
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* A stream-json run ends with one `result` object. Its raw JSON, cut at 300
|
|
21
|
+
* characters, reached the phone as a broken message; say what it reports.
|
|
22
|
+
*/
|
|
23
|
+
export function providerResultFailure(stdout: string): string | undefined {
|
|
24
|
+
const lines = stdout.split('\n').map(line => line.trim()).filter(line => line.startsWith('{'));
|
|
25
|
+
for (const line of lines.reverse()) {
|
|
26
|
+
let row: Record<string, unknown>;
|
|
27
|
+
try { row = JSON.parse(line); } catch { continue; }
|
|
28
|
+
if (row.type !== 'result' && !('total_cost_usd' in row || 'stop_reason' in row)) continue;
|
|
29
|
+
const said = [row.result, ...(Array.isArray(row.errors) ? row.errors : [])]
|
|
30
|
+
.filter((value): value is string => typeof value === 'string' && value.trim() !== '')
|
|
31
|
+
.map(value => value.trim()).join(' ');
|
|
32
|
+
const kind = typeof row.subtype === 'string' && row.subtype !== 'success'
|
|
33
|
+
? row.subtype.replace(/^error_/, '').replace(/_/g, ' ') : undefined;
|
|
34
|
+
const reason = said || kind || (typeof row.stop_reason === 'string' ? `stop reason ${row.stop_reason}` : 'no reason given');
|
|
35
|
+
return reason.slice(0, 300);
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
19
40
|
export function providerExitFailure(command: string, stderr: string, stdout: string, code: number | null): string {
|
|
41
|
+
const reported = stderr.trim() ? undefined : providerResultFailure(stdout);
|
|
20
42
|
return providerUsageFailure(stderr)
|
|
21
|
-
?? `${command}
|
|
43
|
+
?? (reported ? `${basename(command)} stopped with code ${code}: ${reported}`
|
|
44
|
+
: `${command} exited with code ${code}: ${(stderr.trim() || stdout.trim()).slice(0, 300)}`);
|
|
22
45
|
}
|
|
@@ -7,6 +7,13 @@ import { interruptCodexDesktop } from '../codex-desktop';
|
|
|
7
7
|
|
|
8
8
|
const DELIVERY_TIMEOUT_MS = 240_000;
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Chats already asked to continue. A slow answer makes the phone's Resume look
|
|
12
|
+
* ignored, so it is tapped again; the second tap must not queue a second
|
|
13
|
+
* "continue" behind the first.
|
|
14
|
+
*/
|
|
15
|
+
const continuing = new Set<string>();
|
|
16
|
+
|
|
10
17
|
/** What the agent is told when the person lifts the hold and asks it to go on. */
|
|
11
18
|
export const RESUME_PROMPT =
|
|
12
19
|
"GrantTap: this chat was resumed in GrantTap. Continue the work you were doing before the pause; tool calls are allowed again.";
|
|
@@ -45,6 +52,11 @@ export async function controlTaskSession(
|
|
|
45
52
|
if (!session) {
|
|
46
53
|
return reply(true, "Resumed. This chat is not on this computer any more, so nothing was asked to continue.");
|
|
47
54
|
}
|
|
55
|
+
if (continuing.has(sessionId)) {
|
|
56
|
+
afterContinue();
|
|
57
|
+
return reply(true, "Resumed. This chat was already asked to continue.");
|
|
58
|
+
}
|
|
59
|
+
continuing.add(sessionId);
|
|
48
60
|
await reply(true, "Resumed and asked to continue.");
|
|
49
61
|
void deliverToSession(session, RESUME_PROMPT, DELIVERY_TIMEOUT_MS, [], { ignorePause: true })
|
|
50
62
|
.then((result) => {
|
|
@@ -53,7 +65,7 @@ export async function controlTaskSession(
|
|
|
53
65
|
}
|
|
54
66
|
})
|
|
55
67
|
.catch(() => {})
|
|
56
|
-
.finally(afterContinue);
|
|
68
|
+
.finally(() => { continuing.delete(sessionId); afterContinue(); });
|
|
57
69
|
}
|
|
58
70
|
|
|
59
71
|
export async function compactTaskSession(sessionId: string,
|
package/cursor-plugin/README.md
CHANGED
|
@@ -10,7 +10,7 @@ keeps each phone response tied to the exact originating chat and prompt.
|
|
|
10
10
|
Install the supported CLI on this computer, then run:
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
npm install -g granttap-mcp@0.8.
|
|
13
|
+
npm install -g granttap-mcp@0.8.138
|
|
14
14
|
granttap setup
|
|
15
15
|
granttap status
|
|
16
16
|
```
|
package/cursor-plugin/mcp.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"command": "node",
|
|
5
5
|
"args": [
|
|
6
6
|
"-e",
|
|
7
|
-
"\"use strict\";\n\n// Cursor may start this MCP from any cwd. Execute JavaScript entry points with\n// Node itself: Windows batch shims require shell quoting that differs by host.\nconst { spawn } = require(\"node:child_process\");\nconst { existsSync } = require(\"node:fs\");\nconst { delimiter, dirname, join } = require(\"node:path\");\n\nconst PACKAGE = \"granttap-mcp@0.8.
|
|
7
|
+
"\"use strict\";\n\n// Cursor may start this MCP from any cwd. Execute JavaScript entry points with\n// Node itself: Windows batch shims require shell quoting that differs by host.\nconst { spawn } = require(\"node:child_process\");\nconst { existsSync } = require(\"node:fs\");\nconst { delimiter, dirname, join } = require(\"node:path\");\n\nconst PACKAGE = \"granttap-mcp@0.8.138\";\nconst dryRun = process.env.GRANTTAP_BOOTSTRAP_DRY_RUN === \"1\";\nconst platform = dryRun && process.env.GRANTTAP_BOOTSTRAP_PLATFORM\n ? process.env.GRANTTAP_BOOTSTRAP_PLATFORM : process.platform;\nconst nodeRoot = dryRun && process.env.GRANTTAP_BOOTSTRAP_NODE_ROOT\n ? process.env.GRANTTAP_BOOTSTRAP_NODE_ROOT : dirname(process.execPath);\nconst pathRoots = (process.env.PATH || \"\").split(delimiter).filter(Boolean);\nconst appData = process.env.APPDATA;\nconst roots = [nodeRoot, ...pathRoots, ...(appData ? [join(appData, \"npm\")] : [])];\nconst first = (paths) => paths.find((path) => existsSync(path));\n\nfunction launch() {\n if (platform !== \"win32\") {\n const installed = first(roots.map((root) => join(root, \"granttap-mcp\")));\n if (installed) return { command: installed, args: [] };\n const npx = first(roots.map((root) => join(root, \"npx\"))) || \"npx\";\n return { command: npx, args: [\"-y\", PACKAGE] };\n }\n const installed = first(roots.map((root) =>\n join(root, \"node_modules\", \"granttap-mcp\", \"bin\", \"granttap-mcp.mjs\")));\n if (installed) return { command: process.execPath, args: [installed] };\n const npx = first(roots.map((root) =>\n join(root, \"node_modules\", \"npm\", \"bin\", \"npx-cli.js\")));\n if (npx) return { command: process.execPath, args: [npx, \"-y\", PACKAGE] };\n throw new Error(\"Node.js/npm 22.13.0+ is required on this Windows device. Install npm and retry GrantTap.\");\n}\n\nlet target;\ntry { target = launch(); }\ncatch (error) {\n process.stderr.write(`[granttap] ${error.message}\\n`);\n process.exit(1);\n}\n\nif (dryRun) {\n process.stdout.write(JSON.stringify(target));\n process.exit(0);\n}\n\nconst child = spawn(target.command, target.args, { stdio: \"inherit\", windowsHide: true });\nchild.on(\"error\", (error) => {\n process.stderr.write(`[granttap] ${error.message}\\n`);\n process.exit(1);\n});\nchild.on(\"exit\", (code, signal) => {\n if (signal && platform !== \"win32\") {\n try { process.kill(process.pid, signal); } catch { process.exit(code ?? 1); }\n return;\n }\n process.exit(code ?? 1);\n});\n"
|
|
8
8
|
]
|
|
9
9
|
}
|
|
10
10
|
}
|
|
@@ -7,7 +7,7 @@ const { spawn } = require("node:child_process");
|
|
|
7
7
|
const { existsSync } = require("node:fs");
|
|
8
8
|
const { delimiter, dirname, join } = require("node:path");
|
|
9
9
|
|
|
10
|
-
const PACKAGE = "granttap-mcp@0.8.
|
|
10
|
+
const PACKAGE = "granttap-mcp@0.8.138";
|
|
11
11
|
const dryRun = process.env.GRANTTAP_BOOTSTRAP_DRY_RUN === "1";
|
|
12
12
|
const platform = dryRun && process.env.GRANTTAP_BOOTSTRAP_PLATFORM
|
|
13
13
|
? process.env.GRANTTAP_BOOTSTRAP_PLATFORM : process.platform;
|