@ttsc/unplugin 0.31.0 → 0.31.2

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 (291) hide show
  1. package/lib/core/bridge/projectRecordMoved.js +1 -1
  2. package/lib/core/bridge/projectRecordMoved.js.map +1 -1
  3. package/lib/core/bridge/projectRecordMoved.mjs +1 -1
  4. package/lib/core/bridge/projectRecordMoved.mjs.map +1 -1
  5. package/lib/core/bun/bun.d.cts +3 -2
  6. package/lib/core/bun/bun.d.mts +3 -2
  7. package/lib/core/bun/bun.d.ts +3 -2
  8. package/lib/core/bun/bun.js +8 -4
  9. package/lib/core/bun/bun.js.map +1 -1
  10. package/lib/core/bun/bun.mjs +8 -4
  11. package/lib/core/bun/bun.mjs.map +1 -1
  12. package/lib/core/observer/createInputObserver.js +7 -6
  13. package/lib/core/observer/createInputObserver.js.map +1 -1
  14. package/lib/core/observer/createInputObserver.mjs +7 -6
  15. package/lib/core/observer/createInputObserver.mjs.map +1 -1
  16. package/lib/core/observer/openIsolatedRecursiveWatch.d.cts +11 -12
  17. package/lib/core/observer/openIsolatedRecursiveWatch.d.mts +11 -12
  18. package/lib/core/observer/openIsolatedRecursiveWatch.d.ts +11 -12
  19. package/lib/core/observer/openIsolatedRecursiveWatch.js +11 -12
  20. package/lib/core/observer/openIsolatedRecursiveWatch.js.map +1 -1
  21. package/lib/core/observer/openIsolatedRecursiveWatch.mjs +11 -12
  22. package/lib/core/observer/openIsolatedRecursiveWatch.mjs.map +1 -1
  23. package/lib/core/transform/cache/TtscCachedProjectTransform.d.cts +12 -3
  24. package/lib/core/transform/cache/TtscCachedProjectTransform.d.mts +12 -3
  25. package/lib/core/transform/cache/TtscCachedProjectTransform.d.ts +12 -3
  26. package/lib/core/transform/cache/selectCachedGenerationAction.d.cts +2 -0
  27. package/lib/core/transform/cache/selectCachedGenerationAction.d.mts +2 -0
  28. package/lib/core/transform/cache/selectCachedGenerationAction.d.ts +2 -0
  29. package/lib/core/transform/cache/selectCachedGenerationAction.js +1 -1
  30. package/lib/core/transform/cache/selectCachedGenerationAction.js.map +1 -1
  31. package/lib/core/transform/cache/selectCachedGenerationAction.mjs +1 -1
  32. package/lib/core/transform/cache/selectCachedGenerationAction.mjs.map +1 -1
  33. package/lib/core/transform/deliverCachedTransform.d.cts +36 -0
  34. package/lib/core/transform/deliverCachedTransform.d.mts +36 -0
  35. package/lib/core/transform/deliverCachedTransform.d.ts +36 -0
  36. package/lib/core/transform/deliverCachedTransform.js +73 -0
  37. package/lib/core/transform/deliverCachedTransform.js.map +1 -0
  38. package/lib/core/transform/deliverCachedTransform.mjs +71 -0
  39. package/lib/core/transform/deliverCachedTransform.mjs.map +1 -0
  40. package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.d.cts +2 -2
  41. package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.d.mts +2 -2
  42. package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.d.ts +2 -2
  43. package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.js +6 -2
  44. package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.js.map +1 -1
  45. package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.mjs +6 -2
  46. package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.mjs.map +1 -1
  47. package/lib/core/transform/envelope/selectExternalInputPaths.d.cts +3 -5
  48. package/lib/core/transform/envelope/selectExternalInputPaths.d.mts +3 -5
  49. package/lib/core/transform/envelope/selectExternalInputPaths.d.ts +3 -5
  50. package/lib/core/transform/envelope/selectExternalInputPaths.js +8 -7
  51. package/lib/core/transform/envelope/selectExternalInputPaths.js.map +1 -1
  52. package/lib/core/transform/envelope/selectExternalInputPaths.mjs +8 -7
  53. package/lib/core/transform/envelope/selectExternalInputPaths.mjs.map +1 -1
  54. package/lib/core/transform/filesystem/TtscTransformFilesystemOperations.d.cts +15 -12
  55. package/lib/core/transform/filesystem/TtscTransformFilesystemOperations.d.mts +15 -12
  56. package/lib/core/transform/filesystem/TtscTransformFilesystemOperations.d.ts +15 -12
  57. package/lib/core/transform/generation/captureFailedGenerationInputStates.js +1 -1
  58. package/lib/core/transform/generation/captureFailedGenerationInputStates.js.map +1 -1
  59. package/lib/core/transform/generation/captureFailedGenerationInputStates.mjs +1 -1
  60. package/lib/core/transform/generation/captureFailedGenerationInputStates.mjs.map +1 -1
  61. package/lib/core/transform/generation/captureTransformGeneration.js +1 -1
  62. package/lib/core/transform/generation/captureTransformGeneration.js.map +1 -1
  63. package/lib/core/transform/generation/captureTransformGeneration.mjs +1 -1
  64. package/lib/core/transform/generation/captureTransformGeneration.mjs.map +1 -1
  65. package/lib/core/transform/generation/failedGenerationEnvironmentChanged.js +2 -2
  66. package/lib/core/transform/generation/failedGenerationEnvironmentChanged.js.map +1 -1
  67. package/lib/core/transform/generation/failedGenerationEnvironmentChanged.mjs +2 -2
  68. package/lib/core/transform/generation/failedGenerationEnvironmentChanged.mjs.map +1 -1
  69. package/lib/core/transform/generation/selectTransformAttemptDisposition.d.cts +3 -1
  70. package/lib/core/transform/generation/selectTransformAttemptDisposition.d.mts +3 -1
  71. package/lib/core/transform/generation/selectTransformAttemptDisposition.d.ts +3 -1
  72. package/lib/core/transform/generation/selectTransformAttemptDisposition.js +3 -1
  73. package/lib/core/transform/generation/selectTransformAttemptDisposition.js.map +1 -1
  74. package/lib/core/transform/generation/selectTransformAttemptDisposition.mjs +3 -1
  75. package/lib/core/transform/generation/selectTransformAttemptDisposition.mjs.map +1 -1
  76. package/lib/core/transform/generation/transformProject.d.cts +9 -7
  77. package/lib/core/transform/generation/transformProject.d.mts +9 -7
  78. package/lib/core/transform/generation/transformProject.d.ts +9 -7
  79. package/lib/core/transform/generation/transformProject.js +14 -9
  80. package/lib/core/transform/generation/transformProject.js.map +1 -1
  81. package/lib/core/transform/generation/transformProject.mjs +14 -9
  82. package/lib/core/transform/generation/transformProject.mjs.map +1 -1
  83. package/lib/core/transform/inputs/pluginSourceFilesDigest.d.cts +9 -3
  84. package/lib/core/transform/inputs/pluginSourceFilesDigest.d.mts +9 -3
  85. package/lib/core/transform/inputs/pluginSourceFilesDigest.d.ts +9 -3
  86. package/lib/core/transform/inputs/pluginSourceFilesDigest.js +10 -4
  87. package/lib/core/transform/inputs/pluginSourceFilesDigest.js.map +1 -1
  88. package/lib/core/transform/inputs/pluginSourceFilesDigest.mjs +11 -5
  89. package/lib/core/transform/inputs/pluginSourceFilesDigest.mjs.map +1 -1
  90. package/lib/core/transform/inputs/pluginSourceHolds.d.cts +4 -2
  91. package/lib/core/transform/inputs/pluginSourceHolds.d.mts +4 -2
  92. package/lib/core/transform/inputs/pluginSourceHolds.d.ts +4 -2
  93. package/lib/core/transform/inputs/pluginSourceHolds.js +9 -4
  94. package/lib/core/transform/inputs/pluginSourceHolds.js.map +1 -1
  95. package/lib/core/transform/inputs/pluginSourceHolds.mjs +9 -4
  96. package/lib/core/transform/inputs/pluginSourceHolds.mjs.map +1 -1
  97. package/lib/core/transform/inputs/pluginSourceState.d.cts +3 -1
  98. package/lib/core/transform/inputs/pluginSourceState.d.mts +3 -1
  99. package/lib/core/transform/inputs/pluginSourceState.d.ts +3 -1
  100. package/lib/core/transform/inputs/pluginSourceState.js +8 -3
  101. package/lib/core/transform/inputs/pluginSourceState.js.map +1 -1
  102. package/lib/core/transform/inputs/pluginSourceState.mjs +8 -3
  103. package/lib/core/transform/inputs/pluginSourceState.mjs.map +1 -1
  104. package/lib/core/transform/inputs/preparePluginBuildEnvironments.d.cts +18 -5
  105. package/lib/core/transform/inputs/preparePluginBuildEnvironments.d.mts +18 -5
  106. package/lib/core/transform/inputs/preparePluginBuildEnvironments.d.ts +18 -5
  107. package/lib/core/transform/inputs/preparePluginBuildEnvironments.js +53 -12
  108. package/lib/core/transform/inputs/preparePluginBuildEnvironments.js.map +1 -1
  109. package/lib/core/transform/inputs/preparePluginBuildEnvironments.mjs +53 -12
  110. package/lib/core/transform/inputs/preparePluginBuildEnvironments.mjs.map +1 -1
  111. package/lib/core/transform/tracker/broker/WatchBroker.d.cts +14 -4
  112. package/lib/core/transform/tracker/broker/WatchBroker.d.mts +14 -4
  113. package/lib/core/transform/tracker/broker/WatchBroker.d.ts +14 -4
  114. package/lib/core/transform/tracker/broker/WatchBrokerTransport.d.cts +63 -0
  115. package/lib/core/transform/tracker/broker/WatchBrokerTransport.d.mts +63 -0
  116. package/lib/core/transform/tracker/broker/WatchBrokerTransport.d.ts +63 -0
  117. package/lib/core/transform/tracker/broker/WatchBrokerTransport.js +89 -0
  118. package/lib/core/transform/tracker/broker/WatchBrokerTransport.js.map +1 -0
  119. package/lib/core/transform/tracker/broker/WatchBrokerTransport.mjs +89 -0
  120. package/lib/core/transform/tracker/broker/WatchBrokerTransport.mjs.map +1 -0
  121. package/lib/core/transform/tracker/broker/drainWatchBroker.d.cts +8 -8
  122. package/lib/core/transform/tracker/broker/drainWatchBroker.d.mts +8 -8
  123. package/lib/core/transform/tracker/broker/drainWatchBroker.d.ts +8 -8
  124. package/lib/core/transform/tracker/broker/drainWatchBroker.js +12 -13
  125. package/lib/core/transform/tracker/broker/drainWatchBroker.js.map +1 -1
  126. package/lib/core/transform/tracker/broker/drainWatchBroker.mjs +12 -13
  127. package/lib/core/transform/tracker/broker/drainWatchBroker.mjs.map +1 -1
  128. package/lib/core/transform/tracker/broker/getWatchBroker.d.cts +18 -15
  129. package/lib/core/transform/tracker/broker/getWatchBroker.d.mts +18 -15
  130. package/lib/core/transform/tracker/broker/getWatchBroker.d.ts +18 -15
  131. package/lib/core/transform/tracker/broker/getWatchBroker.js +87 -17
  132. package/lib/core/transform/tracker/broker/getWatchBroker.js.map +1 -1
  133. package/lib/core/transform/tracker/broker/getWatchBroker.mjs +87 -17
  134. package/lib/core/transform/tracker/broker/getWatchBroker.mjs.map +1 -1
  135. package/lib/core/transform/tracker/broker/openBrokeredWatch.d.cts +5 -5
  136. package/lib/core/transform/tracker/broker/openBrokeredWatch.d.mts +5 -5
  137. package/lib/core/transform/tracker/broker/openBrokeredWatch.d.ts +5 -5
  138. package/lib/core/transform/tracker/broker/openBrokeredWatch.js +11 -14
  139. package/lib/core/transform/tracker/broker/openBrokeredWatch.js.map +1 -1
  140. package/lib/core/transform/tracker/broker/openBrokeredWatch.mjs +11 -14
  141. package/lib/core/transform/tracker/broker/openBrokeredWatch.mjs.map +1 -1
  142. package/lib/core/transform/tracker/broker/usesWatchBroker.d.cts +7 -7
  143. package/lib/core/transform/tracker/broker/usesWatchBroker.d.mts +7 -7
  144. package/lib/core/transform/tracker/broker/usesWatchBroker.d.ts +7 -7
  145. package/lib/core/transform/tracker/broker/usesWatchBroker.js +7 -7
  146. package/lib/core/transform/tracker/broker/usesWatchBroker.mjs +7 -7
  147. package/lib/core/transform/tracker/broker/watchBrokerSource.d.cts +9 -10
  148. package/lib/core/transform/tracker/broker/watchBrokerSource.d.mts +9 -10
  149. package/lib/core/transform/tracker/broker/watchBrokerSource.d.ts +9 -10
  150. package/lib/core/transform/tracker/broker/watchBrokerSource.js +10 -11
  151. package/lib/core/transform/tracker/broker/watchBrokerSource.js.map +1 -1
  152. package/lib/core/transform/tracker/broker/watchBrokerSource.mjs +10 -11
  153. package/lib/core/transform/tracker/broker/watchBrokerSource.mjs.map +1 -1
  154. package/lib/core/transform/transformTtsc.d.cts +7 -4
  155. package/lib/core/transform/transformTtsc.d.mts +7 -4
  156. package/lib/core/transform/transformTtsc.d.ts +7 -4
  157. package/lib/core/transform/transformTtsc.js +38 -93
  158. package/lib/core/transform/transformTtsc.js.map +1 -1
  159. package/lib/core/transform/transformTtsc.mjs +38 -93
  160. package/lib/core/transform/transformTtsc.mjs.map +1 -1
  161. package/lib/core/transform/validation/TtscGenerationProof.d.cts +105 -0
  162. package/lib/core/transform/validation/TtscGenerationProof.d.mts +105 -0
  163. package/lib/core/transform/validation/TtscGenerationProof.d.ts +105 -0
  164. package/lib/core/transform/validation/TtscGenerationProof.js +149 -0
  165. package/lib/core/transform/validation/TtscGenerationProof.js.map +1 -0
  166. package/lib/core/transform/validation/TtscGenerationProof.mjs +149 -0
  167. package/lib/core/transform/validation/TtscGenerationProof.mjs.map +1 -0
  168. package/lib/core/transform/validation/captureUniversalHostInputValidation.js +2 -2
  169. package/lib/core/transform/validation/captureUniversalHostInputValidation.js.map +1 -1
  170. package/lib/core/transform/validation/captureUniversalHostInputValidation.mjs +2 -2
  171. package/lib/core/transform/validation/captureUniversalHostInputValidation.mjs.map +1 -1
  172. package/lib/core/transform/validation/matchesCachedSource.d.cts +18 -15
  173. package/lib/core/transform/validation/matchesCachedSource.d.mts +18 -15
  174. package/lib/core/transform/validation/matchesCachedSource.d.ts +18 -15
  175. package/lib/core/transform/validation/matchesCachedSource.js +28 -22
  176. package/lib/core/transform/validation/matchesCachedSource.js.map +1 -1
  177. package/lib/core/transform/validation/matchesCachedSource.mjs +28 -22
  178. package/lib/core/transform/validation/matchesCachedSource.mjs.map +1 -1
  179. package/lib/core/transform/validation/matchesCompleteInputSnapshot.d.cts +3 -2
  180. package/lib/core/transform/validation/matchesCompleteInputSnapshot.d.mts +3 -2
  181. package/lib/core/transform/validation/matchesCompleteInputSnapshot.d.ts +3 -2
  182. package/lib/core/transform/validation/matchesCompleteInputSnapshot.js +4 -4
  183. package/lib/core/transform/validation/matchesCompleteInputSnapshot.js.map +1 -1
  184. package/lib/core/transform/validation/matchesCompleteInputSnapshot.mjs +4 -4
  185. package/lib/core/transform/validation/matchesCompleteInputSnapshot.mjs.map +1 -1
  186. package/lib/core/transform/validation/matchesNarrowPersistentInputs.d.cts +2 -1
  187. package/lib/core/transform/validation/matchesNarrowPersistentInputs.d.mts +2 -1
  188. package/lib/core/transform/validation/matchesNarrowPersistentInputs.d.ts +2 -1
  189. package/lib/core/transform/validation/matchesNarrowPersistentInputs.js +2 -2
  190. package/lib/core/transform/validation/matchesNarrowPersistentInputs.js.map +1 -1
  191. package/lib/core/transform/validation/matchesNarrowPersistentInputs.mjs +2 -2
  192. package/lib/core/transform/validation/matchesNarrowPersistentInputs.mjs.map +1 -1
  193. package/lib/core/transform/validation/matchesUniversalHostInputTrees.d.cts +3 -2
  194. package/lib/core/transform/validation/matchesUniversalHostInputTrees.d.mts +3 -2
  195. package/lib/core/transform/validation/matchesUniversalHostInputTrees.d.ts +3 -2
  196. package/lib/core/transform/validation/matchesUniversalHostInputTrees.js +7 -5
  197. package/lib/core/transform/validation/matchesUniversalHostInputTrees.js.map +1 -1
  198. package/lib/core/transform/validation/matchesUniversalHostInputTrees.mjs +7 -5
  199. package/lib/core/transform/validation/matchesUniversalHostInputTrees.mjs.map +1 -1
  200. package/lib/core/transform/validation/matchesUniversalHostInputs.d.cts +3 -2
  201. package/lib/core/transform/validation/matchesUniversalHostInputs.d.mts +3 -2
  202. package/lib/core/transform/validation/matchesUniversalHostInputs.d.ts +3 -2
  203. package/lib/core/transform/validation/matchesUniversalHostInputs.js +5 -5
  204. package/lib/core/transform/validation/matchesUniversalHostInputs.js.map +1 -1
  205. package/lib/core/transform/validation/matchesUniversalHostInputs.mjs +5 -5
  206. package/lib/core/transform/validation/matchesUniversalHostInputs.mjs.map +1 -1
  207. package/lib/core/transform/validation/nativeInputPredicatesHold.d.cts +5 -4
  208. package/lib/core/transform/validation/nativeInputPredicatesHold.d.mts +5 -4
  209. package/lib/core/transform/validation/nativeInputPredicatesHold.d.ts +5 -4
  210. package/lib/core/transform/validation/nativeInputPredicatesHold.js +31 -12
  211. package/lib/core/transform/validation/nativeInputPredicatesHold.js.map +1 -1
  212. package/lib/core/transform/validation/nativeInputPredicatesHold.mjs +31 -12
  213. package/lib/core/transform/validation/nativeInputPredicatesHold.mjs.map +1 -1
  214. package/lib/core/transform/validation/notificationsProveProgramUnchanged.d.cts +2 -1
  215. package/lib/core/transform/validation/notificationsProveProgramUnchanged.d.mts +2 -1
  216. package/lib/core/transform/validation/notificationsProveProgramUnchanged.d.ts +2 -1
  217. package/lib/core/transform/validation/notificationsProveProgramUnchanged.js +2 -2
  218. package/lib/core/transform/validation/notificationsProveProgramUnchanged.js.map +1 -1
  219. package/lib/core/transform/validation/notificationsProveProgramUnchanged.mjs +2 -2
  220. package/lib/core/transform/validation/notificationsProveProgramUnchanged.mjs.map +1 -1
  221. package/lib/core/transform/watch/captureWatchInputBaseline.d.cts +4 -0
  222. package/lib/core/transform/watch/captureWatchInputBaseline.d.mts +4 -0
  223. package/lib/core/transform/watch/captureWatchInputBaseline.d.ts +4 -0
  224. package/lib/core/transform/watch/captureWatchInputBaseline.js +3 -0
  225. package/lib/core/transform/watch/captureWatchInputBaseline.js.map +1 -1
  226. package/lib/core/transform/watch/captureWatchInputBaseline.mjs +3 -0
  227. package/lib/core/transform/watch/captureWatchInputBaseline.mjs.map +1 -1
  228. package/lib/core/transform/watch/captureWatchInputBaselines.d.cts +2 -0
  229. package/lib/core/transform/watch/captureWatchInputBaselines.d.mts +2 -0
  230. package/lib/core/transform/watch/captureWatchInputBaselines.d.ts +2 -0
  231. package/lib/core/transform/watch/captureWatchInputBaselines.js +3 -1
  232. package/lib/core/transform/watch/captureWatchInputBaselines.js.map +1 -1
  233. package/lib/core/transform/watch/captureWatchInputBaselines.mjs +3 -1
  234. package/lib/core/transform/watch/captureWatchInputBaselines.mjs.map +1 -1
  235. package/lib/core/transform/watch/notifyWatchInputs.js +3 -0
  236. package/lib/core/transform/watch/notifyWatchInputs.js.map +1 -1
  237. package/lib/core/transform/watch/notifyWatchInputs.mjs +3 -0
  238. package/lib/core/transform/watch/notifyWatchInputs.mjs.map +1 -1
  239. package/lib/core/transform/watch/watchInputEvidenceMatchesDisk.d.cts +5 -2
  240. package/lib/core/transform/watch/watchInputEvidenceMatchesDisk.d.mts +5 -2
  241. package/lib/core/transform/watch/watchInputEvidenceMatchesDisk.d.ts +5 -2
  242. package/lib/core/transform/watch/watchInputEvidenceMatchesDisk.js +6 -3
  243. package/lib/core/transform/watch/watchInputEvidenceMatchesDisk.js.map +1 -1
  244. package/lib/core/transform/watch/watchInputEvidenceMatchesDisk.mjs +6 -3
  245. package/lib/core/transform/watch/watchInputEvidenceMatchesDisk.mjs.map +1 -1
  246. package/lib/core/turbopack/turbopack.js +2 -1
  247. package/lib/core/turbopack/turbopack.js.map +1 -1
  248. package/lib/core/turbopack/turbopack.mjs +2 -1
  249. package/lib/core/turbopack/turbopack.mjs.map +1 -1
  250. package/package.json +3 -3
  251. package/src/core/bridge/projectRecordMoved.ts +3 -1
  252. package/src/core/bun/bun.ts +8 -4
  253. package/src/core/observer/createInputObserver.ts +8 -5
  254. package/src/core/observer/openIsolatedRecursiveWatch.ts +11 -12
  255. package/src/core/transform/cache/TtscCachedProjectTransform.ts +13 -3
  256. package/src/core/transform/cache/selectCachedGenerationAction.ts +9 -1
  257. package/src/core/transform/deliverCachedTransform.ts +97 -0
  258. package/src/core/transform/envelope/selectDeclaredProjectInputKeys.ts +5 -2
  259. package/src/core/transform/envelope/selectExternalInputPaths.ts +7 -7
  260. package/src/core/transform/filesystem/TtscTransformFilesystemOperations.ts +15 -12
  261. package/src/core/transform/generation/captureFailedGenerationInputStates.ts +1 -0
  262. package/src/core/transform/generation/captureTransformGeneration.ts +6 -1
  263. package/src/core/transform/generation/failedGenerationEnvironmentChanged.ts +12 -2
  264. package/src/core/transform/generation/selectTransformAttemptDisposition.ts +3 -1
  265. package/src/core/transform/generation/transformProject.ts +13 -9
  266. package/src/core/transform/inputs/pluginSourceFilesDigest.ts +11 -4
  267. package/src/core/transform/inputs/pluginSourceHolds.ts +13 -3
  268. package/src/core/transform/inputs/pluginSourceState.ts +8 -2
  269. package/src/core/transform/inputs/preparePluginBuildEnvironments.ts +64 -11
  270. package/src/core/transform/tracker/broker/WatchBroker.ts +15 -4
  271. package/src/core/transform/tracker/broker/WatchBrokerTransport.ts +82 -0
  272. package/src/core/transform/tracker/broker/drainWatchBroker.ts +12 -13
  273. package/src/core/transform/tracker/broker/getWatchBroker.ts +89 -18
  274. package/src/core/transform/tracker/broker/openBrokeredWatch.ts +11 -14
  275. package/src/core/transform/tracker/broker/usesWatchBroker.ts +7 -7
  276. package/src/core/transform/tracker/broker/watchBrokerSource.ts +10 -11
  277. package/src/core/transform/transformTtsc.ts +38 -92
  278. package/src/core/transform/validation/TtscGenerationProof.ts +201 -0
  279. package/src/core/transform/validation/captureUniversalHostInputValidation.ts +2 -1
  280. package/src/core/transform/validation/matchesCachedSource.ts +27 -21
  281. package/src/core/transform/validation/matchesCompleteInputSnapshot.ts +5 -3
  282. package/src/core/transform/validation/matchesNarrowPersistentInputs.ts +3 -1
  283. package/src/core/transform/validation/matchesUniversalHostInputTrees.ts +8 -3
  284. package/src/core/transform/validation/matchesUniversalHostInputs.ts +6 -4
  285. package/src/core/transform/validation/nativeInputPredicatesHold.ts +36 -14
  286. package/src/core/transform/validation/notificationsProveProgramUnchanged.ts +3 -1
  287. package/src/core/transform/watch/captureWatchInputBaseline.ts +4 -0
  288. package/src/core/transform/watch/captureWatchInputBaselines.ts +7 -1
  289. package/src/core/transform/watch/notifyWatchInputs.ts +3 -0
  290. package/src/core/transform/watch/watchInputEvidenceMatchesDisk.ts +12 -2
  291. package/src/core/turbopack/turbopack.ts +2 -1
