@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.
- package/CHANGELOG.md +48 -0
- package/README.md +134 -15
- package/THIRD_PARTY_NOTICES.md +170 -0
- package/dist/browser.cjs +2361 -1033
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +33 -3
- package/dist/browser.d.ts +33 -3
- package/dist/browser.js +2357 -1033
- package/dist/browser.js.map +1 -1
- package/dist/cli.cjs +160 -23
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +161 -24
- package/dist/cli.js.map +1 -1
- package/dist/core.cjs +748 -867
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +21 -85
- package/dist/core.d.ts +21 -85
- package/dist/core.js +734 -855
- package/dist/core.js.map +1 -1
- package/dist/cpp-worker-client-Bn7kC0_L.d.ts +84 -0
- package/dist/cpp-worker-client-BzdJLuZa.d.cts +84 -0
- package/dist/cpp.cjs +1063 -0
- package/dist/cpp.cjs.map +1 -0
- package/dist/cpp.d.cts +7 -0
- package/dist/cpp.d.ts +7 -0
- package/dist/cpp.js +1035 -0
- package/dist/cpp.js.map +1 -0
- package/dist/csharp-worker-client-DMHIa2YG.d.cts +69 -0
- package/dist/csharp-worker-client-JwqS6LiX.d.ts +69 -0
- package/dist/csharp.cjs +1012 -0
- package/dist/csharp.cjs.map +1 -0
- package/dist/csharp.d.cts +7 -0
- package/dist/csharp.d.ts +7 -0
- package/dist/csharp.js +984 -0
- package/dist/csharp.js.map +1 -0
- package/dist/index.cjs +3142 -1160
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -5
- package/dist/index.d.ts +13 -5
- package/dist/index.js +3117 -1148
- package/dist/index.js.map +1 -1
- package/dist/internal/browser.cjs +1639 -30
- package/dist/internal/browser.cjs.map +1 -1
- package/dist/internal/browser.d.cts +6 -199
- package/dist/internal/browser.d.ts +6 -199
- package/dist/internal/browser.js +1636 -30
- package/dist/internal/browser.js.map +1 -1
- package/dist/java-worker-client-BOwKW-11.d.cts +72 -0
- package/dist/java-worker-client-C97DDnCp.d.ts +72 -0
- package/dist/java.cjs +1225 -0
- package/dist/java.cjs.map +1 -0
- package/dist/java.d.cts +7 -0
- package/dist/java.d.ts +7 -0
- package/dist/java.js +1197 -0
- package/dist/java.js.map +1 -0
- package/dist/javascript-worker-client-CYBGEEvc.d.cts +51 -0
- package/dist/javascript-worker-client-DIX1Mp21.d.ts +51 -0
- package/dist/javascript.cjs +1063 -19
- package/dist/javascript.cjs.map +1 -1
- package/dist/javascript.d.cts +7 -4
- package/dist/javascript.d.ts +7 -4
- package/dist/javascript.js +1061 -19
- package/dist/javascript.js.map +1 -1
- package/dist/pyodide-worker-client-C-2rfHj9.d.ts +111 -0
- package/dist/pyodide-worker-client-Cn0a8Uv3.d.cts +111 -0
- package/dist/python.cjs +1282 -74
- package/dist/python.cjs.map +1 -1
- package/dist/python.d.cts +20 -14
- package/dist/python.d.ts +20 -14
- package/dist/python.js +1279 -74
- package/dist/python.js.map +1 -1
- package/dist/runtime-language-info-BFUSti3-.d.ts +43 -0
- package/dist/runtime-language-info-Bxza1cI2.d.cts +43 -0
- package/dist/runtime-types-2qM0MukN.d.cts +244 -0
- package/dist/runtime-types-2qM0MukN.d.ts +244 -0
- package/package.json +73 -8
- package/workers/cpp/cpp-compiler-frame.html +82 -0
- package/workers/cpp/cpp-compiler-worker.js +131 -0
- package/workers/cpp/cpp-worker.js +5790 -0
- package/workers/cpp/tracecode_runtime.hpp +6169 -0
- package/workers/csharp/csharp-worker.js +301 -0
- package/workers/java/.build/classes/harness/browser/JavaRewriteLibrary.class +0 -0
- package/workers/java/java-source-augmentations.js +907 -0
- package/workers/java/java-worker.js +2161 -177
- package/workers/java/src/harness/browser/JavaRewriteLibrary.java +1659 -32
- package/workers/java/src/javafx/util/Pair.java +42 -0
- package/workers/java/src/tracecode/browser/BrowserCompileAndTraceLibrary.java +714 -0
- package/workers/java/src/tracecode/browser/BrowserCompileAndTraceMain.java +76 -0
- package/workers/java/src/tracecode/browser/RuntimeProbeMain.java +14 -0
- package/workers/java/src/tracecode/user/TraceHooks.java +1414 -0
- package/workers/javascript/javascript-libraries-entry.js +71 -0
- package/workers/javascript/javascript-worker.js +2055 -424
- package/workers/python/generated-python-harness-snippets.js +4 -4
- package/workers/python/pyodide-worker.js +222 -61
- package/workers/python/runtime-core.js +1387 -301
- package/workers/vendor/csharp/.stamp +0 -0
- package/workers/vendor/csharp/TraceCode.CSharpHost.runtimeconfig.json +32 -0
- package/workers/vendor/csharp/_framework/Microsoft.CSharp.wasm +0 -0
- package/workers/vendor/csharp/_framework/Microsoft.CodeAnalysis.CSharp.wasm +0 -0
- package/workers/vendor/csharp/_framework/Microsoft.CodeAnalysis.wasm +0 -0
- package/workers/vendor/csharp/_framework/Microsoft.VisualBasic.Core.wasm +0 -0
- package/workers/vendor/csharp/_framework/Microsoft.VisualBasic.wasm +0 -0
- package/workers/vendor/csharp/_framework/Microsoft.Win32.Primitives.wasm +0 -0
- package/workers/vendor/csharp/_framework/Microsoft.Win32.Registry.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.AppContext.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Buffers.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Collections.Concurrent.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Collections.Immutable.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Collections.NonGeneric.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Collections.Specialized.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Collections.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.ComponentModel.Annotations.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.ComponentModel.DataAnnotations.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.ComponentModel.EventBasedAsync.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.ComponentModel.Primitives.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.ComponentModel.TypeConverter.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.ComponentModel.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Configuration.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Console.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Core.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Data.Common.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Data.DataSetExtensions.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Data.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Diagnostics.Contracts.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Diagnostics.Debug.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Diagnostics.DiagnosticSource.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Diagnostics.FileVersionInfo.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Diagnostics.Process.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Diagnostics.StackTrace.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Diagnostics.TextWriterTraceListener.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Diagnostics.Tools.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Diagnostics.TraceSource.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Diagnostics.Tracing.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Drawing.Primitives.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Drawing.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Dynamic.Runtime.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Formats.Asn1.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Formats.Tar.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Globalization.Calendars.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Globalization.Extensions.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Globalization.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.IO.Compression.Brotli.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.IO.Compression.FileSystem.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.IO.Compression.ZipFile.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.IO.Compression.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.IO.FileSystem.AccessControl.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.IO.FileSystem.DriveInfo.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.IO.FileSystem.Primitives.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.IO.FileSystem.Watcher.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.IO.FileSystem.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.IO.IsolatedStorage.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.IO.MemoryMappedFiles.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.IO.Pipelines.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.IO.Pipes.AccessControl.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.IO.Pipes.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.IO.UnmanagedMemoryStream.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.IO.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Linq.AsyncEnumerable.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Linq.Expressions.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Linq.Parallel.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Linq.Queryable.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Linq.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Memory.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.Http.Json.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.Http.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.HttpListener.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.Mail.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.NameResolution.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.NetworkInformation.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.Ping.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.Primitives.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.Quic.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.Requests.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.Security.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.ServerSentEvents.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.ServicePoint.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.Sockets.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.WebClient.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.WebHeaderCollection.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.WebProxy.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.WebSockets.Client.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.WebSockets.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Net.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Numerics.Vectors.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Numerics.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.ObjectModel.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Private.CoreLib.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Private.DataContractSerialization.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Private.Uri.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Private.Xml.Linq.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Private.Xml.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Reflection.DispatchProxy.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Reflection.Emit.ILGeneration.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Reflection.Emit.Lightweight.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Reflection.Emit.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Reflection.Extensions.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Reflection.Metadata.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Reflection.Primitives.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Reflection.TypeExtensions.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Reflection.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Resources.Reader.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Resources.ResourceManager.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Resources.Writer.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Runtime.CompilerServices.Unsafe.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Runtime.CompilerServices.VisualC.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Runtime.Extensions.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Runtime.Handles.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Runtime.InteropServices.JavaScript.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Runtime.InteropServices.RuntimeInformation.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Runtime.InteropServices.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Runtime.Intrinsics.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Runtime.Loader.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Runtime.Numerics.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Runtime.Serialization.Formatters.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Runtime.Serialization.Json.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Runtime.Serialization.Primitives.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Runtime.Serialization.Xml.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Runtime.Serialization.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Runtime.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Security.AccessControl.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Security.Claims.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Security.Cryptography.Algorithms.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Security.Cryptography.Cng.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Security.Cryptography.Csp.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Security.Cryptography.Encoding.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Security.Cryptography.OpenSsl.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Security.Cryptography.Primitives.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Security.Cryptography.X509Certificates.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Security.Cryptography.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Security.Principal.Windows.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Security.Principal.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Security.SecureString.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Security.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.ServiceModel.Web.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.ServiceProcess.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Text.Encoding.CodePages.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Text.Encoding.Extensions.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Text.Encoding.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Text.Encodings.Web.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Text.Json.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Text.RegularExpressions.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Threading.AccessControl.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Threading.Channels.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Threading.Overlapped.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Threading.Tasks.Dataflow.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Threading.Tasks.Extensions.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Threading.Tasks.Parallel.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Threading.Tasks.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Threading.Thread.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Threading.ThreadPool.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Threading.Timer.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Threading.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Transactions.Local.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Transactions.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.ValueTuple.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Web.HttpUtility.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Web.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Windows.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Xml.Linq.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Xml.ReaderWriter.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Xml.Serialization.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Xml.XDocument.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Xml.XPath.XDocument.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Xml.XPath.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Xml.XmlDocument.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Xml.XmlSerializer.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.Xml.wasm +0 -0
- package/workers/vendor/csharp/_framework/System.wasm +0 -0
- package/workers/vendor/csharp/_framework/TraceCode.CSharpHost.wasm +0 -0
- package/workers/vendor/csharp/_framework/WindowsBase.wasm +0 -0
- package/workers/vendor/csharp/_framework/cs/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/cs/Microsoft.CodeAnalysis.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/de/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/de/Microsoft.CodeAnalysis.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/dotnet.boot.js +1958 -0
- package/workers/vendor/csharp/_framework/dotnet.js +4 -0
- package/workers/vendor/csharp/_framework/dotnet.js.map +1 -0
- package/workers/vendor/csharp/_framework/dotnet.native.js +6687 -0
- package/workers/vendor/csharp/_framework/dotnet.native.wasm +0 -0
- package/workers/vendor/csharp/_framework/dotnet.runtime.js +4 -0
- package/workers/vendor/csharp/_framework/dotnet.runtime.js.map +1 -0
- package/workers/vendor/csharp/_framework/es/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/es/Microsoft.CodeAnalysis.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/fr/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/fr/Microsoft.CodeAnalysis.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/it/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/it/Microsoft.CodeAnalysis.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/ja/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/ja/Microsoft.CodeAnalysis.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/ko/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/ko/Microsoft.CodeAnalysis.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/mscorlib.wasm +0 -0
- package/workers/vendor/csharp/_framework/netstandard.wasm +0 -0
- package/workers/vendor/csharp/_framework/pl/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/pl/Microsoft.CodeAnalysis.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/pt-BR/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/pt-BR/Microsoft.CodeAnalysis.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/ru/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/ru/Microsoft.CodeAnalysis.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/0_Microsoft.CodeAnalysis.CSharp.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/100_System.Reflection.Emit.ILGeneration.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/101_System.Reflection.Emit.Lightweight.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/102_System.Reflection.Extensions.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/103_System.Reflection.Metadata.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/104_System.Reflection.Primitives.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/105_System.Reflection.TypeExtensions.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/106_System.Resources.Reader.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/107_System.Resources.ResourceManager.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/108_System.Resources.Writer.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/109_System.Runtime.CompilerServices.Unsafe.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/10_System.Buffers.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/110_System.Runtime.CompilerServices.VisualC.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/111_System.Runtime.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/112_System.Runtime.Extensions.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/113_System.Runtime.Handles.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/114_System.Runtime.InteropServices.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/115_System.Runtime.InteropServices.JavaScript.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/116_System.Runtime.InteropServices.RuntimeInformation.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/117_System.Runtime.Intrinsics.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/118_System.Runtime.Loader.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/119_System.Runtime.Numerics.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/11_System.Collections.Concurrent.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/120_System.Runtime.Serialization.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/121_System.Runtime.Serialization.Formatters.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/122_System.Runtime.Serialization.Json.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/123_System.Runtime.Serialization.Primitives.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/124_System.Runtime.Serialization.Xml.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/125_System.Security.AccessControl.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/126_System.Security.Claims.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/127_System.Security.Cryptography.Algorithms.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/128_System.Security.Cryptography.Cng.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/129_System.Security.Cryptography.Csp.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/12_System.Collections.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/130_System.Security.Cryptography.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/131_System.Security.Cryptography.Encoding.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/132_System.Security.Cryptography.OpenSsl.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/133_System.Security.Cryptography.Primitives.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/134_System.Security.Cryptography.X509Certificates.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/135_System.Security.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/136_System.Security.Principal.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/137_System.Security.Principal.Windows.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/138_System.Security.SecureString.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/139_System.ServiceModel.Web.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/13_System.Collections.Immutable.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/140_System.ServiceProcess.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/141_System.Text.Encoding.CodePages.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/142_System.Text.Encoding.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/143_System.Text.Encoding.Extensions.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/144_System.Text.Encodings.Web.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/145_System.Text.Json.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/146_System.Text.RegularExpressions.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/147_System.Threading.AccessControl.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/148_System.Threading.Channels.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/149_System.Threading.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/14_System.Collections.NonGeneric.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/150_System.Threading.Overlapped.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/151_System.Threading.Tasks.Dataflow.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/152_System.Threading.Tasks.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/153_System.Threading.Tasks.Extensions.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/154_System.Threading.Tasks.Parallel.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/155_System.Threading.Thread.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/156_System.Threading.ThreadPool.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/157_System.Threading.Timer.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/158_System.Transactions.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/159_System.Transactions.Local.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/15_System.Collections.Specialized.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/160_System.ValueTuple.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/161_System.Web.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/162_System.Web.HttpUtility.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/163_System.Windows.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/164_System.Xml.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/165_System.Xml.Linq.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/166_System.Xml.ReaderWriter.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/167_System.Xml.Serialization.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/168_System.Xml.XDocument.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/169_System.Xml.XmlDocument.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/16_System.ComponentModel.Annotations.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/170_System.Xml.XmlSerializer.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/171_System.Xml.XPath.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/172_System.Xml.XPath.XDocument.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/173_TraceCode.CSharpHost.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/174_WindowsBase.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/17_System.ComponentModel.DataAnnotations.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/18_System.ComponentModel.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/19_System.ComponentModel.EventBasedAsync.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/1_Microsoft.CodeAnalysis.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/20_System.ComponentModel.Primitives.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/21_System.ComponentModel.TypeConverter.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/22_System.Configuration.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/23_System.Console.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/24_System.Core.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/25_System.Data.Common.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/26_System.Data.DataSetExtensions.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/27_System.Data.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/28_System.Diagnostics.Contracts.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/29_System.Diagnostics.Debug.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/2_Microsoft.CSharp.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/30_System.Diagnostics.DiagnosticSource.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/31_System.Diagnostics.FileVersionInfo.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/32_System.Diagnostics.Process.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/33_System.Diagnostics.StackTrace.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/34_System.Diagnostics.TextWriterTraceListener.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/35_System.Diagnostics.Tools.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/36_System.Diagnostics.TraceSource.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/37_System.Diagnostics.Tracing.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/38_System.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/39_System.Drawing.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/3_Microsoft.VisualBasic.Core.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/40_System.Drawing.Primitives.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/41_System.Dynamic.Runtime.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/42_System.Formats.Asn1.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/43_System.Formats.Tar.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/44_System.Globalization.Calendars.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/45_System.Globalization.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/46_System.Globalization.Extensions.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/47_System.IO.Compression.Brotli.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/48_System.IO.Compression.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/49_System.IO.Compression.FileSystem.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/4_Microsoft.VisualBasic.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/50_System.IO.Compression.ZipFile.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/51_System.IO.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/52_System.IO.FileSystem.AccessControl.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/53_System.IO.FileSystem.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/54_System.IO.FileSystem.DriveInfo.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/55_System.IO.FileSystem.Primitives.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/56_System.IO.FileSystem.Watcher.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/57_System.IO.IsolatedStorage.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/58_System.IO.MemoryMappedFiles.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/59_System.IO.Pipelines.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/5_Microsoft.Win32.Primitives.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/60_System.IO.Pipes.AccessControl.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/61_System.IO.Pipes.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/62_System.IO.UnmanagedMemoryStream.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/63_System.Linq.AsyncEnumerable.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/64_System.Linq.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/65_System.Linq.Expressions.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/66_System.Linq.Parallel.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/67_System.Linq.Queryable.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/68_System.Memory.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/69_System.Net.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/6_Microsoft.Win32.Registry.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/70_System.Net.Http.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/71_System.Net.Http.Json.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/72_System.Net.HttpListener.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/73_System.Net.Mail.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/74_System.Net.NameResolution.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/75_System.Net.NetworkInformation.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/76_System.Net.Ping.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/77_System.Net.Primitives.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/78_System.Net.Quic.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/79_System.Net.Requests.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/7_mscorlib.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/80_System.Net.Security.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/81_System.Net.ServerSentEvents.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/82_System.Net.ServicePoint.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/83_System.Net.Sockets.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/84_System.Net.WebClient.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/85_System.Net.WebHeaderCollection.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/86_System.Net.WebProxy.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/87_System.Net.WebSockets.Client.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/88_System.Net.WebSockets.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/89_System.Numerics.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/8_netstandard.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/90_System.Numerics.Vectors.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/91_System.ObjectModel.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/92_System.Private.CoreLib.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/93_System.Private.DataContractSerialization.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/94_System.Private.Uri.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/95_System.Private.Xml.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/96_System.Private.Xml.Linq.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/97_System.Reflection.DispatchProxy.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/98_System.Reflection.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/99_System.Reflection.Emit.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/9_System.AppContext.dll +0 -0
- package/workers/vendor/csharp/_framework/tr/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/tr/Microsoft.CodeAnalysis.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/zh-Hans/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/zh-Hans/Microsoft.CodeAnalysis.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/zh-Hant/Microsoft.CodeAnalysis.CSharp.resources.wasm +0 -0
- package/workers/vendor/csharp/_framework/zh-Hant/Microsoft.CodeAnalysis.resources.wasm +0 -0
- package/workers/vendor/csharp/main.mjs +5 -0
- package/workers/vendor/csharp/package.json +1 -0
- package/workers/vendor/java-browser-helper.jar +0 -0
- package/workers/vendor/java-rewriter.jar +0 -0
- package/workers/vendor/javascript-libraries.js +10106 -0
- package/dist/runtime-types-89nchXlY.d.cts +0 -89
- package/dist/runtime-types-CCQ-ZLc9.d.ts +0 -89
- package/dist/types-zyvpJKCi.d.cts +0 -100
- package/dist/types-zyvpJKCi.d.ts +0 -100
- package/workers/java/java-source-augmentations.cjs +0 -242
- package/workers/java/src/spike/user/TraceHooks.java +0 -619
- package/workers/vendor/java-browser-spike-helper.jar +0 -0
- package/workers/vendor/java-practice-rewriter.jar +0 -0
- package/workers/vendor/java-rewrite-bridge.jar +0 -0
package/dist/javascript.cjs
CHANGED
|
@@ -20,7 +20,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// packages/harness-javascript/src/index.ts
|
|
21
21
|
var src_exports = {};
|
|
22
22
|
__export(src_exports, {
|
|
23
|
+
JavaScriptWorkerClient: () => JavaScriptWorkerClient,
|
|
23
24
|
TYPESCRIPT_RUNTIME_DECLARATIONS: () => TYPESCRIPT_RUNTIME_DECLARATIONS,
|
|
25
|
+
createJavaScriptRuntimeClient: () => createJavaScriptRuntimeClient,
|
|
24
26
|
executeJavaScriptCode: () => executeJavaScriptCode,
|
|
25
27
|
executeJavaScriptWithTracing: () => executeJavaScriptWithTracing,
|
|
26
28
|
executeTypeScriptCode: () => executeTypeScriptCode,
|
|
@@ -28,10 +30,24 @@ __export(src_exports, {
|
|
|
28
30
|
});
|
|
29
31
|
module.exports = __toCommonJS(src_exports);
|
|
30
32
|
|
|
33
|
+
// packages/harness-core/src/runtime-trace.ts
|
|
34
|
+
var RUNTIME_TRACE_SCHEMA_VERSION = "runtime-trace-2026-04-28";
|
|
35
|
+
function createEmptyRuntimeTrace(language, options = {}) {
|
|
36
|
+
return {
|
|
37
|
+
schemaVersion: RUNTIME_TRACE_SCHEMA_VERSION,
|
|
38
|
+
language,
|
|
39
|
+
runId: options.runId ?? `${language}:run`,
|
|
40
|
+
events: [],
|
|
41
|
+
lineEventCount: 0,
|
|
42
|
+
traceStepCount: 0
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
31
46
|
// packages/harness-javascript/src/typescript-runtime-declarations.ts
|
|
32
47
|
var TYPESCRIPT_RUNTIME_DECLARATIONS = `
|
|
33
48
|
declare class ListNode {
|
|
34
49
|
val: any;
|
|
50
|
+
value: any;
|
|
35
51
|
next: ListNode | SerializedListNode | SerializedRef | null;
|
|
36
52
|
prev?: ListNode | SerializedListNode | SerializedRef | null;
|
|
37
53
|
constructor(val?: any, next?: ListNode | null);
|
|
@@ -39,6 +55,7 @@ declare class ListNode {
|
|
|
39
55
|
|
|
40
56
|
declare class TreeNode {
|
|
41
57
|
val: any;
|
|
58
|
+
value: any;
|
|
42
59
|
left: TreeNode | SerializedTreeNode | SerializedRef | null;
|
|
43
60
|
right: TreeNode | SerializedTreeNode | SerializedRef | null;
|
|
44
61
|
constructor(val?: any, left?: TreeNode | null, right?: TreeNode | null);
|
|
@@ -50,6 +67,7 @@ type SerializedListNode = {
|
|
|
50
67
|
__id__?: string;
|
|
51
68
|
__type__?: 'ListNode';
|
|
52
69
|
val?: any;
|
|
70
|
+
value?: any;
|
|
53
71
|
next?: SerializedListNode | SerializedRef | ListNode | null;
|
|
54
72
|
prev?: SerializedListNode | SerializedRef | ListNode | null;
|
|
55
73
|
};
|
|
@@ -58,6 +76,7 @@ type SerializedTreeNode = {
|
|
|
58
76
|
__id__?: string;
|
|
59
77
|
__type__?: 'TreeNode';
|
|
60
78
|
val?: any;
|
|
79
|
+
value?: any;
|
|
61
80
|
left?: SerializedTreeNode | SerializedRef | TreeNode | null;
|
|
62
81
|
right?: SerializedTreeNode | SerializedRef | TreeNode | null;
|
|
63
82
|
};
|
|
@@ -71,6 +90,7 @@ ${TYPESCRIPT_RUNTIME_DECLARATIONS}
|
|
|
71
90
|
|
|
72
91
|
// packages/harness-javascript/src/javascript-executor.ts
|
|
73
92
|
var typeScriptModulePromise = null;
|
|
93
|
+
var javascriptLibraryPromise = null;
|
|
74
94
|
async function getTypeScriptModule() {
|
|
75
95
|
if (!typeScriptModulePromise) {
|
|
76
96
|
const specifier = "typescript";
|
|
@@ -81,6 +101,154 @@ async function getTypeScriptModule() {
|
|
|
81
101
|
}
|
|
82
102
|
return typeScriptModulePromise;
|
|
83
103
|
}
|
|
104
|
+
async function tryImportJavaScriptLibraryModule(specifier) {
|
|
105
|
+
try {
|
|
106
|
+
return await import(
|
|
107
|
+
/* webpackIgnore: true */
|
|
108
|
+
specifier
|
|
109
|
+
);
|
|
110
|
+
} catch {
|
|
111
|
+
return void 0;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function normalizeCommonJsLikeModule(moduleValue) {
|
|
115
|
+
if (!moduleValue || typeof moduleValue !== "object") return moduleValue;
|
|
116
|
+
const record = moduleValue;
|
|
117
|
+
const namedKeys = Object.keys(record).filter((key) => key !== "default");
|
|
118
|
+
if (namedKeys.length === 0 && "default" in record) {
|
|
119
|
+
return record.default;
|
|
120
|
+
}
|
|
121
|
+
if (record.default && typeof record.default === "object") {
|
|
122
|
+
return { ...record.default, ...record };
|
|
123
|
+
}
|
|
124
|
+
return record;
|
|
125
|
+
}
|
|
126
|
+
function moduleMember(moduleValue, name) {
|
|
127
|
+
if (!moduleValue || typeof moduleValue !== "object") return void 0;
|
|
128
|
+
const record = moduleValue;
|
|
129
|
+
return record[name];
|
|
130
|
+
}
|
|
131
|
+
async function getJavaScriptLibraryEnvironment() {
|
|
132
|
+
if (!javascriptLibraryPromise) {
|
|
133
|
+
javascriptLibraryPromise = (async () => {
|
|
134
|
+
const [
|
|
135
|
+
lodashModule,
|
|
136
|
+
binarySearchTreeModule,
|
|
137
|
+
dequeModule,
|
|
138
|
+
graphModule,
|
|
139
|
+
heapModule,
|
|
140
|
+
linkedListModule,
|
|
141
|
+
priorityQueueModule,
|
|
142
|
+
queueModule,
|
|
143
|
+
enhancedSetModule,
|
|
144
|
+
stackModule,
|
|
145
|
+
trieModule
|
|
146
|
+
] = await Promise.all([
|
|
147
|
+
tryImportJavaScriptLibraryModule("lodash"),
|
|
148
|
+
tryImportJavaScriptLibraryModule("@datastructures-js/binary-search-tree"),
|
|
149
|
+
tryImportJavaScriptLibraryModule("@datastructures-js/deque"),
|
|
150
|
+
tryImportJavaScriptLibraryModule("@datastructures-js/graph"),
|
|
151
|
+
tryImportJavaScriptLibraryModule("@datastructures-js/heap"),
|
|
152
|
+
tryImportJavaScriptLibraryModule("@datastructures-js/linked-list"),
|
|
153
|
+
tryImportJavaScriptLibraryModule("@datastructures-js/priority-queue"),
|
|
154
|
+
tryImportJavaScriptLibraryModule("@datastructures-js/queue"),
|
|
155
|
+
tryImportJavaScriptLibraryModule("@datastructures-js/set"),
|
|
156
|
+
tryImportJavaScriptLibraryModule("@datastructures-js/stack"),
|
|
157
|
+
tryImportJavaScriptLibraryModule("@datastructures-js/trie")
|
|
158
|
+
]);
|
|
159
|
+
const lodash = normalizeCommonJsLikeModule(lodashModule);
|
|
160
|
+
const binarySearchTree = normalizeCommonJsLikeModule(binarySearchTreeModule);
|
|
161
|
+
const deque = normalizeCommonJsLikeModule(dequeModule);
|
|
162
|
+
const graph = normalizeCommonJsLikeModule(graphModule);
|
|
163
|
+
const heap = normalizeCommonJsLikeModule(heapModule);
|
|
164
|
+
const linkedList = normalizeCommonJsLikeModule(linkedListModule);
|
|
165
|
+
const priorityQueue = normalizeCommonJsLikeModule(priorityQueueModule);
|
|
166
|
+
const queue = normalizeCommonJsLikeModule(queueModule);
|
|
167
|
+
const enhancedSet = normalizeCommonJsLikeModule(enhancedSetModule);
|
|
168
|
+
const stack = normalizeCommonJsLikeModule(stackModule);
|
|
169
|
+
const trie = normalizeCommonJsLikeModule(trieModule);
|
|
170
|
+
const moduleEntries = [
|
|
171
|
+
["lodash", lodash],
|
|
172
|
+
["lodash.js", lodash],
|
|
173
|
+
["@datastructures-js/binary-search-tree", binarySearchTree],
|
|
174
|
+
["@datastructures-js/deque", deque],
|
|
175
|
+
["@datastructures-js/graph", graph],
|
|
176
|
+
["@datastructures-js/heap", heap],
|
|
177
|
+
["@datastructures-js/linked-list", linkedList],
|
|
178
|
+
["@datastructures-js/priority-queue", priorityQueue],
|
|
179
|
+
["@datastructures-js/queue", queue],
|
|
180
|
+
["@datastructures-js/set", enhancedSet],
|
|
181
|
+
["@datastructures-js/stack", stack],
|
|
182
|
+
["@datastructures-js/trie", trie]
|
|
183
|
+
].filter((entry) => entry[1] !== void 0);
|
|
184
|
+
const globals = {
|
|
185
|
+
_: lodash,
|
|
186
|
+
lodash,
|
|
187
|
+
Deque: moduleMember(deque, "Deque"),
|
|
188
|
+
DoublyLinkedList: moduleMember(linkedList, "DoublyLinkedList"),
|
|
189
|
+
DoublyLinkedListNode: moduleMember(linkedList, "DoublyLinkedListNode"),
|
|
190
|
+
EnhancedSet: moduleMember(enhancedSet, "EnhancedSet"),
|
|
191
|
+
Heap: moduleMember(heap, "Heap"),
|
|
192
|
+
LinkedList: moduleMember(linkedList, "LinkedList"),
|
|
193
|
+
LinkedListNode: moduleMember(linkedList, "LinkedListNode"),
|
|
194
|
+
MaxHeap: moduleMember(heap, "MaxHeap"),
|
|
195
|
+
MaxPriorityQueue: moduleMember(priorityQueue, "MaxPriorityQueue"),
|
|
196
|
+
MinHeap: moduleMember(heap, "MinHeap"),
|
|
197
|
+
MinPriorityQueue: moduleMember(priorityQueue, "MinPriorityQueue"),
|
|
198
|
+
PriorityQueue: moduleMember(priorityQueue, "PriorityQueue"),
|
|
199
|
+
Queue: moduleMember(queue, "Queue"),
|
|
200
|
+
Stack: moduleMember(stack, "Stack")
|
|
201
|
+
};
|
|
202
|
+
for (const [key, value] of Object.entries(globals)) {
|
|
203
|
+
if (value === void 0) delete globals[key];
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
modules: Object.fromEntries(moduleEntries),
|
|
207
|
+
globals
|
|
208
|
+
};
|
|
209
|
+
})();
|
|
210
|
+
}
|
|
211
|
+
return javascriptLibraryPromise;
|
|
212
|
+
}
|
|
213
|
+
function installJavaScriptLibraryGlobals(environment) {
|
|
214
|
+
const scope = globalThis;
|
|
215
|
+
const descriptors = /* @__PURE__ */ new Map();
|
|
216
|
+
const previousRequire = typeof scope.require === "function" ? scope.require : null;
|
|
217
|
+
const moduleObject = { exports: {} };
|
|
218
|
+
const requireFunction = (specifier) => {
|
|
219
|
+
if (Object.prototype.hasOwnProperty.call(environment.modules, specifier)) {
|
|
220
|
+
return environment.modules[specifier];
|
|
221
|
+
}
|
|
222
|
+
if (previousRequire && previousRequire !== requireFunction) {
|
|
223
|
+
return previousRequire(specifier);
|
|
224
|
+
}
|
|
225
|
+
throw new Error(`Cannot find module '${specifier}'`);
|
|
226
|
+
};
|
|
227
|
+
const values = {
|
|
228
|
+
...environment.globals,
|
|
229
|
+
__TRACECODE_JAVASCRIPT_LIBRARIES__: environment.modules,
|
|
230
|
+
require: requireFunction,
|
|
231
|
+
module: moduleObject,
|
|
232
|
+
exports: moduleObject.exports
|
|
233
|
+
};
|
|
234
|
+
for (const [key, value] of Object.entries(values)) {
|
|
235
|
+
descriptors.set(key, Object.getOwnPropertyDescriptor(globalThis, key));
|
|
236
|
+
Object.defineProperty(scope, key, {
|
|
237
|
+
value,
|
|
238
|
+
configurable: true,
|
|
239
|
+
writable: true
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
return () => {
|
|
243
|
+
for (const [key, descriptor] of descriptors) {
|
|
244
|
+
if (descriptor) {
|
|
245
|
+
Object.defineProperty(scope, key, descriptor);
|
|
246
|
+
} else {
|
|
247
|
+
delete scope[key];
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
}
|
|
84
252
|
function performanceNow() {
|
|
85
253
|
if (typeof performance !== "undefined" && typeof performance.now === "function") {
|
|
86
254
|
return performance.now();
|
|
@@ -136,8 +304,23 @@ function getCustomClassName(value) {
|
|
|
136
304
|
}
|
|
137
305
|
return name;
|
|
138
306
|
}
|
|
307
|
+
var RUNTIME_VALUE_MAX_DEPTH = 48;
|
|
308
|
+
var RUNTIME_VALUE_MAX_ITEMS = 64;
|
|
309
|
+
var RUNTIME_VALUE_MAX_OBJECT_FIELDS = 32;
|
|
310
|
+
var TRACE_SERIALIZATION_LIMITS = { maxItems: RUNTIME_VALUE_MAX_ITEMS, maxFields: RUNTIME_VALUE_MAX_OBJECT_FIELDS };
|
|
311
|
+
var OUTPUT_SERIALIZATION_LIMITS = { maxItems: Number.POSITIVE_INFINITY, maxFields: Number.POSITIVE_INFINITY };
|
|
312
|
+
var activeSerializationLimits = TRACE_SERIALIZATION_LIMITS;
|
|
313
|
+
function truncationMarker(total, emitted) {
|
|
314
|
+
return { __truncated__: true, remaining: Math.max(0, total - emitted) };
|
|
315
|
+
}
|
|
316
|
+
function limitedEntries(items, maxItems) {
|
|
317
|
+
return {
|
|
318
|
+
values: items.slice(0, maxItems),
|
|
319
|
+
remaining: Math.max(0, items.length - maxItems)
|
|
320
|
+
};
|
|
321
|
+
}
|
|
139
322
|
function serializeValue(value, depth = 0, seen = /* @__PURE__ */ new WeakSet(), nodeRefState = { ids: /* @__PURE__ */ new Map(), nextId: 1 }) {
|
|
140
|
-
if (depth >
|
|
323
|
+
if (depth > RUNTIME_VALUE_MAX_DEPTH) return "<max depth>";
|
|
141
324
|
if (value === null || value === void 0) return value;
|
|
142
325
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
143
326
|
return value;
|
|
@@ -149,22 +332,39 @@ function serializeValue(value, depth = 0, seen = /* @__PURE__ */ new WeakSet(),
|
|
|
149
332
|
return "<function>";
|
|
150
333
|
}
|
|
151
334
|
if (Array.isArray(value)) {
|
|
152
|
-
|
|
335
|
+
const limited = limitedEntries(value, activeSerializationLimits.maxItems);
|
|
336
|
+
const result = limited.values.map((item) => serializeValue(item, depth + 1, seen, nodeRefState));
|
|
337
|
+
if (limited.remaining > 0) result.push(truncationMarker(value.length, limited.values.length));
|
|
338
|
+
return result;
|
|
153
339
|
}
|
|
154
340
|
if (value instanceof Set) {
|
|
155
|
-
|
|
341
|
+
const items = [...value];
|
|
342
|
+
const limited = limitedEntries(items, activeSerializationLimits.maxItems);
|
|
343
|
+
const result = {
|
|
156
344
|
__type__: "set",
|
|
157
|
-
values:
|
|
345
|
+
values: limited.values.map((item) => serializeValue(item, depth + 1, seen, nodeRefState))
|
|
158
346
|
};
|
|
347
|
+
if (limited.remaining > 0) {
|
|
348
|
+
result.__truncated__ = true;
|
|
349
|
+
result.remaining = limited.remaining;
|
|
350
|
+
}
|
|
351
|
+
return result;
|
|
159
352
|
}
|
|
160
353
|
if (value instanceof Map) {
|
|
161
|
-
|
|
354
|
+
const entries = [...value.entries()];
|
|
355
|
+
const limited = limitedEntries(entries, activeSerializationLimits.maxItems);
|
|
356
|
+
const result = {
|
|
162
357
|
__type__: "map",
|
|
163
|
-
entries:
|
|
358
|
+
entries: limited.values.map(([k, v]) => [
|
|
164
359
|
serializeValue(k, depth + 1, seen, nodeRefState),
|
|
165
360
|
serializeValue(v, depth + 1, seen, nodeRefState)
|
|
166
361
|
])
|
|
167
362
|
};
|
|
363
|
+
if (limited.remaining > 0) {
|
|
364
|
+
result.__truncated__ = true;
|
|
365
|
+
result.remaining = limited.remaining;
|
|
366
|
+
}
|
|
367
|
+
return result;
|
|
168
368
|
}
|
|
169
369
|
if (typeof value === "object") {
|
|
170
370
|
if (isLikelyTreeNodeValue(value) || isLikelyListNodeValue(value)) {
|
|
@@ -175,8 +375,7 @@ function serializeValue(value, depth = 0, seen = /* @__PURE__ */ new WeakSet(),
|
|
|
175
375
|
return { __ref__: existingId };
|
|
176
376
|
}
|
|
177
377
|
const isTree = isLikelyTreeNodeValue(value);
|
|
178
|
-
const
|
|
179
|
-
const nodeId = `${nodePrefix}-${nodeRefState.nextId++}`;
|
|
378
|
+
const nodeId = `ref-${nodeRefState.nextId++}`;
|
|
180
379
|
nodeRefState.ids.set(objectValue, nodeId);
|
|
181
380
|
const out2 = isTree ? {
|
|
182
381
|
__type__: "TreeNode",
|
|
@@ -192,10 +391,14 @@ function serializeValue(value, depth = 0, seen = /* @__PURE__ */ new WeakSet(),
|
|
|
192
391
|
..."prev" in nodeValue ? { prev: serializeValue(nodeValue.prev ?? null, depth + 1, seen, nodeRefState) } : {}
|
|
193
392
|
};
|
|
194
393
|
const skipped = isTree ? /* @__PURE__ */ new Set(["__id__", "__type__", "__class__", "val", "value", "left", "right"]) : /* @__PURE__ */ new Set(["__id__", "__type__", "__class__", "val", "value", "next", "prev"]);
|
|
195
|
-
|
|
196
|
-
|
|
394
|
+
const fields2 = Object.entries(nodeValue).filter(([k]) => !skipped.has(k));
|
|
395
|
+
for (const [k, v] of fields2.slice(0, activeSerializationLimits.maxFields)) {
|
|
197
396
|
out2[k] = serializeValue(v, depth + 1, seen, nodeRefState);
|
|
198
397
|
}
|
|
398
|
+
if (fields2.length > activeSerializationLimits.maxFields) {
|
|
399
|
+
out2.__truncated__ = true;
|
|
400
|
+
out2.remaining = fields2.length - activeSerializationLimits.maxFields;
|
|
401
|
+
}
|
|
199
402
|
return out2;
|
|
200
403
|
}
|
|
201
404
|
const customClassName = getCustomClassName(value);
|
|
@@ -205,32 +408,54 @@ function serializeValue(value, depth = 0, seen = /* @__PURE__ */ new WeakSet(),
|
|
|
205
408
|
if (existingId) {
|
|
206
409
|
return { __ref__: existingId };
|
|
207
410
|
}
|
|
208
|
-
const objectId = `
|
|
411
|
+
const objectId = `ref-${nodeRefState.nextId++}`;
|
|
209
412
|
nodeRefState.ids.set(objectValue, objectId);
|
|
210
413
|
if (seen.has(objectValue)) return { __ref__: objectId };
|
|
211
414
|
seen.add(objectValue);
|
|
212
415
|
const out2 = {
|
|
213
|
-
__type__:
|
|
416
|
+
__type__: customClassName,
|
|
214
417
|
__class__: customClassName,
|
|
215
418
|
__id__: objectId
|
|
216
419
|
};
|
|
217
|
-
|
|
420
|
+
const fields2 = Object.entries(value);
|
|
421
|
+
for (const [k, v] of fields2.slice(0, activeSerializationLimits.maxFields)) {
|
|
218
422
|
out2[k] = serializeValue(v, depth + 1, seen, nodeRefState);
|
|
219
423
|
}
|
|
424
|
+
if (fields2.length > activeSerializationLimits.maxFields) {
|
|
425
|
+
out2.__truncated__ = true;
|
|
426
|
+
out2.remaining = fields2.length - activeSerializationLimits.maxFields;
|
|
427
|
+
}
|
|
220
428
|
seen.delete(objectValue);
|
|
221
429
|
return out2;
|
|
222
430
|
}
|
|
223
431
|
if (seen.has(value)) return "<cycle>";
|
|
224
432
|
seen.add(value);
|
|
225
433
|
const out = {};
|
|
226
|
-
|
|
434
|
+
const fields = Object.entries(value);
|
|
435
|
+
for (const [k, v] of fields.slice(0, activeSerializationLimits.maxFields)) {
|
|
227
436
|
out[k] = serializeValue(v, depth + 1, seen, nodeRefState);
|
|
228
437
|
}
|
|
438
|
+
if (fields.length > activeSerializationLimits.maxFields) {
|
|
439
|
+
out.__truncated__ = true;
|
|
440
|
+
out.remaining = fields.length - activeSerializationLimits.maxFields;
|
|
441
|
+
}
|
|
229
442
|
seen.delete(value);
|
|
230
443
|
return out;
|
|
231
444
|
}
|
|
232
445
|
return String(value);
|
|
233
446
|
}
|
|
447
|
+
function withSerializationLimits(limits, serialize) {
|
|
448
|
+
const previous = activeSerializationLimits;
|
|
449
|
+
activeSerializationLimits = limits;
|
|
450
|
+
try {
|
|
451
|
+
return serialize();
|
|
452
|
+
} finally {
|
|
453
|
+
activeSerializationLimits = previous;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
function serializeOutputValue(value) {
|
|
457
|
+
return withSerializationLimits(OUTPUT_SERIALIZATION_LIMITS, () => serializeValue(value));
|
|
458
|
+
}
|
|
234
459
|
function extractUserErrorLine(error) {
|
|
235
460
|
if (typeof error === "object" && error && "__tracecodeLine" in error) {
|
|
236
461
|
const line2 = Number(error.__tracecodeLine);
|
|
@@ -296,16 +521,40 @@ function resolveReferenceGraph(value, byId, resolved) {
|
|
|
296
521
|
}
|
|
297
522
|
return out;
|
|
298
523
|
}
|
|
524
|
+
function cloneInputGraph(value, cloned = /* @__PURE__ */ new WeakMap()) {
|
|
525
|
+
if (value === null || value === void 0) return value;
|
|
526
|
+
if (typeof value !== "object") return value;
|
|
527
|
+
if (cloned.has(value)) {
|
|
528
|
+
return cloned.get(value);
|
|
529
|
+
}
|
|
530
|
+
if (Array.isArray(value)) {
|
|
531
|
+
const out2 = [];
|
|
532
|
+
cloned.set(value, out2);
|
|
533
|
+
for (const item of value) {
|
|
534
|
+
out2.push(cloneInputGraph(item, cloned));
|
|
535
|
+
}
|
|
536
|
+
return out2;
|
|
537
|
+
}
|
|
538
|
+
if (!isPlainObjectRecord(value)) {
|
|
539
|
+
return value;
|
|
540
|
+
}
|
|
541
|
+
const out = {};
|
|
542
|
+
cloned.set(value, out);
|
|
543
|
+
for (const [key, nested] of Object.entries(value)) {
|
|
544
|
+
out[key] = cloneInputGraph(nested, cloned);
|
|
545
|
+
}
|
|
546
|
+
return out;
|
|
547
|
+
}
|
|
299
548
|
function normalizeInputs(inputs) {
|
|
300
549
|
if (!inputs || typeof inputs !== "object" || Array.isArray(inputs)) return {};
|
|
301
550
|
const byId = /* @__PURE__ */ new Map();
|
|
302
551
|
collectReferenceTargets(inputs, byId, /* @__PURE__ */ new WeakSet());
|
|
303
552
|
if (byId.size === 0) {
|
|
304
|
-
return inputs;
|
|
553
|
+
return cloneInputGraph(inputs);
|
|
305
554
|
}
|
|
306
555
|
const hydrated = resolveReferenceGraph(inputs, byId, /* @__PURE__ */ new WeakMap());
|
|
307
556
|
if (!hydrated || typeof hydrated !== "object" || Array.isArray(hydrated)) {
|
|
308
|
-
return inputs;
|
|
557
|
+
return cloneInputGraph(inputs);
|
|
309
558
|
}
|
|
310
559
|
return hydrated;
|
|
311
560
|
}
|
|
@@ -713,6 +962,8 @@ async function executeJavaScriptCode(code, functionName, inputs, executionStyle
|
|
|
713
962
|
const normalizedInputs = normalizeInputs(inputs);
|
|
714
963
|
const materializers = await resolveInputMaterializers(code, functionName, executionStyle, language);
|
|
715
964
|
const materializedInputs = applyInputMaterializers(normalizedInputs, materializers);
|
|
965
|
+
const javascriptLibraryEnvironment = await getJavaScriptLibraryEnvironment();
|
|
966
|
+
const restoreJavaScriptLibraryGlobals = installJavaScriptLibraryGlobals(javascriptLibraryEnvironment);
|
|
716
967
|
try {
|
|
717
968
|
let output;
|
|
718
969
|
if (executionStyle === "ops-class") {
|
|
@@ -728,7 +979,7 @@ async function executeJavaScriptCode(code, functionName, inputs, executionStyle
|
|
|
728
979
|
}
|
|
729
980
|
return {
|
|
730
981
|
success: true,
|
|
731
|
-
output:
|
|
982
|
+
output: serializeOutputValue(output),
|
|
732
983
|
consoleOutput
|
|
733
984
|
};
|
|
734
985
|
} catch (error) {
|
|
@@ -739,6 +990,8 @@ async function executeJavaScriptCode(code, functionName, inputs, executionStyle
|
|
|
739
990
|
errorLine: extractUserErrorLine(error),
|
|
740
991
|
consoleOutput
|
|
741
992
|
};
|
|
993
|
+
} finally {
|
|
994
|
+
restoreJavaScriptLibraryGlobals();
|
|
742
995
|
}
|
|
743
996
|
}
|
|
744
997
|
async function executeJavaScriptWithTracing(code, functionName, inputs, executionStyle = "function", language = "javascript") {
|
|
@@ -750,7 +1003,7 @@ async function executeJavaScriptWithTracing(code, functionName, inputs, executio
|
|
|
750
1003
|
success: false,
|
|
751
1004
|
error: codeResult.error,
|
|
752
1005
|
errorLine: codeResult.errorLine,
|
|
753
|
-
trace:
|
|
1006
|
+
trace: createEmptyRuntimeTrace(language),
|
|
754
1007
|
executionTimeMs,
|
|
755
1008
|
consoleOutput: codeResult.consoleOutput ?? [],
|
|
756
1009
|
lineEventCount: 0,
|
|
@@ -760,7 +1013,7 @@ async function executeJavaScriptWithTracing(code, functionName, inputs, executio
|
|
|
760
1013
|
return {
|
|
761
1014
|
success: true,
|
|
762
1015
|
output: codeResult.output,
|
|
763
|
-
trace:
|
|
1016
|
+
trace: createEmptyRuntimeTrace(language),
|
|
764
1017
|
executionTimeMs,
|
|
765
1018
|
consoleOutput: codeResult.consoleOutput ?? [],
|
|
766
1019
|
lineEventCount: 0,
|
|
@@ -774,9 +1027,800 @@ async function executeTypeScriptCode(code, functionName, inputs, executionStyle
|
|
|
774
1027
|
const transpiledCode = await transpileTypeScript(code);
|
|
775
1028
|
return executeJavaScriptCode(transpiledCode, functionName, materializedInputs, executionStyle, "typescript");
|
|
776
1029
|
}
|
|
1030
|
+
|
|
1031
|
+
// packages/harness-browser/src/runtime-capability-guards.ts
|
|
1032
|
+
function isScriptRequest(functionName) {
|
|
1033
|
+
if (functionName == null) return true;
|
|
1034
|
+
return functionName.trim().length === 0;
|
|
1035
|
+
}
|
|
1036
|
+
function executionStyleLabel(executionStyle) {
|
|
1037
|
+
if (executionStyle === "solution-method") return "solution-method";
|
|
1038
|
+
if (executionStyle === "ops-class") return "ops-class";
|
|
1039
|
+
return "function";
|
|
1040
|
+
}
|
|
1041
|
+
function isExecutionStyleSupported(profile, executionStyle) {
|
|
1042
|
+
const styles = profile.capabilities.execution.styles;
|
|
1043
|
+
if (executionStyle === "solution-method") return styles.solutionMethod;
|
|
1044
|
+
if (executionStyle === "ops-class") return styles.opsClass;
|
|
1045
|
+
return styles.function;
|
|
1046
|
+
}
|
|
1047
|
+
function describeRequest(request) {
|
|
1048
|
+
if (request === "trace") return "tracing";
|
|
1049
|
+
if (request === "interview") return "interview execution";
|
|
1050
|
+
return "execution";
|
|
1051
|
+
}
|
|
1052
|
+
function assertRuntimeRequestSupported(profile, options) {
|
|
1053
|
+
if (options.request === "trace" && !profile.capabilities.tracing.supported) {
|
|
1054
|
+
throw new Error(`Runtime "${profile.language}" does not support tracing.`);
|
|
1055
|
+
}
|
|
1056
|
+
if (options.request === "interview" && !profile.capabilities.execution.styles.interviewMode) {
|
|
1057
|
+
throw new Error(`Runtime "${profile.language}" does not support interview execution.`);
|
|
1058
|
+
}
|
|
1059
|
+
if (!isExecutionStyleSupported(profile, options.executionStyle)) {
|
|
1060
|
+
throw new Error(
|
|
1061
|
+
`Runtime "${profile.language}" does not support execution style "${executionStyleLabel(options.executionStyle)}".`
|
|
1062
|
+
);
|
|
1063
|
+
}
|
|
1064
|
+
if (isScriptRequest(options.functionName) && !profile.capabilities.execution.styles.script) {
|
|
1065
|
+
throw new Error(`Runtime "${profile.language}" does not support script mode ${describeRequest(options.request)}.`);
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
// packages/harness-browser/src/runtime-profiles.ts
|
|
1070
|
+
var PYTHON_RUNTIME_PROFILE = {
|
|
1071
|
+
language: "python",
|
|
1072
|
+
maturity: "stable",
|
|
1073
|
+
capabilities: {
|
|
1074
|
+
execution: {
|
|
1075
|
+
styles: {
|
|
1076
|
+
function: true,
|
|
1077
|
+
solutionMethod: true,
|
|
1078
|
+
opsClass: true,
|
|
1079
|
+
script: true,
|
|
1080
|
+
interviewMode: true
|
|
1081
|
+
},
|
|
1082
|
+
timeouts: {
|
|
1083
|
+
clientTimeouts: true,
|
|
1084
|
+
runtimeTimeouts: true
|
|
1085
|
+
}
|
|
1086
|
+
},
|
|
1087
|
+
tracing: {
|
|
1088
|
+
supported: true,
|
|
1089
|
+
events: {
|
|
1090
|
+
line: true,
|
|
1091
|
+
call: true,
|
|
1092
|
+
return: true,
|
|
1093
|
+
exception: true,
|
|
1094
|
+
stdout: true,
|
|
1095
|
+
timeout: true
|
|
1096
|
+
},
|
|
1097
|
+
controls: {
|
|
1098
|
+
maxTraceSteps: true,
|
|
1099
|
+
maxLineEvents: true,
|
|
1100
|
+
maxSingleLineHits: true,
|
|
1101
|
+
maxStoredEvents: true,
|
|
1102
|
+
minimalTrace: true
|
|
1103
|
+
},
|
|
1104
|
+
fidelity: {
|
|
1105
|
+
preciseLineMapping: true,
|
|
1106
|
+
stableFunctionNames: true,
|
|
1107
|
+
callStack: true
|
|
1108
|
+
}
|
|
1109
|
+
},
|
|
1110
|
+
diagnostics: {
|
|
1111
|
+
compileErrors: false,
|
|
1112
|
+
runtimeErrors: true,
|
|
1113
|
+
mappedErrorLines: true,
|
|
1114
|
+
stackTraces: false
|
|
1115
|
+
},
|
|
1116
|
+
structures: {
|
|
1117
|
+
treeNodeRefs: true,
|
|
1118
|
+
listNodeRefs: true,
|
|
1119
|
+
mapSerialization: true,
|
|
1120
|
+
setSerialization: true,
|
|
1121
|
+
graphSerialization: true,
|
|
1122
|
+
cycleReferences: true
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
1126
|
+
var JAVASCRIPT_RUNTIME_PROFILE = {
|
|
1127
|
+
language: "javascript",
|
|
1128
|
+
maturity: "stable",
|
|
1129
|
+
capabilities: {
|
|
1130
|
+
execution: {
|
|
1131
|
+
styles: {
|
|
1132
|
+
function: true,
|
|
1133
|
+
solutionMethod: true,
|
|
1134
|
+
opsClass: true,
|
|
1135
|
+
script: true,
|
|
1136
|
+
interviewMode: true
|
|
1137
|
+
},
|
|
1138
|
+
timeouts: {
|
|
1139
|
+
clientTimeouts: true,
|
|
1140
|
+
runtimeTimeouts: false
|
|
1141
|
+
}
|
|
1142
|
+
},
|
|
1143
|
+
tracing: {
|
|
1144
|
+
supported: true,
|
|
1145
|
+
events: {
|
|
1146
|
+
line: true,
|
|
1147
|
+
call: true,
|
|
1148
|
+
return: true,
|
|
1149
|
+
exception: true,
|
|
1150
|
+
stdout: false,
|
|
1151
|
+
timeout: true
|
|
1152
|
+
},
|
|
1153
|
+
controls: {
|
|
1154
|
+
maxTraceSteps: true,
|
|
1155
|
+
maxLineEvents: true,
|
|
1156
|
+
maxSingleLineHits: true,
|
|
1157
|
+
maxStoredEvents: true,
|
|
1158
|
+
minimalTrace: true
|
|
1159
|
+
},
|
|
1160
|
+
fidelity: {
|
|
1161
|
+
preciseLineMapping: true,
|
|
1162
|
+
stableFunctionNames: true,
|
|
1163
|
+
callStack: true
|
|
1164
|
+
}
|
|
1165
|
+
},
|
|
1166
|
+
diagnostics: {
|
|
1167
|
+
compileErrors: false,
|
|
1168
|
+
runtimeErrors: true,
|
|
1169
|
+
mappedErrorLines: false,
|
|
1170
|
+
stackTraces: false
|
|
1171
|
+
},
|
|
1172
|
+
structures: {
|
|
1173
|
+
treeNodeRefs: true,
|
|
1174
|
+
listNodeRefs: true,
|
|
1175
|
+
mapSerialization: true,
|
|
1176
|
+
setSerialization: true,
|
|
1177
|
+
graphSerialization: true,
|
|
1178
|
+
cycleReferences: true
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
};
|
|
1182
|
+
var TYPESCRIPT_RUNTIME_PROFILE = {
|
|
1183
|
+
language: "typescript",
|
|
1184
|
+
maturity: "stable",
|
|
1185
|
+
capabilities: {
|
|
1186
|
+
execution: {
|
|
1187
|
+
styles: {
|
|
1188
|
+
function: true,
|
|
1189
|
+
solutionMethod: true,
|
|
1190
|
+
opsClass: true,
|
|
1191
|
+
script: true,
|
|
1192
|
+
interviewMode: true
|
|
1193
|
+
},
|
|
1194
|
+
timeouts: {
|
|
1195
|
+
clientTimeouts: true,
|
|
1196
|
+
runtimeTimeouts: false
|
|
1197
|
+
}
|
|
1198
|
+
},
|
|
1199
|
+
tracing: {
|
|
1200
|
+
supported: true,
|
|
1201
|
+
events: {
|
|
1202
|
+
line: true,
|
|
1203
|
+
call: true,
|
|
1204
|
+
return: true,
|
|
1205
|
+
exception: true,
|
|
1206
|
+
stdout: false,
|
|
1207
|
+
timeout: true
|
|
1208
|
+
},
|
|
1209
|
+
controls: {
|
|
1210
|
+
maxTraceSteps: true,
|
|
1211
|
+
maxLineEvents: true,
|
|
1212
|
+
maxSingleLineHits: true,
|
|
1213
|
+
maxStoredEvents: true,
|
|
1214
|
+
minimalTrace: true
|
|
1215
|
+
},
|
|
1216
|
+
fidelity: {
|
|
1217
|
+
preciseLineMapping: true,
|
|
1218
|
+
stableFunctionNames: true,
|
|
1219
|
+
callStack: true
|
|
1220
|
+
}
|
|
1221
|
+
},
|
|
1222
|
+
diagnostics: {
|
|
1223
|
+
compileErrors: true,
|
|
1224
|
+
runtimeErrors: true,
|
|
1225
|
+
mappedErrorLines: true,
|
|
1226
|
+
stackTraces: false
|
|
1227
|
+
},
|
|
1228
|
+
structures: {
|
|
1229
|
+
treeNodeRefs: true,
|
|
1230
|
+
listNodeRefs: true,
|
|
1231
|
+
mapSerialization: true,
|
|
1232
|
+
setSerialization: true,
|
|
1233
|
+
graphSerialization: true,
|
|
1234
|
+
cycleReferences: true
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
};
|
|
1238
|
+
var JAVA_RUNTIME_PROFILE = {
|
|
1239
|
+
language: "java",
|
|
1240
|
+
maturity: "experimental",
|
|
1241
|
+
capabilities: {
|
|
1242
|
+
execution: {
|
|
1243
|
+
styles: {
|
|
1244
|
+
function: true,
|
|
1245
|
+
solutionMethod: true,
|
|
1246
|
+
opsClass: true,
|
|
1247
|
+
script: true,
|
|
1248
|
+
interviewMode: true
|
|
1249
|
+
},
|
|
1250
|
+
timeouts: {
|
|
1251
|
+
clientTimeouts: true,
|
|
1252
|
+
runtimeTimeouts: true
|
|
1253
|
+
}
|
|
1254
|
+
},
|
|
1255
|
+
tracing: {
|
|
1256
|
+
supported: true,
|
|
1257
|
+
events: {
|
|
1258
|
+
line: true,
|
|
1259
|
+
call: true,
|
|
1260
|
+
return: true,
|
|
1261
|
+
exception: true,
|
|
1262
|
+
stdout: false,
|
|
1263
|
+
timeout: true
|
|
1264
|
+
},
|
|
1265
|
+
controls: {
|
|
1266
|
+
maxTraceSteps: true,
|
|
1267
|
+
maxLineEvents: false,
|
|
1268
|
+
maxSingleLineHits: false,
|
|
1269
|
+
maxStoredEvents: true,
|
|
1270
|
+
minimalTrace: false
|
|
1271
|
+
},
|
|
1272
|
+
fidelity: {
|
|
1273
|
+
preciseLineMapping: true,
|
|
1274
|
+
stableFunctionNames: true,
|
|
1275
|
+
callStack: true
|
|
1276
|
+
}
|
|
1277
|
+
},
|
|
1278
|
+
diagnostics: {
|
|
1279
|
+
compileErrors: true,
|
|
1280
|
+
runtimeErrors: true,
|
|
1281
|
+
mappedErrorLines: false,
|
|
1282
|
+
stackTraces: true
|
|
1283
|
+
},
|
|
1284
|
+
structures: {
|
|
1285
|
+
treeNodeRefs: true,
|
|
1286
|
+
listNodeRefs: true,
|
|
1287
|
+
mapSerialization: true,
|
|
1288
|
+
setSerialization: true,
|
|
1289
|
+
graphSerialization: false,
|
|
1290
|
+
cycleReferences: true
|
|
1291
|
+
}
|
|
1292
|
+
},
|
|
1293
|
+
notes: [
|
|
1294
|
+
"Java currently supports the browser-local Java 17 lane for function, solution-method, ops-class, and script-style execution.",
|
|
1295
|
+
"Interview-mode Java reuses the same browser-local execution path and remains experimental.",
|
|
1296
|
+
'Script-style Java uses an empty function name with executionStyle="function" and reads the top-level result variable.'
|
|
1297
|
+
]
|
|
1298
|
+
};
|
|
1299
|
+
var CSHARP_RUNTIME_PROFILE = {
|
|
1300
|
+
language: "csharp",
|
|
1301
|
+
maturity: "experimental",
|
|
1302
|
+
capabilities: {
|
|
1303
|
+
execution: {
|
|
1304
|
+
styles: {
|
|
1305
|
+
function: true,
|
|
1306
|
+
solutionMethod: true,
|
|
1307
|
+
opsClass: true,
|
|
1308
|
+
script: true,
|
|
1309
|
+
interviewMode: true
|
|
1310
|
+
},
|
|
1311
|
+
timeouts: {
|
|
1312
|
+
clientTimeouts: true,
|
|
1313
|
+
runtimeTimeouts: true
|
|
1314
|
+
}
|
|
1315
|
+
},
|
|
1316
|
+
tracing: {
|
|
1317
|
+
supported: true,
|
|
1318
|
+
events: {
|
|
1319
|
+
line: true,
|
|
1320
|
+
call: true,
|
|
1321
|
+
return: true,
|
|
1322
|
+
exception: true,
|
|
1323
|
+
stdout: true,
|
|
1324
|
+
timeout: true
|
|
1325
|
+
},
|
|
1326
|
+
controls: {
|
|
1327
|
+
maxTraceSteps: true,
|
|
1328
|
+
maxLineEvents: true,
|
|
1329
|
+
maxSingleLineHits: true,
|
|
1330
|
+
maxStoredEvents: true,
|
|
1331
|
+
minimalTrace: true
|
|
1332
|
+
},
|
|
1333
|
+
fidelity: {
|
|
1334
|
+
preciseLineMapping: true,
|
|
1335
|
+
stableFunctionNames: true,
|
|
1336
|
+
callStack: true
|
|
1337
|
+
}
|
|
1338
|
+
},
|
|
1339
|
+
diagnostics: {
|
|
1340
|
+
compileErrors: true,
|
|
1341
|
+
runtimeErrors: true,
|
|
1342
|
+
mappedErrorLines: true,
|
|
1343
|
+
stackTraces: false
|
|
1344
|
+
},
|
|
1345
|
+
structures: {
|
|
1346
|
+
treeNodeRefs: true,
|
|
1347
|
+
listNodeRefs: true,
|
|
1348
|
+
mapSerialization: true,
|
|
1349
|
+
setSerialization: true,
|
|
1350
|
+
graphSerialization: true,
|
|
1351
|
+
cycleReferences: true
|
|
1352
|
+
}
|
|
1353
|
+
},
|
|
1354
|
+
notes: [
|
|
1355
|
+
"C# support is browser-local and experimental.",
|
|
1356
|
+
"C# supports named function-style requests where the browser-local host can bind the named method.",
|
|
1357
|
+
'Script-style C# uses an empty function name with executionStyle="function" and reads the top-level result variable.',
|
|
1358
|
+
"Interview-mode C# uses the same browser-local worker execution path with interview timeout normalization.",
|
|
1359
|
+
"The first C# slice supports public class Solution methods.",
|
|
1360
|
+
"ListNode and TreeNode inputs are hydrated from level-order arrays or object-shaped JSON.",
|
|
1361
|
+
"Dictionary, HashSet, List, and array return values serialize through the browser-local worker.",
|
|
1362
|
+
"Tracing currently supports line, call, return, stdout, and simple local variable write events.",
|
|
1363
|
+
"Structural visualization is added after execution and diagnostics are proven."
|
|
1364
|
+
]
|
|
1365
|
+
};
|
|
1366
|
+
var CPP_RUNTIME_PROFILE = {
|
|
1367
|
+
language: "cpp",
|
|
1368
|
+
maturity: "experimental",
|
|
1369
|
+
capabilities: {
|
|
1370
|
+
execution: {
|
|
1371
|
+
styles: {
|
|
1372
|
+
function: true,
|
|
1373
|
+
solutionMethod: true,
|
|
1374
|
+
opsClass: true,
|
|
1375
|
+
script: true,
|
|
1376
|
+
interviewMode: true
|
|
1377
|
+
},
|
|
1378
|
+
timeouts: {
|
|
1379
|
+
clientTimeouts: true,
|
|
1380
|
+
runtimeTimeouts: true
|
|
1381
|
+
}
|
|
1382
|
+
},
|
|
1383
|
+
tracing: {
|
|
1384
|
+
supported: true,
|
|
1385
|
+
events: {
|
|
1386
|
+
line: true,
|
|
1387
|
+
call: true,
|
|
1388
|
+
return: true,
|
|
1389
|
+
exception: true,
|
|
1390
|
+
stdout: true,
|
|
1391
|
+
timeout: true
|
|
1392
|
+
},
|
|
1393
|
+
controls: {
|
|
1394
|
+
maxTraceSteps: true,
|
|
1395
|
+
maxLineEvents: true,
|
|
1396
|
+
maxSingleLineHits: true,
|
|
1397
|
+
maxStoredEvents: true,
|
|
1398
|
+
minimalTrace: true
|
|
1399
|
+
},
|
|
1400
|
+
fidelity: {
|
|
1401
|
+
preciseLineMapping: true,
|
|
1402
|
+
stableFunctionNames: true,
|
|
1403
|
+
callStack: true
|
|
1404
|
+
}
|
|
1405
|
+
},
|
|
1406
|
+
diagnostics: {
|
|
1407
|
+
compileErrors: true,
|
|
1408
|
+
runtimeErrors: true,
|
|
1409
|
+
mappedErrorLines: true,
|
|
1410
|
+
stackTraces: false
|
|
1411
|
+
},
|
|
1412
|
+
structures: {
|
|
1413
|
+
treeNodeRefs: true,
|
|
1414
|
+
listNodeRefs: true,
|
|
1415
|
+
mapSerialization: true,
|
|
1416
|
+
setSerialization: true,
|
|
1417
|
+
graphSerialization: true,
|
|
1418
|
+
cycleReferences: true
|
|
1419
|
+
}
|
|
1420
|
+
},
|
|
1421
|
+
notes: [
|
|
1422
|
+
"C++ uses a focused browser-local Clang/LLD/WASI compiler lane with TraceCode-owned execution glue.",
|
|
1423
|
+
"The runtime intentionally does not depend on a generic multi-language container/runtime SDK.",
|
|
1424
|
+
'Script-style C++ uses an empty function name with executionStyle="function"; the snippet must assign a serializable result variable.',
|
|
1425
|
+
"Interview-mode C++ reuses the tracing compiler path with a trace budget and returns a non-trace execution result."
|
|
1426
|
+
]
|
|
1427
|
+
};
|
|
1428
|
+
var LANGUAGE_RUNTIME_PROFILES = {
|
|
1429
|
+
python: PYTHON_RUNTIME_PROFILE,
|
|
1430
|
+
javascript: JAVASCRIPT_RUNTIME_PROFILE,
|
|
1431
|
+
typescript: TYPESCRIPT_RUNTIME_PROFILE,
|
|
1432
|
+
java: JAVA_RUNTIME_PROFILE,
|
|
1433
|
+
csharp: CSHARP_RUNTIME_PROFILE,
|
|
1434
|
+
cpp: CPP_RUNTIME_PROFILE
|
|
1435
|
+
};
|
|
1436
|
+
var SUPPORTED_LANGUAGES = Object.freeze(
|
|
1437
|
+
Object.keys(LANGUAGE_RUNTIME_PROFILES)
|
|
1438
|
+
);
|
|
1439
|
+
function getLanguageRuntimeProfile(language) {
|
|
1440
|
+
const profile = LANGUAGE_RUNTIME_PROFILES[language];
|
|
1441
|
+
if (!profile) {
|
|
1442
|
+
throw new Error(`Runtime profile for language "${language}" is not implemented yet.`);
|
|
1443
|
+
}
|
|
1444
|
+
return profile;
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
// packages/harness-browser/src/javascript-runtime-client.ts
|
|
1448
|
+
var JavaScriptRuntimeClient = class {
|
|
1449
|
+
constructor(runtimeLanguage, workerClient) {
|
|
1450
|
+
this.runtimeLanguage = runtimeLanguage;
|
|
1451
|
+
this.workerClient = workerClient;
|
|
1452
|
+
}
|
|
1453
|
+
async init() {
|
|
1454
|
+
return this.workerClient.init();
|
|
1455
|
+
}
|
|
1456
|
+
async executeWithTracing(code, functionName, inputs, options, executionStyle = "function") {
|
|
1457
|
+
assertRuntimeRequestSupported(getLanguageRuntimeProfile(this.runtimeLanguage), {
|
|
1458
|
+
request: "trace",
|
|
1459
|
+
executionStyle,
|
|
1460
|
+
functionName
|
|
1461
|
+
});
|
|
1462
|
+
return this.workerClient.executeWithTracing(
|
|
1463
|
+
code,
|
|
1464
|
+
functionName,
|
|
1465
|
+
inputs,
|
|
1466
|
+
options,
|
|
1467
|
+
executionStyle,
|
|
1468
|
+
this.runtimeLanguage
|
|
1469
|
+
);
|
|
1470
|
+
}
|
|
1471
|
+
async executeCode(code, functionName, inputs, executionStyle = "function") {
|
|
1472
|
+
assertRuntimeRequestSupported(getLanguageRuntimeProfile(this.runtimeLanguage), {
|
|
1473
|
+
request: "execute",
|
|
1474
|
+
executionStyle,
|
|
1475
|
+
functionName
|
|
1476
|
+
});
|
|
1477
|
+
return this.workerClient.executeCode(
|
|
1478
|
+
code,
|
|
1479
|
+
functionName,
|
|
1480
|
+
inputs,
|
|
1481
|
+
executionStyle,
|
|
1482
|
+
this.runtimeLanguage
|
|
1483
|
+
);
|
|
1484
|
+
}
|
|
1485
|
+
async executeCodeInterviewMode(code, functionName, inputs, executionStyle = "function") {
|
|
1486
|
+
assertRuntimeRequestSupported(getLanguageRuntimeProfile(this.runtimeLanguage), {
|
|
1487
|
+
request: "interview",
|
|
1488
|
+
executionStyle,
|
|
1489
|
+
functionName
|
|
1490
|
+
});
|
|
1491
|
+
return this.workerClient.executeCodeInterviewMode(
|
|
1492
|
+
code,
|
|
1493
|
+
functionName,
|
|
1494
|
+
inputs,
|
|
1495
|
+
executionStyle,
|
|
1496
|
+
this.runtimeLanguage
|
|
1497
|
+
);
|
|
1498
|
+
}
|
|
1499
|
+
};
|
|
1500
|
+
function createJavaScriptRuntimeClient(runtimeLanguage, workerClient) {
|
|
1501
|
+
return new JavaScriptRuntimeClient(runtimeLanguage, workerClient);
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
// packages/harness-browser/src/runtime-diagnostics.ts
|
|
1505
|
+
var CONSOLE_METHOD_BY_LEVEL = {
|
|
1506
|
+
debug: "debug",
|
|
1507
|
+
info: "info",
|
|
1508
|
+
warn: "warn",
|
|
1509
|
+
error: "error"
|
|
1510
|
+
};
|
|
1511
|
+
function runtimeDiagnosticEvent(params) {
|
|
1512
|
+
return {
|
|
1513
|
+
schema: "tracecode.runtime-diagnostic.v1",
|
|
1514
|
+
source: "harness",
|
|
1515
|
+
...params
|
|
1516
|
+
};
|
|
1517
|
+
}
|
|
1518
|
+
function logRuntimeDiagnostic(level, params, options = {}) {
|
|
1519
|
+
if (options.enabled === false && level !== "error") {
|
|
1520
|
+
return;
|
|
1521
|
+
}
|
|
1522
|
+
const method = CONSOLE_METHOD_BY_LEVEL[level] ?? "info";
|
|
1523
|
+
console[method]("[TraceRuntime]", runtimeDiagnosticEvent(params));
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
// packages/harness-browser/src/javascript-worker-client.ts
|
|
1527
|
+
var EXECUTION_TIMEOUT_MS = 2e4;
|
|
1528
|
+
var INTERVIEW_MODE_TIMEOUT_MS = 5e3;
|
|
1529
|
+
var TRACING_TIMEOUT_MS = 2e4;
|
|
1530
|
+
var INIT_TIMEOUT_MS = 1e4;
|
|
1531
|
+
var TYPESCRIPT_WARMUP_TIMEOUT_MS = 3e4;
|
|
1532
|
+
var MESSAGE_TIMEOUT_MS = 12e3;
|
|
1533
|
+
var WORKER_READY_TIMEOUT_MS = 1e4;
|
|
1534
|
+
var JavaScriptWorkerClient = class {
|
|
1535
|
+
constructor(options) {
|
|
1536
|
+
this.options = options;
|
|
1537
|
+
this.debug = options.debug ?? process.env.NODE_ENV === "development";
|
|
1538
|
+
}
|
|
1539
|
+
worker = null;
|
|
1540
|
+
pendingMessages = /* @__PURE__ */ new Map();
|
|
1541
|
+
messageId = 0;
|
|
1542
|
+
isInitializing = false;
|
|
1543
|
+
initPromise = null;
|
|
1544
|
+
warmupPromises = /* @__PURE__ */ new Map();
|
|
1545
|
+
workerReadyPromise = null;
|
|
1546
|
+
workerReadyResolve = null;
|
|
1547
|
+
workerReadyReject = null;
|
|
1548
|
+
debug;
|
|
1549
|
+
isSupported() {
|
|
1550
|
+
return typeof Worker !== "undefined";
|
|
1551
|
+
}
|
|
1552
|
+
getWorker() {
|
|
1553
|
+
if (this.worker) return this.worker;
|
|
1554
|
+
if (!this.isSupported()) {
|
|
1555
|
+
throw new Error("Web Workers are not supported in this environment");
|
|
1556
|
+
}
|
|
1557
|
+
this.workerReadyPromise = new Promise((resolve, reject) => {
|
|
1558
|
+
this.workerReadyResolve = resolve;
|
|
1559
|
+
this.workerReadyReject = (error) => reject(error);
|
|
1560
|
+
});
|
|
1561
|
+
const workerUrl = this.debug && !this.options.workerUrl.includes("?") ? `${this.options.workerUrl}?dev=${Date.now()}` : this.options.workerUrl;
|
|
1562
|
+
this.worker = new Worker(workerUrl);
|
|
1563
|
+
this.worker.onmessage = (event) => {
|
|
1564
|
+
const { id, type, payload } = event.data;
|
|
1565
|
+
if (type === "worker-ready") {
|
|
1566
|
+
this.workerReadyResolve?.();
|
|
1567
|
+
this.workerReadyResolve = null;
|
|
1568
|
+
this.workerReadyReject = null;
|
|
1569
|
+
logRuntimeDiagnostic("info", {
|
|
1570
|
+
component: "JavaScriptWorkerClient",
|
|
1571
|
+
runtime: "javascript",
|
|
1572
|
+
phase: "worker-ready",
|
|
1573
|
+
message: "JavaScript worker is ready."
|
|
1574
|
+
}, { enabled: this.debug });
|
|
1575
|
+
return;
|
|
1576
|
+
}
|
|
1577
|
+
if (id) {
|
|
1578
|
+
const pending = this.pendingMessages.get(id);
|
|
1579
|
+
if (!pending) return;
|
|
1580
|
+
this.pendingMessages.delete(id);
|
|
1581
|
+
if (pending.timeoutId) globalThis.clearTimeout(pending.timeoutId);
|
|
1582
|
+
if (type === "error") {
|
|
1583
|
+
pending.reject(new Error(payload.error));
|
|
1584
|
+
return;
|
|
1585
|
+
}
|
|
1586
|
+
pending.resolve(payload);
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
this.worker.onerror = (error) => {
|
|
1590
|
+
logRuntimeDiagnostic("error", {
|
|
1591
|
+
component: "JavaScriptWorkerClient",
|
|
1592
|
+
runtime: "javascript",
|
|
1593
|
+
phase: "worker-error",
|
|
1594
|
+
message: "JavaScript worker emitted an error event.",
|
|
1595
|
+
detail: {
|
|
1596
|
+
message: error.message,
|
|
1597
|
+
filename: error.filename,
|
|
1598
|
+
lineno: error.lineno,
|
|
1599
|
+
colno: error.colno
|
|
1600
|
+
}
|
|
1601
|
+
});
|
|
1602
|
+
const workerError = new Error("Worker error");
|
|
1603
|
+
this.workerReadyReject?.(workerError);
|
|
1604
|
+
this.workerReadyResolve = null;
|
|
1605
|
+
this.workerReadyReject = null;
|
|
1606
|
+
for (const [id, pending] of this.pendingMessages) {
|
|
1607
|
+
if (pending.timeoutId) globalThis.clearTimeout(pending.timeoutId);
|
|
1608
|
+
pending.reject(workerError);
|
|
1609
|
+
this.pendingMessages.delete(id);
|
|
1610
|
+
}
|
|
1611
|
+
};
|
|
1612
|
+
return this.worker;
|
|
1613
|
+
}
|
|
1614
|
+
async waitForWorkerReady() {
|
|
1615
|
+
const readyPromise = this.workerReadyPromise;
|
|
1616
|
+
if (!readyPromise) return;
|
|
1617
|
+
await new Promise((resolve, reject) => {
|
|
1618
|
+
let settled = false;
|
|
1619
|
+
const timeoutId = globalThis.setTimeout(() => {
|
|
1620
|
+
if (settled) return;
|
|
1621
|
+
settled = true;
|
|
1622
|
+
const timeoutError = new Error(
|
|
1623
|
+
`JavaScript worker failed to initialize in time (${Math.round(WORKER_READY_TIMEOUT_MS / 1e3)}s)`
|
|
1624
|
+
);
|
|
1625
|
+
this.terminateAndReset(timeoutError);
|
|
1626
|
+
reject(timeoutError);
|
|
1627
|
+
}, WORKER_READY_TIMEOUT_MS);
|
|
1628
|
+
readyPromise.then(() => {
|
|
1629
|
+
if (settled) return;
|
|
1630
|
+
settled = true;
|
|
1631
|
+
globalThis.clearTimeout(timeoutId);
|
|
1632
|
+
resolve();
|
|
1633
|
+
}).catch((error) => {
|
|
1634
|
+
if (settled) return;
|
|
1635
|
+
settled = true;
|
|
1636
|
+
globalThis.clearTimeout(timeoutId);
|
|
1637
|
+
reject(error instanceof Error ? error : new Error(String(error)));
|
|
1638
|
+
});
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
async sendMessage(type, payload, timeoutMs = MESSAGE_TIMEOUT_MS) {
|
|
1642
|
+
const worker = this.getWorker();
|
|
1643
|
+
await this.waitForWorkerReady();
|
|
1644
|
+
const id = String(++this.messageId);
|
|
1645
|
+
return new Promise((resolve, reject) => {
|
|
1646
|
+
this.pendingMessages.set(id, {
|
|
1647
|
+
resolve,
|
|
1648
|
+
reject
|
|
1649
|
+
});
|
|
1650
|
+
const timeoutId = globalThis.setTimeout(() => {
|
|
1651
|
+
const pending2 = this.pendingMessages.get(id);
|
|
1652
|
+
if (!pending2) return;
|
|
1653
|
+
this.pendingMessages.delete(id);
|
|
1654
|
+
pending2.reject(new Error(`Worker request timed out: ${type}`));
|
|
1655
|
+
}, timeoutMs);
|
|
1656
|
+
const pending = this.pendingMessages.get(id);
|
|
1657
|
+
if (pending) pending.timeoutId = timeoutId;
|
|
1658
|
+
worker.postMessage({ id, type, payload });
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1661
|
+
async executeWithTimeout(executor, timeoutMs) {
|
|
1662
|
+
return new Promise((resolve, reject) => {
|
|
1663
|
+
let settled = false;
|
|
1664
|
+
const timeoutId = globalThis.setTimeout(() => {
|
|
1665
|
+
if (settled) return;
|
|
1666
|
+
settled = true;
|
|
1667
|
+
this.terminateAndReset();
|
|
1668
|
+
reject(
|
|
1669
|
+
new Error(
|
|
1670
|
+
`Execution timed out (possible infinite loop). Code execution was stopped after ${Math.round(timeoutMs / 1e3)} seconds.`
|
|
1671
|
+
)
|
|
1672
|
+
);
|
|
1673
|
+
}, timeoutMs);
|
|
1674
|
+
executor().then((result) => {
|
|
1675
|
+
if (settled) return;
|
|
1676
|
+
settled = true;
|
|
1677
|
+
globalThis.clearTimeout(timeoutId);
|
|
1678
|
+
resolve(result);
|
|
1679
|
+
}).catch((error) => {
|
|
1680
|
+
if (settled) return;
|
|
1681
|
+
settled = true;
|
|
1682
|
+
globalThis.clearTimeout(timeoutId);
|
|
1683
|
+
reject(error);
|
|
1684
|
+
});
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
terminateAndReset(reason = new Error("Worker was terminated")) {
|
|
1688
|
+
this.workerReadyReject?.(reason);
|
|
1689
|
+
if (this.worker) {
|
|
1690
|
+
this.worker.terminate();
|
|
1691
|
+
this.worker = null;
|
|
1692
|
+
}
|
|
1693
|
+
this.initPromise = null;
|
|
1694
|
+
this.warmupPromises.clear();
|
|
1695
|
+
this.isInitializing = false;
|
|
1696
|
+
this.workerReadyPromise = null;
|
|
1697
|
+
this.workerReadyResolve = null;
|
|
1698
|
+
this.workerReadyReject = null;
|
|
1699
|
+
for (const [, pending] of this.pendingMessages) {
|
|
1700
|
+
if (pending.timeoutId) globalThis.clearTimeout(pending.timeoutId);
|
|
1701
|
+
pending.reject(reason);
|
|
1702
|
+
}
|
|
1703
|
+
this.pendingMessages.clear();
|
|
1704
|
+
}
|
|
1705
|
+
async init() {
|
|
1706
|
+
if (this.initPromise) return this.initPromise;
|
|
1707
|
+
if (this.isInitializing) {
|
|
1708
|
+
await new Promise((resolve) => globalThis.setTimeout(resolve, 100));
|
|
1709
|
+
return this.init();
|
|
1710
|
+
}
|
|
1711
|
+
this.isInitializing = true;
|
|
1712
|
+
this.initPromise = this.sendMessage("init", void 0, INIT_TIMEOUT_MS);
|
|
1713
|
+
try {
|
|
1714
|
+
return await this.initPromise;
|
|
1715
|
+
} catch (error) {
|
|
1716
|
+
this.initPromise = null;
|
|
1717
|
+
throw error;
|
|
1718
|
+
} finally {
|
|
1719
|
+
this.isInitializing = false;
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
async warmup(language = "javascript") {
|
|
1723
|
+
const existing = this.warmupPromises.get(language);
|
|
1724
|
+
if (existing) return existing;
|
|
1725
|
+
const warmupPromise = (async () => {
|
|
1726
|
+
await this.init();
|
|
1727
|
+
return this.sendMessage(
|
|
1728
|
+
"warmup",
|
|
1729
|
+
{ language },
|
|
1730
|
+
language === "typescript" ? TYPESCRIPT_WARMUP_TIMEOUT_MS : INIT_TIMEOUT_MS
|
|
1731
|
+
);
|
|
1732
|
+
})();
|
|
1733
|
+
this.warmupPromises.set(language, warmupPromise);
|
|
1734
|
+
try {
|
|
1735
|
+
return await warmupPromise;
|
|
1736
|
+
} catch (error) {
|
|
1737
|
+
this.warmupPromises.delete(language);
|
|
1738
|
+
throw error;
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
async executeWithTracing(code, functionName, inputs, options, executionStyle = "function", language = "javascript") {
|
|
1742
|
+
await this.init();
|
|
1743
|
+
return this.executeWithTimeout(
|
|
1744
|
+
() => this.sendMessage(
|
|
1745
|
+
"execute-with-tracing",
|
|
1746
|
+
{
|
|
1747
|
+
code,
|
|
1748
|
+
functionName,
|
|
1749
|
+
inputs,
|
|
1750
|
+
options,
|
|
1751
|
+
executionStyle,
|
|
1752
|
+
language
|
|
1753
|
+
},
|
|
1754
|
+
TRACING_TIMEOUT_MS + 2e3
|
|
1755
|
+
),
|
|
1756
|
+
TRACING_TIMEOUT_MS
|
|
1757
|
+
);
|
|
1758
|
+
}
|
|
1759
|
+
async executeCode(code, functionName, inputs, executionStyle = "function", language = "javascript") {
|
|
1760
|
+
await this.init();
|
|
1761
|
+
return this.executeWithTimeout(
|
|
1762
|
+
() => this.sendMessage(
|
|
1763
|
+
"execute-code",
|
|
1764
|
+
{
|
|
1765
|
+
code,
|
|
1766
|
+
functionName,
|
|
1767
|
+
inputs,
|
|
1768
|
+
executionStyle,
|
|
1769
|
+
language
|
|
1770
|
+
},
|
|
1771
|
+
EXECUTION_TIMEOUT_MS + 2e3
|
|
1772
|
+
),
|
|
1773
|
+
EXECUTION_TIMEOUT_MS
|
|
1774
|
+
);
|
|
1775
|
+
}
|
|
1776
|
+
async executeCodeInterviewMode(code, functionName, inputs, executionStyle = "function", language = "javascript") {
|
|
1777
|
+
await this.init();
|
|
1778
|
+
try {
|
|
1779
|
+
const result = await this.executeWithTimeout(
|
|
1780
|
+
() => this.sendMessage(
|
|
1781
|
+
"execute-code-interview",
|
|
1782
|
+
{
|
|
1783
|
+
code,
|
|
1784
|
+
functionName,
|
|
1785
|
+
inputs,
|
|
1786
|
+
executionStyle,
|
|
1787
|
+
language
|
|
1788
|
+
},
|
|
1789
|
+
INTERVIEW_MODE_TIMEOUT_MS + 2e3
|
|
1790
|
+
),
|
|
1791
|
+
INTERVIEW_MODE_TIMEOUT_MS
|
|
1792
|
+
);
|
|
1793
|
+
if (!result.success && result.error) {
|
|
1794
|
+
const normalized = result.error.toLowerCase();
|
|
1795
|
+
const isTimeoutOrResourceLimit = normalized.includes("timed out") || normalized.includes("infinite loop") || normalized.includes("line-limit") || normalized.includes("single-line-limit") || normalized.includes("recursion-limit") || normalized.includes("trace-limit") || normalized.includes("line events") || normalized.includes("trace steps") || normalized.includes("call depth");
|
|
1796
|
+
if (isTimeoutOrResourceLimit) {
|
|
1797
|
+
return {
|
|
1798
|
+
success: false,
|
|
1799
|
+
output: null,
|
|
1800
|
+
error: "Time Limit Exceeded",
|
|
1801
|
+
consoleOutput: result.consoleOutput ?? []
|
|
1802
|
+
};
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
return result;
|
|
1806
|
+
} catch {
|
|
1807
|
+
return {
|
|
1808
|
+
success: false,
|
|
1809
|
+
output: null,
|
|
1810
|
+
error: "Time Limit Exceeded",
|
|
1811
|
+
consoleOutput: []
|
|
1812
|
+
};
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
terminate() {
|
|
1816
|
+
this.terminateAndReset();
|
|
1817
|
+
}
|
|
1818
|
+
};
|
|
777
1819
|
// Annotate the CommonJS export names for ESM import in node:
|
|
778
1820
|
0 && (module.exports = {
|
|
1821
|
+
JavaScriptWorkerClient,
|
|
779
1822
|
TYPESCRIPT_RUNTIME_DECLARATIONS,
|
|
1823
|
+
createJavaScriptRuntimeClient,
|
|
780
1824
|
executeJavaScriptCode,
|
|
781
1825
|
executeJavaScriptWithTracing,
|
|
782
1826
|
executeTypeScriptCode,
|