@ttsc/graph 0.18.3 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/README.md +231 -36
  2. package/lib/TtscGraphApplication.d.ts +4 -3
  3. package/lib/TtscGraphApplication.js +54 -19
  4. package/lib/TtscGraphApplication.js.map +1 -1
  5. package/lib/index.d.ts +9 -4
  6. package/lib/index.js +24 -5
  7. package/lib/index.js.map +1 -1
  8. package/lib/model/TtscGraphMemory.js +80 -22
  9. package/lib/model/TtscGraphMemory.js.map +1 -1
  10. package/lib/model/TtscGraphSession.d.ts +36 -0
  11. package/lib/model/TtscGraphSession.js +457 -0
  12. package/lib/model/TtscGraphSession.js.map +1 -0
  13. package/lib/model/loadGraph.d.ts +3 -3
  14. package/lib/model/loadGraph.js +94 -141
  15. package/lib/model/loadGraph.js.map +1 -1
  16. package/lib/resolveGraphBinary.d.ts +4 -2
  17. package/lib/resolveGraphBinary.js +7 -3
  18. package/lib/resolveGraphBinary.js.map +1 -1
  19. package/lib/server/createServer.d.ts +16 -9
  20. package/lib/server/createServer.js +286 -190
  21. package/lib/server/createServer.js.map +1 -1
  22. package/lib/server/exportSurface.d.ts +26 -0
  23. package/lib/server/exportSurface.js +44 -0
  24. package/lib/server/exportSurface.js.map +1 -0
  25. package/lib/server/resolveHandle.d.ts +26 -1
  26. package/lib/server/resolveHandle.js +124 -4
  27. package/lib/server/resolveHandle.js.map +1 -1
  28. package/lib/server/resultAudit.d.ts +74 -0
  29. package/lib/server/resultAudit.js +110 -0
  30. package/lib/server/resultAudit.js.map +1 -0
  31. package/lib/server/resultNext.d.ts +9 -0
  32. package/lib/server/resultNext.js +11 -0
  33. package/lib/server/resultNext.js.map +1 -0
  34. package/lib/server/runDetails.d.ts +15 -3
  35. package/lib/server/runDetails.js +105 -23
  36. package/lib/server/runDetails.js.map +1 -1
  37. package/lib/server/runEntrypoints.d.ts +2 -1
  38. package/lib/server/runEntrypoints.js +17 -10
  39. package/lib/server/runEntrypoints.js.map +1 -1
  40. package/lib/server/runLookup.d.ts +2 -1
  41. package/lib/server/runLookup.js +21 -9
  42. package/lib/server/runLookup.js.map +1 -1
  43. package/lib/server/runOverview.d.ts +2 -1
  44. package/lib/server/runOverview.js +5 -4
  45. package/lib/server/runOverview.js.map +1 -1
  46. package/lib/server/runTour.d.ts +2 -1
  47. package/lib/server/runTour.js +707 -331
  48. package/lib/server/runTour.js.map +1 -1
  49. package/lib/server/runTrace.d.ts +2 -1
  50. package/lib/server/runTrace.js +234 -54
  51. package/lib/server/runTrace.js.map +1 -1
  52. package/lib/server/startServer.d.ts +3 -2
  53. package/lib/server/startServer.js +13 -7
  54. package/lib/server/startServer.js.map +1 -1
  55. package/lib/structures/ITtscGraphApplication.d.ts +122 -114
  56. package/lib/structures/ITtscGraphDecorator.d.ts +4 -7
  57. package/lib/structures/ITtscGraphDetails.d.ts +51 -43
  58. package/lib/structures/ITtscGraphDump.d.ts +36 -11
  59. package/lib/structures/ITtscGraphEdge.d.ts +4 -6
  60. package/lib/structures/ITtscGraphEntrypoints.d.ts +10 -27
  61. package/lib/structures/ITtscGraphEscape.d.ts +6 -16
  62. package/lib/structures/ITtscGraphEvidence.d.ts +5 -8
  63. package/lib/structures/ITtscGraphLookup.d.ts +9 -20
  64. package/lib/structures/ITtscGraphNext.d.ts +10 -7
  65. package/lib/structures/ITtscGraphNode.d.ts +17 -8
  66. package/lib/structures/ITtscGraphOverview.d.ts +10 -14
  67. package/lib/structures/ITtscGraphSpan.d.ts +29 -0
  68. package/lib/structures/{ITtscGraphDiagnostic.js → ITtscGraphSpan.js} +1 -1
  69. package/lib/structures/ITtscGraphSpan.js.map +1 -0
  70. package/lib/structures/ITtscGraphTour.d.ts +65 -23
  71. package/lib/structures/ITtscGraphTrace.d.ts +72 -49
  72. package/lib/structures/TtscGraphEdgeKind.d.ts +7 -1
  73. package/lib/structures/index.d.ts +1 -1
  74. package/lib/structures/index.js +1 -1
  75. package/lib/structures/index.js.map +1 -1
  76. package/lib/view.js +3 -1
  77. package/lib/view.js.map +1 -1
  78. package/package.json +4 -4
  79. package/src/TtscGraphApplication.ts +66 -31
  80. package/src/index.ts +23 -5
  81. package/src/model/TtscGraphMemory.ts +86 -22
  82. package/src/model/TtscGraphSession.ts +204 -0
  83. package/src/model/loadGraph.ts +6 -4
  84. package/src/resolveGraphBinary.ts +7 -3
  85. package/src/server/createServer.ts +24 -17
  86. package/src/server/exportSurface.ts +40 -0
  87. package/src/server/resolveHandle.ts +141 -4
  88. package/src/server/resultAudit.ts +109 -0
  89. package/src/server/resultNext.ts +22 -0
  90. package/src/server/runDetails.ts +112 -28
  91. package/src/server/runEntrypoints.ts +26 -17
  92. package/src/server/runLookup.ts +29 -18
  93. package/src/server/runOverview.ts +9 -10
  94. package/src/server/runTour.ts +764 -363
  95. package/src/server/runTrace.ts +265 -71
  96. package/src/server/startServer.ts +13 -8
  97. package/src/structures/ITtscGraphApplication.ts +124 -114
  98. package/src/structures/ITtscGraphDecorator.ts +4 -7
  99. package/src/structures/ITtscGraphDetails.ts +60 -46
  100. package/src/structures/ITtscGraphDump.ts +41 -11
  101. package/src/structures/ITtscGraphEdge.ts +4 -6
  102. package/src/structures/ITtscGraphEntrypoints.ts +10 -30
  103. package/src/structures/ITtscGraphEscape.ts +6 -19
  104. package/src/structures/ITtscGraphEvidence.ts +5 -8
  105. package/src/structures/ITtscGraphLookup.ts +9 -22
  106. package/src/structures/ITtscGraphNext.ts +10 -7
  107. package/src/structures/ITtscGraphNode.ts +18 -8
  108. package/src/structures/ITtscGraphOverview.ts +10 -17
  109. package/src/structures/ITtscGraphSpan.ts +33 -0
  110. package/src/structures/ITtscGraphTour.ts +70 -28
  111. package/src/structures/ITtscGraphTrace.ts +82 -51
  112. package/src/structures/TtscGraphEdgeKind.ts +7 -0
  113. package/src/structures/index.ts +1 -1
  114. package/src/view.ts +3 -1
  115. package/lib/server/accessAliases.d.ts +0 -8
  116. package/lib/server/accessAliases.js +0 -53
  117. package/lib/server/accessAliases.js.map +0 -1
  118. package/lib/server/resultGuide.d.ts +0 -3
  119. package/lib/server/resultGuide.js +0 -16
  120. package/lib/server/resultGuide.js.map +0 -1
  121. package/lib/structures/ITtscGraphDiagnostic.d.ts +0 -27
  122. package/lib/structures/ITtscGraphDiagnostic.js.map +0 -1
  123. package/src/server/accessAliases.ts +0 -55
  124. package/src/server/resultGuide.ts +0 -20
  125. package/src/structures/ITtscGraphDiagnostic.ts +0 -34
