@tracecode/harness 0.6.6 → 0.7.0-beta8

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 (494) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +134 -15
  3. package/THIRD_PARTY_NOTICES.md +170 -0
  4. package/dist/browser.cjs +2361 -1033
  5. package/dist/browser.cjs.map +1 -1
  6. package/dist/browser.d.cts +33 -3
  7. package/dist/browser.d.ts +33 -3
  8. package/dist/browser.js +2357 -1033
  9. package/dist/browser.js.map +1 -1
  10. package/dist/cli.cjs +160 -23
  11. package/dist/cli.cjs.map +1 -1
  12. package/dist/cli.js +161 -24
  13. package/dist/cli.js.map +1 -1
  14. package/dist/core.cjs +748 -867
  15. package/dist/core.cjs.map +1 -1
  16. package/dist/core.d.cts +21 -85
  17. package/dist/core.d.ts +21 -85
  18. package/dist/core.js +734 -855
  19. package/dist/core.js.map +1 -1
  20. package/dist/cpp-worker-client-Bn7kC0_L.d.ts +84 -0
  21. package/dist/cpp-worker-client-BzdJLuZa.d.cts +84 -0
  22. package/dist/cpp.cjs +1063 -0
  23. package/dist/cpp.cjs.map +1 -0
  24. package/dist/cpp.d.cts +7 -0
  25. package/dist/cpp.d.ts +7 -0
  26. package/dist/cpp.js +1035 -0
  27. package/dist/cpp.js.map +1 -0
  28. package/dist/csharp-worker-client-DMHIa2YG.d.cts +69 -0
  29. package/dist/csharp-worker-client-JwqS6LiX.d.ts +69 -0
  30. package/dist/csharp.cjs +1012 -0
  31. package/dist/csharp.cjs.map +1 -0
  32. package/dist/csharp.d.cts +7 -0
  33. package/dist/csharp.d.ts +7 -0
  34. package/dist/csharp.js +984 -0
  35. package/dist/csharp.js.map +1 -0
  36. package/dist/index.cjs +3142 -1160
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +13 -5
  39. package/dist/index.d.ts +13 -5
  40. package/dist/index.js +3117 -1148
  41. package/dist/index.js.map +1 -1
  42. package/dist/internal/browser.cjs +1639 -30
  43. package/dist/internal/browser.cjs.map +1 -1
  44. package/dist/internal/browser.d.cts +6 -199
  45. package/dist/internal/browser.d.ts +6 -199
  46. package/dist/internal/browser.js +1636 -30
  47. package/dist/internal/browser.js.map +1 -1
  48. package/dist/java-worker-client-BOwKW-11.d.cts +72 -0
  49. package/dist/java-worker-client-C97DDnCp.d.ts +72 -0
  50. package/dist/java.cjs +1225 -0
  51. package/dist/java.cjs.map +1 -0
  52. package/dist/java.d.cts +7 -0
  53. package/dist/java.d.ts +7 -0
  54. package/dist/java.js +1197 -0
  55. package/dist/java.js.map +1 -0
  56. package/dist/javascript-worker-client-CYBGEEvc.d.cts +51 -0
  57. package/dist/javascript-worker-client-DIX1Mp21.d.ts +51 -0
  58. package/dist/javascript.cjs +1063 -19
  59. package/dist/javascript.cjs.map +1 -1
  60. package/dist/javascript.d.cts +7 -4
  61. package/dist/javascript.d.ts +7 -4
  62. package/dist/javascript.js +1061 -19
  63. package/dist/javascript.js.map +1 -1
  64. package/dist/pyodide-worker-client-C-2rfHj9.d.ts +111 -0
  65. package/dist/pyodide-worker-client-Cn0a8Uv3.d.cts +111 -0
  66. package/dist/python.cjs +1282 -74
  67. package/dist/python.cjs.map +1 -1
  68. package/dist/python.d.cts +20 -14
  69. package/dist/python.d.ts +20 -14
  70. package/dist/python.js +1279 -74
  71. package/dist/python.js.map +1 -1
  72. package/dist/runtime-language-info-BFUSti3-.d.ts +43 -0
  73. package/dist/runtime-language-info-Bxza1cI2.d.cts +43 -0
  74. package/dist/runtime-types-2qM0MukN.d.cts +244 -0
  75. package/dist/runtime-types-2qM0MukN.d.ts +244 -0
  76. package/package.json +73 -8
  77. package/workers/cpp/cpp-compiler-frame.html +82 -0
  78. package/workers/cpp/cpp-compiler-worker.js +131 -0
  79. package/workers/cpp/cpp-worker.js +5790 -0
  80. package/workers/cpp/tracecode_runtime.hpp +6169 -0
  81. package/workers/csharp/csharp-worker.js +301 -0
  82. package/workers/java/.build/classes/harness/browser/JavaRewriteLibrary.class +0 -0
  83. package/workers/java/java-source-augmentations.js +907 -0
  84. package/workers/java/java-worker.js +2161 -177
  85. package/workers/java/src/harness/browser/JavaRewriteLibrary.java +1659 -32
  86. package/workers/java/src/javafx/util/Pair.java +42 -0
  87. package/workers/java/src/tracecode/browser/BrowserCompileAndTraceLibrary.java +714 -0
  88. package/workers/java/src/tracecode/browser/BrowserCompileAndTraceMain.java +76 -0
  89. package/workers/java/src/tracecode/browser/RuntimeProbeMain.java +14 -0
  90. package/workers/java/src/tracecode/user/TraceHooks.java +1414 -0
  91. package/workers/javascript/javascript-libraries-entry.js +71 -0
  92. package/workers/javascript/javascript-worker.js +2055 -424
  93. package/workers/python/generated-python-harness-snippets.js +4 -4
  94. package/workers/python/pyodide-worker.js +222 -61
  95. package/workers/python/runtime-core.js +1387 -301
  96. package/workers/vendor/csharp/.stamp +0 -0
  97. package/workers/vendor/csharp/TraceCode.CSharpHost.runtimeconfig.json +32 -0
  98. package/workers/vendor/csharp/_framework/Microsoft.CSharp.wasm +0 -0
  99. package/workers/vendor/csharp/_framework/Microsoft.CodeAnalysis.CSharp.wasm +0 -0
  100. package/workers/vendor/csharp/_framework/Microsoft.CodeAnalysis.wasm +0 -0
  101. package/workers/vendor/csharp/_framework/Microsoft.VisualBasic.Core.wasm +0 -0
  102. package/workers/vendor/csharp/_framework/Microsoft.VisualBasic.wasm +0 -0
  103. package/workers/vendor/csharp/_framework/Microsoft.Win32.Primitives.wasm +0 -0
  104. package/workers/vendor/csharp/_framework/Microsoft.Win32.Registry.wasm +0 -0
  105. package/workers/vendor/csharp/_framework/System.AppContext.wasm +0 -0
  106. package/workers/vendor/csharp/_framework/System.Buffers.wasm +0 -0
  107. package/workers/vendor/csharp/_framework/System.Collections.Concurrent.wasm +0 -0
  108. package/workers/vendor/csharp/_framework/System.Collections.Immutable.wasm +0 -0
  109. package/workers/vendor/csharp/_framework/System.Collections.NonGeneric.wasm +0 -0
  110. package/workers/vendor/csharp/_framework/System.Collections.Specialized.wasm +0 -0
  111. package/workers/vendor/csharp/_framework/System.Collections.wasm +0 -0
  112. package/workers/vendor/csharp/_framework/System.ComponentModel.Annotations.wasm +0 -0
  113. package/workers/vendor/csharp/_framework/System.ComponentModel.DataAnnotations.wasm +0 -0
  114. package/workers/vendor/csharp/_framework/System.ComponentModel.EventBasedAsync.wasm +0 -0
  115. package/workers/vendor/csharp/_framework/System.ComponentModel.Primitives.wasm +0 -0
  116. package/workers/vendor/csharp/_framework/System.ComponentModel.TypeConverter.wasm +0 -0
  117. package/workers/vendor/csharp/_framework/System.ComponentModel.wasm +0 -0
  118. package/workers/vendor/csharp/_framework/System.Configuration.wasm +0 -0
  119. package/workers/vendor/csharp/_framework/System.Console.wasm +0 -0
  120. package/workers/vendor/csharp/_framework/System.Core.wasm +0 -0
  121. package/workers/vendor/csharp/_framework/System.Data.Common.wasm +0 -0
  122. package/workers/vendor/csharp/_framework/System.Data.DataSetExtensions.wasm +0 -0
  123. package/workers/vendor/csharp/_framework/System.Data.wasm +0 -0
  124. package/workers/vendor/csharp/_framework/System.Diagnostics.Contracts.wasm +0 -0
  125. package/workers/vendor/csharp/_framework/System.Diagnostics.Debug.wasm +0 -0
  126. package/workers/vendor/csharp/_framework/System.Diagnostics.DiagnosticSource.wasm +0 -0
  127. package/workers/vendor/csharp/_framework/System.Diagnostics.FileVersionInfo.wasm +0 -0
  128. package/workers/vendor/csharp/_framework/System.Diagnostics.Process.wasm +0 -0
  129. package/workers/vendor/csharp/_framework/System.Diagnostics.StackTrace.wasm +0 -0
  130. package/workers/vendor/csharp/_framework/System.Diagnostics.TextWriterTraceListener.wasm +0 -0
  131. package/workers/vendor/csharp/_framework/System.Diagnostics.Tools.wasm +0 -0
  132. package/workers/vendor/csharp/_framework/System.Diagnostics.TraceSource.wasm +0 -0
  133. package/workers/vendor/csharp/_framework/System.Diagnostics.Tracing.wasm +0 -0
  134. package/workers/vendor/csharp/_framework/System.Drawing.Primitives.wasm +0 -0
  135. package/workers/vendor/csharp/_framework/System.Drawing.wasm +0 -0
  136. package/workers/vendor/csharp/_framework/System.Dynamic.Runtime.wasm +0 -0
  137. package/workers/vendor/csharp/_framework/System.Formats.Asn1.wasm +0 -0
  138. package/workers/vendor/csharp/_framework/System.Formats.Tar.wasm +0 -0
  139. package/workers/vendor/csharp/_framework/System.Globalization.Calendars.wasm +0 -0
  140. package/workers/vendor/csharp/_framework/System.Globalization.Extensions.wasm +0 -0
  141. package/workers/vendor/csharp/_framework/System.Globalization.wasm +0 -0
  142. package/workers/vendor/csharp/_framework/System.IO.Compression.Brotli.wasm +0 -0
  143. package/workers/vendor/csharp/_framework/System.IO.Compression.FileSystem.wasm +0 -0
  144. package/workers/vendor/csharp/_framework/System.IO.Compression.ZipFile.wasm +0 -0
  145. package/workers/vendor/csharp/_framework/System.IO.Compression.wasm +0 -0
  146. package/workers/vendor/csharp/_framework/System.IO.FileSystem.AccessControl.wasm +0 -0
  147. package/workers/vendor/csharp/_framework/System.IO.FileSystem.DriveInfo.wasm +0 -0
  148. package/workers/vendor/csharp/_framework/System.IO.FileSystem.Primitives.wasm +0 -0
  149. package/workers/vendor/csharp/_framework/System.IO.FileSystem.Watcher.wasm +0 -0
  150. package/workers/vendor/csharp/_framework/System.IO.FileSystem.wasm +0 -0
  151. package/workers/vendor/csharp/_framework/System.IO.IsolatedStorage.wasm +0 -0
  152. package/workers/vendor/csharp/_framework/System.IO.MemoryMappedFiles.wasm +0 -0
  153. package/workers/vendor/csharp/_framework/System.IO.Pipelines.wasm +0 -0
  154. package/workers/vendor/csharp/_framework/System.IO.Pipes.AccessControl.wasm +0 -0
  155. package/workers/vendor/csharp/_framework/System.IO.Pipes.wasm +0 -0
  156. package/workers/vendor/csharp/_framework/System.IO.UnmanagedMemoryStream.wasm +0 -0
  157. package/workers/vendor/csharp/_framework/System.IO.wasm +0 -0
  158. package/workers/vendor/csharp/_framework/System.Linq.AsyncEnumerable.wasm +0 -0
  159. package/workers/vendor/csharp/_framework/System.Linq.Expressions.wasm +0 -0
  160. package/workers/vendor/csharp/_framework/System.Linq.Parallel.wasm +0 -0
  161. package/workers/vendor/csharp/_framework/System.Linq.Queryable.wasm +0 -0
  162. package/workers/vendor/csharp/_framework/System.Linq.wasm +0 -0
  163. package/workers/vendor/csharp/_framework/System.Memory.wasm +0 -0
  164. package/workers/vendor/csharp/_framework/System.Net.Http.Json.wasm +0 -0
  165. package/workers/vendor/csharp/_framework/System.Net.Http.wasm +0 -0
  166. package/workers/vendor/csharp/_framework/System.Net.HttpListener.wasm +0 -0
  167. package/workers/vendor/csharp/_framework/System.Net.Mail.wasm +0 -0
  168. package/workers/vendor/csharp/_framework/System.Net.NameResolution.wasm +0 -0
  169. package/workers/vendor/csharp/_framework/System.Net.NetworkInformation.wasm +0 -0
  170. package/workers/vendor/csharp/_framework/System.Net.Ping.wasm +0 -0
  171. package/workers/vendor/csharp/_framework/System.Net.Primitives.wasm +0 -0
  172. package/workers/vendor/csharp/_framework/System.Net.Quic.wasm +0 -0
  173. package/workers/vendor/csharp/_framework/System.Net.Requests.wasm +0 -0
  174. package/workers/vendor/csharp/_framework/System.Net.Security.wasm +0 -0
  175. package/workers/vendor/csharp/_framework/System.Net.ServerSentEvents.wasm +0 -0
  176. package/workers/vendor/csharp/_framework/System.Net.ServicePoint.wasm +0 -0
  177. package/workers/vendor/csharp/_framework/System.Net.Sockets.wasm +0 -0
  178. package/workers/vendor/csharp/_framework/System.Net.WebClient.wasm +0 -0
  179. package/workers/vendor/csharp/_framework/System.Net.WebHeaderCollection.wasm +0 -0
  180. package/workers/vendor/csharp/_framework/System.Net.WebProxy.wasm +0 -0
  181. package/workers/vendor/csharp/_framework/System.Net.WebSockets.Client.wasm +0 -0
  182. package/workers/vendor/csharp/_framework/System.Net.WebSockets.wasm +0 -0
  183. package/workers/vendor/csharp/_framework/System.Net.wasm +0 -0
  184. package/workers/vendor/csharp/_framework/System.Numerics.Vectors.wasm +0 -0
  185. package/workers/vendor/csharp/_framework/System.Numerics.wasm +0 -0
  186. package/workers/vendor/csharp/_framework/System.ObjectModel.wasm +0 -0
  187. package/workers/vendor/csharp/_framework/System.Private.CoreLib.wasm +0 -0
  188. package/workers/vendor/csharp/_framework/System.Private.DataContractSerialization.wasm +0 -0
  189. package/workers/vendor/csharp/_framework/System.Private.Uri.wasm +0 -0
  190. package/workers/vendor/csharp/_framework/System.Private.Xml.Linq.wasm +0 -0
  191. package/workers/vendor/csharp/_framework/System.Private.Xml.wasm +0 -0
  192. package/workers/vendor/csharp/_framework/System.Reflection.DispatchProxy.wasm +0 -0
  193. package/workers/vendor/csharp/_framework/System.Reflection.Emit.ILGeneration.wasm +0 -0
  194. package/workers/vendor/csharp/_framework/System.Reflection.Emit.Lightweight.wasm +0 -0
  195. package/workers/vendor/csharp/_framework/System.Reflection.Emit.wasm +0 -0
  196. package/workers/vendor/csharp/_framework/System.Reflection.Extensions.wasm +0 -0
  197. package/workers/vendor/csharp/_framework/System.Reflection.Metadata.wasm +0 -0
  198. package/workers/vendor/csharp/_framework/System.Reflection.Primitives.wasm +0 -0
  199. package/workers/vendor/csharp/_framework/System.Reflection.TypeExtensions.wasm +0 -0
  200. package/workers/vendor/csharp/_framework/System.Reflection.wasm +0 -0
  201. package/workers/vendor/csharp/_framework/System.Resources.Reader.wasm +0 -0
  202. package/workers/vendor/csharp/_framework/System.Resources.ResourceManager.wasm +0 -0
  203. package/workers/vendor/csharp/_framework/System.Resources.Writer.wasm +0 -0
  204. package/workers/vendor/csharp/_framework/System.Runtime.CompilerServices.Unsafe.wasm +0 -0
  205. package/workers/vendor/csharp/_framework/System.Runtime.CompilerServices.VisualC.wasm +0 -0
  206. package/workers/vendor/csharp/_framework/System.Runtime.Extensions.wasm +0 -0
  207. package/workers/vendor/csharp/_framework/System.Runtime.Handles.wasm +0 -0
  208. package/workers/vendor/csharp/_framework/System.Runtime.InteropServices.JavaScript.wasm +0 -0
  209. package/workers/vendor/csharp/_framework/System.Runtime.InteropServices.RuntimeInformation.wasm +0 -0
  210. package/workers/vendor/csharp/_framework/System.Runtime.InteropServices.wasm +0 -0
  211. package/workers/vendor/csharp/_framework/System.Runtime.Intrinsics.wasm +0 -0
  212. package/workers/vendor/csharp/_framework/System.Runtime.Loader.wasm +0 -0
  213. package/workers/vendor/csharp/_framework/System.Runtime.Numerics.wasm +0 -0
  214. package/workers/vendor/csharp/_framework/System.Runtime.Serialization.Formatters.wasm +0 -0
  215. package/workers/vendor/csharp/_framework/System.Runtime.Serialization.Json.wasm +0 -0
  216. package/workers/vendor/csharp/_framework/System.Runtime.Serialization.Primitives.wasm +0 -0
  217. package/workers/vendor/csharp/_framework/System.Runtime.Serialization.Xml.wasm +0 -0
  218. package/workers/vendor/csharp/_framework/System.Runtime.Serialization.wasm +0 -0
  219. package/workers/vendor/csharp/_framework/System.Runtime.wasm +0 -0
  220. package/workers/vendor/csharp/_framework/System.Security.AccessControl.wasm +0 -0
  221. package/workers/vendor/csharp/_framework/System.Security.Claims.wasm +0 -0
  222. package/workers/vendor/csharp/_framework/System.Security.Cryptography.Algorithms.wasm +0 -0
  223. package/workers/vendor/csharp/_framework/System.Security.Cryptography.Cng.wasm +0 -0
  224. package/workers/vendor/csharp/_framework/System.Security.Cryptography.Csp.wasm +0 -0
  225. package/workers/vendor/csharp/_framework/System.Security.Cryptography.Encoding.wasm +0 -0
  226. package/workers/vendor/csharp/_framework/System.Security.Cryptography.OpenSsl.wasm +0 -0
  227. package/workers/vendor/csharp/_framework/System.Security.Cryptography.Primitives.wasm +0 -0
  228. package/workers/vendor/csharp/_framework/System.Security.Cryptography.X509Certificates.wasm +0 -0
  229. package/workers/vendor/csharp/_framework/System.Security.Cryptography.wasm +0 -0
  230. package/workers/vendor/csharp/_framework/System.Security.Principal.Windows.wasm +0 -0
  231. package/workers/vendor/csharp/_framework/System.Security.Principal.wasm +0 -0
  232. package/workers/vendor/csharp/_framework/System.Security.SecureString.wasm +0 -0
  233. package/workers/vendor/csharp/_framework/System.Security.wasm +0 -0
  234. package/workers/vendor/csharp/_framework/System.ServiceModel.Web.wasm +0 -0
  235. package/workers/vendor/csharp/_framework/System.ServiceProcess.wasm +0 -0
  236. package/workers/vendor/csharp/_framework/System.Text.Encoding.CodePages.wasm +0 -0
  237. package/workers/vendor/csharp/_framework/System.Text.Encoding.Extensions.wasm +0 -0
  238. package/workers/vendor/csharp/_framework/System.Text.Encoding.wasm +0 -0
  239. package/workers/vendor/csharp/_framework/System.Text.Encodings.Web.wasm +0 -0
  240. package/workers/vendor/csharp/_framework/System.Text.Json.wasm +0 -0
  241. package/workers/vendor/csharp/_framework/System.Text.RegularExpressions.wasm +0 -0
  242. package/workers/vendor/csharp/_framework/System.Threading.AccessControl.wasm +0 -0
  243. package/workers/vendor/csharp/_framework/System.Threading.Channels.wasm +0 -0
  244. package/workers/vendor/csharp/_framework/System.Threading.Overlapped.wasm +0 -0
  245. package/workers/vendor/csharp/_framework/System.Threading.Tasks.Dataflow.wasm +0 -0
  246. package/workers/vendor/csharp/_framework/System.Threading.Tasks.Extensions.wasm +0 -0
  247. package/workers/vendor/csharp/_framework/System.Threading.Tasks.Parallel.wasm +0 -0
  248. package/workers/vendor/csharp/_framework/System.Threading.Tasks.wasm +0 -0
  249. package/workers/vendor/csharp/_framework/System.Threading.Thread.wasm +0 -0
  250. package/workers/vendor/csharp/_framework/System.Threading.ThreadPool.wasm +0 -0
  251. package/workers/vendor/csharp/_framework/System.Threading.Timer.wasm +0 -0
  252. package/workers/vendor/csharp/_framework/System.Threading.wasm +0 -0
  253. package/workers/vendor/csharp/_framework/System.Transactions.Local.wasm +0 -0
  254. package/workers/vendor/csharp/_framework/System.Transactions.wasm +0 -0
  255. package/workers/vendor/csharp/_framework/System.ValueTuple.wasm +0 -0
  256. package/workers/vendor/csharp/_framework/System.Web.HttpUtility.wasm +0 -0
  257. package/workers/vendor/csharp/_framework/System.Web.wasm +0 -0
  258. package/workers/vendor/csharp/_framework/System.Windows.wasm +0 -0
  259. package/workers/vendor/csharp/_framework/System.Xml.Linq.wasm +0 -0
  260. package/workers/vendor/csharp/_framework/System.Xml.ReaderWriter.wasm +0 -0
  261. package/workers/vendor/csharp/_framework/System.Xml.Serialization.wasm +0 -0
  262. package/workers/vendor/csharp/_framework/System.Xml.XDocument.wasm +0 -0
  263. package/workers/vendor/csharp/_framework/System.Xml.XPath.XDocument.wasm +0 -0
  264. package/workers/vendor/csharp/_framework/System.Xml.XPath.wasm +0 -0
  265. package/workers/vendor/csharp/_framework/System.Xml.XmlDocument.wasm +0 -0
  266. package/workers/vendor/csharp/_framework/System.Xml.XmlSerializer.wasm +0 -0
  267. package/workers/vendor/csharp/_framework/System.Xml.wasm +0 -0
  268. package/workers/vendor/csharp/_framework/System.wasm +0 -0
  269. package/workers/vendor/csharp/_framework/TraceCode.CSharpHost.wasm +0 -0
  270. package/workers/vendor/csharp/_framework/WindowsBase.wasm +0 -0
  271. package/workers/vendor/csharp/_framework/cs/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
  272. package/workers/vendor/csharp/_framework/cs/Microsoft.CodeAnalysis.resources.wasm +0 -0
  273. package/workers/vendor/csharp/_framework/de/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
  274. package/workers/vendor/csharp/_framework/de/Microsoft.CodeAnalysis.resources.wasm +0 -0
  275. package/workers/vendor/csharp/_framework/dotnet.boot.js +1958 -0
  276. package/workers/vendor/csharp/_framework/dotnet.js +4 -0
  277. package/workers/vendor/csharp/_framework/dotnet.js.map +1 -0
  278. package/workers/vendor/csharp/_framework/dotnet.native.js +6687 -0
  279. package/workers/vendor/csharp/_framework/dotnet.native.wasm +0 -0
  280. package/workers/vendor/csharp/_framework/dotnet.runtime.js +4 -0
  281. package/workers/vendor/csharp/_framework/dotnet.runtime.js.map +1 -0
  282. package/workers/vendor/csharp/_framework/es/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
  283. package/workers/vendor/csharp/_framework/es/Microsoft.CodeAnalysis.resources.wasm +0 -0
  284. package/workers/vendor/csharp/_framework/fr/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
  285. package/workers/vendor/csharp/_framework/fr/Microsoft.CodeAnalysis.resources.wasm +0 -0
  286. package/workers/vendor/csharp/_framework/it/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
  287. package/workers/vendor/csharp/_framework/it/Microsoft.CodeAnalysis.resources.wasm +0 -0
  288. package/workers/vendor/csharp/_framework/ja/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
  289. package/workers/vendor/csharp/_framework/ja/Microsoft.CodeAnalysis.resources.wasm +0 -0
  290. package/workers/vendor/csharp/_framework/ko/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
  291. package/workers/vendor/csharp/_framework/ko/Microsoft.CodeAnalysis.resources.wasm +0 -0
  292. package/workers/vendor/csharp/_framework/mscorlib.wasm +0 -0
  293. package/workers/vendor/csharp/_framework/netstandard.wasm +0 -0
  294. package/workers/vendor/csharp/_framework/pl/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
  295. package/workers/vendor/csharp/_framework/pl/Microsoft.CodeAnalysis.resources.wasm +0 -0
  296. package/workers/vendor/csharp/_framework/pt-BR/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
  297. package/workers/vendor/csharp/_framework/pt-BR/Microsoft.CodeAnalysis.resources.wasm +0 -0
  298. package/workers/vendor/csharp/_framework/ru/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
  299. package/workers/vendor/csharp/_framework/ru/Microsoft.CodeAnalysis.resources.wasm +0 -0
  300. package/workers/vendor/csharp/_framework/supportFiles/0_Microsoft.CodeAnalysis.CSharp.dll +0 -0
  301. package/workers/vendor/csharp/_framework/supportFiles/100_System.Reflection.Emit.ILGeneration.dll +0 -0
  302. package/workers/vendor/csharp/_framework/supportFiles/101_System.Reflection.Emit.Lightweight.dll +0 -0
  303. package/workers/vendor/csharp/_framework/supportFiles/102_System.Reflection.Extensions.dll +0 -0
  304. package/workers/vendor/csharp/_framework/supportFiles/103_System.Reflection.Metadata.dll +0 -0
  305. package/workers/vendor/csharp/_framework/supportFiles/104_System.Reflection.Primitives.dll +0 -0
  306. package/workers/vendor/csharp/_framework/supportFiles/105_System.Reflection.TypeExtensions.dll +0 -0
  307. package/workers/vendor/csharp/_framework/supportFiles/106_System.Resources.Reader.dll +0 -0
  308. package/workers/vendor/csharp/_framework/supportFiles/107_System.Resources.ResourceManager.dll +0 -0
  309. package/workers/vendor/csharp/_framework/supportFiles/108_System.Resources.Writer.dll +0 -0
  310. package/workers/vendor/csharp/_framework/supportFiles/109_System.Runtime.CompilerServices.Unsafe.dll +0 -0
  311. package/workers/vendor/csharp/_framework/supportFiles/10_System.Buffers.dll +0 -0
  312. package/workers/vendor/csharp/_framework/supportFiles/110_System.Runtime.CompilerServices.VisualC.dll +0 -0
  313. package/workers/vendor/csharp/_framework/supportFiles/111_System.Runtime.dll +0 -0
  314. package/workers/vendor/csharp/_framework/supportFiles/112_System.Runtime.Extensions.dll +0 -0
  315. package/workers/vendor/csharp/_framework/supportFiles/113_System.Runtime.Handles.dll +0 -0
  316. package/workers/vendor/csharp/_framework/supportFiles/114_System.Runtime.InteropServices.dll +0 -0
  317. package/workers/vendor/csharp/_framework/supportFiles/115_System.Runtime.InteropServices.JavaScript.dll +0 -0
  318. package/workers/vendor/csharp/_framework/supportFiles/116_System.Runtime.InteropServices.RuntimeInformation.dll +0 -0
  319. package/workers/vendor/csharp/_framework/supportFiles/117_System.Runtime.Intrinsics.dll +0 -0
  320. package/workers/vendor/csharp/_framework/supportFiles/118_System.Runtime.Loader.dll +0 -0
  321. package/workers/vendor/csharp/_framework/supportFiles/119_System.Runtime.Numerics.dll +0 -0
  322. package/workers/vendor/csharp/_framework/supportFiles/11_System.Collections.Concurrent.dll +0 -0
  323. package/workers/vendor/csharp/_framework/supportFiles/120_System.Runtime.Serialization.dll +0 -0
  324. package/workers/vendor/csharp/_framework/supportFiles/121_System.Runtime.Serialization.Formatters.dll +0 -0
  325. package/workers/vendor/csharp/_framework/supportFiles/122_System.Runtime.Serialization.Json.dll +0 -0
  326. package/workers/vendor/csharp/_framework/supportFiles/123_System.Runtime.Serialization.Primitives.dll +0 -0
  327. package/workers/vendor/csharp/_framework/supportFiles/124_System.Runtime.Serialization.Xml.dll +0 -0
  328. package/workers/vendor/csharp/_framework/supportFiles/125_System.Security.AccessControl.dll +0 -0
  329. package/workers/vendor/csharp/_framework/supportFiles/126_System.Security.Claims.dll +0 -0
  330. package/workers/vendor/csharp/_framework/supportFiles/127_System.Security.Cryptography.Algorithms.dll +0 -0
  331. package/workers/vendor/csharp/_framework/supportFiles/128_System.Security.Cryptography.Cng.dll +0 -0
  332. package/workers/vendor/csharp/_framework/supportFiles/129_System.Security.Cryptography.Csp.dll +0 -0
  333. package/workers/vendor/csharp/_framework/supportFiles/12_System.Collections.dll +0 -0
  334. package/workers/vendor/csharp/_framework/supportFiles/130_System.Security.Cryptography.dll +0 -0
  335. package/workers/vendor/csharp/_framework/supportFiles/131_System.Security.Cryptography.Encoding.dll +0 -0
  336. package/workers/vendor/csharp/_framework/supportFiles/132_System.Security.Cryptography.OpenSsl.dll +0 -0
  337. package/workers/vendor/csharp/_framework/supportFiles/133_System.Security.Cryptography.Primitives.dll +0 -0
  338. package/workers/vendor/csharp/_framework/supportFiles/134_System.Security.Cryptography.X509Certificates.dll +0 -0
  339. package/workers/vendor/csharp/_framework/supportFiles/135_System.Security.dll +0 -0
  340. package/workers/vendor/csharp/_framework/supportFiles/136_System.Security.Principal.dll +0 -0
  341. package/workers/vendor/csharp/_framework/supportFiles/137_System.Security.Principal.Windows.dll +0 -0
  342. package/workers/vendor/csharp/_framework/supportFiles/138_System.Security.SecureString.dll +0 -0
  343. package/workers/vendor/csharp/_framework/supportFiles/139_System.ServiceModel.Web.dll +0 -0
  344. package/workers/vendor/csharp/_framework/supportFiles/13_System.Collections.Immutable.dll +0 -0
  345. package/workers/vendor/csharp/_framework/supportFiles/140_System.ServiceProcess.dll +0 -0
  346. package/workers/vendor/csharp/_framework/supportFiles/141_System.Text.Encoding.CodePages.dll +0 -0
  347. package/workers/vendor/csharp/_framework/supportFiles/142_System.Text.Encoding.dll +0 -0
  348. package/workers/vendor/csharp/_framework/supportFiles/143_System.Text.Encoding.Extensions.dll +0 -0
  349. package/workers/vendor/csharp/_framework/supportFiles/144_System.Text.Encodings.Web.dll +0 -0
  350. package/workers/vendor/csharp/_framework/supportFiles/145_System.Text.Json.dll +0 -0
  351. package/workers/vendor/csharp/_framework/supportFiles/146_System.Text.RegularExpressions.dll +0 -0
  352. package/workers/vendor/csharp/_framework/supportFiles/147_System.Threading.AccessControl.dll +0 -0
  353. package/workers/vendor/csharp/_framework/supportFiles/148_System.Threading.Channels.dll +0 -0
  354. package/workers/vendor/csharp/_framework/supportFiles/149_System.Threading.dll +0 -0
  355. package/workers/vendor/csharp/_framework/supportFiles/14_System.Collections.NonGeneric.dll +0 -0
  356. package/workers/vendor/csharp/_framework/supportFiles/150_System.Threading.Overlapped.dll +0 -0
  357. package/workers/vendor/csharp/_framework/supportFiles/151_System.Threading.Tasks.Dataflow.dll +0 -0
  358. package/workers/vendor/csharp/_framework/supportFiles/152_System.Threading.Tasks.dll +0 -0
  359. package/workers/vendor/csharp/_framework/supportFiles/153_System.Threading.Tasks.Extensions.dll +0 -0
  360. package/workers/vendor/csharp/_framework/supportFiles/154_System.Threading.Tasks.Parallel.dll +0 -0
  361. package/workers/vendor/csharp/_framework/supportFiles/155_System.Threading.Thread.dll +0 -0
  362. package/workers/vendor/csharp/_framework/supportFiles/156_System.Threading.ThreadPool.dll +0 -0
  363. package/workers/vendor/csharp/_framework/supportFiles/157_System.Threading.Timer.dll +0 -0
  364. package/workers/vendor/csharp/_framework/supportFiles/158_System.Transactions.dll +0 -0
  365. package/workers/vendor/csharp/_framework/supportFiles/159_System.Transactions.Local.dll +0 -0
  366. package/workers/vendor/csharp/_framework/supportFiles/15_System.Collections.Specialized.dll +0 -0
  367. package/workers/vendor/csharp/_framework/supportFiles/160_System.ValueTuple.dll +0 -0
  368. package/workers/vendor/csharp/_framework/supportFiles/161_System.Web.dll +0 -0
  369. package/workers/vendor/csharp/_framework/supportFiles/162_System.Web.HttpUtility.dll +0 -0
  370. package/workers/vendor/csharp/_framework/supportFiles/163_System.Windows.dll +0 -0
  371. package/workers/vendor/csharp/_framework/supportFiles/164_System.Xml.dll +0 -0
  372. package/workers/vendor/csharp/_framework/supportFiles/165_System.Xml.Linq.dll +0 -0
  373. package/workers/vendor/csharp/_framework/supportFiles/166_System.Xml.ReaderWriter.dll +0 -0
  374. package/workers/vendor/csharp/_framework/supportFiles/167_System.Xml.Serialization.dll +0 -0
  375. package/workers/vendor/csharp/_framework/supportFiles/168_System.Xml.XDocument.dll +0 -0
  376. package/workers/vendor/csharp/_framework/supportFiles/169_System.Xml.XmlDocument.dll +0 -0
  377. package/workers/vendor/csharp/_framework/supportFiles/16_System.ComponentModel.Annotations.dll +0 -0
  378. package/workers/vendor/csharp/_framework/supportFiles/170_System.Xml.XmlSerializer.dll +0 -0
  379. package/workers/vendor/csharp/_framework/supportFiles/171_System.Xml.XPath.dll +0 -0
  380. package/workers/vendor/csharp/_framework/supportFiles/172_System.Xml.XPath.XDocument.dll +0 -0
  381. package/workers/vendor/csharp/_framework/supportFiles/173_TraceCode.CSharpHost.dll +0 -0
  382. package/workers/vendor/csharp/_framework/supportFiles/174_WindowsBase.dll +0 -0
  383. package/workers/vendor/csharp/_framework/supportFiles/17_System.ComponentModel.DataAnnotations.dll +0 -0
  384. package/workers/vendor/csharp/_framework/supportFiles/18_System.ComponentModel.dll +0 -0
  385. package/workers/vendor/csharp/_framework/supportFiles/19_System.ComponentModel.EventBasedAsync.dll +0 -0
  386. package/workers/vendor/csharp/_framework/supportFiles/1_Microsoft.CodeAnalysis.dll +0 -0
  387. package/workers/vendor/csharp/_framework/supportFiles/20_System.ComponentModel.Primitives.dll +0 -0
  388. package/workers/vendor/csharp/_framework/supportFiles/21_System.ComponentModel.TypeConverter.dll +0 -0
  389. package/workers/vendor/csharp/_framework/supportFiles/22_System.Configuration.dll +0 -0
  390. package/workers/vendor/csharp/_framework/supportFiles/23_System.Console.dll +0 -0
  391. package/workers/vendor/csharp/_framework/supportFiles/24_System.Core.dll +0 -0
  392. package/workers/vendor/csharp/_framework/supportFiles/25_System.Data.Common.dll +0 -0
  393. package/workers/vendor/csharp/_framework/supportFiles/26_System.Data.DataSetExtensions.dll +0 -0
  394. package/workers/vendor/csharp/_framework/supportFiles/27_System.Data.dll +0 -0
  395. package/workers/vendor/csharp/_framework/supportFiles/28_System.Diagnostics.Contracts.dll +0 -0
  396. package/workers/vendor/csharp/_framework/supportFiles/29_System.Diagnostics.Debug.dll +0 -0
  397. package/workers/vendor/csharp/_framework/supportFiles/2_Microsoft.CSharp.dll +0 -0
  398. package/workers/vendor/csharp/_framework/supportFiles/30_System.Diagnostics.DiagnosticSource.dll +0 -0
  399. package/workers/vendor/csharp/_framework/supportFiles/31_System.Diagnostics.FileVersionInfo.dll +0 -0
  400. package/workers/vendor/csharp/_framework/supportFiles/32_System.Diagnostics.Process.dll +0 -0
  401. package/workers/vendor/csharp/_framework/supportFiles/33_System.Diagnostics.StackTrace.dll +0 -0
  402. package/workers/vendor/csharp/_framework/supportFiles/34_System.Diagnostics.TextWriterTraceListener.dll +0 -0
  403. package/workers/vendor/csharp/_framework/supportFiles/35_System.Diagnostics.Tools.dll +0 -0
  404. package/workers/vendor/csharp/_framework/supportFiles/36_System.Diagnostics.TraceSource.dll +0 -0
  405. package/workers/vendor/csharp/_framework/supportFiles/37_System.Diagnostics.Tracing.dll +0 -0
  406. package/workers/vendor/csharp/_framework/supportFiles/38_System.dll +0 -0
  407. package/workers/vendor/csharp/_framework/supportFiles/39_System.Drawing.dll +0 -0
  408. package/workers/vendor/csharp/_framework/supportFiles/3_Microsoft.VisualBasic.Core.dll +0 -0
  409. package/workers/vendor/csharp/_framework/supportFiles/40_System.Drawing.Primitives.dll +0 -0
  410. package/workers/vendor/csharp/_framework/supportFiles/41_System.Dynamic.Runtime.dll +0 -0
  411. package/workers/vendor/csharp/_framework/supportFiles/42_System.Formats.Asn1.dll +0 -0
  412. package/workers/vendor/csharp/_framework/supportFiles/43_System.Formats.Tar.dll +0 -0
  413. package/workers/vendor/csharp/_framework/supportFiles/44_System.Globalization.Calendars.dll +0 -0
  414. package/workers/vendor/csharp/_framework/supportFiles/45_System.Globalization.dll +0 -0
  415. package/workers/vendor/csharp/_framework/supportFiles/46_System.Globalization.Extensions.dll +0 -0
  416. package/workers/vendor/csharp/_framework/supportFiles/47_System.IO.Compression.Brotli.dll +0 -0
  417. package/workers/vendor/csharp/_framework/supportFiles/48_System.IO.Compression.dll +0 -0
  418. package/workers/vendor/csharp/_framework/supportFiles/49_System.IO.Compression.FileSystem.dll +0 -0
  419. package/workers/vendor/csharp/_framework/supportFiles/4_Microsoft.VisualBasic.dll +0 -0
  420. package/workers/vendor/csharp/_framework/supportFiles/50_System.IO.Compression.ZipFile.dll +0 -0
  421. package/workers/vendor/csharp/_framework/supportFiles/51_System.IO.dll +0 -0
  422. package/workers/vendor/csharp/_framework/supportFiles/52_System.IO.FileSystem.AccessControl.dll +0 -0
  423. package/workers/vendor/csharp/_framework/supportFiles/53_System.IO.FileSystem.dll +0 -0
  424. package/workers/vendor/csharp/_framework/supportFiles/54_System.IO.FileSystem.DriveInfo.dll +0 -0
  425. package/workers/vendor/csharp/_framework/supportFiles/55_System.IO.FileSystem.Primitives.dll +0 -0
  426. package/workers/vendor/csharp/_framework/supportFiles/56_System.IO.FileSystem.Watcher.dll +0 -0
  427. package/workers/vendor/csharp/_framework/supportFiles/57_System.IO.IsolatedStorage.dll +0 -0
  428. package/workers/vendor/csharp/_framework/supportFiles/58_System.IO.MemoryMappedFiles.dll +0 -0
  429. package/workers/vendor/csharp/_framework/supportFiles/59_System.IO.Pipelines.dll +0 -0
  430. package/workers/vendor/csharp/_framework/supportFiles/5_Microsoft.Win32.Primitives.dll +0 -0
  431. package/workers/vendor/csharp/_framework/supportFiles/60_System.IO.Pipes.AccessControl.dll +0 -0
  432. package/workers/vendor/csharp/_framework/supportFiles/61_System.IO.Pipes.dll +0 -0
  433. package/workers/vendor/csharp/_framework/supportFiles/62_System.IO.UnmanagedMemoryStream.dll +0 -0
  434. package/workers/vendor/csharp/_framework/supportFiles/63_System.Linq.AsyncEnumerable.dll +0 -0
  435. package/workers/vendor/csharp/_framework/supportFiles/64_System.Linq.dll +0 -0
  436. package/workers/vendor/csharp/_framework/supportFiles/65_System.Linq.Expressions.dll +0 -0
  437. package/workers/vendor/csharp/_framework/supportFiles/66_System.Linq.Parallel.dll +0 -0
  438. package/workers/vendor/csharp/_framework/supportFiles/67_System.Linq.Queryable.dll +0 -0
  439. package/workers/vendor/csharp/_framework/supportFiles/68_System.Memory.dll +0 -0
  440. package/workers/vendor/csharp/_framework/supportFiles/69_System.Net.dll +0 -0
  441. package/workers/vendor/csharp/_framework/supportFiles/6_Microsoft.Win32.Registry.dll +0 -0
  442. package/workers/vendor/csharp/_framework/supportFiles/70_System.Net.Http.dll +0 -0
  443. package/workers/vendor/csharp/_framework/supportFiles/71_System.Net.Http.Json.dll +0 -0
  444. package/workers/vendor/csharp/_framework/supportFiles/72_System.Net.HttpListener.dll +0 -0
  445. package/workers/vendor/csharp/_framework/supportFiles/73_System.Net.Mail.dll +0 -0
  446. package/workers/vendor/csharp/_framework/supportFiles/74_System.Net.NameResolution.dll +0 -0
  447. package/workers/vendor/csharp/_framework/supportFiles/75_System.Net.NetworkInformation.dll +0 -0
  448. package/workers/vendor/csharp/_framework/supportFiles/76_System.Net.Ping.dll +0 -0
  449. package/workers/vendor/csharp/_framework/supportFiles/77_System.Net.Primitives.dll +0 -0
  450. package/workers/vendor/csharp/_framework/supportFiles/78_System.Net.Quic.dll +0 -0
  451. package/workers/vendor/csharp/_framework/supportFiles/79_System.Net.Requests.dll +0 -0
  452. package/workers/vendor/csharp/_framework/supportFiles/7_mscorlib.dll +0 -0
  453. package/workers/vendor/csharp/_framework/supportFiles/80_System.Net.Security.dll +0 -0
  454. package/workers/vendor/csharp/_framework/supportFiles/81_System.Net.ServerSentEvents.dll +0 -0
  455. package/workers/vendor/csharp/_framework/supportFiles/82_System.Net.ServicePoint.dll +0 -0
  456. package/workers/vendor/csharp/_framework/supportFiles/83_System.Net.Sockets.dll +0 -0
  457. package/workers/vendor/csharp/_framework/supportFiles/84_System.Net.WebClient.dll +0 -0
  458. package/workers/vendor/csharp/_framework/supportFiles/85_System.Net.WebHeaderCollection.dll +0 -0
  459. package/workers/vendor/csharp/_framework/supportFiles/86_System.Net.WebProxy.dll +0 -0
  460. package/workers/vendor/csharp/_framework/supportFiles/87_System.Net.WebSockets.Client.dll +0 -0
  461. package/workers/vendor/csharp/_framework/supportFiles/88_System.Net.WebSockets.dll +0 -0
  462. package/workers/vendor/csharp/_framework/supportFiles/89_System.Numerics.dll +0 -0
  463. package/workers/vendor/csharp/_framework/supportFiles/8_netstandard.dll +0 -0
  464. package/workers/vendor/csharp/_framework/supportFiles/90_System.Numerics.Vectors.dll +0 -0
  465. package/workers/vendor/csharp/_framework/supportFiles/91_System.ObjectModel.dll +0 -0
  466. package/workers/vendor/csharp/_framework/supportFiles/92_System.Private.CoreLib.dll +0 -0
  467. package/workers/vendor/csharp/_framework/supportFiles/93_System.Private.DataContractSerialization.dll +0 -0
  468. package/workers/vendor/csharp/_framework/supportFiles/94_System.Private.Uri.dll +0 -0
  469. package/workers/vendor/csharp/_framework/supportFiles/95_System.Private.Xml.dll +0 -0
  470. package/workers/vendor/csharp/_framework/supportFiles/96_System.Private.Xml.Linq.dll +0 -0
  471. package/workers/vendor/csharp/_framework/supportFiles/97_System.Reflection.DispatchProxy.dll +0 -0
  472. package/workers/vendor/csharp/_framework/supportFiles/98_System.Reflection.dll +0 -0
  473. package/workers/vendor/csharp/_framework/supportFiles/99_System.Reflection.Emit.dll +0 -0
  474. package/workers/vendor/csharp/_framework/supportFiles/9_System.AppContext.dll +0 -0
  475. package/workers/vendor/csharp/_framework/tr/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
  476. package/workers/vendor/csharp/_framework/tr/Microsoft.CodeAnalysis.resources.wasm +0 -0
  477. package/workers/vendor/csharp/_framework/zh-Hans/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
  478. package/workers/vendor/csharp/_framework/zh-Hans/Microsoft.CodeAnalysis.resources.wasm +0 -0
  479. package/workers/vendor/csharp/_framework/zh-Hant/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
  480. package/workers/vendor/csharp/_framework/zh-Hant/Microsoft.CodeAnalysis.resources.wasm +0 -0
  481. package/workers/vendor/csharp/main.mjs +5 -0
  482. package/workers/vendor/csharp/package.json +1 -0
  483. package/workers/vendor/java-browser-helper.jar +0 -0
  484. package/workers/vendor/java-rewriter.jar +0 -0
  485. package/workers/vendor/javascript-libraries.js +10106 -0
  486. package/dist/runtime-types-89nchXlY.d.cts +0 -89
  487. package/dist/runtime-types-CCQ-ZLc9.d.ts +0 -89
  488. package/dist/types-zyvpJKCi.d.cts +0 -100
  489. package/dist/types-zyvpJKCi.d.ts +0 -100
  490. package/workers/java/java-source-augmentations.cjs +0 -242
  491. package/workers/java/src/spike/user/TraceHooks.java +0 -619
  492. package/workers/vendor/java-browser-spike-helper.jar +0 -0
  493. package/workers/vendor/java-practice-rewriter.jar +0 -0
  494. package/workers/vendor/java-rewrite-bridge.jar +0 -0