@@ -1,27 +1,40 @@
1
1
  import type { TtscCachedProjectTransform } from "../cache/TtscCachedProjectTransform";
2
2
  import type { TtscTransformFilesystemOperations } from "../filesystem/TtscTransformFilesystemOperations";
3
3
  /**
4
- * Prepare actual plugin toolchain authority before synchronous input proofs.
4
+ * Qualify actual plugin toolchain authority before synchronous input proofs.
5
5
  * Cold Go/environment/SDK work stays off the host thread. A mismatch requests
6
6
  * one fresh native environment reading; observation failure remains unavailable
7
7
  * and the following admission or replay validator retains its failure policy. A
8
8
  * resident generation can reuse its exact proven source state while healthy
9
9
  * notifications and the still-qualified environment witness both hold. Native
10
- * environment preparation remains mandatory; source events cannot prove it.
10
+ * environment authority remains mandatory; source events cannot prove it.
11
+ *
12
+ * WARNING (#1712): yield before observing queued source changes, then qualify
13
+ * all current readings in one synchronous batch. Missing readings require an
14
+ * await and a fresh batch afterward. Source comparisons may request native
15
+ * refreshes; the caller must establish another current proof after those
16
+ * awaits. Never preserve a positive batch across an await or replay the SDK
17
+ * witness independently for every plugin and nested validator.
18
+ *
19
+ * The project root reaches ttsc's environment worker, so that isolate proves
20
+ * the Go SDK and executables from the plugin cache's records instead of reading
21
+ * 135 MB of SDK once per bundler or runtime process (samchon/ttsc#1722).
11
22
  *
12
23
  * @param cached Optional resident generation whose existing source-state and
13
24
  * environment witness may qualify source reuse. Other preparation owners
14
25
  * retain direct source comparison.
15
- * @evidence contracts/common.md#principled-implementation Every reported plugin directory prepares its actual current environment. The same result's matching manifest state can share source proof only with a healthy exact-source tracker and the environment under which that tree was proven. Otherwise this operation compares source state once and a mismatch refreshes environment authority for the following owning validator to compare again; failed preparation cannot qualify an input.
26
+ * @param projectRoot Project whose plugin cache holds those records; the
27
+ * resident generation's own root when omitted.
28
+ * @evidence contracts/common.md#principled-implementation Every reported plugin directory qualifies current environment authority; only missing readings require asynchronous preparation. The same result's matching manifest state can share source proof only with a healthy exact-source tracker and the environment under which that tree was proven. Otherwise this operation compares source state once and a mismatch refreshes environment authority for the following owning validator to compare again; failed preparation cannot qualify an input.
16
29
  * @evidence contracts/common.md#clear-and-simple-design One async boundary precedes existing synchronous generation, delivery and terminal proofs.
17
30
  * @evidence contracts/common.md#prohibited-implementation-shortcuts Missing observations stay unproved; reported binary state never substitutes for native environment preparation or source comparison.
18
31
  * @evidence contracts/common.md#meaningful-documentation Native prose identifies off-thread work, mismatch refresh and preserved downstream failure ownership.
19
32
  * @evidence contracts/portability.md#os-neutral-implementation The same native toolchain/environment reader and caller filesystem source digest qualify each directory without platform guesses.
20
- * @evidence contracts/performance.md#efficient-algorithms The envelope selector builds its directory map once per result, and preparation visits each reported directory once. Environment requests build keys from effective variables and qualify native dependencies. A qualified source witness avoids enumeration; other source comparisons enumerate and sort files, check metadata and hash bytes when the digest cannot be reused. A mismatch requests one environment refresh rather than a second source comparison here.
33
+ * @evidence contracts/performance.md#efficient-algorithms The envelope selector indexes directories once per result. Linear directory passes batch-qualify current readings, prepare missing authority, compare source state and refresh mismatches. Each synchronous batch hashes variables once and shares distinct native dependencies; any preparation await requires another current batch. A qualified source witness avoids enumeration; other source comparisons enumerate and sort files, check metadata and hash bytes when the digest cannot be reused. A mismatch requests one environment refresh rather than a second source comparison here.
21
34
  * @evidence contracts/performance.md#reuse-equivalent-work The environment owner shares equivalent in-flight requests and still-qualified readings. Resident source proof is reused only for the exact result and manifest digest, unchanged qualified environment and currently healthy covered source notifications; absent, dirty, replaced or unavailable witnesses retain direct proof. No epoch or quiet watcher alone authorizes reuse, and subsequent admission still owns its current validation.
22
35
  * @evidence contracts/performance.md#bound-retention-and-release-resources This module records asynchronous execution ownership in a WeakSet before preparation, including failures, so disposed results are not retained. Requests and worker lifetimes remain with the environment owner; this sequential operation awaits each request and acquires no native observer or independent cancellation handle.
23
36
  */
