@ttsc/graph 0.23.0 → 0.25.0
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/README.md +1 -1
- package/lib/index.js +36 -0
- package/lib/index.js.map +1 -1
- package/lib/model/TtscGraphMemory.d.ts +1 -1
- package/lib/model/TtscGraphMemory.js +16 -13
- package/lib/model/TtscGraphMemory.js.map +1 -1
- package/lib/model/TtscGraphSession.d.ts +2 -6
- package/lib/model/TtscGraphSession.js +414 -235
- package/lib/model/TtscGraphSession.js.map +1 -1
- package/lib/model/TtscGraphShardStore.d.ts +16 -0
- package/lib/model/TtscGraphShardStore.js +272 -0
- package/lib/model/TtscGraphShardStore.js.map +1 -0
- package/lib/model/loadGraph.js +68 -61
- package/lib/model/loadGraph.js.map +1 -1
- package/lib/nativeExecutable.d.ts +22 -0
- package/lib/nativeExecutable.js +76 -0
- package/lib/nativeExecutable.js.map +1 -1
- package/lib/server/runDetails.js +4 -9
- package/lib/server/runDetails.js.map +1 -1
- package/lib/server/runEntrypoints.js +4 -7
- package/lib/server/runEntrypoints.js.map +1 -1
- package/lib/server/runLookup.js +1 -1
- package/lib/server/runLookup.js.map +1 -1
- package/lib/server/runOverview.js +3 -3
- package/lib/server/runOverview.js.map +1 -1
- package/lib/server/runTour.js +7 -11
- package/lib/server/runTour.js.map +1 -1
- package/lib/server/runTrace.d.ts +4 -5
- package/lib/server/runTrace.js +10 -19
- package/lib/server/runTrace.js.map +1 -1
- package/lib/structures/ITtscGraphDump.d.ts +8 -2
- package/lib/structures/ITtscGraphNode.d.ts +1 -2
- package/lib/structures/ITtscGraphSnapshot.d.ts +37 -1
- package/lib/structures/TtscGraphDumpEdgeKind.d.ts +2 -0
- package/lib/structures/TtscGraphDumpEdgeKind.js +3 -0
- package/lib/structures/TtscGraphDumpEdgeKind.js.map +1 -0
- package/lib/structures/TtscGraphDumpNodeKind.d.ts +2 -0
- package/lib/structures/TtscGraphDumpNodeKind.js +3 -0
- package/lib/structures/TtscGraphDumpNodeKind.js.map +1 -0
- package/lib/structures/TtscGraphEdgeKind.d.ts +8 -6
- package/lib/structures/TtscGraphNodeKind.d.ts +5 -6
- package/lib/structures/TtscGraphNodeModifier.d.ts +1 -1
- package/lib/structures/index.d.ts +2 -0
- package/lib/structures/index.js +2 -0
- package/lib/structures/index.js.map +1 -1
- package/lib/view.js +17 -2
- package/lib/view.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +40 -0
- package/src/model/TtscGraphMemory.ts +10 -8
- package/src/model/TtscGraphSession.ts +64 -47
- package/src/model/TtscGraphShardStore.ts +371 -0
- package/src/model/loadGraph.ts +20 -13
- package/src/nativeExecutable.ts +83 -0
- package/src/server/runDetails.ts +5 -10
- package/src/server/runEntrypoints.ts +4 -7
- package/src/server/runLookup.ts +1 -1
- package/src/server/runOverview.ts +3 -3
- package/src/server/runTour.ts +8 -14
- package/src/server/runTrace.ts +10 -19
- package/src/structures/ITtscGraphDump.ts +10 -2
- package/src/structures/ITtscGraphNode.ts +1 -2
- package/src/structures/ITtscGraphSnapshot.ts +42 -1
- package/src/structures/TtscGraphDumpEdgeKind.ts +11 -0
- package/src/structures/TtscGraphDumpNodeKind.ts +10 -0
- package/src/structures/TtscGraphEdgeKind.ts +8 -9
- package/src/structures/TtscGraphNodeKind.ts +5 -11
- package/src/structures/TtscGraphNodeModifier.ts +1 -2
- package/src/structures/index.ts +2 -0
- package/src/view.ts +21 -7
|
@@ -37,10 +37,46 @@ export interface ITtscGraphSnapshot {
|
|
|
37
37
|
changed: boolean;
|
|
38
38
|
/** The snapshot, present exactly when `changed` is true. */
|
|
39
39
|
dump?: ITtscGraphDump;
|
|
40
|
+
/** Native graph-shard transaction, present for an opted-in changed request. */
|
|
41
|
+
snapshot?: ITtscGraphSnapshot.ITransaction;
|
|
40
42
|
/** Set when the request produced no snapshot; `mode` is then `"error"`. */
|
|
41
43
|
error?: string;
|
|
42
44
|
}
|
|
43
45
|
export declare namespace ITtscGraphSnapshot {
|
|
46
|
+
/** Versioned content-addressed transaction emitted by `ttscgraph serve`. */
|
|
47
|
+
interface ITransaction {
|
|
48
|
+
protocolVersion: number;
|
|
49
|
+
schemaVersion: number;
|
|
50
|
+
project: string;
|
|
51
|
+
tsconfig: string;
|
|
52
|
+
producer: ITtscGraphDump.IProducer;
|
|
53
|
+
capabilities: string[];
|
|
54
|
+
universe: ITtscGraphDump.IUniverse;
|
|
55
|
+
sequence: number;
|
|
56
|
+
generation: string;
|
|
57
|
+
baseSequence?: number;
|
|
58
|
+
baseGeneration?: string;
|
|
59
|
+
upserts: IShardUpsert[];
|
|
60
|
+
deletes: string[];
|
|
61
|
+
manifest: IShardReference[];
|
|
62
|
+
}
|
|
63
|
+
interface IShardUpsert {
|
|
64
|
+
digest: string;
|
|
65
|
+
shard: IShard;
|
|
66
|
+
}
|
|
67
|
+
interface IShardReference {
|
|
68
|
+
key: string;
|
|
69
|
+
digest: string;
|
|
70
|
+
}
|
|
71
|
+
/** One source/config or metadata-owned raw compiler fact shard. */
|
|
72
|
+
interface IShard {
|
|
73
|
+
key: string;
|
|
74
|
+
source?: ITtscGraphDump.ISourceDigest;
|
|
75
|
+
config?: ITtscGraphDump.IFileDigest;
|
|
76
|
+
nodes: ITtscGraphDump.INode[];
|
|
77
|
+
edges: ITtscGraphDump.IEdge[];
|
|
78
|
+
diagnostics: ITtscGraphDump.IDiagnostic[];
|
|
79
|
+
}
|
|
44
80
|
/**
|
|
45
81
|
* The computation modes the producer reports, plus the transport's `error`.
|
|
46
82
|
*
|
|
@@ -48,7 +84,7 @@ export declare namespace ITtscGraphSnapshot {
|
|
|
48
84
|
* - `reload`: the build universe moved, so the program was reloaded whole.
|
|
49
85
|
* - `unchanged`: nothing moved; no dump rides it and the last one still holds.
|
|
50
86
|
* - `incremental`: edits applied onto the reused resident program.
|
|
51
|
-
* - `rebuild`: edits applied, but
|
|
87
|
+
* - `rebuild`: edits applied, but graph projection required a complete build.
|
|
52
88
|
* - `error`: no snapshot was produced.
|
|
53
89
|
*/
|
|
54
90
|
type Mode = "initial" | "reload" | "unchanged" | "incremental" | "rebuild" | "error";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TtscGraphDumpEdgeKind.js","sourceRoot":"","sources":["../../src/structures/TtscGraphDumpEdgeKind.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TtscGraphDumpNodeKind.js","sourceRoot":"","sources":["../../src/structures/TtscGraphDumpNodeKind.ts"],"names":[],"mappings":""}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The relationship a directed edge encodes between two {@link ITtscGraphNode}s.
|
|
3
3
|
*
|
|
4
|
-
* Structural
|
|
5
|
-
*
|
|
4
|
+
* Structural `exports` edges come from the native declaration pass, while the
|
|
5
|
+
* TypeScript memory layer synthesizes `contains` ownership. Value and type
|
|
6
|
+
* edges (`calls`, `accesses`, `instantiates`, `type_ref`,
|
|
6
7
|
* `extends`, `implements`, `overrides`, `renders`) are resolved by the checker
|
|
7
|
-
* — `renders` is a JSX component use.
|
|
8
|
-
*
|
|
8
|
+
* — `renders` is a JSX component use. Decorators are facts on their target node,
|
|
9
|
+
* not edges.
|
|
9
10
|
*
|
|
10
11
|
* `dispatches` is the runtime counterpart of `overrides`/`implements`: the
|
|
11
12
|
* checker resolves a call to the declaration it names, and where that
|
|
12
13
|
* declaration is abstract or an interface member, the code that runs is its
|
|
13
14
|
* implementation. It carries the implementation's declaration span, and a
|
|
14
|
-
* traversal that follows what executes emits it in place of the dead end.
|
|
15
|
+
* traversal that follows what executes emits it in place of the dead end. It is
|
|
16
|
+
* trace-only and never appears in a native dump.
|
|
15
17
|
*/
|
|
16
|
-
export type TtscGraphEdgeKind = "contains" | "exports" | "
|
|
18
|
+
export type TtscGraphEdgeKind = "contains" | "exports" | "calls" | "accesses" | "instantiates" | "type_ref" | "extends" | "implements" | "overrides" | "dispatches" | "renders";
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What a graph node represents.
|
|
3
3
|
*
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* internals.
|
|
4
|
+
* The native builder emits declaration kinds from `module` through `method`.
|
|
5
|
+
* The TypeScript memory layer replaces each module with a `file` container and
|
|
6
|
+
* refines class/interface member variables to `property`. An external boundary
|
|
7
|
+
* leaf keeps its real declaration kind and sets `external: true`.
|
|
9
8
|
*
|
|
10
9
|
* Used as the `kind` discriminant on {@link ITtscGraphNode}.
|
|
11
10
|
*/
|
|
12
|
-
export type TtscGraphNodeKind = "file" | "
|
|
11
|
+
export type TtscGraphNodeKind = "file" | "function" | "class" | "interface" | "type" | "enum" | "variable" | "method" | "property";
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* and shape — e.g. a public-API overview filters on `export`, a class outline
|
|
5
5
|
* separates `static` members.
|
|
6
6
|
*/
|
|
7
|
-
export type TtscGraphNodeModifier = "export" | "default" | "declare" | "abstract" | "static" | "readonly" | "async" | "const" | "public" | "private" | "protected"
|
|
7
|
+
export type TtscGraphNodeModifier = "export" | "default" | "declare" | "abstract" | "static" | "readonly" | "async" | "const" | "public" | "private" | "protected";
|
|
@@ -15,5 +15,7 @@ export * from "./ITtscGraphSnapshot";
|
|
|
15
15
|
export * from "./ITtscGraphSpan";
|
|
16
16
|
export * from "./ITtscGraphTour";
|
|
17
17
|
export * from "./TtscGraphEdgeKind";
|
|
18
|
+
export * from "./TtscGraphDumpEdgeKind";
|
|
19
|
+
export * from "./TtscGraphDumpNodeKind";
|
|
18
20
|
export * from "./TtscGraphNodeKind";
|
|
19
21
|
export * from "./TtscGraphNodeModifier";
|
package/lib/structures/index.js
CHANGED
|
@@ -36,6 +36,8 @@ __exportStar(require("./ITtscGraphSnapshot"), exports);
|
|
|
36
36
|
__exportStar(require("./ITtscGraphSpan"), exports);
|
|
37
37
|
__exportStar(require("./ITtscGraphTour"), exports);
|
|
38
38
|
__exportStar(require("./TtscGraphEdgeKind"), exports);
|
|
39
|
+
__exportStar(require("./TtscGraphDumpEdgeKind"), exports);
|
|
40
|
+
__exportStar(require("./TtscGraphDumpNodeKind"), exports);
|
|
39
41
|
__exportStar(require("./TtscGraphNodeKind"), exports);
|
|
40
42
|
__exportStar(require("./TtscGraphNodeModifier"), exports);
|
|
41
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/structures/index.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,0EAA0E;AAC1E,8EAA8E;AAC9E,gFAAgF;AAChF,6BAA6B;;;;;;;;;;;;;;;;AAE7B,0DAAwC;AACxC,wDAAsC;AACtC,mDAAiC;AACjC,mDAAiC;AACjC,uDAAqC;AACrC,qDAAmC;AACnC,sDAAoC;AACpC,0DAAwC;AACxC,mDAAiC;AACjC,uDAAqC;AACrC,qDAAmC;AACnC,mDAAiC;AACjC,oDAAkC;AAClC,uDAAqC;AACrC,mDAAiC;AACjC,mDAAiC;AACjC,sDAAoC;AACpC,sDAAoC;AACpC,0DAAwC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/structures/index.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,0EAA0E;AAC1E,8EAA8E;AAC9E,gFAAgF;AAChF,6BAA6B;;;;;;;;;;;;;;;;AAE7B,0DAAwC;AACxC,wDAAsC;AACtC,mDAAiC;AACjC,mDAAiC;AACjC,uDAAqC;AACrC,qDAAmC;AACnC,sDAAoC;AACpC,0DAAwC;AACxC,mDAAiC;AACjC,uDAAqC;AACrC,qDAAmC;AACnC,mDAAiC;AACjC,oDAAkC;AAClC,uDAAqC;AACrC,mDAAiC;AACjC,mDAAiC;AACjC,sDAAoC;AACpC,0DAAwC;AACxC,0DAAwC;AACxC,sDAAoC;AACpC,0DAAwC"}
|
package/lib/view.js
CHANGED
|
@@ -52,7 +52,22 @@ function runView(argv) {
|
|
|
52
52
|
}
|
|
53
53
|
(0, nativeExecutable_1.ensureExecutable)(binary);
|
|
54
54
|
process.stderr.write(`@ttsc/graph: building the graph for ${opts.cwd} (${opts.tsconfig})...\n`);
|
|
55
|
-
|
|
55
|
+
// The dump goes to a file rather than a pipe, so no output ceiling applies.
|
|
56
|
+
const capture = (0, nativeExecutable_1.captureProcessOutput)();
|
|
57
|
+
let dump;
|
|
58
|
+
let dumpStdout;
|
|
59
|
+
let dumpStderr;
|
|
60
|
+
try {
|
|
61
|
+
dump = (0, node_child_process_1.spawnSync)(binary, ["dump", "--cwd", opts.cwd, "--tsconfig", opts.tsconfig], {
|
|
62
|
+
stdio: ["ignore", capture.stdoutFd, capture.stderrFd],
|
|
63
|
+
windowsHide: true,
|
|
64
|
+
});
|
|
65
|
+
dumpStdout = capture.read("stdout");
|
|
66
|
+
dumpStderr = capture.read("stderr");
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
capture.dispose();
|
|
70
|
+
}
|
|
56
71
|
if (dump.error) {
|
|
57
72
|
process.stderr.write(`@ttsc/graph: ${dump.error.message}\n`);
|
|
58
73
|
return 1;
|
|
@@ -63,7 +78,7 @@ function runView(argv) {
|
|
|
63
78
|
}
|
|
64
79
|
let raw;
|
|
65
80
|
try {
|
|
66
|
-
raw = (0, loadGraph_1.parseDump)(
|
|
81
|
+
raw = (0, loadGraph_1.parseDump)(dumpStdout);
|
|
67
82
|
}
|
|
68
83
|
catch (error) {
|
|
69
84
|
const message = error instanceof Error ? error.message : String(error);
|
package/lib/view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.js","sourceRoot":"","sources":["../src/view.ts"],"names":[],"mappings":";;;;;;AAAA,2DAAsD;AACtD,sDAAyB;AACzB,0DAA6B;AAC7B,0DAA6B;AAE7B,iDAKwB;AACxB,iDAA8C;AAC9C,
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":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Checker-resolved architecture graph over MCP for coding agents, backed by ttsc's in-process TypeScript-Go compiler.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"typia": "13.2.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"ttsc": "^0.
|
|
23
|
+
"ttsc": "^0.25.0"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
26
|
"ttsc",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"three": "^0.184.0",
|
|
43
43
|
"three-forcegraph": "^1.43.4",
|
|
44
44
|
"typescript": "^7.0.2",
|
|
45
|
-
"ttsc": "0.
|
|
45
|
+
"ttsc": "0.25.0"
|
|
46
46
|
},
|
|
47
47
|
"repository": {
|
|
48
48
|
"type": "git",
|
package/src/index.ts
CHANGED
|
@@ -83,6 +83,37 @@ export function runGraph(
|
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
/** The help spellings `ttscgraph` itself accepts, mirrored for the fallback. */
|
|
87
|
+
const DUMP_HELP_FLAGS = new Set(["--help", "-help", "-h"]);
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Print a `dump` usage summary when the native binary cannot be resolved.
|
|
91
|
+
*
|
|
92
|
+
* This is a fallback, not a second contract: `cmd/ttscgraph/main.go` owns these
|
|
93
|
+
* flags and answers whenever it is installed. Keep this short and point at that
|
|
94
|
+
* authority, so a drift degrades to a stale summary rather than a wrong
|
|
95
|
+
* answer.
|
|
96
|
+
*/
|
|
97
|
+
function printDumpHelp(): void {
|
|
98
|
+
process.stdout.write(
|
|
99
|
+
[
|
|
100
|
+
"Usage: ttsc-graph dump [options]",
|
|
101
|
+
"",
|
|
102
|
+
"Write the whole compiler graph as JSON to stdout: every node and edge,",
|
|
103
|
+
"none of the MCP response caps.",
|
|
104
|
+
"",
|
|
105
|
+
"Options:",
|
|
106
|
+
" --cwd <dir> Project root (default: current directory).",
|
|
107
|
+
" --tsconfig <path> Project tsconfig path (default: tsconfig.json).",
|
|
108
|
+
" --pretty Indent the JSON output.",
|
|
109
|
+
"",
|
|
110
|
+
"The native `ttscgraph` binary owns these flags and is not installed here,",
|
|
111
|
+
"so this summary may lag it. Install `ttsc` and rerun for the exact list.",
|
|
112
|
+
"",
|
|
113
|
+
].join("\n"),
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
86
117
|
/**
|
|
87
118
|
* Pass `dump` through to the native binary, inheriting stdio so the JSON lands
|
|
88
119
|
* on this process's stdout. Returns the child's exit code.
|
|
@@ -93,6 +124,15 @@ function runDump(argv: readonly string[]): number {
|
|
|
93
124
|
const { cwd } = projectOptions(parseLauncherOptions(argv, DUMP_OPTIONS));
|
|
94
125
|
const binary = resolveGraphBinary(process.env, cwd);
|
|
95
126
|
if (binary === null) {
|
|
127
|
+
// `ttscgraph` owns the flag contract, so a resolvable binary always answers
|
|
128
|
+
// `--help` itself and stays the single source of truth. It cannot answer
|
|
129
|
+
// when it is absent, and that is exactly when a caller is most likely to be
|
|
130
|
+
// asking what the command needs — so fall back to a summary that names the
|
|
131
|
+
// authority rather than making usage unreachable behind an install error.
|
|
132
|
+
if (argv.some((argument) => DUMP_HELP_FLAGS.has(argument))) {
|
|
133
|
+
printDumpHelp();
|
|
134
|
+
return 0;
|
|
135
|
+
}
|
|
96
136
|
process.stderr.write(
|
|
97
137
|
"@ttsc/graph: could not resolve the ttscgraph binary. " +
|
|
98
138
|
"Install `ttsc` so its platform package is present, " +
|
|
@@ -27,7 +27,7 @@ export class TtscGraphMemory {
|
|
|
27
27
|
|
|
28
28
|
/** The absolute project root the dump was built for. */
|
|
29
29
|
readonly project: string;
|
|
30
|
-
/** Every node,
|
|
30
|
+
/** Every post-fold node, including refined properties and file containers. */
|
|
31
31
|
readonly nodes: readonly ITtscGraphNode[];
|
|
32
32
|
/** Every edge, raw plus synthesized containment. */
|
|
33
33
|
readonly edges: readonly ITtscGraphEdge[];
|
|
@@ -190,20 +190,22 @@ function synthesize(dump: ITtscGraphDump): {
|
|
|
190
190
|
// small — the two copies are 17% of the document, 55 MB of VS Code's 323 MB,
|
|
191
191
|
// paid again in the encode, the pipe, the parse and the validation. Nothing
|
|
192
192
|
// downstream of this line sees a span without its file.
|
|
193
|
-
const nodes: ITtscGraphNode[] = dump.nodes
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
193
|
+
const nodes: ITtscGraphNode[] = dump.nodes.flatMap((n): ITtscGraphNode[] => {
|
|
194
|
+
if (n.kind === "module") return [];
|
|
195
|
+
const { evidence, implementation, ...rest } = n;
|
|
196
|
+
return [
|
|
197
|
+
{
|
|
198
198
|
...rest,
|
|
199
|
+
kind: n.kind,
|
|
199
200
|
...(evidence !== undefined
|
|
200
201
|
? { evidence: spanIn(evidence, n.file) }
|
|
201
202
|
: {}),
|
|
202
203
|
...(implementation !== undefined
|
|
203
204
|
? { implementation: spanIn(implementation, n.file) }
|
|
204
205
|
: {}),
|
|
205
|
-
}
|
|
206
|
-
|
|
206
|
+
},
|
|
207
|
+
];
|
|
208
|
+
});
|
|
207
209
|
const edges: ITtscGraphEdge[] = dump.edges.map((edge) => {
|
|
208
210
|
const { evidence, ...rest } = edge;
|
|
209
211
|
const from = moduleIds.get(edge.from);
|
|
@@ -6,6 +6,7 @@ import { ensureExecutable } from "../nativeExecutable";
|
|
|
6
6
|
import { resolveGraphBinary } from "../resolveGraphBinary";
|
|
7
7
|
import { ITtscGraphSnapshot } from "../structures/ITtscGraphSnapshot";
|
|
8
8
|
import { TtscGraphMemory } from "./TtscGraphMemory";
|
|
9
|
+
import { TtscGraphShardStore } from "./TtscGraphShardStore";
|
|
9
10
|
import { DUMP_SCHEMA_VERSION } from "./loadGraph";
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -17,15 +18,13 @@ import { DUMP_SCHEMA_VERSION } from "./loadGraph";
|
|
|
17
18
|
* constant out of this file and fails if the pair drifts.
|
|
18
19
|
*/
|
|
19
20
|
const PROTOCOL_VERSION = 1;
|
|
20
|
-
const
|
|
21
|
-
const MAX_TIMER_MS = 2_147_483_647;
|
|
21
|
+
const GRAPH_SNAPSHOT_PROTOCOL_VERSION = 1;
|
|
22
22
|
const TERMINATION_GRACE_MS = 1_000;
|
|
23
23
|
|
|
24
24
|
interface Pending {
|
|
25
25
|
child: NativeChild;
|
|
26
26
|
resolve: (response: ITtscGraphSnapshot) => void;
|
|
27
27
|
reject: (error: Error) => void;
|
|
28
|
-
timer: NodeJS.Timeout;
|
|
29
28
|
signal?: AbortSignal;
|
|
30
29
|
abort?: () => void;
|
|
31
30
|
}
|
|
@@ -44,11 +43,6 @@ export interface TtscGraphSessionOptions {
|
|
|
44
43
|
tsconfig: string;
|
|
45
44
|
/** Absolute native binary path, resolved from `cwd` when omitted. */
|
|
46
45
|
binary?: string;
|
|
47
|
-
/**
|
|
48
|
-
* Maximum time for one native snapshot response. Defaults to five minutes,
|
|
49
|
-
* which is more than ten times the published 28.7-second VS Code cold index.
|
|
50
|
-
*/
|
|
51
|
-
requestTimeoutMs?: number;
|
|
52
46
|
}
|
|
53
47
|
|
|
54
48
|
/** Per-call controls for a native graph refresh. */
|
|
@@ -69,26 +63,15 @@ export class TtscGraphSession {
|
|
|
69
63
|
private readonly cwd: string;
|
|
70
64
|
private readonly tsconfig: string;
|
|
71
65
|
private readonly binary: string;
|
|
72
|
-
private readonly requestTimeoutMs: number;
|
|
73
66
|
private child: NativeChild | undefined;
|
|
74
67
|
private nextId = 0;
|
|
75
68
|
private readonly pending = new Map<number, Pending>();
|
|
76
69
|
private queue: Promise<void> = Promise.resolve();
|
|
77
70
|
private current: TtscGraphMemory | undefined;
|
|
71
|
+
private shardStore = new TtscGraphShardStore();
|
|
78
72
|
private closed = false;
|
|
79
73
|
|
|
80
74
|
public constructor(options: TtscGraphSessionOptions) {
|
|
81
|
-
const requestTimeoutMs =
|
|
82
|
-
options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
83
|
-
if (
|
|
84
|
-
!Number.isSafeInteger(requestTimeoutMs) ||
|
|
85
|
-
requestTimeoutMs <= 0 ||
|
|
86
|
-
requestTimeoutMs > MAX_TIMER_MS
|
|
87
|
-
) {
|
|
88
|
-
throw new TypeError(
|
|
89
|
-
`@ttsc/graph: requestTimeoutMs must be an integer between 1 and ${String(MAX_TIMER_MS)}`,
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
75
|
// Resolve the platform binary from the project this session serves, so the
|
|
93
76
|
// MCP server started from an unrelated directory still finds the target's
|
|
94
77
|
// installed `ttsc`.
|
|
@@ -105,7 +88,6 @@ export class TtscGraphSession {
|
|
|
105
88
|
this.cwd = options.cwd;
|
|
106
89
|
this.tsconfig = options.tsconfig;
|
|
107
90
|
this.binary = binary;
|
|
108
|
-
this.requestTimeoutMs = requestTimeoutMs;
|
|
109
91
|
}
|
|
110
92
|
|
|
111
93
|
/** Return a graph for the current disk snapshot, serialized per tool call. */
|
|
@@ -167,16 +149,30 @@ export class TtscGraphSession {
|
|
|
167
149
|
// The protocol version and the envelope shape were both settled in onLine,
|
|
168
150
|
// before this frame was ever routed here.
|
|
169
151
|
const response = await this.request(signal);
|
|
152
|
+
this.assertResponseSemantics(response);
|
|
170
153
|
if (response.error !== undefined) {
|
|
171
154
|
throw new Error(`@ttsc/graph: ${response.error}`);
|
|
172
155
|
}
|
|
173
156
|
if (response.changed) {
|
|
174
|
-
if (response.
|
|
157
|
+
if (response.snapshot !== undefined) {
|
|
158
|
+
try {
|
|
159
|
+
this.current = TtscGraphMemory.from(
|
|
160
|
+
this.shardStore.apply(response.snapshot),
|
|
161
|
+
);
|
|
162
|
+
} catch (error) {
|
|
163
|
+
const failure = asError(error);
|
|
164
|
+
if (this.child !== undefined) this.failChild(this.child, failure);
|
|
165
|
+
throw failure;
|
|
166
|
+
}
|
|
167
|
+
} else if (response.dump !== undefined) {
|
|
168
|
+
// A serve-protocol-v1 binary predating graph shard negotiation ignores
|
|
169
|
+
// the optional request field and retains the complete-dump response.
|
|
170
|
+
this.current = TtscGraphMemory.from(response.dump);
|
|
171
|
+
} else {
|
|
175
172
|
throw new Error(
|
|
176
|
-
`@ttsc/graph: native ${response.mode} response omitted
|
|
173
|
+
`@ttsc/graph: native ${response.mode} response omitted both graph snapshot protocol v${String(GRAPH_SNAPSHOT_PROTOCOL_VERSION)} data and a compatible dump`,
|
|
177
174
|
);
|
|
178
175
|
}
|
|
179
|
-
this.current = TtscGraphMemory.from(response.dump);
|
|
180
176
|
}
|
|
181
177
|
if (this.current === undefined) {
|
|
182
178
|
throw new Error(
|
|
@@ -186,6 +182,30 @@ export class TtscGraphSession {
|
|
|
186
182
|
return this.current;
|
|
187
183
|
}
|
|
188
184
|
|
|
185
|
+
private assertResponseSemantics(response: ITtscGraphSnapshot): void {
|
|
186
|
+
const bodies =
|
|
187
|
+
Number(response.dump !== undefined) +
|
|
188
|
+
Number(response.snapshot !== undefined);
|
|
189
|
+
let problem: string | undefined;
|
|
190
|
+
if (response.error !== undefined) {
|
|
191
|
+
if (response.mode !== "error" || response.changed || bodies !== 0) {
|
|
192
|
+
problem = "an error response carried snapshot state";
|
|
193
|
+
}
|
|
194
|
+
} else if (response.mode === "error") {
|
|
195
|
+
problem = "an error-mode response omitted its error";
|
|
196
|
+
} else if (response.changed) {
|
|
197
|
+
if (response.mode === "unchanged" || bodies !== 1) {
|
|
198
|
+
problem = "a changed response did not carry exactly one snapshot body";
|
|
199
|
+
}
|
|
200
|
+
} else if (response.mode !== "unchanged" || bodies !== 0) {
|
|
201
|
+
problem = "an unchanged response carried changed mode or snapshot state";
|
|
202
|
+
}
|
|
203
|
+
if (problem === undefined) return;
|
|
204
|
+
const error = new Error(`@ttsc/graph: native session returned ${problem}`);
|
|
205
|
+
if (this.child !== undefined) this.failChild(this.child, error);
|
|
206
|
+
throw error;
|
|
207
|
+
}
|
|
208
|
+
|
|
189
209
|
private request(signal?: AbortSignal): Promise<ITtscGraphSnapshot> {
|
|
190
210
|
if (signal?.aborted) throw cancelledError(signal);
|
|
191
211
|
const child = this.ensureChild();
|
|
@@ -195,17 +215,8 @@ export class TtscGraphSession {
|
|
|
195
215
|
child,
|
|
196
216
|
resolve,
|
|
197
217
|
reject,
|
|
198
|
-
timer: setTimeout(() => {
|
|
199
|
-
this.failChild(
|
|
200
|
-
child,
|
|
201
|
-
new Error(
|
|
202
|
-
`@ttsc/graph: native snapshot request timed out after ${String(this.requestTimeoutMs)} ms${stderrSuffix(child)}`,
|
|
203
|
-
),
|
|
204
|
-
);
|
|
205
|
-
}, this.requestTimeoutMs),
|
|
206
218
|
signal,
|
|
207
219
|
};
|
|
208
|
-
pending.timer.unref();
|
|
209
220
|
if (signal !== undefined) {
|
|
210
221
|
pending.abort = () =>
|
|
211
222
|
this.failChild(child, cancelledError(signal, child));
|
|
@@ -216,16 +227,19 @@ export class TtscGraphSession {
|
|
|
216
227
|
pending.abort!();
|
|
217
228
|
return;
|
|
218
229
|
}
|
|
219
|
-
child.process.stdin.write(
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
230
|
+
child.process.stdin.write(
|
|
231
|
+
`${JSON.stringify({ id, graphSnapshotVersion: GRAPH_SNAPSHOT_PROTOCOL_VERSION })}\n`,
|
|
232
|
+
(error) => {
|
|
233
|
+
if (error === null || error === undefined) return;
|
|
234
|
+
if (this.pending.get(id) !== pending) return;
|
|
235
|
+
this.failChild(
|
|
236
|
+
child,
|
|
237
|
+
new Error(
|
|
238
|
+
`@ttsc/graph: could not request native snapshot: ${error.message}`,
|
|
239
|
+
),
|
|
240
|
+
);
|
|
241
|
+
},
|
|
242
|
+
);
|
|
229
243
|
});
|
|
230
244
|
}
|
|
231
245
|
|
|
@@ -344,8 +358,10 @@ export class TtscGraphSession {
|
|
|
344
358
|
// looking like a type with no members. Hold the body to its own number too,
|
|
345
359
|
// once the frame is understood.
|
|
346
360
|
if (
|
|
347
|
-
response.dump !== undefined &&
|
|
348
|
-
|
|
361
|
+
(response.dump !== undefined &&
|
|
362
|
+
response.dump.provenance.schemaVersion !== DUMP_SCHEMA_VERSION) ||
|
|
363
|
+
(response.snapshot !== undefined &&
|
|
364
|
+
response.snapshot.schemaVersion !== DUMP_SCHEMA_VERSION)
|
|
349
365
|
) {
|
|
350
366
|
// Session-wide, for the same reason the protocol mismatch above is: it is
|
|
351
367
|
// the wrong binary, not one bad frame.
|
|
@@ -353,7 +369,8 @@ export class TtscGraphSession {
|
|
|
353
369
|
child,
|
|
354
370
|
new Error(
|
|
355
371
|
`@ttsc/graph: ttscgraph sends dump schema v${String(
|
|
356
|
-
response.dump
|
|
372
|
+
response.dump?.provenance.schemaVersion ??
|
|
373
|
+
response.snapshot?.schemaVersion,
|
|
357
374
|
)}, this client reads v${String(DUMP_SCHEMA_VERSION)}. ` +
|
|
358
375
|
"Install a matching `ttsc` (the binary resolves from the target " +
|
|
359
376
|
"project, or from TTSC_GRAPH_BINARY).",
|
|
@@ -371,6 +388,7 @@ export class TtscGraphSession {
|
|
|
371
388
|
if (this.child !== child) return;
|
|
372
389
|
this.child = undefined;
|
|
373
390
|
this.current = undefined;
|
|
391
|
+
this.shardStore = new TtscGraphShardStore();
|
|
374
392
|
child.lines.close();
|
|
375
393
|
this.failPending(error, child);
|
|
376
394
|
if (terminate) terminateChild(child.process);
|
|
@@ -391,7 +409,6 @@ export class TtscGraphSession {
|
|
|
391
409
|
): void {
|
|
392
410
|
if (this.pending.get(id) !== pending) return;
|
|
393
411
|
this.pending.delete(id);
|
|
394
|
-
clearTimeout(pending.timer);
|
|
395
412
|
if (pending.signal !== undefined && pending.abort !== undefined) {
|
|
396
413
|
pending.signal.removeEventListener("abort", pending.abort);
|
|
397
414
|
}
|