@ttsc/graph 0.16.4 → 0.16.6

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 (115) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +24 -53
  3. package/lib/TtscGraphApplication.js +59 -0
  4. package/lib/TtscGraphApplication.js.map +1 -0
  5. package/lib/index.js +31 -108
  6. package/lib/index.js.map +1 -1
  7. package/lib/model/TtscGraphMemory.js +185 -0
  8. package/lib/model/TtscGraphMemory.js.map +1 -0
  9. package/lib/model/loadGraph.js +418 -0
  10. package/lib/model/loadGraph.js.map +1 -0
  11. package/lib/reduce.js +101 -0
  12. package/lib/reduce.js.map +1 -0
  13. package/lib/resolveGraphBinary.js +42 -0
  14. package/lib/resolveGraphBinary.js.map +1 -0
  15. package/lib/server/accessAliases.js +53 -0
  16. package/lib/server/accessAliases.js.map +1 -0
  17. package/lib/server/createServer.js +1726 -0
  18. package/lib/server/createServer.js.map +1 -0
  19. package/lib/server/instructions.js +80 -0
  20. package/lib/server/instructions.js.map +1 -0
  21. package/lib/server/resolveHandle.js +25 -0
  22. package/lib/server/resolveHandle.js.map +1 -0
  23. package/lib/server/runDetails.js +413 -0
  24. package/lib/server/runDetails.js.map +1 -0
  25. package/lib/server/runEntrypoints.js +211 -0
  26. package/lib/server/runEntrypoints.js.map +1 -0
  27. package/lib/server/runLookup.js +234 -0
  28. package/lib/server/runLookup.js.map +1 -0
  29. package/lib/server/runOverview.js +160 -0
  30. package/lib/server/runOverview.js.map +1 -0
  31. package/lib/server/runTrace.js +314 -0
  32. package/lib/server/runTrace.js.map +1 -0
  33. package/lib/server/startServer.js +21 -0
  34. package/lib/server/startServer.js.map +1 -0
  35. package/lib/structures/ITtscGraphApplication.js +3 -0
  36. package/lib/structures/ITtscGraphApplication.js.map +1 -0
  37. package/lib/structures/ITtscGraphDecorator.js +3 -0
  38. package/lib/structures/ITtscGraphDecorator.js.map +1 -0
  39. package/lib/structures/ITtscGraphDetails.js +3 -0
  40. package/lib/structures/ITtscGraphDetails.js.map +1 -0
  41. package/lib/structures/ITtscGraphDiagnostic.js +3 -0
  42. package/lib/structures/ITtscGraphDiagnostic.js.map +1 -0
  43. package/lib/structures/ITtscGraphDump.js +3 -0
  44. package/lib/structures/ITtscGraphDump.js.map +1 -0
  45. package/lib/structures/ITtscGraphEdge.js +3 -0
  46. package/lib/structures/ITtscGraphEdge.js.map +1 -0
  47. package/lib/structures/ITtscGraphEntrypoints.js +3 -0
  48. package/lib/structures/ITtscGraphEntrypoints.js.map +1 -0
  49. package/lib/structures/ITtscGraphEscape.js +3 -0
  50. package/lib/structures/ITtscGraphEscape.js.map +1 -0
  51. package/lib/structures/ITtscGraphEvidence.js +3 -0
  52. package/lib/structures/ITtscGraphEvidence.js.map +1 -0
  53. package/lib/structures/ITtscGraphLookup.js +3 -0
  54. package/lib/structures/ITtscGraphLookup.js.map +1 -0
  55. package/lib/structures/ITtscGraphNode.js +3 -0
  56. package/lib/structures/ITtscGraphNode.js.map +1 -0
  57. package/lib/structures/ITtscGraphOverview.js +3 -0
  58. package/lib/structures/ITtscGraphOverview.js.map +1 -0
  59. package/lib/structures/ITtscGraphTrace.js +3 -0
  60. package/lib/structures/ITtscGraphTrace.js.map +1 -0
  61. package/lib/structures/TtscGraphEdgeKind.js +3 -0
  62. package/lib/structures/TtscGraphEdgeKind.js.map +1 -0
  63. package/lib/structures/TtscGraphNodeKind.js +3 -0
  64. package/lib/structures/TtscGraphNodeKind.js.map +1 -0
  65. package/lib/structures/TtscGraphNodeModifier.js +3 -0
  66. package/lib/structures/TtscGraphNodeModifier.js.map +1 -0
  67. package/lib/structures/index.js +38 -0
  68. package/lib/structures/index.js.map +1 -0
  69. package/lib/view.js +140 -0
  70. package/lib/view.js.map +1 -0
  71. package/lib/viewer/index.html +123 -0
  72. package/lib/viewer/viewer.js +4610 -0
  73. package/package.json +17 -4
  74. package/src/TtscGraphApplication.ts +64 -0
  75. package/src/index.ts +40 -126
  76. package/src/model/TtscGraphMemory.ts +204 -0
  77. package/src/model/loadGraph.ts +85 -0
  78. package/src/reduce.ts +165 -0
  79. package/src/resolveGraphBinary.ts +40 -0
  80. package/src/server/accessAliases.ts +55 -0
  81. package/src/server/createServer.ts +101 -0
  82. package/src/server/instructions.ts +76 -0
  83. package/src/server/resolveHandle.ts +34 -0
  84. package/src/server/runDetails.ts +469 -0
  85. package/src/server/runEntrypoints.ts +256 -0
  86. package/src/server/runLookup.ts +257 -0
  87. package/src/server/runOverview.ts +166 -0
  88. package/src/server/runTrace.ts +359 -0
  89. package/src/server/startServer.ts +25 -0
  90. package/src/structures/ITtscGraphApplication.ts +116 -0
  91. package/src/structures/ITtscGraphDecorator.ts +31 -0
  92. package/src/structures/ITtscGraphDetails.ts +134 -0
  93. package/src/structures/ITtscGraphDiagnostic.ts +34 -0
  94. package/src/structures/ITtscGraphDump.ts +35 -0
  95. package/src/structures/ITtscGraphEdge.ts +24 -0
  96. package/src/structures/ITtscGraphEntrypoints.ts +118 -0
  97. package/src/structures/ITtscGraphEscape.ts +39 -0
  98. package/src/structures/ITtscGraphEvidence.ts +26 -0
  99. package/src/structures/ITtscGraphLookup.ts +61 -0
  100. package/src/structures/ITtscGraphNode.ts +70 -0
  101. package/src/structures/ITtscGraphOverview.ts +87 -0
  102. package/src/structures/ITtscGraphTrace.ts +140 -0
  103. package/src/structures/TtscGraphEdgeKind.ts +23 -0
  104. package/src/structures/TtscGraphNodeKind.ts +26 -0
  105. package/src/structures/TtscGraphNodeModifier.ts +19 -0
  106. package/src/structures/index.ts +22 -0
  107. package/src/view.ts +155 -0
  108. package/src/viewer/index.html +123 -0
  109. package/src/viewer/main.ts +209 -0
  110. package/lib/bin.d.ts +0 -2
  111. package/lib/diagnostics.d.ts +0 -23
  112. package/lib/diagnostics.js +0 -84
  113. package/lib/diagnostics.js.map +0 -1
  114. package/lib/index.d.ts +0 -29
  115. package/src/diagnostics.ts +0 -93