24
- export declare function preparePluginBuildEnvironments(result: TtscCachedProjectTransform["result"], filesystem: TtscTransformFilesystemOperations, cached?: TtscCachedProjectTransform): Promise<void>;
37
+ export declare function preparePluginBuildEnvironments(result: TtscCachedProjectTransform["result"], filesystem: TtscTransformFilesystemOperations, cached?: TtscCachedProjectTransform, projectRoot?: string | undefined): Promise<void>;
25
38
  /**
26
39
  * Whether this result's owner attempted asynchronous native preparation. This
27
40
  * records execution ownership, never successful observation authority.
@@ -10,32 +10,67 @@ var pluginSourceHolds = require('./pluginSourceHolds.js');
10
10
  // async proofs cannot silently fall back to it after an unavailable reading.
11
11
  const asyncResults = new WeakSet();
12
12
  /**
13
- * Prepare actual plugin toolchain authority before synchronous input proofs.
13
+ * Qualify actual plugin toolchain authority before synchronous input proofs.
14
14
  * Cold Go/environment/SDK work stays off the host thread. A mismatch requests
15
15
  * one fresh native environment reading; observation failure remains unavailable
16
16
  * and the following admission or replay validator retains its failure policy. A
17
17
  * resident generation can reuse its exact proven source state while healthy
18
18
  * notifications and the still-qualified environment witness both hold. Native
19
- * environment preparation remains mandatory; source events cannot prove it.
19
+ * environment authority remains mandatory; source events cannot prove it.
20
+ *
21
+ * WARNING (#1712): yield before observing queued source changes, then qualify
22
+ * all current readings in one synchronous batch. Missing readings require an
23
+ * await and a fresh batch afterward. Source comparisons may request native
24
+ * refreshes; the caller must establish another current proof after those
25
+ * awaits. Never preserve a positive batch across an await or replay the SDK
26
+ * witness independently for every plugin and nested validator.
27
+ *
28
+ * The project root reaches ttsc's environment worker, so that isolate proves
29
+ * the Go SDK and executables from the plugin cache's records instead of reading
30
+ * 135 MB of SDK once per bundler or runtime process (samchon/ttsc#1722).
20
31
  *
21
32
  * @param cached Optional resident generation whose existing source-state and
22
33
  * environment witness may qualify source reuse. Other preparation owners
23
34
  * retain direct source comparison.
24
- * @evidence contracts/common.md#principled-implementation Every reported plugin directory prepares its actual current environment. The same result's matching manifest state can share source proof only with a healthy exact-source tracker and the environment under which that tree was proven. Otherwise this operation compares source state once and a mismatch refreshes environment authority for the following owning validator to compare again; failed preparation cannot qualify an input.
35
+ * @param projectRoot Project whose plugin cache holds those records; the
36
+ * resident generation's own root when omitted.
37
+ * @evidence contracts/common.md#principled-implementation Every reported plugin directory qualifies current environment authority; only missing readings require asynchronous preparation. The same result's matching manifest state can share source proof only with a healthy exact-source tracker and the environment under which that tree was proven. Otherwise this operation compares source state once and a mismatch refreshes environment authority for the following owning validator to compare again; failed preparation cannot qualify an input.
25
38
  * @evidence contracts/common.md#clear-and-simple-design One async boundary precedes existing synchronous generation, delivery and terminal proofs.
26
39
  * @evidence contracts/common.md#prohibited-implementation-shortcuts Missing observations stay unproved; reported binary state never substitutes for native environment preparation or source comparison.
27
40
  * @evidence contracts/common.md#meaningful-documentation Native prose identifies off-thread work, mismatch refresh and preserved downstream failure ownership.
28
41
  * @evidence contracts/portability.md#os-neutral-implementation The same native toolchain/environment reader and caller filesystem source digest qualify each directory without platform guesses.
29
- * @evidence contracts/performance.md#efficient-algorithms The envelope selector builds its directory map once per result, and preparation visits each reported directory once. Environment requests build keys from effective variables and qualify native dependencies. A qualified source witness avoids enumeration; other source comparisons enumerate and sort files, check metadata and hash bytes when the digest cannot be reused. A mismatch requests one environment refresh rather than a second source comparison here.
42
+ * @evidence contracts/performance.md#efficient-algorithms The envelope selector indexes directories once per result. Linear directory passes batch-qualify current readings, prepare missing authority, compare source state and refresh mismatches. Each synchronous batch hashes variables once and shares distinct native dependencies; any preparation await requires another current batch. A qualified source witness avoids enumeration; other source comparisons enumerate and sort files, check metadata and hash bytes when the digest cannot be reused. A mismatch requests one environment refresh rather than a second source comparison here.
30
43
  * @evidence contracts/performance.md#reuse-equivalent-work The environment owner shares equivalent in-flight requests and still-qualified readings. Resident source proof is reused only for the exact result and manifest digest, unchanged qualified environment and currently healthy covered source notifications; absent, dirty, replaced or unavailable witnesses retain direct proof. No epoch or quiet watcher alone authorizes reuse, and subsequent admission still owns its current validation.
31
44
  * @evidence contracts/performance.md#bound-retention-and-release-resources This module records asynchronous execution ownership in a WeakSet before preparation, including failures, so disposed results are not retained. Requests and worker lifetimes remain with the environment owner; this sequential operation awaits each request and acquires no native observer or independent cancellation handle.
32
45
  */
