@ttsc/graph 0.18.4 → 0.19.1
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 +231 -37
- package/lib/TtscGraphApplication.d.ts +1 -1
- package/lib/TtscGraphApplication.js +50 -17
- package/lib/TtscGraphApplication.js.map +1 -1
- package/lib/index.d.ts +5 -0
- package/lib/index.js +20 -1
- package/lib/index.js.map +1 -1
- package/lib/model/TtscGraphMemory.js +80 -22
- package/lib/model/TtscGraphMemory.js.map +1 -1
- package/lib/model/TtscGraphSession.js +92 -138
- package/lib/model/TtscGraphSession.js.map +1 -1
- package/lib/model/loadGraph.js +91 -138
- package/lib/model/loadGraph.js.map +1 -1
- package/lib/resolveGraphBinary.d.ts +4 -2
- package/lib/resolveGraphBinary.js +7 -3
- package/lib/resolveGraphBinary.js.map +1 -1
- package/lib/server/createServer.d.ts +16 -9
- package/lib/server/createServer.js +286 -190
- package/lib/server/createServer.js.map +1 -1
- package/lib/server/exportSurface.d.ts +26 -0
- package/lib/server/exportSurface.js +44 -0
- package/lib/server/exportSurface.js.map +1 -0
- package/lib/server/resolveHandle.d.ts +26 -1
- package/lib/server/resolveHandle.js +124 -4
- package/lib/server/resolveHandle.js.map +1 -1
- package/lib/server/resultAudit.d.ts +74 -0
- package/lib/server/resultAudit.js +110 -0
- package/lib/server/resultAudit.js.map +1 -0
- package/lib/server/resultNext.d.ts +9 -0
- package/lib/server/resultNext.js +11 -0
- package/lib/server/resultNext.js.map +1 -0
- package/lib/server/runDetails.d.ts +15 -3
- package/lib/server/runDetails.js +105 -23
- package/lib/server/runDetails.js.map +1 -1
- package/lib/server/runEntrypoints.d.ts +2 -1
- package/lib/server/runEntrypoints.js +17 -10
- package/lib/server/runEntrypoints.js.map +1 -1
- package/lib/server/runLookup.d.ts +2 -1
- package/lib/server/runLookup.js +21 -9
- package/lib/server/runLookup.js.map +1 -1
- package/lib/server/runOverview.d.ts +2 -1
- package/lib/server/runOverview.js +5 -4
- package/lib/server/runOverview.js.map +1 -1
- package/lib/server/runTour.d.ts +2 -1
- package/lib/server/runTour.js +707 -331
- package/lib/server/runTour.js.map +1 -1
- package/lib/server/runTrace.d.ts +2 -1
- package/lib/server/runTrace.js +234 -54
- package/lib/server/runTrace.js.map +1 -1
- package/lib/structures/ITtscGraphApplication.d.ts +122 -118
- package/lib/structures/ITtscGraphDecorator.d.ts +4 -7
- package/lib/structures/ITtscGraphDetails.d.ts +51 -43
- package/lib/structures/ITtscGraphDump.d.ts +32 -8
- package/lib/structures/ITtscGraphEdge.d.ts +4 -6
- package/lib/structures/ITtscGraphEntrypoints.d.ts +10 -27
- package/lib/structures/ITtscGraphEscape.d.ts +6 -16
- package/lib/structures/ITtscGraphEvidence.d.ts +5 -8
- package/lib/structures/ITtscGraphLookup.d.ts +9 -20
- package/lib/structures/ITtscGraphNext.d.ts +10 -7
- package/lib/structures/ITtscGraphNode.d.ts +17 -8
- package/lib/structures/ITtscGraphOverview.d.ts +10 -14
- package/lib/structures/ITtscGraphSpan.d.ts +29 -0
- package/lib/structures/{ITtscGraphDiagnostic.js → ITtscGraphSpan.js} +1 -1
- package/lib/structures/ITtscGraphSpan.js.map +1 -0
- package/lib/structures/ITtscGraphTour.d.ts +65 -23
- package/lib/structures/ITtscGraphTrace.d.ts +72 -49
- package/lib/structures/TtscGraphEdgeKind.d.ts +7 -1
- package/lib/structures/index.d.ts +1 -1
- package/lib/structures/index.js +1 -1
- package/lib/structures/index.js.map +1 -1
- package/lib/view.js +3 -1
- package/lib/view.js.map +1 -1
- package/package.json +4 -4
- package/src/TtscGraphApplication.ts +58 -27
- package/src/index.ts +19 -1
- package/src/model/TtscGraphMemory.ts +86 -22
- package/src/model/TtscGraphSession.ts +5 -1
- package/src/model/loadGraph.ts +3 -1
- package/src/resolveGraphBinary.ts +7 -3
- package/src/server/createServer.ts +24 -17
- package/src/server/exportSurface.ts +40 -0
- package/src/server/resolveHandle.ts +141 -4
- package/src/server/resultAudit.ts +109 -0
- package/src/server/resultNext.ts +22 -0
- package/src/server/runDetails.ts +112 -28
- package/src/server/runEntrypoints.ts +26 -17
- package/src/server/runLookup.ts +29 -18
- package/src/server/runOverview.ts +9 -10
- package/src/server/runTour.ts +764 -363
- package/src/server/runTrace.ts +265 -71
- package/src/structures/ITtscGraphApplication.ts +124 -118
- package/src/structures/ITtscGraphDecorator.ts +4 -7
- package/src/structures/ITtscGraphDetails.ts +60 -46
- package/src/structures/ITtscGraphDump.ts +37 -8
- package/src/structures/ITtscGraphEdge.ts +4 -6
- package/src/structures/ITtscGraphEntrypoints.ts +10 -30
- package/src/structures/ITtscGraphEscape.ts +6 -19
- package/src/structures/ITtscGraphEvidence.ts +5 -8
- package/src/structures/ITtscGraphLookup.ts +9 -22
- package/src/structures/ITtscGraphNext.ts +10 -7
- package/src/structures/ITtscGraphNode.ts +18 -8
- package/src/structures/ITtscGraphOverview.ts +10 -17
- package/src/structures/ITtscGraphSpan.ts +33 -0
- package/src/structures/ITtscGraphTour.ts +70 -28
- package/src/structures/ITtscGraphTrace.ts +82 -51
- package/src/structures/TtscGraphEdgeKind.ts +7 -0
- package/src/structures/index.ts +1 -1
- package/src/view.ts +3 -1
- package/lib/server/accessAliases.d.ts +0 -8
- package/lib/server/accessAliases.js +0 -53
- package/lib/server/accessAliases.js.map +0 -1
- package/lib/server/resultGuide.d.ts +0 -3
- package/lib/server/resultGuide.js +0 -16
- package/lib/server/resultGuide.js.map +0 -1
- package/lib/structures/ITtscGraphDiagnostic.d.ts +0 -27
- package/lib/structures/ITtscGraphDiagnostic.js.map +0 -1
- package/src/server/accessAliases.ts +0 -55
- package/src/server/resultGuide.ts +0 -20
- package/src/structures/ITtscGraphDiagnostic.ts +0 -34
package/lib/structures/index.js
CHANGED
|
@@ -21,7 +21,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
__exportStar(require("./ITtscGraphApplication"), exports);
|
|
23
23
|
__exportStar(require("./ITtscGraphDecorator"), exports);
|
|
24
|
-
__exportStar(require("./ITtscGraphDiagnostic"), exports);
|
|
25
24
|
__exportStar(require("./ITtscGraphDump"), exports);
|
|
26
25
|
__exportStar(require("./ITtscGraphEdge"), exports);
|
|
27
26
|
__exportStar(require("./ITtscGraphEvidence"), exports);
|
|
@@ -33,6 +32,7 @@ __exportStar(require("./ITtscGraphOverview"), exports);
|
|
|
33
32
|
__exportStar(require("./ITtscGraphLookup"), exports);
|
|
34
33
|
__exportStar(require("./ITtscGraphNext"), exports);
|
|
35
34
|
__exportStar(require("./ITtscGraphTrace"), exports);
|
|
35
|
+
__exportStar(require("./ITtscGraphSpan"), exports);
|
|
36
36
|
__exportStar(require("./ITtscGraphTour"), exports);
|
|
37
37
|
__exportStar(require("./TtscGraphEdgeKind"), exports);
|
|
38
38
|
__exportStar(require("./TtscGraphNodeKind"), exports);
|
|
@@ -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,
|
|
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,mDAAiC;AACjC,mDAAiC;AACjC,sDAAoC;AACpC,sDAAoC;AACpC,0DAAwC"}
|
package/lib/view.js
CHANGED
|
@@ -50,7 +50,9 @@ function parseViewArgs(argv) {
|
|
|
50
50
|
*/
|
|
51
51
|
function runView(argv) {
|
|
52
52
|
const opts = parseViewArgs(argv);
|
|
53
|
-
|
|
53
|
+
// Anchor binary resolution at the project selected by `--cwd`, so `view` from
|
|
54
|
+
// an unrelated directory still finds the `ttsc` installed under the target.
|
|
55
|
+
const binary = (0, resolveGraphBinary_1.resolveGraphBinary)(process.env, opts.cwd);
|
|
54
56
|
if (binary === null) {
|
|
55
57
|
process.stderr.write("@ttsc/graph: could not resolve the ttscgraph binary. " +
|
|
56
58
|
"Install `ttsc` so its platform package is present, " +
|
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,yDAAsD;AACtD,qCAAgD;AAChD,6DAA0D;AAU1D,SAAS,aAAa,CAAC,IAAuB;IAC5C,MAAM,IAAI,GAAgB;QACxB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,QAAQ,EAAE,eAAe;QACzB,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;QACrB,IAAI,GAAG,KAAK,OAAO;YAAE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC;aACjD,IAAI,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC;YAAE,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAA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AC;QACP,kDAAkD;IACpD,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttsc/graph",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "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",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
19
|
-
"@typia/mcp": "
|
|
20
|
-
"typia": "
|
|
19
|
+
"@typia/mcp": "13.1.0",
|
|
20
|
+
"typia": "13.1.0"
|
|
21
21
|
},
|
|
22
22
|
"keywords": [
|
|
23
23
|
"ttsc",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"three": "^0.184.0",
|
|
40
40
|
"three-forcegraph": "^1.43.4",
|
|
41
41
|
"typescript": "^7.0.2",
|
|
42
|
-
"ttsc": "0.
|
|
42
|
+
"ttsc": "0.19.1"
|
|
43
43
|
},
|
|
44
44
|
"repository": {
|
|
45
45
|
"type": "git",
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { TtscGraphMemory } from "./model/TtscGraphMemory";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
RESULT_AUDIT,
|
|
4
|
+
RESULT_AUDIT_ESCAPE,
|
|
5
|
+
RESULT_AUDIT_SELECTION,
|
|
6
|
+
} from "./server/resultAudit";
|
|
7
|
+
import { resultNext } from "./server/resultNext";
|
|
3
8
|
import { runDetails } from "./server/runDetails";
|
|
4
9
|
import { runEntrypoints } from "./server/runEntrypoints";
|
|
5
10
|
import { runLookup } from "./server/runLookup";
|
|
@@ -38,65 +43,91 @@ export class TtscGraphApplication implements ITtscGraphApplication {
|
|
|
38
43
|
|
|
39
44
|
public async inspect_typescript_graph(
|
|
40
45
|
props: ITtscGraphApplication.IProps,
|
|
41
|
-
): Promise<ITtscGraphApplication.
|
|
46
|
+
): Promise<ITtscGraphApplication.IOutput> {
|
|
42
47
|
if (props.request.type === "escape") {
|
|
43
48
|
const result = this.escape(props.request.reason);
|
|
44
49
|
if (props.request.nextStep !== undefined) {
|
|
45
50
|
result.nextStep = props.request.nextStep;
|
|
46
51
|
}
|
|
47
52
|
return {
|
|
53
|
+
audit: RESULT_AUDIT_ESCAPE,
|
|
54
|
+
next: resultNext(
|
|
55
|
+
"outside",
|
|
56
|
+
"The caller chose to leave the graph, so this call carries no graph facts.",
|
|
57
|
+
),
|
|
48
58
|
result,
|
|
49
59
|
};
|
|
50
60
|
}
|
|
51
61
|
const graph = await this.graph();
|
|
52
62
|
switch (props.request.type) {
|
|
53
|
-
case "entrypoints":
|
|
63
|
+
case "entrypoints": {
|
|
64
|
+
// A ranked shortlist matched against the question: its facts are
|
|
65
|
+
// compiler-verified, but its selection is heuristic, so it carries the
|
|
66
|
+
// selection audit rather than the exact-structure one.
|
|
67
|
+
const r = runEntrypoints(graph, props.request);
|
|
54
68
|
return {
|
|
55
|
-
|
|
69
|
+
audit: RESULT_AUDIT_SELECTION,
|
|
70
|
+
next: r.next,
|
|
71
|
+
result: r.result,
|
|
56
72
|
};
|
|
57
|
-
|
|
73
|
+
}
|
|
74
|
+
case "lookup": {
|
|
75
|
+
// Natural-query ranker (see `runLookup`): scored, ranked, per-file
|
|
76
|
+
// capped, and limited, so the selection is heuristic.
|
|
77
|
+
const r = runLookup(graph, props.request);
|
|
58
78
|
return {
|
|
59
|
-
|
|
79
|
+
audit: RESULT_AUDIT_SELECTION,
|
|
80
|
+
next: r.next,
|
|
81
|
+
result: r.result,
|
|
60
82
|
};
|
|
61
|
-
|
|
83
|
+
}
|
|
84
|
+
case "trace": {
|
|
85
|
+
const r = runTrace(graph, props.request);
|
|
62
86
|
return {
|
|
63
|
-
|
|
87
|
+
audit: RESULT_AUDIT,
|
|
88
|
+
next: r.next,
|
|
89
|
+
result: r.result,
|
|
64
90
|
};
|
|
65
|
-
|
|
91
|
+
}
|
|
92
|
+
case "details": {
|
|
93
|
+
const r = runDetails(graph, props.request);
|
|
66
94
|
return {
|
|
67
|
-
|
|
95
|
+
audit: RESULT_AUDIT,
|
|
96
|
+
next: r.next,
|
|
97
|
+
result: r.result,
|
|
68
98
|
};
|
|
69
|
-
|
|
99
|
+
}
|
|
100
|
+
case "overview": {
|
|
101
|
+
const r = runOverview(graph, props.request);
|
|
70
102
|
return {
|
|
71
|
-
|
|
103
|
+
audit: RESULT_AUDIT,
|
|
104
|
+
next: r.next,
|
|
105
|
+
result: r.result,
|
|
72
106
|
};
|
|
73
|
-
|
|
107
|
+
}
|
|
108
|
+
case "tour": {
|
|
109
|
+
// The tour ranks against the question, and the question is `props`
|
|
110
|
+
// — the caller wrote it once, at the top, in the user's words. It
|
|
111
|
+
// ranks seeds, walks bounded flows, and slices to a limit, so its
|
|
112
|
+
// selection is heuristic.
|
|
113
|
+
const r = runTour(graph, props.request, props.question);
|
|
74
114
|
return {
|
|
75
|
-
|
|
115
|
+
audit: RESULT_AUDIT_SELECTION,
|
|
116
|
+
next: r.next,
|
|
117
|
+
result: r.result,
|
|
76
118
|
};
|
|
119
|
+
}
|
|
77
120
|
default:
|
|
78
121
|
props.request satisfies never;
|
|
79
122
|
throw new Error("Unknown graph request type");
|
|
80
123
|
}
|
|
81
124
|
}
|
|
82
125
|
|
|
83
|
-
private escape(
|
|
84
|
-
reason: string,
|
|
85
|
-
nextStep?: string,
|
|
86
|
-
action: "answer" | "outside" | "clarify" = "outside",
|
|
87
|
-
): ITtscGraphEscape {
|
|
126
|
+
private escape(reason: string, nextStep?: string): ITtscGraphEscape {
|
|
88
127
|
return {
|
|
89
128
|
type: "escape",
|
|
90
129
|
skipped: true,
|
|
91
130
|
reason,
|
|
92
|
-
next: resultNext(
|
|
93
|
-
action,
|
|
94
|
-
nextStep ??
|
|
95
|
-
"Graph evidence is exhausted or not the next evidence source.",
|
|
96
|
-
),
|
|
97
|
-
guide: resultGuide(
|
|
98
|
-
"Finish from existing graph evidence, state the graph gap, or ask for clarification.",
|
|
99
|
-
),
|
|
100
131
|
...(nextStep !== undefined ? { nextStep } : {}),
|
|
101
132
|
};
|
|
102
133
|
}
|
package/src/index.ts
CHANGED
|
@@ -6,6 +6,21 @@ import { resolveGraphBinary } from "./resolveGraphBinary";
|
|
|
6
6
|
import { startServer } from "./server/startServer";
|
|
7
7
|
import { runView } from "./view";
|
|
8
8
|
|
|
9
|
+
/** What a graph result says about where its facts came from. */
|
|
10
|
+
export {
|
|
11
|
+
RESULT_AUDIT,
|
|
12
|
+
RESULT_AUDIT_ESCAPE,
|
|
13
|
+
RESULT_AUDIT_SELECTION,
|
|
14
|
+
} from "./server/resultAudit";
|
|
15
|
+
|
|
16
|
+
// Programmatic entry points. Each resolves its native binary from the project
|
|
17
|
+
// `cwd` it is given (see `resolveGraphBinary`), so a caller that graphs a
|
|
18
|
+
// project other than its own process directory names it once and the binary is
|
|
19
|
+
// found under that project's installed `ttsc`.
|
|
20
|
+
export { resolveGraphBinary } from "./resolveGraphBinary";
|
|
21
|
+
export { loadGraph } from "./model/loadGraph";
|
|
22
|
+
export { TtscGraphSession } from "./model/TtscGraphSession";
|
|
23
|
+
|
|
9
24
|
// The server version reported in the MCP handshake; read from this package.
|
|
10
25
|
const VERSION: string = (require("../package.json") as { version: string })
|
|
11
26
|
.version;
|
|
@@ -65,7 +80,10 @@ export function runGraph(
|
|
|
65
80
|
* on this process's stdout. Returns the child's exit code.
|
|
66
81
|
*/
|
|
67
82
|
function runDump(argv: readonly string[]): number {
|
|
68
|
-
|
|
83
|
+
// Resolve the native binary from the target project the caller named with
|
|
84
|
+
// `--cwd`, not from wherever the launcher process happened to start.
|
|
85
|
+
const { cwd } = parseProjectArgs(argv);
|
|
86
|
+
const binary = resolveGraphBinary(process.env, cwd);
|
|
69
87
|
if (binary === null) {
|
|
70
88
|
process.stderr.write(
|
|
71
89
|
"@ttsc/graph: could not resolve the ttscgraph binary. " +
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ITtscGraphDump } from "../structures/ITtscGraphDump";
|
|
2
2
|
import { ITtscGraphEdge } from "../structures/ITtscGraphEdge";
|
|
3
|
+
import { ITtscGraphEvidence } from "../structures/ITtscGraphEvidence";
|
|
3
4
|
import { ITtscGraphNode } from "../structures/ITtscGraphNode";
|
|
5
|
+
import { ITtscGraphSpan } from "../structures/ITtscGraphSpan";
|
|
4
6
|
import { TtscGraphEdgeKind } from "../structures/TtscGraphEdgeKind";
|
|
5
7
|
|
|
6
8
|
/**
|
|
@@ -122,6 +124,24 @@ function fileNodeId(file: string): string {
|
|
|
122
124
|
return file;
|
|
123
125
|
}
|
|
124
126
|
|
|
127
|
+
/**
|
|
128
|
+
* A wire span with its file put back: the one the builder left out because the
|
|
129
|
+
* reader has it, or the one it kept because it could not be derived (an
|
|
130
|
+
* implementation in another file).
|
|
131
|
+
*/
|
|
132
|
+
function spanIn(span: ITtscGraphSpan, file: string): ITtscGraphEvidence {
|
|
133
|
+
return { ...span, file: span.file ?? file };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The source file a node id names. An id is `path#Qualified.Name:kind`, and a
|
|
138
|
+
* file node's id is the path itself.
|
|
139
|
+
*/
|
|
140
|
+
function fileOfNodeId(id: string): string {
|
|
141
|
+
const hash = id.indexOf("#");
|
|
142
|
+
return hash === -1 ? id : id.slice(0, hash);
|
|
143
|
+
}
|
|
144
|
+
|
|
125
145
|
function basename(file: string): string {
|
|
126
146
|
const slash = file.lastIndexOf("/");
|
|
127
147
|
return slash >= 0 ? file.slice(slash + 1) : file;
|
|
@@ -136,9 +156,49 @@ function synthesize(dump: ITtscGraphDump): {
|
|
|
136
156
|
nodes: ITtscGraphNode[];
|
|
137
157
|
edges: ITtscGraphEdge[];
|
|
138
158
|
} {
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
|
|
159
|
+
// A module node is the dump's name for a source file's export surface, and a
|
|
160
|
+
// file node is this layer's name for the same file. Fold the two: the module
|
|
161
|
+
// keeps its file present here even when the file declares nothing (a barrel),
|
|
162
|
+
// and its `exports` edges are re-anchored on the file id every other tool
|
|
163
|
+
// already traverses. What the module carried, the file now carries.
|
|
164
|
+
const moduleFiles = new Set(
|
|
165
|
+
dump.nodes.filter((n) => n.kind === "module").map((n) => n.file),
|
|
166
|
+
);
|
|
167
|
+
const moduleIds = new Map(
|
|
168
|
+
dump.nodes.filter((n) => n.kind === "module").map((n) => [n.id, n.file]),
|
|
169
|
+
);
|
|
170
|
+
// Clone nodes so property refinement does not mutate the caller's dump, and
|
|
171
|
+
// put back the file the builder left out of every span: a node's span is in
|
|
172
|
+
// the node's file, an edge's span is in the file its `from` id names. The
|
|
173
|
+
// builder omits both because they are exactly reconstructible and they are not
|
|
174
|
+
// small — the two copies are 17% of the document, 55 MB of VS Code's 323 MB,
|
|
175
|
+
// paid again in the encode, the pipe, the parse and the validation. Nothing
|
|
176
|
+
// downstream of this line sees a span without its file.
|
|
177
|
+
const nodes: ITtscGraphNode[] = dump.nodes
|
|
178
|
+
.filter((n) => n.kind !== "module")
|
|
179
|
+
.map((n) => {
|
|
180
|
+
const { evidence, implementation, ...rest } = n;
|
|
181
|
+
return {
|
|
182
|
+
...rest,
|
|
183
|
+
...(evidence !== undefined
|
|
184
|
+
? { evidence: spanIn(evidence, n.file) }
|
|
185
|
+
: {}),
|
|
186
|
+
...(implementation !== undefined
|
|
187
|
+
? { implementation: spanIn(implementation, n.file) }
|
|
188
|
+
: {}),
|
|
189
|
+
};
|
|
190
|
+
});
|
|
191
|
+
const edges: ITtscGraphEdge[] = dump.edges.map((edge) => {
|
|
192
|
+
const { evidence, ...rest } = edge;
|
|
193
|
+
const from = moduleIds.get(edge.from);
|
|
194
|
+
return {
|
|
195
|
+
...rest,
|
|
196
|
+
...(from !== undefined ? { from: fileNodeId(from) } : {}),
|
|
197
|
+
...(evidence !== undefined
|
|
198
|
+
? { evidence: spanIn(evidence, fileOfNodeId(edge.from)) }
|
|
199
|
+
: {}),
|
|
200
|
+
};
|
|
201
|
+
});
|
|
142
202
|
|
|
143
203
|
// Index workspace nodes by (file, within-file key) so ownership can resolve a
|
|
144
204
|
// member to its declaring class/namespace.
|
|
@@ -161,23 +221,34 @@ function synthesize(dump: ITtscGraphDump): {
|
|
|
161
221
|
}
|
|
162
222
|
}
|
|
163
223
|
|
|
164
|
-
// One file container node per distinct workspace source file
|
|
224
|
+
// One file container node per distinct workspace source file, plus every file
|
|
225
|
+
// the dump saw an export surface on — a barrel declares nothing, so its only
|
|
226
|
+
// trace in the dump is its module node, and it is exactly the file a consumer
|
|
227
|
+
// imports the package from.
|
|
165
228
|
const fileNodes = new Map<string, ITtscGraphNode>();
|
|
229
|
+
const addFileNode = (file: string): void => {
|
|
230
|
+
if (file === "" || fileNodes.has(file)) return;
|
|
231
|
+
fileNodes.set(file, {
|
|
232
|
+
id: fileNodeId(file),
|
|
233
|
+
kind: "file",
|
|
234
|
+
name: basename(file),
|
|
235
|
+
file,
|
|
236
|
+
external: false,
|
|
237
|
+
});
|
|
238
|
+
};
|
|
166
239
|
for (const node of nodes) {
|
|
167
|
-
if (node.external
|
|
168
|
-
|
|
169
|
-
fileNodes.set(node.file, {
|
|
170
|
-
id: fileNodeId(node.file),
|
|
171
|
-
kind: "file",
|
|
172
|
-
name: basename(node.file),
|
|
173
|
-
file: node.file,
|
|
174
|
-
external: false,
|
|
175
|
-
});
|
|
176
|
-
}
|
|
240
|
+
if (node.external) continue;
|
|
241
|
+
addFileNode(node.file);
|
|
177
242
|
}
|
|
243
|
+
for (const file of moduleFiles) addFileNode(file);
|
|
178
244
|
|
|
179
245
|
// Ownership: a member is contained by its owner; a top-level declaration by
|
|
180
|
-
// its file. Exports
|
|
246
|
+
// its file. Exports are not synthesized here: the dump's `exports` edges come
|
|
247
|
+
// from the checker's export table, which follows re-exports and barrels, so
|
|
248
|
+
// they say which module puts a symbol on the wire. Deriving them from the
|
|
249
|
+
// `exported` flag instead would say only that the declaring file made it
|
|
250
|
+
// public, which is the fact that cannot tell a package's front door from its
|
|
251
|
+
// legacy subpath.
|
|
181
252
|
const structural: ITtscGraphEdge[] = [];
|
|
182
253
|
const membersByOwner = new Map<string, ITtscGraphNode[]>();
|
|
183
254
|
for (const node of nodes) {
|
|
@@ -190,13 +261,6 @@ function synthesize(dump: ITtscGraphDump): {
|
|
|
190
261
|
to: node.id,
|
|
191
262
|
kind: "contains",
|
|
192
263
|
});
|
|
193
|
-
if (node.exported) {
|
|
194
|
-
structural.push({
|
|
195
|
-
from: fileNodeId(node.file),
|
|
196
|
-
to: node.id,
|
|
197
|
-
kind: "exports" satisfies TtscGraphEdgeKind,
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
264
|
}
|
|
201
265
|
|
|
202
266
|
const synthesized = [...edges, ...structural];
|
|
@@ -45,7 +45,11 @@ export class TtscGraphSession {
|
|
|
45
45
|
tsconfig: string;
|
|
46
46
|
binary?: string;
|
|
47
47
|
}) {
|
|
48
|
-
|
|
48
|
+
// Resolve the platform binary from the project this session serves, so the
|
|
49
|
+
// MCP server started from an unrelated directory still finds the target's
|
|
50
|
+
// installed `ttsc`.
|
|
51
|
+
const binary =
|
|
52
|
+
options.binary ?? resolveGraphBinary(process.env, options.cwd);
|
|
49
53
|
if (binary === null) {
|
|
50
54
|
throw new Error(
|
|
51
55
|
"@ttsc/graph: could not resolve the ttscgraph binary. " +
|
package/src/model/loadGraph.ts
CHANGED
|
@@ -37,7 +37,9 @@ export function loadGraph(
|
|
|
37
37
|
): TtscGraphMemory {
|
|
38
38
|
const cwd = options.cwd ?? process.cwd();
|
|
39
39
|
const tsconfig = options.tsconfig ?? "tsconfig.json";
|
|
40
|
-
|
|
40
|
+
// Resolve the platform binary from the selected project cwd, not the caller's
|
|
41
|
+
// process directory, so a one-shot load names its own installation.
|
|
42
|
+
const binary = options.binary ?? resolveGraphBinary(process.env, cwd);
|
|
41
43
|
if (binary === null) {
|
|
42
44
|
throw new Error(
|
|
43
45
|
"@ttsc/graph: could not resolve the ttscgraph binary. " +
|
|
@@ -15,8 +15,10 @@ import path from "node:path";
|
|
|
15
15
|
* 2. The per-platform npm package `@ttsc/<platform>-<arch>/bin/ttscgraph[.exe]`.
|
|
16
16
|
* That package carries `ttsc`, `ttscserver`, and `ttscgraph` together and is
|
|
17
17
|
* an `optionalDependency` of `ttsc`, so it is resolved from `ttsc`'s
|
|
18
|
-
* location — found from `
|
|
19
|
-
*
|
|
18
|
+
* location — found from `cwd`, the project the caller selected (via `--cwd`
|
|
19
|
+
* or an API `cwd` option), defaulting to `process.cwd()` when no project was
|
|
20
|
+
* named. A launcher started from an unrelated directory still resolves the
|
|
21
|
+
* `ttsc` installed under the target project it was asked to graph.
|
|
20
22
|
*/
|
|
21
23
|
export function resolveGraphBinary(
|
|
22
24
|
env: NodeJS.ProcessEnv = process.env,
|
|
@@ -27,8 +29,10 @@ export function resolveGraphBinary(
|
|
|
27
29
|
}
|
|
28
30
|
const exe = process.platform === "win32" ? "ttscgraph.exe" : "ttscgraph";
|
|
29
31
|
try {
|
|
32
|
+
// Anchor package lookup at the absolute project root so a relative `--cwd`
|
|
33
|
+
// resolves the same way the native process interprets it.
|
|
30
34
|
const ttscPackageJson = require.resolve("ttsc/package.json", {
|
|
31
|
-
paths: [cwd],
|
|
35
|
+
paths: [path.resolve(cwd)],
|
|
32
36
|
});
|
|
33
37
|
const fromTtsc = createRequire(ttscPackageJson);
|
|
34
38
|
return fromTtsc.resolve(
|
|
@@ -1,31 +1,38 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import { createMcpServer } from "@typia/mcp";
|
|
3
|
-
import typia
|
|
3
|
+
import typia from "typia";
|
|
4
4
|
|
|
5
5
|
import { TtscGraphApplication, TtscGraphSource } from "../TtscGraphApplication";
|
|
6
6
|
import { ITtscGraphApplication } from "../structures/ITtscGraphApplication";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Build the MCP server for a graph.
|
|
10
|
-
* {@link ITtscGraphApplication} into the tool schema and validator (no
|
|
11
|
-
* hand-written schema), and `createMcpServer` from `@typia/mcp` handles the
|
|
12
|
-
* list/call registration, argument validation, and structured output.
|
|
9
|
+
* Build the MCP server for a graph.
|
|
13
10
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
11
|
+
* `typia.llm.controller` reflects {@link ITtscGraphApplication} into the tool's
|
|
12
|
+
* input and output schemas and its argument validator, with no hand-written
|
|
13
|
+
* schema: the interface's JSDoc becomes the handshake instructions, the
|
|
14
|
+
* method's becomes the tool description, and every property's becomes the
|
|
15
|
+
* description of that field — including `audit`, whose JSDoc is how a caller
|
|
16
|
+
* learns what the server checked before it answered.
|
|
17
|
+
*
|
|
18
|
+
* The registration was hand-written here for a while, because a tool that
|
|
19
|
+
* declares an output schema must answer with `structuredContent` and the helper
|
|
20
|
+
* also serialized the same JSON into a text block: the payload crossed the wire
|
|
21
|
+
* twice, a client counted both copies against its tool-result cap, and a 30 KB
|
|
22
|
+
* tour arrived as 60 KB, blew the cap, and was spilled to a file the model then
|
|
23
|
+
* shelled out to read back. `@typia/mcp` 13.1.0 ships the structured result
|
|
24
|
+
* once (samchon/typia#2020), so the hand-written server had nothing left to fix
|
|
25
|
+
* and the library owns the registration again.
|
|
19
26
|
*/
|
|
20
27
|
export function createServer(
|
|
21
28
|
graph: TtscGraphSource,
|
|
22
29
|
version: string,
|
|
23
30
|
): McpServer {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
void version;
|
|
32
|
+
return createMcpServer(
|
|
33
|
+
typia.llm.controller<ITtscGraphApplication>(
|
|
34
|
+
"ttsc-graph",
|
|
35
|
+
new TtscGraphApplication(graph),
|
|
36
|
+
),
|
|
37
|
+
);
|
|
31
38
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { TtscGraphMemory } from "../model/TtscGraphMemory";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* How public a symbol is, counted from the graph and nothing else.
|
|
5
|
+
*
|
|
6
|
+
* A module's `exports` edges are the checker's export table, resolved through
|
|
7
|
+
* every re-export and barrel it passes. So a symbol carries one edge per module
|
|
8
|
+
* that puts it on the wire, and that count is the project's own answer to how
|
|
9
|
+
* far forward the symbol stands: an internal helper is exported by the file
|
|
10
|
+
* that declares it or by nothing at all, while the name a consumer imports from
|
|
11
|
+
* the package has been re-exported up a chain of barrels and carries an edge
|
|
12
|
+
* from each one.
|
|
13
|
+
*
|
|
14
|
+
* On zod the count is the whole difference between the current API and the
|
|
15
|
+
* previous major it still ships: `parse` and `safeParse` in v4's classic
|
|
16
|
+
* surface carry five, v3's `ZodString` carries three, and v3's
|
|
17
|
+
* `ZodType.safeParse` — a class method, which no export table ever names —
|
|
18
|
+
* carries none. A ranker that knew only the `exported` flag saw all of these as
|
|
19
|
+
* equally public, picked the one whose name matched the question best, and
|
|
20
|
+
* opened zod's tour on the legacy implementation.
|
|
21
|
+
*
|
|
22
|
+
* The count is a fact the compiler resolved. It reads no package.json, guesses
|
|
23
|
+
* from no filename, and holds for a project that has neither.
|
|
24
|
+
*/
|
|
25
|
+
export function exportFanIn(graph: TtscGraphMemory, id: string): number {
|
|
26
|
+
let count = 0;
|
|
27
|
+
for (const edge of graph.incoming(id)) if (edge.kind === "exports") count++;
|
|
28
|
+
return count;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** True when the dump carries an export surface at all. */
|
|
32
|
+
export function hasExportSurface(graph: TtscGraphMemory): boolean {
|
|
33
|
+
const known = cache.get(graph);
|
|
34
|
+
if (known !== undefined) return known;
|
|
35
|
+
const found = graph.edges.some((edge) => edge.kind === "exports");
|
|
36
|
+
cache.set(graph, found);
|
|
37
|
+
return found;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const cache = new WeakMap<TtscGraphMemory, boolean>();
|