@ttsc/graph 0.16.6 → 0.16.8
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 +45 -25
- 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/model/loadGraph.js +74 -90
- package/lib/model/loadGraph.js.map +1 -1
- package/lib/reduce.js +34 -3
- package/lib/reduce.js.map +1 -1
- package/lib/server/createServer.js +650 -247
- package/lib/server/createServer.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 +3 -8
- package/src/TtscGraphApplication.ts +49 -16
- package/src/model/TtscGraphMemory.ts +46 -4
- package/src/reduce.ts +37 -5
- package/src/server/createServer.ts +7 -2
- 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 +126 -57
- 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
- package/lib/server/instructions.js +0 -80
- package/lib/server/instructions.js.map +0 -1
- package/src/server/instructions.ts +0 -76
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
|
|
2
2
|
import { ITtscGraphEvidence } from "./ITtscGraphEvidence";
|
|
3
|
+
import { ITtscGraphNext } from "./ITtscGraphNext";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
|
-
* The
|
|
6
|
+
* The source-free facts for a few selected handles.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
8
|
+
* This is not a file reader. It returns signatures, member outlines, direct
|
|
9
|
+
* calls, direct types, implementation candidates, dependency summaries, and
|
|
10
|
+
* sourceSpan citation anchors.
|
|
9
11
|
*/
|
|
10
12
|
export interface ITtscGraphDetails {
|
|
11
13
|
/** Discriminator for selected symbol inspection. */
|
|
12
14
|
type: "details";
|
|
13
15
|
|
|
16
|
+
/** Selected node facts, in the same order as resolved handles when possible. */
|
|
14
17
|
nodes: ITtscGraphDetails.INode[];
|
|
15
18
|
|
|
19
|
+
/** How to use this source-free result next. */
|
|
20
|
+
next: ITtscGraphNext;
|
|
21
|
+
|
|
22
|
+
/** Human-readable compatibility note mirroring `next`. */
|
|
23
|
+
guide: string;
|
|
24
|
+
|
|
16
25
|
/** Handles that resolved to no node, or that were ambiguous. */
|
|
17
26
|
unknown: string[];
|
|
18
27
|
}
|
|
19
28
|
export namespace ITtscGraphDetails {
|
|
20
|
-
/** Which handles to inspect, and how much of each to return. */
|
|
29
|
+
/** Which selected handles to inspect, and how much of each to return. */
|
|
21
30
|
export interface IRequest {
|
|
22
31
|
/** Discriminator for selected symbol inspection. */
|
|
23
32
|
type: "details";
|
|
@@ -25,14 +34,16 @@ export namespace ITtscGraphDetails {
|
|
|
25
34
|
/**
|
|
26
35
|
* Node ids from another tool, or dotted symbol handles such as
|
|
27
36
|
* `OrderService.create`. Pass the few handles you need for source-free
|
|
28
|
-
* details
|
|
37
|
+
* details. Prefer one to three handles. Use `trace` when you need a path
|
|
38
|
+
* instead of widening this call.
|
|
29
39
|
*/
|
|
30
40
|
handles: string[];
|
|
31
41
|
|
|
32
42
|
/**
|
|
33
43
|
* Also list each node's direct dependencies and dependents (the symbols it
|
|
34
44
|
* uses and the symbols that use it). The list is capped; raise
|
|
35
|
-
* `neighborLimit`
|
|
45
|
+
* `neighborLimit` when the first slice is truncated and the missing
|
|
46
|
+
* relation is named. This remains a relationship summary, not a file body.
|
|
36
47
|
*
|
|
37
48
|
* @default false
|
|
38
49
|
*/
|
|
@@ -42,13 +53,17 @@ export namespace ITtscGraphDetails {
|
|
|
42
53
|
* Maximum dependencies and dependents to return per side when
|
|
43
54
|
* `neighbors:true`.
|
|
44
55
|
*
|
|
56
|
+
* Prefer the default. Values above a few neighbors are usually overfetch;
|
|
57
|
+
* call `trace` for flow instead.
|
|
58
|
+
*
|
|
45
59
|
* @default 2
|
|
46
60
|
*/
|
|
47
61
|
neighborLimit?: number;
|
|
48
62
|
|
|
49
63
|
/**
|
|
50
64
|
* Maximum owned members to return for a container or object literal. Raise
|
|
51
|
-
* only when the first outline is truncated
|
|
65
|
+
* only when the first outline is truncated and the missing member is
|
|
66
|
+
* named.
|
|
52
67
|
*
|
|
53
68
|
* @default 6
|
|
54
69
|
*/
|
|
@@ -56,73 +71,121 @@ export namespace ITtscGraphDetails {
|
|
|
56
71
|
|
|
57
72
|
/**
|
|
58
73
|
* Maximum direct execution and type references to return per group. Raise
|
|
59
|
-
* only when the first dependency slice is
|
|
74
|
+
* only when the first dependency slice is truncated and the missing
|
|
75
|
+
* dependency is named.
|
|
60
76
|
*
|
|
61
77
|
* @default 1
|
|
62
78
|
*/
|
|
63
79
|
dependencyLimit?: number;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Include dependency-boundary references from node_modules or bundled
|
|
83
|
+
* `.d.ts` libraries. Leave false for source-architecture answers; enable
|
|
84
|
+
* only when external type/API boundaries are the question.
|
|
85
|
+
*
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
includeExternal?: boolean;
|
|
64
89
|
}
|
|
65
90
|
|
|
66
91
|
/** One inspected node: its declared shape and graph coordinates. */
|
|
67
92
|
export interface INode {
|
|
93
|
+
/** Stable node id for subsequent `details` or `trace` calls. */
|
|
68
94
|
id: string;
|
|
95
|
+
|
|
96
|
+
/** Qualified symbol name when available, otherwise the simple name. */
|
|
69
97
|
name: string;
|
|
98
|
+
|
|
99
|
+
/** Declaration kind (`class`, `method`, `function`, ...). */
|
|
70
100
|
kind: string;
|
|
101
|
+
|
|
102
|
+
/** Project-relative path of the file that declares this node. */
|
|
71
103
|
file: string;
|
|
104
|
+
|
|
72
105
|
/** 1-based declaration line, when known. */
|
|
73
106
|
line?: number;
|
|
107
|
+
|
|
74
108
|
/** The declaration signature: its first line(s) up to the body. */
|
|
75
109
|
signature?: string;
|
|
110
|
+
|
|
76
111
|
/** Decorators written on this declaration, when any. */
|
|
77
112
|
decorators?: ITtscGraphDecorator[];
|
|
113
|
+
|
|
78
114
|
/** Assigned implementation span, when source comes from one. */
|
|
79
115
|
implementation?: ITtscGraphEvidence;
|
|
116
|
+
|
|
80
117
|
/** Direct execution dependencies in source order, with edge evidence. */
|
|
81
118
|
calls?: IReference[];
|
|
119
|
+
|
|
82
120
|
/** Direct type dependencies in source order, with edge evidence. */
|
|
83
121
|
types?: IReference[];
|
|
122
|
+
|
|
123
|
+
/** Concrete nodes that implement or override this interface/base member. */
|
|
124
|
+
implementedBy?: IReference[];
|
|
125
|
+
|
|
84
126
|
/** String literal values from the signature. */
|
|
85
127
|
literals?: string[];
|
|
128
|
+
|
|
86
129
|
/**
|
|
87
130
|
* For a container or object-literal variable: the owned symbol or top-level
|
|
88
131
|
* property outline a consumer reaches for, without bodies.
|
|
89
132
|
*/
|
|
90
133
|
members?: IMember[];
|
|
91
|
-
|
|
134
|
+
|
|
135
|
+
/** Declaration or implementation citation range, when known. */
|
|
92
136
|
sourceSpan?: Pick<ITtscGraphEvidence, "file" | "startLine" | "endLine">;
|
|
137
|
+
|
|
93
138
|
/** Symbols this node uses (outgoing dependency edges). */
|
|
94
139
|
dependsOn?: IReference[];
|
|
140
|
+
|
|
95
141
|
/** Symbols that use this node (incoming dependency edges). */
|
|
96
142
|
dependedOnBy?: IReference[];
|
|
97
143
|
}
|
|
98
144
|
|
|
99
145
|
/** One member of a container node, with its signature but not its body. */
|
|
100
146
|
export interface IMember {
|
|
147
|
+
/** Member name, qualified when the graph records an owner-qualified handle. */
|
|
101
148
|
name: string;
|
|
149
|
+
|
|
150
|
+
/** Member kind (`method`, `property`, `class`, ...). */
|
|
102
151
|
kind: string;
|
|
152
|
+
|
|
103
153
|
/** 1-based declaration line, when known. */
|
|
104
154
|
line?: number;
|
|
155
|
+
|
|
105
156
|
/** The member's declaration signature. */
|
|
106
157
|
signature?: string;
|
|
158
|
+
|
|
107
159
|
/** Decorators written on this member, when any. */
|
|
108
160
|
decorators?: ITtscGraphDecorator[];
|
|
109
161
|
}
|
|
110
162
|
|
|
111
163
|
/** A dependency neighbor of an inspected node and the edge that links them. */
|
|
112
164
|
export interface IReference {
|
|
165
|
+
/** Stable id of the neighboring node. */
|
|
113
166
|
id: string;
|
|
167
|
+
|
|
168
|
+
/** Neighbor symbol name, qualified when available. */
|
|
114
169
|
name: string;
|
|
170
|
+
|
|
171
|
+
/** Neighbor declaration kind. */
|
|
115
172
|
kind: string;
|
|
173
|
+
|
|
174
|
+
/** Project-relative declaration file for the neighbor. */
|
|
116
175
|
file: string;
|
|
176
|
+
|
|
117
177
|
/** 1-based declaration line, when known. */
|
|
118
178
|
line?: number;
|
|
179
|
+
|
|
119
180
|
/** The edge kind connecting the two (`calls`, `type_ref`, ...). */
|
|
120
181
|
relation: string;
|
|
182
|
+
|
|
121
183
|
/**
|
|
122
|
-
* Source span for the expression that produced this relationship. It
|
|
123
|
-
*
|
|
184
|
+
* Source span for the expression that produced this relationship. It is
|
|
185
|
+
* repository evidence for the edge, not a file-read instruction.
|
|
124
186
|
*/
|
|
125
187
|
evidence?: ITtscGraphEvidence;
|
|
188
|
+
|
|
126
189
|
/**
|
|
127
190
|
* Stable access-path aliases derived from edge evidence. For example, an
|
|
128
191
|
* edge to `Owner.member` through `obj.slot.member` may expose
|
|
@@ -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
|
}
|