granttap-mcp 0.8.155 → 0.8.156
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/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/outbound-scheduler/README.md +7 -0
- package/packages/core/outbound-scheduler/index.ts +25 -2
- package/packages/core/relay-client.ts +7 -1
- package/packages/core/socket-lifecycle/upgrade-headers.ts +1 -1
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.156
|
|
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.156\";\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.156";
|
|
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
|
@@ -12,6 +12,13 @@ Disconnect rejects the current write as well as queued frames. Catalog and
|
|
|
12
12
|
history publishers can retry on the next connection even if the previous
|
|
13
13
|
socket never calls its write-completion callback.
|
|
14
14
|
|
|
15
|
+
Supporting relays negotiate an ingress window and cumulative read receipts.
|
|
16
|
+
At most 64 frames then wait for relay reads, in addition to the existing pace.
|
|
17
|
+
Short TCP buffering or a slow relay cannot release several seconds of ordinary
|
|
18
|
+
traffic as one excessive burst. Controls retain queue priority and reconnecting
|
|
19
|
+
creates a new counter generation. Managed admission renewals use their separate
|
|
20
|
+
control lane. A read receipt proves no persistence, decryption or task delivery.
|
|
21
|
+
|
|
15
22
|
Tests live in `tests/`; they include an actual WebSocket server with the relay's
|
|
16
23
|
rate limit. A socket write is transport evidence, never an approval receipt.
|
|
17
24
|
|
|
@@ -17,9 +17,30 @@ export class OutboundFrameQueue {
|
|
|
17
17
|
private closed = false;
|
|
18
18
|
private timer?: NodeJS.Timeout;
|
|
19
19
|
private nextAt = 0;
|
|
20
|
+
private ingressWindow?: number;
|
|
21
|
+
private sentFrames = 0;
|
|
22
|
+
private receivedFrames = 0;
|
|
20
23
|
|
|
21
24
|
constructor(private readonly write: (frame: string) => Promise<void>, private readonly intervalMs = 6) {}
|
|
22
25
|
|
|
26
|
+
/** Read receipts bound TCP bursts; they never acknowledge application delivery. */
|
|
27
|
+
enableIngressWindow(window: number | undefined): void {
|
|
28
|
+
if (!Number.isSafeInteger(window) || window! < 16) return;
|
|
29
|
+
this.ingressWindow = Math.min(window!, 64);
|
|
30
|
+
this.schedule();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
acknowledgeIngress(received: number): void {
|
|
34
|
+
if (this.ingressWindow === undefined || !Number.isSafeInteger(received)
|
|
35
|
+
|| received <= this.receivedFrames || received > this.sentFrames) return;
|
|
36
|
+
this.receivedFrames = received;
|
|
37
|
+
this.schedule();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
private get hasIngressCredit(): boolean {
|
|
41
|
+
return this.ingressWindow === undefined || this.sentFrames - this.receivedFrames < this.ingressWindow;
|
|
42
|
+
}
|
|
43
|
+
|
|
23
44
|
send(frame: string, urgent = false): Promise<void> {
|
|
24
45
|
if (this.closed) return Promise.reject(CLOSED());
|
|
25
46
|
const bytes = Buffer.byteLength(frame);
|
|
@@ -45,18 +66,20 @@ export class OutboundFrameQueue {
|
|
|
45
66
|
}
|
|
46
67
|
|
|
47
68
|
private schedule(): void {
|
|
48
|
-
if (this.closed || this.running || this.timer ||
|
|
69
|
+
if (this.closed || this.running || this.timer || !this.hasIngressCredit
|
|
70
|
+
|| (!this.controls.length && !this.snapshots.length)) return;
|
|
49
71
|
this.timer = setTimeout(() => { this.timer = undefined; void this.pump(); },
|
|
50
72
|
Math.max(0, this.nextAt - performance.now()));
|
|
51
73
|
}
|
|
52
74
|
|
|
53
75
|
private async pump(): Promise<void> {
|
|
54
|
-
if (this.closed) return;
|
|
76
|
+
if (this.closed || !this.hasIngressCredit) return;
|
|
55
77
|
const job = this.controls.shift() ?? this.snapshots.shift();
|
|
56
78
|
if (!job) return;
|
|
57
79
|
this.running = true;
|
|
58
80
|
this.inFlight = job;
|
|
59
81
|
this.bytes -= job.bytes;
|
|
82
|
+
this.sentFrames += 1;
|
|
60
83
|
try {
|
|
61
84
|
await this.write(job.frame);
|
|
62
85
|
if (this.closed) throw CLOSED();
|
|
@@ -144,10 +144,16 @@ export class RelayClient {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
private async onRaw(raw: string): Promise<void> {
|
|
147
|
-
const control = parseRelayControl(raw) as { type?: string; recipientRouting?: boolean; retainedState?: boolean;
|
|
147
|
+
const control = parseRelayControl(raw) as { type?: string; recipientRouting?: boolean; retainedState?: boolean;
|
|
148
|
+
retainedStateGroups?: boolean; ingressWindow?: number; received?: number } | null;
|
|
148
149
|
if (control?.type === "relay.capabilities" && control.recipientRouting === true) {
|
|
149
150
|
this.recipientRouting = true;
|
|
150
151
|
this.retainedState = control.retainedState === true && control.retainedStateGroups === true;
|
|
152
|
+
this.frames?.enableIngressWindow(control.ingressWindow);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (control?.type === 'relay.ingress') {
|
|
156
|
+
if (typeof control.received === 'number') this.frames?.acknowledgeIngress(control.received);
|
|
151
157
|
return;
|
|
152
158
|
}
|
|
153
159
|
if (control?.type === "relay.task-job") {
|
|
@@ -3,7 +3,7 @@ import { publicKeyIdentifier } from '../ciphertext-recipient';
|
|
|
3
3
|
|
|
4
4
|
/** Bind optional mailbox routing to this endpoint's real encryption identity. */
|
|
5
5
|
export function relayUpgradeHeaders(cfg: PeerConfig, admission: Record<string, string>, durableReceiver: boolean) {
|
|
6
|
-
return { ...admission, 'X-GrantTap-Recipient-Routing': '1',
|
|
6
|
+
return { ...admission, 'X-GrantTap-Recipient-Routing': '1', 'X-GrantTap-Ingress-Flow': '1',
|
|
7
7
|
'X-GrantTap-Recipient-Key-Id': publicKeyIdentifier(cfg.myPublicKey),
|
|
8
8
|
...(durableReceiver ? { 'X-GrantTap-Task-Dispatch': '1' } : {}),
|
|
9
9
|
...(cfg.pushAuth ? { Authorization: `Bearer ${cfg.pushAuth}` } : {}) };
|