ttsc 0.31.6 → 0.32.1

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 (261) hide show
  1. package/cmd/ttsc/compiler_argument_cwd_test.go +38 -38
  2. package/cmd/ttscserver/main.go +2 -12
  3. package/cmd/ttscserver/resolve_launch_uses_native_flag_authority_test.go +7 -7
  4. package/driver/lsp.go +4 -43
  5. package/driver/rewrite.go +1 -1
  6. package/internal/e2etrace/completion_hints.go +3 -3
  7. package/internal/e2etrace/completion_hints_test.go +26 -12
  8. package/internal/graph/build.go +5 -6
  9. package/internal/graph/graph.go +3 -3
  10. package/internal/graph/line_model.go +2 -35
  11. package/internal/lspserver/lsp_clean_didopen_refreshes_compiler_state_test.go +13 -36
  12. package/internal/lspserver/lsp_hints_refresh_ignores_a_superseded_generation_test.go +9 -3
  13. package/internal/lspserver/lsp_plugin.go +19 -0
  14. package/internal/lspserver/lsp_proxy.go +9 -129
  15. package/internal/lspserver/lsp_server.go +0 -8
  16. package/internal/lspserver/lsp_watched_file_changes_reach_compiler_caches_test.go +6 -36
  17. package/internal/sourceprocess/windows_target_owns_suspended_admission_test.go +5 -5
  18. package/lib/TtscCompiler.js +1 -1
  19. package/lib/TtscCompiler.js.map +1 -1
  20. package/lib/compiler/internal/ResidentCheckProcess.d.ts +74 -96
  21. package/lib/compiler/internal/ResidentCheckProcess.js +150 -335
  22. package/lib/compiler/internal/ResidentCheckProcess.js.map +1 -1
  23. package/lib/compiler/internal/ResidentCheckProcessHost.d.ts +127 -0
  24. package/lib/compiler/internal/ResidentCheckProcessHost.js +447 -0
  25. package/lib/compiler/internal/ResidentCheckProcessHost.js.map +1 -0
  26. package/lib/compiler/internal/ResidentCheckProcessProtocol.d.ts +64 -0
  27. package/lib/compiler/internal/ResidentCheckProcessProtocol.js +3 -0
  28. package/lib/compiler/internal/ResidentCheckProcessProtocol.js.map +1 -0
  29. package/lib/compiler/internal/build/BuildExecution.d.ts +103 -1
  30. package/lib/compiler/internal/build/BuildExecution.js +92 -12
  31. package/lib/compiler/internal/build/BuildExecution.js.map +1 -1
  32. package/lib/compiler/internal/build/ResidentCheckWatchSession.d.ts +16 -11
  33. package/lib/compiler/internal/build/ResidentCheckWatchSession.js +37 -21
  34. package/lib/compiler/internal/build/ResidentCheckWatchSession.js.map +1 -1
  35. package/lib/compiler/internal/build/RunBuildOptions.d.ts +6 -5
  36. package/lib/compiler/internal/build/TsgoArguments.js.map +1 -1
  37. package/lib/compiler/internal/build/WatchInputPublication.d.ts +59 -0
  38. package/lib/compiler/internal/build/WatchInputPublication.js +93 -0
  39. package/lib/compiler/internal/build/WatchInputPublication.js.map +1 -0
  40. package/lib/compiler/internal/build/runBuild.d.ts +29 -2
  41. package/lib/compiler/internal/build/runBuild.js +45 -19
  42. package/lib/compiler/internal/build/runBuild.js.map +1 -1
  43. package/lib/compiler/internal/buildNativeCompiler.d.ts +2 -0
  44. package/lib/compiler/internal/buildNativeCompiler.js +1 -0
  45. package/lib/compiler/internal/buildNativeCompiler.js.map +1 -1
  46. package/lib/compiler/internal/compileProjectInMemory.js +4 -2
  47. package/lib/compiler/internal/compileProjectInMemory.js.map +1 -1
  48. package/lib/compiler/internal/project/CompilerProjectSelection.d.ts +9 -8
  49. package/lib/compiler/internal/project/CompilerProjectSelection.js +11 -9
  50. package/lib/compiler/internal/project/CompilerProjectSelection.js.map +1 -1
  51. package/lib/compiler/internal/project/resolveOwningProjectConfig.d.ts +25 -8
  52. package/lib/compiler/internal/project/resolveOwningProjectConfig.js +26 -14
  53. package/lib/compiler/internal/project/resolveOwningProjectConfig.js.map +1 -1
  54. package/lib/compiler/internal/readEffectiveCompilerOptions.js +1 -1
  55. package/lib/compiler/internal/readEffectiveCompilerOptions.js.map +1 -1
  56. package/lib/compiler/internal/resolveBinary.d.ts +1 -0
  57. package/lib/compiler/internal/resolveBinary.js.map +1 -1
  58. package/lib/compiler/internal/resolveTsgo.d.ts +6 -0
  59. package/lib/compiler/internal/resolveTsgo.js.map +1 -1
  60. package/lib/compiler/internal/runSingleFileEmit.d.ts +32 -4
  61. package/lib/compiler/internal/runSingleFileEmit.js +124 -89
  62. package/lib/compiler/internal/runSingleFileEmit.js.map +1 -1
  63. package/lib/compiler/internal/startResidentTransform.js +8 -2
  64. package/lib/compiler/internal/startResidentTransform.js.map +1 -1
  65. package/lib/compiler/internal/transformProjectInMemory.js +11 -3
  66. package/lib/compiler/internal/transformProjectInMemory.js.map +1 -1
  67. package/lib/compiler/internal/transformProjectInWorker.d.ts +1 -1
  68. package/lib/compiler/internal/transformProjectInWorker.js +3 -2
  69. package/lib/compiler/internal/transformProjectInWorker.js.map +1 -1
  70. package/lib/flags/ParseOptions.d.ts +2 -2
  71. package/lib/internal/E2ETrace.js.map +1 -1
  72. package/lib/internal/OwnedNativeProcess.d.ts +2 -2
  73. package/lib/internal/OwnedNativeProcess.js +2 -2
  74. package/lib/internal/SourceNativeRetirement.d.ts +8 -7
  75. package/lib/internal/SourceNativeRetirement.js +19 -10
  76. package/lib/internal/SourceNativeRetirement.js.map +1 -1
  77. package/lib/internal/TtsxNodeOptions.d.ts +79 -0
  78. package/lib/internal/TtsxNodeOptions.js +121 -0
  79. package/lib/internal/TtsxNodeOptions.js.map +1 -0
  80. package/lib/internal/javascriptRuntimeCapabilities.js +4 -1
  81. package/lib/internal/javascriptRuntimeCapabilities.js.map +1 -1
  82. package/lib/internal/parseWindowsDirectoryCaseSensitivity.d.ts +5 -5
  83. package/lib/internal/parseWindowsDirectoryCaseSensitivity.js +5 -5
  84. package/lib/internal/pathIdentity/createCaseSensitivityObservations.d.ts +35 -0
  85. package/lib/internal/pathIdentity/createCaseSensitivityObservations.js +209 -0
  86. package/lib/internal/pathIdentity/createCaseSensitivityObservations.js.map +1 -0
  87. package/lib/internal/pathIdentity/createFilesystemPathIdentityContext.js +2 -143
  88. package/lib/internal/pathIdentity/createFilesystemPathIdentityContext.js.map +1 -1
  89. package/lib/internal/projectInputPathIdentity.d.ts +1 -0
  90. package/lib/internal/projectInputPathIdentity.js +1 -0
  91. package/lib/internal/projectInputPathIdentity.js.map +1 -1
  92. package/lib/internal/workerModuleUrl.d.ts +28 -0
  93. package/lib/internal/workerModuleUrl.js +40 -0
  94. package/lib/internal/workerModuleUrl.js.map +1 -0
  95. package/lib/launcher/internal/buildSingleRootProject.js +2 -1
  96. package/lib/launcher/internal/buildSingleRootProject.js.map +1 -1
  97. package/lib/launcher/internal/getCompilerVersionText.js +3 -2
  98. package/lib/launcher/internal/getCompilerVersionText.js.map +1 -1
  99. package/lib/launcher/internal/parseTtsxCLI.d.ts +5 -4
  100. package/lib/launcher/internal/parseTtsxCLI.js +5 -4
  101. package/lib/launcher/internal/parseTtsxCLI.js.map +1 -1
  102. package/lib/launcher/internal/prepareExecution.js +2 -1
  103. package/lib/launcher/internal/prepareExecution.js.map +1 -1
  104. package/lib/launcher/internal/resolveSingleFileOutput.d.ts +8 -9
  105. package/lib/launcher/internal/resolveSingleFileOutput.js +8 -9
  106. package/lib/launcher/internal/resolveSingleFileOutput.js.map +1 -1
  107. package/lib/launcher/internal/runTtsc.js +91 -41
  108. package/lib/launcher/internal/runTtsc.js.map +1 -1
  109. package/lib/launcher/internal/runTtsx.js +5 -2
  110. package/lib/launcher/internal/runTtsx.js.map +1 -1
  111. package/lib/launcher/internal/runtime/CommonJsRuntimeSource.d.ts +10 -6
  112. package/lib/launcher/internal/runtime/CommonJsRuntimeSource.js +11 -9
  113. package/lib/launcher/internal/runtime/CommonJsRuntimeSource.js.map +1 -1
  114. package/lib/launcher/internal/runtime/RuntimeEntrySources.d.ts +40 -0
  115. package/lib/launcher/internal/runtime/RuntimeEntrySources.js +57 -0
  116. package/lib/launcher/internal/runtime/RuntimeEntrySources.js.map +1 -0
  117. package/lib/launcher/internal/runtime/RuntimeProjectOwnership.d.ts +5 -4
  118. package/lib/launcher/internal/runtime/RuntimeProjectOwnership.js +8 -6
  119. package/lib/launcher/internal/runtime/RuntimeProjectOwnership.js.map +1 -1
  120. package/lib/launcher/internal/runtime/advertiseTypeScriptExtensions.d.ts +20 -0
  121. package/lib/launcher/internal/runtime/advertiseTypeScriptExtensions.js +27 -0
  122. package/lib/launcher/internal/runtime/advertiseTypeScriptExtensions.js.map +1 -0
  123. package/lib/launcher/internal/runtime/commonJsExportNames.d.ts +2 -1
  124. package/lib/launcher/internal/runtime/commonJsExportNames.js +2 -1
  125. package/lib/launcher/internal/runtime/commonJsExportNames.js.map +1 -1
  126. package/lib/launcher/internal/runtime/installRuntimeHooks.d.ts +5 -3
  127. package/lib/launcher/internal/runtime/installRuntimeHooks.js +42 -12
  128. package/lib/launcher/internal/runtime/installRuntimeHooks.js.map +1 -1
  129. package/lib/launcher/internal/runtime/resolveRuntimeCleanTargets.js +3 -1
  130. package/lib/launcher/internal/runtime/resolveRuntimeCleanTargets.js.map +1 -1
  131. package/lib/launcher/internal/watch/AsyncWatchTopology.d.ts +113 -0
  132. package/lib/launcher/internal/watch/AsyncWatchTopology.js +232 -0
  133. package/lib/launcher/internal/watch/AsyncWatchTopology.js.map +1 -0
  134. package/lib/launcher/internal/watch/WatchSettlement.d.ts +49 -0
  135. package/lib/launcher/internal/watch/WatchSettlement.js +70 -0
  136. package/lib/launcher/internal/watch/WatchSettlement.js.map +1 -0
  137. package/lib/launcher/internal/watch/WatchTopology.d.ts +103 -13
  138. package/lib/launcher/internal/watch/WatchTopology.js +380 -95
  139. package/lib/launcher/internal/watch/WatchTopology.js.map +1 -1
  140. package/lib/launcher/internal/watch/WatchTopologyWorkerProtocol.d.ts +121 -0
  141. package/lib/launcher/internal/watch/WatchTopologyWorkerProtocol.js +3 -0
  142. package/lib/launcher/internal/watch/WatchTopologyWorkerProtocol.js.map +1 -0
  143. package/lib/launcher/internal/watch/projectInputReloadEventShouldNotify.d.ts +4 -1
  144. package/lib/launcher/internal/watch/projectInputReloadEventShouldNotify.js +3 -2
  145. package/lib/launcher/internal/watch/projectInputReloadEventShouldNotify.js.map +1 -1
  146. package/lib/launcher/internal/watch/serveWatchTopologyWorker.d.ts +19 -0
  147. package/lib/launcher/internal/watch/serveWatchTopologyWorker.js +62 -0
  148. package/lib/launcher/internal/watch/serveWatchTopologyWorker.js.map +1 -0
  149. package/lib/launcher/internal/watch/watchTopologyWorker.d.ts +1 -0
  150. package/lib/launcher/internal/watch/watchTopologyWorker.js +22 -0
  151. package/lib/launcher/internal/watch/watchTopologyWorker.js.map +1 -0
  152. package/lib/plugin/CapabilityPluginResolver.d.ts +1 -1
  153. package/lib/plugin/CapabilityPluginResolver.js +3 -2
  154. package/lib/plugin/CapabilityPluginResolver.js.map +1 -1
  155. package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.d.ts +15 -12
  156. package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.js +13 -11
  157. package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.js.map +1 -1
  158. package/lib/plugin/internal/load/PluginPackageResolution.d.ts +2 -2
  159. package/lib/plugin/internal/load/PluginPackageResolution.js +13 -7
  160. package/lib/plugin/internal/load/PluginPackageResolution.js.map +1 -1
  161. package/lib/plugin/internal/load/ProjectPluginEntries.d.ts +23 -7
  162. package/lib/plugin/internal/load/ProjectPluginEntries.js +36 -14
  163. package/lib/plugin/internal/load/ProjectPluginEntries.js.map +1 -1
  164. package/lib/plugin/internal/load/collectProjectHostInputs.d.ts +3 -1
  165. package/lib/plugin/internal/load/collectProjectHostInputs.js +5 -2
  166. package/lib/plugin/internal/load/collectProjectHostInputs.js.map +1 -1
  167. package/lib/plugin/internal/load/hasProjectPluginEntries.d.ts +3 -1
  168. package/lib/plugin/internal/load/hasProjectPluginEntries.js +4 -2
  169. package/lib/plugin/internal/load/hasProjectPluginEntries.js.map +1 -1
  170. package/lib/plugin/internal/load/loadProjectPlugins.d.ts +36 -5
  171. package/lib/plugin/internal/load/loadProjectPlugins.js +477 -421
  172. package/lib/plugin/internal/load/loadProjectPlugins.js.map +1 -1
  173. package/lib/plugin/internal/load/pluginResolutionFailure.d.ts +18 -0
  174. package/lib/plugin/internal/load/pluginResolutionFailure.js +32 -0
  175. package/lib/plugin/internal/load/pluginResolutionFailure.js.map +1 -0
  176. package/lib/plugin/internal/load/resolveNativeSource.js +2 -3
  177. package/lib/plugin/internal/load/resolveNativeSource.js.map +1 -1
  178. package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.d.ts +1 -1
  179. package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js +3 -2
  180. package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js.map +1 -1
  181. package/lib/plugin/internal/source/pluginModuleReplaceDirectories.d.ts +4 -1
  182. package/lib/plugin/internal/source/pluginModuleReplaceDirectories.js +9 -2
  183. package/lib/plugin/internal/source/pluginModuleReplaceDirectories.js.map +1 -1
  184. package/lib/structures/ITtscCompilerContext.d.ts +12 -12
  185. package/lib/structures/ITtscPlugin.d.ts +7 -5
  186. package/lib/structures/ITtscPluginFactoryContext.d.ts +9 -8
  187. package/lib/structures/internal/TtscCommonOptions.d.ts +2 -2
  188. package/lib/structures/internal/TtscSingleFileEmitOptions.d.ts +12 -6
  189. package/package.json +9 -9
  190. package/src/TtscCompiler.ts +1 -1
  191. package/src/compiler/internal/ResidentCheckProcess.ts +159 -374
  192. package/src/compiler/internal/ResidentCheckProcessHost.ts +502 -0
  193. package/src/compiler/internal/ResidentCheckProcessProtocol.ts +53 -0
  194. package/src/compiler/internal/build/BuildExecution.ts +123 -11
  195. package/src/compiler/internal/build/ResidentCheckWatchSession.ts +41 -24
  196. package/src/compiler/internal/build/RunBuildOptions.ts +9 -5
  197. package/src/compiler/internal/build/TsgoArguments.ts +4 -1
  198. package/src/compiler/internal/build/WatchInputPublication.ts +106 -0
  199. package/src/compiler/internal/build/runBuild.ts +58 -34
  200. package/src/compiler/internal/buildNativeCompiler.ts +4 -0
  201. package/src/compiler/internal/compileProjectInMemory.ts +8 -2
  202. package/src/compiler/internal/project/CompilerProjectSelection.ts +14 -14
  203. package/src/compiler/internal/project/resolveOwningProjectConfig.ts +42 -16
  204. package/src/compiler/internal/readEffectiveCompilerOptions.ts +1 -1
  205. package/src/compiler/internal/resolveBinary.ts +4 -1
  206. package/src/compiler/internal/resolveTsgo.ts +7 -0
  207. package/src/compiler/internal/runSingleFileEmit.ts +145 -101
  208. package/src/compiler/internal/startResidentTransform.ts +9 -2
  209. package/src/compiler/internal/transformProjectInMemory.ts +12 -3
  210. package/src/compiler/internal/transformProjectInWorker.ts +10 -2
  211. package/src/flags/ParseOptions.ts +2 -2
  212. package/src/internal/E2ETrace.ts +3 -1
  213. package/src/internal/OwnedNativeProcess.ts +2 -2
  214. package/src/internal/SourceNativeRetirement.ts +42 -19
  215. package/src/internal/TtsxNodeOptions.ts +124 -0
  216. package/src/internal/javascriptRuntimeCapabilities.ts +6 -1
  217. package/src/internal/parseWindowsDirectoryCaseSensitivity.ts +5 -5
  218. package/src/internal/pathIdentity/createCaseSensitivityObservations.ts +242 -0
  219. package/src/internal/pathIdentity/createFilesystemPathIdentityContext.ts +2 -169
  220. package/src/internal/projectInputPathIdentity.ts +1 -0
  221. package/src/internal/workerModuleUrl.ts +34 -0
  222. package/src/launcher/internal/buildSingleRootProject.ts +2 -0
  223. package/src/launcher/internal/getCompilerVersionText.ts +3 -2
  224. package/src/launcher/internal/parseTtsxCLI.ts +5 -4
  225. package/src/launcher/internal/prepareExecution.ts +6 -1
  226. package/src/launcher/internal/resolveSingleFileOutput.ts +8 -9
  227. package/src/launcher/internal/runTtsc.ts +127 -49
  228. package/src/launcher/internal/runTtsx.ts +17 -8
  229. package/src/launcher/internal/runtime/CommonJsRuntimeSource.ts +11 -9
  230. package/src/launcher/internal/runtime/RuntimeEntrySources.ts +57 -0
  231. package/src/launcher/internal/runtime/RuntimeProjectOwnership.ts +23 -10
  232. package/src/launcher/internal/runtime/advertiseTypeScriptExtensions.ts +25 -0
  233. package/src/launcher/internal/runtime/commonJsExportNames.ts +11 -4
  234. package/src/launcher/internal/runtime/installRuntimeHooks.ts +62 -16
  235. package/src/launcher/internal/runtime/resolveRuntimeCleanTargets.ts +17 -5
  236. package/src/launcher/internal/watch/AsyncWatchTopology.ts +267 -0
  237. package/src/launcher/internal/watch/WatchSettlement.ts +67 -0
  238. package/src/launcher/internal/watch/WatchTopology.ts +461 -102
  239. package/src/launcher/internal/watch/WatchTopologyWorkerProtocol.ts +106 -0
  240. package/src/launcher/internal/watch/projectInputReloadEventShouldNotify.ts +14 -9
  241. package/src/launcher/internal/watch/serveWatchTopologyWorker.ts +75 -0
  242. package/src/launcher/internal/watch/watchTopologyWorker.ts +29 -0
  243. package/src/plugin/CapabilityPluginResolver.ts +9 -2
  244. package/src/plugin/internal/load/PluginDescriptorEvaluationCache.ts +17 -12
  245. package/src/plugin/internal/load/PluginPackageResolution.ts +14 -9
  246. package/src/plugin/internal/load/ProjectPluginEntries.ts +40 -15
  247. package/src/plugin/internal/load/collectProjectHostInputs.ts +7 -1
  248. package/src/plugin/internal/load/hasProjectPluginEntries.ts +8 -3
  249. package/src/plugin/internal/load/loadProjectPlugins.ts +683 -593
  250. package/src/plugin/internal/load/pluginResolutionFailure.ts +37 -0
  251. package/src/plugin/internal/load/resolveNativeSource.ts +10 -4
  252. package/src/plugin/internal/source/PluginBuildEnvironmentReadings.ts +8 -2
  253. package/src/plugin/internal/source/pluginModuleReplaceDirectories.ts +10 -1
  254. package/src/structures/ITtscCompilerContext.ts +12 -12
  255. package/src/structures/ITtscPlugin.ts +7 -5
  256. package/src/structures/ITtscPluginFactoryContext.ts +9 -8
  257. package/src/structures/internal/TtscCommonOptions.ts +2 -2
  258. package/src/structures/internal/TtscSingleFileEmitOptions.ts +22 -11
  259. package/internal/graphsymbols/position_helpers_follow_ecma_line_terminators_test.go +0 -78
  260. package/internal/graphsymbols/provider.go +0 -650
  261. package/internal/lspserver/lsp_symbols.go +0 -212
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AsyncWatchTopology = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const node_worker_threads_1 = require("node:worker_threads");
9
+ const SidecarEnvironment_1 = require("../../../compiler/internal/sharedHost/SidecarEnvironment");
10
+ const workerModuleUrl_1 = require("../../../internal/workerModuleUrl");
11
+ /**
12
+ * Keep one watch topology and its native subscriptions on a worker thread.
13
+ *
14
+ * Case-policy probes, content digests and compiler listings must retain their
15
+ * actual observations. Replacing them with path-only case caches or size/mtime
16
+ * digests can miss directory replacements and source edits. They instead run
17
+ * off the launcher's loop so their cost cannot delay resident-host retirement
18
+ * or queued build decisions (#1758). This moves the cost; it does not remove
19
+ * it. Options and publications are cloned, while callbacks stay on the caller.
20
+ *
21
+ * Await a publication before the build reads its inputs. Moving that baseline
22
+ * past the build could absorb an intervening edit (#1728). Callback messages
23
+ * and completion replies share one FIFO channel, so whenIdle completes after
24
+ * the notifications its barrier observed have reached the launcher (#1756).
25
+ *
26
+ * @evidence contracts/common.md#principled-implementation A dedicated supported worker executes the unchanged topology algorithm on selected cloneable data while callbacks remain caller-owned; worker events and correlated replies settle actual operations, and one FIFO channel orders callbacks before completion.
27
+ * @evidence contracts/common.md#clear-and-simple-design The facade separates option capture, reply dispatch and worker lifetime; the synchronous core retains filesystem policy and watcher ownership.
28
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Existing native case observations, compiler membership and content proofs remain authoritative. The explicit worker factory supplies transport without replacing globals, and the default starts the actual packaged CommonJS entry without a synchronous barrier or metadata shortcut.
29
+ * @evidence contracts/common.md#meaningful-documentation Native prose explains off-thread cost, baseline-before-build ordering, FIFO replies and lifetime failures; constructor prose identifies data capture, callback ownership and the optional factory.
30
+ * @evidence contracts/portability.md#os-neutral-implementation Native joins locate the packaged CommonJS entry, and the supported module bootstrap loads it through createRequire while retaining Node-owned inherited execution options and loader hooks. Structured cloning preserves maps and bigint device references; SidecarEnvironment merges native environment names before startup.
31
+ * @evidence contracts/performance.md#efficient-algorithms One thread serves the topology lifetime. Construction copies fixed option references before cloning, with costs for option/environment bytes and module initialization; each operation clones its publication bytes and adds one pending entry while the core retains native costs.
32
+ * @evidence contracts/performance.md#reuse-equivalent-work Construction starts a fresh worker lifetime; that worker retains current registrations, listing premises and baselines across requests, but completion grants no reuse for another filesystem generation.
33
+ * @evidence contracts/performance.md#bound-retention-and-release-resources One referenced worker, listeners, exit promise and uncapped pending map belong to the facade; creation failure precedes ownership transfer. Replies prune entries and failure rejects all entries. Close joins worker exit after native subscription close; failed close terminates and joins the thread while retaining error. Requests have no implicit deadline.
34
+ */
35
+ class AsyncWatchTopology {
36
+ callbacks;
37
+ worker;
38
+ exited;
39
+ pending = new Map();
40
+ sequence = 0;
41
+ failure;
42
+ failed = false;
43
+ terminating = false;
44
+ closing;
45
+ /**
46
+ * Capture data options and start the worker; callbacks remain caller-owned.
47
+ * The optional factory observes worker transport without replacing globals.
48
+ */
49
+ constructor(options, callbacks, createWorker = (selected) => new node_worker_threads_1.Worker((0, workerModuleUrl_1.workerModuleUrl)(node_path_1.default.join(__dirname, `watchTopologyWorker${node_path_1.default.extname(__filename)}`)), {
50
+ env: SidecarEnvironment_1.SidecarEnvironment.merge(process.env, selected.env),
51
+ workerData: selected,
52
+ })) {
53
+ this.callbacks = callbacks;
54
+ // Callers also carry build callbacks. Select only the core's data options:
55
+ // sending the invocation wholesale would attempt to clone those functions.
56
+ const { binary, compilerArgsCwd, compilerProjectSelections, cwd, emit, env, files, outDir, passthrough, pinCompilerProject, projectRoot, tsconfig, } = options;
57
+ this.worker = createWorker({
58
+ binary,
59
+ compilerArgsCwd,
60
+ compilerProjectSelections,
61
+ cwd,
62
+ emit,
63
+ env,
64
+ files,
65
+ outDir,
66
+ passthrough,
67
+ pinCompilerProject,
68
+ projectRoot,
69
+ tsconfig,
70
+ });
71
+ this.worker.on("message", (reply) => {
72
+ if ("id" in reply) {
73
+ const waiting = this.pending.get(reply.id);
74
+ if (waiting === undefined)
75
+ return;
76
+ this.pending.delete(reply.id);
77
+ if (reply.ok)
78
+ waiting.resolve();
79
+ else
80
+ waiting.reject(reply.error);
81
+ return;
82
+ }
83
+ switch (reply.event) {
84
+ case "input":
85
+ this.callbacks.onInputChange(reply.change);
86
+ break;
87
+ case "topology":
88
+ this.callbacks.onTopologyChange();
89
+ break;
90
+ case "error":
91
+ this.callbacks.onError(reply.location, reply.error);
92
+ break;
93
+ case "roots":
94
+ this.callbacks.onProjectInputWatchRoots?.(reply.roots);
95
+ break;
96
+ case "unavailable":
97
+ this.callbacks.onProjectInputWatchUnavailable?.(reply.roots);
98
+ break;
99
+ }
100
+ });
101
+ this.worker.on("error", (error) => this.fail(error));
102
+ this.exited = new Promise((resolve) => {
103
+ this.worker.once("exit", (code) => {
104
+ if (this.closing === undefined ||
105
+ this.pending.size !== 0 ||
106
+ (code !== 0 && !this.terminating))
107
+ this.fail(new Error(`ttsc: watch topology worker exited with code ${code}`));
108
+ resolve();
109
+ });
110
+ });
111
+ }
112
+ /**
113
+ * Reconcile actual compiler membership and wait for its publication.
114
+ *
115
+ * @evidence contracts/common.md#principled-implementation The worker executes the core's actual refresh before replying, so completion does not stand for a predicted membership.
116
+ * @evidence contracts/common.md#clear-and-simple-design This operation frames one refresh and delegates transport correlation to request.
117
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Membership still comes from the core's native compiler-input reader.
118
+ * @evidence contracts/common.md#meaningful-documentation Prose states the membership and publication boundary.
119
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The method frames a boolean; the worker and core own native execution.
120
+ * @evidence contracts/performance.md#efficient-algorithms Fixed-size framing adds one pending entry; the core retains listing, traversal and hashing costs off-thread.
121
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Every requested refresh executes; listing reuse remains the core's decision.
122
+ * @evidence contracts/performance.md#bound-retention-and-release-resources Correlation remains live until reply or worker failure; no deadline is imposed.
123
+ */
124
+ refresh(notify) {
125
+ return this.request({ method: "refresh", notify });
126
+ }
127
+ /**
128
+ * Capture plugin baselines before the caller starts reading or building.
129
+ *
130
+ * @evidence contracts/common.md#principled-implementation Awaited completion follows the core's baseline capture and preserves the supplied record store's separability references through structured cloning.
131
+ * @evidence contracts/common.md#clear-and-simple-design One publication carries inputs and their existing proof store together.
132
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The actual content identity owner still judges every record; transport invents no digest or metadata equivalence.
133
+ * @evidence contracts/common.md#meaningful-documentation Prose states the required pre-build ordering.
134
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Paths and bigint maps are cloned as data; the core owns native interpretation.
135
+ * @evidence contracts/performance.md#efficient-algorithms Framing is fixed structural work and cloning visits input paths and record references; digest and registration work stays with the core.
136
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Each publication reaches the core, which owns baseline and listing reuse premises.
137
+ * @evidence contracts/performance.md#bound-retention-and-release-resources Publication data and one pending correlation remain live through completion or worker failure without a size or deadline cap.
138
+ */
139
+ setExtraInputs(inputs, identities) {
140
+ return this.request({ method: "setExtraInputs", inputs, identities });
141
+ }
142
+ /**
143
+ * Capture rule-input baselines before the caller consumes those inputs.
144
+ *
145
+ * @evidence contracts/common.md#principled-implementation Completion follows actual declaration normalization, population capture and subscription reconciliation in the core.
146
+ * @evidence contracts/common.md#clear-and-simple-design One operation carries the complete declared snapshot without splitting population and baseline ownership.
147
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The core retains missing-path, alias and empty-population semantics; transport filters no inputs.
148
+ * @evidence contracts/common.md#meaningful-documentation Prose states capture timing relative to consumption.
149
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The snapshot crosses as data; the core owns filesystem identity and case policy.
150
+ * @evidence contracts/performance.md#efficient-algorithms Cloning visits the snapshot's path text; matching, fingerprinting and registrations keep their owning core costs.
151
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work The core decides whether a publication is equivalent; transport reuses no earlier result.
152
+ * @evidence contracts/performance.md#bound-retention-and-release-resources Snapshot bytes and one pending correlation remain live until reply or worker failure without a population cap.
153
+ */
154
+ setProjectInputs(inputs) {
155
+ return this.request({ method: "setProjectInputs", inputs });
156
+ }
157
+ /**
158
+ * Wait for delivered topology work and its preceding callback messages.
159
+ *
160
+ * @evidence contracts/common.md#principled-implementation The worker's core barrier observes its scheduled owners, and callbacks sent before the completion reply arrive first on the same FIFO channel.
161
+ * @evidence contracts/common.md#clear-and-simple-design One request exposes the core's complete queue ownership instead of duplicating queue flags here.
162
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Actual queue completion replaces elapsed quiet-time estimates.
163
+ * @evidence contracts/common.md#meaningful-documentation Prose identifies delivered work and callback ordering.
164
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The operation uses portable MessagePort ordering without a native path or process call.
165
+ * @evidence contracts/performance.md#efficient-algorithms Fixed-size framing adds one correlation; the core checks flags per yielded turn and still pays its pending operations' costs.
166
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Each barrier observes current pending work rather than a previous receipt.
167
+ * @evidence contracts/performance.md#bound-retention-and-release-resources One request remains live until idle, close or failure; continuous new work can keep it pending without an implicit deadline.
168
+ */
169
+ whenIdle() {
170
+ return this.request({ method: "whenIdle" });
171
+ }
172
+ /**
173
+ * Close subscriptions and join the thread. Repeated calls share retirement;
174
+ * close or worker failures remain rejection even after thread termination.
175
+ *
176
+ * @evidence contracts/common.md#principled-implementation Successful close follows core subscription release, outstanding barrier answers and actual worker exit; failed close terminates and joins the thread while preserving rejection.
177
+ * @evidence contracts/common.md#clear-and-simple-design One retained promise owns idempotent shutdown and finishClose owns its two retirement paths.
178
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Shutdown joins actual thread exit rather than treating a posted close as completion.
179
+ * @evidence contracts/common.md#meaningful-documentation Prose states joined completion, repeated-call sharing and failure retention.
180
+ * @evidence contracts/portability.md#os-neutral-implementation Node's supported worker exit and termination APIs own thread retirement; the core owns backend subscription closure.
181
+ * @evidence contracts/performance.md#efficient-algorithms One close message and shared promise add fixed structural work; subscription traversal, outstanding replies and thread retirement retain delegated costs.
182
+ * @evidence contracts/performance.md#reuse-equivalent-work Every repeated close shares this lifetime's single retirement result, including rejection.
183
+ * @evidence contracts/performance.md#bound-retention-and-release-resources Closure rejects new requests and joins the worker; pending requests settle by replies or terminal failure. Native FSEvents stop errors are suppressed by its existing backend, so thread joining alone cannot certify that optional binding's physical cleanup.
184
+ */
185
+ close() {
186
+ this.closing ??= this.finishClose();
187
+ return this.closing;
188
+ }
189
+ async finishClose() {
190
+ try {
191
+ await this.request({ method: "close" });
192
+ }
193
+ catch (error) {
194
+ this.terminating = true;
195
+ await this.worker.terminate();
196
+ await this.exited;
197
+ throw error;
198
+ }
199
+ await this.exited;
200
+ if (this.failed)
201
+ throw this.failure;
202
+ }
203
+ request(operation) {
204
+ if (this.failed)
205
+ return Promise.reject(this.failure);
206
+ if (this.closing !== undefined)
207
+ return Promise.reject(new Error("ttsc: watch topology is closing"));
208
+ const id = ++this.sequence;
209
+ return new Promise((resolve, reject) => {
210
+ this.pending.set(id, { reject, resolve });
211
+ try {
212
+ this.worker.postMessage({ ...operation, id });
213
+ }
214
+ catch (error) {
215
+ this.pending.delete(id);
216
+ reject(error);
217
+ }
218
+ });
219
+ }
220
+ fail(error) {
221
+ if (this.failed)
222
+ return;
223
+ this.failed = true;
224
+ this.failure = error;
225
+ for (const waiting of this.pending.values())
226
+ waiting.reject(error);
227
+ this.pending.clear();
228
+ this.callbacks.onFailure(error);
229
+ }
230
+ }
231
+ exports.AsyncWatchTopology = AsyncWatchTopology;
232
+ //# sourceMappingURL=AsyncWatchTopology.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncWatchTopology.js","sourceRoot":"","sources":["../../../../src/launcher/internal/watch/AsyncWatchTopology.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,6DAA6C;AAE7C,iGAA8F;AAC9F,uEAAoE;AAKpE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IAmBqB,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CAAC;QACnE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACF"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Waits for an owner's idle observation without losing changes during that
3
+ * observation. The owner announces every scheduling and terminal transition.
4
+ *
5
+ * Elapsed silence cannot certify idle: a queued build or an asynchronous input
6
+ * decision can remain silent until it starts. A changed revision therefore
7
+ * requires another observation, even when the earlier one reported idle.
8
+ *
9
+ * @evidence contracts/common.md#principled-implementation A monotonic revision detects transitions across an asynchronous idle query; wait registration and the final revision comparison share one JavaScript turn, preventing a lost wake.
10
+ * @evidence contracts/common.md#clear-and-simple-design The owner supplies its actual idle predicate and announces state changes; this class owns only revision validation and waiting callbacks.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts No timeout, retry limit, process hook or consumer-specific decision substitutes for the owner's state.
12
+ * @evidence contracts/common.md#meaningful-documentation Prose defines idle-query ownership and why silent queued work and intervening changes require a fresh observation; methods describe notification and failure effects.
13
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Revisions and promises have no native path, filesystem or process boundary.
14
+ * @evidence contracts/performance.md#efficient-algorithms Each transition visits current waiters once; each observation is constant bookkeeping plus the supplied owner's work, without polling.
15
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Each wait observes mutable owner state independently; no computed result is cached across transitions.
16
+ * @evidence contracts/performance.md#bound-retention-and-release-resources A non-idle wait registers one callback until the next transition; an in-flight idle query or publication retains its call closure until settlement. Errors reject directly. The owner must announce terminal transitions so registered callbacks can recheck and reject. Concurrent caller population has no fixed cap.
17
+ */
18
+ export declare class WatchSettlement {
19
+ private revision;
20
+ private readonly waiters;
21
+ /**
22
+ * Announces a scheduling or terminal transition and releases current waits.
23
+ *
24
+ * @evidence contracts/common.md#principled-implementation Advancing the revision invalidates queries already in flight, and releasing the current callback population permits each pending wait to query again.
25
+ * @evidence contracts/common.md#clear-and-simple-design One notification handles both ordinary scheduling and terminal transitions without interpreting the owner's state.
26
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Callbacks observe a real owner transition without polling or replacing owner operations.
27
+ * @evidence contracts/common.md#meaningful-documentation The prose states which transitions callers announce and that current waits are released.
28
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation This in-memory notification has no native boundary.
29
+ * @evidence contracts/performance.md#efficient-algorithms Copying and waking current callbacks costs linear time and temporary space in pending waits.
30
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work This effectful transition does not compute a reusable result.
31
+ * @evidence contracts/performance.md#bound-retention-and-release-resources Clearing the set releases its references before callbacks run; each resumed wait owns any later registration.
32
+ */
33
+ changed(): void;
34
+ /**
35
+ * Publishes and resolves after an idle query spans no transition; errors
36
+ * reject. The owner must reject its query after shutdown and announce that
37
+ * shutdown. Publication starts in the same turn as the final revision check.
38
+ *
39
+ * @evidence contracts/common.md#principled-implementation The revision comparison validates the complete awaited observation; publication starts synchronously after that comparison, and a non-idle result registers its wake in the same turn, so neither path loses an intervening transition.
40
+ * @evidence contracts/common.md#clear-and-simple-design The loop retries only after a real transition and delegates all idle and terminal meaning to the supplied owner query.
41
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts No elapsed silence, deadline or fixed retry count stands for the owner's actual pending work.
42
+ * @evidence contracts/common.md#meaningful-documentation The prose describes successful observation, same-turn publication, error propagation and the terminal notification obligation.
43
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Awaiting an owner query imposes no native path or process policy.
44
+ * @evidence contracts/performance.md#efficient-algorithms Each query adds constant revision bookkeeping and at most one callback; query work belongs to the supplied owner, and no timer polls state.
45
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Queries observe mutable state and are not cached across transitions.
46
+ * @evidence contracts/performance.md#bound-retention-and-release-resources A non-idle observation retains one resolver until changed clears it; successful and failed queries retain no registered callback, while an in-flight query or publication retains this call until settlement. Terminal wake and rejection are the owner's obligation.
47
+ */
48
+ wait(idle: () => Promise<boolean>, publish?: () => void | Promise<void>): Promise<void>;
49
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WatchSettlement = void 0;
4
+ /**
5
+ * Waits for an owner's idle observation without losing changes during that
6
+ * observation. The owner announces every scheduling and terminal transition.
7
+ *
8
+ * Elapsed silence cannot certify idle: a queued build or an asynchronous input
9
+ * decision can remain silent until it starts. A changed revision therefore
10
+ * requires another observation, even when the earlier one reported idle.
11
+ *
12
+ * @evidence contracts/common.md#principled-implementation A monotonic revision detects transitions across an asynchronous idle query; wait registration and the final revision comparison share one JavaScript turn, preventing a lost wake.
13
+ * @evidence contracts/common.md#clear-and-simple-design The owner supplies its actual idle predicate and announces state changes; this class owns only revision validation and waiting callbacks.
14
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts No timeout, retry limit, process hook or consumer-specific decision substitutes for the owner's state.
15
+ * @evidence contracts/common.md#meaningful-documentation Prose defines idle-query ownership and why silent queued work and intervening changes require a fresh observation; methods describe notification and failure effects.
16
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Revisions and promises have no native path, filesystem or process boundary.
17
+ * @evidence contracts/performance.md#efficient-algorithms Each transition visits current waiters once; each observation is constant bookkeeping plus the supplied owner's work, without polling.
18
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Each wait observes mutable owner state independently; no computed result is cached across transitions.
19
+ * @evidence contracts/performance.md#bound-retention-and-release-resources A non-idle wait registers one callback until the next transition; an in-flight idle query or publication retains its call closure until settlement. Errors reject directly. The owner must announce terminal transitions so registered callbacks can recheck and reject. Concurrent caller population has no fixed cap.
20
+ */
21
+ class WatchSettlement {
22
+ revision = 0;
23
+ waiters = new Set();
24
+ /**
25
+ * Announces a scheduling or terminal transition and releases current waits.
26
+ *
27
+ * @evidence contracts/common.md#principled-implementation Advancing the revision invalidates queries already in flight, and releasing the current callback population permits each pending wait to query again.
28
+ * @evidence contracts/common.md#clear-and-simple-design One notification handles both ordinary scheduling and terminal transitions without interpreting the owner's state.
29
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Callbacks observe a real owner transition without polling or replacing owner operations.
30
+ * @evidence contracts/common.md#meaningful-documentation The prose states which transitions callers announce and that current waits are released.
31
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation This in-memory notification has no native boundary.
32
+ * @evidence contracts/performance.md#efficient-algorithms Copying and waking current callbacks costs linear time and temporary space in pending waits.
33
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work This effectful transition does not compute a reusable result.
34
+ * @evidence contracts/performance.md#bound-retention-and-release-resources Clearing the set releases its references before callbacks run; each resumed wait owns any later registration.
35
+ */
36
+ changed() {
37
+ ++this.revision;
38
+ const waiters = [...this.waiters];
39
+ this.waiters.clear();
40
+ for (const wake of waiters)
41
+ wake();
42
+ }
43
+ /**
44
+ * Publishes and resolves after an idle query spans no transition; errors
45
+ * reject. The owner must reject its query after shutdown and announce that
46
+ * shutdown. Publication starts in the same turn as the final revision check.
47
+ *
48
+ * @evidence contracts/common.md#principled-implementation The revision comparison validates the complete awaited observation; publication starts synchronously after that comparison, and a non-idle result registers its wake in the same turn, so neither path loses an intervening transition.
49
+ * @evidence contracts/common.md#clear-and-simple-design The loop retries only after a real transition and delegates all idle and terminal meaning to the supplied owner query.
50
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts No elapsed silence, deadline or fixed retry count stands for the owner's actual pending work.
51
+ * @evidence contracts/common.md#meaningful-documentation The prose describes successful observation, same-turn publication, error propagation and the terminal notification obligation.
52
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Awaiting an owner query imposes no native path or process policy.
53
+ * @evidence contracts/performance.md#efficient-algorithms Each query adds constant revision bookkeeping and at most one callback; query work belongs to the supplied owner, and no timer polls state.
54
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Queries observe mutable state and are not cached across transitions.
55
+ * @evidence contracts/performance.md#bound-retention-and-release-resources A non-idle observation retains one resolver until changed clears it; successful and failed queries retain no registered callback, while an in-flight query or publication retains this call until settlement. Terminal wake and rejection are the owner's obligation.
56
+ */
57
+ async wait(idle, publish = () => { }) {
58
+ for (;;) {
59
+ const revision = this.revision;
60
+ const observed = await idle();
61
+ if (revision !== this.revision)
62
+ continue;
63
+ if (observed)
64
+ return await publish();
65
+ await new Promise((resolve) => this.waiters.add(resolve));
66
+ }
67
+ }
68
+ }
69
+ exports.WatchSettlement = WatchSettlement;
70
+ //# sourceMappingURL=WatchSettlement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WatchSettlement.js","sourceRoot":"","sources":["../../../../src/launcher/internal/watch/WatchSettlement.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;GAgBG;AACH;IACU,QAAQ,GAAG,CAAC,CAAC;IACJ,OAAO,GAAG,IAAI,GAAG,EAAc,CAAC;IAEjD;;;;;;;;;;;OAWG;IACI,OAAO;QACZ,EAAE,IAAI,CAAC,QAAQ,CAAC;QAChB,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QAClC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,KAAK,MAAM,IAAI,IAAI,OAAO;YAAE,IAAI,EAAE,CAAC;IACrC,CAAC;IAED;;;;;;;;;;;;;OAaG;IACI,KAAK,CAAC,IAAI,CACf,IAA4B,EAC5B,OAAO,GAA+B,GAAG,EAAE,GAAE,CAAC;QAE9C,SAAS,CAAC;YACR,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC/B,MAAM,QAAQ,GAAG,MAAM,IAAI,EAAE,CAAC;YAC9B,IAAI,QAAQ,KAAK,IAAI,CAAC,QAAQ;gBAAE,SAAS;YACzC,IAAI,QAAQ;gBAAE,OAAO,MAAM,OAAO,EAAE,CAAC;YACrC,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;CACF"}
@@ -1,4 +1,5 @@
1
1
  import fs from "node:fs";
2
+ import { createCaseSensitivityObservations } from "../../../internal/pathIdentity/createCaseSensitivityObservations";
2
3
  import { PluginContentIdentities } from "../../../plugin/internal/source/PluginContentIdentities";
3
4
  import type { ITtscParsedProjectConfig } from "../../../structures/internal/ITtscParsedProjectConfig";
4
5
  import type { ITtscProjectInputSnapshot } from "../../../structures/internal/ITtscProjectInputSnapshot";
@@ -12,26 +13,26 @@ import { watchDirectory } from "./watchDirectory";
12
13
  * output for source and declaration membership. An explicit reader supplies the
13
14
  * same absolute-path membership and failure contract for each resolved project.
14
15
  * Configuration files, project-reference roots, output inference and native
15
- * filesystem identity remain this topology's responsibility.
16
- * Response frames are observed once per project refresh at its compiler cwd;
17
- * that option view serves all project-output queries while the original argv
18
- * reaches compiler membership. A second observation rejects response changes
19
- * across membership resolution. Response files join the config reload set;
20
- * these observations do not pin files or detect a change restored in between.
16
+ * filesystem identity remain this topology's responsibility. Response frames
17
+ * are observed once per project refresh at its compiler cwd; that option view
18
+ * serves all project-output queries while the original argv reaches compiler
19
+ * membership. A second observation rejects response changes across membership
20
+ * resolution. Response files join the config reload set; these observations do
21
+ * not pin files or detect a change restored in between.
21
22
  *
22
23
  * `TTSC_WATCH_DEBUG_INPUTS` reports the named event, observed population deltas
23
24
  * and reload decision. These diagnostics reuse the decision's existing inputs;
24
25
  * they perform no extra filesystem observations.
25
26
  *
26
27
  * @evidence contracts/common.md#principled-implementation The compiler-input operation's membership, published rule inputs and actual content fingerprints qualify notifications; its native default obtains the real compiler list. Post-registration reconciliation compares baselines to recover observed handoff changes, not an atomic guarantee against every transient mutation. Explicit operations preserve native defaults without replacing global filesystem or compiler methods. Project-input attribution: Observed member deltas establish attribution; stale selected names cannot override them, while directory names retain supported population causality and unrelated multiple members remain unnamed.
27
- * @evidence contracts/common.md#clear-and-simple-design Compiler, plugin and project-input watch populations keep their own baselines and callbacks under one topology owner; small classifiers separate membership, selection and handle replacement. Four distinct operations own directory subscriptions, file subscriptions, immediate reload-directory reads and compiler membership; existing callers need no new argument. Project-input attribution: One private reconciliation separates member deltas from immediate resolution-directory digests before choosing a supported event name or an observed single member.
28
+ * @evidence contracts/common.md#clear-and-simple-design Compiler, plugin and project-input watch populations keep their own baselines and callbacks under one topology owner; small classifiers separate membership, selection and handle replacement. Five distinct operations own directory subscriptions, file subscriptions, immediate reload-directory reads, compiler membership and each decision's case-policy observations; existing callers need no new argument. Project-input attribution: One private reconciliation separates member deltas from immediate resolution-directory digests before choosing a supported event name or an observed single member.
28
29
  * @evidence contracts/common.md#prohibited-implementation-shortcuts Supported native backends and explicit gap/replacement ownership replace foreign watcher patching; failed observation is reported rather than represented as complete coverage. The constructor manufactures no observations and bypasses no input or content proof; supplied operations retain the existing callback and result contracts. Project-input attribution: Native event names do not manufacture a delta; the current and previous physical membership identify already observed names without filename or fixture exceptions.
29
30
  * @evidence contracts/common.md#meaningful-documentation Native paragraphs explain membership authority, plugin fingerprinting, publication races, physical registration and public lifecycle operations following the documentation skill. Parameters identify each supplied operation and native default beside the constructor. Project-input attribution: Native paragraphs explain stale attention, directory causality, accompanying resolution digests and unselected immediate entries.
30
31
  * @evidence contracts/portability.md#os-neutral-implementation Native paths use Node APIs and registration uses realpath; compiler/plugin maps preserve lexical aliases and fold only measured insensitive ASCII components. Project inputs use physical identities, while unknown/native Unicode relations remain conservative event candidates rather than identity proof. Registration paths and read options are passed unchanged; compiler-input readers supply absolute membership paths without replacing the topology's native identity policy. Project-input attribution: The supplied filesystem identity transaction establishes selected names and ancestry without an OS-wide case assumption or lexical alias guess.
31
32
  *
32
- * @evidence contracts/performance.md#efficient-algorithms Identity-keyed maps separate membership, baselines and handle registries; reconciliation delegates project/config discovery, native compiler listing, filesystem traversal/hashing and backend callbacks, with costs described by its members. Construction retains operation references and empty indexes without a filesystem observation or build. Attribution indexed visits additionally pay path/key text, ancestor and native identity work; shared ancestor keys avoid repeating the same walk within a transaction.
33
- * @evidence contracts/performance.md#reuse-equivalent-work Current membership, content baselines and live registrations belong to one topology; reconciliation owners decide their reuse against fresh premises. Supplied operation identities are retained without adding an observation-result cache or assuming changed inputs remain equivalent. Project-input attribution: This classifier borrows one scan's deltas and identity transaction without retaining cross-event answers.
34
- * @evidence contracts/performance.md#bound-retention-and-release-resources Current and pending maps and live subscriptions remain topology-owned without a population cap; reconciliation attempts obsolete handle retirement. Constructor acquires no handle; directory arrays and attribution deltas are call-local. close invokes supplied close methods but does not await backend closure, and a thrown close can interrupt later map cleanup; retained snapshots remain until the facade is released.
33
+ * @evidence contracts/performance.md#efficient-algorithms Identity-keyed maps separate membership, baselines and handle registries; reconciliation delegates project/config discovery, native compiler listing, filesystem traversal/hashing and backend callbacks, with costs described by its members. A directory-triggered refresh additionally visits R active reload files even on failure and compares their metadata/owner snapshots, reading bytes only when those snapshots changed. Changed-owner and notification arrays and a reported-key set require O(R) references; moved owners share one existing watcher synchronization and post-registration reconciliation, whose selected-file traversal remains part of the operation. No additional compiler listing is requested. Construction retains operation references and empty indexes without a filesystem observation or build. Attribution indexed visits additionally pay path/key text, ancestor and native identity work; shared ancestor keys avoid repeating the same walk within a transaction.
34
+ * @evidence contracts/performance.md#reuse-equivalent-work Current membership, content baselines and live registrations belong to one topology; reconciliation owners decide their reuse against fresh premises. Supplied operation identities are retained without assuming changed inputs remain equivalent. Each project's last compiler listing is kept with its arguments and answers only a plugin-input change, which cannot move Program membership; every other refresh lists again. Notifications delivered in one poll iteration are decided together in the check phase, so one change lists and rescans once. Project-input attribution: This classifier borrows one scan's deltas and identity transaction without retaining cross-event answers.
35
+ * @evidence contracts/performance.md#bound-retention-and-release-resources Current and pending maps and live subscriptions remain topology-owned without a population cap; compiler listings are replaced by each resolution and hold only its projects; reconciliation attempts obsolete handle retirement. Constructor acquires no handle; directory arrays and attribution deltas are call-local. close invokes supplied close methods but does not await backend closure, and a thrown close can interrupt later map cleanup; retained snapshots remain until the facade is released.
35
36
  */
36
37
  export declare class WatchTopology {
37
38
  private readonly options;
@@ -40,6 +41,7 @@ export declare class WatchTopology {
40
41
  private readonly openFileWatch;
41
42
  private readonly readDirectory;
42
43
  private readonly getCompilerInputs;
44
+ private readonly observeCaseSensitivity;
43
45
  private analysisOnly;
44
46
  private closed;
45
47
  private compilerPostRegistrationMembershipRefresh;
@@ -70,13 +72,36 @@ export declare class WatchTopology {
70
72
  /** The plugin inputs whose directories the last sync already watched. */
71
73
  private watchedExtraInputs;
72
74
  private compilerFileSnapshots;
75
+ /**
76
+ * The last compiler listing of each project the topology resolved, by its
77
+ * config path, with the arguments it was asked under (`listingQuestion`). A
78
+ * change of plugin inputs reuses it (samchon/ttsc#1741).
79
+ */
80
+ private compilerListings;
81
+ /**
82
+ * Notifications the current poll iteration delivered, decided together in the
83
+ * check phase (`deferNotification`).
84
+ */
85
+ private pendingNotifications;
86
+ private notificationsScheduled;
73
87
  private files;
88
+ /**
89
+ * The current decision's directory case-policy observations, which every
90
+ * identity context the decision creates shares (samchon/ttsc#1742).
91
+ */
92
+ private caseObservations;
74
93
  private lexicalIdentities;
75
94
  private fileWatchers;
76
95
  private observedDirectories;
77
96
  private outputFiles;
78
97
  private outputs;
79
98
  private projectInputFingerprints;
99
+ /**
100
+ * The metadata and physical owner each matched project-input file had when
101
+ * its fingerprint was taken, by match key; a named notification re-reads only
102
+ * the files whose metadata moved (samchon/ttsc#1748).
103
+ */
104
+ private projectInputFileSnapshots;
80
105
  private projectInputMatches;
81
106
  private projectInputs;
82
107
  private declaredProjectInputs;
@@ -104,8 +129,10 @@ export declare class WatchTopology {
104
129
  * membership; the default invokes the native compiler. Readers throw
105
130
  * listing failures and retain ownership of their returned array, which this
106
131
  * topology does not mutate.
132
+ * @param observeCaseSensitivity Create one decision's directory case-policy
133
+ * observations; the default asks the native filesystem.
107
134
  */
108
- constructor(options: WatchTopologyOptions, callbacks: WatchTopologyCallbacks, openDirectoryWatch?: typeof watchDirectory, openFileWatch?: typeof fs.watch, readDirectory?: typeof fs.readdirSync, getCompilerInputs?: typeof listCompilerInputs);
135
+ constructor(options: WatchTopologyOptions, callbacks: WatchTopologyCallbacks, openDirectoryWatch?: typeof watchDirectory, openFileWatch?: typeof fs.watch, readDirectory?: typeof fs.readdirSync, getCompilerInputs?: typeof listCompilerInputs, observeCaseSensitivity?: typeof createCaseSensitivityObservations);
109
136
  /**
110
137
  * Re-resolve compiler inputs and notify when the resolved topology changes,
111
138
  * including membership, output/configuration or analysis-mode changes. Errors
@@ -122,6 +149,30 @@ export declare class WatchTopology {
122
149
  * @evidence contracts/performance.md#bound-retention-and-release-resources Current snapshots prune removed members and synchronization attempts obsolete handle closure, keeping old coverage after incomplete registration. Current/recovery populations and observations have no size cap; supplied close/error callbacks can throw and close does not await backend completion. State remains owner-held until released.
123
150
  */
124
151
  refresh(notify: boolean): void;
152
+ /**
153
+ * Wait until delivered notifications and registration reconciliation finish.
154
+ *
155
+ * A completed build does not imply a quiet topology: its final refresh can
156
+ * queue another decision and another build (#1756). Yield through the check
157
+ * phase before inspecting every scheduled owner so a decision queued by
158
+ * another decision remains part of this barrier. Later filesystem changes
159
+ * belong to a later barrier; this does not freeze the filesystem.
160
+ *
161
+ * @evidence contracts/common.md#principled-implementation A check-phase observation follows delivered events, and every notification, recovery and registration queue must be empty before completion.
162
+ * @evidence contracts/common.md#clear-and-simple-design The topology owns the barrier because it alone owns all five scheduled queues.
163
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Queue state establishes completion without a quiet-time estimate or an invented filesystem snapshot.
164
+ * @evidence contracts/common.md#meaningful-documentation Native prose distinguishes delivered work from later mutations and explains the post-build queued-decision race.
165
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The barrier observes owned JavaScript queues without a separate native operation.
166
+ * @evidence contracts/performance.md#efficient-algorithms Each check turn inspects five flags and two map sizes; notification processing retains its owning traversal and native-operation costs.
167
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Each call observes current work rather than reusing an earlier completion.
168
+ * @evidence contracts/performance.md#bound-retention-and-release-resources One immediate callback and promise remain live per waiting call; continuous new work can prevent completion and no deadline is imposed.
169
+ */
170
+ whenIdle(): Promise<void>;
171
+ /**
172
+ * @param reuseListings Answer each project's membership with its last listing
173
+ * under the same arguments instead of asking the compiler again. Only a
174
+ * refresh whose cause cannot move Program membership passes it.
175
+ */
125
176
  private refreshCompilerInputs;
126
177
  /**
127
178
  * Hand one Program-membership transition from the compiler lane to the
@@ -157,8 +208,8 @@ export declare class WatchTopology {
157
208
  * @evidence contracts/common.md#prohibited-implementation-shortcuts The actual plugin source digest applies its owning source-selection and pruning policy; named plugins or fixture output do not replace observed input state.
158
209
  * @evidence contracts/common.md#meaningful-documentation Native prose explains baseline timing and why existing inputs are not restamped following the documentation skill.
159
210
  * @evidence contracts/portability.md#os-neutral-implementation Native path resolution and canonical backend registration govern source trees; lexical keys preserve declarations and unknown names, folding ASCII only under measured insensitive parents rather than an OS-derived rule.
160
- * @evidence contracts/performance.md#efficient-algorithms Input/path keys deduplicate with text and native case/ancestor work; only newly admitted inputs compute initial source digests, each proven from the selected files' metadata when the load's records hold and read from the selected pruned corpus otherwise; refresh(false) also pays project/compiler listing, directory traversal and watcher reconciliation; fixed publication count does not bound delegated bytes or backend work.
161
- * @evidence contracts/performance.md#reuse-equivalent-work Unchanged ordered input sets return immediately; existing inputs reuse their recorded digest until actual notification processing establishes changed consumed state; a new input's digest is the one the load recorded while its metadata holds.
211
+ * @evidence contracts/performance.md#efficient-algorithms Input/path keys deduplicate with text and native case/ancestor work; only newly admitted inputs compute initial source digests, each proven from the selected files' metadata when the load's records hold and read from the selected pruned corpus otherwise; the following reconciliation pays project configuration, directory traversal and watcher work but answers membership from each project's last compiler listing; fixed publication count does not bound delegated bytes or backend work.
212
+ * @evidence contracts/performance.md#reuse-equivalent-work Unchanged ordered input sets return immediately; a changed set reuses each project's last compiler listing under the same arguments, since plugin inputs cannot move Program membership; existing inputs reuse their recorded digest until actual notification processing establishes changed consumed state; a new input's digest is the one the load recorded while its metadata holds.
162
213
  * @evidence contracts/performance.md#bound-retention-and-release-resources Publications replace input/digest populations and case-observation caches without a population cap; synchronization attempts obsolete watcher closure. Native/supplied closure has its own lifetime and can throw; owner close does not prove every backend has stopped or every retained snapshot byte was released.
163
214
  */
164
215
  setExtraInputs(inputs: readonly string[], identities?: PluginContentIdentities.Store): void;
@@ -197,6 +248,14 @@ export declare class WatchTopology {
197
248
  close(): void;
198
249
  /** Start fresh native case observations for one synchronous watch decision. */
199
250
  private beginLexicalTransaction;
251
+ /**
252
+ * A strict project-input identity context for the current decision. Its
253
+ * physical paths are resolved afresh, and its case answers are the
254
+ * decision's: one decision builds such contexts per declaration and per
255
+ * candidate, and each asked every directory again, which on Windows is an
256
+ * `fsutil` process per question (samchon/ttsc#1742).
257
+ */
258
+ private projectInputIdentities;
200
259
  /** Keep lexical alias ownership while sharing this decision's case probes. */
201
260
  private pathKey;
202
261
  private syncFileWatchers;
@@ -211,6 +270,22 @@ export declare class WatchTopology {
211
270
  /** A config's physical replacement can change resolution with equal bytes. */
212
271
  private compilerMovementReports;
213
272
  private syncDirectoryWatchers;
273
+ /**
274
+ * Decide a notification in the event loop's check phase, together with every
275
+ * other notification the same poll iteration delivered (samchon/ttsc#1741).
276
+ *
277
+ * One filesystem change usually arrives as several notifications, rename and
278
+ * change or create and modify, and each listed the compiler inputs or
279
+ * rescanned the project inputs again. Identical notifications of one lane,
280
+ * location and path merge, keeping a rename or a gap any of them carried, and
281
+ * the batch refreshes compiler membership once after deciding them all. The
282
+ * refresh therefore starts after every notification it absorbs, and one
283
+ * delivered later schedules another batch.
284
+ */
285
+ private deferNotification;
286
+ private decideNotifications;
287
+ /** Decide one merged directory notification of the compiler lane. */
288
+ private decideCompilerDirectoryNotification;
214
289
  /**
215
290
  * Reconcile tracked compiler files after a newly registered watcher returns.
216
291
  *
@@ -337,6 +412,21 @@ export declare class WatchTopology {
337
412
  private refreshProjectInputs;
338
413
  private collectProjectInputMatches;
339
414
  private refreshFromDirectory;
415
+ /**
416
+ * Refresh compiler membership once for every directory a decision asked
417
+ * about. A failed refresh still reports, once each, the reload inputs every
418
+ * requested change names.
419
+ *
420
+ * A replacement can be delivered under only its vanished temporary name,
421
+ * including when its malformed bytes prevent refresh. Reconcile active
422
+ * reload-file snapshots on either outcome, deduplicate failed-refresh
423
+ * recovery against actual reported movement, and preserve the original
424
+ * refresh error after recovery. Batch moved owners through the existing rearm
425
+ * operation before notifying, because a POSIX per-file handle still owns the
426
+ * old inode. Unchanged snapshots stay quiet unless the existing
427
+ * failed-refresh selector explicitly names or cannot find the reload input.
428
+ */
429
+ private refreshFromDirectories;
340
430
  private isCompilerOutputDirectory;
341
431
  private isCompilerOutput;
342
432
  private isProjectInputCompilerOutputDirectory;