Interface ScriptExecutionStrategy
- All Known Implementing Classes:
EmbeddedPythonExecutionStrategy, ExternalPythonExecutionStrategy, JavaScriptExecutionStrategy
public interface ScriptExecutionStrategy
Strategy interface for script execution.
Implementations provide different ways to execute scripts:
JavaScriptExecutionStrategy- GraalJS JavaScript engineEmbeddedPythonExecutionStrategy- GraalPy embedded PythonExternalPythonExecutionStrategy- External Python subprocess (future)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionexecute(String code, Map<String, Object> input, ai.nervemind.common.domain.Node node, ExecutionService.ExecutionContext context) Execute a script with the given input data.default StringGet information about why this strategy might not be available.Get a human-readable name for display.Get the language identifier this strategy handles.default booleanCheck if this strategy is available (dependencies installed, etc.).
-
Method Details
-
execute
Map<String,Object> execute(String code, Map<String, Object> input, ai.nervemind.common.domain.Node node, ExecutionService.ExecutionContext context) throws ScriptExecutionExceptionExecute a script with the given input data.- Parameters:
code- the script code to executeinput- input data from previous nodesnode- the node being executed (for accessing parameters)context- the execution context- Returns:
- output data including script results merged with input
- Throws:
ScriptExecutionException- if execution fails
-
getLanguageId
String getLanguageId()Get the language identifier this strategy handles.- Returns:
- the language ID (e.g., "javascript", "python")
-
getDisplayName
String getDisplayName()Get a human-readable name for display.- Returns:
- display name (e.g., "JavaScript (GraalJS)", "Python (GraalPy)")
-
isAvailable
default boolean isAvailable()Check if this strategy is available (dependencies installed, etc.).- Returns:
- true if the strategy can be used
-
getAvailabilityInfo
Get information about why this strategy might not be available.- Returns:
- diagnostic message, or empty string if available
-