@@ -1,56 +1,42 @@
1
1
  import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
2
2
  import { ITtscGraphEvidence } from "./ITtscGraphEvidence";
3
- import { ITtscGraphNext } from "./ITtscGraphNext";
4
3
  /** The first compact source-free handle list for a TypeScript code question. */
5
4
  export interface ITtscGraphEntrypoints {
6
5
  /** Discriminator for first-pass question indexing. */
7
6
  type: "entrypoints";
8
- /** The original question/search phrase the entrypoints were built for. */
9
- query: string;
10
7
  /** Ranked symbols relevant to the query. */
11
8
  hits: ITtscGraphEntrypoints.IHit[];
12
9
  /** Code handles written directly in the query, resolved when possible. */
13
10
  mentions: ITtscGraphEntrypoints.IMention[];
14
11
  /** Direct dependency context for the resolved mentions and highest hits. */
15
12
  neighborhood: ITtscGraphEntrypoints.INeighborhood[];
16
- /** How to use this source-free result next. */
17
- next: ITtscGraphNext;
18
- /** Human-readable compatibility note mirroring `next`. */
19
- guide: string;
20
- /** True when result caps hid additional seeds or references. */
13
+ /** True when some low-signal seeds or references were capped; the list stands. */
21
14
  truncated?: boolean;
22
15
  }
