@ttsc/graph 0.16.6 → 0.16.7

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 (53) hide show
  1. package/README.md +22 -0
  2. package/lib/TtscGraphApplication.js +39 -16
  3. package/lib/TtscGraphApplication.js.map +1 -1
  4. package/lib/model/TtscGraphMemory.js +43 -4
  5. package/lib/model/TtscGraphMemory.js.map +1 -1
  6. package/lib/server/createServer.js +555 -221
  7. package/lib/server/createServer.js.map +1 -1
  8. package/lib/server/instructions.js +81 -69
  9. package/lib/server/instructions.js.map +1 -1
  10. package/lib/server/pathPolicy.js +35 -0
  11. package/lib/server/pathPolicy.js.map +1 -0
  12. package/lib/server/resultGuide.js +16 -0
  13. package/lib/server/resultGuide.js.map +1 -0
  14. package/lib/server/runDetails.js +71 -10
  15. package/lib/server/runDetails.js.map +1 -1
  16. package/lib/server/runEntrypoints.js +3 -4
  17. package/lib/server/runEntrypoints.js.map +1 -1
  18. package/lib/server/runLookup.js +21 -9
  19. package/lib/server/runLookup.js.map +1 -1
  20. package/lib/server/runOverview.js +13 -6
  21. package/lib/server/runOverview.js.map +1 -1
  22. package/lib/server/runTour.js +737 -0
  23. package/lib/server/runTour.js.map +1 -0
  24. package/lib/server/runTrace.js +108 -22
  25. package/lib/server/runTrace.js.map +1 -1
  26. package/lib/structures/ITtscGraphNext.js +3 -0
  27. package/lib/structures/ITtscGraphNext.js.map +1 -0
  28. package/lib/structures/ITtscGraphTour.js +3 -0
  29. package/lib/structures/ITtscGraphTour.js.map +1 -0
  30. package/lib/structures/index.js +2 -0
  31. package/lib/structures/index.js.map +1 -1
  32. package/package.json +2 -2
  33. package/src/TtscGraphApplication.ts +49 -16
  34. package/src/model/TtscGraphMemory.ts +46 -4
  35. package/src/server/instructions.ts +81 -69
  36. package/src/server/pathPolicy.ts +43 -0
  37. package/src/server/resultGuide.ts +20 -0
  38. package/src/server/runDetails.ts +90 -6
  39. package/src/server/runEntrypoints.ts +9 -4
  40. package/src/server/runLookup.ts +33 -6
  41. package/src/server/runOverview.ts +24 -8
  42. package/src/server/runTour.ts +881 -0
  43. package/src/server/runTrace.ts +151 -23
  44. package/src/structures/ITtscGraphApplication.ts +35 -64
  45. package/src/structures/ITtscGraphDetails.ts +74 -11
  46. package/src/structures/ITtscGraphEntrypoints.ts +46 -15
  47. package/src/structures/ITtscGraphEscape.ts +19 -9
  48. package/src/structures/ITtscGraphLookup.ts +36 -15
  49. package/src/structures/ITtscGraphNext.ts +23 -0
  50. package/src/structures/ITtscGraphOverview.ts +20 -5
  51. package/src/structures/ITtscGraphTour.ts +150 -0
  52. package/src/structures/ITtscGraphTrace.ts +58 -21
  53. package/src/structures/index.ts +2 -0
