@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.
- package/README.md +22 -0
- package/lib/TtscGraphApplication.js +39 -16
- package/lib/TtscGraphApplication.js.map +1 -1
- package/lib/model/TtscGraphMemory.js +43 -4
- package/lib/model/TtscGraphMemory.js.map +1 -1
- package/lib/server/createServer.js +555 -221
- package/lib/server/createServer.js.map +1 -1
- package/lib/server/instructions.js +81 -69
- package/lib/server/instructions.js.map +1 -1
- package/lib/server/pathPolicy.js +35 -0
- package/lib/server/pathPolicy.js.map +1 -0
- package/lib/server/resultGuide.js +16 -0
- package/lib/server/resultGuide.js.map +1 -0
- package/lib/server/runDetails.js +71 -10
- package/lib/server/runDetails.js.map +1 -1
- package/lib/server/runEntrypoints.js +3 -4
- package/lib/server/runEntrypoints.js.map +1 -1
- package/lib/server/runLookup.js +21 -9
- package/lib/server/runLookup.js.map +1 -1
- package/lib/server/runOverview.js +13 -6
- package/lib/server/runOverview.js.map +1 -1
- package/lib/server/runTour.js +737 -0
- package/lib/server/runTour.js.map +1 -0
- package/lib/server/runTrace.js +108 -22
- package/lib/server/runTrace.js.map +1 -1
- package/lib/structures/ITtscGraphNext.js +3 -0
- package/lib/structures/ITtscGraphNext.js.map +1 -0
- package/lib/structures/ITtscGraphTour.js +3 -0
- package/lib/structures/ITtscGraphTour.js.map +1 -0
- package/lib/structures/index.js +2 -0
- package/lib/structures/index.js.map +1 -1
- package/package.json +2 -2
- package/src/TtscGraphApplication.ts +49 -16
- package/src/model/TtscGraphMemory.ts +46 -4
- package/src/server/instructions.ts +81 -69
- package/src/server/pathPolicy.ts +43 -0
- package/src/server/resultGuide.ts +20 -0
- package/src/server/runDetails.ts +90 -6
- package/src/server/runEntrypoints.ts +9 -4
- package/src/server/runLookup.ts +33 -6
- package/src/server/runOverview.ts +24 -8
- package/src/server/runTour.ts +881 -0
- package/src/server/runTrace.ts +151 -23
- package/src/structures/ITtscGraphApplication.ts +35 -64
- package/src/structures/ITtscGraphDetails.ts +74 -11
- package/src/structures/ITtscGraphEntrypoints.ts +46 -15
- package/src/structures/ITtscGraphEscape.ts +19 -9
- package/src/structures/ITtscGraphLookup.ts +36 -15
- package/src/structures/ITtscGraphNext.ts +23 -0
- package/src/structures/ITtscGraphOverview.ts +20 -5
- package/src/structures/ITtscGraphTour.ts +150 -0
- package/src/structures/ITtscGraphTrace.ts +58 -21
- package/src/structures/index.ts +2 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
|
|
2
2
|
import { ITtscGraphEvidence } from "./ITtscGraphEvidence";
|
|
3
|
+
import { ITtscGraphNext } from "./ITtscGraphNext";
|
|
3
4
|
|
|
4
|
-
/** The compact source-free
|
|
5
|
+
/** The first compact source-free handle list for a TypeScript code question. */
|
|
5
6
|
export interface ITtscGraphEntrypoints {
|
|
6
7
|
/** Discriminator for first-pass question indexing. */
|
|
7
8
|
type: "entrypoints";
|
|
@@ -18,8 +19,11 @@ export interface ITtscGraphEntrypoints {
|
|
|
18
19
|
/** Direct dependency context for the resolved mentions and highest hits. */
|
|
19
20
|
neighborhood: ITtscGraphEntrypoints.INeighborhood[];
|
|
20
21
|
|
|
21
|
-
/**
|
|
22
|
-
next:
|
|
22
|
+
/** How to use this source-free result next. */
|
|
23
|
+
next: ITtscGraphNext;
|
|
24
|
+
|
|
25
|
+
/** Human-readable compatibility note mirroring `next`. */
|
|
26
|
+
guide: string;
|
|
23
27
|
|
|
24
28
|
/** True when result caps hid additional seeds or references. */
|
|
25
29
|
truncated?: boolean;
|
|
@@ -27,9 +31,10 @@ export interface ITtscGraphEntrypoints {
|
|
|
27
31
|
|
|
28
32
|
export namespace ITtscGraphEntrypoints {
|
|
29
33
|
/**
|
|
30
|
-
* Ask
|
|
31
|
-
*
|
|
32
|
-
*
|
|
34
|
+
* Ask for first handles when the question is narrow but the symbol is not yet
|
|
35
|
+
* known. For broad tours, read-next, architecture, or multi-phase runtime
|
|
36
|
+
* flow, use `tour` instead of decomposing the answer into entrypoints and
|
|
37
|
+
* follow-up calls.
|
|
33
38
|
*/
|
|
34
39
|
export interface IRequest {
|
|
35
40
|
/** Discriminator for first-pass question indexing. */
|
|
@@ -38,13 +43,17 @@ export namespace ITtscGraphEntrypoints {
|
|
|
38
43
|
/**
|
|
39
44
|
* A natural code question or search phrase. Mix prose with code handles,
|
|
40
45
|
* for example `how Repository.find loads relations` or
|
|
41
|
-
* `SelectQueryBuilder.setFindOptions join aliases`.
|
|
46
|
+
* `SelectQueryBuilder.setFindOptions join aliases`. Keep this close to the
|
|
47
|
+
* user's question; do not turn it into a broad keyword dump.
|
|
42
48
|
*/
|
|
43
49
|
query: string;
|
|
44
50
|
|
|
45
51
|
/**
|
|
46
52
|
* Maximum ranked hits to return.
|
|
47
53
|
*
|
|
54
|
+
* Prefer the default. Raise only when the first result was truncated and
|
|
55
|
+
* the missing handle is named.
|
|
56
|
+
*
|
|
48
57
|
* @default 4
|
|
49
58
|
*/
|
|
50
59
|
limit?: number;
|
|
@@ -53,6 +62,7 @@ export namespace ITtscGraphEntrypoints {
|
|
|
53
62
|
* Maximum direct dependencies and dependents to return per indexed symbol.
|
|
54
63
|
* This is an orientation slice, not a dependency dump; use `trace` or
|
|
55
64
|
* `details` with `neighbors:true` after choosing the specific handles.
|
|
65
|
+
* Prefer the default zero for the first call.
|
|
56
66
|
*
|
|
57
67
|
* @default 0
|
|
58
68
|
*/
|
|
@@ -61,14 +71,24 @@ export namespace ITtscGraphEntrypoints {
|
|
|
61
71
|
|
|
62
72
|
/** A compact symbol coordinate, optionally with its declaration signature. */
|
|
63
73
|
export interface INode {
|
|
74
|
+
/** Stable node id for subsequent graph calls. */
|
|
64
75
|
id: string;
|
|
76
|
+
|
|
77
|
+
/** Qualified symbol name when available, otherwise the simple name. */
|
|
65
78
|
name: string;
|
|
79
|
+
|
|
80
|
+
/** Declaration kind (`class`, `method`, `function`, ...). */
|
|
66
81
|
kind: string;
|
|
82
|
+
|
|
83
|
+
/** Project-relative path of the declaration file. */
|
|
67
84
|
file: string;
|
|
85
|
+
|
|
68
86
|
/** 1-based declaration line, when known. */
|
|
69
87
|
line?: number;
|
|
88
|
+
|
|
70
89
|
/** Declaration head, included only for indexed symbols. */
|
|
71
90
|
signature?: string;
|
|
91
|
+
|
|
72
92
|
/** Decorators written on this declaration, when any. */
|
|
73
93
|
decorators?: ITtscGraphDecorator[];
|
|
74
94
|
}
|
|
@@ -81,38 +101,49 @@ export namespace ITtscGraphEntrypoints {
|
|
|
81
101
|
|
|
82
102
|
/** A code handle written in the query, with its resolution status. */
|
|
83
103
|
export interface IMention {
|
|
104
|
+
/** The exact handle text found in the query. */
|
|
84
105
|
handle: string;
|
|
106
|
+
|
|
107
|
+
/** Resolved node when the handle maps unambiguously. */
|
|
85
108
|
node?: INode;
|
|
109
|
+
|
|
110
|
+
/** Candidate nodes when the handle is ambiguous. */
|
|
86
111
|
candidates?: INode[];
|
|
87
112
|
}
|
|
88
113
|
|
|
89
114
|
/** Direct dependency context around one indexed symbol. */
|
|
90
115
|
export interface INeighborhood extends INode {
|
|
116
|
+
/** Symbols this node directly uses, capped by `neighbors`. */
|
|
91
117
|
dependsOn: IReference[];
|
|
118
|
+
|
|
119
|
+
/** Symbols that directly use this node, capped by `neighbors`. */
|
|
92
120
|
dependedOnBy: IReference[];
|
|
93
121
|
}
|
|
94
122
|
|
|
95
123
|
/** One neighboring symbol and the relationship leading to it. */
|
|
96
124
|
export interface IReference {
|
|
125
|
+
/** Stable id of the neighboring node. */
|
|
97
126
|
id: string;
|
|
127
|
+
|
|
128
|
+
/** Neighbor symbol name, qualified when available. */
|
|
98
129
|
name: string;
|
|
130
|
+
|
|
131
|
+
/** Neighbor declaration kind. */
|
|
99
132
|
kind: string;
|
|
133
|
+
|
|
134
|
+
/** Project-relative declaration file for the neighbor. */
|
|
100
135
|
file: string;
|
|
136
|
+
|
|
101
137
|
/** 1-based declaration line, when known. */
|
|
102
138
|
line?: number;
|
|
139
|
+
|
|
140
|
+
/** Edge kind connecting the indexed node and this neighbor. */
|
|
103
141
|
relation: string;
|
|
142
|
+
|
|
104
143
|
/**
|
|
105
144
|
* Source span for the expression that produced this relationship. It lets
|
|
106
145
|
* an agent see why the edge exists without opening the file.
|
|
107
146
|
*/
|
|
108
147
|
evidence?: ITtscGraphEvidence;
|
|
109
148
|
}
|
|
110
|
-
|
|
111
|
-
/** Tool-call handles suggested by this first entrypoints result. */
|
|
112
|
-
export interface INext {
|
|
113
|
-
/** Pass these ids to `details` for source-free symbol facts. */
|
|
114
|
-
details: string[];
|
|
115
|
-
/** Pass these ids to `trace` when following dependency flow. */
|
|
116
|
-
traceFrom: string[];
|
|
117
|
-
}
|
|
118
149
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ITtscGraphNext } from "./ITtscGraphNext";
|
|
2
|
+
|
|
3
|
+
/** The no-op result for when graph is not the useful next evidence source. */
|
|
2
4
|
export interface ITtscGraphEscape {
|
|
3
5
|
/** Discriminator for the no-op escape route. */
|
|
4
6
|
type: "escape";
|
|
@@ -9,12 +11,18 @@ export interface ITtscGraphEscape {
|
|
|
9
11
|
/** Why no graph operation should run. */
|
|
10
12
|
reason: string;
|
|
11
13
|
|
|
12
|
-
/**
|
|
14
|
+
/** How to proceed after skipping graph work. */
|
|
15
|
+
next: ITtscGraphNext;
|
|
16
|
+
|
|
17
|
+
/** Human-readable compatibility note mirroring `next`. */
|
|
18
|
+
guide: string;
|
|
19
|
+
|
|
20
|
+
/** Optional note about the next non-graph step. */
|
|
13
21
|
nextStep?: string;
|
|
14
22
|
}
|
|
15
23
|
|
|
16
24
|
export namespace ITtscGraphEscape {
|
|
17
|
-
/**
|
|
25
|
+
/** Skip graph work when graph evidence is unnecessary or exhausted. */
|
|
18
26
|
export interface IRequest {
|
|
19
27
|
/** Discriminator for the no-op escape route. */
|
|
20
28
|
type: "escape";
|
|
@@ -22,17 +30,19 @@ export namespace ITtscGraphEscape {
|
|
|
22
30
|
/**
|
|
23
31
|
* Why no graph operation should run.
|
|
24
32
|
*
|
|
25
|
-
* Use this when the
|
|
26
|
-
* config files, generated output, prose
|
|
27
|
-
*
|
|
33
|
+
* Use this only when the next evidence is outside the indexed TypeScript
|
|
34
|
+
* graph: package scripts, config files, generated output, prose docs, exact
|
|
35
|
+
* text, or exact source body text. Name the smallest returned sourceSpan
|
|
36
|
+
* when source body text is truly required.
|
|
28
37
|
*/
|
|
29
38
|
reason: string;
|
|
30
39
|
|
|
31
40
|
/**
|
|
32
|
-
* The
|
|
41
|
+
* The final non-graph note, if useful.
|
|
33
42
|
*
|
|
34
|
-
* Keep this short. Examples: `answer from the prior graph result`, `
|
|
35
|
-
*
|
|
43
|
+
* Keep this short. Examples: `answer from the prior graph result`, `source
|
|
44
|
+
* body needed at returned sourceSpan`, or `ask the user for a concrete
|
|
45
|
+
* symbol`.
|
|
36
46
|
*/
|
|
37
47
|
nextStep?: string;
|
|
38
48
|
}
|
|
@@ -1,61 +1,82 @@
|
|
|
1
1
|
import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
|
|
2
|
+
import { ITtscGraphNext } from "./ITtscGraphNext";
|
|
2
3
|
|
|
3
|
-
/**
|
|
4
|
+
/** Targeted symbol lookup when a concrete name or handle is being resolved. */
|
|
4
5
|
export interface ITtscGraphLookup {
|
|
5
6
|
/** Discriminator for targeted symbol lookup. */
|
|
6
7
|
type: "lookup";
|
|
7
8
|
|
|
9
|
+
/** Ranked symbol matches for the query. */
|
|
8
10
|
hits: ITtscGraphLookup.IHit[];
|
|
9
11
|
|
|
10
|
-
/**
|
|
11
|
-
next:
|
|
12
|
+
/** How to use this source-free result next. */
|
|
13
|
+
next: ITtscGraphNext;
|
|
14
|
+
|
|
15
|
+
/** Human-readable compatibility note mirroring `next`. */
|
|
16
|
+
guide: string;
|
|
12
17
|
}
|
|
13
18
|
export namespace ITtscGraphLookup {
|
|
14
|
-
/** Find
|
|
19
|
+
/** Find a concrete class, method, function, property, type, or dotted handle. */
|
|
15
20
|
export interface IRequest {
|
|
16
21
|
/** Discriminator for targeted symbol lookup. */
|
|
17
22
|
type: "lookup";
|
|
18
23
|
|
|
19
24
|
/**
|
|
20
25
|
* What to find, in natural language and code vocabulary mixed freely: a
|
|
21
|
-
* symbol name, a dotted member (`
|
|
22
|
-
* (`
|
|
23
|
-
*
|
|
26
|
+
* symbol name, a dotted member (`Service.create`), or a short phrase
|
|
27
|
+
* (`request handler`). Exact names are not required, but this is not a
|
|
28
|
+
* second broad entrypoints call. Use it when a named handle is missing or
|
|
29
|
+
* ambiguous.
|
|
24
30
|
*/
|
|
25
31
|
query: string;
|
|
26
32
|
|
|
27
33
|
/**
|
|
28
34
|
* Maximum hits to return.
|
|
29
35
|
*
|
|
36
|
+
* Prefer the default. Large hit lists usually mean the query is too broad;
|
|
37
|
+
* refine the name instead of raising this.
|
|
38
|
+
*
|
|
30
39
|
* @default 5
|
|
31
40
|
*/
|
|
32
41
|
limit?: number;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Include dependency-boundary declarations from node_modules or bundled
|
|
45
|
+
* `.d.ts` libraries. Leave false for project-source answers; enable only
|
|
46
|
+
* when external type/API boundaries are the question.
|
|
47
|
+
*
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
includeExternal?: boolean;
|
|
33
51
|
}
|
|
34
52
|
|
|
35
53
|
/** One ranked hit with a handle to follow via `details` or `trace`. */
|
|
36
54
|
export interface IHit {
|
|
55
|
+
/** Stable node id for subsequent graph calls. */
|
|
37
56
|
id: string;
|
|
57
|
+
|
|
58
|
+
/** Qualified symbol name when available, otherwise the simple name. */
|
|
38
59
|
name: string;
|
|
60
|
+
|
|
61
|
+
/** Declaration kind (`class`, `method`, `function`, ...). */
|
|
39
62
|
kind: string;
|
|
63
|
+
|
|
64
|
+
/** Project-relative path of the declaration file. */
|
|
40
65
|
file: string;
|
|
66
|
+
|
|
41
67
|
/** 1-based declaration line, when known. */
|
|
42
68
|
line?: number;
|
|
69
|
+
|
|
43
70
|
/**
|
|
44
71
|
* The hit's declaration signature, so you can often answer without
|
|
45
72
|
* requesting details.
|
|
46
73
|
*/
|
|
47
74
|
signature?: string;
|
|
75
|
+
|
|
48
76
|
/** Decorators written on this declaration, when any. */
|
|
49
77
|
decorators?: ITtscGraphDecorator[];
|
|
78
|
+
|
|
50
79
|
/** Relative relevance; higher is a better match. */
|
|
51
80
|
score: number;
|
|
52
81
|
}
|
|
53
|
-
|
|
54
|
-
/** Tool-call handles suggested by this lookup result. */
|
|
55
|
-
export interface INext {
|
|
56
|
-
/** Pass these ids to `details` for source-free symbol facts. */
|
|
57
|
-
details: string[];
|
|
58
|
-
/** Pass these ids to `trace` when following dependency flow. */
|
|
59
|
-
traceFrom: string[];
|
|
60
|
-
}
|
|
61
82
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** The required next step from a compiler-derived graph result. */
|
|
2
|
+
export interface ITtscGraphNext {
|
|
3
|
+
/**
|
|
4
|
+
* Answer, continue graph inspection, leave graph, or clarify.
|
|
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.
|
|
9
|
+
*/
|
|
10
|
+
action: "answer" | "inspect" | "outside" | "clarify";
|
|
11
|
+
|
|
12
|
+
/** Smallest graph request type to use when `action` is `inspect`. */
|
|
13
|
+
request?:
|
|
14
|
+
| "entrypoints"
|
|
15
|
+
| "lookup"
|
|
16
|
+
| "trace"
|
|
17
|
+
| "details"
|
|
18
|
+
| "overview"
|
|
19
|
+
| "tour";
|
|
20
|
+
|
|
21
|
+
/** Why the returned graph evidence supports that action. */
|
|
22
|
+
reason: string;
|
|
23
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
1
|
+
import { ITtscGraphNext } from "./ITtscGraphNext";
|
|
2
|
+
|
|
3
|
+
/** A compact, source-read-free project map for broad orientation only. */
|
|
5
4
|
export interface ITtscGraphOverview {
|
|
6
5
|
/** Discriminator for source-free project overview. */
|
|
7
6
|
type: "overview";
|
|
@@ -12,6 +11,12 @@ export interface ITtscGraphOverview {
|
|
|
12
11
|
/** Size of the graph. */
|
|
13
12
|
counts: ITtscGraphOverview.ICounts;
|
|
14
13
|
|
|
14
|
+
/** How to use this source-free result next. */
|
|
15
|
+
next: ITtscGraphNext;
|
|
16
|
+
|
|
17
|
+
/** Human-readable compatibility note mirroring `next`. */
|
|
18
|
+
guide: string;
|
|
19
|
+
|
|
15
20
|
/** Folder layering, largest first. */
|
|
16
21
|
layers?: ITtscGraphOverview.ILayer[];
|
|
17
22
|
|
|
@@ -22,7 +27,7 @@ export interface ITtscGraphOverview {
|
|
|
22
27
|
publicApi?: ITtscGraphOverview.IPublicApi[];
|
|
23
28
|
}
|
|
24
29
|
export namespace ITtscGraphOverview {
|
|
25
|
-
/** Which architecture facets `overview` should return. */
|
|
30
|
+
/** Which broad architecture facets `overview` should return. */
|
|
26
31
|
export interface IRequest {
|
|
27
32
|
/** Discriminator for source-free project overview. */
|
|
28
33
|
type: "overview";
|
|
@@ -32,6 +37,10 @@ export namespace ITtscGraphOverview {
|
|
|
32
37
|
* layering, `hotspots` the highest-dependency symbols, `publicApi` the
|
|
33
38
|
* exported API symbols ranked by how depended-on they are.
|
|
34
39
|
*
|
|
40
|
+
* Use this only for broad public API or layer orientation. For behavior,
|
|
41
|
+
* lifecycle, request-flow, rendering-flow, validation-flow, caller, or
|
|
42
|
+
* dependency questions, use `entrypoints` then `trace` instead.
|
|
43
|
+
*
|
|
35
44
|
* @default "all"
|
|
36
45
|
*/
|
|
37
46
|
aspect?: "all" | "layers" | "hotspots" | "publicApi";
|
|
@@ -39,9 +48,15 @@ export namespace ITtscGraphOverview {
|
|
|
39
48
|
|
|
40
49
|
/** Size of the graph by node/edge totals and per-kind node counts. */
|
|
41
50
|
export interface ICounts {
|
|
51
|
+
/** Number of source file container nodes. */
|
|
42
52
|
files: number;
|
|
53
|
+
|
|
54
|
+
/** Total node count, including declarations and file containers. */
|
|
43
55
|
nodes: number;
|
|
56
|
+
|
|
57
|
+
/** Total edge count, including structural edges. */
|
|
44
58
|
edges: number;
|
|
59
|
+
|
|
45
60
|
/** Node count per kind. */
|
|
46
61
|
byKind: Record<string, number>;
|
|
47
62
|
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
|
|
2
|
+
import { ITtscGraphNext } from "./ITtscGraphNext";
|
|
3
|
+
|
|
4
|
+
/** Answer-ready, source-free tour evidence for broad code-flow questions. */
|
|
5
|
+
export interface ITtscGraphTour {
|
|
6
|
+
/** Discriminator for code-tour indexing. */
|
|
7
|
+
type: "tour";
|
|
8
|
+
|
|
9
|
+
/** Natural code question this tour was built for. */
|
|
10
|
+
query: string;
|
|
11
|
+
|
|
12
|
+
/** Central entrypoints selected for the tour. */
|
|
13
|
+
entrypoints: ITtscGraphTour.INode[];
|
|
14
|
+
|
|
15
|
+
/** Selected primary runtime flows; sufficient for an index-level tour. */
|
|
16
|
+
primaryFlow: ITtscGraphTour.IFlow[];
|
|
17
|
+
|
|
18
|
+
/** Nearby dependency anchors around the selected entrypoints. */
|
|
19
|
+
nearby: ITtscGraphTour.IAnchor[];
|
|
20
|
+
|
|
21
|
+
/** Test or usage anchors reached through graph impact edges. */
|
|
22
|
+
tests: ITtscGraphTour.IAnchor[];
|
|
23
|
+
|
|
24
|
+
/** Ordered file/line anchors to cite in the final answer, not file reads. */
|
|
25
|
+
answerAnchors: ITtscGraphTour.IAnchor[];
|
|
26
|
+
|
|
27
|
+
/** How to use this source-free result next. */
|
|
28
|
+
next: ITtscGraphNext;
|
|
29
|
+
|
|
30
|
+
/** Human-readable compatibility note mirroring `next`. */
|
|
31
|
+
guide: string;
|
|
32
|
+
|
|
33
|
+
/** True when any internal slice hit its cap. */
|
|
34
|
+
truncated?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export namespace ITtscGraphTour {
|
|
38
|
+
/**
|
|
39
|
+
* Build the complete index-level answer surface for broad code tours: central
|
|
40
|
+
* entrypoints, primary flow, nearby paths, tests, and answer anchors. Use
|
|
41
|
+
* this instead of decomposing repository-orientation, read-next,
|
|
42
|
+
* architecture, or multi-phase runtime-flow questions into many
|
|
43
|
+
* lookup/details/trace calls.
|
|
44
|
+
*/
|
|
45
|
+
export interface IRequest {
|
|
46
|
+
/** Discriminator for code-tour indexing. */
|
|
47
|
+
type: "tour";
|
|
48
|
+
|
|
49
|
+
/** The user's natural code-tour question. */
|
|
50
|
+
query: string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Maximum central entrypoints to seed the tour.
|
|
54
|
+
*
|
|
55
|
+
* Prefer the default. Raise only when the question names several distinct
|
|
56
|
+
* public paths that must all appear in one answer.
|
|
57
|
+
*
|
|
58
|
+
* @default 4
|
|
59
|
+
*/
|
|
60
|
+
limit?: number;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Include graph-reached test or usage anchors when available.
|
|
64
|
+
*
|
|
65
|
+
* @default true
|
|
66
|
+
*/
|
|
67
|
+
includeTests?: boolean;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** A compact symbol coordinate for a tour. */
|
|
71
|
+
export interface INode {
|
|
72
|
+
/** Stable node id for later graph calls. */
|
|
73
|
+
id: string;
|
|
74
|
+
|
|
75
|
+
/** Qualified symbol name when available, otherwise the simple name. */
|
|
76
|
+
name: string;
|
|
77
|
+
|
|
78
|
+
/** Declaration kind (`class`, `method`, `function`, ...). */
|
|
79
|
+
kind: string;
|
|
80
|
+
|
|
81
|
+
/** Project-relative declaration file. */
|
|
82
|
+
file: string;
|
|
83
|
+
|
|
84
|
+
/** 1-based declaration line, when known. */
|
|
85
|
+
line?: number;
|
|
86
|
+
|
|
87
|
+
/** Declaration or implementation range, when known. */
|
|
88
|
+
sourceSpan?: ITtscGraphTour.ISpan;
|
|
89
|
+
|
|
90
|
+
/** Declaration head, when available. */
|
|
91
|
+
signature?: string;
|
|
92
|
+
|
|
93
|
+
/** Decorators written on the declaration, when any. */
|
|
94
|
+
decorators?: ITtscGraphDecorator[];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** A primary flow slice from one selected entrypoint. */
|
|
98
|
+
export interface IFlow {
|
|
99
|
+
/** Flow start node. */
|
|
100
|
+
start: ITtscGraphTour.INode;
|
|
101
|
+
|
|
102
|
+
/** Compact edge summaries in graph order. */
|
|
103
|
+
steps: string[];
|
|
104
|
+
|
|
105
|
+
/** Nodes reached by this flow. */
|
|
106
|
+
reached: ITtscGraphTour.INode[];
|
|
107
|
+
|
|
108
|
+
/** Edge and node anchors that explain the flow. */
|
|
109
|
+
anchors: ITtscGraphTour.IAnchor[];
|
|
110
|
+
|
|
111
|
+
/** True when the flow hit graph caps. */
|
|
112
|
+
truncated?: boolean;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** A file/line citation chosen by the graph, not source body text. */
|
|
116
|
+
export interface IAnchor {
|
|
117
|
+
/** Why this anchor matters in the tour. */
|
|
118
|
+
reason: string;
|
|
119
|
+
|
|
120
|
+
/** Stable node id when the anchor belongs to a node. */
|
|
121
|
+
id?: string;
|
|
122
|
+
|
|
123
|
+
/** Symbol, edge, or test name to show in the answer. */
|
|
124
|
+
name: string;
|
|
125
|
+
|
|
126
|
+
/** Declaration kind, when this anchor belongs to a node. */
|
|
127
|
+
kind?: string;
|
|
128
|
+
|
|
129
|
+
/** Project-relative file. */
|
|
130
|
+
file: string;
|
|
131
|
+
|
|
132
|
+
/** 1-based start line. */
|
|
133
|
+
startLine: number;
|
|
134
|
+
|
|
135
|
+
/** 1-based end line, when known. */
|
|
136
|
+
endLine?: number;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Source coordinates without source text. */
|
|
140
|
+
export interface ISpan {
|
|
141
|
+
/** Project-relative file. */
|
|
142
|
+
file: string;
|
|
143
|
+
|
|
144
|
+
/** 1-based start line. */
|
|
145
|
+
startLine: number;
|
|
146
|
+
|
|
147
|
+
/** 1-based end line, when known. */
|
|
148
|
+
endLine?: number;
|
|
149
|
+
}
|
|
150
|
+
}
|