using System.Text.Json; namespace ZB.MOM.WW.ScadaBridge.CentralUI.ScriptAnalysis; /// /// Request from the UI to execute a script in the central sandbox. /// Parameters arrive as JSON values and are converted to .NET primitives /// before being placed in the Parameters dictionary supplied to the script. /// selects which globals surface the script is compiled /// and run against — template/shared scripts see , /// inbound API method scripts see . /// , when set, binds the run to a deployed /// instance so Instance/Attributes access routes to it cross-site /// instead of throwing. Ignored for inbound API scripts. /// public record SandboxRunRequest( string Code, Dictionary? Parameters, int? TimeoutSeconds, ScriptKind Kind = ScriptKind.Template, string? BindInstanceUniqueName = null); public enum SandboxErrorKind { None, CompileError, SandboxLimitation, RuntimeError, Timeout } /// /// Result of a Test Run. carries Roslyn diagnostics /// when is CompileError so the UI can display them /// the same way it does for the editor's live problems panel. /// public record SandboxRunResult( bool Success, string? ReturnValueJson, string? ReturnTypeName, string ConsoleOutput, string? Error, SandboxErrorKind ErrorKind, long DurationMs, IReadOnlyList? Markers);