granttap-mcp 0.8.159 → 0.8.160
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/mesh/runtime/graph/README.md +14 -0
- package/apps/bridge/src/mesh/runtime/graph/analysis.ts +10 -3
- package/apps/bridge/src/mesh/runtime/snapshot/fit.ts +43 -20
- 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
|
@@ -18,6 +18,12 @@ computer analyzes only its own endpoint bindings. Failed bindings remain visible
|
|
|
18
18
|
projection and phone refresh use this rule. The graph contains actual Engine
|
|
19
19
|
analysis; unavailable analysis is never synthesized as a successful graph.
|
|
20
20
|
|
|
21
|
+
A folder that no longer exists is not analyzed. When this computer's bindings
|
|
22
|
+
are only such folders, an explicit build still answers and names each one
|
|
23
|
+
`REPOSITORY_NOT_LOCAL`, which the phone already explains; the build used to get
|
|
24
|
+
no reply and failed after its 150-second wait. Beside a real checkout a removed
|
|
25
|
+
folder stays out of the report.
|
|
26
|
+
|
|
21
27
|
After repository analysis, explicit builds request bounded cross-repository
|
|
22
28
|
contract matches from the same admitted bindings. These are projected as shared
|
|
23
29
|
static contracts with an unverified runtime target. Background snapshots reuse
|
|
@@ -25,6 +31,14 @@ fresh in-memory results; they do not queue additional multi-repository scans.
|
|
|
25
31
|
A verified Backbone remains authoritative. Project identities and grants are
|
|
26
32
|
preserved.
|
|
27
33
|
|
|
34
|
+
Every phone-bound snapshot, the build's reply included, is fitted to the 256 KiB
|
|
35
|
+
plaintext envelope every iPhone build enforces (`../snapshot/fit.ts`); a larger
|
|
36
|
+
reply crossed the relay and was dropped on the phone, so the build spun and then
|
|
37
|
+
failed. Graphs take the room the rest leaves. Repository details and the oldest
|
|
38
|
+
events and executions, which the phone merges from earlier snapshots, make way
|
|
39
|
+
before the Graph falls below half of it. Every repository keeps its entry, so a
|
|
40
|
+
requested build is always answered.
|
|
41
|
+
|
|
28
42
|
Behavior tests: `tests/`, root `tests/graph/graph-binding-sync.test.ts`, and
|
|
29
43
|
`apps/mcp/src/desktop/projection/tests/graph-refresh.test.ts`. The optional
|
|
30
44
|
`engine-selection-live.test.ts` uses `GRANTTAP_ENGINE_TEST_BINARY` to verify the
|
|
@@ -64,7 +64,13 @@ export async function analyzeProjectGraphNow(
|
|
|
64
64
|
const own = (current.bindings ?? []).find(binding => binding.repositoryId === current.project.canonicalRepositoryId
|
|
65
65
|
&& (!endpoint || binding.endpointId === endpoint) && binding.available && binding.localPathHint
|
|
66
66
|
&& existsSync(binding.localPathHint) && !bindings.some(selected => selected.repositoryId === binding.repositoryId));
|
|
67
|
-
|
|
67
|
+
// A removed folder is named only when it is all this computer holds: the phone's build would otherwise
|
|
68
|
+
// wait for an answer that never came, while beside a real checkout it would only crowd Health.
|
|
69
|
+
const removed = bindings.length || failures.length || own ? [] : [...new Set((current.bindings ?? [])
|
|
70
|
+
.filter(binding => (!endpoint || binding.endpointId === endpoint) && binding.available
|
|
71
|
+
&& binding.localPathHint && !existsSync(binding.localPathHint)).map(binding => binding.repositoryId))];
|
|
72
|
+
if (dependencies.endpoint && !bindings.length && !failures.length && !own && !removed.length
|
|
73
|
+
&& current.bindings?.length) return false;
|
|
68
74
|
const [backbone, repositoryGraphs, details] = await Promise.all([
|
|
69
75
|
dependencies.backbone(projectId),
|
|
70
76
|
dependencies.graphs(projectId, bindings, { background: false }),
|
|
@@ -85,8 +91,9 @@ export async function analyzeProjectGraphNow(
|
|
|
85
91
|
const reported = new Set(observed.map(report => report.repositoryId));
|
|
86
92
|
const unfinished = [...new Set(bindings.map(binding => binding.repositoryId))]
|
|
87
93
|
.filter(id => !reported.has(id)).map(id => unavailable(id, "ANALYSIS_NOT_FINISHED"));
|
|
88
|
-
const
|
|
89
|
-
|
|
94
|
+
const folders = [...(own ? [unavailable(own.repositoryId, "GIT_CHECKOUT_REQUIRED")] : []),
|
|
95
|
+
...removed.map(id => unavailable(id, "REPOSITORY_NOT_LOCAL"))];
|
|
96
|
+
const reports = observed.length + unfinished.length + folders.length > 0 ? [...observed, ...unfinished, ...folders]
|
|
90
97
|
: [unavailable(current.project.canonicalRepositoryId, "REPOSITORY_NOT_BOUND")];
|
|
91
98
|
const receipts = requestIds?.size ? requestIds : new Set<string | undefined>([undefined]);
|
|
92
99
|
for (const id of receipts) {
|
|
@@ -2,34 +2,57 @@ import type { MeshSnapshot, ProjectRepositoryGraph } from "../../../../../../pac
|
|
|
2
2
|
import { fitRepositoryGraph } from "../../../engine/runtime/repository-graph/fit";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Every iPhone build drops a Mesh snapshot whose plaintext is larger than 256 KiB. Fitting only to the
|
|
6
|
+
* relay's 1.8 MB stored-frame limit let a requested Graph reach the phone and vanish there: the build
|
|
7
|
+
* spun until it failed, on exactly the Projects with the most work in them. The relay limit is far above this.
|
|
7
8
|
*/
|
|
8
|
-
export const MESH_SNAPSHOT_BUDGET_BYTES =
|
|
9
|
+
export const MESH_SNAPSHOT_BUDGET_BYTES = 256 * 1_024;
|
|
10
|
+
/** A busy Project's Graph keeps half the envelope before its older events and executions are left out. */
|
|
11
|
+
const GRAPH_FLOOR_BYTES = 128 * 1_024;
|
|
9
12
|
|
|
10
13
|
const size = (value: unknown) => Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
/** The repository stays named, so the phone's requested build is answered rather than left waiting. */
|
|
16
|
+
function emptied(graph: ProjectRepositoryGraph): ProjectRepositoryGraph {
|
|
17
|
+
return { ...graph, codeMap: undefined, architectureHypotheses: undefined, nodes: [], relations: [], truncated: true };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Fair shares of the room, smallest reports first so an unused share passes to the larger ones. */
|
|
21
|
+
function fitGraphs(graphs: ProjectRepositoryGraph[], room: number): ProjectRepositoryGraph[] {
|
|
22
|
+
const fitted = [...graphs];
|
|
23
|
+
const order = graphs.map((graph, index) => ({ index, bytes: size(graph) })).sort((a, b) => a.bytes - b.bytes);
|
|
24
|
+
let remaining = room - graphs.length;
|
|
25
|
+
for (const [position, { index, bytes }] of order.entries()) {
|
|
26
|
+
const graph = graphs[index]!;
|
|
27
|
+
const share = Math.floor(remaining / (graphs.length - position));
|
|
28
|
+
const kept = bytes <= share ? graph : share >= 1_024 ? fitRepositoryGraph(graph, share) : undefined;
|
|
29
|
+
fitted[index] = kept === graph ? graph : kept ? { ...kept, truncated: true } : emptied(graph);
|
|
30
|
+
remaining -= size(fitted[index]);
|
|
31
|
+
}
|
|
32
|
+
return fitted;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The phone merges these by id, so an earlier snapshot already gave it the oldest ones. */
|
|
36
|
+
function withoutOldest(snapshot: MeshSnapshot, key: "events" | "executions", maxBytes: number): MeshSnapshot {
|
|
37
|
+
let excess = size(snapshot) - maxBytes;
|
|
38
|
+
if (excess <= 0) return snapshot;
|
|
39
|
+
const items: unknown[] = snapshot[key];
|
|
40
|
+
let cut = 0;
|
|
41
|
+
while (cut < items.length && excess > 0) excess -= size(items[cut++]) + 1;
|
|
42
|
+
return { ...snapshot, [key]: items.slice(cut) };
|
|
15
43
|
}
|
|
16
44
|
|
|
17
45
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* its tasks and its people are never cut here.
|
|
46
|
+
* Graphs are shrunk into the room the rest leaves, but not below their floor while repository details,
|
|
47
|
+
* older events and older executions can make way. The Project, its Tasks and its people are never cut.
|
|
21
48
|
*/
|
|
22
49
|
export function fitMeshSnapshot(snapshot: MeshSnapshot, maxBytes = MESH_SNAPSHOT_BUDGET_BYTES): MeshSnapshot {
|
|
23
50
|
if (size(snapshot) <= maxBytes) return snapshot;
|
|
24
|
-
const graphs = snapshot.repositoryGraphs
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
fitted = { ...fitted, repositoryDetails: undefined };
|
|
32
|
-
if (size(fitted) <= maxBytes) return fitted;
|
|
33
|
-
}
|
|
34
|
-
return { ...fitted, repositoryGraphs: undefined, repositoryDetails: undefined };
|
|
51
|
+
const graphs = snapshot.repositoryGraphs;
|
|
52
|
+
const floor = Math.min(graphs ? size(graphs) : 0, GRAPH_FLOOR_BYTES);
|
|
53
|
+
let rest: MeshSnapshot = { ...snapshot, repositoryGraphs: graphs?.map(emptied) };
|
|
54
|
+
if (size(rest) + floor > maxBytes && rest.repositoryDetails) rest = { ...rest, repositoryDetails: undefined };
|
|
55
|
+
rest = withoutOldest(withoutOldest(rest, "events", maxBytes - floor), "executions", maxBytes - floor);
|
|
56
|
+
if (!graphs) return rest;
|
|
57
|
+
return { ...rest, repositoryGraphs: fitGraphs(graphs, maxBytes - size({ ...rest, repositoryGraphs: [] })) };
|
|
35
58
|
}
|
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.160
|
|
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.160\";\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.160";
|
|
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;
|