Draft: localExec under pythonmonkey: run Node's evaluator as the sandbox

Supersedes !303 (closed).

localExec() under pythonmonkey uses Node's own evaluator as the sandbox. pmEvaluatorFactory() returns a Worker-shaped SandboxConstructor that starts node libexec/evaluator-node.js <files> through evaluator-pm-parent.py (pythonmonkey has no child_process) and speaks the lib/standaloneWorker.js wire protocol over its stdio. Callers pass the node sandbox definition files; there is no separate pythonmonkey sandbox definition. Node.js on the PATH is required, as for the rest of PythonMonkey.

build/bundle: gives node.exe a Windows path for dcpClientDestination when cygpath is available (carried over from !303 (closed)).

Sequencing

  1. PythonMonkey #518 adds a structuredClone() global; the supervisor needs it.
  2. This MR.
  3. dcp !3327 calls pmEvaluatorFactory() from job.localExec(). It needs sandboxDefinitions['node'] instead of ['pythonmonkey'].

Tested

  • From PythonMonkey 1.4.1 on macOS arm64: every node sandbox definition file reports scriptLoaded (including the Pyodide worktime), the sandbox posts __sandboxLoaded, and terminate() leaves no evaluator-node.js process.
  • Not yet: a full job.localExec() (needs dcp !3327), Linux, Windows.

🤖 Generated with Claude Code

Edited by Dan Desjardins

Merge request reports

Loading
Loading