@ttsc/graph 0.19.2 → 0.20.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.
Files changed (92) hide show
  1. package/lib/TtscGraphApplication.js +5 -1
  2. package/lib/TtscGraphApplication.js.map +1 -1
  3. package/lib/bin.js +15 -3
  4. package/lib/bin.js.map +1 -1
  5. package/lib/index.d.ts +13 -2
  6. package/lib/index.js +25 -30
  7. package/lib/index.js.map +1 -1
  8. package/lib/launcherArgs.d.ts +24 -0
  9. package/lib/launcherArgs.js +136 -0
  10. package/lib/launcherArgs.js.map +1 -0
  11. package/lib/model/TtscGraphMemory.d.ts +9 -5
  12. package/lib/model/TtscGraphMemory.js +35 -58
  13. package/lib/model/TtscGraphMemory.js.map +1 -1
  14. package/lib/model/TtscGraphNodeId.d.ts +17 -0
  15. package/lib/model/TtscGraphNodeId.js +69 -0
  16. package/lib/model/TtscGraphNodeId.js.map +1 -0
  17. package/lib/model/TtscGraphSession.d.ts +23 -7
  18. package/lib/model/TtscGraphSession.js +423 -171
  19. package/lib/model/TtscGraphSession.js.map +1 -1
  20. package/lib/model/TtscGraphSourceReader.d.ts +27 -0
  21. package/lib/model/TtscGraphSourceReader.js +97 -0
  22. package/lib/model/TtscGraphSourceReader.js.map +1 -0
  23. package/lib/model/loadGraph.d.ts +14 -0
  24. package/lib/model/loadGraph.js +256 -143
  25. package/lib/model/loadGraph.js.map +1 -1
  26. package/lib/reduce.d.ts +4 -1
  27. package/lib/reduce.js +112 -29
  28. package/lib/reduce.js.map +1 -1
  29. package/lib/resolveGraphBinary.d.ts +9 -3
  30. package/lib/resolveGraphBinary.js +9 -3
  31. package/lib/resolveGraphBinary.js.map +1 -1
  32. package/lib/server/createServer.js +22 -11
  33. package/lib/server/createServer.js.map +1 -1
  34. package/lib/server/pathPolicy.d.ts +6 -0
  35. package/lib/server/pathPolicy.js +10 -1
  36. package/lib/server/pathPolicy.js.map +1 -1
  37. package/lib/server/resolveHandle.js +22 -18
  38. package/lib/server/resolveHandle.js.map +1 -1
  39. package/lib/server/resultAudit.d.ts +56 -14
  40. package/lib/server/resultAudit.js +90 -24
  41. package/lib/server/resultAudit.js.map +1 -1
  42. package/lib/server/resultNext.d.ts +5 -0
  43. package/lib/server/resultNext.js.map +1 -1
  44. package/lib/server/runDetails.d.ts +9 -2
  45. package/lib/server/runDetails.js +132 -157
  46. package/lib/server/runDetails.js.map +1 -1
  47. package/lib/server/runEntrypoints.js +1 -1
  48. package/lib/server/runEntrypoints.js.map +1 -1
  49. package/lib/server/runLookup.js +1 -1
  50. package/lib/server/runLookup.js.map +1 -1
  51. package/lib/server/runTour.js +113 -30
  52. package/lib/server/runTour.js.map +1 -1
  53. package/lib/server/runTrace.d.ts +22 -0
  54. package/lib/server/runTrace.js +293 -63
  55. package/lib/server/runTrace.js.map +1 -1
  56. package/lib/structures/ITtscGraphApplication.d.ts +8 -7
  57. package/lib/structures/ITtscGraphDetails.d.ts +18 -8
  58. package/lib/structures/ITtscGraphDump.d.ts +13 -13
  59. package/lib/structures/ITtscGraphNode.d.ts +71 -0
  60. package/lib/structures/ITtscGraphTour.d.ts +1 -1
  61. package/lib/structures/ITtscGraphTrace.d.ts +1 -1
  62. package/lib/view.js +18 -28
  63. package/lib/view.js.map +1 -1
  64. package/package.json +7 -4
  65. package/src/TtscGraphApplication.ts +8 -1
  66. package/src/bin.ts +13 -3
  67. package/src/index.ts +35 -27
  68. package/src/launcherArgs.ts +168 -0
  69. package/src/model/TtscGraphMemory.ts +34 -60
  70. package/src/model/TtscGraphNodeId.ts +77 -0
  71. package/src/model/TtscGraphSession.ts +253 -53
  72. package/src/model/TtscGraphSourceReader.ts +117 -0
  73. package/src/model/loadGraph.ts +6 -1
  74. package/src/reduce.ts +136 -31
  75. package/src/resolveGraphBinary.ts +9 -3
  76. package/src/server/createServer.ts +12 -2
  77. package/src/server/pathPolicy.ts +10 -1
  78. package/src/server/resolveHandle.ts +21 -22
  79. package/src/server/resultAudit.ts +93 -23
  80. package/src/server/resultNext.ts +6 -0
  81. package/src/server/runDetails.ts +134 -165
  82. package/src/server/runEntrypoints.ts +1 -1
  83. package/src/server/runLookup.ts +1 -1
  84. package/src/server/runTour.ts +133 -39
  85. package/src/server/runTrace.ts +401 -65
  86. package/src/structures/ITtscGraphApplication.ts +8 -7
  87. package/src/structures/ITtscGraphDetails.ts +18 -8
  88. package/src/structures/ITtscGraphDump.ts +13 -13
  89. package/src/structures/ITtscGraphNode.ts +80 -0
  90. package/src/structures/ITtscGraphTour.ts +1 -1
  91. package/src/structures/ITtscGraphTrace.ts +1 -1
  92. package/src/view.ts +25 -23