33
- async function preparePluginBuildEnvironments(result, filesystem, cached) {
46
+ async function preparePluginBuildEnvironments(result, filesystem, cached, projectRoot = cached?.projectRoot) {
34
47
  asyncResults.add(result);
35
- for (const [directory, state] of selectPluginSourceInputs.selectPluginSourceInputs(result)) {
48
+ const sources = selectPluginSourceInputs.selectPluginSourceInputs(result);
49
+ // Preserve the async preparation boundary even for warm environments.
50
+ // Events queued by the caller before awaiting preparation must participate
51
+ // in the source witness below. Observe the batch after this yield, never
52
+ // carry a positive environment observation across it (#1712).
53
+ await Promise.resolve();
54
+ const current = pluginSource.PluginBuildEnvironmentReadings.cachedAll(sources.keys());
55
+ let awaited = false;
56
+ for (const directory of sources.keys()) {
57
+ if (current.get(directory) !== undefined)
58
+ continue;
59
+ awaited = true;
60
+ try {
61
+ await pluginSource.PluginBuildEnvironmentReadings.prepare(directory, false, projectRoot);
62
+ }
63
+ catch {
64
+ // Keep unavailable authority for admission rather than cold fallback.
65
+ }
66
+ }
67
+ const environments = awaited
68
+ ? pluginSource.PluginBuildEnvironmentReadings.cachedAll(sources.keys())
69
+ : current;
70
+ const refresh = [];
71
+ for (const [directory, state] of sources) {
36
72
  try {
37
- await pluginSource.PluginBuildEnvironmentReadings.prepare(directory);
38
- const environment = pluginSource.PluginBuildEnvironmentReadings.cached(directory);
73
+ const environment = environments.get(directory);
39
74
  if (cached?.result === result &&
40
75
  cached.hostInputValidation?.trees.get(directory) === state &&
41
76
  environment !== undefined &&
@@ -43,16 +78,22 @@ async function preparePluginBuildEnvironments(result, filesystem, cached) {
43
78
  environment &&
44
79
  trackerProvesInputUnchanged.trackerProvesInputUnchanged(cached.hostInputMutationTracker, directory))
45
80
  continue;
46
- if (!pluginSourceHolds.pluginSourceHolds(directory, state, filesystem, {
47
- environment,
48
- }))
49
- await pluginSource.PluginBuildEnvironmentReadings.prepare(directory, true);
81
+ if (!pluginSourceHolds.pluginSourceHolds(directory, state, filesystem, { environment }, projectRoot))
82
+ refresh.push(directory);
50
83
  }
51
84
  catch {
52
85
  // Admission and terminal recovery interpret unavailable proof in their
53
86
  // own domain; this boundary never upgrades it to a successful reading.
54
87
  }
55
88
  }
89
+ for (const directory of refresh) {
90
+ try {
91
+ await pluginSource.PluginBuildEnvironmentReadings.prepare(directory, true, projectRoot);
92
+ }
93
+ catch {
94
+ // Synchronous admission requalifies after this asynchronous window.
95
+ }
96
+ }
56
97
  }
57
98
  /**
58
99
  * Whether this result's owner attempted asynchronous native preparation. This
@@ -1 +1 @@
1
- {"version":3,"file":"preparePluginBuildEnvironments.js","sources":["../../../../src/core/transform/inputs/preparePluginBuildEnvironments.ts"],"sourcesContent":[null],"names":["selectPluginSourceInputs","PluginBuildEnvironmentReadings","trackerProvesInputUnchanged","pluginSourceHolds"],"mappings":";;;;;;;AAQA;AACA;AACA;AACA,MAAM,YAAY,GAAG,IAAI,OAAO,EAAU;AAE1C;;;;;;;;;;;;;;;;;;;;AAoBG;AACI,eAAe,8BAA8B,CAClD,MAA4C,EAC5C,UAA6C,EAC7C,MAAmC,EAAA;AAEnC,IAAA,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC;AACxB,IAAA,KAAK,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,IAAIA,iDAAwB,CAAC,MAAM,CAAC,EAAE;AACjE,QAAA,IAAI;AACF,YAAA,MAAMC,2CAA8B,CAAC,OAAO,CAAC,SAAS,CAAC;YACvD,MAAM,WAAW,GAAGA,2CAA8B,CAAC,MAAM,CAAC,SAAS,CAAC;AACpE,YAAA,IACE,MAAM,EAAE,MAAM,KAAK,MAAM;gBACzB,MAAM,CAAC,mBAAmB,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,KAAK;AAC1D,gBAAA,WAAW,KAAK,SAAS;gBACzB,MAAM,CAAC,mBAAmB,CAAC,gBAAgB,EAAE,GAAG,CAAC,SAAS,CAAC;oBACzD,WAAW;AACb,gBAAAC,uDAA2B,CAAC,MAAM,CAAC,wBAAwB,EAAE,SAAS,CAAC;gBAEvE;YACF,IACE,CAACC,mCAAiB,CAAC,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE;gBAC/C,WAAW;aACZ,CAAC;gBAEF,MAAMF,2CAA8B,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC;QACjE;AAAE,QAAA,MAAM;;;QAGR;IACF;AACF;AAEA;;;;;;;;;;;;AAYG;AACG,SAAU,mCAAmC,CACjD,MAA4C,EAAA;AAE5C,IAAA,OAAO,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC;AACjC;;;;;"}
1
+ {"version":3,"file":"preparePluginBuildEnvironments.js","sources":["../../../../src/core/transform/inputs/preparePluginBuildEnvironments.ts"],"sourcesContent":[null],"names":["selectPluginSourceInputs","PluginBuildEnvironmentReadings","trackerProvesInputUnchanged","pluginSourceHolds"],"mappings":";;;;;;;AAQA;AACA;AACA;AACA,MAAM,YAAY,GAAG,IAAI,OAAO,EAAU;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCG;AACI,eAAe,8BAA8B,CAClD,MAA4C,EAC5C,UAA6C,EAC7C,MAAmC,EACnC,WAAA,GAAkC,MAAM,EAAE,WAAW,EAAA;AAErD,IAAA,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC;AACxB,IAAA,MAAM,OAAO,GAAGA,iDAAwB,CAAC,MAAM,CAAC;;;;;AAKhD,IAAA,MAAM,OAAO,CAAC,OAAO,EAAE;IACvB,MAAM,OAAO,GAAGC,2CAA8B,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACxE,IAAI,OAAO,GAAG,KAAK;IACnB,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,IAAI,EAAE,EAAE;AACtC,QAAA,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,SAAS;YAAE;QAC1C,OAAO,GAAG,IAAI;AACd,QAAA,IAAI;YACF,MAAMA,2CAA8B,CAAC,OAAO,CAC1C,SAAS,EACT,KAAK,EACL,WAAW,CACZ;QACH;AAAE,QAAA,MAAM;;QAER;IACF;IACA,MAAM,YAAY,GAAG;UACjBA,2CAA8B,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE;UACvD,OAAO;IACX,MAAM,OAAO,GAAa,EAAE;IAC5B,KAAK,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,OAAO,EAAE;AACxC,QAAA,IAAI;YACF,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC;AAC/C,YAAA,IACE,MAAM,EAAE,MAAM,KAAK,MAAM;gBACzB,MAAM,CAAC,mBAAmB,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,KAAK;AAC1D,gBAAA,WAAW,KAAK,SAAS;gBACzB,MAAM,CAAC,mBAAmB,CAAC,gBAAgB,EAAE,GAAG,CAAC,SAAS,CAAC;oBACzD,WAAW;AACb,gBAAAC,uDAA2B,CAAC,MAAM,CAAC,wBAAwB,EAAE,SAAS,CAAC;gBAEvE;AACF,YAAA,IACE,CAACC,mCAAiB,CAChB,SAAS,EACT,KAAK,EACL,UAAU,EACV,EAAE,WAAW,EAAE,EACf,WAAW,CACZ;AAED,gBAAA,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC;QAC3B;AAAE,QAAA,MAAM;;;QAGR;IACF;AACA,IAAA,KAAK,MAAM,SAAS,IAAI,OAAO,EAAE;AAC/B,QAAA,IAAI;YACF,MAAMF,2CAA8B,CAAC,OAAO,CAC1C,SAAS,EACT,IAAI,EACJ,WAAW,CACZ;QACH;AAAE,QAAA,MAAM;;QAER;IACF;AACF;AAEA;;;;;;;;;;;;AAYG;AACG,SAAU,mCAAmC,CACjD,MAA4C,EAAA;AAE5C,IAAA,OAAO,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC;AACjC;;;;;"}
@@ -8,32 +8,67 @@ import { pluginSourceHolds } from './pluginSourceHolds.mjs';
8
8
  // async proofs cannot silently fall back to it after an unavailable reading.
9
9
  const asyncResults = new WeakSet();
10
10
  /**
11
- * Prepare actual plugin toolchain authority before synchronous input proofs.
11
+ * Qualify actual plugin toolchain authority before synchronous input proofs.
12
12
  * Cold Go/environment/SDK work stays off the host thread. A mismatch requests
13
13
  * one fresh native environment reading; observation failure remains unavailable
14
14
  * and the following admission or replay validator retains its failure policy. A
15
15
  * resident generation can reuse its exact proven source state while healthy
16
16
  * notifications and the still-qualified environment witness both hold. Native
17
- * environment preparation remains mandatory; source events cannot prove it.
17
+ * environment authority remains mandatory; source events cannot prove it.
18
+ *
19
+ * WARNING (#1712): yield before observing queued source changes, then qualify
20
+ * all current readings in one synchronous batch. Missing readings require an
21
+ * await and a fresh batch afterward. Source comparisons may request native
22
+ * refreshes; the caller must establish another current proof after those
23
+ * awaits. Never preserve a positive batch across an await or replay the SDK
24
+ * witness independently for every plugin and nested validator.
25
+ *
26
+ * The project root reaches ttsc's environment worker, so that isolate proves
27
+ * the Go SDK and executables from the plugin cache's records instead of reading
28
+ * 135 MB of SDK once per bundler or runtime process (samchon/ttsc#1722).
18
29
  *
19
30
  * @param cached Optional resident generation whose existing source-state and
20
31
  * environment witness may qualify source reuse. Other preparation owners
21
32
  * retain direct source comparison.
22
- * @evidence contracts/common.md#principled-implementation Every reported plugin directory prepares its actual current environment. The same result's matching manifest state can share source proof only with a healthy exact-source tracker and the environment under which that tree was proven. Otherwise this operation compares source state once and a mismatch refreshes environment authority for the following owning validator to compare again; failed preparation cannot qualify an input.
33
+ * @param projectRoot Project whose plugin cache holds those records; the
34
+ * resident generation's own root when omitted.
35
+ * @evidence contracts/common.md#principled-implementation Every reported plugin directory qualifies current environment authority; only missing readings require asynchronous preparation. The same result's matching manifest state can share source proof only with a healthy exact-source tracker and the environment under which that tree was proven. Otherwise this operation compares source state once and a mismatch refreshes environment authority for the following owning validator to compare again; failed preparation cannot qualify an input.
23
36
  * @evidence contracts/common.md#clear-and-simple-design One async boundary precedes existing synchronous generation, delivery and terminal proofs.
24
37
  * @evidence contracts/common.md#prohibited-implementation-shortcuts Missing observations stay unproved; reported binary state never substitutes for native environment preparation or source comparison.
25
38
  * @evidence contracts/common.md#meaningful-documentation Native prose identifies off-thread work, mismatch refresh and preserved downstream failure ownership.
26
39
  * @evidence contracts/portability.md#os-neutral-implementation The same native toolchain/environment reader and caller filesystem source digest qualify each directory without platform guesses.
27
- * @evidence contracts/performance.md#efficient-algorithms The envelope selector builds its directory map once per result, and preparation visits each reported directory once. Environment requests build keys from effective variables and qualify native dependencies. A qualified source witness avoids enumeration; other source comparisons enumerate and sort files, check metadata and hash bytes when the digest cannot be reused. A mismatch requests one environment refresh rather than a second source comparison here.
40
+ * @evidence contracts/performance.md#efficient-algorithms The envelope selector indexes directories once per result. Linear directory passes batch-qualify current readings, prepare missing authority, compare source state and refresh mismatches. Each synchronous batch hashes variables once and shares distinct native dependencies; any preparation await requires another current batch. A qualified source witness avoids enumeration; other source comparisons enumerate and sort files, check metadata and hash bytes when the digest cannot be reused. A mismatch requests one environment refresh rather than a second source comparison here.
28
41
  * @evidence contracts/performance.md#reuse-equivalent-work The environment owner shares equivalent in-flight requests and still-qualified readings. Resident source proof is reused only for the exact result and manifest digest, unchanged qualified environment and currently healthy covered source notifications; absent, dirty, replaced or unavailable witnesses retain direct proof. No epoch or quiet watcher alone authorizes reuse, and subsequent admission still owns its current validation.
29
42
  * @evidence contracts/performance.md#bound-retention-and-release-resources This module records asynchronous execution ownership in a WeakSet before preparation, including failures, so disposed results are not retained. Requests and worker lifetimes remain with the environment owner; this sequential operation awaits each request and acquires no native observer or independent cancellation handle.
30
43
  */
31
- async function preparePluginBuildEnvironments(result, filesystem, cached) {
44
+ async function preparePluginBuildEnvironments(result, filesystem, cached, projectRoot = cached?.projectRoot) {
32
45
  asyncResults.add(result);
33
- for (const [directory, state] of selectPluginSourceInputs(result)) {
46
+ const sources = selectPluginSourceInputs(result);
47
+ // Preserve the async preparation boundary even for warm environments.
48
+ // Events queued by the caller before awaiting preparation must participate
49
+ // in the source witness below. Observe the batch after this yield, never
50
+ // carry a positive environment observation across it (#1712).
51
+ await Promise.resolve();
52
+ const current = PluginBuildEnvironmentReadings.cachedAll(sources.keys());
53
+ let awaited = false;
54
+ for (const directory of sources.keys()) {
55
+ if (current.get(directory) !== undefined)
56
+ continue;
57
+ awaited = true;
58
+ try {
59
+ await PluginBuildEnvironmentReadings.prepare(directory, false, projectRoot);
60
+ }
61
+ catch {
62
+ // Keep unavailable authority for admission rather than cold fallback.
63
+ }
64
+ }
65
+ const environments = awaited
66
+ ? PluginBuildEnvironmentReadings.cachedAll(sources.keys())
67
+ : current;
68
+ const refresh = [];
69
+ for (const [directory, state] of sources) {
34
70
  try {
35
- await PluginBuildEnvironmentReadings.prepare(directory);
36
- const environment = PluginBuildEnvironmentReadings.cached(directory);
71
+ const environment = environments.get(directory);
37
72
  if (cached?.result === result &&
38
73
  cached.hostInputValidation?.trees.get(directory) === state &&
39
74
  environment !== undefined &&
@@ -41,16 +76,22 @@ async function preparePluginBuildEnvironments(result, filesystem, cached) {
41
76
  environment &&
42
77
  trackerProvesInputUnchanged(cached.hostInputMutationTracker, directory))
43
78
  continue;
44
- if (!pluginSourceHolds(directory, state, filesystem, {
45
- environment,
46
- }))
47
- await PluginBuildEnvironmentReadings.prepare(directory, true);
79
+ if (!pluginSourceHolds(directory, state, filesystem, { environment }, projectRoot))
80
+ refresh.push(directory);
48
81
  }
49
82
  catch {
50
83
  // Admission and terminal recovery interpret unavailable proof in their
51
84
  // own domain; this boundary never upgrades it to a successful reading.
52
85
  }
53
86
  }
87
+ for (const directory of refresh) {
88
+ try {
89
+ await PluginBuildEnvironmentReadings.prepare(directory, true, projectRoot);
90
+ }
91
+ catch {
92
+ // Synchronous admission requalifies after this asynchronous window.
93
+ }
94
+ }
54
95
  }
55
96
  /**
56
97
  * Whether this result's owner attempted asynchronous native preparation. This
@@ -1 +1 @@
1
- {"version":3,"file":"preparePluginBuildEnvironments.mjs","sources":["../../../../src/core/transform/inputs/preparePluginBuildEnvironments.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAQA;AACA;AACA;AACA,MAAM,YAAY,GAAG,IAAI,OAAO,EAAU;AAE1C;;;;;;;;;;;;;;;;;;;;AAoBG;AACI,eAAe,8BAA8B,CAClD,MAA4C,EAC5C,UAA6C,EAC7C,MAAmC,EAAA;AAEnC,IAAA,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC;AACxB,IAAA,KAAK,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,wBAAwB,CAAC,MAAM,CAAC,EAAE;AACjE,QAAA,IAAI;AACF,YAAA,MAAM,8BAA8B,CAAC,OAAO,CAAC,SAAS,CAAC;YACvD,MAAM,WAAW,GAAG,8BAA8B,CAAC,MAAM,CAAC,SAAS,CAAC;AACpE,YAAA,IACE,MAAM,EAAE,MAAM,KAAK,MAAM;gBACzB,MAAM,CAAC,mBAAmB,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,KAAK;AAC1D,gBAAA,WAAW,KAAK,SAAS;gBACzB,MAAM,CAAC,mBAAmB,CAAC,gBAAgB,EAAE,GAAG,CAAC,SAAS,CAAC;oBACzD,WAAW;AACb,gBAAA,2BAA2B,CAAC,MAAM,CAAC,wBAAwB,EAAE,SAAS,CAAC;gBAEvE;YACF,IACE,CAAC,iBAAiB,CAAC,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE;gBAC/C,WAAW;aACZ,CAAC;gBAEF,MAAM,8BAA8B,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC;QACjE;AAAE,QAAA,MAAM;;;QAGR;IACF;AACF;AAEA;;;;;;;;;;;;AAYG;AACG,SAAU,mCAAmC,CACjD,MAA4C,EAAA;AAE5C,IAAA,OAAO,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC;AACjC;;;;"}
1
+ {"version":3,"file":"preparePluginBuildEnvironments.mjs","sources":["../../../../src/core/transform/inputs/preparePluginBuildEnvironments.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAQA;AACA;AACA;AACA,MAAM,YAAY,GAAG,IAAI,OAAO,EAAU;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCG;AACI,eAAe,8BAA8B,CAClD,MAA4C,EAC5C,UAA6C,EAC7C,MAAmC,EACnC,WAAA,GAAkC,MAAM,EAAE,WAAW,EAAA;AAErD,IAAA,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC;AACxB,IAAA,MAAM,OAAO,GAAG,wBAAwB,CAAC,MAAM,CAAC;;;;;AAKhD,IAAA,MAAM,OAAO,CAAC,OAAO,EAAE;IACvB,MAAM,OAAO,GAAG,8BAA8B,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACxE,IAAI,OAAO,GAAG,KAAK;IACnB,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,IAAI,EAAE,EAAE;AACtC,QAAA,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,SAAS;YAAE;QAC1C,OAAO,GAAG,IAAI;AACd,QAAA,IAAI;YACF,MAAM,8BAA8B,CAAC,OAAO,CAC1C,SAAS,EACT,KAAK,EACL,WAAW,CACZ;QACH;AAAE,QAAA,MAAM;;QAER;IACF;IACA,MAAM,YAAY,GAAG;UACjB,8BAA8B,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE;UACvD,OAAO;IACX,MAAM,OAAO,GAAa,EAAE;IAC5B,KAAK,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,OAAO,EAAE;AACxC,QAAA,IAAI;YACF,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC;AAC/C,YAAA,IACE,MAAM,EAAE,MAAM,KAAK,MAAM;gBACzB,MAAM,CAAC,mBAAmB,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,KAAK;AAC1D,gBAAA,WAAW,KAAK,SAAS;gBACzB,MAAM,CAAC,mBAAmB,CAAC,gBAAgB,EAAE,GAAG,CAAC,SAAS,CAAC;oBACzD,WAAW;AACb,gBAAA,2BAA2B,CAAC,MAAM,CAAC,wBAAwB,EAAE,SAAS,CAAC;gBAEvE;AACF,YAAA,IACE,CAAC,iBAAiB,CAChB,SAAS,EACT,KAAK,EACL,UAAU,EACV,EAAE,WAAW,EAAE,EACf,WAAW,CACZ;AAED,gBAAA,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC;QAC3B;AAAE,QAAA,MAAM;;;QAGR;IACF;AACA,IAAA,KAAK,MAAM,SAAS,IAAI,OAAO,EAAE;AAC/B,QAAA,IAAI;YACF,MAAM,8BAA8B,CAAC,OAAO,CAC1C,SAAS,EACT,IAAI,EACJ,WAAW,CACZ;QACH;AAAE,QAAA,MAAM;;QAER;IACF;AACF;AAEA;;;;;;;;;;;;AAYG;AACG,SAAU,mCAAmC,CACjD,MAA4C,EAAA;AAE5C,IAAA,OAAO,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC;AACjC;;;;"}
@@ -4,10 +4,11 @@ import type { WatchBrokerRegistration } from "./WatchBrokerRegistration.cjs";
4
4
  * The live state of the isolated watch process.
5
5
  *
6
6
  * The broker multiplexes every Windows and macOS watch of the process over one
7
- * IPC channel, a tracker's and an input observer's scope's alike. Registrations
8
- * and drains are counted so the channel is referenced only while a reply is
9
- * outstanding, and each registration keeps the sink its messages go to and the
10
- * spelling map that translates the child's canonical paths back to its own.
7
+ * ordered transport, a tracker's and an input observer's scope's alike. Windows
8
+ * uses the native helper's stdio; macOS uses Node IPC. Registrations and drains
9
+ * are counted so the channel is referenced only while a reply is outstanding,
10
+ * and each registration keeps the sink its messages go to and the spelling map
11
+ * that translates the child's canonical paths back to its own.
11
12
  *
12
13
  * @evidence contracts/common.md#principled-implementation
13
14
  * Registration and request ids distinguish multiplexed owners; drain scopes
@@ -35,6 +36,15 @@ import type { WatchBrokerRegistration } from "./WatchBrokerRegistration.cjs";
35
36
  export interface WatchBroker {
36
37
  /** The isolated watch process; unreferenced whenever no reply is outstanding. */
37
38
  child: ChildProcess;
39
+ /**
40
+ * Native stdio transport on Windows; absent for the macOS IPC broker and
41
+ * explicit test transports.
42
+ */
43
+ transport?: {
44
+ send(message: unknown): boolean;
45
+ reference(active: boolean): void;
46
+ close(): void;
47
+ };
38
48
  /**
39
49
  * Round-trips awaiting the child's reply, by request id, each released with
40
50
  * whether the child answered it.
@@ -4,10 +4,11 @@ import type { WatchBrokerRegistration } from "./WatchBrokerRegistration.mjs";
4
4
  * The live state of the isolated watch process.
5
5
  *
6
6
  * The broker multiplexes every Windows and macOS watch of the process over one
7
- * IPC channel, a tracker's and an input observer's scope's alike. Registrations
8
- * and drains are counted so the channel is referenced only while a reply is
9
- * outstanding, and each registration keeps the sink its messages go to and the
10
- * spelling map that translates the child's canonical paths back to its own.
7
+ * ordered transport, a tracker's and an input observer's scope's alike. Windows
8
+ * uses the native helper's stdio; macOS uses Node IPC. Registrations and drains
9
+ * are counted so the channel is referenced only while a reply is outstanding,
10
+ * and each registration keeps the sink its messages go to and the spelling map
11
+ * that translates the child's canonical paths back to its own.
11
12
  *
12
13
  * @evidence contracts/common.md#principled-implementation
13
14
  * Registration and request ids distinguish multiplexed owners; drain scopes
@@ -35,6 +36,15 @@ import type { WatchBrokerRegistration } from "./WatchBrokerRegistration.mjs";
35
36
  export interface WatchBroker {
36
37
  /** The isolated watch process; unreferenced whenever no reply is outstanding. */
37
38
  child: ChildProcess;
39
+ /**
40
+ * Native stdio transport on Windows; absent for the macOS IPC broker and
41
+ * explicit test transports.
42
+ */
43
+ transport?: {
44
+ send(message: unknown): boolean;
45
+ reference(active: boolean): void;
46
+ close(): void;
47
+ };
38
48
  /**
39
49
  * Round-trips awaiting the child's reply, by request id, each released with
40
50
  * whether the child answered it.
@@ -4,10 +4,11 @@ import type { WatchBrokerRegistration } from "./WatchBrokerRegistration";
4
4
  * The live state of the isolated watch process.
5
5
  *
6
6
  * The broker multiplexes every Windows and macOS watch of the process over one
7
- * IPC channel, a tracker's and an input observer's scope's alike. Registrations
8
- * and drains are counted so the channel is referenced only while a reply is
9
- * outstanding, and each registration keeps the sink its messages go to and the
10
- * spelling map that translates the child's canonical paths back to its own.
7
+ * ordered transport, a tracker's and an input observer's scope's alike. Windows
8
+ * uses the native helper's stdio; macOS uses Node IPC. Registrations and drains
9
+ * are counted so the channel is referenced only while a reply is outstanding,
10
+ * and each registration keeps the sink its messages go to and the spelling map
11
+ * that translates the child's canonical paths back to its own.
11
12
  *
12
13
  * @evidence contracts/common.md#principled-implementation
13
14
  * Registration and request ids distinguish multiplexed owners; drain scopes
@@ -35,6 +36,15 @@ import type { WatchBrokerRegistration } from "./WatchBrokerRegistration";
35
36
  export interface WatchBroker {
36
37
  /** The isolated watch process; unreferenced whenever no reply is outstanding. */
37
38
  child: ChildProcess;
39
+ /**
40
+ * Native stdio transport on Windows; absent for the macOS IPC broker and
41
+ * explicit test transports.
42
+ */
43
+ transport?: {
44
+ send(message: unknown): boolean;
45
+ reference(active: boolean): void;
46
+ close(): void;
47
+ };
38
48
  /**
39
49
  * Round-trips awaiting the child's reply, by request id, each released with
40
50
  * whether the child answered it.
@@ -0,0 +1,63 @@
1
+ import type { WatchBroker } from "./WatchBroker.cjs";
2
+ /**
3
+ * Common lifecycle seam for the native Windows stdio broker and macOS IPC.
4
+ *
5
+ * The transport owns framing and demand references only. Ordered native
6
+ * notifications and per-registration readiness remain backend responsibilities;
7
+ * a successful send cannot certify coverage or cache reuse.
8
+ *
9
+ * @evidence contracts/common.md#principled-implementation One transport seam preserves explicit failure and reference ownership for both supported broker backends.
10
+ * @evidence contracts/common.md#clear-and-simple-design Callers express send, demand and retirement through this namespace instead of duplicating platform checks or modifying a ChildProcess.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Supported child streams and IPC APIs are used without replacing runtime methods.
12
+ * @evidence contracts/common.md#meaningful-documentation Native prose separates transport completion from native watch authority.
13
+ * @evidence contracts/portability.md#os-neutral-implementation Native selection stays at broker startup; all tracker and observer consumers share these operations.
14
+ * @evidenceExclude contracts/performance.md#efficient-algorithms Member operations own their delegated cost.
15
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work The broker owner selects transport and sharing lifetime.
16
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources This namespace itself retains no transport registry.
17
+ */
18
+ export declare namespace WatchBrokerTransport {
19
+ /**
20
+ * Queue a message on the selected transport. False refuses delivery; true
21
+ * only means queued, with actual acknowledgment or failure still
22
+ * outstanding.
23
+ *
24
+ * @evidence contracts/common.md#principled-implementation Native and IPC transports preserve separate queue acceptance and observed backend replies.
25
+ * @evidence contracts/common.md#clear-and-simple-design One selection delegates framing to the startup-owned transport.
26
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts No queue result is upgraded into readiness or a native drain.
27
+ * @evidence contracts/common.md#meaningful-documentation Native prose states the limited meaning of the returned boolean.
28
+ * @evidence contracts/portability.md#os-neutral-implementation Explicit stdio capability takes precedence over optional IPC.
29
+ * @evidence contracts/performance.md#efficient-algorithms Transport selection is fixed work; JSON framing, message bytes and pipe backpressure belong to the selected sender.
30
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Sending an effect does not own computation reuse.
31
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The selected sender and request owner retain queued bytes and outstanding acknowledgment state.
32
+ */
33
+ function send(broker: WatchBroker, message: unknown): boolean;
34
+ /**
35
+ * Keep the selected reply channel live exactly while caller demand exists.
36
+ * Counts belong to registration/drain owners; native references are flags.
37
+ *
38
+ * @evidence contracts/common.md#principled-implementation Outstanding requests retain both process and reply channel, preventing host exit before acknowledgment.
39
+ * @evidence contracts/common.md#clear-and-simple-design One operation applies the caller's aggregated demand to either transport.
40
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Optional Bun IPC methods are used as capabilities without installing replacements.
41
+ * @evidence contracts/common.md#meaningful-documentation Native prose identifies count ownership and flag semantics.
42
+ * @evidence contracts/portability.md#os-neutral-implementation Optional IPC methods and a selected native pipe capability express runtime differences.
43
+ * @evidenceExclude contracts/performance.md#efficient-algorithms Reference toggling selects no data-processing algorithm.
44
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work This effect owns no shared computation.
45
+ * @evidence contracts/performance.md#bound-retention-and-release-resources The caller supplies aggregate demand; removing the last demand unreferences process and reply channel without asserting native termination.
46
+ */
47
+ function reference(broker: WatchBroker, active: boolean): void;
48
+ /**
49
+ * End this broker's request stream. The last-registration owner separately
50
+ * attempts process termination; closing a channel is not proof of child
51
+ * exit.
52
+ *
53
+ * @evidence contracts/common.md#principled-implementation Channel retirement is distinct from process exit and native resource closure.
54
+ * @evidence contracts/common.md#clear-and-simple-design Startup-owned transport closes its request stream without platform checks in consumers.
55
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Supported end/disconnect operations preserve native ownership without synthetic exit acknowledgment.
56
+ * @evidence contracts/common.md#meaningful-documentation Native prose identifies the independent termination attempt and limited closure meaning.
57
+ * @evidence contracts/portability.md#os-neutral-implementation Selected stream closure and optional IPC disconnection keep platform details behind the transport seam.
58
+ * @evidenceExclude contracts/performance.md#efficient-algorithms Closing one channel selects no processing algorithm.
59
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Retirement owns no computation reuse.
60
+ * @evidence contracts/performance.md#bound-retention-and-release-resources The selected transport ends its input; process kill and actual native cleanup remain the broker and backend's responsibilities.
61
+ */
62
+ function close(broker: WatchBroker): void;
63
+ }
@@ -0,0 +1,63 @@
1
+ import type { WatchBroker } from "./WatchBroker.mjs";
2
+ /**
3
+ * Common lifecycle seam for the native Windows stdio broker and macOS IPC.
4
+ *
5
+ * The transport owns framing and demand references only. Ordered native
6
+ * notifications and per-registration readiness remain backend responsibilities;
7
+ * a successful send cannot certify coverage or cache reuse.
8
+ *
9
+ * @evidence contracts/common.md#principled-implementation One transport seam preserves explicit failure and reference ownership for both supported broker backends.
10
+ * @evidence contracts/common.md#clear-and-simple-design Callers express send, demand and retirement through this namespace instead of duplicating platform checks or modifying a ChildProcess.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Supported child streams and IPC APIs are used without replacing runtime methods.
12
+ * @evidence contracts/common.md#meaningful-documentation Native prose separates transport completion from native watch authority.
13
+ * @evidence contracts/portability.md#os-neutral-implementation Native selection stays at broker startup; all tracker and observer consumers share these operations.
14
+ * @evidenceExclude contracts/performance.md#efficient-algorithms Member operations own their delegated cost.
15
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work The broker owner selects transport and sharing lifetime.
16
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources This namespace itself retains no transport registry.
17
+ */
18
+ export declare namespace WatchBrokerTransport {
19
+ /**
20
+ * Queue a message on the selected transport. False refuses delivery; true
21
+ * only means queued, with actual acknowledgment or failure still
22
+ * outstanding.
23
+ *
24
+ * @evidence contracts/common.md#principled-implementation Native and IPC transports preserve separate queue acceptance and observed backend replies.
25
+ * @evidence contracts/common.md#clear-and-simple-design One selection delegates framing to the startup-owned transport.
26
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts No queue result is upgraded into readiness or a native drain.
27
+ * @evidence contracts/common.md#meaningful-documentation Native prose states the limited meaning of the returned boolean.
28
+ * @evidence contracts/portability.md#os-neutral-implementation Explicit stdio capability takes precedence over optional IPC.
29
+ * @evidence contracts/performance.md#efficient-algorithms Transport selection is fixed work; JSON framing, message bytes and pipe backpressure belong to the selected sender.
30
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Sending an effect does not own computation reuse.
31
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The selected sender and request owner retain queued bytes and outstanding acknowledgment state.
32
+ */
33
+ function send(broker: WatchBroker, message: unknown): boolean;
34
+ /**
35
+ * Keep the selected reply channel live exactly while caller demand exists.
36
+ * Counts belong to registration/drain owners; native references are flags.
37
+ *
38
+ * @evidence contracts/common.md#principled-implementation Outstanding requests retain both process and reply channel, preventing host exit before acknowledgment.
39
+ * @evidence contracts/common.md#clear-and-simple-design One operation applies the caller's aggregated demand to either transport.
40
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Optional Bun IPC methods are used as capabilities without installing replacements.
41
+ * @evidence contracts/common.md#meaningful-documentation Native prose identifies count ownership and flag semantics.
42
+ * @evidence contracts/portability.md#os-neutral-implementation Optional IPC methods and a selected native pipe capability express runtime differences.
43
+ * @evidenceExclude contracts/performance.md#efficient-algorithms Reference toggling selects no data-processing algorithm.
44
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work This effect owns no shared computation.
45
+ * @evidence contracts/performance.md#bound-retention-and-release-resources The caller supplies aggregate demand; removing the last demand unreferences process and reply channel without asserting native termination.
46
+ */
47
+ function reference(broker: WatchBroker, active: boolean): void;
48
+ /**
49
+ * End this broker's request stream. The last-registration owner separately
50
+ * attempts process termination; closing a channel is not proof of child
51
+ * exit.
52
+ *
53
+ * @evidence contracts/common.md#principled-implementation Channel retirement is distinct from process exit and native resource closure.
54
+ * @evidence contracts/common.md#clear-and-simple-design Startup-owned transport closes its request stream without platform checks in consumers.
55
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Supported end/disconnect operations preserve native ownership without synthetic exit acknowledgment.
56
+ * @evidence contracts/common.md#meaningful-documentation Native prose identifies the independent termination attempt and limited closure meaning.
57
+ * @evidence contracts/portability.md#os-neutral-implementation Selected stream closure and optional IPC disconnection keep platform details behind the transport seam.
58
+ * @evidenceExclude contracts/performance.md#efficient-algorithms Closing one channel selects no processing algorithm.
59
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Retirement owns no computation reuse.
60
+ * @evidence contracts/performance.md#bound-retention-and-release-resources The selected transport ends its input; process kill and actual native cleanup remain the broker and backend's responsibilities.
61
+ */
62
+ function close(broker: WatchBroker): void;
63
+ }
@@ -0,0 +1,63 @@
1
+ import type { WatchBroker } from "./WatchBroker";
2
+ /**
3
+ * Common lifecycle seam for the native Windows stdio broker and macOS IPC.
4
+ *
5
+ * The transport owns framing and demand references only. Ordered native
6
+ * notifications and per-registration readiness remain backend responsibilities;
7
+ * a successful send cannot certify coverage or cache reuse.
8
+ *
9
+ * @evidence contracts/common.md#principled-implementation One transport seam preserves explicit failure and reference ownership for both supported broker backends.
10
+ * @evidence contracts/common.md#clear-and-simple-design Callers express send, demand and retirement through this namespace instead of duplicating platform checks or modifying a ChildProcess.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Supported child streams and IPC APIs are used without replacing runtime methods.
12
+ * @evidence contracts/common.md#meaningful-documentation Native prose separates transport completion from native watch authority.
13
+ * @evidence contracts/portability.md#os-neutral-implementation Native selection stays at broker startup; all tracker and observer consumers share these operations.
14
+ * @evidenceExclude contracts/performance.md#efficient-algorithms Member operations own their delegated cost.
15
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work The broker owner selects transport and sharing lifetime.
16
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources This namespace itself retains no transport registry.
17
+ */
18
+ export declare namespace WatchBrokerTransport {
19
+ /**
20
+ * Queue a message on the selected transport. False refuses delivery; true
21
+ * only means queued, with actual acknowledgment or failure still
22
+ * outstanding.
23
+ *
24
+ * @evidence contracts/common.md#principled-implementation Native and IPC transports preserve separate queue acceptance and observed backend replies.
25
+ * @evidence contracts/common.md#clear-and-simple-design One selection delegates framing to the startup-owned transport.
26
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts No queue result is upgraded into readiness or a native drain.
27
+ * @evidence contracts/common.md#meaningful-documentation Native prose states the limited meaning of the returned boolean.
28
+ * @evidence contracts/portability.md#os-neutral-implementation Explicit stdio capability takes precedence over optional IPC.
29
+ * @evidence contracts/performance.md#efficient-algorithms Transport selection is fixed work; JSON framing, message bytes and pipe backpressure belong to the selected sender.
30
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Sending an effect does not own computation reuse.
31
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The selected sender and request owner retain queued bytes and outstanding acknowledgment state.
32
+ */
33
+ function send(broker: WatchBroker, message: unknown): boolean;
34
+ /**
35
+ * Keep the selected reply channel live exactly while caller demand exists.
36
+ * Counts belong to registration/drain owners; native references are flags.
37
+ *
38
+ * @evidence contracts/common.md#principled-implementation Outstanding requests retain both process and reply channel, preventing host exit before acknowledgment.
39
+ * @evidence contracts/common.md#clear-and-simple-design One operation applies the caller's aggregated demand to either transport.
40
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Optional Bun IPC methods are used as capabilities without installing replacements.
41
+ * @evidence contracts/common.md#meaningful-documentation Native prose identifies count ownership and flag semantics.
42
+ * @evidence contracts/portability.md#os-neutral-implementation Optional IPC methods and a selected native pipe capability express runtime differences.
43
+ * @evidenceExclude contracts/performance.md#efficient-algorithms Reference toggling selects no data-processing algorithm.
44
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work This effect owns no shared computation.
45
+ * @evidence contracts/performance.md#bound-retention-and-release-resources The caller supplies aggregate demand; removing the last demand unreferences process and reply channel without asserting native termination.
46
+ */
47
+ function reference(broker: WatchBroker, active: boolean): void;
48
+ /**
49
+ * End this broker's request stream. The last-registration owner separately
50
+ * attempts process termination; closing a channel is not proof of child
51
+ * exit.
52
+ *
53
+ * @evidence contracts/common.md#principled-implementation Channel retirement is distinct from process exit and native resource closure.
54
+ * @evidence contracts/common.md#clear-and-simple-design Startup-owned transport closes its request stream without platform checks in consumers.
55
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Supported end/disconnect operations preserve native ownership without synthetic exit acknowledgment.
56
+ * @evidence contracts/common.md#meaningful-documentation Native prose identifies the independent termination attempt and limited closure meaning.
57
+ * @evidence contracts/portability.md#os-neutral-implementation Selected stream closure and optional IPC disconnection keep platform details behind the transport seam.
58
+ * @evidenceExclude contracts/performance.md#efficient-algorithms Closing one channel selects no processing algorithm.
59
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Retirement owns no computation reuse.
60
+ * @evidence contracts/performance.md#bound-retention-and-release-resources The selected transport ends its input; process kill and actual native cleanup remain the broker and backend's responsibilities.
61
+ */
62
+ function close(broker: WatchBroker): void;
63
+ }