@ttsc/graph 0.30.4 → 0.31.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 (292) hide show
  1. package/README.md +122 -30
  2. package/lib/CapturedProcessOutput.d.ts +47 -0
  3. package/lib/CapturedProcessOutput.js +3 -0
  4. package/lib/CapturedProcessOutput.js.map +1 -0
  5. package/lib/ILauncherOption.d.ts +22 -0
  6. package/lib/ILauncherOption.js +3 -0
  7. package/lib/ILauncherOption.js.map +1 -0
  8. package/lib/IProjectOptions.d.ts +18 -0
  9. package/lib/IProjectOptions.js +3 -0
  10. package/lib/IProjectOptions.js.map +1 -0
  11. package/lib/ParsedLauncherOptions.d.ts +13 -0
  12. package/lib/ParsedLauncherOptions.js +3 -0
  13. package/lib/ParsedLauncherOptions.js.map +1 -0
  14. package/lib/TtscGraphApplication.d.ts +38 -1
  15. package/lib/TtscGraphApplication.js +26 -1
  16. package/lib/TtscGraphApplication.js.map +1 -1
  17. package/lib/TtscGraphLauncherArguments.d.ts +115 -0
  18. package/lib/TtscGraphLauncherArguments.js +181 -0
  19. package/lib/TtscGraphLauncherArguments.js.map +1 -0
  20. package/lib/TtscGraphViewSnapshot.d.ts +35 -0
  21. package/lib/TtscGraphViewSnapshot.js +48 -0
  22. package/lib/TtscGraphViewSnapshot.js.map +1 -0
  23. package/lib/index.d.ts +9 -24
  24. package/lib/index.js +6 -128
  25. package/lib/index.js.map +1 -1
  26. package/lib/internal/GraphProcessTrace.d.ts +1 -0
  27. package/lib/internal/GraphProcessTrace.js +235 -0
  28. package/lib/internal/GraphProcessTrace.js.map +1 -0
  29. package/lib/launcherArgs.d.ts +75 -16
  30. package/lib/launcherArgs.js +77 -8
  31. package/lib/launcherArgs.js.map +1 -1
  32. package/lib/model/IArtifactDirectory.d.ts +26 -0
  33. package/lib/model/IArtifactDirectory.js +3 -0
  34. package/lib/model/IArtifactDirectory.js.map +1 -0
  35. package/lib/model/IArtifactInputs.d.ts +19 -0
  36. package/lib/model/IArtifactInputs.js +3 -0
  37. package/lib/model/IArtifactInputs.js.map +1 -0
  38. package/lib/model/IPublishedArtifacts.d.ts +76 -0
  39. package/lib/model/IPublishedArtifacts.js +3 -0
  40. package/lib/model/IPublishedArtifacts.js.map +1 -0
  41. package/lib/model/IPublishedArtifactsResident.d.ts +19 -0
  42. package/lib/model/IPublishedArtifactsResident.js +3 -0
  43. package/lib/model/IPublishedArtifactsResident.js.map +1 -0
  44. package/lib/model/ITtscLintDaemonTarget.d.ts +20 -0
  45. package/lib/model/ITtscLintDaemonTarget.js +3 -0
  46. package/lib/model/ITtscLintDaemonTarget.js.map +1 -0
  47. package/lib/model/TtscGraphLinePeer.d.ts +146 -0
  48. package/lib/model/TtscGraphLinePeer.js +213 -0
  49. package/lib/model/TtscGraphLinePeer.js.map +1 -0
  50. package/lib/model/TtscGraphMemory.d.ts +156 -16
  51. package/lib/model/TtscGraphMemory.js +228 -222
  52. package/lib/model/TtscGraphMemory.js.map +1 -1
  53. package/lib/model/TtscGraphNativeArguments.d.ts +40 -0
  54. package/lib/model/TtscGraphNativeArguments.js +64 -0
  55. package/lib/model/TtscGraphNativeArguments.js.map +1 -0
  56. package/lib/model/TtscGraphNodeId.d.ts +55 -3
  57. package/lib/model/TtscGraphNodeId.js +40 -2
  58. package/lib/model/TtscGraphNodeId.js.map +1 -1
  59. package/lib/model/TtscGraphProjection.d.ts +156 -0
  60. package/lib/model/TtscGraphProjection.js +390 -0
  61. package/lib/model/TtscGraphProjection.js.map +1 -0
  62. package/lib/model/TtscGraphProtocol.d.ts +28 -0
  63. package/lib/model/TtscGraphProtocol.js +928 -0
  64. package/lib/model/TtscGraphProtocol.js.map +1 -0
  65. package/lib/model/TtscGraphReadonly.d.ts +15 -0
  66. package/lib/model/TtscGraphReadonly.js +3 -0
  67. package/lib/model/TtscGraphReadonly.js.map +1 -0
  68. package/lib/model/TtscGraphRequestOptions.d.ts +16 -0
  69. package/lib/model/TtscGraphRequestOptions.js +3 -0
  70. package/lib/model/TtscGraphRequestOptions.js.map +1 -0
  71. package/lib/model/TtscGraphSession.d.ts +82 -36
  72. package/lib/model/TtscGraphSession.js +164 -1238
  73. package/lib/model/TtscGraphSession.js.map +1 -1
  74. package/lib/model/TtscGraphSessionOptions.d.ts +20 -0
  75. package/lib/model/TtscGraphSessionOptions.js +3 -0
  76. package/lib/model/TtscGraphSessionOptions.js.map +1 -0
  77. package/lib/model/TtscGraphSessionState.d.ts +187 -0
  78. package/lib/model/TtscGraphSessionState.js +417 -0
  79. package/lib/model/TtscGraphSessionState.js.map +1 -0
  80. package/lib/model/TtscGraphShardStore.d.ts +64 -3
  81. package/lib/model/TtscGraphShardStore.js +85 -15
  82. package/lib/model/TtscGraphShardStore.js.map +1 -1
  83. package/lib/model/TtscGraphSourceReader.d.ts +31 -8
  84. package/lib/model/TtscGraphSourceReader.js +37 -13
  85. package/lib/model/TtscGraphSourceReader.js.map +1 -1
  86. package/lib/model/TtscLintDaemon.d.ts +35 -17
  87. package/lib/model/TtscLintDaemon.js +39 -117
  88. package/lib/model/TtscLintDaemon.js.map +1 -1
  89. package/lib/model/TtscLintDaemonState.d.ts +69 -0
  90. package/lib/model/TtscLintDaemonState.js +166 -0
  91. package/lib/model/TtscLintDaemonState.js.map +1 -0
  92. package/lib/model/copyGraphRecords.d.ts +14 -0
  93. package/lib/model/copyGraphRecords.js +19 -0
  94. package/lib/model/copyGraphRecords.js.map +1 -0
  95. package/lib/model/copyGraphSnapshot.d.ts +17 -0
  96. package/lib/model/copyGraphSnapshot.js +33 -0
  97. package/lib/model/copyGraphSnapshot.js.map +1 -0
  98. package/lib/model/loadGraph.d.ts +19 -10
  99. package/lib/model/loadGraph.js +21 -12
  100. package/lib/model/loadGraph.js.map +1 -1
  101. package/lib/model/publishedArtifacts.d.ts +78 -97
  102. package/lib/model/publishedArtifacts.js +271 -85
  103. package/lib/model/publishedArtifacts.js.map +1 -1
  104. package/lib/nativeExecutable.d.ts +19 -8
  105. package/lib/nativeExecutable.js +75 -15
  106. package/lib/nativeExecutable.js.map +1 -1
  107. package/lib/reduce.d.ts +19 -45
  108. package/lib/reduce.js +19 -3
  109. package/lib/reduce.js.map +1 -1
  110. package/lib/resolveGraphBinary.d.ts +9 -0
  111. package/lib/resolveGraphBinary.js +11 -3
  112. package/lib/resolveGraphBinary.js.map +1 -1
  113. package/lib/runGraph.d.ts +21 -0
  114. package/lib/runGraph.js +83 -0
  115. package/lib/runGraph.js.map +1 -0
  116. package/lib/server/IResolvedGraphHandle.d.ts +22 -0
  117. package/lib/server/IResolvedGraphHandle.js +3 -0
  118. package/lib/server/IResolvedGraphHandle.js.map +1 -0
  119. package/lib/server/createServer.d.ts +14 -10
  120. package/lib/server/createServer.js +42 -39
  121. package/lib/server/createServer.js.map +1 -1
  122. package/lib/server/exportSurface.d.ts +23 -1
  123. package/lib/server/exportSurface.js +23 -1
  124. package/lib/server/exportSurface.js.map +1 -1
  125. package/lib/server/formatGraphFailure.d.ts +20 -0
  126. package/lib/server/formatGraphFailure.js +35 -0
  127. package/lib/server/formatGraphFailure.js.map +1 -0
  128. package/lib/server/pathPolicy.d.ts +70 -5
  129. package/lib/server/pathPolicy.js +66 -4
  130. package/lib/server/pathPolicy.js.map +1 -1
  131. package/lib/server/resolveHandle.d.ts +10 -5
  132. package/lib/server/resolveHandle.js +39 -7
  133. package/lib/server/resolveHandle.js.map +1 -1
  134. package/lib/server/resultAudit.d.ts +17 -14
  135. package/lib/server/resultAudit.js +56 -27
  136. package/lib/server/resultAudit.js.map +1 -1
  137. package/lib/server/resultNext.d.ts +26 -1
  138. package/lib/server/resultNext.js +14 -0
  139. package/lib/server/resultNext.js.map +1 -1
  140. package/lib/server/runDetails.d.ts +72 -15
  141. package/lib/server/runDetails.js +104 -69
  142. package/lib/server/runDetails.js.map +1 -1
  143. package/lib/server/runEntrypoints.d.ts +9 -0
  144. package/lib/server/runEntrypoints.js +9 -0
  145. package/lib/server/runEntrypoints.js.map +1 -1
  146. package/lib/server/runLookup.d.ts +13 -3
  147. package/lib/server/runLookup.js +19 -6
  148. package/lib/server/runLookup.js.map +1 -1
  149. package/lib/server/runOverview.d.ts +13 -4
  150. package/lib/server/runOverview.js +13 -4
  151. package/lib/server/runOverview.js.map +1 -1
  152. package/lib/server/runTour.d.ts +9 -0
  153. package/lib/server/runTour.js +33 -65
  154. package/lib/server/runTour.js.map +1 -1
  155. package/lib/server/runTrace.d.ts +25 -1
  156. package/lib/server/runTrace.js +133 -88
  157. package/lib/server/runTrace.js.map +1 -1
  158. package/lib/server/startServer.d.ts +16 -0
  159. package/lib/server/startServer.js +24 -1
  160. package/lib/server/startServer.js.map +1 -1
  161. package/lib/structures/ITtscGraphApplication.d.ts +95 -41
  162. package/lib/structures/ITtscGraphDecorator.d.ts +18 -0
  163. package/lib/structures/ITtscGraphDetails.d.ts +81 -6
  164. package/lib/structures/ITtscGraphDocTag.d.ts +17 -8
  165. package/lib/structures/ITtscGraphDump.d.ts +106 -8
  166. package/lib/structures/ITtscGraphEdge.d.ts +14 -2
  167. package/lib/structures/ITtscGraphEntrypoints.d.ts +81 -6
  168. package/lib/structures/ITtscGraphEscape.d.ts +24 -2
  169. package/lib/structures/ITtscGraphEvidence.d.ts +9 -0
  170. package/lib/structures/ITtscGraphLookup.d.ts +42 -9
  171. package/lib/structures/ITtscGraphNext.d.ts +12 -1
  172. package/lib/structures/ITtscGraphNode.d.ts +38 -11
  173. package/lib/structures/ITtscGraphOverview.d.ts +81 -6
  174. package/lib/structures/ITtscGraphSnapshot.d.ts +97 -2
  175. package/lib/structures/ITtscGraphSpan.d.ts +9 -0
  176. package/lib/structures/ITtscGraphTour.d.ts +83 -9
  177. package/lib/structures/ITtscGraphTrace.d.ts +99 -14
  178. package/lib/structures/RawDump.d.ts +22 -0
  179. package/lib/structures/RawDump.js +3 -0
  180. package/lib/structures/RawDump.js.map +1 -0
  181. package/lib/structures/RawEdge.d.ts +20 -0
  182. package/lib/structures/RawEdge.js +3 -0
  183. package/lib/structures/RawEdge.js.map +1 -0
  184. package/lib/structures/RawNode.d.ts +26 -0
  185. package/lib/structures/RawNode.js +3 -0
  186. package/lib/structures/RawNode.js.map +1 -0
  187. package/lib/structures/TtscGraphArtifactNodeKind.d.ts +9 -0
  188. package/lib/structures/TtscGraphArtifactNodeKind.js +9 -0
  189. package/lib/structures/TtscGraphArtifactNodeKind.js.map +1 -1
  190. package/lib/structures/TtscGraphDumpEdgeKind.d.ts +15 -1
  191. package/lib/structures/TtscGraphDumpNodeKind.d.ts +9 -0
  192. package/lib/structures/TtscGraphEdgeKind.d.ts +13 -4
  193. package/lib/structures/TtscGraphNodeKind.d.ts +9 -0
  194. package/lib/structures/TtscGraphNodeModifier.d.ts +9 -0
  195. package/lib/structures/ViewerLink.d.ts +20 -0
  196. package/lib/structures/ViewerLink.js +3 -0
  197. package/lib/structures/ViewerLink.js.map +1 -0
  198. package/lib/structures/ViewerNode.d.ts +24 -0
  199. package/lib/structures/ViewerNode.js +3 -0
  200. package/lib/structures/ViewerNode.js.map +1 -0
  201. package/lib/structures/ViewerPayload.d.ts +42 -0
  202. package/lib/structures/ViewerPayload.js +3 -0
  203. package/lib/structures/ViewerPayload.js.map +1 -0
  204. package/lib/view.d.ts +9 -0
  205. package/lib/view.js +203 -91
  206. package/lib/view.js.map +1 -1
  207. package/lib/viewer/viewer.js +1 -1
  208. package/package.json +8 -6
  209. package/src/CapturedProcessOutput.ts +50 -0
  210. package/src/ILauncherOption.ts +24 -0
  211. package/src/IProjectOptions.ts +19 -0
  212. package/src/ParsedLauncherOptions.ts +13 -0
  213. package/src/TtscGraphApplication.ts +38 -1
  214. package/src/TtscGraphLauncherArguments.ts +207 -0
  215. package/src/TtscGraphViewSnapshot.ts +46 -0
  216. package/src/index.ts +9 -160
  217. package/src/internal/GraphProcessTrace.ts +242 -0
  218. package/src/launcherArgs.ts +89 -23
  219. package/src/model/IArtifactDirectory.ts +27 -0
  220. package/src/model/IArtifactInputs.ts +21 -0
  221. package/src/model/IPublishedArtifacts.ts +81 -0
  222. package/src/model/IPublishedArtifactsResident.ts +24 -0
  223. package/src/model/ITtscLintDaemonTarget.ts +22 -0
  224. package/src/model/TtscGraphLinePeer.ts +318 -0
  225. package/src/model/TtscGraphMemory.ts +284 -246
  226. package/src/model/TtscGraphNativeArguments.ts +67 -0
  227. package/src/model/TtscGraphNodeId.ts +57 -3
  228. package/src/model/TtscGraphProjection.ts +473 -0
  229. package/src/model/TtscGraphProtocol.ts +90 -0
  230. package/src/model/TtscGraphReadonly.ts +17 -0
  231. package/src/model/TtscGraphRequestOptions.ts +16 -0
  232. package/src/model/TtscGraphSession.ts +196 -475
  233. package/src/model/TtscGraphSessionOptions.ts +22 -0
  234. package/src/model/TtscGraphSessionState.ts +558 -0
  235. package/src/model/TtscGraphShardStore.ts +99 -23
  236. package/src/model/TtscGraphSourceReader.ts +37 -15
  237. package/src/model/TtscLintDaemon.ts +55 -136
  238. package/src/model/TtscLintDaemonState.ts +174 -0
  239. package/src/model/copyGraphRecords.ts +17 -0
  240. package/src/model/copyGraphSnapshot.ts +30 -0
  241. package/src/model/loadGraph.ts +23 -12
  242. package/src/model/publishedArtifacts.ts +361 -182
  243. package/src/nativeExecutable.ts +93 -26
  244. package/src/reduce.ts +24 -51
  245. package/src/resolveGraphBinary.ts +13 -3
  246. package/src/runGraph.ts +90 -0
  247. package/src/server/IResolvedGraphHandle.ts +24 -0
  248. package/src/server/createServer.ts +16 -22
  249. package/src/server/exportSurface.ts +23 -1
  250. package/src/server/formatGraphFailure.ts +32 -0
  251. package/src/server/pathPolicy.ts +70 -5
  252. package/src/server/resolveHandle.ts +45 -14
  253. package/src/server/resultAudit.ts +58 -27
  254. package/src/server/resultNext.ts +26 -1
  255. package/src/server/runDetails.ts +138 -73
  256. package/src/server/runEntrypoints.ts +13 -1
  257. package/src/server/runLookup.ts +23 -7
  258. package/src/server/runOverview.ts +17 -5
  259. package/src/server/runTour.ts +44 -82
  260. package/src/server/runTrace.ts +175 -102
  261. package/src/server/startServer.ts +29 -1
  262. package/src/structures/ITtscGraphApplication.ts +95 -41
  263. package/src/structures/ITtscGraphDecorator.ts +18 -0
  264. package/src/structures/ITtscGraphDetails.ts +81 -6
  265. package/src/structures/ITtscGraphDocTag.ts +17 -8
  266. package/src/structures/ITtscGraphDump.ts +106 -8
  267. package/src/structures/ITtscGraphEdge.ts +14 -2
  268. package/src/structures/ITtscGraphEntrypoints.ts +81 -6
  269. package/src/structures/ITtscGraphEscape.ts +24 -2
  270. package/src/structures/ITtscGraphEvidence.ts +9 -0
  271. package/src/structures/ITtscGraphLookup.ts +42 -9
  272. package/src/structures/ITtscGraphNext.ts +12 -1
  273. package/src/structures/ITtscGraphNode.ts +38 -11
  274. package/src/structures/ITtscGraphOverview.ts +88 -6
  275. package/src/structures/ITtscGraphSnapshot.ts +117 -2
  276. package/src/structures/ITtscGraphSpan.ts +9 -0
  277. package/src/structures/ITtscGraphTour.ts +83 -9
  278. package/src/structures/ITtscGraphTrace.ts +100 -14
  279. package/src/structures/RawDump.ts +25 -0
  280. package/src/structures/RawEdge.ts +22 -0
  281. package/src/structures/RawNode.ts +31 -0
  282. package/src/structures/TtscGraphArtifactNodeKind.ts +9 -0
  283. package/src/structures/TtscGraphDumpEdgeKind.ts +15 -1
  284. package/src/structures/TtscGraphDumpNodeKind.ts +9 -0
  285. package/src/structures/TtscGraphEdgeKind.ts +13 -4
  286. package/src/structures/TtscGraphNodeKind.ts +9 -0
  287. package/src/structures/TtscGraphNodeModifier.ts +9 -0
  288. package/src/structures/ViewerLink.ts +22 -0
  289. package/src/structures/ViewerNode.ts +28 -0
  290. package/src/structures/ViewerPayload.ts +52 -0
  291. package/src/view.ts +208 -110
  292. package/src/viewer/legend.ts +119 -27