23
16
  export declare namespace ITtscGraphEntrypoints {
24
17
  /**
25
- * Ask for first handles when the question is narrow but the symbol is not yet
26
- * known. For broad tours, read-next, architecture, or multi-phase runtime
27
- * flow, use `tour` instead of decomposing the answer into entrypoints and
28
- * follow-up calls.
18
+ * First handles when the question is narrow but the symbol name is not yet
19
+ * known.
29
20
  */
30
21
  interface IRequest {
31
22
  /** Discriminator for first-pass question indexing. */
32
23
  type: "entrypoints";
33
24
  /**
34
- * A natural code question or search phrase. Mix prose with code handles,
35
- * for example `how Repository.find loads relations` or
36
- * `SelectQueryBuilder.setFindOptions join aliases`. Keep this close to the
37
- * user's question; do not turn it into a broad keyword dump.
25
+ * A natural code question or search phrase, prose mixed with code handles
26
+ * (`how Repository.find loads relations`). Keep it close to the user's
27
+ * question, not a broad keyword dump.
38
28
  */
39
29
  query: string;
40
30
  /**
41
31
  * Maximum ranked hits to return.
42
32
  *
43
- * Prefer the default. Raise only when the first result was truncated and
44
- * the missing handle is named.
45
- *
46
33
  * @default 4
47
34
  */
48
35
  limit?: number;
49
36
  /**
50
- * Maximum direct dependencies and dependents to return per indexed symbol.
51
- * This is an orientation slice, not a dependency dump; use `trace` or
52
- * `details` with `neighbors:true` after choosing the specific handles.
53
- * Prefer the default zero for the first call.
37
+ * Maximum direct dependencies and dependents per indexed symbol. An
38
+ * orientation slice, not a dependency dump; use `trace` or `details` with
39
+ * `neighbors:true` after choosing the specific handles.
54
40
  *
55
41
  * @default 0
56
42
  */
@@ -108,10 +94,7 @@ export declare namespace ITtscGraphEntrypoints {
108
94
  line?: number;
109
95
  /** Edge kind connecting the indexed node and this neighbor. */
110
96
  relation: string;
111
- /**
112
- * Source span for the expression that produced this relationship. It lets
113
- * an agent see why the edge exists without opening the file.
114
- */
97
+ /** Source span for the edge: shows why it exists without opening the file. */
115
98
  evidence?: ITtscGraphEvidence;
116
99
  }
117
100
  }
@@ -1,4 +1,3 @@
1
- import { ITtscGraphNext } from "./ITtscGraphNext";
2
1
  /** The no-op result for when graph is not the useful next evidence source. */
3
2
  export interface ITtscGraphEscape {
4
3
  /** Discriminator for the no-op escape route. */
@@ -7,10 +6,6 @@ export interface ITtscGraphEscape {
7
6
  skipped: true;
8
7
  /** Why no graph operation should run. */
9
8
  reason: string;
10
- /** How to proceed after skipping graph work. */
11
- next: ITtscGraphNext;
12
- /** Human-readable compatibility note mirroring `next`. */
13
- guide: string;
14
9
  /** Optional note about the next non-graph step. */
15
10
  nextStep?: string;
16
11
  }
@@ -20,20 +15,15 @@ export declare namespace ITtscGraphEscape {
20
15
  /** Discriminator for the no-op escape route. */
21
16
  type: "escape";
22
17
  /**
23
- * Why no graph operation should run.
24
- *
25
- * Use this only when the next evidence is outside the indexed TypeScript
26
- * graph: package scripts, config files, generated output, prose docs, exact
27
- * text, or exact source body text. Name the smallest returned sourceSpan
28
- * when source body text is truly required.
18
+ * Why no graph operation should run. Use only when the next evidence is
19
+ * outside the indexed graph: package scripts, config files, generated
20
+ * output, prose docs, exact text, or source body text. Name the smallest
21
+ * returned sourceSpan when source body text is truly required.
29
22
  */
30
23
  reason: string;
31
24
  /**
32
- * The final non-graph note, if useful.
33
- *
34
- * Keep this short. Examples: `answer from the prior graph result`, `source
35
- * body needed at returned sourceSpan`, or `ask the user for a concrete
36
- * symbol`.
25
+ * A short final non-graph note, if useful, for example `answer from the
26
+ * prior graph result` or `source body needed at returned sourceSpan`.
37
27
  */
38
28
  nextStep?: string;
39
29
  }
@@ -1,12 +1,9 @@
1
1
  /**
2
- * A source location that grounds a node or edge in real code: the declaration
3
- * span for a node, or the expression range that produced an edge.
4
- *
5
- * Evidence is display and grounding only; it is never identity. A node's id is
6
- * position-invariant (see {@link ITtscGraphNode}), so an edit that shifts a span
7
- * does not re-key anything. `startLine`/`startCol` are 1-based. MCP output
8
- * keeps evidence as coordinates; consumers can read the file themselves when
9
- * they truly need source text.
2
+ * A source location grounding a node or edge in real code: the declaration span
3
+ * for a node, or the expression range that produced an edge. Display and
4
+ * grounding only, never identity (a node's id is position-invariant, see
5
+ * {@link ITtscGraphNode}). Lines and columns are 1-based; MCP keeps evidence as
6
+ * coordinates, so read the file yourself when you truly need source text.
10
7
  */
11
8
  export interface ITtscGraphEvidence {
12
9
  /** Project-relative path of the file the span lives in. */
@@ -1,15 +1,10 @@
1
1
  import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
2
- import { ITtscGraphNext } from "./ITtscGraphNext";
3
2
  /** Targeted symbol lookup when a concrete name or handle is being resolved. */
4
3
  export interface ITtscGraphLookup {
5
4
  /** Discriminator for targeted symbol lookup. */
6
5
  type: "lookup";
7
6
  /** Ranked symbol matches for the query. */
8
7
  hits: ITtscGraphLookup.IHit[];
9
- /** How to use this source-free result next. */
10
- next: ITtscGraphNext;
11
- /** Human-readable compatibility note mirroring `next`. */
12
- guide: string;
13
8
  }
14
9
  export declare namespace ITtscGraphLookup {
15
10
  /** Find a concrete class, method, function, property, type, or dotted handle. */
@@ -17,26 +12,23 @@ export declare namespace ITtscGraphLookup {
17
12
  /** Discriminator for targeted symbol lookup. */
18
13
  type: "lookup";
19
14
  /**
20
- * What to find, in natural language and code vocabulary mixed freely: a
21
- * symbol name, a dotted member (`Service.create`), or a short phrase
22
- * (`request handler`). Exact names are not required, but this is not a
23
- * second broad entrypoints call. Use it when a named handle is missing or
24
- * ambiguous.
15
+ * What to find: a symbol name, a dotted member (`Service.create`), or a
16
+ * short phrase (`request handler`). Exact names are not required, but this
17
+ * is not a second broad entrypoints call; use it for a missing or ambiguous
18
+ * named handle.
25
19
  */
26
20
  query: string;
27
21
  /**
28
- * Maximum hits to return.
29
- *
30
- * Prefer the default. Large hit lists usually mean the query is too broad;
31
- * refine the name instead of raising this.
22
+ * Maximum hits to return. A large hit list usually means the query is too
23
+ * broad; refine the name instead of raising this.
32
24
  *
33
25
  * @default 5
34
26
  */
35
27
  limit?: number;
36
28
  /**
37
29
  * Include dependency-boundary declarations from node_modules or bundled
38
- * `.d.ts` libraries. Leave false for project-source answers; enable only
39
- * when external type/API boundaries are the question.
30
+ * `.d.ts` libraries. Enable only when external type/API boundaries are the
31
+ * question.
40
32
  *
41
33
  * @default false
42
34
  */
@@ -54,10 +46,7 @@ export declare namespace ITtscGraphLookup {
54
46
  file: string;
55
47
  /** 1-based declaration line, when known. */
56
48
  line?: number;
57
- /**
58
- * The hit's declaration signature, so you can often answer without
59
- * requesting details.
60
- */
49
+ /** Declaration signature, often enough to answer without a `details` call. */
61
50
  signature?: string;
62
51
  /** Decorators written on this declaration, when any. */
63
52
  decorators?: ITtscGraphDecorator[];
@@ -1,15 +1,18 @@
1
- /** The required next step from a compiler-derived graph result. */
1
+ /** What to do with a compiler-derived graph result. */
2
2
  export interface ITtscGraphNext {
3
3
  /**
4
- * Answer, continue graph inspection, leave graph, or clarify.
4
+ * What to do with this result:
5
5
  *
6
- * `answer` means the returned graph result already carries the evidence
7
- * contract for the current question, even when the slice is capped. Do not
8
- * call graph again or read files to re-check or complete it.
6
+ * - `answer`: the result carries the evidence; stop and answer, do not call
7
+ * graph again or read files to re-check it
8
+ * - `inspect`: the result is genuinely partial; make exactly the one `request`
9
+ * named, once
10
+ * - `outside`: the answer is outside the graph; escape and read source
11
+ * - `clarify`: the request was malformed or ambiguous; restate it
9
12
  */
10
13
  action: "answer" | "inspect" | "outside" | "clarify";
11
- /** Smallest graph request type to use when `action` is `inspect`. */
14
+ /** The single graph request type to use when `action` is `inspect`. */
12
15
  request?: "entrypoints" | "lookup" | "trace" | "details" | "overview" | "tour";
13
- /** Why the returned graph evidence supports that action. */
16
+ /** Why the returned evidence supports that action. */
14
17
  reason: string;
15
18
  }
@@ -27,25 +27,34 @@ export interface ITtscGraphNode {
27
27
  /** Project-relative path of the file that declares this node. */
28
28
  file: string;
29
29
  /**
30
- * True when the declaration lives outside the workspace (a dependency). The
31
- * graph keeps the leaf as a named endpoint but does not walk into its
32
- * internals.
30
+ * True when the declaration is outside the workspace (a dependency): kept as
31
+ * a named endpoint, not walked into.
33
32
  */
34
33
  external: boolean;
35
34
  /**
36
- * True when `file` is git-ignored generated code (a Prisma client, a codegen
37
- * output). Projections desurface these so generated nodes do not bury the
35
+ * True when `file` is git-ignored generated code (Prisma client, codegen
36
+ * output); projections desurface these so generated nodes do not bury the
38
37
  * authored graph.
39
38
  */
40
39
  ignored?: boolean;
41
40
  /** True when the symbol is part of its module's export surface. */
42
41
  exported?: boolean;
42
+ /**
43
+ * True for a declaration made inside another declaration's body: Vue's
44
+ * `baseCreateRenderer.patch`, a callback bound to a const inside a method.
45
+ *
46
+ * It is a name the runtime calls, so a trace, a lookup, or a details request
47
+ * answers with it. An orientation tour does not rank or walk it: a tour is
48
+ * asked what the project's surface is and how it runs, and a body's inner
49
+ * functions are neither — letting them into the seed ranking reshuffled which
50
+ * flows a tour told, and the model went back to the files.
51
+ */
52
+ closure?: boolean;
43
53
  /** Declaration modifiers, when the declaration pass recorded any. */
44
54
  modifiers?: TtscGraphNodeModifier[];
45
55
  /**
46
- * The decorators written on this declaration, in source order, when it has
47
- * any: raw decorator facts (`@Controller`, `@Get`) a consumer can interpret
48
- * without re-parsing source.
56
+ * Decorators written on this declaration, in source order: raw facts
57
+ * (`@Controller`, `@Get`) a consumer interprets without re-parsing source.
49
58
  */
50
59
  decorators?: ITtscGraphDecorator[];
51
60
  /** The declaration span, for display and signatures. */
@@ -1,4 +1,3 @@
1
- import { ITtscGraphNext } from "./ITtscGraphNext";
2
1
  /** A compact, source-read-free project map for broad orientation only. */
3
2
  export interface ITtscGraphOverview {
4
3
  /** Discriminator for source-free project overview. */
@@ -7,10 +6,6 @@ export interface ITtscGraphOverview {
7
6
  project: string;
8
7
  /** Size of the graph. */
9
8
  counts: ITtscGraphOverview.ICounts;
10
- /** How to use this source-free result next. */
11
- next: ITtscGraphNext;
12
- /** Human-readable compatibility note mirroring `next`. */
13
- guide: string;
14
9
  /** Folder layering, largest first. */
15
10
  layers?: ITtscGraphOverview.ILayer[];
16
11
  /** Highest-dependency symbols, busiest first. */
@@ -24,13 +19,15 @@ export declare namespace ITtscGraphOverview {
24
19
  /** Discriminator for source-free project overview. */
25
20
  type: "overview";
26
21
  /**
27
- * The facet to project, or `all` for every facet. `layers` is the folder
28
- * layering, `hotspots` the highest-dependency symbols, `publicApi` the
29
- * exported API symbols ranked by how depended-on they are.
22
+ * Facet to project, or `all` for every facet:
30
23
  *
31
- * Use this only for broad public API or layer orientation. For behavior,
32
- * lifecycle, request-flow, rendering-flow, validation-flow, caller, or
33
- * dependency questions, use `entrypoints` then `trace` instead.
24
+ * - `layers`: folder layering
25
+ * - `hotspots`: highest-dependency symbols
26
+ * - `publicApi`: exported API symbols ranked by how depended-on they are
27
+ *
28
+ * Broad public-API or layer orientation only. For behavior, lifecycle,
29
+ * request/render/validation flow, caller, or dependency questions, use
30
+ * `entrypoints` then `trace`.
34
31
  *
35
32
  * @default "all"
36
33
  */
@@ -77,9 +74,8 @@ export declare namespace ITtscGraphOverview {
77
74
  fanOut: number;
78
75
  }
79
76
  /**
80
- * One symbol on the project's exported public API surface. The list is ranked
81
- * by how depended-on the symbol is, with test, typings, and generated files
82
- * excluded.
77
+ * One exported public-API symbol. The list is ranked by how depended-on the
78
+ * symbol is, excluding test, typings, and generated files.
83
79
  */
84
80
  type IPublicApi = INode;
85
81
  }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * A span on the wire, without the file it lives in.
3
+ *
4
+ * The reader already knows the file: a node's span is in the node's `file`, and
5
+ * an edge's span is in the file its `from` id names. Sending the path a second
6
+ * and a third time cost 17% of the document — on VS Code, 55 MB of a 323 MB
7
+ * dump that then has to be encoded, piped, parsed and validated — for a value
8
+ * that is reconstructible exactly.
9
+ *
10
+ * {@link TtscGraphMemory} puts the file back before any of it is read, so what
11
+ * the graph engine and the MCP results see is the whole
12
+ * {@link ITtscGraphEvidence}. This shape exists only between the Go builder and
13
+ * the loader.
14
+ */
15
+ export interface ITtscGraphSpan {
16
+ /**
17
+ * Present only when it cannot be derived: an `implementation` can live in a
18
+ * different file from the declaration that owns it.
19
+ */
20
+ file?: string;
21
+ /** 1-based line where the span starts. */
22
+ startLine: number;
23
+ /** 1-based column where the span starts, when known. */
24
+ startCol?: number;
25
+ /** 1-based line where the span ends, when known. */
26
+ endLine?: number;
27
+ /** 1-based column where the span ends, when known. */
28
+ endCol?: number;
29
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ITtscGraphDiagnostic.js.map
3
+ //# sourceMappingURL=ITtscGraphSpan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITtscGraphSpan.js","sourceRoot":"","sources":["../../src/structures/ITtscGraphSpan.ts"],"names":[],"mappings":""}
@@ -1,11 +1,8 @@
1
1
  import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
2
- import { ITtscGraphNext } from "./ITtscGraphNext";
3
2
  /** Answer-ready, source-free tour evidence for broad code-flow questions. */
4
3
  export interface ITtscGraphTour {
5
4
  /** Discriminator for code-tour indexing. */
6
5
  type: "tour";
7
- /** Natural code question this tour was built for. */
8
- query: string;
9
6
  /** Central entrypoints selected for the tour. */
10
7
  entrypoints: ITtscGraphTour.INode[];
11
8
  /** Selected primary runtime flows; sufficient for an index-level tour. */
@@ -16,31 +13,48 @@ export interface ITtscGraphTour {
16
13
  tests: ITtscGraphTour.IAnchor[];
17
14
  /** Ordered file/line anchors to cite in the final answer, not file reads. */
18
15
  answerAnchors: ITtscGraphTour.IAnchor[];
19
- /** How to use this source-free result next. */
20
- next: ITtscGraphNext;
21
- /** Human-readable compatibility note mirroring `next`. */
22
- guide: string;
23
- /** True when any internal slice hit its cap. */
16
+ /** True when some low-signal extras were capped; the returned tour stands. */
24
17
  truncated?: boolean;
25
18
  }
26
19
  export declare namespace ITtscGraphTour {
27
20
  /**
28
- * Build the complete index-level answer surface for broad code tours: central
29
- * entrypoints, primary flow, nearby paths, tests, and answer anchors. Use
30
- * this instead of decomposing repository-orientation, read-next,
31
- * architecture, or multi-phase runtime-flow questions into many
32
- * lookup/details/trace calls.
21
+ * A broad code tour: entrypoints, primary flow, nearby paths, and tests.
22
+ *
23
+ * It asks for no question of its own — it ranks against the `question` the
24
+ * caller has already written, in the user's words.
33
25
  */
34
26
  interface IRequest {
35
27
  /** Discriminator for code-tour indexing. */
36
28
  type: "tour";
37
- /** The user's natural code-tour question. */
38
- query: string;
39
29
  /**
40
- * Maximum central entrypoints to seed the tour.
30
+ * Symbol names, never a sentence: the machinery you expect the answer to be
31
+ * made of, spelled the way this codebase would spell it. A question about
32
+ * how a job reaches a worker is reinterpreted as `["JobQueue.push",
33
+ * "Scheduler.tick", "Worker.run", "drainQueue"]`.
41
34
  *
42
- * Prefer the default. Raise only when the question names several distinct
43
- * public paths that must all appear in one answer.
35
+ * Write them from the question, before you have seen a line of the code. A
36
+ * codebase names many things alike, and the question's own words cannot
37
+ * tell them apart: a question about _tracking_ matches the debug hook named
38
+ * after tracking as readily as the function that does it, and one about a
39
+ * _request_ matches a message listener as readily as an HTTP router. The
40
+ * names say which you meant.
41
+ *
42
+ * Each is resolved like a handle — a symbol name, a `Class.member`. The
43
+ * ones the graph holds take half the tour's entrypoints, the rest stays
44
+ * with what the graph finds central, and a name it does not know, or knows
45
+ * several of, is dropped. So a wrong guess costs nothing, and a specific
46
+ * name is worth more than a general one: `drainQueue` resolves, `queue`
47
+ * does not.
48
+ *
49
+ * Send `[]` when the question names no machinery — "show me the central
50
+ * flow" in a repository you have never seen. There is nothing to
51
+ * reinterpret then: the tour ranks on structure, which is what that
52
+ * question asks for. Do not look names up first to fill this.
53
+ */
54
+ reinterpretations: string[];
55
+ /**
56
+ * Central entrypoints to seed the tour. Raise only when the question names
57
+ * several public paths that must all appear in one answer.
44
58
  *
45
59
  * @default 4
46
60
  */
@@ -68,6 +82,12 @@ export declare namespace ITtscGraphTour {
68
82
  sourceSpan?: ITtscGraphTour.ISpan;
69
83
  /** Declaration head, when available. */
70
84
  signature?: string;
85
+ /**
86
+ * The first sentence of the doc comment above the declaration: what the
87
+ * project says this symbol is for. A name and an edge say what calls what;
88
+ * this says why, which is what a tour is asked for.
89
+ */
90
+ doc?: string;
71
91
  /** Decorators written on the declaration, when any. */
72
92
  decorators?: ITtscGraphDecorator[];
73
93
  }
@@ -77,13 +97,35 @@ export declare namespace ITtscGraphTour {
77
97
  start: ITtscGraphTour.INode;
78
98
  /** Compact edge summaries in graph order. */
79
99
  steps: string[];
80
- /** Nodes reached by this flow. */
81
- reached: ITtscGraphTour.INode[];
82
- /** Edge and node anchors that explain the flow. */
83
- anchors: ITtscGraphTour.IAnchor[];
84
- /** True when the flow hit graph caps. */
100
+ /**
101
+ * Every node this flow reached, with the handle to call the graph with
102
+ * next.
103
+ *
104
+ * A step is prose — it names both of its ends and the file and line the
105
+ * call sits on — and it carries no handle. So the nodes a step names are
106
+ * listed here too: `steps` is the story, `reached` is what to go on with.
107
+ */
108
+ reached: ITtscGraphTour.IReached[];
109
+ /** True when some low-signal flow steps were capped; the flow stands. */
85
110
  truncated?: boolean;
86
111
  }
112
+ /**
113
+ * A node a flow reached, as its handle and its declaration line.
114
+ *
115
+ * A node id _is_ its coordinates — `path/to/file.ts#Owner.member:kind` — so a
116
+ * reached node carrying `file` and `kind` beside it bought the same fact
117
+ * three times. Across the benchmark corpus that repetition was 15% of every
118
+ * tour, and a tour is re-sent whole on every turn of the conversation it
119
+ * opened.
120
+ */
121
+ interface IReached {
122
+ /** Stable node id for later graph calls: `file#Qualified.Name:kind`. */
123
+ id: string;
124
+ /** Qualified symbol name when available, otherwise the simple name. */
125
+ name: string;
126
+ /** 1-based declaration line, when known. */
127
+ line?: number;
128
+ }
87
129
  /** A file/line citation chosen by the graph, not source body text. */
88
130
  interface IAnchor {
89
131
  /** Why this anchor matters in the tour. */