package/dist/core.cjs CHANGED
@@ -20,383 +20,612 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // packages/harness-core/src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
- RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION: () => RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION,
24
- adaptJavaScriptTraceExecutionResult: () => adaptJavaScriptTraceExecutionResult,
25
- adaptJavaSpikeTraceExecutionResult: () => adaptJavaTraceExecutionResult,
26
- adaptJavaTraceExecutionResult: () => adaptJavaTraceExecutionResult,
27
- adaptPythonTraceExecutionResult: () => adaptPythonTraceExecutionResult,
28
- adaptTraceExecutionResult: () => adaptTraceExecutionResult,
29
- buildJavaExecutionResult: () => buildJavaExecutionResult,
30
- buildJavaSpikeExecutionResult: () => buildJavaExecutionResult,
23
+ LANGUAGE_RUNTIME_INFOS: () => LANGUAGE_RUNTIME_INFOS,
24
+ RUNTIME_TRACE_SCHEMA_VERSION: () => RUNTIME_TRACE_SCHEMA_VERSION,
25
+ SUPPORTED_LANGUAGE_RUNTIME_INFOS: () => SUPPORTED_LANGUAGE_RUNTIME_INFOS,
26
+ assertSupportedRawEmissions: () => assertSupportedRawEmissions,
27
+ buildRuntimeTraceParitySignature: () => buildRuntimeTraceParitySignature,
28
+ compareRawEmissionParity: () => compareRawEmissionParity,
29
+ createEmptyRuntimeTrace: () => createEmptyRuntimeTrace,
30
+ getLanguageRuntimeInfo: () => getLanguageRuntimeInfo,
31
+ getSupportedLanguageRuntimeInfos: () => getSupportedLanguageRuntimeInfos,
32
+ javaTraceHooksEventsToRuntimeTrace: () => javaTraceHooksEventsToRuntimeTrace,
33
+ normalizeJavaNativeTraceJsonPayload: () => normalizeJavaNativeTraceJsonPayload,
31
34
  normalizeJavaSerializedResult: () => normalizeJavaSerializedResult,
