Package ai.platon.pulsar.coding
Class CodeRunner
-
- All Implemented Interfaces:
public final class CodeRunnerSandboxed code execution for the coding domain —
coding.runCode(language, code).Runs user/agent-provided code in a throwaway subprocess with:
a private temp working directory (nothing in the workspace can be touched unless the code explicitly reaches out via absolute paths),
a hard timeout (default 30s) after which the process is killed,
stdout/stderr capture with truncation (no unbounded output),
a deny-list of interpreters that would be too dangerous to spawn as-is (interactive shells, database clients, etc.).
It deliberately does NOT provide network, persistence, or workspace access — scripts that need those should use
coding.shellwith the normal command whitelist instead.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classCodeRunner.RunResult
-
Constructor Summary
Constructors Constructor Description CodeRunner(Long defaultTimeoutSeconds, Integer maxOutputChars)
-
Method Summary
-
-
Method Detail
-
supportedLanguages
final List<String> supportedLanguages()
Supported languages for runCode.
-
run
final CodeRunner.RunResult run(String language, String code, Long timeoutSeconds, List<String> args)
Run code in a sandboxed subprocess.
- Parameters:
language- one of supportedLanguagescode- source code to executetimeoutSeconds- max run time (defaults to defaultTimeoutSeconds)args- extra CLI args passed to the interpreter
-
-
-
-