@@ -1,6 +1,20 @@
1
- import { ITtscGraphNode } from "../structures/ITtscGraphNode";
1
+ import { TtscGraphReadonly } from "../model/TtscGraphReadonly";
2
+ import { ITtscGraphNode as NodeShape } from "../structures/ITtscGraphNode";
2
3
 
3
- /** True for dependency declarations outside the authored project graph. */
4
+ type ITtscGraphNode = TtscGraphReadonly<NodeShape>;
5
+
6
+ /**
7
+ * True for dependency declarations outside the authored project graph.
8
+ *
9
+ * @evidence contracts/common.md#principled-implementation Producer external status, bundled coordinates and node_modules path segments identify dependency boundaries in the graph's portable vocabulary.
10
+ * @evidence contracts/common.md#clear-and-simple-design One predicate owns external selection for projections.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Selection follows provenance and dependency coordinates rather than named repositories.
12
+ * @evidence contracts/common.md#meaningful-documentation The native headline states dependency-boundary meaning; the predicate uses portable graph coordinates rather than native paths.
13
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources returns a boolean and retains nothing.
14
+ * @evidenceExclude contracts/performance.md#efficient-algorithms one flag read and two string tests on a single coordinate.
15
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work pure per-call work with no cache, so there is nothing to share or invalidate.
16
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation classifies a slash-normalized coordinate string from the dump and never touches the filesystem.
17
+ */
4
18
  export function isExternalNode(node: ITtscGraphNode): boolean {
5
19
  return (
6
20
  node.external ||
@@ -13,12 +27,35 @@ export function isExternalNode(node: ITtscGraphNode): boolean {
13
27
  * True for a `.d.ts` declaration file. Every declaration such a file holds is
14
28
  * ambient by construction, so none of them carries a body the graph can walk
15
29
  * into, whether or not the `declare` keyword is written out.
30
+ *
31
+ * @evidence contracts/common.md#principled-implementation The declaration-file suffix recognizes d.ts, d.cts and d.mts ambient files under TypeScript's supported filename conventions.
32
+ * @evidence contracts/common.md#clear-and-simple-design One suffix predicate is reused by body and support-file policies.
33
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Ambient status is not guessed from fixture names or missing written declare keywords.
34
+ * @evidence contracts/common.md#meaningful-documentation Native prose explains why ambient declarations are bodyless regardless of modifier spelling.
35
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources returns a boolean and retains nothing.
36
+ * @evidenceExclude contracts/performance.md#efficient-algorithms one suffix test on a single coordinate.
37
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work pure per-call work with no cache, so there is nothing to share or invalidate.
38
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation tests the suffix of a coordinate string and never touches the filesystem.
16
39
  */
17
40
  export function isDeclarationFile(file: string): boolean {
18
41
  return /\.d\.[cm]?ts$/.test(file);
19
42
  }
20
43
 
21
- /** True for tests, examples, fixtures, generated output, and build artifacts. */
44
+ /**
45
+ * True for conventional tests, examples, fixtures, generated output and builds.
46
+ *
47
+ * This is a projection heuristic over portable graph coordinates, not proof
48
+ * that a source is generated or a package's manifest classification.
49
+ *
50
+ * @evidence contracts/common.md#principled-implementation Segment and suffix conventions select likely support material; declaration-file and dependency checks share the established coordinate vocabulary.
51
+ * @evidence contracts/common.md#clear-and-simple-design One policy combines conventional support categories for rankers rather than duplicating regexes in each runner.
52
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The heuristic uses general path categories and does not hardcode benchmark repositories or expected symbols.
53
+ * @evidence contracts/common.md#meaningful-documentation Native prose states heuristic status and its provenance limitation rather than certifying generated source from naming.
54
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources returns a boolean and retains nothing.
55
+ * @evidenceExclude contracts/performance.md#efficient-algorithms a fixed handful of string and pattern tests on a single coordinate.
56
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work pure per-call work with no cache, so there is nothing to share or invalidate.
57
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation classifies a slash-normalized coordinate string from the dump and never touches the filesystem.
58
+ */
22
59
  export function isSupportPath(file: string): boolean {
23
60
  return (
24
61
  file === "" ||
@@ -34,7 +71,21 @@ export function isSupportPath(file: string): boolean {
34
71
  );
35
72
  }
36
73
 
37
- /** True for source files whose declarations are tests or test helpers. */
74
+ /**
75
+ * True for conventional test-directory or test/spec-suffixed source paths.
76
+ *
77
+ * This identifies likely test anchors by path convention; it does not execute
78
+ * tests or establish their behavioral coverage.
79
+ *
80
+ * @evidence contracts/common.md#principled-implementation Complete path segments and TypeScript/JavaScript test suffixes recognize conventional test locations without substring matches on arbitrary names.
81
+ * @evidence contracts/common.md#clear-and-simple-design The test subset has one predicate separate from the broader support-file policy.
82
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Returned test anchors follow general conventions rather than an expected benchmark answer list.
83
+ * @evidence contracts/common.md#meaningful-documentation Native prose explains conventional selection and its lack of behavioral verification.
84
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources returns a boolean and retains nothing.
85
+ * @evidenceExclude contracts/performance.md#efficient-algorithms two pattern tests on a single coordinate.
86
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work pure per-call work with no cache, so there is nothing to share or invalidate.
87
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation classifies a slash-normalized coordinate string from the dump and never touches the filesystem.
88
+ */
38
89
  export function isTestPath(file: string): boolean {
39
90
  return (
40
91
  /(^|\/)(test|tests|__tests__|spec)\//.test(file) ||
@@ -42,7 +93,21 @@ export function isTestPath(file: string): boolean {
42
93
  );
43
94
  }
44
95
 
45
- /** True when exported symbols are unlikely to be authored public API. */
96
+ /**
97
+ * True when exported symbols are unlikely to be authored public API.
98
+ *
99
+ * Support material, ambient typings and internal directories are selection
100
+ * signals, not proof that a symbol cannot be imported.
101
+ *
102
+ * @evidence contracts/common.md#principled-implementation Shared support selection plus typings/internal conventions identify likely API noise while preserving actual compiler export facts elsewhere.
103
+ * @evidence contracts/common.md#clear-and-simple-design The API projection adds its own two exclusions to the common support predicate.
104
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Heuristic API visibility does not rewrite the producer's actual export table.
105
+ * @evidence contracts/common.md#meaningful-documentation Native prose distinguishes likely authored API from supported importability.
106
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources returns a boolean and retains nothing.
107
+ * @evidenceExclude contracts/performance.md#efficient-algorithms a fixed handful of pattern tests on a single coordinate.
108
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work pure per-call work with no cache, so there is nothing to share or invalidate.
109
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation classifies a slash-normalized coordinate string from the dump and never touches the filesystem.
110
+ */
46
111
  export function isPublicApiNoisePath(file: string): boolean {
47
112
  return (
48
113
  isSupportPath(file) ||
@@ -1,13 +1,12 @@
1
1
  import { TtscGraphMemory } from "../model/TtscGraphMemory";
2
2
  import { parseTtscGraphNodeId } from "../model/TtscGraphNodeId";
3
- import { ITtscGraphNode } from "../structures/ITtscGraphNode";
3
+ import { TtscGraphReadonly } from "../model/TtscGraphReadonly";
4
+ import { ITtscGraphNode as NodeShape } from "../structures/ITtscGraphNode";
5
+ import type { IResolvedGraphHandle } from "./IResolvedGraphHandle";
4
6
  import { exportFanIn } from "./exportSurface";
5
7
  import { isSupportPath } from "./pathPolicy";
6
8
 
7
- export interface IResolvedGraphHandle {
8
- node?: ITtscGraphNode;
9
- candidates?: ITtscGraphNode[];
10
- }
9
+ type ITtscGraphNode = TtscGraphReadonly<NodeShape>;
11
10
 
12
11
  /**
13
12
  * Resolve a tool handle as an id, an exact symbol name, a dotted suffix, or a
@@ -34,6 +33,15 @@ export interface IResolvedGraphHandle {
34
33
  * method (`db.query`, `app.listen`, `repo.save`), so the member is what it
35
34
  * means, and the candidates come back ranked when several classes declare
36
35
  * it.
36
+ *
37
+ * @evidence contracts/common.md#principled-implementation Exact id/name resolution precedes suffix and file/member fallbacks; unique outcomes preserve identity while multiple matches remain candidates.
38
+ * @evidence contracts/common.md#clear-and-simple-design Resolution helpers each own one handle form and one shared ranker orders ambiguity consistently.
39
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts General handle grammar and compiler export edges guide fallback, not repository-specific expected symbol lists.
40
+ * @evidence contracts/common.md#meaningful-documentation Native paragraphs describe supported stale-id, file-qualified and value-receiver spellings plus preserved ambiguity.
41
+ * @evidence contracts/performance.md#efficient-algorithms Exact id and symbol probes use generation indexes; a dotted-suffix miss can scan V nodes and collect C matches, while ranking their indexed edge neighborhoods retains the best K in O(CK) time and O(K) additional space for the normal small cap.
42
+ * @evidence contracts/performance.md#reuse-equivalent-work The graph shares id, symbol and adjacency indexes across handle resolutions; each call ranks a fresh candidate set because the spelling and requested limit can differ.
43
+ * @evidence contracts/performance.md#bound-retention-and-release-resources Candidate lists are request-local and returned to the caller; the resolver retains no history, handle or running task.
44
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation looks handles up in in-memory indexes; a path part of an id is matched as text.
37
45
  */
38
46
  export function resolveGraphHandle(
39
47
  graph: TtscGraphMemory,
@@ -142,15 +150,38 @@ function rank(
142
150
  candidateLimit: number,
143
151
  ): IResolvedGraphHandle {
144
152
  if (resolved.candidates === undefined) return resolved;
145
- const ranked = resolved.candidates
146
- .map((node) => ({ node, score: candidateScore(graph, node) }))
147
- .sort((a, b) => {
148
- const score = b.score - a.score;
149
- return score !== 0 ? score : compareIdentity(a.node.id, b.node.id);
150
- })
151
- .slice(0, candidateLimit)
152
- .map(({ node }) => node);
153
- return { candidates: ranked };
153
+ const candidates = resolved.candidates;
154
+ const cap = Math.trunc(candidateLimit);
155
+ const compare = (
156
+ a: { node: ITtscGraphNode; score: number },
157
+ b: { node: ITtscGraphNode; score: number },
158
+ ): number => {
159
+ const score = b.score - a.score;
160
+ return score !== 0 ? score : compareIdentity(a.node.id, b.node.id);
161
+ };
162
+ // Large or unusual public caps retain Array.slice semantics; the normal
163
+ // small cap need not sort every ambiguous declaration in the project.
164
+ if (!Number.isFinite(cap) || cap < 0 || cap > 32) {
165
+ return {
166
+ candidates: candidates
167
+ .map((node) => ({ node, score: candidateScore(graph, node) }))
168
+ .sort(compare)
169
+ .slice(0, candidateLimit)
170
+ .map(({ node }) => node),
171
+ };
172
+ }
173
+ const ranked: Array<{ node: ITtscGraphNode; score: number }> = [];
174
+ for (const node of candidates) {
175
+ const item = { node, score: candidateScore(graph, node) };
176
+ const position = ranked.findIndex((other) => compare(item, other) < 0);
177
+ if (position < 0) {
178
+ if (ranked.length < cap) ranked.push(item);
179
+ } else if (position < cap) {
180
+ ranked.splice(position, 0, item);
181
+ if (ranked.length > cap) ranked.pop();
182
+ }
183
+ }
184
+ return { candidates: ranked.map(({ node }) => node) };
154
185
  }
155
186
 
156
187
  /** Compare position-invariant ids without locale-dependent collation. */
@@ -1,3 +1,31 @@
1
+ import { TTSC_GRAPH_ARTIFACT_NODE_KINDS } from "../structures/TtscGraphArtifactNodeKind";
2
+
3
+ /**
4
+ * What the audits say about facts the compiler did not resolve.
5
+ *
6
+ * The graph holds two kinds of fact that no compiler pass resolved, and an
7
+ * audit that called every fact compiler-resolved claimed more than this layer
8
+ * checked. The memory layer derives structure from compiler-owned declarations:
9
+ * `file` containers, `contains` ownership, a class member's `property` kind, a
10
+ * `test` role or `tests` anchor chosen by path convention, and, in a trace,
11
+ * `dispatches` hops built from `overrides` and `implements`. And an artifact
12
+ * node is published by a lint plugin that parsed a document, a data model, or
13
+ * an API description in a process of its own, which is exactly what the dump's
14
+ * `artifactProducer` records. The text names both, and lists the artifact kinds
15
+ * from the one vocabulary the memory layer classifies by, so a kind added there
16
+ * cannot be left out of what the audit disclaims.
17
+ */
18
+ const NOT_COMPILER_RESOLVED: string = [
19
+ "The server adds only structure derived from those facts: `file` nodes, `contains` ownership,",
20
+ "`dispatches` hops, a class member's `property` kind, and the `test` role and `tests` anchors,",
21
+ "which it assigns from a file's conventional test location rather than from the compiler. A node whose kind is one of",
22
+ TTSC_GRAPH_ARTIFACT_NODE_KINDS.map((kind) => `\`${kind}\``).join(", ") +
23
+ " is not",
24
+ "the compiler's: a lint plugin parsed that artifact in its own process, and the graph returns its",
25
+ "address, kind, name, and line as that plugin reported them. Nothing else is the server's own,",
26
+ "so for this snapshot a compiler-resolved fact here cannot disagree with the program.",
27
+ ].join("\n");
28
+
1
29
  /**
2
30
  * The audit stamped as the first property of every
3
31
  * {@link ITtscGraphApplication.IOutput}. Because it serializes before `result`,
@@ -37,25 +65,28 @@
37
65
  * layer holds no `Program` and no checker, it runs one pure projection over an
38
66
  * in-memory `TtscGraphMemory`, and it selects a constant by request type
39
67
  * (#818). What is true is stronger than it sounds and is what the text now
40
- * says: the compiler resolved these facts when the snapshot was built, the
41
- * graph holds what it resolved, and this result is a projection of exactly
42
- * those facts that adds none of its own. A reader who checks that claim finds
43
- * it holds; a reader who checked the old one found a promise the code could not
44
- * have kept.
68
+ * says: the compiler resolved these declaration facts when the snapshot was
69
+ * built, the graph holds what it resolved, and this result is a projection of
70
+ * them. The text then names what is not the compiler's, because "adds none of
71
+ * its own" was itself too strong: the memory layer derives `file` nodes,
72
+ * `contains` ownership and a member's `property` kind, a trace emits
73
+ * `dispatches` hops, and an artifact node arrives from a lint plugin's parser.
74
+ * A reader who checks the claim as now written finds it holds; a reader who
75
+ * checked the old ones found promises the code could not have kept.
45
76
  *
46
77
  * ## Two guarantees, not one
47
78
  *
48
79
  * A returned fact and the set it was chosen from are not audited to the same
49
80
  * standard, and one audit that conflated them was dishonest. Every operation
50
- * resolves each fact it returns — a name, a span, an edge, a signature — to the
51
- * type-checked program, so a returned fact cannot be wrong for the snapshot.
52
- * But `lookup`, `entrypoints`, and `tour` do not answer with the structure at a
53
- * handle you named; they match your natural-language question, score and rank
54
- * the graph against it, cap hits per file, and cut to a limit. Their `score`
55
- * and `truncated` fields say so, while the single old audit — "matched, ranked,
56
- * guessed, or inferred: none" — told the reader the opposite in the same
57
- * payload, and told it to stop where the shortlist's coverage was exactly what
58
- * needed judging.
81
+ * resolves each declaration fact it returns — a name, a span, an edge, a
82
+ * signature — to the type-checked program, so a returned compiler fact cannot
83
+ * be wrong for the snapshot. But `lookup`, `entrypoints`, and `tour` do not
84
+ * answer with the structure at a handle you named; they match your
85
+ * natural-language question, score and rank the graph against it, cap hits per
86
+ * file, and cut to a limit. Their `score` and `truncated` fields say so, while
87
+ * the single old audit — "matched, ranked, guessed, or inferred: none" — told
88
+ * the reader the opposite in the same payload, and told it to stop where the
89
+ * shortlist's coverage was exactly what needed judging.
59
90
  *
60
91
  * So the audits split by what the reader must judge. {@link RESULT_AUDIT} covers
61
92
  * the walks from an explicit handle or structure (`trace`, `overview`): the
@@ -79,10 +110,10 @@
79
110
  export const RESULT_AUDIT: string = `
80
111
  AUDITED BEFORE RETURNING. READ FIRST.
81
112
 
82
- Every fact in this \`result\` — each name, span, edge, signature, and step — was resolved by
83
- the TypeScript compiler against the program for the snapshot this call synced to, and the
84
- graph holds what it resolved. This \`result\` is a projection of exactly those facts and adds
85
- none of its own, so for this snapshot a fact here cannot disagree with the program.
113
+ Every declaration fact in this \`result\` — each name, span, edge, signature, and step — was
114
+ resolved by the TypeScript compiler against the program for the snapshot this call synced to,
115
+ and the graph holds what it resolved. This \`result\` is a projection of those facts.
116
+ ${NOT_COMPILER_RESOLVED}
86
117
 
87
118
  This is the structure the graph holds for the handles you named, not a shortlist matched
88
119
  against a natural-language question. Trust every fact it gives and re-verify none: a returned
@@ -102,11 +133,11 @@ after you edit the source.
102
133
  export const RESULT_AUDIT_SELECTION: string = `
103
134
  AUDITED BEFORE RETURNING. READ FIRST.
104
135
 
105
- Each fact in this \`result\` — every name, span, edge, and signature — was resolved by the
106
- TypeScript compiler against the program for the snapshot this call synced to, and the graph
107
- holds what it resolved. This \`result\` is a projection of exactly those facts and adds none of
108
- its own, so for this snapshot a fact here cannot disagree with the program: a returned span
109
- is the citation, not a cue to open the file to confirm it.
136
+ Each declaration fact in this \`result\` — every name, span, edge, and signature — was resolved
137
+ by the TypeScript compiler against the program for the snapshot this call synced to, and the
138
+ graph holds what it resolved. This \`result\` is a projection of those facts.
139
+ ${NOT_COMPILER_RESOLVED}
140
+ A returned span is the citation, not a cue to open the file to confirm it.
110
141
 
111
142
  What was selected is heuristic, not exhaustive. This result was matched against your
112
143
  natural-language question, scored and ranked, held to a few hits per file, and cut to a
@@ -137,10 +168,10 @@ Follow \`next\` for where that leaves the question.
137
168
  export const RESULT_AUDIT_DETAILS: string = `
138
169
  AUDITED BEFORE RETURNING. READ FIRST.
139
170
 
140
- Every fact in this \`result\` — each name, span, edge, signature, member, and value — was
141
- resolved by the TypeScript compiler against the program for the snapshot this call synced to,
142
- and the graph holds what it resolved. This \`result\` is a projection of exactly those facts
143
- and adds none of its own, so for this snapshot a fact here cannot disagree with the program.
171
+ Every declaration fact in this \`result\` — each name, span, edge, signature, member, and value —
172
+ was resolved by the TypeScript compiler against the program for the snapshot this call synced
173
+ to, and the graph holds what it resolved. This \`result\` is a projection of those facts.
174
+ ${NOT_COMPILER_RESOLVED}
144
175
 
145
176
  This is the structure the graph holds for the handles you named. What a symbol is — its
146
177
  members, its values, its signature — is complete: trust it and do not open the file to read
@@ -1,6 +1,17 @@
1
1
  import { ITtscGraphNext } from "../structures/ITtscGraphNext";
2
2
 
3
- /** A runner's result structure paired with the next-step calibration for it. */
3
+ /**
4
+ * A runner's result structure paired with the next-step calibration for it.
5
+ *
6
+ * @evidence contracts/common.md#principled-implementation The generic result remains its operation's typed shape while next and optional member truncation qualify how it may be used.
7
+ * @evidence contracts/common.md#clear-and-simple-design Shared control metadata wraps runner-specific facts without copying all result unions here.
8
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Member caps are explicit so audits cannot silently claim completeness after omission.
9
+ * @evidence contracts/common.md#meaningful-documentation Native member paragraphs explain next guidance and the capped-member audit consequence.
10
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources data shape only: it holds no handle, task or retained state.
11
+ * @evidenceExclude contracts/performance.md#efficient-algorithms data shape only: it contains no loop or algorithm.
12
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work data shape only: it computes nothing another request could share.
13
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation data shape only: it touches no file, path or process.
14
+ */
4
15
  export interface IRunnerOutput<T> {
5
16
  /** The graph result structure. */
6
17
  result: T;
@@ -15,6 +26,20 @@ export interface IRunnerOutput<T> {
15
26
  membersCapped?: boolean;
16
27
  }
17
28
 
29
+ /**
30
+ * Construct a next decision, omitting the request field when none is supplied.
31
+ *
32
+ * Callers own the justification for action and any inspect request.
33
+ *
34
+ * @evidence contracts/common.md#principled-implementation Typed action/request values retain the supported decision vocabulary and optional-field semantics.
35
+ * @evidence contracts/common.md#clear-and-simple-design One constructor centralizes omission of absent request metadata without owning runner policy.
36
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The helper does not infer question intent or add a forced follow-up operation.
37
+ * @evidence contracts/common.md#meaningful-documentation Native prose states caller policy ownership and conditional field omission.
38
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources returns a plain object and retains nothing.
39
+ * @evidenceExclude contracts/performance.md#efficient-algorithms builds one small object.
40
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work pure constructor, nothing to share.
41
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation builds a plain object; no file, path or process.
42
+ */
18
43
  export function resultNext(
19
44
  action: ITtscGraphNext["action"],
20
45
  reason: string,