32
- normalizeJavaSpikeTraceContract: () => normalizeJavaTraceContract,
33
- normalizeJavaTraceContract: () => normalizeJavaTraceContract,
34
- normalizeRuntimeTraceContract: () => normalizeRuntimeTraceContract,
35
- stableStringifyRuntimeTraceContract: () => stableStringifyRuntimeTraceContract
35
+ summarizeJavaRawEmissions: () => summarizeJavaRawEmissions,
36
+ summarizeRuntimeTraceEmissions: () => summarizeRuntimeTraceEmissions,
37
+ withRuntimeTraceOptions: () => withRuntimeTraceOptions
36
38
  });
37
39
  module.exports = __toCommonJS(src_exports);
38
40
 
39
- // packages/harness-core/src/trace-contract.ts
40
- var RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION = "2026-04-21";
41
- var TRACE_EVENTS = /* @__PURE__ */ new Set([
42
- "line",
43
- "call",
44
- "return",
45
- "exception",
46
- "timeout",
47
- "stdout"
48
- ]);
49
- var TRACE_ACCESS_KINDS = /* @__PURE__ */ new Set([
50
- "indexed-read",
51
- "indexed-write",
52
- "cell-read",
53
- "cell-write",
54
- "mutating-call"
55
- ]);
56
- function normalizeLineNumber(value, fallback = 1) {
57
- if (typeof value !== "number" || !Number.isFinite(value)) return fallback;
58
- const normalized = Math.floor(value);
59
- return normalized > 0 ? normalized : fallback;
60
- }
61
- function normalizeOutputLineCount(value) {
62
- if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
63
- const normalized = Math.floor(value);
64
- return normalized >= 0 ? normalized : void 0;
65
- }
66
- function normalizeEvent(value) {
67
- if (typeof value === "string" && TRACE_EVENTS.has(value)) {
68
- return value;
69
- }
70
- return "line";
71
- }
72
- function normalizeAccessKind(value) {
73
- if (typeof value === "string" && TRACE_ACCESS_KINDS.has(value)) {
74
- return value;
75
- }
76
- return null;
77
- }
78
- function normalizeFunctionName(value) {
79
- if (typeof value === "string" && value.length > 0) return value;
80
- return "<module>";
81
- }
82
- function normalizeKind(value) {
83
- if (value === "map" || value === "set" || value === "hashmap" || value === "object") {
84
- return value;
85
- }
86
- return "hashmap";
87
- }
88
- function normalizeObjectKind(value) {
89
- if (value === "hashmap" || value === "object" || value === "map" || value === "set" || value === "tree" || value === "linked-list" || value === "graph-adjacency") {
90
- return value;
41
+ // packages/harness-core/src/generated/runtime-language-info-data.ts
42
+ var LANGUAGE_RUNTIME_INFOS = Object.freeze({
43
+ "python": {
44
+ "language": "python",
45
+ "displayName": "Python",
46
+ "versionLabel": "Python 3.13.2 (Pyodide 0.29.0)",
47
+ "description": "Python 3.13.2 (Pyodide 0.29.0).\n\nCommon algorithm helpers are imported automatically, including array, bisect, collections, functools, heapq, itertools. Other standard-library modules can be imported normally.\n\nsortedcontainers 2.4.0 is available for TreeMap, ordered-set, and sorted-list style workflows.",
48
+ "runtime": {
49
+ "name": "Pyodide",
50
+ "version": "0.29.0",
51
+ "detail": "CPython 3.13.2 compiled to WebAssembly."
52
+ },
53
+ "defaultImports": [
54
+ "array",
55
+ "bisect",
56
+ "collections",
57
+ "functools",
58
+ "heapq",
59
+ "itertools",
60
+ "operator",
61
+ "re",
62
+ "string",
63
+ "typing"
64
+ ],
65
+ "libraries": [
66
+ {
67
+ "name": "sortedcontainers",
68
+ "version": "2.4.0",
69
+ "importName": "sortedcontainers",
70
+ "detail": "SortedDict, SortedList, and SortedSet are loaded for tree-map/tree-set style use cases."
71
+ }
72
+ ]
73
+ },
74
+ "javascript": {
75
+ "language": "javascript",
76
+ "displayName": "JavaScript",
77
+ "versionLabel": "JavaScript (ECMAScript 2023)",
78
+ "runtime": {
79
+ "name": "Browser Worker JavaScript runtime",
80
+ "detail": "Runs in the host browser worker; Node.js is not required for browser execution."
81
+ },
82
+ "libraries": [
83
+ {
84
+ "name": "lodash",
85
+ "version": "4.17.21",
86
+ "importName": "lodash",
87
+ "globalName": "_"
88
+ },
89
+ {
90
+ "name": "@datastructures-js/binary-search-tree",
91
+ "version": "5.4.0",
92
+ "importName": "@datastructures-js/binary-search-tree"
93
+ },
94
+ {
95
+ "name": "@datastructures-js/deque",
96
+ "version": "1.0.8",
97
+ "importName": "@datastructures-js/deque"
98
+ },
99
+ {
100
+ "name": "@datastructures-js/graph",
101
+ "version": "5.3.1",
102
+ "importName": "@datastructures-js/graph"
103
+ },
104
+ {
105
+ "name": "@datastructures-js/heap",
106
+ "version": "4.3.7",
107
+ "importName": "@datastructures-js/heap"
108
+ },
109
+ {
110
+ "name": "@datastructures-js/linked-list",
111
+ "version": "6.1.4",
112
+ "importName": "@datastructures-js/linked-list"
113
+ },
114
+ {
115
+ "name": "@datastructures-js/priority-queue",
116
+ "version": "6.3.5",
117
+ "importName": "@datastructures-js/priority-queue"
118
+ },
119
+ {
120
+ "name": "@datastructures-js/queue",
121
+ "version": "4.3.0",
122
+ "importName": "@datastructures-js/queue"
123
+ },
124
+ {
125
+ "name": "@datastructures-js/set",
126
+ "version": "4.2.2",
127
+ "importName": "@datastructures-js/set"
128
+ },
129
+ {
130
+ "name": "@datastructures-js/stack",
131
+ "version": "3.1.6",
132
+ "importName": "@datastructures-js/stack"
133
+ },
134
+ {
135
+ "name": "@datastructures-js/trie",
136
+ "version": "4.2.3",
137
+ "importName": "@datastructures-js/trie"
138
+ }
139
+ ],
140
+ "standard": "ECMAScript 2023-compatible syntax in the browser worker lane.",
141
+ "description": 'JavaScript runs in an isolated browser Web Worker with ECMAScript 2023-compatible syntax.\n\nLodash 4.17.21 is available as both lodash and _.\n\nThe @datastructures-js packages are bundled for common algorithm data structures. Queue, Stack, Deque, Heap, PriorityQueue, MinPriorityQueue, and MaxPriorityQueue are available globally.\n\nBundled @datastructures-js versions:\n\n"@datastructures-js/binary-search-tree": "5.4.0"\n"@datastructures-js/deque": "1.0.8"\n"@datastructures-js/graph": "5.3.1"\n"@datastructures-js/heap": "4.3.7"\n"@datastructures-js/linked-list": "6.1.4"\n"@datastructures-js/priority-queue": "6.3.5"\n"@datastructures-js/queue": "4.3.0"\n"@datastructures-js/set": "4.2.2"\n"@datastructures-js/stack": "3.1.6"\n"@datastructures-js/trie": "4.2.3"\n\nBinary Search Tree, Trie, and Graph are bundled too, but are not exposed globally because those names can collide with problem definitions. Import or require the matching package when you need one.'
142
+ },
143
+ "typescript": {
144
+ "language": "typescript",
145
+ "displayName": "TypeScript",
146
+ "versionLabel": "TypeScript 5.9.3",
147
+ "description": 'TypeScript 5.9.3 is compiled in the browser and then executed on the JavaScript worker runtime.\n\nCompiler options: --target ES2020 --module None --strict false --esModuleInterop\n\nLodash 4.17.21 is available as both lodash and _.\n\nThe @datastructures-js packages are bundled for common algorithm data structures. Queue, Stack, Deque, Heap, PriorityQueue, MinPriorityQueue, and MaxPriorityQueue are available globally.\n\nBundled @datastructures-js versions:\n\n"@datastructures-js/binary-search-tree": "5.4.0"\n"@datastructures-js/deque": "1.0.8"\n"@datastructures-js/graph": "5.3.1"\n"@datastructures-js/heap": "4.3.7"\n"@datastructures-js/linked-list": "6.1.4"\n"@datastructures-js/priority-queue": "6.3.5"\n"@datastructures-js/queue": "4.3.0"\n"@datastructures-js/set": "4.2.2"\n"@datastructures-js/stack": "3.1.6"\n"@datastructures-js/trie": "4.2.3"\n\nBinary Search Tree, Trie, and Graph are bundled too, but are not exposed globally because those names can collide with problem definitions. Import or require the matching package when you need one.\n\nThe compiled output runs on the same browser worker execution lane as JavaScript submissions.',
148
+ "runtime": {
149
+ "name": "Browser Worker JavaScript runtime",
150
+ "detail": "TypeScript is compiled before execution and runs on the JavaScript worker lane."
151
+ },
152
+ "compiler": {
153
+ "name": "TypeScript",
154
+ "version": "5.9.3"
155
+ },
156
+ "standard": "Transpiles to JavaScript for the browser worker lane.",
157
+ "libraries": [
158
+ {
159
+ "name": "lodash",
160
+ "version": "4.17.21",
161
+ "importName": "lodash",
162
+ "globalName": "_"
163
+ },
164
+ {
165
+ "name": "@datastructures-js/binary-search-tree",
166
+ "version": "5.4.0",
167
+ "importName": "@datastructures-js/binary-search-tree"
168
+ },
169
+ {
170
+ "name": "@datastructures-js/deque",
171
+ "version": "1.0.8",
172
+ "importName": "@datastructures-js/deque"
173
+ },
174
+ {
175
+ "name": "@datastructures-js/graph",
176
+ "version": "5.3.1",
177
+ "importName": "@datastructures-js/graph"
178
+ },
179
+ {
180
+ "name": "@datastructures-js/heap",
181
+ "version": "4.3.7",
182
+ "importName": "@datastructures-js/heap"
183
+ },
184
+ {
185
+ "name": "@datastructures-js/linked-list",
186
+ "version": "6.1.4",
187
+ "importName": "@datastructures-js/linked-list"
188
+ },
189
+ {
190
+ "name": "@datastructures-js/priority-queue",
191
+ "version": "6.3.5",
192
+ "importName": "@datastructures-js/priority-queue"
193
+ },
194
+ {
195
+ "name": "@datastructures-js/queue",
196
+ "version": "4.3.0",
197
+ "importName": "@datastructures-js/queue"
198
+ },
199
+ {
200
+ "name": "@datastructures-js/set",
201
+ "version": "4.2.2",
202
+ "importName": "@datastructures-js/set"
203
+ },
204
+ {
205
+ "name": "@datastructures-js/stack",
206
+ "version": "3.1.6",
207
+ "importName": "@datastructures-js/stack"
208
+ },
209
+ {
210
+ "name": "@datastructures-js/trie",
211
+ "version": "4.2.3",
212
+ "importName": "@datastructures-js/trie"
213
+ }
214
+ ]
215
+ },
216
+ "java": {
217
+ "language": "java",
218
+ "displayName": "Java",
219
+ "versionLabel": "Java 17",
220
+ "description": "Java 17 is compiled with javac 17 and executed in the browser through CheerpJ 4.2.\n\nCommon imports are added automatically: java.util.*, java.io.*, java.math.*, java.util.stream.*, javafx.util.Pair.",
221
+ "runtime": {
222
+ "name": "CheerpJ browser-local OpenJDK runtime",
223
+ "version": "17",
224
+ "detail": "Loaded through CheerpJ 4.2."
225
+ },
226
+ "compiler": {
227
+ "name": "javac",
228
+ "version": "17"
229
+ },
230
+ "defaultImports": [
231
+ "java.util.*",
232
+ "java.io.*",
233
+ "java.math.*",
234
+ "java.util.stream.*",
235
+ "javafx.util.Pair"
236
+ ],
237
+ "libraries": [
238
+ {
239
+ "name": "JavaParser",
240
+ "version": "3.25.10",
241
+ "detail": "Used internally for Java source rewriting."
242
+ },
243
+ {
244
+ "name": "javafx.util.Pair",
245
+ "detail": "Small compatibility Pair class bundled with the Java helper jar."
246
+ }
247
+ ]
248
+ },
249
+ "csharp": {
250
+ "language": "csharp",
251
+ "displayName": "C#",
252
+ "versionLabel": "C# 14 (.NET 10.0.8)",
253
+ "description": "C# 14 with .NET 10.0.8 runtime.\n\nCode is compiled with Microsoft.CodeAnalysis.CSharp 5.3.0 and executed by a browser-local .NET WebAssembly runtime.\n\nCommon namespaces are imported automatically: System, System.Collections, System.Collections.Generic, System.Linq, System.Numerics, System.Text, System.Text.RegularExpressions.",
254
+ "runtime": {
255
+ "name": ".NET WebAssembly runtime",
256
+ "version": "10.0.8",
257
+ "detail": "Browser-local .NET runtime targeting net10.0."
258
+ },
259
+ "compiler": {
260
+ "name": "Microsoft.CodeAnalysis.CSharp",
261
+ "version": "5.3.0"
262
+ },
263
+ "standard": "C# 14",
264
+ "defaultImports": [
265
+ "System",
266
+ "System.Collections",
267
+ "System.Collections.Generic",
268
+ "System.Linq",
269
+ "System.Numerics",
270
+ "System.Text",
271
+ "System.Text.RegularExpressions"
272
+ ]
273
+ },
274
+ "cpp": {
275
+ "language": "cpp",
276
+ "displayName": "C++",
277
+ "versionLabel": "C++23 (YoWASP Clang 22)",
278
+ "description": "C++ is compiled with YoWASP Clang/LLD 22.0.0-git20542-10 using the C++23 standard.\n\nSubmissions compile to WebAssembly and run in a browser-local WASI-style execution lane. The harness currently compiles with -O0 and -fno-exceptions, with a fixed program stack size.\n\nCommon standard library headers are included automatically, including <algorithm>, <array>, <bitset>, <climits>, <cmath>, <cstdint>, <functional>, <limits>, <numeric>, <sstream>, <tuple>, <vector>, <unordered_map>, <unordered_set> and more.",
279
+ "runtime": {
280
+ "name": "WASI/WebAssembly execution lane",
281
+ "detail": "Compiled and executed in a browser-local WASI-style worker lane."
282
+ },
283
+ "compiler": {
284
+ "name": "YoWASP Clang/LLD",
285
+ "version": "22.0.0-git20542-10"
286
+ },
287
+ "standard": "C++23",
288
+ "defaultImports": [
289
+ "<algorithm>",
290
+ "<array>",
291
+ "<bitset>",
292
+ "<climits>",
293
+ "<cmath>",
294
+ "<cstdint>",
295
+ "<functional>",
296
+ "<limits>",
297
+ "<numeric>",
298
+ "<sstream>",
299
+ "<tuple>",
300
+ "<vector>",
301
+ "<unordered_map>",
302
+ "<unordered_set>",
303
+ "<map>",
304
+ "<set>",
305
+ "<deque>",
306
+ "<queue>",
307
+ "<stack>",
308
+ "<utility>",
309
+ "<string>",
310
+ "<span>",
311
+ "<ranges>",
312
+ "<concepts>",
313
+ "<any>",
314
+ "<bit>",
315
+ "<cctype>",
316
+ "<cerrno>",
317
+ "<cfloat>",
318
+ "<charconv>",
319
+ "<chrono>",
320
+ "<cinttypes>",
321
+ "<compare>",
322
+ "<complex>",
323
+ "<cstddef>",
324
+ "<cstdio>",
325
+ "<cstdlib>",
326
+ "<cstring>",
327
+ "<exception>",
328
+ "<expected>",
329
+ "<forward_list>",
330
+ "<initializer_list>",
331
+ "<iomanip>",
332
+ "<ios>",
333
+ "<iostream>",
334
+ "<iterator>",
335
+ "<list>",
336
+ "<memory>",
337
+ "<numbers>",
338
+ "<optional>",
339
+ "<random>",
340
+ "<ratio>",
341
+ "<regex>",
342
+ "<stdexcept>",
343
+ "<string_view>",
344
+ "<type_traits>",
345
+ "<typeindex>",
346
+ "<typeinfo>",
347
+ "<valarray>",
348
+ "<variant>",
349
+ "<version>"
350
+ ],
351
+ "libraries": [
352
+ {
353
+ "name": "C++ standard library and WASI libc",
354
+ "detail": "Provided by the YoWASP Clang toolchain bundle."
355
+ }
356
+ ]
91
357
  }
92
- return null;
93
- }
94
- function normalizeScalar(value) {
95
- if (value === null || value === void 0) return value;
96
- if (typeof value === "string" || typeof value === "boolean") return value;
97
- if (typeof value === "number") return Number.isFinite(value) ? value : String(value);
98
- if (typeof value === "bigint") {
99
- const asNumber = Number(value);
100
- return Number.isSafeInteger(asNumber) ? asNumber : String(value);
358
+ });
359
+
360
+ // packages/harness-core/src/runtime-language-info.ts
361
+ var SUPPORTED_LANGUAGE_RUNTIME_INFOS = Object.freeze(
362
+ Object.values(LANGUAGE_RUNTIME_INFOS)
363
+ );
364
+ function getLanguageRuntimeInfo(language) {
365
+ const info = LANGUAGE_RUNTIME_INFOS[language];
366
+ if (!info) {
367
+ throw new Error(`Runtime info for language "${language}" is not implemented yet.`);
101
368
  }
102
- if (typeof value === "function") return "<function>";
103
- return null;
369
+ return info;
104
370
  }
105
- function normalizeUnknown(value, depth = 0, seen = /* @__PURE__ */ new WeakSet()) {
106
- if (depth > 48) return "<max depth>";
107
- const scalar = normalizeScalar(value);
108
- if (scalar !== null || value === null || value === void 0) {
109
- return scalar;
110
- }
111
- if (Array.isArray(value)) {
112
- return value.map((item) => {
113
- if (item === void 0) return null;
114
- return normalizeUnknown(item, depth + 1, seen);
115
- });
116
- }
117
- if (typeof value === "object" && value) {
118
- if (seen.has(value)) return "<cycle>";
119
- seen.add(value);
120
- const normalized = {};
121
- for (const key of Object.keys(value).sort()) {
122
- const child = value[key];
123
- if (child === void 0) continue;
124
- normalized[key] = normalizeUnknown(child, depth + 1, seen);
125
- }
126
- seen.delete(value);
127
- return normalized;
128
- }
129
- return String(value);
371
+ function getSupportedLanguageRuntimeInfos() {
372
+ return SUPPORTED_LANGUAGE_RUNTIME_INFOS;
130
373
  }
131
- function normalizeAccesses(accesses) {
132
- if (!Array.isArray(accesses) || accesses.length === 0) {
133
- return void 0;
134
- }
135
- const normalized = accesses.map((access) => {
136
- const variable = typeof access?.variable === "string" && access.variable.length > 0 ? access.variable : "";
137
- const kind = normalizeAccessKind(access?.kind);
138
- if (!variable || !kind) {
139
- return null;
140
- }
141
- const indices = Array.isArray(access?.indices) ? access.indices.map(
142
- (index) => typeof index === "number" && Number.isFinite(index) ? Math.floor(index) : null
143
- ).filter((index) => index !== null) : void 0;
144
- const pathDepth = access?.pathDepth === 1 || access?.pathDepth === 2 ? access.pathDepth : void 0;
145
- const method = typeof access?.method === "string" && access.method.length > 0 ? access.method : void 0;
146
- const payload = {
147
- variable,
148
- kind
149
- };
150
- if (indices && indices.length > 0) {
151
- payload.indices = indices;
152
- }
153
- if (pathDepth !== void 0) {
154
- payload.pathDepth = pathDepth;
155
- }
156
- if (method) {
157
- payload.method = method;
158
- }
159
- return payload;
160
- }).filter((access) => access !== null);
161
- if (normalized.length === 0) {
162
- return void 0;
163
- }
164
- const statsByVariable = /* @__PURE__ */ new Map();
165
- for (const access of normalized) {
166
- const stats = statsByVariable.get(access.variable) ?? { hasCellRead: false, hasCellWrite: false };
167
- if (access.kind === "cell-read") stats.hasCellRead = true;
168
- if (access.kind === "cell-write") stats.hasCellWrite = true;
169
- statsByVariable.set(access.variable, stats);
170
- }
171
- const deduped = /* @__PURE__ */ new Set();
172
- const collapsed = normalized.filter((access) => {
173
- const stats = statsByVariable.get(access.variable);
174
- if (access.kind === "indexed-read" && (stats?.hasCellRead || stats?.hasCellWrite)) {
175
- return false;
176
- }
177
- if (access.kind === "indexed-write" && stats?.hasCellWrite) {
178
- return false;
179
- }
180
- const key = JSON.stringify([
181
- access.variable,
182
- access.kind,
183
- access.indices ?? null,
184
- access.pathDepth ?? null,
185
- access.method ?? null
186
- ]);
187
- if (deduped.has(key)) {
188
- return false;
189
- }
190
- deduped.add(key);
191
- return true;
192
- });
193
- return collapsed.length > 0 ? collapsed : void 0;
374
+
375
+ // packages/harness-core/src/runtime-trace.ts
376
+ var RUNTIME_TRACE_SCHEMA_VERSION = "runtime-trace-2026-04-28";
377
+ function createEmptyRuntimeTrace(language, options = {}) {
378
+ return {
379
+ schemaVersion: RUNTIME_TRACE_SCHEMA_VERSION,
380
+ language,
381
+ runId: options.runId ?? `${language}:run`,
382
+ events: [],
383
+ lineEventCount: 0,
384
+ traceStepCount: 0
385
+ };
194
386
  }
195
- function normalizeRecord(value) {
196
- if (!value || typeof value !== "object" || Array.isArray(value)) return {};
197
- return normalizeUnknown(value);
387
+ function sortedUnique(values) {
388
+ return [...new Set(values)].sort((left, right) => left.localeCompare(right));
198
389
  }
199
- function normalizeVariableSources(value) {
200
- if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
201
- const entries = Object.entries(value).filter(
202
- ([name, source]) => typeof name === "string" && name.length > 0 && (source === "user" || source === "user-input" || source === "harness-prelude")
203
- ).sort((a, b) => a[0].localeCompare(b[0]));
204
- if (entries.length === 0) return void 0;
205
- return Object.fromEntries(entries);
390
+ function sortedUniqueEventKinds(values) {
391
+ return [...new Set(values)].sort((left, right) => left.localeCompare(right));
206
392
  }
207
- function normalizeCallStackFrame(frame) {
393
+ function withRuntimeTraceOptions(trace, options = {}) {
394
+ const runId = options.runId ?? trace.runId;
208
395
  return {
209
- function: normalizeFunctionName(frame?.function),
210
- line: normalizeLineNumber(frame?.line, 1),
211
- args: normalizeRecord(frame?.args)
396
+ ...trace,
397
+ runId,
398
+ events: trace.events.map((event) => ({
399
+ ...event,
400
+ runId,
401
+ ...options.file ? { file: options.file } : {}
402
+ }))
212
403
  };
213
404
  }
214
- function normalizeVisualizationPayload(payload) {
215
- const hashMaps = Array.isArray(payload?.hashMaps) ? payload.hashMaps.map((entry) => ({
216
- name: typeof entry?.name === "string" ? entry.name : "",
217
- kind: normalizeKind(entry?.kind),
218
- entries: Array.isArray(entry?.entries) ? entry.entries.map((item) => ({
219
- key: normalizeUnknown(item?.key),
220
- value: normalizeUnknown(item?.value),
221
- ...item?.highlight ? { highlight: true } : {}
222
- })) : [],
223
- ...entry?.highlightedKey !== void 0 ? { highlightedKey: normalizeUnknown(entry.highlightedKey) } : {},
224
- ...entry?.deletedKey !== void 0 ? { deletedKey: normalizeUnknown(entry.deletedKey) } : {},
225
- ...typeof entry?.objectClassName === "string" && entry.objectClassName.length > 0 ? { objectClassName: entry.objectClassName } : {},
226
- ...typeof entry?.objectId === "string" && entry.objectId.length > 0 ? { objectId: entry.objectId } : {}
227
- })).sort((a, b) => `${a.name}:${a.kind}`.localeCompare(`${b.name}:${b.kind}`)) : [];
228
- const objectKinds = payload?.objectKinds && typeof payload.objectKinds === "object" ? Object.fromEntries(
229
- Object.entries(payload.objectKinds).filter(([name]) => typeof name === "string" && name.length > 0).map(([name, kind]) => [name, normalizeObjectKind(kind)]).filter((entry) => entry[1] !== null).sort((a, b) => a[0].localeCompare(b[0]))
230
- ) : void 0;
231
- if (hashMaps.length === 0 && (!objectKinds || Object.keys(objectKinds).length === 0)) {
232
- return void 0;
405
+ function buildRuntimeTraceParitySignature(trace) {
406
+ const lineSequence = [];
407
+ const eventKindsByLine = /* @__PURE__ */ new Map();
408
+ const variableSnapshotsByLine = /* @__PURE__ */ new Map();
409
+ const accessTargetsByLine = /* @__PURE__ */ new Map();
410
+ const callReturnShape = [];
411
+ for (const event of trace.events) {
412
+ if (event.kind === "line" && typeof event.line === "number") {
413
+ lineSequence.push(event.line);
414
+ }
415
+ if (event.kind === "call" || event.kind === "return") {
416
+ callReturnShape.push(event.kind);
417
+ }
418
+ if (typeof event.line === "number") {
419
+ const kinds = eventKindsByLine.get(event.line) ?? [];
420
+ kinds.push(event.kind);
421
+ eventKindsByLine.set(event.line, kinds);
422
+ }
423
+ if (event.kind === "snapshot" && "variable" in event.target && typeof event.line === "number") {
424
+ const variables = variableSnapshotsByLine.get(event.line) ?? [];
425
+ variables.push(event.target.variable);
426
+ variableSnapshotsByLine.set(event.line, variables);
427
+ }
428
+ if ((event.kind === "read" || event.kind === "write" || event.kind === "mutate") && "variable" in event.target && typeof event.line === "number") {
429
+ const accesses = accessTargetsByLine.get(event.line) ?? [];
430
+ accesses.push({
431
+ kind: event.kind,
432
+ variable: event.target.variable,
433
+ pathDepth: "path" in event.target && Array.isArray(event.target.path) ? event.target.path.length : void 0
434
+ });
435
+ accessTargetsByLine.set(event.line, accesses);
436
+ }
233
437
  }
234
438
  return {
235
- ...hashMaps.length > 0 ? { hashMaps } : {},
236
- ...objectKinds && Object.keys(objectKinds).length > 0 ? { objectKinds } : {}
439
+ lineSequence,
440
+ eventKindsByLine: Object.fromEntries(
441
+ [...eventKindsByLine.entries()].map(([line, kinds]) => [
442
+ line,
443
+ sortedUniqueEventKinds(kinds)
444
+ ])
445
+ ),
446
+ variableSnapshotsByLine: Object.fromEntries(
447
+ [...variableSnapshotsByLine.entries()].map(([line, variables]) => [
448
+ line,
449
+ sortedUnique(variables)
450
+ ])
451
+ ),
452
+ accessTargetsByLine: Object.fromEntries(
453
+ [...accessTargetsByLine.entries()].map(([line, accesses]) => [
454
+ line,
455
+ accesses.sort((left, right) => {
456
+ const leftKey = `${left.kind}:${left.variable ?? ""}:${left.pathDepth ?? 0}`;
457
+ const rightKey = `${right.kind}:${right.variable ?? ""}:${right.pathDepth ?? 0}`;
458
+ return leftKey.localeCompare(rightKey);
459
+ })
460
+ ])
461
+ ),
462
+ callReturnShape
237
463
  };
238
464
  }
239
- function normalizeTraceStep(step) {
240
- const normalizedStdoutCount = normalizeOutputLineCount(step?.stdoutLineCount);
241
- const normalizedVisualization = normalizeVisualizationPayload(step?.visualization);
242
- const normalizedAccesses = normalizeAccesses(step?.accesses);
243
- const normalizedVariableSources = normalizeVariableSources(step?.variableSources);
244
- return {
245
- event: normalizeEvent(step?.event),
246
- line: normalizeLineNumber(step?.line, 1),
247
- function: normalizeFunctionName(step?.function),
248
- variables: normalizeRecord(step?.variables),
249
- ...normalizedVariableSources ? { variableSources: normalizedVariableSources } : {},
250
- ...Array.isArray(step?.callStack) && step.callStack.length > 0 ? { callStack: step.callStack.map(normalizeCallStackFrame) } : {},
251
- ...normalizedAccesses ? { accesses: normalizedAccesses } : {},
252
- ...step?.returnValue !== void 0 ? { returnValue: normalizeUnknown(step.returnValue) } : {},
253
- ...normalizedStdoutCount !== void 0 ? { stdoutLineCount: normalizedStdoutCount } : {},
254
- ...normalizedVisualization ? { visualization: normalizedVisualization } : {}
255
- };
465
+
466
+ // packages/harness-core/src/runtime-raw-emission-contract.ts
467
+ function sortedUnique2(values) {
468
+ return [...new Set(values)].sort((left, right) => left.localeCompare(right));
469
+ }
470
+ var FORBIDDEN_RUNTIME_TRACE_TOKENS = [
471
+ "visualization",
472
+ "objectKinds",
473
+ "hashMaps",
474
+ "graph-adjacency",
475
+ "linked-list",
476
+ "tree"
477
+ ];
478
+ var FORBIDDEN_RUNTIME_TRACE_KEYS = /* @__PURE__ */ new Set([
479
+ "visualization",
480
+ "objectKinds",
481
+ "hashMaps",
482
+ "graph-adjacency",
483
+ "linked-list"
484
+ ]);
485
+ function normalizeJavaNativeTraceJsonPayload(payload) {
486
+ return payload.replace(/(?<![A-Za-z0-9_"])-Infinity(?![A-Za-z0-9_"])/g, '"-Infinity"').replace(/(?<![A-Za-z0-9_"])Infinity(?![A-Za-z0-9_"])/g, '"Infinity"').replace(/(?<![A-Za-z0-9_"])NaN(?![A-Za-z0-9_"])/g, '"NaN"');
256
487
  }
257
- function collapseTraceAccessNoise(trace) {
258
- const variablesWithCellAccess = /* @__PURE__ */ new Set();
259
- const accessStatsByVariable = /* @__PURE__ */ new Map();
260
- for (const step of trace) {
261
- for (const access of step.accesses ?? []) {
262
- const stats = accessStatsByVariable.get(access.variable) ?? {
263
- hasCellRead: false,
264
- hasCellWrite: false,
265
- hasMutatingCall: false,
266
- hasIndexedWrite: false
267
- };
268
- if (access.kind === "cell-read" || access.kind === "cell-write") {
269
- variablesWithCellAccess.add(access.variable);
270
- }
271
- if (access.kind === "cell-read") stats.hasCellRead = true;
272
- if (access.kind === "cell-write") stats.hasCellWrite = true;
273
- if (access.kind === "mutating-call") stats.hasMutatingCall = true;
274
- if (access.kind === "indexed-write") stats.hasIndexedWrite = true;
275
- accessStatsByVariable.set(access.variable, stats);
488
+ function forbiddenRuntimeTraceTokens(value) {
489
+ const tokens = /* @__PURE__ */ new Set();
490
+ collectForbiddenRuntimeTraceTokens(value, tokens, null, false);
491
+ return FORBIDDEN_RUNTIME_TRACE_TOKENS.filter((token) => tokens.has(token));
492
+ }
493
+ function collectForbiddenRuntimeTraceTokens(value, tokens, parentKey, semanticPayload) {
494
+ if (typeof value === "string") {
495
+ if ((semanticPayload || parentKey === "kind" || parentKey === "type" || parentKey === "category") && FORBIDDEN_RUNTIME_TRACE_TOKENS.includes(value)) {
496
+ tokens.add(value);
276
497
  }
498
+ return;
277
499
  }
278
- if (variablesWithCellAccess.size === 0) {
279
- return trace;
500
+ if (value === null || typeof value !== "object") return;
501
+ if (Array.isArray(value)) {
502
+ for (const item of value) collectForbiddenRuntimeTraceTokens(item, tokens, parentKey, semanticPayload);
503
+ return;
280
504
  }
281
- return trace.map((step) => {
282
- if (!step.accesses?.length) {
283
- return step;
284
- }
285
- const filtered = step.accesses.filter((access) => {
286
- const stats = accessStatsByVariable.get(access.variable);
287
- if (variablesWithCellAccess.has(access.variable)) {
288
- return access.kind !== "indexed-read" && access.kind !== "indexed-write";
289
- }
290
- if (access.kind === "mutating-call" && stats?.hasIndexedWrite && !stats.hasCellRead && !stats.hasCellWrite) {
291
- return false;
292
- }
293
- if (access.kind === "indexed-read" && stats?.hasMutatingCall && !stats.hasIndexedWrite && !stats.hasCellRead && !stats.hasCellWrite) {
294
- return false;
295
- }
296
- return true;
297
- });
298
- if (filtered.length === step.accesses.length) {
299
- return step;
300
- }
301
- return {
302
- ...step,
303
- ...filtered.length > 0 ? { accesses: filtered } : {},
304
- ...filtered.length === 0 ? { accesses: void 0 } : {}
305
- };
505
+ const entries = Object.entries(value);
506
+ const objectSemanticPayload = entries.some(([key, child]) => {
507
+ if (parentKey !== "args" && FORBIDDEN_RUNTIME_TRACE_KEYS.has(key)) return true;
508
+ return (key === "kind" || key === "type" || key === "category") && typeof child === "string" && FORBIDDEN_RUNTIME_TRACE_TOKENS.includes(child);
306
509
  });
510
+ for (const [key, child] of entries) {
511
+ if (parentKey !== "args" && FORBIDDEN_RUNTIME_TRACE_KEYS.has(key)) {
512
+ tokens.add(key);
513
+ }
514
+ if (key === "target" || key === "variable" || key === "function") continue;
515
+ collectForbiddenRuntimeTraceTokens(child, tokens, key, semanticPayload || objectSemanticPayload);
516
+ }
307
517
  }
308
- function normalizeRuntimeTraceContract(language, result) {
309
- const rawNormalizedTrace = collapseTraceAccessNoise(
310
- Array.isArray(result.trace) ? result.trace.map(normalizeTraceStep) : []
311
- );
312
- const maxTraceSteps = typeof result.maxTraceSteps === "number" && Number.isFinite(result.maxTraceSteps) ? Math.max(1, Math.floor(result.maxTraceSteps)) : void 0;
313
- const traceWasClipped = maxTraceSteps !== void 0 && rawNormalizedTrace.length > maxTraceSteps;
314
- const normalizedTrace = traceWasClipped && maxTraceSteps !== void 0 ? rawNormalizedTrace.slice(0, maxTraceSteps) : rawNormalizedTrace;
315
- const lineEventCount = typeof result.lineEventCount === "number" && Number.isFinite(result.lineEventCount) ? Math.floor(result.lineEventCount) : normalizedTrace.filter((step) => step.event === "line").length;
316
- const normalizedConsole = Array.isArray(result.consoleOutput) ? result.consoleOutput.map((line) => String(line)) : [];
317
- return {
318
- schemaVersion: RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION,
319
- language,
320
- success: Boolean(result.success),
321
- ...Object.prototype.hasOwnProperty.call(result, "output") ? { output: normalizeUnknown(result.output) } : {},
322
- ...typeof result.error === "string" && result.error.length > 0 ? { error: result.error } : {},
323
- ...typeof result.errorLine === "number" && Number.isFinite(result.errorLine) ? { errorLine: Math.floor(result.errorLine) } : {},
324
- consoleOutput: normalizedConsole,
325
- trace: normalizedTrace,
326
- ...result.traceLimitExceeded !== void 0 || traceWasClipped ? { traceLimitExceeded: Boolean(result.traceLimitExceeded) || traceWasClipped } : {},
327
- ...typeof result.timeoutReason === "string" && result.timeoutReason.length > 0 ? { timeoutReason: result.timeoutReason } : {},
328
- lineEventCount: Math.max(0, lineEventCount),
329
- traceStepCount: normalizedTrace.length
330
- };
331
- }
332
- function stableStringifyRuntimeTraceContract(value) {
333
- return JSON.stringify(normalizeUnknown(value), null, 2);
518
+ function unsupportedForbiddenPayload(label, value) {
519
+ const tokens = forbiddenRuntimeTraceTokens(value);
520
+ if (tokens.length === 0) return null;
521
+ return `${label} contains forbidden runtime trace token(s): ${tokens.join(", ")}`;
334
522
  }
335
-
336
- // packages/harness-core/src/trace-adapters/shared.ts
337
- function denormalizeCallStackFrame(frame) {
338
- return {
339
- function: frame.function,
340
- line: frame.line,
341
- args: frame.args
342
- };
523
+ function javaNativeTracePayloadKind(event) {
524
+ if (!event.startsWith("trace:")) return null;
525
+ try {
526
+ const parsed = JSON.parse(normalizeJavaNativeTraceJsonPayload(event.slice("trace:".length)));
527
+ if (parsed.kind === "line") return "line";
528
+ if (parsed.kind === "call") return "call";
529
+ if (parsed.kind === "return") return "return";
530
+ if (parsed.kind === "exception") return "exception";
531
+ if (parsed.kind === "timeout") return "timeout";
532
+ if (parsed.kind === "stdout") return "stdout";
533
+ if (parsed.kind === "snapshot") return "snapshot";
534
+ if (parsed.kind === "read") return "read";
535
+ if (parsed.kind === "write") return "write";
536
+ if (parsed.kind === "mutate") return "mutate";
537
+ } catch {
538
+ return null;
539
+ }
540
+ return null;
343
541
  }
344
- function denormalizeTraceStep(step) {
542
+ function summarizeJavaRawEmissions(events) {
543
+ const kinds = [];
544
+ const unsupported = [];
545
+ for (const [index, event] of events.entries()) {
546
+ if (event.startsWith("trace:")) {
547
+ try {
548
+ const parsed = JSON.parse(normalizeJavaNativeTraceJsonPayload(event.slice("trace:".length)));
549
+ const forbiddenPayload = unsupportedForbiddenPayload(`java trace event ${index}`, parsed);
550
+ if (forbiddenPayload) {
551
+ unsupported.push(forbiddenPayload);
552
+ continue;
553
+ }
554
+ } catch {
555
+ }
556
+ }
557
+ const nativeKind = javaNativeTracePayloadKind(event);
558
+ if (nativeKind) {
559
+ kinds.push(nativeKind);
560
+ continue;
561
+ }
562
+ unsupported.push(event);
563
+ }
345
564
  return {
346
- line: step.line,
347
- event: step.event,
348
- variables: step.variables,
349
- function: step.function,
350
- ...step.callStack ? { callStack: step.callStack.map(denormalizeCallStackFrame) } : {},
351
- ...step.accesses ? { accesses: step.accesses } : {},
352
- ...step.returnValue !== void 0 ? { returnValue: step.returnValue } : {},
353
- ...step.stdoutLineCount !== void 0 ? { stdoutLineCount: step.stdoutLineCount } : {},
354
- ...step.visualization ? { visualization: step.visualization } : {}
565
+ language: "java",
566
+ kinds: sortedUnique2(kinds),
567
+ unsupported
355
568
  };
356
569
  }
357
- function adaptTraceExecutionResult(language, result) {
358
- const normalized = normalizeRuntimeTraceContract(language, result);
359
- const adaptedTrace = normalized.trace.map(denormalizeTraceStep);
570
+ function summarizeRuntimeTraceEmissions(trace) {
571
+ const kinds = [];
572
+ const unsupported = [];
573
+ for (const [index, event] of trace.events.entries()) {
574
+ const forbiddenPayload = unsupportedForbiddenPayload(`${trace.language} trace event ${index}`, event);
575
+ if (forbiddenPayload) {
576
+ unsupported.push(forbiddenPayload);
577
+ continue;
578
+ }
579
+ switch (event.kind) {
580
+ case "line":
581
+ case "call":
582
+ case "return":
583
+ case "exception":
584
+ case "timeout":
585
+ case "stdout":
586
+ case "snapshot":
587
+ case "read":
588
+ case "write":
589
+ case "mutate":
590
+ kinds.push(event.kind);
591
+ break;
592
+ default:
593
+ unsupported.push(`${trace.language} trace event ${index} has unsupported kind "${String(event.kind)}"`);
594
+ }
595
+ }
360
596
  return {
361
- success: normalized.success,
362
- ...Object.prototype.hasOwnProperty.call(normalized, "output") ? { output: normalized.output } : {},
363
- ...normalized.error ? { error: normalized.error } : {},
364
- ...normalized.errorLine !== void 0 ? { errorLine: normalized.errorLine } : {},
365
- trace: adaptedTrace,
366
- executionTimeMs: typeof result.executionTimeMs === "number" && Number.isFinite(result.executionTimeMs) ? result.executionTimeMs : 0,
367
- consoleOutput: normalized.consoleOutput,
368
- ...normalized.traceLimitExceeded !== void 0 ? { traceLimitExceeded: normalized.traceLimitExceeded } : {},
369
- ...normalized.timeoutReason ? { timeoutReason: normalized.timeoutReason } : {},
370
- lineEventCount: normalized.lineEventCount,
371
- traceStepCount: adaptedTrace.length
597
+ language: trace.language,
598
+ kinds: sortedUnique2(kinds),
599
+ unsupported
372
600
  };
373
601
  }
374
-
375
- // packages/harness-core/src/trace-adapters/python.ts
376
- function adaptPythonTraceExecutionResult(result) {
377
- return adaptTraceExecutionResult("python", result);
602
+ function assertSupportedRawEmissions(summary, label) {
603
+ if (summary.unsupported.length > 0) {
604
+ throw new Error(
605
+ `${label} emitted unsupported raw runtime payloads:
606
+ ${summary.unsupported.slice(0, 20).join("\n")}`
607
+ );
608
+ }
378
609
  }
379
-
380
- // packages/harness-core/src/trace-adapters/javascript.ts
381
- function adaptJavaScriptTraceExecutionResult(language, result) {
382
- return adaptTraceExecutionResult(language, result);
610
+ function parityKinds(summary) {
611
+ return summary.kinds;
383
612
  }
384
-
385
- // packages/harness-core/src/trace-adapters/java.ts
386
- function parseScalar(raw) {
387
- if (raw === "null") return null;
388
- if (raw === "true") return true;
389
- if (raw === "false") return false;
390
- if (/^-?\d+$/.test(raw)) return Number.parseInt(raw, 10);
391
- if (/^-?\d+\.\d+$/.test(raw)) return Number.parseFloat(raw);
392
- if (raw.startsWith('"') && raw.endsWith('"') || raw.startsWith("[") && raw.endsWith("]") || raw.startsWith("{") && raw.endsWith("}")) {
393
- try {
394
- return JSON.parse(raw);
395
- } catch {
613
+ function compareRawEmissionParity(reference, summaries) {
614
+ const expected = new Set(parityKinds(reference));
615
+ const mismatches = [];
616
+ for (const summary of summaries) {
617
+ if (summary.language === reference.language) continue;
618
+ const actual = new Set(parityKinds(summary));
619
+ const missing = [...expected].filter((kind) => !actual.has(kind)).sort((left, right) => left.localeCompare(right));
620
+ const extra = [...actual].filter((kind) => !expected.has(kind)).sort((left, right) => left.localeCompare(right));
621
+ if (missing.length > 0 || extra.length > 0) {
622
+ mismatches.push({ language: summary.language, missing, extra });
396
623
  }
397
624
  }
398
- return raw;
625
+ return mismatches;
399
626
  }
627
+
628
+ // packages/harness-core/src/trace-adapters/java.ts
400
629
  function normalizeJavaSerializedResult(output) {
401
630
  if (typeof output !== "string") {
402
631
  return output;
@@ -407,30 +636,8 @@ function normalizeJavaSerializedResult(output) {
407
636
  return output;
408
637
  }
409
638
  }
410
- function parseKeyValuePairs(fragment) {
411
- const variables = {};
412
- const matches = Array.from(fragment.matchAll(/\b([A-Za-z_][A-Za-z0-9_.]*)=/g));
413
- for (let index = 0; index < matches.length; index += 1) {
414
- const match = matches[index];
415
- const rawKey = match[1];
416
- const valueStart = (match.index ?? 0) + match[0].length;
417
- const valueEnd = index + 1 < matches.length ? matches[index + 1].index ?? fragment.length : fragment.length;
418
- const rawValue = fragment.slice(valueStart, valueEnd).trim();
419
- if (!rawKey || rawValue === void 0) continue;
420
- if (rawKey === "method") continue;
421
- variables[rawKey.replaceAll(".", "_")] = parseScalar(rawValue);
422
- }
423
- return variables;
424
- }
425
- function extractLineMetadata(event) {
426
- const match = event.match(/^line=(\d+)(?:\s+(.*))?$/);
427
- if (!match) {
428
- return { line: 1, payload: event };
429
- }
430
- return {
431
- line: Number.parseInt(match[1], 10),
432
- payload: match[2] ?? ""
433
- };
639
+ function isNativeJavaTraceEvent(event) {
640
+ return event.startsWith("trace:");
434
641
  }
435
642
  function stripInlineComments(line, inBlockComment) {
436
643
  let result = "";
@@ -453,9 +660,7 @@ function stripInlineComments(line, inBlockComment) {
453
660
  index += 2;
454
661
  continue;
455
662
  }
456
- if (current === "/" && next === "/") {
457
- break;
458
- }
663
+ if (current === "/" && next === "/") break;
459
664
  result += current;
460
665
  index += 1;
461
666
  }
@@ -468,532 +673,208 @@ function isMethodDeclarationLine(line) {
468
673
  if (!trimmed.includes("(") || !trimmed.includes(")")) return false;
469
674
  if (trimmed.endsWith(";")) return false;
470
675
  if (trimmed.includes("->")) return false;
471
- if (/^(?:if|for|while|switch|catch|do|try|else|return|throw|new)\b/.test(trimmed)) {
472
- return false;
473
- }
474
- if (!/[A-Za-z_][A-Za-z0-9_]*\s*\([^{};]*\)/.test(trimmed)) {
475
- return false;
476
- }
676
+ if (/^(?:if|for|while|switch|catch|do|try|else|return|throw|new)\b/.test(trimmed)) return false;
677
+ if (!/[A-Za-z_][A-Za-z0-9_]*\s*\([^{};]*\)/.test(trimmed)) return false;
477
678
  return /(?:\{\s*)?$/.test(trimmed);
478
679
  }
479
- function buildLineRemap(sourceText) {
480
- if (typeof sourceText !== "string" || sourceText.length === 0) {
481
- return null;
482
- }
680
+ function buildLocalDeclarationNamesByLine(sourceText) {
681
+ const namesByLine = /* @__PURE__ */ new Map();
682
+ if (typeof sourceText !== "string" || sourceText.length === 0) return namesByLine;
483
683
  const lines = sourceText.split(/\r?\n/);
484
- const executable = /* @__PURE__ */ new Set();
485
684
  let inBlockComment = false;
486
685
  for (let index = 0; index < lines.length; index += 1) {
487
686
  const { text, inBlockComment: nextInBlockComment } = stripInlineComments(lines[index] ?? "", inBlockComment);
488
687
  inBlockComment = nextInBlockComment;
489
- if (text.trim().length > 0) {
490
- executable.add(index + 1);
491
- }
492
- }
493
- if (executable.size === 0) {
494
- return null;
495
- }
496
- const nextExecutableAtOrAfter = new Array(lines.length + 2).fill(null);
497
- let nextExecutable = null;
498
- for (let line = lines.length; line >= 1; line -= 1) {
499
- if (executable.has(line)) {
500
- nextExecutable = line;
501
- }
502
- nextExecutableAtOrAfter[line] = nextExecutable;
503
- }
504
- const previousExecutableAtOrBefore = new Array(lines.length + 2).fill(null);
505
- let previousExecutable = null;
506
- for (let line = 1; line <= lines.length; line += 1) {
507
- if (executable.has(line)) {
508
- previousExecutable = line;
509
- }
510
- previousExecutableAtOrBefore[line] = previousExecutable;
511
- }
512
- const remap = /* @__PURE__ */ new Map();
513
- for (let line = 1; line <= lines.length; line += 1) {
514
- if (executable.has(line)) continue;
515
- const forward = nextExecutableAtOrAfter[line];
516
- const backward = previousExecutableAtOrBefore[line];
517
- const target = forward ?? backward;
518
- if (target !== null && target !== line) {
519
- remap.set(line, target);
520
- }
521
- }
522
- return remap;
688
+ if (isMethodDeclarationLine(text)) continue;
689
+ const names = [];
690
+ const declarationPattern = /\b(?:final\s+)?(?:[A-Za-z_][A-Za-z0-9_.$]*(?:\s*<[^;=(){}]+>)?(?:\s*\[\])?)\s+([A-Za-z_][A-Za-z0-9_]*)\s*=/g;
691
+ for (const match of text.matchAll(declarationPattern)) {
692
+ if (match[1]) names.push(match[1]);
693
+ }
694
+ if (names.length > 0) namesByLine.set(index + 1, names);
695
+ }
696
+ return namesByLine;
697
+ }
698
+ function removeSameLineMutationDeclarationSnapshotEvents(events, sourceText) {
699
+ const declarationNamesByLine = buildLocalDeclarationNamesByLine(sourceText);
700
+ if (declarationNamesByLine.size === 0) return events;
701
+ const mutationVariablesByLine = /* @__PURE__ */ new Map();
702
+ for (const event of events) {
703
+ if (event.kind !== "mutate" || typeof event.line !== "number" || !("variable" in event.target)) continue;
704
+ const variables = mutationVariablesByLine.get(event.line) ?? /* @__PURE__ */ new Set();
705
+ variables.add(event.target.variable);
706
+ mutationVariablesByLine.set(event.line, variables);
707
+ }
708
+ if (mutationVariablesByLine.size === 0) return events;
709
+ return events.filter((event) => {
710
+ if (event.kind !== "snapshot" || typeof event.line !== "number" || !("variable" in event.target)) return true;
711
+ const declaredNames = declarationNamesByLine.get(event.line);
712
+ if (!declaredNames?.includes(event.target.variable)) return true;
713
+ const mutationVariables = mutationVariablesByLine.get(event.line);
714
+ return mutationVariables?.has(event.target.variable) === true;
715
+ });
523
716
  }
524
- function buildMethodDeclarationLineSet(sourceText) {
525
- if (typeof sourceText !== "string" || sourceText.length === 0) {
526
- return null;
527
- }
528
- const declarationLines = /* @__PURE__ */ new Set();
717
+ function collectJavaLineDeclarationsForHeaderExpansion(line) {
718
+ const names = [];
719
+ const declarationPattern = /\b(?:final\s+)?((?:boolean|byte|char|short|int|long|float|double|String|Object|[A-Za-z_][A-Za-z0-9_<>.?]*(?:\s*<[^,;=(){}:]+>)?)\s*(?:\[\s*\])*)\s+([A-Za-z_][A-Za-z0-9_]*)\s*(?==)/g;
720
+ const skippedNames = /* @__PURE__ */ new Set(["class", "interface", "enum", "record", "return", "new"]);
721
+ for (const match of line.matchAll(declarationPattern)) {
722
+ const typeSource = match[1] ?? "";
723
+ const name = match[2];
724
+ if (!name || skippedNames.has(name) || name.startsWith("__tracecode")) continue;
725
+ if (typeSource.includes("[")) continue;
726
+ names.push(name);
727
+ }
728
+ return names;
729
+ }
730
+ function collectJavaControlHeaderDeclarations(line) {
731
+ const forMatch = /\bfor\s*\(\s*(?:final\s+)?(?:[A-Za-z_][A-Za-z0-9_<>.?]*(?:\s*<[^;=(){}:]+>)?|\w+(?:\s*\[\s*\])*)\s+([A-Za-z_][A-Za-z0-9_]*)\s*(?:=|:)/.exec(line);
732
+ return forMatch?.[1] ? [forMatch[1]] : [];
733
+ }
734
+ function buildJavaControlHeaderInfo(sourceText) {
735
+ if (typeof sourceText !== "string" || sourceText.length === 0) return null;
529
736
  const lines = sourceText.split(/\r?\n/);
530
- let inBlockComment = false;
737
+ const loopBodyLineToHeader = /* @__PURE__ */ new Map();
738
+ const headerLineToExcludedVariables = /* @__PURE__ */ new Map();
531
739
  for (let index = 0; index < lines.length; index += 1) {
532
- const { text, inBlockComment: nextInBlockComment } = stripInlineComments(lines[index] ?? "", inBlockComment);
533
- inBlockComment = nextInBlockComment;
534
- if (isMethodDeclarationLine(text)) {
535
- declarationLines.add(index + 1);
740
+ const line = lines[index] ?? "";
741
+ const isLoopHeader = /\b(?:for|while)\s*\(/.test(line);
742
+ const isControlHeader = /\b(?:for|while|if|else\s+if)\s*\(/.test(line);
743
+ if (!isControlHeader || !line.includes("{")) continue;
744
+ for (let bodyIndex = index + 1; bodyIndex < lines.length; bodyIndex += 1) {
745
+ const trimmed = (lines[bodyIndex] ?? "").trim();
746
+ if (trimmed.length === 0) continue;
747
+ if (trimmed.startsWith("}")) break;
748
+ const headerInfo = {
749
+ line: index + 1,
750
+ excludedVariables: new Set(collectJavaLineDeclarationsForHeaderExpansion(lines[bodyIndex] ?? "")),
751
+ headerVariables: new Set(collectJavaControlHeaderDeclarations(line))
752
+ };
753
+ if (isLoopHeader) loopBodyLineToHeader.set(bodyIndex + 1, headerInfo);
754
+ headerLineToExcludedVariables.set(index + 1, headerInfo.excludedVariables);
755
+ break;
536
756
  }
537
757
  }
538
- return declarationLines;
539
- }
540
- function parseAccessEvent(payload) {
541
- const isEphemeralOutputArrayName = (name) => /^(output|outputs)$/i.test(name);
542
- const cellRead = payload.match(/^access ([A-Za-z_][A-Za-z0-9_]*)\[(\d+)\]\[(\d+)\]=(.+)$/);
543
- if (cellRead) {
544
- return [{
545
- variable: cellRead[1],
546
- kind: "cell-read",
547
- indices: [Number.parseInt(cellRead[2], 10), Number.parseInt(cellRead[3], 10)],
548
- pathDepth: 2
549
- }];
550
- }
551
- const indexedRead = payload.match(/^access ([A-Za-z_][A-Za-z0-9_]*)\[(\d+)\]=(.+)$/);
552
- if (indexedRead) {
553
- return [{
554
- variable: indexedRead[1],
555
- kind: "indexed-read",
556
- indices: [Number.parseInt(indexedRead[2], 10)],
557
- pathDepth: 1
558
- }];
559
- }
560
- const cellWrite = payload.match(/^write-array ([A-Za-z_][A-Za-z0-9_]*)\[(\d+)\]\[(\d+)\]=(.+)$/);
561
- if (cellWrite) {
562
- return [{
563
- variable: cellWrite[1],
564
- kind: "cell-write",
565
- indices: [Number.parseInt(cellWrite[2], 10), Number.parseInt(cellWrite[3], 10)],
566
- pathDepth: 2
567
- }];
568
- }
569
- const indexedWrite = payload.match(/^write-array ([A-Za-z_][A-Za-z0-9_]*)\[(\d+)\]=(.+)$/);
570
- if (indexedWrite) {
571
- if (isEphemeralOutputArrayName(indexedWrite[1])) {
572
- return void 0;
758
+ if (loopBodyLineToHeader.size === 0 && headerLineToExcludedVariables.size === 0) return null;
759
+ return { loopBodyLineToHeader, headerLineToExcludedVariables };
760
+ }
761
+ function eventLine(event) {
762
+ return typeof event.line === "number" && Number.isFinite(event.line) && event.line > 0 ? event.line : null;
763
+ }
764
+ function eventSnapshotVariable(event) {
765
+ if (event.kind !== "snapshot") return null;
766
+ const target = event.target;
767
+ if (!target || typeof target !== "object" || !("variable" in target)) return null;
768
+ const variable = target.variable;
769
+ return typeof variable === "string" && variable.length > 0 ? variable : null;
770
+ }
771
+ function cloneRuntimeEventAtLine(event, line) {
772
+ return { ...event, line };
773
+ }
774
+ function expandJavaLoopHeaderTraceEvents(events, sourceText) {
775
+ if (events.length === 0) return events;
776
+ const controlHeaderInfo = buildJavaControlHeaderInfo(sourceText);
777
+ if (!controlHeaderInfo) return events;
778
+ const { loopBodyLineToHeader, headerLineToExcludedVariables } = controlHeaderInfo;
779
+ const expanded = [];
780
+ const latestSnapshotByVariable = /* @__PURE__ */ new Map();
781
+ let lastLineEventLine = null;
782
+ for (let index = 0; index < events.length; index += 1) {
783
+ const event = events[index];
784
+ const line = eventLine(event);
785
+ const snapshotVariable = eventSnapshotVariable(event);
786
+ if (line !== null && snapshotVariable && headerLineToExcludedVariables.get(line)?.has(snapshotVariable)) {
787
+ continue;
573
788
  }
574
- return [{
575
- variable: indexedWrite[1],
576
- kind: "indexed-write",
577
- indices: [Number.parseInt(indexedWrite[2], 10)],
578
- pathDepth: 1
579
- }];
580
- }
581
- const mutatingCall = payload.match(/^mutate ([A-Za-z_][A-Za-z0-9_]*) method=([A-Za-z_][A-Za-z0-9_]*)$/);
582
- if (mutatingCall) {
583
- return [{
584
- variable: mutatingCall[1],
585
- kind: "mutating-call",
586
- method: mutatingCall[2],
587
- pathDepth: 1
588
- }];
589
- }
590
- const indexedMutatingCall = payload.match(/^mutate-indexed ([A-Za-z_][A-Za-z0-9_]*)\[(\d+)\] method=([A-Za-z_][A-Za-z0-9_]*)$/);
591
- if (indexedMutatingCall) {
592
- return [{
593
- variable: indexedMutatingCall[1],
594
- kind: "mutating-call",
595
- indices: [Number.parseInt(indexedMutatingCall[2], 10)],
596
- method: indexedMutatingCall[3],
597
- pathDepth: 1
598
- }];
599
- }
600
- const keyedCall = payload.match(/^keyed-call ([A-Za-z_][A-Za-z0-9_]*) method=([A-Za-z_][A-Za-z0-9_]*)(?:\s+.*)?$/);
601
- if (keyedCall) {
602
- return [{
603
- variable: keyedCall[1],
604
- kind: "mutating-call",
605
- method: keyedCall[2],
606
- pathDepth: 1
607
- }];
608
- }
609
- return void 0;
610
- }
611
- function parseStructureState(payload) {
612
- const match = payload.match(/^state (linked-list|tree|graph-adjacency) ([A-Za-z_][A-Za-z0-9_]*)=(.+)$/);
613
- if (!match) return null;
614
- return {
615
- structure: match[1],
616
- variable: match[2],
617
- value: JSON.parse(match[3])
618
- };
619
- }
620
- function parseObjectState(payload) {
621
- const match = payload.match(/^object-state ([A-Za-z_][A-Za-z0-9_]*)=(.+)$/);
622
- if (!match) return null;
623
- return {
624
- variable: match[1],
625
- visualization: JSON.parse(match[2])
626
- };
627
- }
628
- function parseMapState(payload) {
629
- const match = payload.match(/^map-state ([A-Za-z_][A-Za-z0-9_]*)=(.+)$/);
630
- if (!match) return null;
631
- return {
632
- variable: match[1],
633
- visualization: JSON.parse(match[2])
634
- };
635
- }
636
- function parseSetState(payload) {
637
- const match = payload.match(/^set-state ([A-Za-z_][A-Za-z0-9_]*)=(.+)$/);
638
- if (!match) return null;
639
- return {
640
- variable: match[1],
641
- visualization: JSON.parse(match[2])
642
- };
643
- }
644
- function parseObjectFieldEvent(payload) {
645
- const match = payload.match(/^(access|write) ([A-Za-z_][A-Za-z0-9_]*)\.([A-Za-z_][A-Za-z0-9_]*)=(.+)$/);
646
- if (!match) return null;
647
- return {
648
- variable: match[2],
649
- field: match[3],
650
- value: parseScalar(match[4])
651
- };
652
- }
653
- function isArrayLengthAccessEvent(payload) {
654
- return /^access [A-Za-z_][A-Za-z0-9_]*\.length=\d+$/.test(payload);
655
- }
656
- function buildFieldVisualization(event) {
657
- return {
658
- objectKinds: {
659
- [event.variable]: "object"
660
- },
661
- hashMaps: [
662
- {
663
- name: event.variable,
664
- kind: "object",
665
- objectClassName: event.field === "next" || event.field === "prev" ? "ListNode" : event.field === "left" || event.field === "right" ? "TreeNode" : void 0,
666
- objectId: `${event.variable}-object`,
667
- highlightedKey: event.field,
668
- entries: [{ key: event.field, value: event.value, highlight: true }]
789
+ const headerInfo = line === null ? void 0 : loopBodyLineToHeader.get(line);
790
+ const headerLine = headerInfo?.line;
791
+ if (headerInfo && typeof headerLine === "number" && event.kind === "line" && lastLineEventLine !== headerLine) {
792
+ expanded.push(cloneRuntimeEventAtLine(event, headerLine));
793
+ for (const [variable, snapshotEvent] of latestSnapshotByVariable) {
794
+ if (headerInfo.excludedVariables.has(variable)) continue;
795
+ expanded.push(cloneRuntimeEventAtLine(snapshotEvent, headerLine));
796
+ }
797
+ lastLineEventLine = headerLine;
798
+ }
799
+ if (headerInfo && typeof headerLine === "number" && event.kind === "line") {
800
+ for (let lookahead = index + 1; lookahead < events.length; lookahead += 1) {
801
+ if (eventLine(events[lookahead]) !== line) break;
802
+ const variable = eventSnapshotVariable(events[lookahead]);
803
+ if (!variable || !headerInfo.headerVariables.has(variable)) continue;
804
+ expanded.push(cloneRuntimeEventAtLine(events[lookahead], headerLine));
669
805
  }
670
- ]
671
- };
672
- }
673
- function callStacksEqual(left, right) {
674
- return JSON.stringify(left ?? []) === JSON.stringify(right ?? []);
675
- }
676
- function mergeVisualizationPayloads(left, right) {
677
- if (!left) return right;
678
- if (!right) return left;
679
- return {
680
- ...left,
681
- ...right,
682
- objectKinds: {
683
- ...left.objectKinds ?? {},
684
- ...right.objectKinds ?? {}
685
- },
686
- hashMaps: [
687
- ...left.hashMaps ?? [],
688
- ...right.hashMaps ?? []
689
- ]
690
- };
691
- }
692
- function maybeMergeConsecutiveLineStep(trace, nextStep) {
693
- if (nextStep.event !== "line") {
694
- return false;
695
- }
696
- const previous = trace.at(-1);
697
- if (!previous || previous.event !== "line") {
698
- return false;
699
- }
700
- if (previous.line !== nextStep.line || previous.function !== nextStep.function) {
701
- return false;
702
- }
703
- if (!callStacksEqual(previous.callStack, nextStep.callStack)) {
704
- return false;
705
- }
706
- previous.variables = { ...previous.variables ?? {}, ...nextStep.variables ?? {} };
707
- if (nextStep.accesses?.length) {
708
- previous.accesses = [...previous.accesses ?? [], ...nextStep.accesses];
709
- }
710
- previous.visualization = mergeVisualizationPayloads(previous.visualization, nextStep.visualization);
711
- return true;
712
- }
713
- function filterStructuredVariables(variables) {
714
- if (!variables) {
715
- return void 0;
716
- }
717
- const isEphemeralOutputArrayName = (name) => /^(output|outputs)$/i.test(name);
718
- const entries = Object.entries(variables).filter(([name, value]) => {
719
- if (value === null || typeof value !== "object") {
720
- return false;
721
806
  }
722
- if (!Array.isArray(value)) {
723
- return true;
807
+ expanded.push(event);
808
+ if (event.kind === "line") {
809
+ lastLineEventLine = line;
724
810
  }
725
- if (Array.isArray(value[0])) {
726
- return true;
811
+ if (snapshotVariable) {
812
+ latestSnapshotByVariable.set(snapshotVariable, event);
727
813
  }
728
- return !isEphemeralOutputArrayName(name);
729
- });
730
- if (entries.length === 0) {
731
- return void 0;
732
814
  }
733
- return Object.fromEntries(entries);
815
+ return expanded;
734
816
  }
735
- function appendJavaTraceStep(trace, step, pendingAccesses, options = {}) {
736
- const nextStep = pendingAccesses.length > 0 ? { ...step, accesses: [...pendingAccesses] } : step;
737
- pendingAccesses.length = 0;
738
- if (options.allowMerge !== false && maybeMergeConsecutiveLineStep(trace, nextStep)) {
739
- return;
740
- }
741
- trace.push(nextStep);
742
- }
743
- function mergeIntoPreviousMatchingLineStep(trace, line, currentFunction, currentCallStack, patch) {
744
- const candidate = trace.at(-1);
745
- if (!candidate || candidate.event !== "line") {
746
- return false;
747
- }
748
- if (candidate.line !== line || candidate.function !== currentFunction) {
749
- return false;
750
- }
751
- if (!callStacksEqual(candidate.callStack, currentCallStack)) {
752
- return false;
753
- }
754
- candidate.variables = { ...candidate.variables ?? {}, ...patch.variables ?? {} };
755
- if (patch.accesses?.length) {
756
- candidate.accesses = [...candidate.accesses ?? [], ...patch.accesses];
757
- }
758
- candidate.visualization = mergeVisualizationPayloads(candidate.visualization, patch.visualization);
759
- return true;
760
- }
761
- function mergeAccessesIntoPreviousMatchingLineStep(trace, line, currentFunction, currentCallStack, accesses) {
762
- return mergeIntoPreviousMatchingLineStep(trace, line, currentFunction, currentCallStack, {
763
- variables: void 0,
764
- accesses,
765
- visualization: void 0
766
- });
767
- }
768
- function eventsToRawTrace(events, sourceText) {
769
- const trace = [];
770
- const variables = {};
771
- const objectKinds = {};
772
- const stack = [];
773
- const pendingAccesses = [];
774
- let currentFunction = "<module>";
775
- let previousRawLine = null;
776
- const lineRemap = buildLineRemap(sourceText);
777
- const declarationLines = buildMethodDeclarationLineSet(sourceText);
778
- for (const rawEvent of events) {
779
- if (rawEvent === "clear" || rawEvent === "reset") continue;
780
- const metadata = extractLineMetadata(rawEvent);
781
- const previousEventRawLine = previousRawLine;
782
- previousRawLine = metadata.line;
783
- const line = lineRemap?.get(metadata.line) ?? metadata.line;
784
- const payload = metadata.payload;
785
- const isDeclarationLine = declarationLines?.has(line) === true;
786
- if (payload.startsWith("call ")) {
787
- const match = payload.match(/^call\s+(\S+)(?:\s+(.*))?$/);
788
- const functionName = match?.[1] ?? currentFunction;
789
- const argsFragment = match?.[2] ?? "";
790
- const args = parseKeyValuePairs(argsFragment);
791
- Object.assign(variables, args);
792
- currentFunction = functionName || currentFunction;
793
- stack.push({ function: currentFunction, line, args });
794
- appendJavaTraceStep(trace, {
795
- line,
796
- event: "call",
797
- function: currentFunction,
798
- variables: { ...variables },
799
- callStack: stack.map((frame) => ({ function: frame.function, line: frame.line, args: { ...frame.args } }))
800
- }, pendingAccesses);
801
- continue;
802
- }
803
- if (payload.startsWith("return ")) {
804
- const match = payload.match(/^return\s+(\S+)(?:\s+value=(.*))?$/);
805
- const functionName = match?.[1] ?? currentFunction;
806
- const returnValue = match?.[2] !== void 0 ? parseScalar(match[2].trim()) : void 0;
807
- const returnVariables = functionName === "<module>" ? { ...variables } : filterStructuredVariables(variables) ?? {};
808
- appendJavaTraceStep(trace, {
809
- line,
810
- event: "return",
811
- function: functionName || currentFunction,
812
- variables: returnVariables,
813
- callStack: stack.map((frame) => ({ function: frame.function, line: frame.line, args: { ...frame.args } })),
814
- ...returnValue !== void 0 ? { returnValue } : {}
815
- }, pendingAccesses);
816
- stack.pop();
817
- currentFunction = stack[stack.length - 1]?.function ?? "<module>";
818
- continue;
819
- }
820
- if (isDeclarationLine) {
821
- continue;
822
- }
823
- if (payload.length === 0) {
824
- appendJavaTraceStep(trace, {
825
- line,
826
- event: "line",
827
- function: currentFunction,
828
- variables: { ...variables },
829
- ...stack.length > 0 ? { callStack: stack.map((frame) => ({ function: frame.function, line: frame.line, args: { ...frame.args } })) } : {}
830
- }, pendingAccesses, { allowMerge: previousEventRawLine !== metadata.line });
831
- continue;
832
- }
833
- const structureState = parseStructureState(payload);
834
- if (structureState) {
835
- variables[structureState.variable] = structureState.value;
836
- objectKinds[structureState.variable] = structureState.structure;
837
- appendJavaTraceStep(trace, {
838
- line,
839
- event: "line",
840
- function: currentFunction,
841
- variables: { ...variables },
842
- callStack: stack.map((frame) => ({ function: frame.function, line: frame.line, args: { ...frame.args } })),
843
- visualization: {
844
- objectKinds: { ...objectKinds }
845
- }
846
- }, pendingAccesses);
847
- continue;
848
- }
849
- const objectState = parseObjectState(payload);
850
- if (objectState) {
851
- variables[objectState.variable] = { __ref__: objectState.visualization.objectId ?? `${objectState.variable}-object` };
852
- appendJavaTraceStep(trace, {
853
- line,
854
- event: "line",
855
- function: currentFunction,
856
- variables: { ...variables },
857
- callStack: stack.map((frame) => ({ function: frame.function, line: frame.line, args: { ...frame.args } })),
858
- visualization: {
859
- objectKinds: { [objectState.variable]: "object" },
860
- hashMaps: [objectState.visualization]
861
- }
862
- }, pendingAccesses);
863
- continue;
864
- }
865
- const mapState = parseMapState(payload);
866
- if (mapState) {
867
- const entries = mapState.visualization.entries.map((entry) => [entry.key, entry.value]);
868
- variables[mapState.variable] = { __type__: "map", entries };
869
- appendJavaTraceStep(trace, {
870
- line,
871
- event: "line",
872
- function: currentFunction,
873
- variables: { ...variables },
874
- callStack: stack.map((frame) => ({ function: frame.function, line: frame.line, args: { ...frame.args } })),
875
- visualization: {
876
- objectKinds: { [mapState.variable]: "map" },
877
- hashMaps: [mapState.visualization]
878
- }
879
- }, pendingAccesses);
880
- continue;
881
- }
882
- const setState = parseSetState(payload);
883
- if (setState) {
884
- const values = setState.visualization.entries.map((entry) => entry.key);
885
- variables[setState.variable] = { __type__: "set", values };
886
- appendJavaTraceStep(trace, {
887
- line,
888
- event: "line",
889
- function: currentFunction,
890
- variables: { ...variables },
891
- callStack: stack.map((frame) => ({ function: frame.function, line: frame.line, args: { ...frame.args } })),
892
- visualization: {
893
- objectKinds: { [setState.variable]: "set" },
894
- hashMaps: [setState.visualization]
895
- }
896
- }, pendingAccesses);
897
- continue;
898
- }
899
- if (isArrayLengthAccessEvent(payload)) {
900
- continue;
901
- }
902
- const accesses = parseAccessEvent(payload);
903
- if (accesses) {
904
- const currentCallStack = stack.length > 0 ? stack.map((frame) => ({ function: frame.function, line: frame.line, args: { ...frame.args } })) : void 0;
905
- if (mergeAccessesIntoPreviousMatchingLineStep(trace, line, currentFunction, currentCallStack, accesses)) {
906
- continue;
907
- }
908
- pendingAccesses.push(...accesses);
909
- continue;
910
- }
911
- const objectField = parseObjectFieldEvent(payload);
912
- if (objectField) {
913
- variables[objectField.variable] = { __ref__: `${objectField.variable}-object` };
914
- const currentCallStack = stack.length > 0 ? stack.map((frame) => ({ function: frame.function, line: frame.line, args: { ...frame.args } })) : void 0;
915
- if (mergeIntoPreviousMatchingLineStep(trace, line, currentFunction, currentCallStack, {
916
- variables: { ...variables },
917
- accesses: void 0,
918
- visualization: buildFieldVisualization(objectField)
919
- })) {
920
- continue;
921
- }
922
- appendJavaTraceStep(trace, {
923
- line,
924
- event: "line",
925
- function: currentFunction,
926
- variables: { ...variables },
927
- callStack: stack.map((frame) => ({ function: frame.function, line: frame.line, args: { ...frame.args } })),
928
- visualization: buildFieldVisualization(objectField)
929
- }, pendingAccesses);
930
- continue;
817
+ function nativeJavaTraceEventsToTrace(events, sourceText, options = {}) {
818
+ const runId = options.runId ?? "java:run";
819
+ let parsedEvents = events.map((event) => {
820
+ let parsed;
821
+ try {
822
+ parsed = JSON.parse(normalizeJavaNativeTraceJsonPayload(event.slice("trace:".length)));
823
+ } catch (error) {
824
+ const message = error instanceof Error ? error.message : String(error);
825
+ throw new Error(`Invalid Java native runtime trace event: ${message}
826
+ ${event.slice(0, 500)}`);
931
827
  }
932
- Object.assign(variables, parseKeyValuePairs(payload));
933
- appendJavaTraceStep(trace, {
934
- line,
935
- event: "line",
936
- function: currentFunction,
937
- variables: { ...variables },
938
- ...stack.length > 0 ? { callStack: stack.map((frame) => ({ function: frame.function, line: frame.line, args: { ...frame.args } })) } : {}
939
- }, pendingAccesses);
940
- }
941
- if (pendingAccesses.length > 0 && trace.length > 0) {
942
- const last = trace[trace.length - 1];
943
- last.accesses = [...last.accesses ?? [], ...pendingAccesses];
944
- }
945
- return trace;
946
- }
947
- function buildJavaExecutionResult(output, events, executionTimeMs = 0, traceLimitExceeded, timeoutReason, maxTraceSteps, sourceText, options = {}) {
948
- const trace = eventsToRawTrace(events, sourceText);
949
- return {
950
- success: true,
951
- output: options.outputIsSerialized === false ? output : normalizeJavaSerializedResult(output),
952
- trace,
953
- executionTimeMs,
954
- consoleOutput: [],
955
- ...traceLimitExceeded !== void 0 ? { traceLimitExceeded } : {},
956
- ...maxTraceSteps !== void 0 ? { maxTraceSteps } : {},
957
- ...timeoutReason ? { timeoutReason } : {},
958
- lineEventCount: trace.filter((step) => step.event === "line").length,
959
- traceStepCount: trace.length
960
- };
961
- }
962
- function normalizeJavaTraceContract(result) {
963
- const normalized = normalizeRuntimeTraceContract(
964
- "java",
965
- buildJavaExecutionResult(
966
- result.output,
967
- result.events,
968
- 0,
969
- result.traceLimitExceeded,
970
- result.timeoutReason,
971
- void 0,
972
- result.sourceText
973
- )
974
- );
828
+ return {
829
+ ...parsed,
830
+ runId,
831
+ ...options.file ? { file: options.file } : {}
832
+ };
833
+ });
834
+ parsedEvents = removeSameLineMutationDeclarationSnapshotEvents(parsedEvents, sourceText);
835
+ parsedEvents = expandJavaLoopHeaderTraceEvents(parsedEvents, sourceText);
975
836
  return {
976
- ...normalized,
977
- language: "java"
837
+ schemaVersion: RUNTIME_TRACE_SCHEMA_VERSION,
838
+ language: "java",
839
+ runId,
840
+ events: parsedEvents,
841
+ lineEventCount: parsedEvents.filter((event) => event.kind === "line").length,
842
+ traceStepCount: parsedEvents.length
978
843
  };
979
844
  }
980
- function adaptJavaTraceExecutionResult(result) {
981
- return adaptTraceExecutionResult("java", result);
845
+ function javaTraceHooksEventsToRuntimeTrace(events, sourceText, options = {}) {
846
+ assertSupportedRawEmissions(summarizeJavaRawEmissions(events), "java");
847
+ if (events.length === 0) {
848
+ return {
849
+ schemaVersion: RUNTIME_TRACE_SCHEMA_VERSION,
850
+ language: "java",
851
+ runId: options.runId ?? "java:run",
852
+ events: [],
853
+ lineEventCount: 0,
854
+ traceStepCount: 0
855
+ };
856
+ }
857
+ if (!events.every(isNativeJavaTraceEvent)) {
858
+ throw new Error("Java TraceHooks must emit native runtime trace events. Unsupported line=... events are no longer supported.");
859
+ }
860
+ return nativeJavaTraceEventsToTrace(events, sourceText, options);
982
861
  }
983
862
  // Annotate the CommonJS export names for ESM import in node:
984
863
  0 && (module.exports = {
985
- RUNTIME_TRACE_CONTRACT_SCHEMA_VERSION,
986
- adaptJavaScriptTraceExecutionResult,
987
- adaptJavaSpikeTraceExecutionResult,
988
- adaptJavaTraceExecutionResult,
989
- adaptPythonTraceExecutionResult,
990
- adaptTraceExecutionResult,
991
- buildJavaExecutionResult,
992
- buildJavaSpikeExecutionResult,
864
+ LANGUAGE_RUNTIME_INFOS,
865
+ RUNTIME_TRACE_SCHEMA_VERSION,
866
+ SUPPORTED_LANGUAGE_RUNTIME_INFOS,
867
+ assertSupportedRawEmissions,
868
+ buildRuntimeTraceParitySignature,
869
+ compareRawEmissionParity,
870
+ createEmptyRuntimeTrace,
871
+ getLanguageRuntimeInfo,
872
+ getSupportedLanguageRuntimeInfos,
873
+ javaTraceHooksEventsToRuntimeTrace,
874
+ normalizeJavaNativeTraceJsonPayload,
993
875
  normalizeJavaSerializedResult,
994
- normalizeJavaSpikeTraceContract,
995
- normalizeJavaTraceContract,
996
- normalizeRuntimeTraceContract,
997
- stableStringifyRuntimeTraceContract
876
+ summarizeJavaRawEmissions,
877
+ summarizeRuntimeTraceEmissions,
878
+ withRuntimeTraceOptions
998
879
  });
999
880
  //# sourceMappingURL=core.cjs.map