@ttsc/graph 0.16.5 → 0.16.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/TtscGraphApplication.js +36 -23
- package/lib/TtscGraphApplication.js.map +1 -1
- package/lib/model/loadGraph.js +17 -17
- package/lib/server/accessAliases.js +53 -0
- package/lib/server/accessAliases.js.map +1 -0
- package/lib/server/createServer.js +1133 -634
- package/lib/server/createServer.js.map +1 -1
- package/lib/server/instructions.js +69 -21
- package/lib/server/instructions.js.map +1 -1
- package/lib/server/runDetails.js +413 -0
- package/lib/server/runDetails.js.map +1 -0
- package/lib/server/{runIndex.js → runEntrypoints.js} +91 -26
- package/lib/server/runEntrypoints.js.map +1 -0
- package/lib/server/{runQuery.js → runLookup.js} +102 -15
- package/lib/server/runLookup.js.map +1 -0
- package/lib/server/runOverview.js +31 -21
- package/lib/server/runOverview.js.map +1 -1
- package/lib/server/runTrace.js +133 -38
- package/lib/server/runTrace.js.map +1 -1
- package/lib/structures/{ITtscGraphQuery.js → ITtscGraphDetails.js} +1 -1
- package/lib/structures/ITtscGraphDetails.js.map +1 -0
- package/lib/structures/ITtscGraphEntrypoints.js +3 -0
- package/lib/structures/ITtscGraphEntrypoints.js.map +1 -0
- package/lib/structures/{ITtscGraphExpand.js → ITtscGraphEscape.js} +1 -1
- package/lib/structures/ITtscGraphEscape.js.map +1 -0
- package/lib/structures/{ITtscGraphIndex.js → ITtscGraphLookup.js} +1 -1
- package/lib/structures/ITtscGraphLookup.js.map +1 -0
- package/lib/structures/index.js +4 -3
- package/lib/structures/index.js.map +1 -1
- package/package.json +2 -2
- package/src/TtscGraphApplication.ts +39 -32
- package/src/server/accessAliases.ts +55 -0
- package/src/server/createServer.ts +4 -7
- package/src/server/instructions.ts +69 -21
- package/src/server/runDetails.ts +469 -0
- package/src/server/{runIndex.ts → runEntrypoints.ts} +109 -34
- package/src/server/{runQuery.ts → runLookup.ts} +123 -16
- package/src/server/runOverview.ts +35 -23
- package/src/server/runTrace.ts +164 -38
- package/src/structures/ITtscGraphApplication.ts +100 -52
- package/src/structures/ITtscGraphDecorator.ts +12 -14
- package/src/structures/ITtscGraphDetails.ts +134 -0
- package/src/structures/{ITtscGraphIndex.ts → ITtscGraphEntrypoints.ts} +34 -16
- package/src/structures/ITtscGraphEscape.ts +39 -0
- package/src/structures/ITtscGraphEvidence.ts +5 -8
- package/src/structures/ITtscGraphLookup.ts +61 -0
- package/src/structures/ITtscGraphNode.ts +10 -4
- package/src/structures/ITtscGraphOverview.ts +24 -16
- package/src/structures/ITtscGraphTrace.ts +54 -11
- package/src/structures/TtscGraphNodeKind.ts +2 -2
- package/src/structures/index.ts +4 -3
- package/lib/server/runExpand.js +0 -177
- package/lib/server/runExpand.js.map +0 -1
- package/lib/server/runIndex.js.map +0 -1
- package/lib/server/runQuery.js.map +0 -1
- package/lib/structures/ITtscGraphExpand.js.map +0 -1
- package/lib/structures/ITtscGraphIndex.js.map +0 -1
- package/lib/structures/ITtscGraphQuery.js.map +0 -1
- package/src/server/runExpand.ts +0 -186
- package/src/structures/ITtscGraphExpand.ts +0 -85
- package/src/structures/ITtscGraphQuery.ts +0 -49
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
|
|
2
|
+
import { ITtscGraphEvidence } from "./ITtscGraphEvidence";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The resolved symbol details returned for a set of handles.
|
|
6
|
+
*
|
|
7
|
+
* The default payload is source-free: signatures, member outlines, and direct
|
|
8
|
+
* graph summaries with sourceSpan anchors.
|
|
9
|
+
*/
|
|
10
|
+
export interface ITtscGraphDetails {
|
|
11
|
+
/** Discriminator for selected symbol inspection. */
|
|
12
|
+
type: "details";
|
|
13
|
+
|
|
14
|
+
nodes: ITtscGraphDetails.INode[];
|
|
15
|
+
|
|
16
|
+
/** Handles that resolved to no node, or that were ambiguous. */
|
|
17
|
+
unknown: string[];
|
|
18
|
+
}
|
|
19
|
+
export namespace ITtscGraphDetails {
|
|
20
|
+
/** Which handles to inspect, and how much of each to return. */
|
|
21
|
+
export interface IRequest {
|
|
22
|
+
/** Discriminator for selected symbol inspection. */
|
|
23
|
+
type: "details";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Node ids from another tool, or dotted symbol handles such as
|
|
27
|
+
* `OrderService.create`. Pass the few handles you need for source-free
|
|
28
|
+
* details; use `trace` when you need a path instead of widening this call.
|
|
29
|
+
*/
|
|
30
|
+
handles: string[];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Also list each node's direct dependencies and dependents (the symbols it
|
|
34
|
+
* uses and the symbols that use it). The list is capped; raise
|
|
35
|
+
* `neighborLimit` only when the first slice is not enough.
|
|
36
|
+
*
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
neighbors?: boolean;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Maximum dependencies and dependents to return per side when
|
|
43
|
+
* `neighbors:true`.
|
|
44
|
+
*
|
|
45
|
+
* @default 2
|
|
46
|
+
*/
|
|
47
|
+
neighborLimit?: number;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Maximum owned members to return for a container or object literal. Raise
|
|
51
|
+
* only when the first outline is truncated.
|
|
52
|
+
*
|
|
53
|
+
* @default 6
|
|
54
|
+
*/
|
|
55
|
+
memberLimit?: number;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Maximum direct execution and type references to return per group. Raise
|
|
59
|
+
* only when the first dependency slice is not enough.
|
|
60
|
+
*
|
|
61
|
+
* @default 1
|
|
62
|
+
*/
|
|
63
|
+
dependencyLimit?: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** One inspected node: its declared shape and graph coordinates. */
|
|
67
|
+
export interface INode {
|
|
68
|
+
id: string;
|
|
69
|
+
name: string;
|
|
70
|
+
kind: string;
|
|
71
|
+
file: string;
|
|
72
|
+
/** 1-based declaration line, when known. */
|
|
73
|
+
line?: number;
|
|
74
|
+
/** The declaration signature: its first line(s) up to the body. */
|
|
75
|
+
signature?: string;
|
|
76
|
+
/** Decorators written on this declaration, when any. */
|
|
77
|
+
decorators?: ITtscGraphDecorator[];
|
|
78
|
+
/** Assigned implementation span, when source comes from one. */
|
|
79
|
+
implementation?: ITtscGraphEvidence;
|
|
80
|
+
/** Direct execution dependencies in source order, with edge evidence. */
|
|
81
|
+
calls?: IReference[];
|
|
82
|
+
/** Direct type dependencies in source order, with edge evidence. */
|
|
83
|
+
types?: IReference[];
|
|
84
|
+
/** String literal values from the signature. */
|
|
85
|
+
literals?: string[];
|
|
86
|
+
/**
|
|
87
|
+
* For a container or object-literal variable: the owned symbol or top-level
|
|
88
|
+
* property outline a consumer reaches for, without bodies.
|
|
89
|
+
*/
|
|
90
|
+
members?: IMember[];
|
|
91
|
+
/** The declaration or implementation file and line range, when known. */
|
|
92
|
+
sourceSpan?: Pick<ITtscGraphEvidence, "file" | "startLine" | "endLine">;
|
|
93
|
+
/** Symbols this node uses (outgoing dependency edges). */
|
|
94
|
+
dependsOn?: IReference[];
|
|
95
|
+
/** Symbols that use this node (incoming dependency edges). */
|
|
96
|
+
dependedOnBy?: IReference[];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** One member of a container node, with its signature but not its body. */
|
|
100
|
+
export interface IMember {
|
|
101
|
+
name: string;
|
|
102
|
+
kind: string;
|
|
103
|
+
/** 1-based declaration line, when known. */
|
|
104
|
+
line?: number;
|
|
105
|
+
/** The member's declaration signature. */
|
|
106
|
+
signature?: string;
|
|
107
|
+
/** Decorators written on this member, when any. */
|
|
108
|
+
decorators?: ITtscGraphDecorator[];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** A dependency neighbor of an inspected node and the edge that links them. */
|
|
112
|
+
export interface IReference {
|
|
113
|
+
id: string;
|
|
114
|
+
name: string;
|
|
115
|
+
kind: string;
|
|
116
|
+
file: string;
|
|
117
|
+
/** 1-based declaration line, when known. */
|
|
118
|
+
line?: number;
|
|
119
|
+
/** The edge kind connecting the two (`calls`, `type_ref`, ...). */
|
|
120
|
+
relation: string;
|
|
121
|
+
/**
|
|
122
|
+
* Source span for the expression that produced this relationship. It lets
|
|
123
|
+
* an agent see why the edge exists without opening the file.
|
|
124
|
+
*/
|
|
125
|
+
evidence?: ITtscGraphEvidence;
|
|
126
|
+
/**
|
|
127
|
+
* Stable access-path aliases derived from edge evidence. For example, an
|
|
128
|
+
* edge to `Owner.member` through `obj.slot.member` may expose
|
|
129
|
+
* `Owner.slot.member` so answers can preserve both the resolved symbol and
|
|
130
|
+
* the source access path.
|
|
131
|
+
*/
|
|
132
|
+
aliases?: string[];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -1,31 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
|
|
2
|
+
import { ITtscGraphEvidence } from "./ITtscGraphEvidence";
|
|
3
|
+
|
|
4
|
+
/** The compact source-free entrypoint list returned for a code question. */
|
|
5
|
+
export interface ITtscGraphEntrypoints {
|
|
6
|
+
/** Discriminator for first-pass question indexing. */
|
|
7
|
+
type: "entrypoints";
|
|
8
|
+
|
|
9
|
+
/** The original question/search phrase the entrypoints were built for. */
|
|
4
10
|
query: string;
|
|
5
11
|
|
|
6
12
|
/** Ranked symbols relevant to the query. */
|
|
7
|
-
hits:
|
|
13
|
+
hits: ITtscGraphEntrypoints.IHit[];
|
|
8
14
|
|
|
9
15
|
/** Code handles written directly in the query, resolved when possible. */
|
|
10
|
-
mentions:
|
|
16
|
+
mentions: ITtscGraphEntrypoints.IMention[];
|
|
11
17
|
|
|
12
18
|
/** Direct dependency context for the resolved mentions and highest hits. */
|
|
13
|
-
neighborhood:
|
|
19
|
+
neighborhood: ITtscGraphEntrypoints.INeighborhood[];
|
|
14
20
|
|
|
15
21
|
/** Follow-up handles for deeper graph calls. */
|
|
16
|
-
next:
|
|
22
|
+
next: ITtscGraphEntrypoints.INext;
|
|
17
23
|
|
|
18
24
|
/** True when result caps hid additional seeds or references. */
|
|
19
25
|
truncated?: boolean;
|
|
20
26
|
}
|
|
21
27
|
|
|
22
|
-
export namespace
|
|
28
|
+
export namespace ITtscGraphEntrypoints {
|
|
23
29
|
/**
|
|
24
|
-
* Ask the graph for the first
|
|
30
|
+
* Ask the graph for the first entrypoints an agent should read before opening
|
|
25
31
|
* source: ranked symbols, exact mentioned handles, and nearby dependency
|
|
26
32
|
* edges.
|
|
27
33
|
*/
|
|
28
|
-
export interface
|
|
34
|
+
export interface IRequest {
|
|
35
|
+
/** Discriminator for first-pass question indexing. */
|
|
36
|
+
type: "entrypoints";
|
|
37
|
+
|
|
29
38
|
/**
|
|
30
39
|
* A natural code question or search phrase. Mix prose with code handles,
|
|
31
40
|
* for example `how Repository.find loads relations` or
|
|
@@ -36,14 +45,16 @@ export namespace ITtscGraphIndex {
|
|
|
36
45
|
/**
|
|
37
46
|
* Maximum ranked hits to return.
|
|
38
47
|
*
|
|
39
|
-
* @default
|
|
48
|
+
* @default 4
|
|
40
49
|
*/
|
|
41
50
|
limit?: number;
|
|
42
51
|
|
|
43
52
|
/**
|
|
44
53
|
* Maximum direct dependencies and dependents to return per indexed symbol.
|
|
54
|
+
* This is an orientation slice, not a dependency dump; use `trace` or
|
|
55
|
+
* `details` with `neighbors:true` after choosing the specific handles.
|
|
45
56
|
*
|
|
46
|
-
* @default
|
|
57
|
+
* @default 0
|
|
47
58
|
*/
|
|
48
59
|
neighbors?: number;
|
|
49
60
|
}
|
|
@@ -58,6 +69,8 @@ export namespace ITtscGraphIndex {
|
|
|
58
69
|
line?: number;
|
|
59
70
|
/** Declaration head, included only for indexed symbols. */
|
|
60
71
|
signature?: string;
|
|
72
|
+
/** Decorators written on this declaration, when any. */
|
|
73
|
+
decorators?: ITtscGraphDecorator[];
|
|
61
74
|
}
|
|
62
75
|
|
|
63
76
|
/** One ranked search hit. */
|
|
@@ -88,13 +101,18 @@ export namespace ITtscGraphIndex {
|
|
|
88
101
|
/** 1-based declaration line, when known. */
|
|
89
102
|
line?: number;
|
|
90
103
|
relation: string;
|
|
104
|
+
/**
|
|
105
|
+
* Source span for the expression that produced this relationship. It lets
|
|
106
|
+
* an agent see why the edge exists without opening the file.
|
|
107
|
+
*/
|
|
108
|
+
evidence?: ITtscGraphEvidence;
|
|
91
109
|
}
|
|
92
110
|
|
|
93
|
-
/** Tool-call handles suggested by this first
|
|
111
|
+
/** Tool-call handles suggested by this first entrypoints result. */
|
|
94
112
|
export interface INext {
|
|
95
|
-
/** Pass these ids to `
|
|
96
|
-
|
|
97
|
-
/** Pass these ids to `
|
|
113
|
+
/** Pass these ids to `details` for source-free symbol facts. */
|
|
114
|
+
details: string[];
|
|
115
|
+
/** Pass these ids to `trace` when following dependency flow. */
|
|
98
116
|
traceFrom: string[];
|
|
99
117
|
}
|
|
100
118
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** The no-op graph result returned when reasoning rejects the graph call. */
|
|
2
|
+
export interface ITtscGraphEscape {
|
|
3
|
+
/** Discriminator for the no-op escape route. */
|
|
4
|
+
type: "escape";
|
|
5
|
+
|
|
6
|
+
/** Always true so callers can distinguish an intentional no-op. */
|
|
7
|
+
skipped: true;
|
|
8
|
+
|
|
9
|
+
/** Why no graph operation should run. */
|
|
10
|
+
reason: string;
|
|
11
|
+
|
|
12
|
+
/** The next non-graph step, if useful. */
|
|
13
|
+
nextStep?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export namespace ITtscGraphEscape {
|
|
17
|
+
/** Exit after the reasoning review decides graph evidence is unnecessary. */
|
|
18
|
+
export interface IRequest {
|
|
19
|
+
/** Discriminator for the no-op escape route. */
|
|
20
|
+
type: "escape";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Why no graph operation should run.
|
|
24
|
+
*
|
|
25
|
+
* Use this when the review finds the user is asking about package scripts,
|
|
26
|
+
* config files, generated output, prose documentation, or an answer that
|
|
27
|
+
* the current graph result already settled.
|
|
28
|
+
*/
|
|
29
|
+
reason: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The next non-graph step, if useful.
|
|
33
|
+
*
|
|
34
|
+
* Keep this short. Examples: `answer from the prior graph result`, `inspect
|
|
35
|
+
* package.json`, or `ask the user for a concrete symbol`.
|
|
36
|
+
*/
|
|
37
|
+
nextStep?: string;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A source location that grounds a node or edge in real code
|
|
3
|
-
* span for a node, or the expression that produced an edge.
|
|
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
4
|
*
|
|
5
5
|
* Evidence is display and grounding only; it is never identity. A node's id is
|
|
6
6
|
* position-invariant (see {@link ITtscGraphNode}), so an edit that shifts a span
|
|
7
|
-
* does not re-key anything. `startLine`/`startCol` are 1-based.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
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.
|
|
10
10
|
*/
|
|
11
11
|
export interface ITtscGraphEvidence {
|
|
12
12
|
/** Project-relative path of the file the span lives in. */
|
|
@@ -23,7 +23,4 @@ export interface ITtscGraphEvidence {
|
|
|
23
23
|
|
|
24
24
|
/** 1-based column where the span ends, when known. */
|
|
25
25
|
endCol?: number;
|
|
26
|
-
|
|
27
|
-
/** A short source excerpt of the span, when the producer inlines one. */
|
|
28
|
-
text?: string;
|
|
29
26
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ITtscGraphDecorator } from "./ITtscGraphDecorator";
|
|
2
|
+
|
|
3
|
+
/** The ranked hits returned by targeted symbol lookup. */
|
|
4
|
+
export interface ITtscGraphLookup {
|
|
5
|
+
/** Discriminator for targeted symbol lookup. */
|
|
6
|
+
type: "lookup";
|
|
7
|
+
|
|
8
|
+
hits: ITtscGraphLookup.IHit[];
|
|
9
|
+
|
|
10
|
+
/** Follow-up handles for selected symbol details. */
|
|
11
|
+
next: ITtscGraphLookup.INext;
|
|
12
|
+
}
|
|
13
|
+
export namespace ITtscGraphLookup {
|
|
14
|
+
/** Find the symbols and clusters most relevant to a natural code query. */
|
|
15
|
+
export interface IRequest {
|
|
16
|
+
/** Discriminator for targeted symbol lookup. */
|
|
17
|
+
type: "lookup";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* What to find, in natural language and code vocabulary mixed freely: a
|
|
21
|
+
* symbol name, a dotted member (`OrderService.create`), or a phrase
|
|
22
|
+
* (`shopping order create`, `repository find relations`). Exact names are
|
|
23
|
+
* not required; subword and CamelCase matches rank too.
|
|
24
|
+
*/
|
|
25
|
+
query: string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Maximum hits to return.
|
|
29
|
+
*
|
|
30
|
+
* @default 5
|
|
31
|
+
*/
|
|
32
|
+
limit?: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** One ranked hit with a handle to follow via `details` or `trace`. */
|
|
36
|
+
export interface IHit {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
kind: string;
|
|
40
|
+
file: string;
|
|
41
|
+
/** 1-based declaration line, when known. */
|
|
42
|
+
line?: number;
|
|
43
|
+
/**
|
|
44
|
+
* The hit's declaration signature, so you can often answer without
|
|
45
|
+
* requesting details.
|
|
46
|
+
*/
|
|
47
|
+
signature?: string;
|
|
48
|
+
/** Decorators written on this declaration, when any. */
|
|
49
|
+
decorators?: ITtscGraphDecorator[];
|
|
50
|
+
/** Relative relevance; higher is a better match. */
|
|
51
|
+
score: number;
|
|
52
|
+
}
|
|
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
|
+
}
|
|
@@ -23,7 +23,7 @@ export interface ITtscGraphNode {
|
|
|
23
23
|
name: string;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* The owner-qualified name, when the node lives inside another declaration
|
|
26
|
+
* The owner-qualified name, when the node lives inside another declaration:
|
|
27
27
|
* `OrderService.create`, `Shopping.ISale`. Absent for a top-level
|
|
28
28
|
* declaration.
|
|
29
29
|
*/
|
|
@@ -34,7 +34,7 @@ export interface ITtscGraphNode {
|
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* True when the declaration lives outside the workspace (a dependency). The
|
|
37
|
-
* graph keeps the leaf as a named endpoint but does not
|
|
37
|
+
* graph keeps the leaf as a named endpoint but does not walk into its
|
|
38
38
|
* internals.
|
|
39
39
|
*/
|
|
40
40
|
external: boolean;
|
|
@@ -54,11 +54,17 @@ export interface ITtscGraphNode {
|
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* The decorators written on this declaration, in source order, when it has
|
|
57
|
-
* any
|
|
57
|
+
* any: raw decorator facts (`@Controller`, `@Get`) a consumer can interpret
|
|
58
58
|
* without re-parsing source.
|
|
59
59
|
*/
|
|
60
60
|
decorators?: ITtscGraphDecorator[];
|
|
61
61
|
|
|
62
|
-
/** The declaration span, for display and
|
|
62
|
+
/** The declaration span, for display and signatures. */
|
|
63
63
|
evidence?: ITtscGraphEvidence;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The implementation span when a callable/property member is implemented by a
|
|
67
|
+
* function assignment separate from its declaration.
|
|
68
|
+
*/
|
|
69
|
+
implementation?: ITtscGraphEvidence;
|
|
64
70
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A compact, source-read-free architecture map of the project
|
|
3
|
-
*
|
|
2
|
+
* A compact, source-read-free architecture map of the project returned by
|
|
3
|
+
* `overview`.
|
|
4
4
|
*/
|
|
5
5
|
export interface ITtscGraphOverview {
|
|
6
|
+
/** Discriminator for source-free project overview. */
|
|
7
|
+
type: "overview";
|
|
8
|
+
|
|
6
9
|
/** Absolute project root. */
|
|
7
10
|
project: string;
|
|
8
11
|
|
|
@@ -19,8 +22,11 @@ export interface ITtscGraphOverview {
|
|
|
19
22
|
publicApi?: ITtscGraphOverview.IPublicApi[];
|
|
20
23
|
}
|
|
21
24
|
export namespace ITtscGraphOverview {
|
|
22
|
-
/** Which architecture facets `
|
|
23
|
-
export interface
|
|
25
|
+
/** Which architecture facets `overview` should return. */
|
|
26
|
+
export interface IRequest {
|
|
27
|
+
/** Discriminator for source-free project overview. */
|
|
28
|
+
type: "overview";
|
|
29
|
+
|
|
24
30
|
/**
|
|
25
31
|
* The facet to project, or `all` for every facet. `layers` is the folder
|
|
26
32
|
* layering, `hotspots` the highest-dependency symbols, `publicApi` the
|
|
@@ -50,12 +56,22 @@ export namespace ITtscGraphOverview {
|
|
|
50
56
|
exported: number;
|
|
51
57
|
}
|
|
52
58
|
|
|
53
|
-
/** A
|
|
54
|
-
export interface
|
|
59
|
+
/** A compact symbol coordinate that can be passed to deeper graph tools. */
|
|
60
|
+
export interface INode {
|
|
61
|
+
/** Stable handle for `details` or `trace`. */
|
|
55
62
|
id: string;
|
|
63
|
+
/** The symbol's qualified name when available. */
|
|
56
64
|
name: string;
|
|
65
|
+
/** Its declaration kind (`class`, `interface`, `function`, ...). */
|
|
57
66
|
kind: string;
|
|
67
|
+
/** Project-relative path of the file that declares it. */
|
|
58
68
|
file: string;
|
|
69
|
+
/** 1-based declaration line, when known. */
|
|
70
|
+
line?: number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** A high-dependency symbol with its non-structural fan-in and fan-out. */
|
|
74
|
+
export interface IHotspot extends INode {
|
|
59
75
|
/** Non-structural edges pointing at this symbol. */
|
|
60
76
|
fanIn: number;
|
|
61
77
|
/** Non-structural edges leaving this symbol. */
|
|
@@ -65,15 +81,7 @@ export namespace ITtscGraphOverview {
|
|
|
65
81
|
/**
|
|
66
82
|
* One symbol on the project's exported public API surface. The list is ranked
|
|
67
83
|
* by how depended-on the symbol is, with test, typings, and generated files
|
|
68
|
-
* excluded
|
|
69
|
-
* first — not whichever file happens to declare the most exports.
|
|
84
|
+
* excluded.
|
|
70
85
|
*/
|
|
71
|
-
export
|
|
72
|
-
/** The exported symbol's name. */
|
|
73
|
-
name: string;
|
|
74
|
-
/** Its declaration kind (`class`, `interface`, `function`, …). */
|
|
75
|
-
kind: string;
|
|
76
|
-
/** Project-relative path of the file that declares it. */
|
|
77
|
-
file: string;
|
|
78
|
-
}
|
|
86
|
+
export type IPublicApi = INode;
|
|
79
87
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
1
|
+
import { ITtscGraphEvidence } from "./ITtscGraphEvidence";
|
|
2
|
+
|
|
3
|
+
/** The ordered dependency flow returned from a start symbol. */
|
|
5
4
|
export interface ITtscGraphTrace {
|
|
5
|
+
/** Discriminator for dependency tracing. */
|
|
6
|
+
type: "trace";
|
|
7
|
+
|
|
6
8
|
/** The resolved start node, or undefined when `from` matched nothing. */
|
|
7
9
|
start?: ITtscGraphTrace.INode;
|
|
8
10
|
|
|
@@ -27,12 +29,21 @@ export interface ITtscGraphTrace {
|
|
|
27
29
|
*/
|
|
28
30
|
path?: ITtscGraphTrace.INode[];
|
|
29
31
|
|
|
32
|
+
/** Compact hop summaries preserving node names and edge evidence, capped. */
|
|
33
|
+
steps?: string[];
|
|
34
|
+
|
|
35
|
+
/** Follow-up handles for inspecting or continuing the trace. */
|
|
36
|
+
next?: ITtscGraphTrace.INext;
|
|
37
|
+
|
|
30
38
|
/** When `from` was an ambiguous name, the matches to disambiguate with. */
|
|
31
39
|
candidates?: ITtscGraphTrace.INode[];
|
|
32
40
|
}
|
|
33
41
|
export namespace ITtscGraphTrace {
|
|
34
42
|
/** Where and how far to trace dependency flow. */
|
|
35
|
-
export interface
|
|
43
|
+
export interface IRequest {
|
|
44
|
+
/** Discriminator for dependency tracing. */
|
|
45
|
+
type: "trace";
|
|
46
|
+
|
|
36
47
|
/**
|
|
37
48
|
* Where to start: a node id from another tool, a simple symbol name, or a
|
|
38
49
|
* dotted member name such as `OrderService.create`. An ambiguous name
|
|
@@ -42,8 +53,8 @@ export namespace ITtscGraphTrace {
|
|
|
42
53
|
|
|
43
54
|
/**
|
|
44
55
|
* A target symbol: node id, simple symbol name, or dotted member name. When
|
|
45
|
-
* given, the tool returns the dependency path from `from` to this target
|
|
46
|
-
* the one-call answer for "how does A reach B"
|
|
56
|
+
* given, the tool returns the dependency path from `from` to this target,
|
|
57
|
+
* the one-call answer for "how does A reach B", instead of an open-ended
|
|
47
58
|
* trace.
|
|
48
59
|
*/
|
|
49
60
|
to?: string;
|
|
@@ -58,16 +69,28 @@ export namespace ITtscGraphTrace {
|
|
|
58
69
|
direction?: "forward" | "reverse" | "impact";
|
|
59
70
|
|
|
60
71
|
/**
|
|
61
|
-
*
|
|
72
|
+
* Which non-structural edge family to follow: `execution` follows runtime
|
|
73
|
+
* calls, instantiations, property access, and JSX renders; `types` follows
|
|
74
|
+
* type references and inheritance; `all` preserves the full graph.
|
|
62
75
|
*
|
|
63
|
-
* @default
|
|
76
|
+
* @default "all"
|
|
77
|
+
*/
|
|
78
|
+
focus?: "all" | "execution" | "types";
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* How many hops deep to follow. Open traces are capped at 2; path mode is
|
|
82
|
+
* capped at 12.
|
|
83
|
+
*
|
|
84
|
+
* @default 2
|
|
64
85
|
*/
|
|
65
86
|
maxDepth?: number;
|
|
66
87
|
|
|
67
88
|
/**
|
|
68
89
|
* Cap on reached nodes; the trace stops and marks itself truncated past it.
|
|
90
|
+
* Open traces are capped at 10 nodes so a broad graph cannot flood
|
|
91
|
+
* context.
|
|
69
92
|
*
|
|
70
|
-
* @default
|
|
93
|
+
* @default 6
|
|
71
94
|
*/
|
|
72
95
|
maxNodes?: number;
|
|
73
96
|
}
|
|
@@ -79,6 +102,18 @@ export namespace ITtscGraphTrace {
|
|
|
79
102
|
kind: string;
|
|
80
103
|
/** Hops from the start (1 = direct). */
|
|
81
104
|
depth: number;
|
|
105
|
+
/**
|
|
106
|
+
* Source span for the expression that produced this hop. It lets an agent
|
|
107
|
+
* explain why the trace moves from one symbol to the next without opening
|
|
108
|
+
* the file.
|
|
109
|
+
*/
|
|
110
|
+
evidence?: ITtscGraphEvidence;
|
|
111
|
+
/**
|
|
112
|
+
* Stable access-path aliases derived from edge evidence. These preserve a
|
|
113
|
+
* resolved member's owner and the concrete property path used at the call
|
|
114
|
+
* site.
|
|
115
|
+
*/
|
|
116
|
+
aliases?: string[];
|
|
82
117
|
}
|
|
83
118
|
|
|
84
119
|
/** A node on the trace: the start, a reached node, or a candidate. */
|
|
@@ -89,9 +124,17 @@ export namespace ITtscGraphTrace {
|
|
|
89
124
|
file: string;
|
|
90
125
|
/** Hops from the start, on a reached node. */
|
|
91
126
|
depth?: number;
|
|
92
|
-
/** The node's signature
|
|
127
|
+
/** The node's signature, carried on path nodes so the path explains itself. */
|
|
93
128
|
signature?: string;
|
|
94
129
|
/** Why this node matters to an impact trace: `exported`, `test`. */
|
|
95
130
|
roles?: string[];
|
|
96
131
|
}
|
|
132
|
+
|
|
133
|
+
/** Tool-call handles suggested by this trace. */
|
|
134
|
+
export interface INext {
|
|
135
|
+
/** Pass these ids to `details` for selected symbol details. */
|
|
136
|
+
details: string[];
|
|
137
|
+
/** Continue tracing from these ids when the current result is intermediate. */
|
|
138
|
+
traceFrom: string[];
|
|
139
|
+
}
|
|
97
140
|
}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The symbol kinds (`file` through `parameter`) are declarations the TypeScript
|
|
5
5
|
* program owns and the checker resolves. `external_symbol` is a
|
|
6
|
-
* dependency-boundary leaf the workspace references but does not declare
|
|
7
|
-
* graph keeps it as a named endpoint without
|
|
6
|
+
* dependency-boundary leaf the workspace references but does not declare. The
|
|
7
|
+
* graph keeps it as a named endpoint without walking into the dependency's
|
|
8
8
|
* internals.
|
|
9
9
|
*
|
|
10
10
|
* Used as the `kind` discriminant on {@link ITtscGraphNode}.
|
package/src/structures/index.ts
CHANGED
|
@@ -10,11 +10,12 @@ export * from "./ITtscGraphDiagnostic";
|
|
|
10
10
|
export * from "./ITtscGraphDump";
|
|
11
11
|
export * from "./ITtscGraphEdge";
|
|
12
12
|
export * from "./ITtscGraphEvidence";
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
13
|
+
export * from "./ITtscGraphEscape";
|
|
14
|
+
export * from "./ITtscGraphDetails";
|
|
15
|
+
export * from "./ITtscGraphEntrypoints";
|
|
15
16
|
export * from "./ITtscGraphNode";
|
|
16
17
|
export * from "./ITtscGraphOverview";
|
|
17
|
-
export * from "./
|
|
18
|
+
export * from "./ITtscGraphLookup";
|
|
18
19
|
export * from "./ITtscGraphTrace";
|
|
19
20
|
export * from "./TtscGraphEdgeKind";
|
|
20
21
|
export * from "./TtscGraphNodeKind";
|