granttap-mcp 0.8.151 → 0.8.153
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/apps/bridge/src/sessions/telemetry/command-preview.ts +1 -1
- package/cursor-plugin/README.md +1 -1
- package/cursor-plugin/mcp.json +1 -1
- package/cursor-plugin/stdio-bootstrap.cjs +1 -1
- package/package.json +1 -1
- package/packages/core/relay-client.ts +1 -1
- package/packages/core/socket-lifecycle/README.md +5 -0
- package/packages/core/socket-lifecycle/relay-socket-health.ts +35 -4
|
@@ -85,7 +85,7 @@ function redactCommandSecrets(raw: string): string {
|
|
|
85
85
|
`$1${REDACTED_COMMAND_VALUE}`,
|
|
86
86
|
);
|
|
87
87
|
value = value.replace(
|
|
88
|
-
/([a-z][a-z0-9+.-]*:\/\/)[^\s/@:]+:[^\s/@]+@/gi,
|
|
88
|
+
/(?<![a-z0-9+.-])([a-z][a-z0-9+.-]*:\/\/)[^\s/@:]+:[^\s/@]+@/gi,
|
|
89
89
|
`$1${REDACTED_COMMAND_VALUE}@`,
|
|
90
90
|
);
|
|
91
91
|
value = value.replace(
|
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.153
|
|
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.153\";\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.153";
|
|
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;
|
package/package.json
CHANGED
|
@@ -97,7 +97,7 @@ export class RelayClient {
|
|
|
97
97
|
this.linkWatch.opened();
|
|
98
98
|
clearTimeout(timer);
|
|
99
99
|
openedAt = Date.now();
|
|
100
|
-
this.socketHealth.start(ws, this.opts.pingIntervalMs ?? 20_000);
|
|
100
|
+
this.socketHealth.start(ws, this.opts.pingIntervalMs ?? 20_000, this.opts.pongTimeoutMs);
|
|
101
101
|
this.admissionLease.start(ws, this.opts);
|
|
102
102
|
// Announce ourselves. The envelope's cleartext (room, from) is what the
|
|
103
103
|
// relay uses to register this socket; the Hello body stays encrypted.
|
|
@@ -6,6 +6,11 @@ socket and does not rotate task keys or reload transcript state. A failed lookup
|
|
|
6
6
|
cannot extend the server's signed expiry. Closing or replacing a socket cancels
|
|
7
7
|
only its own timers.
|
|
8
8
|
|
|
9
|
+
Network health honors the configured pong deadline independently of ping cadence.
|
|
10
|
+
Pongs, relay pings and inbound frames prove transport liveness. Deadline checks
|
|
11
|
+
allow buffered I/O to run after a busy event loop; stopping or replacing a socket
|
|
12
|
+
removes its health listeners and cancels its deadline.
|
|
13
|
+
|
|
9
14
|
Reconnect pacing resets only after a non-policy connection lived at least 30
|
|
10
15
|
seconds. Short handshakes keep exponential backoff and jitter. WebSocket
|
|
11
16
|
`retry-after` reasons and HTTP `Retry-After` are lower bounds even when they
|
|
@@ -4,26 +4,57 @@ import WebSocket from "ws";
|
|
|
4
4
|
export class RelaySocketHealth {
|
|
5
5
|
private socket?: WebSocket;
|
|
6
6
|
private timer?: NodeJS.Timeout;
|
|
7
|
+
private deadline?: NodeJS.Timeout;
|
|
8
|
+
private release?: () => void;
|
|
7
9
|
private awaitingPong = false;
|
|
8
10
|
|
|
9
|
-
start(socket: WebSocket, interval: number): void {
|
|
11
|
+
start(socket: WebSocket, interval: number, timeout = interval): void {
|
|
10
12
|
this.stop();
|
|
11
13
|
this.socket = socket;
|
|
12
|
-
|
|
14
|
+
const alive = () => {
|
|
15
|
+
if (this.socket !== socket) return;
|
|
16
|
+
this.awaitingPong = false;
|
|
17
|
+
clearTimeout(this.deadline);
|
|
18
|
+
this.deadline = undefined;
|
|
19
|
+
};
|
|
20
|
+
socket.on("pong", alive);
|
|
21
|
+
socket.on("ping", alive);
|
|
22
|
+
socket.on("message", alive);
|
|
23
|
+
const closed = () => this.stop(socket);
|
|
24
|
+
socket.once("close", closed);
|
|
25
|
+
this.release = () => {
|
|
26
|
+
socket.off("pong", alive);
|
|
27
|
+
socket.off("ping", alive);
|
|
28
|
+
socket.off("message", alive);
|
|
29
|
+
socket.off("close", closed);
|
|
30
|
+
};
|
|
13
31
|
this.timer = setInterval(() => {
|
|
14
32
|
if (this.socket !== socket || socket.readyState !== WebSocket.OPEN) { this.stop(socket); return; }
|
|
15
|
-
if (this.awaitingPong)
|
|
33
|
+
if (this.awaitingPong) return;
|
|
16
34
|
this.awaitingPong = true;
|
|
35
|
+
const deadline = setTimeout(() => {
|
|
36
|
+
// Process buffered network evidence after a busy event loop before declaring the link dead.
|
|
37
|
+
setImmediate(() => {
|
|
38
|
+
if (this.socket !== socket || this.deadline !== deadline || !this.awaitingPong) return;
|
|
39
|
+
this.stop(socket);
|
|
40
|
+
socket.terminate();
|
|
41
|
+
});
|
|
42
|
+
}, timeout);
|
|
43
|
+
this.deadline = deadline;
|
|
44
|
+
this.deadline.unref();
|
|
17
45
|
try { socket.ping(); }
|
|
18
46
|
catch { this.stop(socket); socket.terminate(); }
|
|
19
47
|
}, interval);
|
|
20
48
|
this.timer.unref();
|
|
21
|
-
socket.once("close", () => this.stop(socket));
|
|
22
49
|
}
|
|
23
50
|
|
|
24
51
|
stop(socket?: WebSocket): void {
|
|
25
52
|
if (socket && this.socket !== socket) return;
|
|
26
53
|
if (this.timer) clearInterval(this.timer);
|
|
54
|
+
clearTimeout(this.deadline);
|
|
55
|
+
this.release?.();
|
|
56
|
+
this.release = undefined;
|
|
57
|
+
this.deadline = undefined;
|
|
27
58
|
this.timer = undefined;
|
|
28
59
|
this.socket = undefined;
|
|
29
60
|
this.awaitingPong = false;
|