feat(builder): expose ProcessCommand as command.processAsync in Execute Script V2#259
Open
feat(builder): expose ProcessCommand as command.processAsync in Execute Script V2#259
Conversation
|
Great job! No new security vulnerabilities introduced in this pull requestCommunicate with Checkmarx by submitting a PR comment with @Checkmarx followed by one of the supported commands. Learn about the supported commands here. |
Co-authored-by: lucasoares <10624972+lucasoares@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for ProcessCommand action in Execute Script V2
feat(builder): expose ProcessCommand as command.processAsync in Execute Script V2
Mar 12, 2026
There was a problem hiding this comment.
Pull request overview
This PR adds a new Execute Script V2 host object (command) so JavaScript scripts can process LIME/Blip commands natively (similar to the Builder ProcessCommand action), and updates documentation and tests accordingly.
Changes:
- Exposes
command.processAsync(payload)to Execute Script V2 scripts and returns the serialized command response JSON. - Threads
ISender,IEnvelopeSerializer, andIConfigurationinto Execute Script V2 function registration to support command processing. - Adds unit tests and updates Execute Script V2 README with usage examples.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Take.Blip.Builder/Actions/ExecuteScriptV2/README.md | Documents the new command.processAsync helper with examples. |
| src/Take.Blip.Builder/Actions/ExecuteScriptV2/Functions/FunctionsRegistrable.cs | Registers the new command host object and expands registration dependencies. |
| src/Take.Blip.Builder/Actions/ExecuteScriptV2/Functions/Command.cs | Implements Command.ProcessAsync to convert payload → LIME Command → ISender.ProcessCommandAsync → serialize response. |
| src/Take.Blip.Builder/Actions/ExecuteScriptV2/ExecuteScriptV2Action.cs | Adds constructor dependencies and passes them into RegisterFunctions. |
| src/Take.Blip.Builder.UnitTests/Actions/ExecuteScript2ActionTests.cs | Adds test coverage for success and failure scenarios of command.processAsync. |
| src/Take.Blip.Builder.Benchmark/Actions/ExecuteScriptBenchmarkTests.cs | Updates benchmark setup for new ExecuteScriptV2Action constructor signature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
30
to
+35
| public ExecuteScriptV2Action( | ||
| IConfiguration configuration, | ||
| IHttpClient httpClient, | ||
| ILogger logger) | ||
| ILogger logger, | ||
| ISender sender, | ||
| IEnvelopeSerializer envelopeSerializer) |
Comment on lines
30
to
38
| public static void RegisterFunctions(this ScriptEngine engine, | ||
| ExecuteScriptV2Settings settings, | ||
| IHttpClient httpClient, IContext context, | ||
| Time time, | ||
| ILogger logger, | ||
| ISender sender, | ||
| IEnvelopeSerializer envelopeSerializer, | ||
| IConfiguration configuration, | ||
| CancellationToken cancellationToken) |
Comment on lines
+89
to
+92
| var command = _convertToCommand(settings); | ||
| command.Id = Lime.Protocol.EnvelopeId.NewId(); | ||
|
|
||
| var resultCommand = await _sender.ProcessCommandAsync(command, _cancellationToken); |
Comment on lines
+97
to
+101
| private LimeCommand _convertToCommand(JObject settings) | ||
| { | ||
| if (settings.TryGetValue(LimeCommand.TYPE_KEY, out var type) | ||
| && Regex.IsMatch(type.ToString(), SERIALIZABLE_PATTERN, default, Constants.REGEX_TIMEOUT) | ||
| && settings.TryGetValue(LimeCommand.RESOURCE_KEY, out var resource)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Execute Script V2 lacked a native way to process LIME/Blip commands from within scripts, forcing workarounds. This adds a
command.processAsync(payload)helper following the same conventions ascontext,request, andtime.Changes
Command.cs(ExecuteScriptV2/Functions/) —Commandclass exposingprocessAsync(object payload)to the V8 engine. Reuses the same command conversion and metadata injection logic asProcessCommandAction. Returns the serialized JSON response string.FunctionsRegistrable.cs— acceptsISender,IEnvelopeSerializer,IConfigurationand registers thecommandhost object.ExecuteScriptV2Action.cs— addsISenderandIEnvelopeSerializerconstructor dependencies; threads them intoRegisterFunctions.README.md— documentscommand.processAsyncwith usage examples.Usage
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.