@ttsc/graph 0.30.3 → 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
@@ -15,6 +15,15 @@ const node_path_1 = __importDefault(require("node:path"));
15
15
  * package binaries without executable bits. The ttsc launcher already repairs
16
16
  * its native helper before spawning; @ttsc/graph has its own ttscgraph spawn
17
17
  * paths, so it must apply the same first-run repair here.
18
+ *
19
+ * @evidence contracts/common.md#principled-implementation POSIX executable access is checked before preserving existing permission bits and adding the required execution permissions.
20
+ * @evidence contracts/common.md#clear-and-simple-design This helper owns the native permission boundary for all graph spawn lanes.
21
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Permission repair addresses supported package installation differences; failures still reach the original spawn path.
22
+ * @evidence contracts/common.md#meaningful-documentation Native paragraphs explain the package-manager condition and why graph must apply its own spawn-boundary repair.
23
+ * @evidence contracts/performance.md#efficient-algorithms Permission repair uses constant-count access/stat/chmod operations without reading binary contents or scanning directories.
24
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Permission is an effectful spawn precondition, not a completed producer result shared across requests.
25
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources This precondition retains no handle, task or historical entry after synchronous filesystem calls.
26
+ * @evidence contracts/portability.md#os-neutral-implementation Windows has no POSIX executable-bit requirement; other hosts use filesystem access and mode APIs rather than path spelling assumptions.
18
27
  */