@@ -0,0 +1,1726 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.createServer = createServer;
40
+ const _a = __importStar(require("typia/lib/internal/_llmApplicationFinalize"));
41
+ const _b = __importStar(require("typia/lib/internal/_validateReport"));
42
+ const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
43
+ const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
44
+ const typia_1 = __importDefault(require("typia"));
45
+ const TtscGraphApplication_1 = require("../TtscGraphApplication");
46
+ const instructions_1 = require("./instructions");
47
+ /**
48
+ * Build the MCP server for a graph. `typia.llm.controller` reflects
49
+ * {@link ITtscGraphApplication} into a validated tool application. Every tool's
50
+ * JSON schema and argument validator is generated from the method's TypeScript
51
+ * types and JSDoc, so there is no hand-written schema. The list/call handlers
52
+ * below are the minimal standalone registration: list the generated functions,
53
+ * and on a call validate the arguments (returning typia's errors for the model
54
+ * to self-correct) before invoking the method.
55
+ *
56
+ * Registration is inlined rather than pulled from `@typia/mcp` to keep the
57
+ * dependency surface to `typia` plus the MCP SDK and avoid version-pinning the
58
+ * wider typia ecosystem; the shape it relies on is `typia.llm.controller`'s
59
+ * public output.
60
+ */
61
+ function createServer(graph, version) {
62
+ const controller = {
63
+ "protocol": "class",
64
+ "name": "graph",
65
+ "execute": new TtscGraphApplication_1.TtscGraphApplication(graph),
66
+ "application": _a._llmApplicationFinalize({
67
+ functions: [
68
+ {
69
+ description: "Query the TypeScript project graph for code evidence.\n\nUse this before answering TypeScript codebase questions. It returns\nchecker-resolved symbols, dependency paths, edge evidence ranges, and\nsourceSpan anchors from the resident graph, avoiding assumptions, shell\nsearch, or file reads when graph evidence is enough.\n\nFill properties in order: question, graphNeed, draft, review, request.\nWrite `draft.reason` before `draft.type`, then choose `entrypoints`,\n`lookup`, `trace`, `details`, `overview`, or `escape`.\n\nMost answers should need 1-3 calls; four is the hard stop for one answer.\nKeep slices small, prefer defaults, and stop once file/symbol/range\nevidence is enough.",
70
+ name: "query",
71
+ output: {
72
+ type: "object",
73
+ properties: {
74
+ result: {
75
+ anyOf: [
76
+ {
77
+ $ref: "#/$defs/ITtscGraphDetails"
78
+ },
79
+ {
80
+ $ref: "#/$defs/ITtscGraphEntrypoints"
81
+ },
82
+ {
83
+ $ref: "#/$defs/ITtscGraphEscape"
84
+ },
85
+ {
86
+ $ref: "#/$defs/ITtscGraphLookup"
87
+ },
88
+ {
89
+ $ref: "#/$defs/ITtscGraphOverview"
90
+ },
91
+ {
92
+ $ref: "#/$defs/ITtscGraphTrace"
93
+ }
94
+ ],
95
+ "x-discriminator": {
96
+ mapping: {
97
+ details: "#/$defs/ITtscGraphDetails",
98
+ entrypoints: "#/$defs/ITtscGraphEntrypoints",
99
+ escape: "#/$defs/ITtscGraphEscape",
100
+ lookup: "#/$defs/ITtscGraphLookup",
101
+ overview: "#/$defs/ITtscGraphOverview",
102
+ trace: "#/$defs/ITtscGraphTrace"
103
+ },
104
+ propertyName: "type"
105
+ }
106
+ }
107
+ },
108
+ required: [
109
+ "result"
110
+ ],
111
+ additionalProperties: false,
112
+ $defs: {
113
+ ITtscGraphDecorator: {
114
+ type: "object",
115
+ properties: {
116
+ arguments: {
117
+ type: "array",
118
+ items: {
119
+ $ref: "#/$defs/ITtscGraphDecorator.IArgument"
120
+ },
121
+ description: "The literal call arguments, in source order. Empty for a bare decorator."
122
+ },
123
+ name: {
124
+ type: "string",
125
+ description: "The decorator name as written, qualified through its access path:\n`Controller`, `Get`, `TypedRoute.Get`, `MessagePattern`."
126
+ }
127
+ },
128
+ required: [
129
+ "name",
130
+ "arguments"
131
+ ],
132
+ additionalProperties: false
133
+ },
134
+ "ITtscGraphDecorator.IArgument": {
135
+ type: "object",
136
+ properties: {
137
+ literal: {
138
+ anyOf: [
139
+ {
140
+ type: "string"
141
+ },
142
+ {
143
+ type: "number"
144
+ },
145
+ {
146
+ type: "boolean"
147
+ }
148
+ ],
149
+ description: "The statically-resolved literal value, when the argument is a literal."
150
+ }
151
+ },
152
+ required: [],
153
+ additionalProperties: false
154
+ },
155
+ ITtscGraphDetails: {
156
+ type: "object",
157
+ properties: {
158
+ type: {
159
+ type: "string",
160
+ "enum": [
161
+ "details"
162
+ ],
163
+ description: "Discriminator for selected symbol inspection."
164
+ },
165
+ nodes: {
166
+ type: "array",
167
+ items: {
168
+ $ref: "#/$defs/ITtscGraphDetails.INode"
169
+ }
170
+ },
171
+ unknown: {
172
+ type: "array",
173
+ items: {
174
+ type: "string"
175
+ },
176
+ description: "Handles that resolved to no node, or that were ambiguous."
177
+ }
178
+ },
179
+ required: [
180
+ "type",
181
+ "nodes",
182
+ "unknown"
183
+ ],
184
+ additionalProperties: false
185
+ },
186
+ "ITtscGraphDetails.IMember": {
187
+ type: "object",
188
+ properties: {
189
+ decorators: {
190
+ type: "array",
191
+ items: {
192
+ $ref: "#/$defs/ITtscGraphDecorator"
193
+ },
194
+ description: "Decorators written on this member, when any."
195
+ },
196
+ kind: {
197
+ type: "string"
198
+ },
199
+ line: {
200
+ type: "number",
201
+ description: "1-based declaration line, when known."
202
+ },
203
+ name: {
204
+ type: "string"
205
+ },
206
+ signature: {
207
+ type: "string",
208
+ description: "The member's declaration signature."
209
+ }
210
+ },
211
+ required: [
212
+ "name",
213
+ "kind"
214
+ ],
215
+ additionalProperties: false
216
+ },
217
+ "ITtscGraphDetails.INode": {
218
+ type: "object",
219
+ properties: {
220
+ calls: {
221
+ type: "array",
222
+ items: {
223
+ $ref: "#/$defs/ITtscGraphDetails.IReference"
224
+ },
225
+ description: "Direct execution dependencies in source order, with edge evidence."
226
+ },
227
+ decorators: {
228
+ type: "array",
229
+ items: {
230
+ $ref: "#/$defs/ITtscGraphDecorator"
231
+ },
232
+ description: "Decorators written on this declaration, when any."
233
+ },
234
+ dependedOnBy: {
235
+ type: "array",
236
+ items: {
237
+ $ref: "#/$defs/ITtscGraphDetails.IReference"
238
+ },
239
+ description: "Symbols that use this node (incoming dependency edges)."
240
+ },
241
+ dependsOn: {
242
+ type: "array",
243
+ items: {
244
+ $ref: "#/$defs/ITtscGraphDetails.IReference"
245
+ },
246
+ description: "Symbols this node uses (outgoing dependency edges)."
247
+ },
248
+ file: {
249
+ type: "string"
250
+ },
251
+ id: {
252
+ type: "string"
253
+ },
254
+ implementation: {
255
+ $ref: "#/$defs/ITtscGraphEvidence",
256
+ description: "Assigned implementation span, when source comes from one."
257
+ },
258
+ kind: {
259
+ type: "string"
260
+ },
261
+ line: {
262
+ type: "number",
263
+ description: "1-based declaration line, when known."
264
+ },
265
+ literals: {
266
+ type: "array",
267
+ items: {
268
+ type: "string"
269
+ },
270
+ description: "String literal values from the signature."
271
+ },
272
+ members: {
273
+ type: "array",
274
+ items: {
275
+ $ref: "#/$defs/ITtscGraphDetails.IMember"
276
+ },
277
+ description: "For a container or object-literal variable: the owned symbol or top-level\nproperty outline a consumer reaches for, without bodies."
278
+ },
279
+ name: {
280
+ type: "string"
281
+ },
282
+ signature: {
283
+ type: "string",
284
+ description: "The declaration signature: its first line(s) up to the body."
285
+ },
286
+ sourceSpan: {
287
+ $ref: "#/$defs/PickITtscGraphEvidenceendLinefilestartLine",
288
+ description: "The declaration or implementation file and line range, when known."
289
+ },
290
+ types: {
291
+ type: "array",
292
+ items: {
293
+ $ref: "#/$defs/ITtscGraphDetails.IReference"
294
+ },
295
+ description: "Direct type dependencies in source order, with edge evidence."
296
+ }
297
+ },
298
+ required: [
299
+ "id",
300
+ "name",
301
+ "kind",
302
+ "file"
303
+ ],
304
+ additionalProperties: false
305
+ },
306
+ "ITtscGraphDetails.IReference": {
307
+ type: "object",
308
+ properties: {
309
+ aliases: {
310
+ type: "array",
311
+ items: {
312
+ type: "string"
313
+ },
314
+ description: "Stable access-path aliases derived from edge evidence. For example, an\nedge to `Owner.member` through `obj.slot.member` may expose\n`Owner.slot.member` so answers can preserve both the resolved symbol and\nthe source access path."
315
+ },
316
+ evidence: {
317
+ $ref: "#/$defs/ITtscGraphEvidence",
318
+ description: "Source span for the expression that produced this relationship. It lets\nan agent see why the edge exists without opening the file."
319
+ },
320
+ file: {
321
+ type: "string"
322
+ },
323
+ id: {
324
+ type: "string"
325
+ },
326
+ kind: {
327
+ type: "string"
328
+ },
329
+ line: {
330
+ type: "number",
331
+ description: "1-based declaration line, when known."
332
+ },
333
+ name: {
334
+ type: "string"
335
+ },
336
+ relation: {
337
+ type: "string",
338
+ description: "The edge kind connecting the two (`calls`, `type_ref`, ...)."
339
+ }
340
+ },
341
+ required: [
342
+ "id",
343
+ "name",
344
+ "kind",
345
+ "file",
346
+ "relation"
347
+ ],
348
+ additionalProperties: false
349
+ },
350
+ ITtscGraphEntrypoints: {
351
+ type: "object",
352
+ properties: {
353
+ type: {
354
+ type: "string",
355
+ "enum": [
356
+ "entrypoints"
357
+ ],
358
+ description: "Discriminator for first-pass question indexing."
359
+ },
360
+ hits: {
361
+ type: "array",
362
+ items: {
363
+ $ref: "#/$defs/ITtscGraphEntrypoints.IHit"
364
+ },
365
+ description: "Ranked symbols relevant to the query."
366
+ },
367
+ mentions: {
368
+ type: "array",
369
+ items: {
370
+ $ref: "#/$defs/ITtscGraphEntrypoints.IMention"
371
+ },
372
+ description: "Code handles written directly in the query, resolved when possible."
373
+ },
374
+ neighborhood: {
375
+ type: "array",
376
+ items: {
377
+ $ref: "#/$defs/ITtscGraphEntrypoints.INeighborhood"
378
+ },
379
+ description: "Direct dependency context for the resolved mentions and highest hits."
380
+ },
381
+ next: {
382
+ $ref: "#/$defs/ITtscGraphEntrypoints.INext",
383
+ description: "Follow-up handles for deeper graph calls."
384
+ },
385
+ query: {
386
+ type: "string",
387
+ description: "The original question/search phrase the entrypoints were built for."
388
+ },
389
+ truncated: {
390
+ type: "boolean",
391
+ description: "True when result caps hid additional seeds or references."
392
+ }
393
+ },
394
+ required: [
395
+ "type",
396
+ "query",
397
+ "hits",
398
+ "mentions",
399
+ "neighborhood",
400
+ "next"
401
+ ],
402
+ additionalProperties: false
403
+ },
404
+ "ITtscGraphEntrypoints.IHit": {
405
+ type: "object",
406
+ properties: {
407
+ decorators: {
408
+ type: "array",
409
+ items: {
410
+ $ref: "#/$defs/ITtscGraphDecorator"
411
+ },
412
+ description: "Decorators written on this declaration, when any."
413
+ },
414
+ file: {
415
+ type: "string"
416
+ },
417
+ id: {
418
+ type: "string"
419
+ },
420
+ kind: {
421
+ type: "string"
422
+ },
423
+ line: {
424
+ type: "number",
425
+ description: "1-based declaration line, when known."
426
+ },
427
+ name: {
428
+ type: "string"
429
+ },
430
+ score: {
431
+ type: "number",
432
+ description: "Relative relevance; higher is a better match."
433
+ },
434
+ signature: {
435
+ type: "string",
436
+ description: "Declaration head, included only for indexed symbols."
437
+ }
438
+ },
439
+ required: [
440
+ "id",
441
+ "name",
442
+ "kind",
443
+ "file",
444
+ "score"
445
+ ],
446
+ additionalProperties: false
447
+ },
448
+ "ITtscGraphEntrypoints.IMention": {
449
+ type: "object",
450
+ properties: {
451
+ candidates: {
452
+ type: "array",
453
+ items: {
454
+ $ref: "#/$defs/ITtscGraphEntrypoints.INode"
455
+ }
456
+ },
457
+ handle: {
458
+ type: "string"
459
+ },
460
+ node: {
461
+ $ref: "#/$defs/ITtscGraphEntrypoints.INode"
462
+ }
463
+ },
464
+ required: [
465
+ "handle"
466
+ ],
467
+ additionalProperties: false
468
+ },
469
+ "ITtscGraphEntrypoints.INeighborhood": {
470
+ type: "object",
471
+ properties: {
472
+ decorators: {
473
+ type: "array",
474
+ items: {
475
+ $ref: "#/$defs/ITtscGraphDecorator"
476
+ },
477
+ description: "Decorators written on this declaration, when any."
478
+ },
479
+ dependedOnBy: {
480
+ type: "array",
481
+ items: {
482
+ $ref: "#/$defs/ITtscGraphEntrypoints.IReference"
483
+ }
484
+ },
485
+ dependsOn: {
486
+ type: "array",
487
+ items: {
488
+ $ref: "#/$defs/ITtscGraphEntrypoints.IReference"
489
+ }
490
+ },
491
+ file: {
492
+ type: "string"
493
+ },
494
+ id: {
495
+ type: "string"
496
+ },
497
+ kind: {
498
+ type: "string"
499
+ },
500
+ line: {
501
+ type: "number",
502
+ description: "1-based declaration line, when known."
503
+ },
504
+ name: {
505
+ type: "string"
506
+ },
507
+ signature: {
508
+ type: "string",
509
+ description: "Declaration head, included only for indexed symbols."
510
+ }
511
+ },
512
+ required: [
513
+ "id",
514
+ "name",
515
+ "kind",
516
+ "file",
517
+ "dependsOn",
518
+ "dependedOnBy"
519
+ ],
520
+ additionalProperties: false
521
+ },
522
+ "ITtscGraphEntrypoints.INext": {
523
+ type: "object",
524
+ properties: {
525
+ details: {
526
+ type: "array",
527
+ items: {
528
+ type: "string"
529
+ },
530
+ description: "Pass these ids to `details` for source-free symbol facts."
531
+ },
532
+ traceFrom: {
533
+ type: "array",
534
+ items: {
535
+ type: "string"
536
+ },
537
+ description: "Pass these ids to `trace` when following dependency flow."
538
+ }
539
+ },
540
+ required: [
541
+ "details",
542
+ "traceFrom"
543
+ ],
544
+ additionalProperties: false
545
+ },
546
+ "ITtscGraphEntrypoints.INode": {
547
+ type: "object",
548
+ properties: {
549
+ decorators: {
550
+ type: "array",
551
+ items: {
552
+ $ref: "#/$defs/ITtscGraphDecorator"
553
+ },
554
+ description: "Decorators written on this declaration, when any."
555
+ },
556
+ file: {
557
+ type: "string"
558
+ },
559
+ id: {
560
+ type: "string"
561
+ },
562
+ kind: {
563
+ type: "string"
564
+ },
565
+ line: {
566
+ type: "number",
567
+ description: "1-based declaration line, when known."
568
+ },
569
+ name: {
570
+ type: "string"
571
+ },
572
+ signature: {
573
+ type: "string",
574
+ description: "Declaration head, included only for indexed symbols."
575
+ }
576
+ },
577
+ required: [
578
+ "id",
579
+ "name",
580
+ "kind",
581
+ "file"
582
+ ],
583
+ additionalProperties: false
584
+ },
585
+ "ITtscGraphEntrypoints.IReference": {
586
+ type: "object",
587
+ properties: {
588
+ evidence: {
589
+ $ref: "#/$defs/ITtscGraphEvidence",
590
+ description: "Source span for the expression that produced this relationship. It lets\nan agent see why the edge exists without opening the file."
591
+ },
592
+ file: {
593
+ type: "string"
594
+ },
595
+ id: {
596
+ type: "string"
597
+ },
598
+ kind: {
599
+ type: "string"
600
+ },
601
+ line: {
602
+ type: "number",
603
+ description: "1-based declaration line, when known."
604
+ },
605
+ name: {
606
+ type: "string"
607
+ },
608
+ relation: {
609
+ type: "string"
610
+ }
611
+ },
612
+ required: [
613
+ "id",
614
+ "name",
615
+ "kind",
616
+ "file",
617
+ "relation"
618
+ ],
619
+ additionalProperties: false
620
+ },
621
+ ITtscGraphEscape: {
622
+ type: "object",
623
+ properties: {
624
+ type: {
625
+ type: "string",
626
+ "enum": [
627
+ "escape"
628
+ ],
629
+ description: "Discriminator for the no-op escape route."
630
+ },
631
+ nextStep: {
632
+ type: "string",
633
+ description: "The next non-graph step, if useful."
634
+ },
635
+ reason: {
636
+ type: "string",
637
+ description: "Why no graph operation should run."
638
+ },
639
+ skipped: {
640
+ type: "boolean",
641
+ "enum": [
642
+ true
643
+ ],
644
+ description: "Always true so callers can distinguish an intentional no-op."
645
+ }
646
+ },
647
+ required: [
648
+ "type",
649
+ "skipped",
650
+ "reason"
651
+ ],
652
+ additionalProperties: false
653
+ },
654
+ ITtscGraphEvidence: {
655
+ type: "object",
656
+ properties: {
657
+ endCol: {
658
+ type: "number",
659
+ description: "1-based column where the span ends, when known."
660
+ },
661
+ endLine: {
662
+ type: "number",
663
+ description: "1-based line where the span ends, when it differs from `startLine`."
664
+ },
665
+ file: {
666
+ type: "string",
667
+ description: "Project-relative path of the file the span lives in."
668
+ },
669
+ startCol: {
670
+ type: "number",
671
+ description: "1-based column where the span starts, when known."
672
+ },
673
+ startLine: {
674
+ type: "number",
675
+ description: "1-based line where the span starts."
676
+ }
677
+ },
678
+ required: [
679
+ "file",
680
+ "startLine"
681
+ ],
682
+ additionalProperties: false
683
+ },
684
+ ITtscGraphLookup: {
685
+ type: "object",
686
+ properties: {
687
+ type: {
688
+ type: "string",
689
+ "enum": [
690
+ "lookup"
691
+ ],
692
+ description: "Discriminator for targeted symbol lookup."
693
+ },
694
+ hits: {
695
+ type: "array",
696
+ items: {
697
+ $ref: "#/$defs/ITtscGraphLookup.IHit"
698
+ }
699
+ },
700
+ next: {
701
+ $ref: "#/$defs/ITtscGraphLookup.INext",
702
+ description: "Follow-up handles for selected symbol details."
703
+ }
704
+ },
705
+ required: [
706
+ "type",
707
+ "hits",
708
+ "next"
709
+ ],
710
+ additionalProperties: false
711
+ },
712
+ "ITtscGraphLookup.IHit": {
713
+ type: "object",
714
+ properties: {
715
+ decorators: {
716
+ type: "array",
717
+ items: {
718
+ $ref: "#/$defs/ITtscGraphDecorator"
719
+ },
720
+ description: "Decorators written on this declaration, when any."
721
+ },
722
+ file: {
723
+ type: "string"
724
+ },
725
+ id: {
726
+ type: "string"
727
+ },
728
+ kind: {
729
+ type: "string"
730
+ },
731
+ line: {
732
+ type: "number",
733
+ description: "1-based declaration line, when known."
734
+ },
735
+ name: {
736
+ type: "string"
737
+ },
738
+ score: {
739
+ type: "number",
740
+ description: "Relative relevance; higher is a better match."
741
+ },
742
+ signature: {
743
+ type: "string",
744
+ description: "The hit's declaration signature, so you can often answer without\nrequesting details."
745
+ }
746
+ },
747
+ required: [
748
+ "id",
749
+ "name",
750
+ "kind",
751
+ "file",
752
+ "score"
753
+ ],
754
+ additionalProperties: false
755
+ },
756
+ "ITtscGraphLookup.INext": {
757
+ type: "object",
758
+ properties: {
759
+ details: {
760
+ type: "array",
761
+ items: {
762
+ type: "string"
763
+ },
764
+ description: "Pass these ids to `details` for source-free symbol facts."
765
+ },
766
+ traceFrom: {
767
+ type: "array",
768
+ items: {
769
+ type: "string"
770
+ },
771
+ description: "Pass these ids to `trace` when following dependency flow."
772
+ }
773
+ },
774
+ required: [
775
+ "details",
776
+ "traceFrom"
777
+ ],
778
+ additionalProperties: false
779
+ },
780
+ ITtscGraphOverview: {
781
+ type: "object",
782
+ properties: {
783
+ type: {
784
+ type: "string",
785
+ "enum": [
786
+ "overview"
787
+ ],
788
+ description: "Discriminator for source-free project overview."
789
+ },
790
+ counts: {
791
+ $ref: "#/$defs/ITtscGraphOverview.ICounts",
792
+ description: "Size of the graph."
793
+ },
794
+ hotspots: {
795
+ type: "array",
796
+ items: {
797
+ $ref: "#/$defs/ITtscGraphOverview.IHotspot"
798
+ },
799
+ description: "Highest-dependency symbols, busiest first."
800
+ },
801
+ layers: {
802
+ type: "array",
803
+ items: {
804
+ $ref: "#/$defs/ITtscGraphOverview.ILayer"
805
+ },
806
+ description: "Folder layering, largest first."
807
+ },
808
+ project: {
809
+ type: "string",
810
+ description: "Absolute project root."
811
+ },
812
+ publicApi: {
813
+ type: "array",
814
+ items: {
815
+ $ref: "#/$defs/ITtscGraphOverview.INode"
816
+ },
817
+ description: "Exported API symbols, most-depended-on first."
818
+ }
819
+ },
820
+ required: [
821
+ "type",
822
+ "project",
823
+ "counts"
824
+ ],
825
+ additionalProperties: false
826
+ },
827
+ "ITtscGraphOverview.ICounts": {
828
+ type: "object",
829
+ properties: {
830
+ byKind: {
831
+ $ref: "#/$defs/Recordstringnumber",
832
+ description: "Node count per kind."
833
+ },
834
+ edges: {
835
+ type: "number"
836
+ },
837
+ files: {
838
+ type: "number"
839
+ },
840
+ nodes: {
841
+ type: "number"
842
+ }
843
+ },
844
+ required: [
845
+ "files",
846
+ "nodes",
847
+ "edges",
848
+ "byKind"
849
+ ],
850
+ additionalProperties: false
851
+ },
852
+ "ITtscGraphOverview.IHotspot": {
853
+ type: "object",
854
+ properties: {
855
+ fanIn: {
856
+ type: "number",
857
+ description: "Non-structural edges pointing at this symbol."
858
+ },
859
+ fanOut: {
860
+ type: "number",
861
+ description: "Non-structural edges leaving this symbol."
862
+ },
863
+ file: {
864
+ type: "string",
865
+ description: "Project-relative path of the file that declares it."
866
+ },
867
+ id: {
868
+ type: "string",
869
+ description: "Stable handle for `details` or `trace`."
870
+ },
871
+ kind: {
872
+ type: "string",
873
+ description: "Its declaration kind (`class`, `interface`, `function`, ...)."
874
+ },
875
+ line: {
876
+ type: "number",
877
+ description: "1-based declaration line, when known."
878
+ },
879
+ name: {
880
+ type: "string",
881
+ description: "The symbol's qualified name when available."
882
+ }
883
+ },
884
+ required: [
885
+ "id",
886
+ "name",
887
+ "kind",
888
+ "file",
889
+ "fanIn",
890
+ "fanOut"
891
+ ],
892
+ additionalProperties: false
893
+ },
894
+ "ITtscGraphOverview.ILayer": {
895
+ type: "object",
896
+ properties: {
897
+ dir: {
898
+ type: "string",
899
+ description: "Directory, project-relative."
900
+ },
901
+ exported: {
902
+ type: "number",
903
+ description: "Exported symbols declared under it."
904
+ },
905
+ files: {
906
+ type: "number",
907
+ description: "Distinct source files under it."
908
+ }
909
+ },
910
+ required: [
911
+ "dir",
912
+ "files",
913
+ "exported"
914
+ ],
915
+ additionalProperties: false
916
+ },
917
+ "ITtscGraphOverview.INode": {
918
+ type: "object",
919
+ properties: {
920
+ file: {
921
+ type: "string",
922
+ description: "Project-relative path of the file that declares it."
923
+ },
924
+ id: {
925
+ type: "string",
926
+ description: "Stable handle for `details` or `trace`."
927
+ },
928
+ kind: {
929
+ type: "string",
930
+ description: "Its declaration kind (`class`, `interface`, `function`, ...)."
931
+ },
932
+ line: {
933
+ type: "number",
934
+ description: "1-based declaration line, when known."
935
+ },
936
+ name: {
937
+ type: "string",
938
+ description: "The symbol's qualified name when available."
939
+ }
940
+ },
941
+ required: [
942
+ "id",
943
+ "name",
944
+ "kind",
945
+ "file"
946
+ ],
947
+ additionalProperties: false
948
+ },
949
+ ITtscGraphTrace: {
950
+ type: "object",
951
+ properties: {
952
+ type: {
953
+ type: "string",
954
+ "enum": [
955
+ "trace"
956
+ ],
957
+ description: "Discriminator for dependency tracing."
958
+ },
959
+ candidates: {
960
+ type: "array",
961
+ items: {
962
+ $ref: "#/$defs/ITtscGraphTrace.INode"
963
+ },
964
+ description: "When `from` was an ambiguous name, the matches to disambiguate with."
965
+ },
966
+ direction: {
967
+ type: "string"
968
+ },
969
+ hops: {
970
+ type: "array",
971
+ items: {
972
+ $ref: "#/$defs/ITtscGraphTrace.IHop"
973
+ },
974
+ description: "Edges traversed, in breadth-first order."
975
+ },
976
+ next: {
977
+ $ref: "#/$defs/ITtscGraphTrace.INext",
978
+ description: "Follow-up handles for inspecting or continuing the trace."
979
+ },
980
+ path: {
981
+ type: "array",
982
+ items: {
983
+ $ref: "#/$defs/ITtscGraphTrace.INode"
984
+ },
985
+ description: "When `to` was given: the ordered dependency path from `from` to `to`\n(`from` first, `to` last), or empty when `to` is not reachable from\n`from`."
986
+ },
987
+ reached: {
988
+ type: "array",
989
+ items: {
990
+ $ref: "#/$defs/ITtscGraphTrace.INode"
991
+ },
992
+ description: "Unique nodes reached (excluding the start), each with its depth and roles."
993
+ },
994
+ start: {
995
+ $ref: "#/$defs/ITtscGraphTrace.INode",
996
+ description: "The resolved start node, or undefined when `from` matched nothing."
997
+ },
998
+ steps: {
999
+ type: "array",
1000
+ items: {
1001
+ type: "string"
1002
+ },
1003
+ description: "Compact hop summaries preserving node names and edge evidence, capped."
1004
+ },
1005
+ target: {
1006
+ $ref: "#/$defs/ITtscGraphTrace.INode",
1007
+ description: "The resolved `to` target, when a path was requested."
1008
+ },
1009
+ truncated: {
1010
+ type: "boolean",
1011
+ description: "True when the trace hit maxNodes or maxDepth and more flow exists."
1012
+ }
1013
+ },
1014
+ required: [
1015
+ "type",
1016
+ "direction",
1017
+ "hops",
1018
+ "reached",
1019
+ "truncated"
1020
+ ],
1021
+ additionalProperties: false
1022
+ },
1023
+ "ITtscGraphTrace.IHop": {
1024
+ type: "object",
1025
+ properties: {
1026
+ aliases: {
1027
+ type: "array",
1028
+ items: {
1029
+ type: "string"
1030
+ },
1031
+ description: "Stable access-path aliases derived from edge evidence. These preserve a\nresolved member's owner and the concrete property path used at the call\nsite."
1032
+ },
1033
+ depth: {
1034
+ type: "number",
1035
+ description: "Hops from the start (1 = direct)."
1036
+ },
1037
+ evidence: {
1038
+ $ref: "#/$defs/ITtscGraphEvidence",
1039
+ description: "Source span for the expression that produced this hop. It lets an agent\nexplain why the trace moves from one symbol to the next without opening\nthe file."
1040
+ },
1041
+ from: {
1042
+ type: "string"
1043
+ },
1044
+ kind: {
1045
+ type: "string"
1046
+ },
1047
+ to: {
1048
+ type: "string"
1049
+ }
1050
+ },
1051
+ required: [
1052
+ "from",
1053
+ "to",
1054
+ "kind",
1055
+ "depth"
1056
+ ],
1057
+ additionalProperties: false
1058
+ },
1059
+ "ITtscGraphTrace.INext": {
1060
+ type: "object",
1061
+ properties: {
1062
+ details: {
1063
+ type: "array",
1064
+ items: {
1065
+ type: "string"
1066
+ },
1067
+ description: "Pass these ids to `details` for selected symbol details."
1068
+ },
1069
+ traceFrom: {
1070
+ type: "array",
1071
+ items: {
1072
+ type: "string"
1073
+ },
1074
+ description: "Continue tracing from these ids when the current result is intermediate."
1075
+ }
1076
+ },
1077
+ required: [
1078
+ "details",
1079
+ "traceFrom"
1080
+ ],
1081
+ additionalProperties: false
1082
+ },
1083
+ "ITtscGraphTrace.INode": {
1084
+ type: "object",
1085
+ properties: {
1086
+ depth: {
1087
+ type: "number",
1088
+ description: "Hops from the start, on a reached node."
1089
+ },
1090
+ file: {
1091
+ type: "string"
1092
+ },
1093
+ id: {
1094
+ type: "string"
1095
+ },
1096
+ kind: {
1097
+ type: "string"
1098
+ },
1099
+ name: {
1100
+ type: "string"
1101
+ },
1102
+ roles: {
1103
+ type: "array",
1104
+ items: {
1105
+ type: "string"
1106
+ },
1107
+ description: "Why this node matters to an impact trace: `exported`, `test`."
1108
+ },
1109
+ signature: {
1110
+ type: "string",
1111
+ description: "The node's signature, carried on path nodes so the path explains itself."
1112
+ }
1113
+ },
1114
+ required: [
1115
+ "id",
1116
+ "name",
1117
+ "kind",
1118
+ "file"
1119
+ ],
1120
+ additionalProperties: false
1121
+ },
1122
+ PickITtscGraphEvidenceendLinefilestartLine: {
1123
+ type: "object",
1124
+ properties: {
1125
+ endLine: {
1126
+ type: "number",
1127
+ description: "1-based line where the span ends, when it differs from `startLine`."
1128
+ },
1129
+ file: {
1130
+ type: "string",
1131
+ description: "Project-relative path of the file the span lives in."
1132
+ },
1133
+ startLine: {
1134
+ type: "number",
1135
+ description: "1-based line where the span starts."
1136
+ }
1137
+ },
1138
+ required: [
1139
+ "file",
1140
+ "startLine"
1141
+ ],
1142
+ additionalProperties: false
1143
+ },
1144
+ Recordstringnumber: {
1145
+ type: "object",
1146
+ properties: {},
1147
+ required: [],
1148
+ additionalProperties: {
1149
+ type: "number"
1150
+ }
1151
+ }
1152
+ }
1153
+ },
1154
+ parameters: {
1155
+ type: "object",
1156
+ properties: {
1157
+ draft: {
1158
+ $ref: "#/$defs/ITtscGraphApplication.IRequestDraft",
1159
+ description: "First request-type decision before arguments are filled.\n\nExplain why one operation class is smaller than the alternatives, then\nname it in `draft.type`. This is only the draft; the final arguments are\nin `request` after `review`."
1160
+ },
1161
+ graphNeed: {
1162
+ type: "string",
1163
+ description: "Why the resident graph is the next evidence source.\n\nState what graph evidence is needed and why assumptions or broad shell\nsearch are not the next step for this call. Name the smallest evidence\nthat would let the agent stop. If graph is not actually the right source,\nsay that and use `escape`."
1164
+ },
1165
+ question: {
1166
+ type: "string",
1167
+ description: "User's TypeScript code question.\n\nRestate the codebase question being answered. Keep this about TypeScript\nsource, symbols, call flow, type flow, or architecture. If the user is\nasking about scripts, config, generated output, or documentation instead,\nsay that boundary here."
1168
+ },
1169
+ request: {
1170
+ anyOf: [
1171
+ {
1172
+ $ref: "#/$defs/ITtscGraphDetails.IRequest"
1173
+ },
1174
+ {
1175
+ $ref: "#/$defs/ITtscGraphEntrypoints.IRequest"
1176
+ },
1177
+ {
1178
+ $ref: "#/$defs/ITtscGraphLookup.IRequest"
1179
+ },
1180
+ {
1181
+ $ref: "#/$defs/ITtscGraphOverview.IRequest"
1182
+ },
1183
+ {
1184
+ $ref: "#/$defs/ITtscGraphTrace.IRequest"
1185
+ },
1186
+ {
1187
+ $ref: "#/$defs/ITtscGraphEscape.IRequest"
1188
+ }
1189
+ ],
1190
+ description: "The graph operation chosen from the reasoning above, or a no-op escape.",
1191
+ "x-discriminator": {
1192
+ mapping: {
1193
+ details: "#/$defs/ITtscGraphDetails.IRequest",
1194
+ entrypoints: "#/$defs/ITtscGraphEntrypoints.IRequest",
1195
+ escape: "#/$defs/ITtscGraphEscape.IRequest",
1196
+ lookup: "#/$defs/ITtscGraphLookup.IRequest",
1197
+ overview: "#/$defs/ITtscGraphOverview.IRequest",
1198
+ trace: "#/$defs/ITtscGraphTrace.IRequest"
1199
+ },
1200
+ propertyName: "type"
1201
+ }
1202
+ },
1203
+ review: {
1204
+ type: "string",
1205
+ description: "Critical review of the draft request.\n\nCheck whether the draft avoids overfetch, non-graph fallback, broad\nreads, and unnecessary neighbor expansion. If this would be a fourth\nbroad lookup, trace, or details call, prefer answering from evidence in\nhand or choose `escape`. Do not spend graph calls only to hunt for tests.\nIf the draft is wrong, choose the corrected type in `request`."
1206
+ }
1207
+ },
1208
+ required: [
1209
+ "question",
1210
+ "graphNeed",
1211
+ "draft",
1212
+ "review",
1213
+ "request"
1214
+ ],
1215
+ additionalProperties: false,
1216
+ $defs: {
1217
+ "ITtscGraphApplication.IRequestDraft": {
1218
+ type: "object",
1219
+ properties: {
1220
+ type: {
1221
+ type: "string",
1222
+ "enum": [
1223
+ "details",
1224
+ "entrypoints",
1225
+ "escape",
1226
+ "lookup",
1227
+ "overview",
1228
+ "trace"
1229
+ ],
1230
+ description: "Draft discriminator for the intended graph operation."
1231
+ },
1232
+ reason: {
1233
+ type: "string",
1234
+ description: "Why this operation type is the smallest useful next step."
1235
+ }
1236
+ },
1237
+ required: [
1238
+ "reason",
1239
+ "type"
1240
+ ],
1241
+ additionalProperties: false
1242
+ },
1243
+ "ITtscGraphDetails.IRequest": {
1244
+ type: "object",
1245
+ properties: {
1246
+ type: {
1247
+ type: "string",
1248
+ "enum": [
1249
+ "details"
1250
+ ],
1251
+ description: "Discriminator for selected symbol inspection."
1252
+ },
1253
+ dependencyLimit: {
1254
+ type: "number",
1255
+ description: "Maximum direct execution and type references to return per group. Raise\nonly when the first dependency slice is not enough."
1256
+ },
1257
+ handles: {
1258
+ type: "array",
1259
+ items: {
1260
+ type: "string"
1261
+ },
1262
+ description: "Node ids from another tool, or dotted symbol handles such as\n`OrderService.create`. Pass the few handles you need for source-free\ndetails; use `trace` when you need a path instead of widening this call."
1263
+ },
1264
+ memberLimit: {
1265
+ type: "number",
1266
+ description: "Maximum owned members to return for a container or object literal. Raise\nonly when the first outline is truncated."
1267
+ },
1268
+ neighborLimit: {
1269
+ type: "number",
1270
+ description: "Maximum dependencies and dependents to return per side when\n`neighbors:true`."
1271
+ },
1272
+ neighbors: {
1273
+ type: "boolean",
1274
+ description: "Also list each node's direct dependencies and dependents (the symbols it\nuses and the symbols that use it). The list is capped; raise\n`neighborLimit` only when the first slice is not enough."
1275
+ }
1276
+ },
1277
+ required: [
1278
+ "type",
1279
+ "handles"
1280
+ ],
1281
+ additionalProperties: false
1282
+ },
1283
+ "ITtscGraphEntrypoints.IRequest": {
1284
+ type: "object",
1285
+ properties: {
1286
+ type: {
1287
+ type: "string",
1288
+ "enum": [
1289
+ "entrypoints"
1290
+ ],
1291
+ description: "Discriminator for first-pass question indexing."
1292
+ },
1293
+ limit: {
1294
+ type: "number",
1295
+ description: "Maximum ranked hits to return."
1296
+ },
1297
+ neighbors: {
1298
+ type: "number",
1299
+ description: "Maximum direct dependencies and dependents to return per indexed symbol.\nThis is an orientation slice, not a dependency dump; use `trace` or\n`details` with `neighbors:true` after choosing the specific handles."
1300
+ },
1301
+ query: {
1302
+ type: "string",
1303
+ description: "A natural code question or search phrase. Mix prose with code handles,\nfor example `how Repository.find loads relations` or\n`SelectQueryBuilder.setFindOptions join aliases`."
1304
+ }
1305
+ },
1306
+ required: [
1307
+ "type",
1308
+ "query"
1309
+ ],
1310
+ additionalProperties: false
1311
+ },
1312
+ "ITtscGraphEscape.IRequest": {
1313
+ type: "object",
1314
+ properties: {
1315
+ type: {
1316
+ type: "string",
1317
+ "enum": [
1318
+ "escape"
1319
+ ],
1320
+ description: "Discriminator for the no-op escape route."
1321
+ },
1322
+ nextStep: {
1323
+ type: "string",
1324
+ description: "The next non-graph step, if useful.\n\nKeep this short. Examples: `answer from the prior graph result`, `inspect\npackage.json`, or `ask the user for a concrete symbol`."
1325
+ },
1326
+ reason: {
1327
+ type: "string",
1328
+ description: "Why no graph operation should run.\n\nUse this when the review finds the user is asking about package scripts,\nconfig files, generated output, prose documentation, or an answer that\nthe current graph result already settled."
1329
+ }
1330
+ },
1331
+ required: [
1332
+ "type",
1333
+ "reason"
1334
+ ],
1335
+ additionalProperties: false
1336
+ },
1337
+ "ITtscGraphLookup.IRequest": {
1338
+ type: "object",
1339
+ properties: {
1340
+ type: {
1341
+ type: "string",
1342
+ "enum": [
1343
+ "lookup"
1344
+ ],
1345
+ description: "Discriminator for targeted symbol lookup."
1346
+ },
1347
+ limit: {
1348
+ type: "number",
1349
+ description: "Maximum hits to return."
1350
+ },
1351
+ query: {
1352
+ type: "string",
1353
+ description: "What to find, in natural language and code vocabulary mixed freely: a\nsymbol name, a dotted member (`OrderService.create`), or a phrase\n(`shopping order create`, `repository find relations`). Exact names are\nnot required; subword and CamelCase matches rank too."
1354
+ }
1355
+ },
1356
+ required: [
1357
+ "type",
1358
+ "query"
1359
+ ],
1360
+ additionalProperties: false
1361
+ },
1362
+ "ITtscGraphOverview.IRequest": {
1363
+ type: "object",
1364
+ properties: {
1365
+ type: {
1366
+ type: "string",
1367
+ "enum": [
1368
+ "overview"
1369
+ ],
1370
+ description: "Discriminator for source-free project overview."
1371
+ },
1372
+ aspect: {
1373
+ type: "string",
1374
+ "enum": [
1375
+ "all",
1376
+ "hotspots",
1377
+ "layers",
1378
+ "publicApi"
1379
+ ],
1380
+ description: "The facet to project, or `all` for every facet. `layers` is the folder\nlayering, `hotspots` the highest-dependency symbols, `publicApi` the\nexported API symbols ranked by how depended-on they are."
1381
+ }
1382
+ },
1383
+ required: [
1384
+ "type"
1385
+ ],
1386
+ additionalProperties: false
1387
+ },
1388
+ "ITtscGraphTrace.IRequest": {
1389
+ type: "object",
1390
+ properties: {
1391
+ type: {
1392
+ type: "string",
1393
+ "enum": [
1394
+ "trace"
1395
+ ],
1396
+ description: "Discriminator for dependency tracing."
1397
+ },
1398
+ direction: {
1399
+ type: "string",
1400
+ "enum": [
1401
+ "forward",
1402
+ "impact",
1403
+ "reverse"
1404
+ ],
1405
+ description: "`forward` follows what the start uses (callees, instantiations, renders);\n`reverse` follows what uses the start (callers); `impact` is a reverse\ntrace that flags the public API and tests a change would reach."
1406
+ },
1407
+ focus: {
1408
+ type: "string",
1409
+ "enum": [
1410
+ "all",
1411
+ "execution",
1412
+ "types"
1413
+ ],
1414
+ description: "Which non-structural edge family to follow: `execution` follows runtime\ncalls, instantiations, property access, and JSX renders; `types` follows\ntype references and inheritance; `all` preserves the full graph."
1415
+ },
1416
+ from: {
1417
+ type: "string",
1418
+ description: "Where to start: a node id from another tool, a simple symbol name, or a\ndotted member name such as `OrderService.create`. An ambiguous name\nreturns its candidates instead of a trace."
1419
+ },
1420
+ maxDepth: {
1421
+ type: "number",
1422
+ description: "How many hops deep to follow. Open traces are capped at 2; path mode is\ncapped at 12."
1423
+ },
1424
+ maxNodes: {
1425
+ type: "number",
1426
+ description: "Cap on reached nodes; the trace stops and marks itself truncated past it.\nOpen traces are capped at 10 nodes so a broad graph cannot flood\ncontext."
1427
+ },
1428
+ to: {
1429
+ type: "string",
1430
+ description: "A target symbol: node id, simple symbol name, or dotted member name. When\ngiven, the tool returns the dependency path from `from` to this target,\nthe one-call answer for \"how does A reach B\", instead of an open-ended\ntrace."
1431
+ }
1432
+ },
1433
+ required: [
1434
+ "type",
1435
+ "from"
1436
+ ],
1437
+ additionalProperties: false
1438
+ }
1439
+ }
1440
+ },
1441
+ validate: (() => {
1442
+ const _io0 = input => "string" === typeof input.question && "string" === typeof input.graphNeed && ("object" === typeof input.draft && null !== input.draft && _io1(input.draft)) && "string" === typeof input.review && ("object" === typeof input.request && null !== input.request && _iu0(input.request));
1443
+ const _io1 = input => "string" === typeof input.reason && ("details" === input.type || "entrypoints" === input.type || "escape" === input.type || "lookup" === input.type || "overview" === input.type || "trace" === input.type);
1444
+ const _io2 = input => "details" === input.type && (Array.isArray(input.handles) && input.handles.every(elem => "string" === typeof elem)) && (undefined === input.neighbors || "boolean" === typeof input.neighbors) && (undefined === input.neighborLimit || "number" === typeof input.neighborLimit) && (undefined === input.memberLimit || "number" === typeof input.memberLimit) && (undefined === input.dependencyLimit || "number" === typeof input.dependencyLimit);
1445
+ const _io3 = input => "entrypoints" === input.type && "string" === typeof input.query && (undefined === input.limit || "number" === typeof input.limit) && (undefined === input.neighbors || "number" === typeof input.neighbors);
1446
+ const _io4 = input => "lookup" === input.type && "string" === typeof input.query && (undefined === input.limit || "number" === typeof input.limit);
1447
+ const _io5 = input => "overview" === input.type && (undefined === input.aspect || "all" === input.aspect || "hotspots" === input.aspect || "layers" === input.aspect || "publicApi" === input.aspect);
1448
+ const _io6 = input => "trace" === input.type && "string" === typeof input.from && (undefined === input.to || "string" === typeof input.to) && (undefined === input.direction || "forward" === input.direction || "impact" === input.direction || "reverse" === input.direction) && (undefined === input.focus || "all" === input.focus || "execution" === input.focus || "types" === input.focus) && (undefined === input.maxDepth || "number" === typeof input.maxDepth) && (undefined === input.maxNodes || "number" === typeof input.maxNodes);
1449
+ const _io7 = input => "escape" === input.type && "string" === typeof input.reason && (undefined === input.nextStep || "string" === typeof input.nextStep);
1450
+ const _iu0 = input => (() => {
1451
+ if ("details" === input.type)
1452
+ return _io2(input);
1453
+ else if ("entrypoints" === input.type)
1454
+ return _io3(input);
1455
+ else if ("lookup" === input.type)
1456
+ return _io4(input);
1457
+ else if ("overview" === input.type)
1458
+ return _io5(input);
1459
+ else if ("trace" === input.type)
1460
+ return _io6(input);
1461
+ else if ("escape" === input.type)
1462
+ return _io7(input);
1463
+ else
1464
+ return false;
1465
+ })();
1466
+ const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.question || _report(_exceptionable, {
1467
+ path: _path + ".question",
1468
+ expected: "string",
1469
+ value: input.question
1470
+ }), "string" === typeof input.graphNeed || _report(_exceptionable, {
1471
+ path: _path + ".graphNeed",
1472
+ expected: "string",
1473
+ value: input.graphNeed
1474
+ }), ("object" === typeof input.draft && null !== input.draft || _report(_exceptionable, {
1475
+ path: _path + ".draft",
1476
+ expected: "ITtscGraphApplication.IRequestDraft",
1477
+ value: input.draft
1478
+ })) && _vo1(input.draft, _path + ".draft", true && _exceptionable) || _report(_exceptionable, {
1479
+ path: _path + ".draft",
1480
+ expected: "ITtscGraphApplication.IRequestDraft",
1481
+ value: input.draft
1482
+ }), "string" === typeof input.review || _report(_exceptionable, {
1483
+ path: _path + ".review",
1484
+ expected: "string",
1485
+ value: input.review
1486
+ }), ("object" === typeof input.request && null !== input.request || _report(_exceptionable, {
1487
+ path: _path + ".request",
1488
+ expected: "(ITtscGraphDetails.IRequest | ITtscGraphEntrypoints.IRequest | ITtscGraphEscape.IRequest | ITtscGraphLookup.IRequest | ITtscGraphOverview.IRequest | ITtscGraphTrace.IRequest)",
1489
+ value: input.request
1490
+ })) && _vu0(input.request, _path + ".request", true && _exceptionable) || _report(_exceptionable, {
1491
+ path: _path + ".request",
1492
+ expected: "(ITtscGraphDetails.IRequest | ITtscGraphEntrypoints.IRequest | ITtscGraphEscape.IRequest | ITtscGraphLookup.IRequest | ITtscGraphOverview.IRequest | ITtscGraphTrace.IRequest)",
1493
+ value: input.request
1494
+ })].every(flag => flag);
1495
+ const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.reason || _report(_exceptionable, {
1496
+ path: _path + ".reason",
1497
+ expected: "string",
1498
+ value: input.reason
1499
+ }), "details" === input.type || "entrypoints" === input.type || "escape" === input.type || "lookup" === input.type || "overview" === input.type || "trace" === input.type || _report(_exceptionable, {
1500
+ path: _path + ".type",
1501
+ expected: "(\"details\" | \"entrypoints\" | \"escape\" | \"lookup\" | \"overview\" | \"trace\")",
1502
+ value: input.type
1503
+ })].every(flag => flag);
1504
+ const _vo2 = (input, _path, _exceptionable = true) => ["details" === input.type || _report(_exceptionable, {
1505
+ path: _path + ".type",
1506
+ expected: "\"details\"",
1507
+ value: input.type
1508
+ }), (Array.isArray(input.handles) || _report(_exceptionable, {
1509
+ path: _path + ".handles",
1510
+ expected: "Array<string>",
1511
+ value: input.handles
1512
+ })) && input.handles.map((elem, _index2) => "string" === typeof elem || _report(_exceptionable, {
1513
+ path: _path + ".handles[" + _index2 + "]",
1514
+ expected: "string",
1515
+ value: elem
1516
+ })).every(flag => flag) || _report(_exceptionable, {
1517
+ path: _path + ".handles",
1518
+ expected: "Array<string>",
1519
+ value: input.handles
1520
+ }), undefined === input.neighbors || "boolean" === typeof input.neighbors || _report(_exceptionable, {
1521
+ path: _path + ".neighbors",
1522
+ expected: "(boolean | undefined)",
1523
+ value: input.neighbors
1524
+ }), undefined === input.neighborLimit || "number" === typeof input.neighborLimit || _report(_exceptionable, {
1525
+ path: _path + ".neighborLimit",
1526
+ expected: "(number | undefined)",
1527
+ value: input.neighborLimit
1528
+ }), undefined === input.memberLimit || "number" === typeof input.memberLimit || _report(_exceptionable, {
1529
+ path: _path + ".memberLimit",
1530
+ expected: "(number | undefined)",
1531
+ value: input.memberLimit
1532
+ }), undefined === input.dependencyLimit || "number" === typeof input.dependencyLimit || _report(_exceptionable, {
1533
+ path: _path + ".dependencyLimit",
1534
+ expected: "(number | undefined)",
1535
+ value: input.dependencyLimit
1536
+ })].every(flag => flag);
1537
+ const _vo3 = (input, _path, _exceptionable = true) => ["entrypoints" === input.type || _report(_exceptionable, {
1538
+ path: _path + ".type",
1539
+ expected: "\"entrypoints\"",
1540
+ value: input.type
1541
+ }), "string" === typeof input.query || _report(_exceptionable, {
1542
+ path: _path + ".query",
1543
+ expected: "string",
1544
+ value: input.query
1545
+ }), undefined === input.limit || "number" === typeof input.limit || _report(_exceptionable, {
1546
+ path: _path + ".limit",
1547
+ expected: "(number | undefined)",
1548
+ value: input.limit
1549
+ }), undefined === input.neighbors || "number" === typeof input.neighbors || _report(_exceptionable, {
1550
+ path: _path + ".neighbors",
1551
+ expected: "(number | undefined)",
1552
+ value: input.neighbors
1553
+ })].every(flag => flag);
1554
+ const _vo4 = (input, _path, _exceptionable = true) => ["lookup" === input.type || _report(_exceptionable, {
1555
+ path: _path + ".type",
1556
+ expected: "\"lookup\"",
1557
+ value: input.type
1558
+ }), "string" === typeof input.query || _report(_exceptionable, {
1559
+ path: _path + ".query",
1560
+ expected: "string",
1561
+ value: input.query
1562
+ }), undefined === input.limit || "number" === typeof input.limit || _report(_exceptionable, {
1563
+ path: _path + ".limit",
1564
+ expected: "(number | undefined)",
1565
+ value: input.limit
1566
+ })].every(flag => flag);
1567
+ const _vo5 = (input, _path, _exceptionable = true) => ["overview" === input.type || _report(_exceptionable, {
1568
+ path: _path + ".type",
1569
+ expected: "\"overview\"",
1570
+ value: input.type
1571
+ }), undefined === input.aspect || "all" === input.aspect || "hotspots" === input.aspect || "layers" === input.aspect || "publicApi" === input.aspect || _report(_exceptionable, {
1572
+ path: _path + ".aspect",
1573
+ expected: "(\"all\" | \"hotspots\" | \"layers\" | \"publicApi\" | undefined)",
1574
+ value: input.aspect
1575
+ })].every(flag => flag);
1576
+ const _vo6 = (input, _path, _exceptionable = true) => ["trace" === input.type || _report(_exceptionable, {
1577
+ path: _path + ".type",
1578
+ expected: "\"trace\"",
1579
+ value: input.type
1580
+ }), "string" === typeof input.from || _report(_exceptionable, {
1581
+ path: _path + ".from",
1582
+ expected: "string",
1583
+ value: input.from
1584
+ }), undefined === input.to || "string" === typeof input.to || _report(_exceptionable, {
1585
+ path: _path + ".to",
1586
+ expected: "(string | undefined)",
1587
+ value: input.to
1588
+ }), undefined === input.direction || "forward" === input.direction || "impact" === input.direction || "reverse" === input.direction || _report(_exceptionable, {
1589
+ path: _path + ".direction",
1590
+ expected: "(\"forward\" | \"impact\" | \"reverse\" | undefined)",
1591
+ value: input.direction
1592
+ }), undefined === input.focus || "all" === input.focus || "execution" === input.focus || "types" === input.focus || _report(_exceptionable, {
1593
+ path: _path + ".focus",
1594
+ expected: "(\"all\" | \"execution\" | \"types\" | undefined)",
1595
+ value: input.focus
1596
+ }), undefined === input.maxDepth || "number" === typeof input.maxDepth || _report(_exceptionable, {
1597
+ path: _path + ".maxDepth",
1598
+ expected: "(number | undefined)",
1599
+ value: input.maxDepth
1600
+ }), undefined === input.maxNodes || "number" === typeof input.maxNodes || _report(_exceptionable, {
1601
+ path: _path + ".maxNodes",
1602
+ expected: "(number | undefined)",
1603
+ value: input.maxNodes
1604
+ })].every(flag => flag);
1605
+ const _vo7 = (input, _path, _exceptionable = true) => ["escape" === input.type || _report(_exceptionable, {
1606
+ path: _path + ".type",
1607
+ expected: "\"escape\"",
1608
+ value: input.type
1609
+ }), "string" === typeof input.reason || _report(_exceptionable, {
1610
+ path: _path + ".reason",
1611
+ expected: "string",
1612
+ value: input.reason
1613
+ }), undefined === input.nextStep || "string" === typeof input.nextStep || _report(_exceptionable, {
1614
+ path: _path + ".nextStep",
1615
+ expected: "(string | undefined)",
1616
+ value: input.nextStep
1617
+ })].every(flag => flag);
1618
+ const _vu0 = (input, _path, _exceptionable = true) => (() => {
1619
+ if ("details" === input.type)
1620
+ return _vo2(input, _path, true && _exceptionable);
1621
+ else if ("entrypoints" === input.type)
1622
+ return _vo3(input, _path, true && _exceptionable);
1623
+ else if ("lookup" === input.type)
1624
+ return _vo4(input, _path, true && _exceptionable);
1625
+ else if ("overview" === input.type)
1626
+ return _vo5(input, _path, true && _exceptionable);
1627
+ else if ("trace" === input.type)
1628
+ return _vo6(input, _path, true && _exceptionable);
1629
+ else if ("escape" === input.type)
1630
+ return _vo7(input, _path, true && _exceptionable);
1631
+ else
1632
+ return _report(_exceptionable, {
1633
+ path: _path,
1634
+ expected: "(ITtscGraphDetails.IRequest | ITtscGraphEntrypoints.IRequest | ITtscGraphLookup.IRequest | ITtscGraphOverview.IRequest | ITtscGraphTrace.IRequest | ITtscGraphEscape.IRequest)",
1635
+ value: input
1636
+ });
1637
+ })();
1638
+ const __is = input => "object" === typeof input && null !== input && _io0(input);
1639
+ let errors;
1640
+ let _report;
1641
+ return input => {
1642
+ if (false === __is(input)) {
1643
+ errors = [];
1644
+ _report = _b._validateReport(errors);
1645
+ ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
1646
+ path: _path + "",
1647
+ expected: "ITtscGraphApplication.IProps",
1648
+ value: input
1649
+ })) && _vo0(input, _path + "", true) || _report(true, {
1650
+ path: _path + "",
1651
+ expected: "ITtscGraphApplication.IProps",
1652
+ value: input
1653
+ }))(input, "$input", true);
1654
+ const success = 0 === errors.length;
1655
+ return success ? {
1656
+ success,
1657
+ data: input
1658
+ } : {
1659
+ success,
1660
+ errors,
1661
+ data: input
1662
+ };
1663
+ }
1664
+ return {
1665
+ success: true,
1666
+ data: input
1667
+ };
1668
+ };
1669
+ })()
1670
+ }
1671
+ ]
1672
+ })
1673
+ };
1674
+ const functions = controller.application.functions;
1675
+ const execute = controller.execute;
1676
+ const server = new mcp_js_1.McpServer({ name: "ttsc-graph", version }, { capabilities: { tools: {} }, instructions: instructions_1.instructions });
1677
+ const raw = server.server;
1678
+ raw.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
1679
+ tools: functions.map((func) => ({
1680
+ name: func.name,
1681
+ description: func.description,
1682
+ inputSchema: {
1683
+ type: "object",
1684
+ properties: func.parameters.properties,
1685
+ required: func.parameters.required,
1686
+ additionalProperties: false,
1687
+ $defs: func.parameters.$defs,
1688
+ },
1689
+ })),
1690
+ }));
1691
+ raw.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
1692
+ const func = functions.find((f) => f.name === request.params.name);
1693
+ const method = execute[request.params.name];
1694
+ if (func === undefined || method === undefined) {
1695
+ return error(`Unknown tool: ${request.params.name}`);
1696
+ }
1697
+ // Validate an empty object when a client omits `arguments`, so typia can
1698
+ // return field-level errors instead of a generic "expected object".
1699
+ const validation = func.validate(request.params.arguments ?? {});
1700
+ if (!validation.success) {
1701
+ // Hand typia's validation errors back so the model can correct its call.
1702
+ return error(JSON.stringify(validation.errors, null, 2));
1703
+ }
1704
+ try {
1705
+ const result = await method.call(execute, validation.data);
1706
+ return {
1707
+ content: [
1708
+ {
1709
+ type: "text",
1710
+ text: result === undefined ? "Success" : JSON.stringify(result),
1711
+ },
1712
+ ],
1713
+ };
1714
+ }
1715
+ catch (exception) {
1716
+ return error(exception instanceof Error
1717
+ ? `${exception.name}: ${exception.message}`
1718
+ : String(exception));
1719
+ }
1720
+ });
1721
+ return server;
1722
+ }
1723
+ function error(text) {
1724
+ return { isError: true, content: [{ type: "text", text }] };
1725
+ }
1726
+ //# sourceMappingURL=createServer.js.map