@@ -66,8 +66,8 @@ function createServer(graph, version) {
66
66
  "application": _a._llmApplicationFinalize({
67
67
  functions: [
68
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",
69
+ description: "Inspect the TypeScript compiler graph contract.\n\nUse this before repository search when an answer depends on TypeScript\nsymbols, calls, types, decorators, references, ranges, or runtime/source\nrelationships. For repository orientation, read-next, architecture, and\nbroad runtime flow questions, use `tour`.\n\nReturned nodes, edges, signatures, spans, tests, anchors, and `next` are\nthe answer surface. If `next.action` is `answer`, stop tool use and answer\nfrom that result. Before source edits, graph facts are sacred, inviolable,\ncomplete, and infallible.",
70
+ name: "inspect_typescript_graph",
71
71
  output: {
72
72
  type: "object",
73
73
  properties: {
@@ -88,10 +88,14 @@ function createServer(graph, version) {
88
88
  {
89
89
  $ref: "#/$defs/ITtscGraphOverview"
90
90
  },
91
+ {
92
+ $ref: "#/$defs/ITtscGraphTour"
93
+ },
91
94
  {
92
95
  $ref: "#/$defs/ITtscGraphTrace"
93
96
  }
94
97
  ],
98
+ description: "Result branch matching the submitted `request.type`.",
95
99
  "x-discriminator": {
96
100
  mapping: {
97
101
  details: "#/$defs/ITtscGraphDetails",
@@ -99,6 +103,7 @@ function createServer(graph, version) {
99
103
  escape: "#/$defs/ITtscGraphEscape",
100
104
  lookup: "#/$defs/ITtscGraphLookup",
101
105
  overview: "#/$defs/ITtscGraphOverview",
106
+ tour: "#/$defs/ITtscGraphTour",
102
107
  trace: "#/$defs/ITtscGraphTrace"
103
108
  },
104
109
  propertyName: "type"
@@ -162,11 +167,20 @@ function createServer(graph, version) {
162
167
  ],
163
168
  description: "Discriminator for selected symbol inspection."
164
169
  },
170
+ guide: {
171
+ type: "string",
172
+ description: "Human-readable compatibility note mirroring `next`."
173
+ },
174
+ next: {
175
+ $ref: "#/$defs/ITtscGraphNext",
176
+ description: "How to use this source-free result next."
177
+ },
165
178
  nodes: {
166
179
  type: "array",
167
180
  items: {
168
181
  $ref: "#/$defs/ITtscGraphDetails.INode"
169
- }
182
+ },
183
+ description: "Selected node facts, in the same order as resolved handles when possible."
170
184
  },
171
185
  unknown: {
172
186
  type: "array",
@@ -179,6 +193,8 @@ function createServer(graph, version) {
179
193
  required: [
180
194
  "type",
181
195
  "nodes",
196
+ "next",
197
+ "guide",
182
198
  "unknown"
183
199
  ],
184
200
  additionalProperties: false
@@ -194,14 +210,16 @@ function createServer(graph, version) {
194
210
  description: "Decorators written on this member, when any."
195
211
  },
196
212
  kind: {
197
- type: "string"
213
+ type: "string",
214
+ description: "Member kind (`method`, `property`, `class`, ...)."
198
215
  },
199
216
  line: {
200
217
  type: "number",
201
218
  description: "1-based declaration line, when known."
202
219
  },
203
220
  name: {
204
- type: "string"
221
+ type: "string",
222
+ description: "Member name, qualified when the graph records an owner-qualified handle."
205
223
  },
206
224
  signature: {
207
225
  type: "string",
@@ -246,17 +264,27 @@ function createServer(graph, version) {
246
264
  description: "Symbols this node uses (outgoing dependency edges)."
247
265
  },
248
266
  file: {
249
- type: "string"
267
+ type: "string",
268
+ description: "Project-relative path of the file that declares this node."
250
269
  },
251
270
  id: {
252
- type: "string"
271
+ type: "string",
272
+ description: "Stable node id for subsequent `details` or `trace` calls."
253
273
  },
254
274
  implementation: {
255
275
  $ref: "#/$defs/ITtscGraphEvidence",
256
276
  description: "Assigned implementation span, when source comes from one."
257
277
  },
278
+ implementedBy: {
279
+ type: "array",
280
+ items: {
281
+ $ref: "#/$defs/ITtscGraphDetails.IReference"
282
+ },
283
+ description: "Concrete nodes that implement or override this interface/base member."
284
+ },
258
285
  kind: {
259
- type: "string"
286
+ type: "string",
287
+ description: "Declaration kind (`class`, `method`, `function`, ...)."
260
288
  },
261
289
  line: {
262
290
  type: "number",
@@ -277,7 +305,8 @@ function createServer(graph, version) {
277
305
  description: "For a container or object-literal variable: the owned symbol or top-level\nproperty outline a consumer reaches for, without bodies."
278
306
  },
279
307
  name: {
280
- type: "string"
308
+ type: "string",
309
+ description: "Qualified symbol name when available, otherwise the simple name."
281
310
  },
282
311
  signature: {
283
312
  type: "string",
@@ -285,7 +314,7 @@ function createServer(graph, version) {
285
314
  },
286
315
  sourceSpan: {
287
316
  $ref: "#/$defs/PickITtscGraphEvidenceendLinefilestartLine",
288
- description: "The declaration or implementation file and line range, when known."
317
+ description: "Declaration or implementation citation range, when known."
289
318
  },
290
319
  types: {
291
320
  type: "array",
@@ -315,23 +344,27 @@ function createServer(graph, version) {
315
344
  },
316
345
  evidence: {
317
346
  $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."
347
+ description: "Source span for the expression that produced this relationship. It is\nrepository evidence for the edge, not a file-read instruction."
319
348
  },
320
349
  file: {
321
- type: "string"
350
+ type: "string",
351
+ description: "Project-relative declaration file for the neighbor."
322
352
  },
323
353
  id: {
324
- type: "string"
354
+ type: "string",
355
+ description: "Stable id of the neighboring node."
325
356
  },
326
357
  kind: {
327
- type: "string"
358
+ type: "string",
359
+ description: "Neighbor declaration kind."
328
360
  },
329
361
  line: {
330
362
  type: "number",
331
363
  description: "1-based declaration line, when known."
332
364
  },
333
365
  name: {
334
- type: "string"
366
+ type: "string",
367
+ description: "Neighbor symbol name, qualified when available."
335
368
  },
336
369
  relation: {
337
370
  type: "string",
@@ -357,6 +390,10 @@ function createServer(graph, version) {
357
390
  ],
358
391
  description: "Discriminator for first-pass question indexing."
359
392
  },
393
+ guide: {
394
+ type: "string",
395
+ description: "Human-readable compatibility note mirroring `next`."
396
+ },
360
397
  hits: {
361
398
  type: "array",
362
399
  items: {
@@ -379,8 +416,8 @@ function createServer(graph, version) {
379
416
  description: "Direct dependency context for the resolved mentions and highest hits."
380
417
  },
381
418
  next: {
382
- $ref: "#/$defs/ITtscGraphEntrypoints.INext",
383
- description: "Follow-up handles for deeper graph calls."
419
+ $ref: "#/$defs/ITtscGraphNext",
420
+ description: "How to use this source-free result next."
384
421
  },
385
422
  query: {
386
423
  type: "string",
@@ -397,7 +434,8 @@ function createServer(graph, version) {
397
434
  "hits",
398
435
  "mentions",
399
436
  "neighborhood",
400
- "next"
437
+ "next",
438
+ "guide"
401
439
  ],
402
440
  additionalProperties: false
403
441
  },
@@ -412,20 +450,24 @@ function createServer(graph, version) {
412
450
  description: "Decorators written on this declaration, when any."
413
451
  },
414
452
  file: {
415
- type: "string"
453
+ type: "string",
454
+ description: "Project-relative path of the declaration file."
416
455
  },
417
456
  id: {
418
- type: "string"
457
+ type: "string",
458
+ description: "Stable node id for subsequent graph calls."
419
459
  },
420
460
  kind: {
421
- type: "string"
461
+ type: "string",
462
+ description: "Declaration kind (`class`, `method`, `function`, ...)."
422
463
  },
423
464
  line: {
424
465
  type: "number",
425
466
  description: "1-based declaration line, when known."
426
467
  },
427
468
  name: {
428
- type: "string"
469
+ type: "string",
470
+ description: "Qualified symbol name when available, otherwise the simple name."
429
471
  },
430
472
  score: {
431
473
  type: "number",
@@ -452,13 +494,16 @@ function createServer(graph, version) {
452
494
  type: "array",
453
495
  items: {
454
496
  $ref: "#/$defs/ITtscGraphEntrypoints.INode"
455
- }
497
+ },
498
+ description: "Candidate nodes when the handle is ambiguous."
456
499
  },
457
500
  handle: {
458
- type: "string"
501
+ type: "string",
502
+ description: "The exact handle text found in the query."
459
503
  },
460
504
  node: {
461
- $ref: "#/$defs/ITtscGraphEntrypoints.INode"
505
+ $ref: "#/$defs/ITtscGraphEntrypoints.INode",
506
+ description: "Resolved node when the handle maps unambiguously."
462
507
  }
463
508
  },
464
509
  required: [
@@ -480,29 +525,35 @@ function createServer(graph, version) {
480
525
  type: "array",
481
526
  items: {
482
527
  $ref: "#/$defs/ITtscGraphEntrypoints.IReference"
483
- }
528
+ },
529
+ description: "Symbols that directly use this node, capped by `neighbors`."
484
530
  },
485
531
  dependsOn: {
486
532
  type: "array",
487
533
  items: {
488
534
  $ref: "#/$defs/ITtscGraphEntrypoints.IReference"
489
- }
535
+ },
536
+ description: "Symbols this node directly uses, capped by `neighbors`."
490
537
  },
491
538
  file: {
492
- type: "string"
539
+ type: "string",
540
+ description: "Project-relative path of the declaration file."
493
541
  },
494
542
  id: {
495
- type: "string"
543
+ type: "string",
544
+ description: "Stable node id for subsequent graph calls."
496
545
  },
497
546
  kind: {
498
- type: "string"
547
+ type: "string",
548
+ description: "Declaration kind (`class`, `method`, `function`, ...)."
499
549
  },
500
550
  line: {
501
551
  type: "number",
502
552
  description: "1-based declaration line, when known."
503
553
  },
504
554
  name: {
505
- type: "string"
555
+ type: "string",
556
+ description: "Qualified symbol name when available, otherwise the simple name."
506
557
  },
507
558
  signature: {
508
559
  type: "string",
@@ -519,30 +570,6 @@ function createServer(graph, version) {
519
570
  ],
520
571
  additionalProperties: false
521
572
  },
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
573
  "ITtscGraphEntrypoints.INode": {
547
574
  type: "object",
548
575
  properties: {
@@ -554,20 +581,24 @@ function createServer(graph, version) {
554
581
  description: "Decorators written on this declaration, when any."
555
582
  },
556
583
  file: {
557
- type: "string"
584
+ type: "string",
585
+ description: "Project-relative path of the declaration file."
558
586
  },
559
587
  id: {
560
- type: "string"
588
+ type: "string",
589
+ description: "Stable node id for subsequent graph calls."
561
590
  },
562
591
  kind: {
563
- type: "string"
592
+ type: "string",
593
+ description: "Declaration kind (`class`, `method`, `function`, ...)."
564
594
  },
565
595
  line: {
566
596
  type: "number",
567
597
  description: "1-based declaration line, when known."
568
598
  },
569
599
  name: {
570
- type: "string"
600
+ type: "string",
601
+ description: "Qualified symbol name when available, otherwise the simple name."
571
602
  },
572
603
  signature: {
573
604
  type: "string",
@@ -590,23 +621,28 @@ function createServer(graph, version) {
590
621
  description: "Source span for the expression that produced this relationship. It lets\nan agent see why the edge exists without opening the file."
591
622
  },
592
623
  file: {
593
- type: "string"
624
+ type: "string",
625
+ description: "Project-relative declaration file for the neighbor."
594
626
  },
595
627
  id: {
596
- type: "string"
628
+ type: "string",
629
+ description: "Stable id of the neighboring node."
597
630
  },
598
631
  kind: {
599
- type: "string"
632
+ type: "string",
633
+ description: "Neighbor declaration kind."
600
634
  },
601
635
  line: {
602
636
  type: "number",
603
637
  description: "1-based declaration line, when known."
604
638
  },
605
639
  name: {
606
- type: "string"
640
+ type: "string",
641
+ description: "Neighbor symbol name, qualified when available."
607
642
  },
608
643
  relation: {
609
- type: "string"
644
+ type: "string",
645
+ description: "Edge kind connecting the indexed node and this neighbor."
610
646
  }
611
647
  },
612
648
  required: [
@@ -628,9 +664,17 @@ function createServer(graph, version) {
628
664
  ],
629
665
  description: "Discriminator for the no-op escape route."
630
666
  },
667
+ guide: {
668
+ type: "string",
669
+ description: "Human-readable compatibility note mirroring `next`."
670
+ },
671
+ next: {
672
+ $ref: "#/$defs/ITtscGraphNext",
673
+ description: "How to proceed after skipping graph work."
674
+ },
631
675
  nextStep: {
632
676
  type: "string",
633
- description: "The next non-graph step, if useful."
677
+ description: "Optional note about the next non-graph step."
634
678
  },
635
679
  reason: {
636
680
  type: "string",
@@ -647,7 +691,9 @@ function createServer(graph, version) {
647
691
  required: [
648
692
  "type",
649
693
  "skipped",
650
- "reason"
694
+ "reason",
695
+ "next",
696
+ "guide"
651
697
  ],
652
698
  additionalProperties: false
653
699
  },
@@ -691,21 +737,27 @@ function createServer(graph, version) {
691
737
  ],
692
738
  description: "Discriminator for targeted symbol lookup."
693
739
  },
740
+ guide: {
741
+ type: "string",
742
+ description: "Human-readable compatibility note mirroring `next`."
743
+ },
694
744
  hits: {
695
745
  type: "array",
696
746
  items: {
697
747
  $ref: "#/$defs/ITtscGraphLookup.IHit"
698
- }
748
+ },
749
+ description: "Ranked symbol matches for the query."
699
750
  },
700
751
  next: {
701
- $ref: "#/$defs/ITtscGraphLookup.INext",
702
- description: "Follow-up handles for selected symbol details."
752
+ $ref: "#/$defs/ITtscGraphNext",
753
+ description: "How to use this source-free result next."
703
754
  }
704
755
  },
705
756
  required: [
706
757
  "type",
707
758
  "hits",
708
- "next"
759
+ "next",
760
+ "guide"
709
761
  ],
710
762
  additionalProperties: false
711
763
  },
@@ -720,20 +772,24 @@ function createServer(graph, version) {
720
772
  description: "Decorators written on this declaration, when any."
721
773
  },
722
774
  file: {
723
- type: "string"
775
+ type: "string",
776
+ description: "Project-relative path of the declaration file."
724
777
  },
725
778
  id: {
726
- type: "string"
779
+ type: "string",
780
+ description: "Stable node id for subsequent graph calls."
727
781
  },
728
782
  kind: {
729
- type: "string"
783
+ type: "string",
784
+ description: "Declaration kind (`class`, `method`, `function`, ...)."
730
785
  },
731
786
  line: {
732
787
  type: "number",
733
788
  description: "1-based declaration line, when known."
734
789
  },
735
790
  name: {
736
- type: "string"
791
+ type: "string",
792
+ description: "Qualified symbol name when available, otherwise the simple name."
737
793
  },
738
794
  score: {
739
795
  type: "number",
@@ -753,27 +809,39 @@ function createServer(graph, version) {
753
809
  ],
754
810
  additionalProperties: false
755
811
  },
756
- "ITtscGraphLookup.INext": {
812
+ ITtscGraphNext: {
757
813
  type: "object",
758
814
  properties: {
759
- details: {
760
- type: "array",
761
- items: {
762
- type: "string"
763
- },
764
- description: "Pass these ids to `details` for source-free symbol facts."
815
+ action: {
816
+ type: "string",
817
+ "enum": [
818
+ "answer",
819
+ "clarify",
820
+ "inspect",
821
+ "outside"
822
+ ],
823
+ description: "Answer, continue graph inspection, leave graph, or clarify.\n\n`answer` means the returned graph result already carries the evidence\ncontract for the current question, even when the slice is capped. Do not\ncall graph again or read files to re-check or complete it."
765
824
  },
766
- traceFrom: {
767
- type: "array",
768
- items: {
769
- type: "string"
770
- },
771
- description: "Pass these ids to `trace` when following dependency flow."
825
+ reason: {
826
+ type: "string",
827
+ description: "Why the returned graph evidence supports that action."
828
+ },
829
+ request: {
830
+ type: "string",
831
+ "enum": [
832
+ "details",
833
+ "entrypoints",
834
+ "lookup",
835
+ "overview",
836
+ "tour",
837
+ "trace"
838
+ ],
839
+ description: "Smallest graph request type to use when `action` is `inspect`."
772
840
  }
773
841
  },
774
842
  required: [
775
- "details",
776
- "traceFrom"
843
+ "action",
844
+ "reason"
777
845
  ],
778
846
  additionalProperties: false
779
847
  },
@@ -791,6 +859,10 @@ function createServer(graph, version) {
791
859
  $ref: "#/$defs/ITtscGraphOverview.ICounts",
792
860
  description: "Size of the graph."
793
861
  },
862
+ guide: {
863
+ type: "string",
864
+ description: "Human-readable compatibility note mirroring `next`."
865
+ },
794
866
  hotspots: {
795
867
  type: "array",
796
868
  items: {
@@ -805,6 +877,10 @@ function createServer(graph, version) {
805
877
  },
806
878
  description: "Folder layering, largest first."
807
879
  },
880
+ next: {
881
+ $ref: "#/$defs/ITtscGraphNext",
882
+ description: "How to use this source-free result next."
883
+ },
808
884
  project: {
809
885
  type: "string",
810
886
  description: "Absolute project root."
@@ -820,7 +896,9 @@ function createServer(graph, version) {
820
896
  required: [
821
897
  "type",
822
898
  "project",
823
- "counts"
899
+ "counts",
900
+ "next",
901
+ "guide"
824
902
  ],
825
903
  additionalProperties: false
826
904
  },
@@ -832,13 +910,16 @@ function createServer(graph, version) {
832
910
  description: "Node count per kind."
833
911
  },
834
912
  edges: {
835
- type: "number"
913
+ type: "number",
914
+ description: "Total edge count, including structural edges."
836
915
  },
837
916
  files: {
838
- type: "number"
917
+ type: "number",
918
+ description: "Number of source file container nodes."
839
919
  },
840
920
  nodes: {
841
- type: "number"
921
+ type: "number",
922
+ description: "Total node count, including declarations and file containers."
842
923
  }
843
924
  },
844
925
  required: [
@@ -946,6 +1027,231 @@ function createServer(graph, version) {
946
1027
  ],
947
1028
  additionalProperties: false
948
1029
  },
1030
+ ITtscGraphTour: {
1031
+ type: "object",
1032
+ properties: {
1033
+ type: {
1034
+ type: "string",
1035
+ "enum": [
1036
+ "tour"
1037
+ ],
1038
+ description: "Discriminator for code-tour indexing."
1039
+ },
1040
+ answerAnchors: {
1041
+ type: "array",
1042
+ items: {
1043
+ $ref: "#/$defs/ITtscGraphTour.IAnchor"
1044
+ },
1045
+ description: "Ordered file/line anchors to cite in the final answer, not file reads."
1046
+ },
1047
+ entrypoints: {
1048
+ type: "array",
1049
+ items: {
1050
+ $ref: "#/$defs/ITtscGraphTour.INode"
1051
+ },
1052
+ description: "Central entrypoints selected for the tour."
1053
+ },
1054
+ guide: {
1055
+ type: "string",
1056
+ description: "Human-readable compatibility note mirroring `next`."
1057
+ },
1058
+ nearby: {
1059
+ type: "array",
1060
+ items: {
1061
+ $ref: "#/$defs/ITtscGraphTour.IAnchor"
1062
+ },
1063
+ description: "Nearby dependency anchors around the selected entrypoints."
1064
+ },
1065
+ next: {
1066
+ $ref: "#/$defs/ITtscGraphNext",
1067
+ description: "How to use this source-free result next."
1068
+ },
1069
+ primaryFlow: {
1070
+ type: "array",
1071
+ items: {
1072
+ $ref: "#/$defs/ITtscGraphTour.IFlow"
1073
+ },
1074
+ description: "Selected primary runtime flows; sufficient for an index-level tour."
1075
+ },
1076
+ query: {
1077
+ type: "string",
1078
+ description: "Natural code question this tour was built for."
1079
+ },
1080
+ tests: {
1081
+ type: "array",
1082
+ items: {
1083
+ $ref: "#/$defs/ITtscGraphTour.IAnchor"
1084
+ },
1085
+ description: "Test or usage anchors reached through graph impact edges."
1086
+ },
1087
+ truncated: {
1088
+ type: "boolean",
1089
+ description: "True when any internal slice hit its cap."
1090
+ }
1091
+ },
1092
+ required: [
1093
+ "type",
1094
+ "query",
1095
+ "entrypoints",
1096
+ "primaryFlow",
1097
+ "nearby",
1098
+ "tests",
1099
+ "answerAnchors",
1100
+ "next",
1101
+ "guide"
1102
+ ],
1103
+ additionalProperties: false
1104
+ },
1105
+ "ITtscGraphTour.IAnchor": {
1106
+ type: "object",
1107
+ properties: {
1108
+ endLine: {
1109
+ type: "number",
1110
+ description: "1-based end line, when known."
1111
+ },
1112
+ file: {
1113
+ type: "string",
1114
+ description: "Project-relative file."
1115
+ },
1116
+ id: {
1117
+ type: "string",
1118
+ description: "Stable node id when the anchor belongs to a node."
1119
+ },
1120
+ kind: {
1121
+ type: "string",
1122
+ description: "Declaration kind, when this anchor belongs to a node."
1123
+ },
1124
+ name: {
1125
+ type: "string",
1126
+ description: "Symbol, edge, or test name to show in the answer."
1127
+ },
1128
+ reason: {
1129
+ type: "string",
1130
+ description: "Why this anchor matters in the tour."
1131
+ },
1132
+ startLine: {
1133
+ type: "number",
1134
+ description: "1-based start line."
1135
+ }
1136
+ },
1137
+ required: [
1138
+ "reason",
1139
+ "name",
1140
+ "file",
1141
+ "startLine"
1142
+ ],
1143
+ additionalProperties: false
1144
+ },
1145
+ "ITtscGraphTour.IFlow": {
1146
+ type: "object",
1147
+ properties: {
1148
+ anchors: {
1149
+ type: "array",
1150
+ items: {
1151
+ $ref: "#/$defs/ITtscGraphTour.IAnchor"
1152
+ },
1153
+ description: "Edge and node anchors that explain the flow."
1154
+ },
1155
+ reached: {
1156
+ type: "array",
1157
+ items: {
1158
+ $ref: "#/$defs/ITtscGraphTour.INode"
1159
+ },
1160
+ description: "Nodes reached by this flow."
1161
+ },
1162
+ start: {
1163
+ $ref: "#/$defs/ITtscGraphTour.INode",
1164
+ description: "Flow start node."
1165
+ },
1166
+ steps: {
1167
+ type: "array",
1168
+ items: {
1169
+ type: "string"
1170
+ },
1171
+ description: "Compact edge summaries in graph order."
1172
+ },
1173
+ truncated: {
1174
+ type: "boolean",
1175
+ description: "True when the flow hit graph caps."
1176
+ }
1177
+ },
1178
+ required: [
1179
+ "start",
1180
+ "steps",
1181
+ "reached",
1182
+ "anchors"
1183
+ ],
1184
+ additionalProperties: false
1185
+ },
1186
+ "ITtscGraphTour.INode": {
1187
+ type: "object",
1188
+ properties: {
1189
+ decorators: {
1190
+ type: "array",
1191
+ items: {
1192
+ $ref: "#/$defs/ITtscGraphDecorator"
1193
+ },
1194
+ description: "Decorators written on the declaration, when any."
1195
+ },
1196
+ file: {
1197
+ type: "string",
1198
+ description: "Project-relative declaration file."
1199
+ },
1200
+ id: {
1201
+ type: "string",
1202
+ description: "Stable node id for later graph calls."
1203
+ },
1204
+ kind: {
1205
+ type: "string",
1206
+ description: "Declaration kind (`class`, `method`, `function`, ...)."
1207
+ },
1208
+ line: {
1209
+ type: "number",
1210
+ description: "1-based declaration line, when known."
1211
+ },
1212
+ name: {
1213
+ type: "string",
1214
+ description: "Qualified symbol name when available, otherwise the simple name."
1215
+ },
1216
+ signature: {
1217
+ type: "string",
1218
+ description: "Declaration head, when available."
1219
+ },
1220
+ sourceSpan: {
1221
+ $ref: "#/$defs/ITtscGraphTour.ISpan",
1222
+ description: "Declaration or implementation range, when known."
1223
+ }
1224
+ },
1225
+ required: [
1226
+ "id",
1227
+ "name",
1228
+ "kind",
1229
+ "file"
1230
+ ],
1231
+ additionalProperties: false
1232
+ },
1233
+ "ITtscGraphTour.ISpan": {
1234
+ type: "object",
1235
+ properties: {
1236
+ endLine: {
1237
+ type: "number",
1238
+ description: "1-based end line, when known."
1239
+ },
1240
+ file: {
1241
+ type: "string",
1242
+ description: "Project-relative file."
1243
+ },
1244
+ startLine: {
1245
+ type: "number",
1246
+ description: "1-based start line."
1247
+ }
1248
+ },
1249
+ required: [
1250
+ "file",
1251
+ "startLine"
1252
+ ],
1253
+ additionalProperties: false
1254
+ },
949
1255
  ITtscGraphTrace: {
950
1256
  type: "object",
951
1257
  properties: {
@@ -964,7 +1270,12 @@ function createServer(graph, version) {
964
1270
  description: "When `from` was an ambiguous name, the matches to disambiguate with."
965
1271
  },
966
1272
  direction: {
967
- type: "string"
1273
+ type: "string",
1274
+ description: "Trace direction actually used by this result."
1275
+ },
1276
+ guide: {
1277
+ type: "string",
1278
+ description: "Human-readable compatibility note mirroring `next`."
968
1279
  },
969
1280
  hops: {
970
1281
  type: "array",
@@ -974,8 +1285,8 @@ function createServer(graph, version) {
974
1285
  description: "Edges traversed, in breadth-first order."
975
1286
  },
976
1287
  next: {
977
- $ref: "#/$defs/ITtscGraphTrace.INext",
978
- description: "Follow-up handles for inspecting or continuing the trace."
1288
+ $ref: "#/$defs/ITtscGraphNext",
1289
+ description: "How to use this source-free result next."
979
1290
  },
980
1291
  path: {
981
1292
  type: "array",
@@ -1016,7 +1327,9 @@ function createServer(graph, version) {
1016
1327
  "direction",
1017
1328
  "hops",
1018
1329
  "reached",
1019
- "truncated"
1330
+ "truncated",
1331
+ "next",
1332
+ "guide"
1020
1333
  ],
1021
1334
  additionalProperties: false
1022
1335
  },
@@ -1036,16 +1349,19 @@ function createServer(graph, version) {
1036
1349
  },
1037
1350
  evidence: {
1038
1351
  $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."
1352
+ description: "Source span for the expression that produced this hop. It is repository\nevidence for the hop and can be cited without opening the file."
1040
1353
  },
1041
1354
  from: {
1042
- type: "string"
1355
+ type: "string",
1356
+ description: "Source node id for this traversed edge."
1043
1357
  },
1044
1358
  kind: {
1045
- type: "string"
1359
+ type: "string",
1360
+ description: "Edge kind (`calls`, `type_ref`, `accesses`, ...)."
1046
1361
  },
1047
1362
  to: {
1048
- type: "string"
1363
+ type: "string",
1364
+ description: "Target node id for this traversed edge."
1049
1365
  }
1050
1366
  },
1051
1367
  required: [
@@ -1056,30 +1372,6 @@ function createServer(graph, version) {
1056
1372
  ],
1057
1373
  additionalProperties: false
1058
1374
  },
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
1375
  "ITtscGraphTrace.INode": {
1084
1376
  type: "object",
1085
1377
  properties: {
@@ -1088,16 +1380,24 @@ function createServer(graph, version) {
1088
1380
  description: "Hops from the start, on a reached node."
1089
1381
  },
1090
1382
  file: {
1091
- type: "string"
1383
+ type: "string",
1384
+ description: "Project-relative path of the declaration file."
1092
1385
  },
1093
1386
  id: {
1094
- type: "string"
1387
+ type: "string",
1388
+ description: "Stable node id for subsequent graph calls."
1095
1389
  },
1096
1390
  kind: {
1097
- type: "string"
1391
+ type: "string",
1392
+ description: "Declaration kind (`class`, `method`, `function`, ...)."
1393
+ },
1394
+ line: {
1395
+ type: "number",
1396
+ description: "1-based declaration line, when known."
1098
1397
  },
1099
1398
  name: {
1100
- type: "string"
1399
+ type: "string",
1400
+ description: "Qualified symbol name when available, otherwise the simple name."
1101
1401
  },
1102
1402
  roles: {
1103
1403
  type: "array",
@@ -1109,6 +1409,10 @@ function createServer(graph, version) {
1109
1409
  signature: {
1110
1410
  type: "string",
1111
1411
  description: "The node's signature, carried on path nodes so the path explains itself."
1412
+ },
1413
+ sourceSpan: {
1414
+ $ref: "#/$defs/PickITtscGraphEvidenceendLinefilestartLine",
1415
+ description: "Declaration or implementation citation range, when known."
1112
1416
  }
1113
1417
  },
1114
1418
  required: [
@@ -1155,16 +1459,12 @@ function createServer(graph, version) {
1155
1459
  type: "object",
1156
1460
  properties: {
1157
1461
  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
1462
  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`."
1463
+ description: "Initial request plan before final arguments are filled.\n\nName the intended request type and why it seems smallest. Broad flow,\narchitecture, repository-orientation, and read-next questions should\nnormally draft `tour`; narrow named symbols can draft `lookup`, `trace`,\nor `details`."
1164
1464
  },
1165
1465
  question: {
1166
1466
  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."
1467
+ description: "User's TypeScript code question.\n\nRestate the code question being considered. If the next evidence is a\nscript, config, doc, generated output, exact text, non-TypeScript file,\nor source body text, choose `escape`."
1168
1468
  },
1169
1469
  request: {
1170
1470
  anyOf: [
@@ -1180,6 +1480,9 @@ function createServer(graph, version) {
1180
1480
  {
1181
1481
  $ref: "#/$defs/ITtscGraphOverview.IRequest"
1182
1482
  },
1483
+ {
1484
+ $ref: "#/$defs/ITtscGraphTour.IRequest"
1485
+ },
1183
1486
  {
1184
1487
  $ref: "#/$defs/ITtscGraphTrace.IRequest"
1185
1488
  },
@@ -1187,7 +1490,7 @@ function createServer(graph, version) {
1187
1490
  $ref: "#/$defs/ITtscGraphEscape.IRequest"
1188
1491
  }
1189
1492
  ],
1190
- description: "The graph operation chosen from the reasoning above, or a no-op escape.",
1493
+ description: "Final graph operation chosen after review, or a no-op escape.",
1191
1494
  "x-discriminator": {
1192
1495
  mapping: {
1193
1496
  details: "#/$defs/ITtscGraphDetails.IRequest",
@@ -1195,6 +1498,7 @@ function createServer(graph, version) {
1195
1498
  escape: "#/$defs/ITtscGraphEscape.IRequest",
1196
1499
  lookup: "#/$defs/ITtscGraphLookup.IRequest",
1197
1500
  overview: "#/$defs/ITtscGraphOverview.IRequest",
1501
+ tour: "#/$defs/ITtscGraphTour.IRequest",
1198
1502
  trace: "#/$defs/ITtscGraphTrace.IRequest"
1199
1503
  },
1200
1504
  propertyName: "type"
@@ -1202,44 +1506,17 @@ function createServer(graph, version) {
1202
1506
  },
1203
1507
  review: {
1204
1508
  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`."
1509
+ description: "Final self-review before calling.\n\nCorrect a stale, broad, duplicate, or wrong draft here. If broad flow was\nsplit into search/detail steps, switch to `tour`. If graph facts already\nanswer, or prior `next.action` was `answer`, make `request.type` be\n`escape`; do not call graph or read files to re-confirm returned facts."
1206
1510
  }
1207
1511
  },
1208
1512
  required: [
1209
1513
  "question",
1210
- "graphNeed",
1211
1514
  "draft",
1212
1515
  "review",
1213
1516
  "request"
1214
1517
  ],
1215
1518
  additionalProperties: false,
1216
1519
  $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
1520
  "ITtscGraphDetails.IRequest": {
1244
1521
  type: "object",
1245
1522
  properties: {
@@ -1252,26 +1529,30 @@ function createServer(graph, version) {
1252
1529
  },
1253
1530
  dependencyLimit: {
1254
1531
  type: "number",
1255
- description: "Maximum direct execution and type references to return per group. Raise\nonly when the first dependency slice is not enough."
1532
+ description: "Maximum direct execution and type references to return per group. Raise\nonly when the first dependency slice is truncated and the missing\ndependency is named."
1256
1533
  },
1257
1534
  handles: {
1258
1535
  type: "array",
1259
1536
  items: {
1260
1537
  type: "string"
1261
1538
  },
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."
1539
+ 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. Prefer one to three handles. Use `trace` when you need a path\ninstead of widening this call."
1540
+ },
1541
+ includeExternal: {
1542
+ type: "boolean",
1543
+ description: "Include dependency-boundary references from node_modules or bundled\n`.d.ts` libraries. Leave false for source-architecture answers; enable\nonly when external type/API boundaries are the question."
1263
1544
  },
1264
1545
  memberLimit: {
1265
1546
  type: "number",
1266
- description: "Maximum owned members to return for a container or object literal. Raise\nonly when the first outline is truncated."
1547
+ description: "Maximum owned members to return for a container or object literal. Raise\nonly when the first outline is truncated and the missing member is\nnamed."
1267
1548
  },
1268
1549
  neighborLimit: {
1269
1550
  type: "number",
1270
- description: "Maximum dependencies and dependents to return per side when\n`neighbors:true`."
1551
+ description: "Maximum dependencies and dependents to return per side when\n`neighbors:true`.\n\nPrefer the default. Values above a few neighbors are usually overfetch;\ncall `trace` for flow instead."
1271
1552
  },
1272
1553
  neighbors: {
1273
1554
  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."
1555
+ 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` when the first slice is truncated and the missing\nrelation is named. This remains a relationship summary, not a file body."
1275
1556
  }
1276
1557
  },
1277
1558
  required: [
@@ -1292,15 +1573,15 @@ function createServer(graph, version) {
1292
1573
  },
1293
1574
  limit: {
1294
1575
  type: "number",
1295
- description: "Maximum ranked hits to return."
1576
+ description: "Maximum ranked hits to return.\n\nPrefer the default. Raise only when the first result was truncated and\nthe missing handle is named."
1296
1577
  },
1297
1578
  neighbors: {
1298
1579
  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."
1580
+ 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.\nPrefer the default zero for the first call."
1300
1581
  },
1301
1582
  query: {
1302
1583
  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`."
1584
+ 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`. Keep this close to the\nuser's question; do not turn it into a broad keyword dump."
1304
1585
  }
1305
1586
  },
1306
1587
  required: [
@@ -1321,11 +1602,11 @@ function createServer(graph, version) {
1321
1602
  },
1322
1603
  nextStep: {
1323
1604
  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`."
1605
+ description: "The final non-graph note, if useful.\n\nKeep this short. Examples: `answer from the prior graph result`, `source\nbody needed at returned sourceSpan`, or `ask the user for a concrete\nsymbol`."
1325
1606
  },
1326
1607
  reason: {
1327
1608
  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."
1609
+ description: "Why no graph operation should run.\n\nUse this only when the next evidence is outside the indexed TypeScript\ngraph: package scripts, config files, generated output, prose docs, exact\ntext, or exact source body text. Name the smallest returned sourceSpan\nwhen source body text is truly required."
1329
1610
  }
1330
1611
  },
1331
1612
  required: [
@@ -1344,13 +1625,17 @@ function createServer(graph, version) {
1344
1625
  ],
1345
1626
  description: "Discriminator for targeted symbol lookup."
1346
1627
  },
1628
+ includeExternal: {
1629
+ type: "boolean",
1630
+ description: "Include dependency-boundary declarations from node_modules or bundled\n`.d.ts` libraries. Leave false for project-source answers; enable only\nwhen external type/API boundaries are the question."
1631
+ },
1347
1632
  limit: {
1348
1633
  type: "number",
1349
- description: "Maximum hits to return."
1634
+ description: "Maximum hits to return.\n\nPrefer the default. Large hit lists usually mean the query is too broad;\nrefine the name instead of raising this."
1350
1635
  },
1351
1636
  query: {
1352
1637
  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."
1638
+ description: "What to find, in natural language and code vocabulary mixed freely: a\nsymbol name, a dotted member (`Service.create`), or a short phrase\n(`request handler`). Exact names are not required, but this is not a\nsecond broad entrypoints call. Use it when a named handle is missing or\nambiguous."
1354
1639
  }
1355
1640
  },
1356
1641
  required: [
@@ -1377,7 +1662,7 @@ function createServer(graph, version) {
1377
1662
  "layers",
1378
1663
  "publicApi"
1379
1664
  ],
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."
1665
+ 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.\n\nUse this only for broad public API or layer orientation. For behavior,\nlifecycle, request-flow, rendering-flow, validation-flow, caller, or\ndependency questions, use `entrypoints` then `trace` instead."
1381
1666
  }
1382
1667
  },
1383
1668
  required: [
@@ -1385,6 +1670,35 @@ function createServer(graph, version) {
1385
1670
  ],
1386
1671
  additionalProperties: false
1387
1672
  },
1673
+ "ITtscGraphTour.IRequest": {
1674
+ type: "object",
1675
+ properties: {
1676
+ type: {
1677
+ type: "string",
1678
+ "enum": [
1679
+ "tour"
1680
+ ],
1681
+ description: "Discriminator for code-tour indexing."
1682
+ },
1683
+ includeTests: {
1684
+ type: "boolean",
1685
+ description: "Include graph-reached test or usage anchors when available."
1686
+ },
1687
+ limit: {
1688
+ type: "number",
1689
+ description: "Maximum central entrypoints to seed the tour.\n\nPrefer the default. Raise only when the question names several distinct\npublic paths that must all appear in one answer."
1690
+ },
1691
+ query: {
1692
+ type: "string",
1693
+ description: "The user's natural code-tour question."
1694
+ }
1695
+ },
1696
+ required: [
1697
+ "type",
1698
+ "query"
1699
+ ],
1700
+ additionalProperties: false
1701
+ },
1388
1702
  "ITtscGraphTrace.IRequest": {
1389
1703
  type: "object",
1390
1704
  properties: {
@@ -1402,7 +1716,7 @@ function createServer(graph, version) {
1402
1716
  "impact",
1403
1717
  "reverse"
1404
1718
  ],
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."
1719
+ description: "`forward` follows what the start uses (callees, instantiations, renders);\n`reverse` follows what uses the start (callers); `impact` is a reverse\ntrace that prioritizes public API and test nodes a change would reach.\nIts test nodes are semantic usage edges, not a text-search inventory.\nCaller questions usually fit `reverse`."
1406
1720
  },
1407
1721
  focus: {
1408
1722
  type: "string",
@@ -1411,23 +1725,27 @@ function createServer(graph, version) {
1411
1725
  "execution",
1412
1726
  "types"
1413
1727
  ],
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."
1728
+ 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. Flow\nquestions should usually choose `execution` rather than `all`."
1415
1729
  },
1416
1730
  from: {
1417
1731
  type: "string",
1418
1732
  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
1733
  },
1734
+ includeExternal: {
1735
+ type: "boolean",
1736
+ description: "Include dependency-boundary nodes from node_modules or bundled `.d.ts`\nlibraries. Leave false for source-flow tours; enable only when the user\nasks about external type/API boundaries."
1737
+ },
1420
1738
  maxDepth: {
1421
1739
  type: "number",
1422
- description: "How many hops deep to follow. Open traces are capped at 2; path mode is\ncapped at 12."
1740
+ description: "How many hops deep to follow. Open forward/reverse traces are capped at\n2; impact traces at 4; path mode at 12.\n\nPrefer the default for open traces. Raise only for path mode or when the\nprevious trace named the missing next hop."
1423
1741
  },
1424
1742
  maxNodes: {
1425
1743
  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."
1744
+ description: "Cap on reached nodes; the trace stops and marks itself truncated past it.\nOpen forward/reverse traces are capped at 8 nodes, impact at 16 nodes.\n\nPrefer the default; use larger open traces only when a named missing edge\nrequires it."
1427
1745
  },
1428
1746
  to: {
1429
1747
  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."
1748
+ 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. Prefer this path mode whenever both ends are known."
1431
1749
  }
1432
1750
  },
1433
1751
  required: [
@@ -1439,22 +1757,24 @@ function createServer(graph, version) {
1439
1757
  }
1440
1758
  },
1441
1759
  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);
1760
+ const _io0 = input => "string" === typeof input.question && "string" === typeof input.draft && "string" === typeof input.review && ("object" === typeof input.request && null !== input.request && _iu0(input.request));
1761
+ const _io1 = 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) && (undefined === input.includeExternal || "boolean" === typeof input.includeExternal);
1762
+ const _io2 = input => "entrypoints" === input.type && "string" === typeof input.query && (undefined === input.limit || "number" === typeof input.limit) && (undefined === input.neighbors || "number" === typeof input.neighbors);
1763
+ const _io3 = input => "lookup" === input.type && "string" === typeof input.query && (undefined === input.limit || "number" === typeof input.limit) && (undefined === input.includeExternal || "boolean" === typeof input.includeExternal);
1764
+ const _io4 = input => "overview" === input.type && (undefined === input.aspect || "all" === input.aspect || "hotspots" === input.aspect || "layers" === input.aspect || "publicApi" === input.aspect);
1765
+ const _io5 = input => "tour" === input.type && "string" === typeof input.query && (undefined === input.limit || "number" === typeof input.limit) && (undefined === input.includeTests || "boolean" === typeof input.includeTests);
1766
+ 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) && (undefined === input.includeExternal || "boolean" === typeof input.includeExternal);
1449
1767
  const _io7 = input => "escape" === input.type && "string" === typeof input.reason && (undefined === input.nextStep || "string" === typeof input.nextStep);
1450
1768
  const _iu0 = input => (() => {
1451
1769
  if ("details" === input.type)
1452
- return _io2(input);
1770
+ return _io1(input);
1453
1771
  else if ("entrypoints" === input.type)
1454
- return _io3(input);
1772
+ return _io2(input);
1455
1773
  else if ("lookup" === input.type)
1456
- return _io4(input);
1774
+ return _io3(input);
1457
1775
  else if ("overview" === input.type)
1776
+ return _io4(input);
1777
+ else if ("tour" === input.type)
1458
1778
  return _io5(input);
1459
1779
  else if ("trace" === input.type)
1460
1780
  return _io6(input);
@@ -1467,17 +1787,9 @@ function createServer(graph, version) {
1467
1787
  path: _path + ".question",
1468
1788
  expected: "string",
1469
1789
  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, {
1790
+ }), "string" === typeof input.draft || _report(_exceptionable, {
1475
1791
  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",
1792
+ expected: "string",
1481
1793
  value: input.draft
1482
1794
  }), "string" === typeof input.review || _report(_exceptionable, {
1483
1795
  path: _path + ".review",
@@ -1485,23 +1797,14 @@ function createServer(graph, version) {
1485
1797
  value: input.review
1486
1798
  }), ("object" === typeof input.request && null !== input.request || _report(_exceptionable, {
1487
1799
  path: _path + ".request",
1488
- expected: "(ITtscGraphDetails.IRequest | ITtscGraphEntrypoints.IRequest | ITtscGraphEscape.IRequest | ITtscGraphLookup.IRequest | ITtscGraphOverview.IRequest | ITtscGraphTrace.IRequest)",
1800
+ expected: "(ITtscGraphDetails.IRequest | ITtscGraphEntrypoints.IRequest | ITtscGraphEscape.IRequest | ITtscGraphLookup.IRequest | ITtscGraphOverview.IRequest | ITtscGraphTour.IRequest | ITtscGraphTrace.IRequest)",
1489
1801
  value: input.request
1490
1802
  })) && _vu0(input.request, _path + ".request", true && _exceptionable) || _report(_exceptionable, {
1491
1803
  path: _path + ".request",
1492
- expected: "(ITtscGraphDetails.IRequest | ITtscGraphEntrypoints.IRequest | ITtscGraphEscape.IRequest | ITtscGraphLookup.IRequest | ITtscGraphOverview.IRequest | ITtscGraphTrace.IRequest)",
1804
+ expected: "(ITtscGraphDetails.IRequest | ITtscGraphEntrypoints.IRequest | ITtscGraphEscape.IRequest | ITtscGraphLookup.IRequest | ITtscGraphOverview.IRequest | ITtscGraphTour.IRequest | ITtscGraphTrace.IRequest)",
1493
1805
  value: input.request
1494
1806
  })].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, {
1807
+ const _vo1 = (input, _path, _exceptionable = true) => ["details" === input.type || _report(_exceptionable, {
1505
1808
  path: _path + ".type",
1506
1809
  expected: "\"details\"",
1507
1810
  value: input.type
@@ -1533,8 +1836,12 @@ function createServer(graph, version) {
1533
1836
  path: _path + ".dependencyLimit",
1534
1837
  expected: "(number | undefined)",
1535
1838
  value: input.dependencyLimit
1839
+ }), undefined === input.includeExternal || "boolean" === typeof input.includeExternal || _report(_exceptionable, {
1840
+ path: _path + ".includeExternal",
1841
+ expected: "(boolean | undefined)",
1842
+ value: input.includeExternal
1536
1843
  })].every(flag => flag);
1537
- const _vo3 = (input, _path, _exceptionable = true) => ["entrypoints" === input.type || _report(_exceptionable, {
1844
+ const _vo2 = (input, _path, _exceptionable = true) => ["entrypoints" === input.type || _report(_exceptionable, {
1538
1845
  path: _path + ".type",
1539
1846
  expected: "\"entrypoints\"",
1540
1847
  value: input.type
@@ -1551,7 +1858,7 @@ function createServer(graph, version) {
1551
1858
  expected: "(number | undefined)",
1552
1859
  value: input.neighbors
1553
1860
  })].every(flag => flag);
1554
- const _vo4 = (input, _path, _exceptionable = true) => ["lookup" === input.type || _report(_exceptionable, {
1861
+ const _vo3 = (input, _path, _exceptionable = true) => ["lookup" === input.type || _report(_exceptionable, {
1555
1862
  path: _path + ".type",
1556
1863
  expected: "\"lookup\"",
1557
1864
  value: input.type
@@ -1563,8 +1870,12 @@ function createServer(graph, version) {
1563
1870
  path: _path + ".limit",
1564
1871
  expected: "(number | undefined)",
1565
1872
  value: input.limit
1873
+ }), undefined === input.includeExternal || "boolean" === typeof input.includeExternal || _report(_exceptionable, {
1874
+ path: _path + ".includeExternal",
1875
+ expected: "(boolean | undefined)",
1876
+ value: input.includeExternal
1566
1877
  })].every(flag => flag);
1567
- const _vo5 = (input, _path, _exceptionable = true) => ["overview" === input.type || _report(_exceptionable, {
1878
+ const _vo4 = (input, _path, _exceptionable = true) => ["overview" === input.type || _report(_exceptionable, {
1568
1879
  path: _path + ".type",
1569
1880
  expected: "\"overview\"",
1570
1881
  value: input.type
@@ -1573,6 +1884,23 @@ function createServer(graph, version) {
1573
1884
  expected: "(\"all\" | \"hotspots\" | \"layers\" | \"publicApi\" | undefined)",
1574
1885
  value: input.aspect
1575
1886
  })].every(flag => flag);
1887
+ const _vo5 = (input, _path, _exceptionable = true) => ["tour" === input.type || _report(_exceptionable, {
1888
+ path: _path + ".type",
1889
+ expected: "\"tour\"",
1890
+ value: input.type
1891
+ }), "string" === typeof input.query || _report(_exceptionable, {
1892
+ path: _path + ".query",
1893
+ expected: "string",
1894
+ value: input.query
1895
+ }), undefined === input.limit || "number" === typeof input.limit || _report(_exceptionable, {
1896
+ path: _path + ".limit",
1897
+ expected: "(number | undefined)",
1898
+ value: input.limit
1899
+ }), undefined === input.includeTests || "boolean" === typeof input.includeTests || _report(_exceptionable, {
1900
+ path: _path + ".includeTests",
1901
+ expected: "(boolean | undefined)",
1902
+ value: input.includeTests
1903
+ })].every(flag => flag);
1576
1904
  const _vo6 = (input, _path, _exceptionable = true) => ["trace" === input.type || _report(_exceptionable, {
1577
1905
  path: _path + ".type",
1578
1906
  expected: "\"trace\"",
@@ -1601,6 +1929,10 @@ function createServer(graph, version) {
1601
1929
  path: _path + ".maxNodes",
1602
1930
  expected: "(number | undefined)",
1603
1931
  value: input.maxNodes
1932
+ }), undefined === input.includeExternal || "boolean" === typeof input.includeExternal || _report(_exceptionable, {
1933
+ path: _path + ".includeExternal",
1934
+ expected: "(boolean | undefined)",
1935
+ value: input.includeExternal
1604
1936
  })].every(flag => flag);
1605
1937
  const _vo7 = (input, _path, _exceptionable = true) => ["escape" === input.type || _report(_exceptionable, {
1606
1938
  path: _path + ".type",
@@ -1617,12 +1949,14 @@ function createServer(graph, version) {
1617
1949
  })].every(flag => flag);
1618
1950
  const _vu0 = (input, _path, _exceptionable = true) => (() => {
1619
1951
  if ("details" === input.type)
1620
- return _vo2(input, _path, true && _exceptionable);
1952
+ return _vo1(input, _path, true && _exceptionable);
1621
1953
  else if ("entrypoints" === input.type)
1622
- return _vo3(input, _path, true && _exceptionable);
1954
+ return _vo2(input, _path, true && _exceptionable);
1623
1955
  else if ("lookup" === input.type)
1624
- return _vo4(input, _path, true && _exceptionable);
1956
+ return _vo3(input, _path, true && _exceptionable);
1625
1957
  else if ("overview" === input.type)
1958
+ return _vo4(input, _path, true && _exceptionable);
1959
+ else if ("tour" === input.type)
1626
1960
  return _vo5(input, _path, true && _exceptionable);
1627
1961
  else if ("trace" === input.type)
1628
1962
  return _vo6(input, _path, true && _exceptionable);
@@ -1631,7 +1965,7 @@ function createServer(graph, version) {
1631
1965
  else
1632
1966
  return _report(_exceptionable, {
1633
1967
  path: _path,
1634
- expected: "(ITtscGraphDetails.IRequest | ITtscGraphEntrypoints.IRequest | ITtscGraphLookup.IRequest | ITtscGraphOverview.IRequest | ITtscGraphTrace.IRequest | ITtscGraphEscape.IRequest)",
1968
+ expected: "(ITtscGraphDetails.IRequest | ITtscGraphEntrypoints.IRequest | ITtscGraphLookup.IRequest | ITtscGraphOverview.IRequest | ITtscGraphTour.IRequest | ITtscGraphTrace.IRequest | ITtscGraphEscape.IRequest)",
1635
1969
  value: input
1636
1970
  });
1637
1971
  })();