Implement JavaScript and Python Execution Components
This PR adds JavaScript and Python run-time features to the golem:exec
interface as requested in issues document. Closes #33
/claim https://github.com/golemcloud/golem-llm/issues/33
What’s Done
Language Support:
- JavaScript: ES5 through ES2022
- Python: versions 3.8 through 3.12
Key Features:
- Streaming execution - get output as code runs, not just when finished
- Session management - upload files, run code, download result
- Resource limits - enable timeouts and memory limits
- File handling - UTF-8, Base64, and Hex encoding enabled
- Error handling - short error messages for different failure modes
How It Works
- Upload your code files to a session
- Set the execution limits (timeout, memory)
- Run code with streaming or normal execution
- Return results through stdout, stderr, and exit codes
Testing
- Tests cover streaming, timeouts, file operation, and language checks
- Works in both native and WASM modes
- Integration tests check the end-to-end pipeline
Files Changed
New Components:
exec/exec/
- Central executor (1,200+ lines)
exec/exec-javascript/
- JavaScript context (400+ lines)
exec/exec-python/
- Python context (400+ lines)
Key Files:
executor.rs
- Core execution logic
runtime/
- Runtime factories for each language
stream.rs
- Streaming output handling
- WIT files defining the interfaces