19
28
  function ensureExecutable(binary) {
20
29
  if (process.platform === "win32")
@@ -45,12 +54,28 @@ function ensureExecutable(binary) {
45
54
  * the same answer everywhere. Reading the result back still materializes a
46
55
  * string, so V8's own maximum string length remains the outer bound — a
47
56
  * property of the runtime rather than a budget chosen here.
57
+ *
58
+ * @evidence contracts/common.md#principled-implementation Passing file descriptors avoids spawnSync's pipe-buffer limit while later UTF-8 reads preserve each output channel.
59
+ * @evidence contracts/common.md#clear-and-simple-design One factory transfers descriptor and directory ownership through a read/dispose handle; private helpers isolate cleanup.
60
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The capture uses supported spawn descriptors rather than patching child_process or imposing repository-sized output limits.
61
+ * @evidence contracts/common.md#meaningful-documentation Native paragraphs explain file capture, heap materialization and the runtime string-length boundary; the handle documents caller disposal.
62
+ * @evidence contracts/portability.md#os-neutral-implementation Native fs descriptors and path.join operate on every host; storage is created beneath the resolved physical system-temp directory.
63
+ * @evidence contracts/performance.md#efficient-algorithms Capturing writes directly to files; reading costs linear output bytes and materializes one stream string, with no pipe-buffer copy in this heap.
64
+ * @evidence contracts/performance.md#reuse-equivalent-work Stdout and stderr are distinct effectful streams from one child invocation; reruns require new storage and cannot reuse a prior result.
65
+ * @evidence contracts/performance.md#bound-retention-and-release-resources The returned owner disposes two descriptors and one directory; acquisition failure unwinds acquired storage and removal is best effort when foreign handles remain open.
48
66
  */
49
67
  function captureProcessOutput() {
50
68
  const directory = createCanonicalTempDirectory("ttscgraph-spawn-");
51
69
  const stdoutPath = node_path_1.default.join(directory, "stdout");
52
70
  const stderrPath = node_path_1.default.join(directory, "stderr");
53
- const stdoutFd = node_fs_1.default.openSync(stdoutPath, "w+");
71
+ let stdoutFd;
72
+ try {
73
+ stdoutFd = node_fs_1.default.openSync(stdoutPath, "w+");
74
+ }
75
+ catch (error) {
76
+ removeQuietly(directory);
77
+ throw error;
78
+ }
54
79
  let stderrFd;
55
80
  try {
56
81
  stderrFd = node_fs_1.default.openSync(stderrPath, "w+");
@@ -62,21 +87,19 @@ function captureProcessOutput() {
62
87
  removeQuietly(directory);
63
88
  throw error;
64
89
  }
90
+ let disposed = false;
65
91
  return {
66
92
  dispose() {
93
+ if (disposed)
94
+ return;
95
+ disposed = true;
67
96
  closeQuietly(stdoutFd);
68
97
  closeQuietly(stderrFd);
69
98
  removeQuietly(directory);
70
99
  },
71
100
  read(stream) {
72
101
  const location = stream === "stdout" ? stdoutPath : stderrPath;
73
- try {
74
- return node_fs_1.default.readFileSync(location, "utf8");
75
- }
76
- catch {
77
- // A spawn that never launched leaves nothing behind.
78
- return "";
79
- }
102
+ return node_fs_1.default.readFileSync(location, "utf8");
80
103
  },
81
104
  stderrFd,
82
105
  stdoutFd,
@@ -85,18 +108,55 @@ function captureProcessOutput() {
85
108
  /** Create capture storage beneath the frozen physical system-temp parent. */
86
109
  function createCanonicalTempDirectory(prefix) {
87
110
  const physicalParent = node_fs_1.default.realpathSync.native(node_os_1.default.tmpdir());
88
- if (!node_fs_1.default.lstatSync(physicalParent).isDirectory()) {
111
+ const parentIdentity = node_fs_1.default.lstatSync(physicalParent);
112
+ if (!parentIdentity.isDirectory()) {
89
113
  throw new Error(`@ttsc/graph: temporary directory parent is not a directory: ${physicalParent}`);
90
114
  }
91
115
  const directory = node_fs_1.default.mkdtempSync(node_path_1.default.join(physicalParent, prefix));
92
- if (!node_fs_1.default.lstatSync(directory).isDirectory()) {
93
- throw new Error(`@ttsc/graph: temporary directory postflight is not a directory: ${directory}`);
116
+ let childIdentity;
117
+ try {
118
+ childIdentity = node_fs_1.default.lstatSync(directory);
119
+ if (!childIdentity.isDirectory() || childIdentity.isSymbolicLink()) {
120
+ throw new Error(`@ttsc/graph: temporary directory postflight is not a directory: ${directory}`);
121
+ }
122
+ const physicalDirectory = node_fs_1.default.realpathSync.native(directory);
123
+ if (node_path_1.default.dirname(physicalDirectory) !== physicalParent) {
124
+ throw new Error(`@ttsc/graph: temporary directory escaped its physical parent: ${physicalDirectory}`);
125
+ }
126
+ return physicalDirectory;
127
+ }
128
+ catch (error) {
129
+ removeUnchangedTempDirectory(directory, physicalParent, prefix, parentIdentity, childIdentity);
130
+ throw error;
131
+ }
132
+ }
133
+ /** Roll back only an unchanged direct child whose native ownership was seen. */
134
+ function removeUnchangedTempDirectory(directory, parent, prefix, parentIdentity, childIdentity) {
135
+ if (childIdentity === undefined ||
136
+ !childIdentity.isDirectory() ||
137
+ childIdentity.isSymbolicLink() ||
138
+ node_path_1.default.dirname(directory) !== parent ||
139
+ !node_path_1.default.basename(directory).startsWith(prefix))
140
+ return;
141
+ try {
142
+ const currentParent = node_fs_1.default.lstatSync(parent);
143
+ const currentChild = node_fs_1.default.lstatSync(directory);
144
+ if (node_fs_1.default.realpathSync.native(parent) !== parent ||
145
+ !currentParent.isDirectory() ||
146
+ currentParent.isSymbolicLink() ||
147
+ currentParent.dev !== parentIdentity.dev ||
148
+ currentParent.ino !== parentIdentity.ino ||
149
+ !currentChild.isDirectory() ||
150
+ currentChild.isSymbolicLink() ||
151
+ currentChild.dev !== childIdentity.dev ||
152
+ currentChild.ino !== childIdentity.ino)
153
+ return;
154
+ removeQuietly(directory);
94
155
  }
95
- const physicalDirectory = node_fs_1.default.realpathSync.native(directory);
96
- if (node_path_1.default.dirname(physicalDirectory) !== physicalParent) {
97
- throw new Error(`@ttsc/graph: temporary directory escaped its physical parent: ${physicalDirectory}`);
156
+ catch {
157
+ // Failed ownership checks leave storage untouched rather than delete a
158
+ // replacement or an unrelated canonical target.
98
159
  }
99
- return physicalDirectory;
100
160
  }
101
161
  /** Close a descriptor, ignoring one that is already closed. */
102
162
  function closeQuietly(fd) {
@@ -1 +1 @@
1
- {"version":3,"file":"nativeExecutable.js","sourceRoot":"","sources":["../src/nativeExecutable.ts"],"names":[],"mappings":";;;;;;;AAAA,sDAAyB;AACzB,sDAAyB;AACzB,0DAA6B;AAE7B;;;;;;;GAOG;AACH,0BAAiC,MAAc;IAC7C,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;QAAE,OAAO;IACzC,IAAI,CAAC;QACH,iBAAE,CAAC,UAAU,CAAC,MAAM,EAAE,iBAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACzC,OAAO;IACT,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,iBAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC;YAC9C,iBAAE,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,GAAG,KAAK,CAAC,CAAC;QACrC,CAAC;QAAC,MAAM,CAAC;YACP,wCAAwC;QAC1C,CAAC;IACH,CAAC;AACH,CAAC;AAWD;;;;;;;;;;;;GAYG;AACH;IACE,MAAM,SAAS,GAAG,4BAA4B,CAAC,kBAAkB,CAAC,CAAC;IACnE,MAAM,UAAU,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QA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C,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,uEAAuE;QACvE,gDAAgD;IAClD,CAAC;AACH,CAAC;AAED,+DAA+D;AAC/D,SAAS,YAAY,CAAC,EAAU;IAC9B,IAAI,CAAC;QACH,iBAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC;IAAC,MAAM,CAAC;QACP,qEAAqE;IACvE,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAS,aAAa,CAAC,SAAiB;IACtC,IAAI,CAAC;QACH,iBAAE,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;IAAC,MAAM,CAAC;QACP,eAAe;IACjB,CAAC;AACH,CAAC"}
package/lib/reduce.d.ts CHANGED
@@ -1,48 +1,22 @@
1
- export interface RawNode {
2
- id: string;
3
- name: string;
4
- kind: string;
5
- file: string;
6
- external?: boolean;
7
- ignored?: boolean;
8
- }
9
- export interface RawEdge {
10
- from: string;
11
- to: string;
12
- kind: string;
13
- }
14
- export interface RawDump {
15
- project?: string;
16
- nodes: RawNode[];
17
- edges: RawEdge[];
18
- }
19
- export interface ViewerNode {
20
- id: string;
21
- name: string;
22
- kind: string;
23
- file: string;
24
- degree: number;
25
- }
26
- export interface ViewerLink {
27
- source: string;
28
- target: string;
29
- kind: string;
30
- }
31
- export interface ViewerPayload {
32
- project: string;
33
- counts: {
34
- rawNodes: number;
35
- rawEdges: number;
36
- nodes: number;
37
- links: number;
38
- droppedExternal: number;
39
- droppedIgnored: number;
40
- droppedByCap: number;
41
- };
42
- nodes: ViewerNode[];
43
- links: ViewerLink[];
44
- }
45
- export declare function reduce(raw: RawDump, { maxNodes, keepExternal, keepIgnored }?: {
1
+ import type { RawDump } from "./structures/RawDump";
2
+ import type { ViewerPayload } from "./structures/ViewerPayload";
3
+ /**
4
+ * Project a dump into a connected viewer graph, retaining high-degree nodes.
5
+ *
6
+ * Current portable coordinates retain their spelling. Legacy absolute paths are
7
+ * rerooted together, and node ids and edge endpoints use the same rewrite.
8
+ * Boundary and cap counters explain selection; isolated nodes are not drawn.
9
+ *
10
+ * @evidence contracts/common.md#principled-implementation Boundary selection precedes induced-edge filtering and degree ranking; final edge membership and matching identity rewrites preserve the displayed subgraph.
11
+ * @evidence contracts/common.md#clear-and-simple-design Pure projection separates path/identity codec, degree calculation and display-family mapping through private helpers.
12
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Paths outside the common root keep identity rather than collapse to basename; filters use producer flags and general kinds without fixture lists.
13
+ * @evidence contracts/common.md#meaningful-documentation Native prose explains legacy/current coordinates and selection losses; DTO members document identity, degree and each counter.
14
+ * @evidence contracts/performance.md#efficient-algorithms Node/edge scans and degree maps cost O(N+E); degree selection sorts at most N nodes, adding O(N log N), with temporary maps/arrays proportional to the input.
15
+ * @evidence contracts/performance.md#reuse-equivalent-work Within one projection, indexed live/kept id sets and degree maps serve multiple filters; callers share the resulting payload across render requests rather than repeat reduction.
16
+ * @evidence contracts/performance.md#bound-retention-and-release-resources Temporary arrays and indexes become unreachable after return; the caller owns only selected DTO arrays and counts, with selected populations bounded by maxNodes and induced edges.
17
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation rewrites path strings as text (separators and common root); it never opens, stats or resolves them.
18
+ */
19
+ export declare function reduce(raw: RawDump, { maxNodes, keepExternal, keepIgnored, }?: {
46
20
  maxNodes?: number;
47
21
  keepExternal?: boolean;
48
22
  keepIgnored?: boolean;
package/lib/reduce.js CHANGED
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reduce = reduce;
2
4
  // Reduce a raw `ttscgraph dump` to the payload the bundled 3D viewer renders.
3
5
  // The same pure transform is copied in
4
6
  // website/src/components/graph/TtscWebsiteGraphReduce.ts and
@@ -8,8 +10,6 @@
8
10
  // by tests/test-graph rather than by this comment. The CLI reduces in Node
9
11
  // before serving, so the browser viewer only ever renders a ready
10
12
  // `{ nodes, links }`.
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.reduce = reduce;
13
13
  function posix(p) {
14
14
  return p.replace(/\\/g, "/");
15
15
  }
@@ -162,8 +162,24 @@ const DISPLAY_KIND = {
162
162
  exports: "exports",
163
163
  };
164
164
  function displayKind(kind) {
165
- return DISPLAY_KIND[kind] ?? kind;
165
+ return Object.hasOwn(DISPLAY_KIND, kind) ? DISPLAY_KIND[kind] : kind;
166
166
  }
167
+ /**
168
+ * Project a dump into a connected viewer graph, retaining high-degree nodes.
169
+ *
170
+ * Current portable coordinates retain their spelling. Legacy absolute paths are
171
+ * rerooted together, and node ids and edge endpoints use the same rewrite.
172
+ * Boundary and cap counters explain selection; isolated nodes are not drawn.
173
+ *
174
+ * @evidence contracts/common.md#principled-implementation Boundary selection precedes induced-edge filtering and degree ranking; final edge membership and matching identity rewrites preserve the displayed subgraph.
175
+ * @evidence contracts/common.md#clear-and-simple-design Pure projection separates path/identity codec, degree calculation and display-family mapping through private helpers.
176
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Paths outside the common root keep identity rather than collapse to basename; filters use producer flags and general kinds without fixture lists.
177
+ * @evidence contracts/common.md#meaningful-documentation Native prose explains legacy/current coordinates and selection losses; DTO members document identity, degree and each counter.
178
+ * @evidence contracts/performance.md#efficient-algorithms Node/edge scans and degree maps cost O(N+E); degree selection sorts at most N nodes, adding O(N log N), with temporary maps/arrays proportional to the input.
179
+ * @evidence contracts/performance.md#reuse-equivalent-work Within one projection, indexed live/kept id sets and degree maps serve multiple filters; callers share the resulting payload across render requests rather than repeat reduction.
180
+ * @evidence contracts/performance.md#bound-retention-and-release-resources Temporary arrays and indexes become unreachable after return; the caller owns only selected DTO arrays and counts, with selected populations bounded by maxNodes and induced edges.
181
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation rewrites path strings as text (separators and common root); it never opens, stats or resolves them.
182
+ */
167
183
  function reduce(raw, { maxNodes = 1200, keepExternal = false, keepIgnored = false, } = {}) {
168
184
  // Drop external boundary leaves and git-ignored generated code (a Prisma
169
185
  // client and the like, tagged `ignored` by the dump) so the authored graph is
package/lib/reduce.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"reduce.js","sourceRoot":"","sources":["../src/reduce.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,uCAAuC;AACvC,6DAA6D;AAC7D,6EAA6E;AAC7E,+EAA+E;AAC/E,+EAA+E;AAC/E,2EAA2E;AAC3E,kEAAkE;AAClE,sBAAsB;;;AAoDtB,SAAS,KAAK,CAAC,CAAS;IACtB,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC/B,CAAC;AAED,iFAAiF;AACjF,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,WAAW,CAAC,IAAY;IAC/B,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC1C,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IACzB,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,UAAU,CAAC,WAAqB;IACvC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACxC,IAAI,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9C,KAAK,MAAM,SAAS,IAAI,WAAW,CAAC,KAAK,CAAC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,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC;QAC/B,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC;QAC7B,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;KAC1B,CAAC,CAAC;SACF,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAEjE,OAAO;QACL,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE;QAC1B,MAAM,EAAE;YACN,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM;YAC1B,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM;YAC1B,KAAK,EAAE,KAAK,CAAC,MAAM;YACnB,KAAK,EAAE,KAAK,CAAC,MAAM;YACnB,0EAA0E;YAC1E,wEAAwE;YACxE,yDAAyD;YACzD,eAAe,EAAE,YAAY;gBAC3B,CAAC,CAAC,CAAC;gBACH,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM;YAC9C,cAAc,EAAE,WAAW;gBACzB,CAAC,CAAC,CAAC;gBACH,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM;YAC5D,YAAY;SACb;QACD,KAAK;QACL,KAAK;KACN,CAAC;AACJ,CAAC"}
@@ -22,5 +22,14 @@
22
22
  * or an API `cwd` option), defaulting to `process.cwd()` when no project was
23
23
  * named. A launcher started from an unrelated directory still resolves the
24
24
  * `ttsc` installed under the target project it was asked to graph.
25
+ *
26
+ * @evidence contracts/common.md#principled-implementation Project-anchored module resolution locates the peer ttsc and then its platform binary; an explicit absolute override has precedence.
27
+ * @evidence contracts/common.md#clear-and-simple-design One resolver owns override and peer-package lookup for all graph launchers.
28
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Resolution uses installed package contracts rather than guessing binary paths from repository layouts.
29
+ * @evidence contracts/common.md#meaningful-documentation Native paragraphs and the ordered list explain peer placement, override precedence and target-project anchoring.
30
+ * @evidence contracts/portability.md#os-neutral-implementation Native path checks and module resolution select the platform/architecture package; only Windows's required executable suffix differs explicitly.
31
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources returns a path string and opens no handle.
32
+ * @evidenceExclude contracts/performance.md#efficient-algorithms performs a constant number of module resolutions (ttsc, then its platform package).
33
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work resolves on every call and caches nothing, so a reinstall between calls is honored.
25
34
  */
26
35
  export declare function resolveGraphBinary(env?: NodeJS.ProcessEnv, cwd?: string): string | null;
@@ -30,6 +30,15 @@ const node_path_1 = __importDefault(require("node:path"));
30
30
  * or an API `cwd` option), defaulting to `process.cwd()` when no project was
31
31
  * named. A launcher started from an unrelated directory still resolves the
32
32
  * `ttsc` installed under the target project it was asked to graph.
33
+ *
34
+ * @evidence contracts/common.md#principled-implementation Project-anchored module resolution locates the peer ttsc and then its platform binary; an explicit absolute override has precedence.
35
+ * @evidence contracts/common.md#clear-and-simple-design One resolver owns override and peer-package lookup for all graph launchers.
36
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Resolution uses installed package contracts rather than guessing binary paths from repository layouts.
37
+ * @evidence contracts/common.md#meaningful-documentation Native paragraphs and the ordered list explain peer placement, override precedence and target-project anchoring.
38
+ * @evidence contracts/portability.md#os-neutral-implementation Native path checks and module resolution select the platform/architecture package; only Windows's required executable suffix differs explicitly.
39
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources returns a path string and opens no handle.
40
+ * @evidenceExclude contracts/performance.md#efficient-algorithms performs a constant number of module resolutions (ttsc, then its platform package).
41
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work resolves on every call and caches nothing, so a reinstall between calls is honored.
33
42
  */
34
43
  function resolveGraphBinary(env = process.env, cwd = process.cwd()) {
35
44
  if (env.TTSC_GRAPH_BINARY && node_path_1.default.isAbsolute(env.TTSC_GRAPH_BINARY)) {
@@ -39,9 +48,8 @@ function resolveGraphBinary(env = process.env, cwd = process.cwd()) {
39
48
  try {
40
49
  // Anchor package lookup at the absolute project root so a relative `--cwd`
41
50
  // resolves the same way the native process interprets it.
42
- const ttscPackageJson = require.resolve("ttsc/package.json", {
43
- paths: [node_path_1.default.resolve(cwd)],
44
- });
51
+ const fromProject = (0, node_module_1.createRequire)(node_path_1.default.join(node_path_1.default.resolve(cwd), "package.json"));
52
+ const ttscPackageJson = fromProject.resolve("ttsc/package.json");
45
53
  const fromTtsc = (0, node_module_1.createRequire)(ttscPackageJson);
46
54
  return fromTtsc.resolve(`@ttsc/${process.platform}-${process.arch}/bin/${exe}`);
47
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"resolveGraphBinary.js","sourceRoot":"","sources":["../src/resolveGraphBinary.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA4C;AAC5C,0DAA6B;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,4BACE,GAAG,GAAsB,OAAO,CAAC,GAAG,EACpC,GAAG,GAAW,OAAO,CAAC,GAAG,EAAE;IAE3B,IAAI,GAAG,CAAC,iBAAiB,IAAI,mBAAI,CAAC,UAAU,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACpE,OAAO,GAAG,CAAC,iBAAiB,CAAC;IAC/B,CAAC;IACD,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW,CAAC;IACzE,IAAI,CAAC;QACH,2EAA2E;QAC3E,0DAA0D;QAC1D,MAAM,eAAe,GAAG,OAA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CAAC,OAAO,CACrB,SAAS,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,QAAQ,GAAG,EAAE,CACvD,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Run the `@ttsc/graph` launcher.
3
+ *
4
+ * - `view`: JS-orchestrated 3D viewer (dump -> reduce -> serve -> open).
5
+ * - `dump`: pass through to the native `ttscgraph dump`, which prints the whole
6
+ * graph as JSON for piping or the viewer.
7
+ * - Default: serve the MCP graph over stdio. The TypeScript server keeps a native
8
+ * incremental compiler session resident, checks the disk snapshot before each
9
+ * graph operation, and reuses the in-memory graph when unchanged; the agent's
10
+ * MCP client speaks JSON-RPC over this process's stdin/stdout.
11
+ *
12
+ * @evidence contracts/common.md#principled-implementation The first command token selects view, native dump or stdio MCP; shared project parsing supplies the producer coordinates consistently.
13
+ * @evidence contracts/common.md#clear-and-simple-design The launcher owns lane dispatch while viewer, server and native dump helpers own their respective execution boundaries.
14
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts A missing dump binary exposes only an explicitly qualified help summary; execution failures retain nonzero outcomes instead of fake graph answers.
15
+ * @evidence contracts/common.md#meaningful-documentation Native lane bullets explain observable CLI behavior and resident refresh ownership with a blank line before tags.
16
+ * @evidence contracts/portability.md#os-neutral-implementation Native lanes resolve the selected project's platform package and pass argv directly; stdio MCP uses Node transport APIs without shell path construction.
17
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources starts the stdio server (owned by startServer), runs a synchronous dump child to completion or hands over to runView, and keeps no handle itself.
18
+ * @evidenceExclude contracts/performance.md#efficient-algorithms dispatches on the first argv token to one lane and the lanes own the work.
19
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work runs one launcher lane per process invocation, so there is nothing to share.
20
+ */
21
+ export declare function runGraph(argv?: readonly string[]): number | void;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runGraph = runGraph;
4
+ const TtscGraphLauncherArguments_1 = require("./TtscGraphLauncherArguments");
5
+ const GraphProcessTrace_1 = require("./internal/GraphProcessTrace");
6
+ const publishedArtifacts_1 = require("./model/publishedArtifacts");
7
+ const nativeExecutable_1 = require("./nativeExecutable");
8
+ const resolveGraphBinary_1 = require("./resolveGraphBinary");
9
+ const startServer_1 = require("./server/startServer");
10
+ const view_1 = require("./view");
11
+ // The server version reported in the MCP handshake; read from this package.
12
+ const VERSION = require("../package.json")
13
+ .version;
14
+ /**
15
+ * Run the `@ttsc/graph` launcher.
16
+ *
17
+ * - `view`: JS-orchestrated 3D viewer (dump -> reduce -> serve -> open).
18
+ * - `dump`: pass through to the native `ttscgraph dump`, which prints the whole
19
+ * graph as JSON for piping or the viewer.
20
+ * - Default: serve the MCP graph over stdio. The TypeScript server keeps a native
21
+ * incremental compiler session resident, checks the disk snapshot before each
22
+ * graph operation, and reuses the in-memory graph when unchanged; the agent's
23
+ * MCP client speaks JSON-RPC over this process's stdin/stdout.
24
+ *
25
+ * @evidence contracts/common.md#principled-implementation The first command token selects view, native dump or stdio MCP; shared project parsing supplies the producer coordinates consistently.
26
+ * @evidence contracts/common.md#clear-and-simple-design The launcher owns lane dispatch while viewer, server and native dump helpers own their respective execution boundaries.
27
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts A missing dump binary exposes only an explicitly qualified help summary; execution failures retain nonzero outcomes instead of fake graph answers.
28
+ * @evidence contracts/common.md#meaningful-documentation Native lane bullets explain observable CLI behavior and resident refresh ownership with a blank line before tags.
29
+ * @evidence contracts/portability.md#os-neutral-implementation Native lanes resolve the selected project's platform package and pass argv directly; stdio MCP uses Node transport APIs without shell path construction.
30
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources starts the stdio server (owned by startServer), runs a synchronous dump child to completion or hands over to runView, and keeps no handle itself.
31
+ * @evidenceExclude contracts/performance.md#efficient-algorithms dispatches on the first argv token to one lane and the lanes own the work.
32
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work runs one launcher lane per process invocation, so there is nothing to share.
33
+ */
34
+ function runGraph(argv = process.argv.slice(2)) {
35
+ if (argv[0] === "view")
36
+ return (0, view_1.runView)(argv.slice(1));
37
+ if (argv[0] === "dump")
38
+ return runDump(argv.slice(1));
39
+ const { cwd, tsconfig } = TtscGraphLauncherArguments_1.TtscGraphLauncherArguments.project(argv);
40
+ void (0, startServer_1.startServer)({ cwd, tsconfig, version: VERSION }).catch((error) => {
41
+ process.stderr.write(`@ttsc/graph: ${error instanceof Error ? error.message : String(error)}\n`);
42
+ process.exit(1);
43
+ });
44
+ }
45
+ /**
46
+ * Pass `dump` through to the native binary, inheriting stdio so the JSON lands
47
+ * on this process's stdout. Returns the child's exit code.
48
+ */
49
+ function runDump(argv) {
50
+ // Resolve the native binary from the target project the caller named with
51
+ // `--cwd`, not from wherever the launcher process happened to start.
52
+ const { cwd, tsconfig, artifactsSpecified } = TtscGraphLauncherArguments_1.TtscGraphLauncherArguments.dump(argv);
53
+ const binary = (0, resolveGraphBinary_1.resolveGraphBinary)(process.env, cwd);
54
+ if (binary === null) {
55
+ // `ttscgraph` owns the flag contract, so a resolvable binary always answers
56
+ // `--help` itself and stays the single source of truth. It cannot answer
57
+ // when it is absent, and that is exactly when a caller is most likely to be
58
+ // asking what the command needs — so fall back to a summary that names the
59
+ // authority rather than making usage unreachable behind an install error.
60
+ const fallback = TtscGraphLauncherArguments_1.TtscGraphLauncherArguments.missingDump(argv);
61
+ if (fallback.stdout !== undefined)
62
+ process.stdout.write(fallback.stdout);
63
+ if (fallback.stderr !== undefined)
64
+ process.stderr.write(fallback.stderr);
65
+ return fallback.code;
66
+ }
67
+ (0, nativeExecutable_1.ensureExecutable)(binary);
68
+ // The same artifacts `loadGraph` and the resident session ask for, so the
69
+ // three ways to reach a dump answer a citation the same way. A caller that
70
+ // named `--artifacts` itself owns the answer and is not overridden.
71
+ const published = artifactsSpecified
72
+ ? null
73
+ : (0, publishedArtifacts_1.publishArtifacts)({ cwd, tsconfig });
74
+ const result = GraphProcessTrace_1.GraphProcessTrace.spawnSync(binary, TtscGraphLauncherArguments_1.TtscGraphLauncherArguments.dumpVector(argv, published?.file ?? null), {
75
+ stdio: "inherit",
76
+ windowsHide: true,
77
+ });
78
+ const completion = TtscGraphLauncherArguments_1.TtscGraphLauncherArguments.dumpCompletion(result);
79
+ if (completion.diagnostic !== undefined)
80
+ process.stderr.write(completion.diagnostic);
81
+ return completion.code;
82
+ }
83
+ //# sourceMappingURL=runGraph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runGraph.js","sourceRoot":"","sources":["../src/runGraph.ts"],"names":[],"mappings":";;;AAAA,6EAA0E;AAC1E,oEAAiE;AACjE,mEAA8D;AAC9D,yDAAsD;AACtD,6DAA0D;AAC1D,sDAAmD;AACnD,iCAAiC;AAEjC,4EAA4E;AAC5E,MAAM,OAAO,GAAY,OAAO,CAAC,iBAAiB,CAAyB;KACxE,OAAO,CAAC;AAEX;;;;;;;;;;;;;;;;;;;GAmBG;AACH,kBACE,IAAI,GAAsB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAE/C,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,MAAM;QAAE,OAAO,IAAA,cAAO,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,MAAM;QAAE,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtD,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,uDAA0B,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,KAAK,IAAA,yBAAW,EAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,CACzD,CAAC,KAAc,EAAE,EAAE;QACjB,OAA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AAiB,CAAC,SAAS,CACxC,MAAM,EACN,uDAA0B,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,IAAI,IAAI,CAAC,EACpE;QACE,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,IAAI;KAClB,CACF,CAAC;IACF,MAAM,UAAU,GAAG,uDAA0B,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACrE,IAAI,UAAU,CAAC,UAAU,KAAK,SAAS;QACrC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAC9C,OAAO,UAAU,CAAC,IAAI,CAAC;AACzB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { TtscGraphReadonly } from "../model/TtscGraphReadonly";
2
+ import { ITtscGraphNode as NodeShape } from "../structures/ITtscGraphNode";
3
+ type ITtscGraphNode = TtscGraphReadonly<NodeShape>;
4
+ /**
5
+ * Exact resolved node, ambiguous candidates or an empty unknown outcome.
6
+ *
7
+ * @evidence contracts/common.md#principled-implementation Optional node and candidates preserve the resolver's unique, ambiguous and absent states without fabricating identity.
8
+ * @evidence contracts/common.md#clear-and-simple-design One compact outcome is shared by direct-id, name and file-qualified resolution paths.
9
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Ranked candidates remain unresolved choices rather than a guessed definitive node.
10
+ * @evidence contracts/common.md#meaningful-documentation Native member comments distinguish uniquely resolved identity from ranked ambiguity.
11
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources data shape only: it holds no handle, task or retained state.
12
+ * @evidenceExclude contracts/performance.md#efficient-algorithms data shape only: it contains no loop or algorithm.
13
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work data shape only: it computes nothing another request could share.
14
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation data shape only: it touches no file, path or process.
15
+ */
16
+ export interface IResolvedGraphHandle {
17
+ /** Present when the handle identifies exactly one node. */
18
+ node?: ITtscGraphNode;
19
+ /** Ranked remaining choices when more than one identity matches. */
20
+ candidates?: ITtscGraphNode[];
21
+ }
22
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IResolvedGraphHandle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IResolvedGraphHandle.js","sourceRoot":"","sources":["../../src/server/IResolvedGraphHandle.ts"],"names":[],"mappings":""}
@@ -7,16 +7,20 @@ import { TtscGraphSource } from "../TtscGraphApplication";
7
7
  * input and output schemas and its argument validator, with no hand-written
8
8
  * schema: the interface's JSDoc becomes the handshake instructions, the
9
9
  * method's becomes the tool description, and every property's becomes the
10
- * description of that field — including `audit`, whose JSDoc is how a caller
11
- * learns what the server checked before it answered.
10
+ * description of that field — including `audit`, whose JSDoc explains fact
11
+ * provenance and coverage without claiming a second compiler check.
12
12
  *
13
- * The registration was hand-written here for a while, because a tool that
14
- * declares an output schema must answer with `structuredContent` and the helper
15
- * also serialized the same JSON into a text block: the payload crossed the wire
16
- * twice, a client counted both copies against its tool-result cap, and a 30 KB
17
- * tour arrived as 60 KB, blew the cap, and was spilled to a file the model then
18
- * shelled out to read back. `@typia/mcp` 13.1.0 ships the structured result
19
- * once (samchon/typia#2020), so the hand-written server had nothing left to fix
20
- * and the library owns the registration again.
13
+ * The library owns registration and sends structured results once by default.
14
+ * Its version option identifies this graph server in the handshake without
15
+ * changing SDK internals after construction.
16
+ *
17
+ * @evidence contracts/common.md#principled-implementation The typed controller supplies reflected schemas and executor dispatch; the supported version option sets the MCP implementation identity at construction.
18
+ * @evidence contracts/common.md#clear-and-simple-design The integration delegates registration and result serialization to the library instead of maintaining another transport implementation.
19
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Handshake version uses the public createMcpServer option; no SDK private field or foreign method is patched.
20
+ * @evidence contracts/common.md#meaningful-documentation Native paragraphs explain schema/JSDoc reflection, structured-result ownership and public version configuration.
21
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources returns a server whose transport lifetime startServer owns.
22
+ * @evidenceExclude contracts/performance.md#efficient-algorithms builds the MCP server once from the typia controller, with no loop of its own.
23
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work called once per process; the schema reflection happens at compile time.
24
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation creates an in-memory MCP server object; startServer attaches the stdio transport.
21
25
  */
22
26
  export declare function createServer(graph: TtscGraphSource, version: string): McpServer;