package/lib/reduce.d.ts CHANGED
@@ -4,6 +4,7 @@ export interface RawNode {
4
4
  kind: string;
5
5
  file: string;
6
6
  external?: boolean;
7
+ ignored?: boolean;
7
8
  }
8
9
  export interface RawEdge {
9
10
  from: string;
@@ -35,12 +36,14 @@ export interface ViewerPayload {
35
36
  nodes: number;
36
37
  links: number;
37
38
  droppedExternal: number;
39
+ droppedIgnored: number;
38
40
  droppedByCap: number;
39
41
  };
40
42
  nodes: ViewerNode[];
41
43
  links: ViewerLink[];
42
44
  }
43
- export declare function reduce(raw: RawDump, { maxNodes, keepExternal }?: {
45
+ export declare function reduce(raw: RawDump, { maxNodes, keepExternal, keepIgnored }?: {
44
46
  maxNodes?: number;
45
47
  keepExternal?: boolean;
48
+ keepIgnored?: boolean;
46
49
  }): ViewerPayload;
package/lib/reduce.js CHANGED
@@ -8,18 +8,34 @@ exports.reduce = reduce;
8
8
  function posix(p) {
9
9
  return p.replace(/\\/g, "/");
10
10
  }
11
- /** An absolute path (POSIX or Windows drive); relative dumps skip rerooting. */
11
+ /** Absolute POSIX, Windows drive, or UNC path; relative dumps skip rerooting. */
12
12
  function isAbsolute(p) {
13
13
  return /^(?:[A-Za-z]:)?\//.test(posix(p));
14
14
  }
15
- function commonRoot(files) {
16
- if (files.length === 0)
15
+ function isWindowsPath(p) {
16
+ const normalized = posix(p);
17
+ return /^[A-Za-z]:(?:\/|$)/.test(normalized) || normalized.startsWith("//");
18
+ }
19
+ function directoryOf(file) {
20
+ const normalized = posix(file).replace(/\/+$/, "");
21
+ const slash = normalized.lastIndexOf("/");
22
+ if (slash < 0)
23
+ return "";
24
+ return slash === 0 ? "/" : normalized.slice(0, slash);
25
+ }
26
+ function commonRoot(directories) {
27
+ if (directories.length === 0)
17
28
  return "";
18
- let parts = posix(files[0]).split("/");
19
- for (const file of files.slice(1)) {
20
- const other = posix(file).split("/");
29
+ let parts = posix(directories[0]).split("/");
30
+ const caseInsensitive = directories.every(isWindowsPath);
31
+ for (const directory of directories.slice(1)) {
32
+ const other = posix(directory).split("/");
21
33
  let i = 0;
22
- while (i < parts.length && i < other.length && parts[i] === other[i])
34
+ while (i < parts.length &&
35
+ i < other.length &&
36
+ (caseInsensitive
37
+ ? parts[i].toLowerCase() === other[i].toLowerCase()
38
+ : parts[i] === other[i]))
23
39
  i++;
24
40
  parts = parts.slice(0, i);
25
41
  if (parts.length === 0)
@@ -27,26 +43,72 @@ function commonRoot(files) {
27
43
  }
28
44
  return parts.join("/");
29
45
  }
30
- // An empty root means the dump's paths are already project-relative (the
31
- // current `ttscgraph dump` contract); they pass through structure-intact.
46
+ // A null root means the dump's paths are already project-relative (the current
47
+ // `ttscgraph dump` contract); they pass through structure-intact.
32
48
  function relativize(abs, root) {
33
49
  const a = posix(abs);
34
- const r = posix(root).replace(/\/+$/, "");
35
- if (!r)
50
+ if (root === null)
36
51
  return a;
37
- if (a === r || a.startsWith(r + "/"))
52
+ const normalizedRoot = posix(root);
53
+ const r = normalizedRoot === "/" ? "/" : normalizedRoot.replace(/\/+$/, "");
54
+ const caseInsensitive = isWindowsPath(a) && isWindowsPath(r);
55
+ const comparedPath = caseInsensitive ? a.toLowerCase() : a;
56
+ const comparedRoot = caseInsensitive ? r.toLowerCase() : r;
57
+ if (comparedRoot &&
58
+ (comparedRoot === "/" ||
59
+ comparedPath === comparedRoot ||
60
+ comparedPath.startsWith(comparedRoot + "/")))
38
61
  return a.slice(r.length).replace(/^\/+/, "");
39
62
  const nm = a.lastIndexOf("node_modules/");
63
+ // A package tail is a deliberate normalization: the same dependency reached
64
+ // through two roots is one thing to look at.
40
65
  if (nm >= 0)
41
66
  return a.slice(nm);
42
- const slash = a.lastIndexOf("/");
43
- return slash >= 0 ? a.slice(slash + 1) : a;
67
+ // Anything else keeps its whole path. Collapsing to the basename made the
68
+ // projection non-injective, and node ids are rewritten with it, so two
69
+ // declarations in two files could become one viewer node and an edge could
70
+ // resolve back to the wrong end. A longer label is a cosmetic cost; a
71
+ // collided id is a wrong picture.
72
+ return a;
44
73
  }
45
74
  function rewriteId(id, root) {
46
- const hash = id.indexOf("#");
75
+ const hash = graphNodeIdHash(id);
47
76
  if (hash < 0)
48
77
  return id;
49
- return relativize(id.slice(0, hash), root) + id.slice(hash);
78
+ return (escapeGraphNodeIdPart(relativize(unescapeGraphNodeIdPart(id.slice(0, hash)), root)) + id.slice(hash));
79
+ }
80
+ function escapeGraphNodeIdPart(value) {
81
+ return value.replaceAll("\\", "\\\\").replaceAll("#", "\\#");
82
+ }
83
+ function unescapeGraphNodeIdPart(value) {
84
+ let result = "";
85
+ for (let index = 0; index < value.length; index++) {
86
+ const next = value[index + 1];
87
+ if (value[index] === "\\" && next !== undefined) {
88
+ if (next === "#" || (next === "\\" && !legacyUNCStart(value, index))) {
89
+ result += next;
90
+ index++;
91
+ continue;
92
+ }
93
+ }
94
+ result += value[index];
95
+ }
96
+ return result;
97
+ }
98
+ function legacyUNCStart(value, index) {
99
+ return (index === 0 && value.length > 2 && value[2] !== "\\" && value[2] !== "#");
100
+ }
101
+ function graphNodeIdHash(id) {
102
+ for (let index = 0; index < id.length; index++) {
103
+ if (id[index] !== "#")
104
+ continue;
105
+ let slashes = 0;
106
+ for (let slash = index - 1; slash >= 0 && id[slash] === "\\"; slash--)
107
+ slashes++;
108
+ if (slashes % 2 === 0)
109
+ return index;
110
+ }
111
+ return -1;
50
112
  }
51
113
  function degreeOf(nodes, edges) {
52
114
  const degree = new Map(nodes.map((n) => [n.id, 0]));
@@ -60,9 +122,9 @@ function degreeOf(nodes, edges) {
60
122
  }
61
123
  /**
62
124
  * Collapse the fine-grained wire kinds `ttscgraph dump` emits (calls,
63
- * instantiates, renders, accesses, type_ref, extends, implements) into the
64
- * three display families the viewer colors and its legend name. An unknown kind
65
- * passes through and renders with the fallback color.
125
+ * instantiates, renders, accesses, type_ref, extends, implements, overrides)
126
+ * into the three display families the viewer colors and its legend name. An
127
+ * unknown kind passes through and renders with the fallback color.
66
128
  */
67
129
  const DISPLAY_KIND = {
68
130
  calls: "value-call",
@@ -72,28 +134,41 @@ const DISPLAY_KIND = {
72
134
  type_ref: "type-ref",
73
135
  extends: "heritage",
74
136
  implements: "heritage",
137
+ overrides: "heritage",
75
138
  };
76
139
  function displayKind(kind) {
77
140
  return DISPLAY_KIND[kind] ?? kind;
78
141
  }
79
- function reduce(raw, { maxNodes = 1200, keepExternal = false, } = {}) {
80
- const keptByExternal = raw.nodes.filter((n) => keepExternal || !n.external);
142
+ function reduce(raw, { maxNodes = 1200, keepExternal = false, keepIgnored = false, } = {}) {
143
+ // Drop external boundary leaves and git-ignored generated code (a Prisma
144
+ // client and the like, tagged `ignored` by the dump) so the authored graph is
145
+ // not buried under codegen. The cap is by degree, and generated clients are
146
+ // large and densely connected, so leaving them in does not merely add noise:
147
+ // they outrank authored code for the surviving slots.
148
+ const keep = (n) => (keepExternal || !n.external) && (keepIgnored || !n.ignored);
149
+ const keptByBoundary = raw.nodes.filter(keep);
81
150
  // Reroot only absolute paths (the legacy dump contract); a current dump's
82
151
  // paths are already project-relative and keep their structure as-is.
83
- const projectFiles = raw.nodes.filter((n) => !n.external).map((n) => n.file);
152
+ const projectFiles = raw.nodes
153
+ .filter((n) => !n.external && !n.ignored)
154
+ .map((n) => n.file);
84
155
  const root = projectFiles.length > 0 && isAbsolute(projectFiles[0])
85
- ? commonRoot(projectFiles)
86
- : "";
87
- const liveIds = new Set(keptByExternal.map((n) => n.id));
156
+ ? // A dump may mix path forms from one valid project: in-project sources
157
+ // are relative, package sources carry a node_modules tail, and other
158
+ // out-of-project sources stay absolute. Mixing those into one common
159
+ // root yields the empty string, so only absolute directories vote.
160
+ commonRoot(projectFiles.filter(isAbsolute).map(directoryOf))
161
+ : null;
162
+ const liveIds = new Set(keptByBoundary.map((n) => n.id));
88
163
  const liveEdges = raw.edges.filter((e) => liveIds.has(e.from) && liveIds.has(e.to));
89
- const degree = degreeOf(keptByExternal, liveEdges);
90
- let kept = keptByExternal;
164
+ const degree = degreeOf(keptByBoundary, liveEdges);
165
+ let kept = keptByBoundary;
91
166
  let droppedByCap = 0;
92
167
  if (kept.length > maxNodes) {
93
168
  kept = [...kept]
94
169
  .sort((a, b) => (degree.get(b.id) ?? 0) - (degree.get(a.id) ?? 0))
95
170
  .slice(0, maxNodes);
96
- droppedByCap = keptByExternal.length - kept.length;
171
+ droppedByCap = keptByBoundary.length - kept.length;
97
172
  }
98
173
  const keptIds = new Set(kept.map((n) => n.id));
99
174
  const edges = liveEdges.filter((e) => keptIds.has(e.from) && keptIds.has(e.to));
@@ -122,7 +197,15 @@ function reduce(raw, { maxNodes = 1200, keepExternal = false, } = {}) {
122
197
  rawEdges: raw.edges.length,
123
198
  nodes: nodes.length,
124
199
  links: links.length,
125
- droppedExternal: raw.nodes.length - keptByExternal.length,
200
+ // Each counter reports what its own filter dropped, and reports zero when
201
+ // that filter was turned off. The two are disjoint: an external node is
202
+ // counted as external whether or not it is also ignored.
203
+ droppedExternal: keepExternal
204
+ ? 0
205
+ : raw.nodes.filter((n) => n.external).length,
206
+ droppedIgnored: keepIgnored
207
+ ? 0
208
+ : raw.nodes.filter((n) => n.ignored && !n.external).length,
126
209
  droppedByCap,
127
210
  },
128
211
  nodes,
package/lib/reduce.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"reduce.js","sourceRoot":"","sources":["../src/reduce.ts"],"names":[],"mappings":";AAAA,8EAA8E;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AAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAEjE,OAAO;QACL,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE;QAC1B,MAAM,EAAE;YACN,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM;YAC1B,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM;YAC1B,KAAK,EAAE,KAAK,CAAC,MAAM;YACnB,KAAK,EAAE,KAAK,CAAC,MAAM;YACnB,0EAA0E;YAC1E,wEAAwE;YACxE,yDAAyD;YACzD,eAAe,EAAE,YAAY;gBAC3B,CAAC,CAAC,CAAC;gBACH,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM;YAC9C,cAAc,EAAE,WAAW;gBACzB,CAAC,CAAC,CAAC;gBACH,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM;YAC5D,YAAY;SACb;QACD,KAAK;QACL,KAAK;KACN,CAAC;AACJ,CAAC"}
@@ -2,9 +2,15 @@
2
2
  * Resolve the per-platform `ttscgraph` binary, or `null` when it cannot be
3
3
  * located.
4
4
  *
5
- * `ttsc` is a peer the user installs alongside `@ttsc/graph` (not a dependency
6
- * of this launcher), so resolution starts from the user's project, not from
7
- * this package's own tree.
5
+ * `ttsc` is a peer dependency pinned to this package's own version, installed
6
+ * alongside `@ttsc/graph` in the user's project rather than nested under this
7
+ * launcher, so resolution starts from the user's project, not from this
8
+ * package's own tree.
9
+ *
10
+ * The pin is what keeps the two halves of the graph in step. `literals` and the
11
+ * rest of the node facts are resolved by the Go builder and ride the dump, so a
12
+ * newer `@ttsc/graph` reading an older `ttscgraph` would find those fields
13
+ * simply absent and answer from a graph missing facts it believes are there.
8
14
  *
9
15
  * Resolution order:
10
16
  *
@@ -10,9 +10,15 @@ const node_path_1 = __importDefault(require("node:path"));
10
10
  * Resolve the per-platform `ttscgraph` binary, or `null` when it cannot be
11
11
  * located.
12
12
  *
13
- * `ttsc` is a peer the user installs alongside `@ttsc/graph` (not a dependency
14
- * of this launcher), so resolution starts from the user's project, not from
15
- * this package's own tree.
13
+ * `ttsc` is a peer dependency pinned to this package's own version, installed
14
+ * alongside `@ttsc/graph` in the user's project rather than nested under this
15
+ * launcher, so resolution starts from the user's project, not from this
16
+ * package's own tree.
17
+ *
18
+ * The pin is what keeps the two halves of the graph in step. `literals` and the
19
+ * rest of the node facts are resolved by the Go builder and ride the dump, so a
20
+ * newer `@ttsc/graph` reading an older `ttscgraph` would find those fields
21
+ * simply absent and answer from a graph missing facts it believes are there.
16
22
  *
17
23
  * Resolution order:
18
24
  *
@@ -1 +1 @@
1
- {"version":3,"file":"resolveGraphBinary.js","sourceRoot":"","sources":["../src/resolveGraphBinary.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA4C;AAC5C,0DAA6B;AAE7B;;;;;;;;;;;;;;;;;;GAkBG;AACH,4BACE,GAAG,GAAsB,OAAO,CAAC,GAAG,EACpC,GAAG,GAAW,OAAO,CAAC,GAAG,EAAE;IAE3B,IAAI,GAAG,CAAC,iBAAiB,IAAI,mBAAI,CAAC,UAAU,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACpE,OAAO,GAAG,CAAC,iBAAiB,CAAC;IAC/B,CAAC;IACD,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW,CAAC;IACzE,IAAI,CAAC;QACH,2EAA2E;QAC3E,0DAA0D;QAC1D,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,mBAAmB,EAAE;YAC3D,KAAK,EAAE,CAAC,mBAAI,CAAC,OAAO,CAAC,GAAG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AAC;AACH,CAAC"}
@@ -62,13 +62,15 @@ const TtscGraphApplication_1 = require("../TtscGraphApplication");
62
62
  * and the library owns the registration again.
63
63
  */
64
64
  function createServer(graph, version) {
65
- void version;
66
- return (0, mcp_1.createMcpServer)({
65
+ const server = (0, mcp_1.createMcpServer)({
67
66
  "protocol": "class",
68
67
  "name": "ttsc-graph",
69
68
  "execute": new TtscGraphApplication_1.TtscGraphApplication(graph),
70
69
  "application": _llmApplicationFinalize_1._llmApplicationFinalize({
71
70
  description: "## Code Graph MCP\n\n`inspect_typescript_graph` returns a compiler-built TypeScript graph contract\nfor the current on-disk source snapshot.\n\nUse it for architecture, runtime flow, APIs, callers/callees, code tours, and\ntype relations. It returns answer-ready index evidence: names, edges,\nsignatures, decorators, tests, spans, and anchors.\n\nEvery returned fact \u2014 each name, edge, signature, and span \u2014 is\ncompiler-resolved and verified for the snapshot that call synchronized, so\ntrust it without re-checking against files. Where an operation ranks a\nshortlist against your question (`lookup`, `entrypoints`, `tour`), the facts\nstay verified but the selection is heuristic: judge whether its coverage\nanswers you, and a follow-up request or a read of a cited span is fair when\nit does not.\n\n## Requests\n\nA request is a union: pick the single type below that best fits the question,\nand submit exactly that one.\n\n- `tour`: architecture, runtime flow, orientation, or a code tour. One call is\n the whole answer; do not split it. Name the machinery you expect it to be\n made of in its `reinterpretations`, or send none.\n- `entrypoints`: find where execution starts when entry points are unknown.\n- `lookup`: locate a named symbol.\n- `trace`: follow calls or data flow forward or backward from a symbol, or \u2014\n with `to` \u2014 the path between two symbols when both ends are known, which is\n the one call that answers \"how does A reach B\".\n- `details`: signatures, members, and relations of named symbols \u2014 including\n the classes that implement an interface, which is the one call that answers\n \"what actually implements this\".\n- `overview`: project layers and folder structure.\n- `escape`: the answer is outside the graph (source body text, non-TypeScript\n files, exact search).\n\n## Chain of Thought\n\nFill these fields in order before the call; each one narrows the reasoning\ntoward the single request you submit.\n\n- `question`: the code question, in the user's own words.\n- `draft`: `{ reason, type }` \u2014 why the smallest request that could answer it,\n then that request's `type`.\n- `review`: fix a broad, stale, or duplicate draft. If the graph already\n answered, or the evidence is outside it, escape.\n- `request`: the final choice. Each branch documents its own fields; fill them\n from what the branch says, not from what another branch wanted.\n\n## What to trust\n\nBefore source edits, every returned fact is compiler-resolved and verified.\nNever use extra graph calls, repository search, or file reads to doubt,\nfact-check, re-derive, re-narrate, or re-confirm a returned node, span, edge,\nsignature, decorator, test, reference, step, or anchor. The server resolved\neach one to the type-checked program for the snapshot the call synced to, and\n`audit` says so on every result.\n\nSelection is the separate question. `lookup`, `entrypoints`, and `tour` match\nyour question and return a scored, ranked, per-file-capped, limited\nshortlist; their facts are still verified, but whether the shortlist covers\nwhat you asked is yours to judge, and their `audit` says that instead of\nclaiming completeness. A follow-up request or a read of a cited span for\nmissed coverage is legitimate \u2014 re-confirming a fact the graph already\nresolved is not.\n\n## Stop\n\nLet the result's `next` set the pace, and do not re-confirm what the graph\nresolved.\n\n- A span is a citation, not a cue to open the file to re-check a fact.\n- Follow the result's `next`: `answer` means stop and answer from it, `inspect`\n means make exactly the one request it names, `outside` means escape,\n `clarify` means restate the request.\n- For a ranked shortlist (`lookup`, `entrypoints`, `tour`), `next` and\n `truncated` say whether coverage is settled; when it is not, one more\n request is the right move \u2014 not a file read to re-verify facts already\n given.",
71
+ config: {
72
+ strict: false
73
+ },
72
74
  functions: [
73
75
  {
74
76
  description: "Answer a TypeScript question from the compiler's own index of this\nrepository.\n\nThe graph holds every symbol, call, type, decorator and test, each with its\nfile and line, resolved from the source on disk now. Submit exactly one\nrequest:\n\n- `tour`: architecture, the runtime flow from the public API to the code that\n does the work, nearby paths, and the tests to read \u2014 a whole orientation\n in one call\n- `trace`: what a symbol calls, what calls it, or the path from A to B\n- `details`: signatures, members, and what implements an interface\n- `lookup`: where a named symbol is declared\n- `entrypoints`: where execution starts, when the entry is unknown\n- `overview`: the project's layers and folder structure\n\nEvery fact in a result is the checker's own resolution, audited before\nreturn, so no fact needs verifying; for the ranked operations (`lookup`,\n`entrypoints`, `tour`), judge whether the shortlist covers your question.\nRead a file for what the graph does not carry: a body, the text in a span.",
@@ -78,7 +80,7 @@ function createServer(graph, version) {
78
80
  properties: {
79
81
  audit: {
80
82
  type: "string",
81
- description: "What the server audited this result against before returning it, in its\nown words: every node, span, edge, signature, member, and step in it\nresolves to the type-checked program for the snapshot the call synced to,\nso opening a file it cites only returns a fact already in it.\n\nThe audit is operation-aware. For the exact operations (`trace`,\n`details`, `overview`) it reports the result as the structure the graph\nholds for the handles named, bounded only where `truncated` says. For the\nranked operations (`lookup`, `entrypoints`, `tour`) it adds that the\nselection is heuristic \u2014 matched, scored, ranked, and limited against the\nquestion \u2014 so the facts are verified but the shortlist's coverage is the\ncaller's to judge."
83
+ description: "What the server audited this result against before returning it, in its\nown words: every node, span, edge, signature, member, and step in it\nresolves to the type-checked program for the snapshot the call synced to,\nso opening a file it cites only returns a fact already in it.\n\nThe audit is operation-aware. For the walks from a named handle (`trace`,\n`overview`) it reports the result as the structure the graph holds,\nbounded where `truncated` says. For `details` it reports the two halves of\na resolved symbol: its own shape returned whole, its fan-out returned as a\nslice with `trace` for the rest. For the ranked operations (`lookup`,\n`entrypoints`, `tour`) it adds that the selection is heuristic \u2014 matched,\nscored, ranked, and limited against the question \u2014 so the facts are\nverified but the shortlist's coverage is the caller's to judge."
82
84
  },
83
85
  next: {
84
86
  $ref: "#/$defs/ITtscGraphNext",
@@ -151,7 +153,7 @@ function createServer(graph, version) {
151
153
  "arguments"
152
154
  ],
153
155
  additionalProperties: false,
154
- description: "A decorator as written on a declaration, carried on the decorated\n's `decorators`. Reported faithfully, not interpreted\nper framework: `name` is the decorator as written (`Controller`, `Get`,\n`TypedRoute.Get`, ...), and statically resolvable literal arguments are\npreserved so a consumer applies its own meaning without re-parsing source."
156
+ description: "A decorator as written on a declaration, carried on the decorated\nITtscGraphNode's `decorators`. Reported faithfully, not interpreted\nper framework: `name` is the decorator as written (`Controller`, `Get`,\n`TypedRoute.Get`, ...), and statically resolvable literal arguments are\npreserved so a consumer applies its own meaning without re-parsing source."
155
157
  },
156
158
  "ITtscGraphDecorator.IArgument": {
157
159
  type: "object",
@@ -173,7 +175,7 @@ function createServer(graph, version) {
173
175
  },
174
176
  required: [],
175
177
  additionalProperties: false,
176
- description: "One argument of an . `literal` is set only when\nthe argument is a string, number, or boolean literal the producer could\nresolve statically, so a consumer can use it without evaluating code."
178
+ description: "One argument of an ITtscGraphDecorator. `literal` is set only when\nthe argument is a string, number, or boolean literal the producer could\nresolve statically, so a consumer can use it without evaluating code."
177
179
  },
178
180
  ITtscGraphDetails: {
179
181
  type: "object",
@@ -372,7 +374,7 @@ function createServer(graph, version) {
372
374
  items: {
373
375
  type: "string"
374
376
  },
375
- description: "String literal values from the signature."
377
+ description: "The complete value set a type alias or enum admits, in TypeScript source\nform (`\"a\"`, `1`, `true`, `null`) \u2014 the checker's resolved union members,\nnot the quoted tokens that happened to fit in `signature`.\n\nAbsent when the type has no enumerable value set. A `signature` is capped\nat the declaration head, so for a union or enum written across several\nlines this is the field that carries the members."
376
378
  },
377
379
  members: {
378
380
  type: "array",
@@ -779,7 +781,7 @@ function createServer(graph, version) {
779
781
  "startLine"
780
782
  ],
781
783
  additionalProperties: false,
782
- description: "A source location grounding a node or edge in real code: the declaration span\nfor a node, or the expression range that produced an edge. Display and\ngrounding only, never identity (a node's id is position-invariant, see\n). Lines and columns are 1-based; MCP keeps evidence as\ncoordinates, so read the file yourself when you truly need source text."
784
+ description: "A source location grounding a node or edge in real code: the declaration span\nfor a node, or the expression range that produced an edge. Display and\ngrounding only, never identity (a node's id is position-invariant, see\nITtscGraphNode). Lines and columns are 1-based; MCP keeps evidence as\ncoordinates, so read the file yourself when you truly need source text."
783
785
  },
784
786
  ITtscGraphLookup: {
785
787
  type: "object",
@@ -1337,7 +1339,7 @@ function createServer(graph, version) {
1337
1339
  },
1338
1340
  truncated: {
1339
1341
  type: "boolean",
1340
- description: "True when the trace hit its node or depth cap; the returned flow stands."
1342
+ description: "In an open trace, true when a bound omitted an eligible node or hop."
1341
1343
  },
1342
1344
  target: {
1343
1345
  $ref: "#/$defs/ITtscGraphTrace.INode",
@@ -1679,15 +1681,15 @@ function createServer(graph, version) {
1679
1681
  },
1680
1682
  neighborLimit: {
1681
1683
  type: "number",
1682
- description: "Maximum dependencies and dependents per side when `neighbors:true`. Above\na few is usually overfetch; call `trace` for flow instead."
1684
+ description: "Dependencies and dependents per side when `neighbors:true`. A small\norientation slice by default; what uses a symbol grows with its\npopularity, so `trace` answers the whole \"who uses this\"."
1683
1685
  },
1684
1686
  memberLimit: {
1685
1687
  type: "number",
1686
- description: "Maximum owned members for a container or object literal."
1688
+ description: "Owned members for a container or object literal. The complete outline by\ndefault \u2014 a class's members and an enum's are the symbol itself, so they\nare not sampled. Pass a number to cap."
1687
1689
  },
1688
1690
  dependencyLimit: {
1689
1691
  type: "number",
1690
- description: "Maximum direct execution and type references per group."
1692
+ description: "Direct execution and type references per group. A small orientation slice\nby default; `trace` follows the whole fan-out."
1691
1693
  },
1692
1694
  includeExternal: {
1693
1695
  type: "boolean",
@@ -2162,5 +2164,14 @@ function createServer(graph, version) {
2162
2164
  ]
2163
2165
  })
2164
2166
  });
2167
+ // @typia/mcp 13.1.0 exposes no class-controller version option. The MCP SDK
2168
+ // keeps the initialize implementation on its public inner Server, so update
2169
+ // that already-constructed implementation before any transport connects.
2170
+ const inner = server.server;
2171
+ if (inner._serverInfo === undefined) {
2172
+ throw new Error("@ttsc/graph: MCP SDK omitted the server implementation");
2173
+ }
2174
+ inner._serverInfo.version = version;
2175
+ return server;
2165
2176
  }
2166
2177
  //# sourceMappingURL=createServer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createServer.js","sourceRoot":"","sources":["../../src/server/createServer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oCAA6C;AAC7C,kDAA0B;AAE1B,kEAAgF;AAGhF;;;;;;;;;;;;;;;;;;GAkBG;AACH,sBACE,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAElC,CAAC;IACF,4EAA4E;IAC5E,4EAA4E;IAC5E,yEAAyE;IACzE,MAAM,KAAK,GAAG,MAAM,CAAC,MAEpB,CAAC;IACF,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC;IACpC,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,6 +1,12 @@
1
1
  import { ITtscGraphNode } from "../structures/ITtscGraphNode";
2
2
  /** True for dependency declarations outside the authored project graph. */
3
3
  export declare function isExternalNode(node: ITtscGraphNode): boolean;
4
+ /**
5
+ * True for a `.d.ts` declaration file. Every declaration such a file holds is
6
+ * ambient by construction, so none of them carries a body the graph can walk
7
+ * into, whether or not the `declare` keyword is written out.
8
+ */
9
+ export declare function isDeclarationFile(file: string): boolean;
4
10
  /** True for tests, examples, fixtures, generated output, and build artifacts. */
5
11
  export declare function isSupportPath(file: string): boolean;
6
12
  /** True for source files whose declarations are tests or test helpers. */
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isExternalNode = isExternalNode;
4
+ exports.isDeclarationFile = isDeclarationFile;
4
5
  exports.isSupportPath = isSupportPath;
5
6
  exports.isTestPath = isTestPath;
6
7
  exports.isPublicApiNoisePath = isPublicApiNoisePath;
@@ -10,6 +11,14 @@ function isExternalNode(node) {
10
11
  node.file.startsWith("bundled://") ||
11
12
  /(^|\/)node_modules\//.test(node.file));
12
13
  }
14
+ /**
15
+ * True for a `.d.ts` declaration file. Every declaration such a file holds is
16
+ * ambient by construction, so none of them carries a body the graph can walk
17
+ * into, whether or not the `declare` keyword is written out.
18
+ */
19
+ function isDeclarationFile(file) {
20
+ return /\.d\.[cm]?ts$/.test(file);
21
+ }
13
22
  /** True for tests, examples, fixtures, generated output, and build artifacts. */
14
23
  function isSupportPath(file) {
15
24
  return (file === "" ||
@@ -18,7 +27,7 @@ function isSupportPath(file) {
18
27
  /(^|\/)(test|tests|__tests__|spec|sample|samples|fixture|fixtures|__fixtures__|example|examples)\//.test(file) ||
19
28
  /\.(test|spec)\.[cm]?tsx?$/.test(file) ||
20
29
  /(^|\/)typings\.[cm]?ts$/.test(file) ||
21
- /\.d\.[cm]?ts$/.test(file) ||
30
+ isDeclarationFile(file) ||
22
31
  /(^|\/)(dist|build|coverage|generated|__generated__)\//.test(file));
23
32
  }
24
33
  /** True for source files whose declarations are tests or test helpers. */
@@ -1 +1 @@
1
- {"version":3,"file":"pathPolicy.js","sourceRoot":"","sources":["../../src/server/pathPolicy.ts"],"names":[],"mappings":";;;;;;AAEA,2EAA2E;AAC3E,wBAA+B,IAAoB;IACjD,OAAO,CACL,IAAI,CAAC,QAAQ;QACb,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;QAClC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CACvC,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,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;QAC7B,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC;QACjC,mGAAmG,CAAC,IAAI,CACtG,IAAI,CACL;QACD,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC;QACtC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC;QACpC,iBAAiB,CAAC,IAAI,CAAC;QACvB,uDAAuD,CAAC,IAAI,CAAC,IAAI,CAAC,CACnE,CAAC;AACJ,CAAC;AAED,0EAA0E;AAC1E,oBAA2B,IAAY;IACrC,OAAO,CACL,qCAAqC,CAAC,IAAI,CAAC,IAAI,CAAC;QAChD,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,CACvC,CAAC;AACJ,CAAC;AAED,yEAAyE;AACzE,8BAAqC,IAAY;IAC/C,OAAO,CACL,aAAa,CAAC,IAAI,CAAC;QACnB,4BAA4B,CAAC,IAAI,CAAC,IAAI,CAAC;QACvC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAC9B,CAAC;AACJ,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveGraphHandle = resolveGraphHandle;
4
+ const TtscGraphNodeId_1 = require("../model/TtscGraphNodeId");
4
5
  const exportSurface_1 = require("./exportSurface");
5
6
  const pathPolicy_1 = require("./pathPolicy");
6
7
  /**
@@ -33,15 +34,15 @@ function resolveGraphHandle(graph, handle, candidateLimit = 12) {
33
34
  const byId = graph.node(handle);
34
35
  if (byId !== undefined)
35
36
  return { node: byId };
36
- const byName = resolveGraphName(graph, handle, candidateLimit);
37
+ const byName = resolveGraphName(graph, handle);
37
38
  if (byName.node !== undefined || byName.candidates !== undefined)
38
39
  return rank(graph, byName, candidateLimit);
39
- const byFile = resolveFileQualified(graph, handle, candidateLimit);
40
+ const byFile = resolveFileQualified(graph, handle);
40
41
  if (byFile.node !== undefined || byFile.candidates !== undefined)
41
42
  return rank(graph, byFile, candidateLimit);
42
43
  const symbol = symbolPartOf(handle) ?? memberPartOf(handle);
43
44
  if (symbol !== undefined)
44
- return rank(graph, resolveGraphName(graph, symbol, candidateLimit), candidateLimit);
45
+ return rank(graph, resolveGraphName(graph, symbol), candidateLimit);
45
46
  return {};
46
47
  }
47
48
  /**
@@ -61,27 +62,21 @@ function memberPartOf(handle) {
61
62
  }
62
63
  /** The symbol an id-shaped handle names: `dir/file.ts#Class.method:kind`. */
63
64
  function symbolPartOf(handle) {
64
- const hash = handle.lastIndexOf("#");
65
- if (hash < 0)
66
- return undefined;
67
- const symbol = handle.slice(hash + 1);
68
- const kind = symbol.lastIndexOf(":");
69
- const name = kind < 0 ? symbol : symbol.slice(0, kind);
70
- return name.length > 0 ? name : undefined;
65
+ return (0, TtscGraphNodeId_1.parseTtscGraphNodeId)(handle)?.name;
71
66
  }
72
- function resolveGraphName(graph, name, candidateLimit) {
67
+ function resolveGraphName(graph, name) {
73
68
  const exact = graph.symbols(name);
74
69
  if (exact.length === 1)
75
70
  return { node: exact[0] };
76
71
  if (exact.length > 1)
77
- return { candidates: exact.slice(0, candidateLimit) };
72
+ return { candidates: [...exact] };
78
73
  if (name.includes(".")) {
79
74
  const suffix = `.${name}`;
80
75
  const suffixMatches = graph.nodes.filter((node) => node.kind !== "file" && node.qualifiedName?.endsWith(suffix) === true);
81
76
  if (suffixMatches.length === 1)
82
77
  return { node: suffixMatches[0] };
83
78
  if (suffixMatches.length > 1) {
84
- return { candidates: suffixMatches.slice(0, candidateLimit) };
79
+ return { candidates: suffixMatches };
85
80
  }
86
81
  }
87
82
  return {};
@@ -92,7 +87,7 @@ function resolveGraphName(graph, name, candidateLimit) {
92
87
  * disambiguates a common name from what the graph just showed it, and it names
93
88
  * exactly one node whenever that file declares the symbol.
94
89
  */
95
- function resolveFileQualified(graph, handle, candidateLimit) {
90
+ function resolveFileQualified(graph, handle) {
96
91
  const dot = handle.indexOf(".");
97
92
  if (dot <= 0)
98
93
  return {};
@@ -106,7 +101,7 @@ function resolveFileQualified(graph, handle, candidateLimit) {
106
101
  if (matches.length === 1)
107
102
  return { node: matches[0] };
108
103
  if (matches.length > 1)
109
- return { candidates: matches.slice(0, candidateLimit) };
104
+ return { candidates: matches };
110
105
  return {};
111
106
  }
112
107
  /** `packages/core/src/renderer.ts` -> `renderer`. */
@@ -125,11 +120,20 @@ function fileStem(file) {
125
120
  function rank(graph, resolved, candidateLimit) {
126
121
  if (resolved.candidates === undefined)
127
122
  return resolved;
128
- const ranked = [...resolved.candidates]
129
- .sort((a, b) => candidateScore(graph, b) - candidateScore(graph, a))
130
- .slice(0, candidateLimit);
123
+ const ranked = resolved.candidates
124
+ .map((node) => ({ node, score: candidateScore(graph, node) }))
125
+ .sort((a, b) => {
126
+ const score = b.score - a.score;
127
+ return score !== 0 ? score : compareIdentity(a.node.id, b.node.id);
128
+ })
129
+ .slice(0, candidateLimit)
130
+ .map(({ node }) => node);
131
131
  return { candidates: ranked };
132
132
  }
133
+ /** Compare position-invariant ids without locale-dependent collation. */
134
+ function compareIdentity(left, right) {
135
+ return left < right ? -1 : left > right ? 1 : 0;
136
+ }
133
137
  function candidateScore(graph, node) {
134
138
  let score = Math.min(48, Math.log2(1 + (0, exportSurface_1.exportFanIn)(graph, node.id)) * 20);
135
139
  if (node.exported)