Expand description
RustPython engine + /lang/python 9P shell for the hyprstream VFS namespace.
This crate is the ONE python-aware layer over the generic, language-agnostic
wasm sandbox engine ([hyprstream_workers_wasmtime]). It runs untrusted Python on
the RustPython guest (hyprstream-workers-python-guest, compiled to
wasm32-unknown-unknown) inside a Profile-A
Sandbox. The engine knows nothing about
Python; everything python-specific (the eval/py_op ABI, the result decoding,
the /lang/python mount) lives here.
Module shape mirrors hyprstream-workers-tcl:
lib.rs— thePythonShell+ re-exports of the mount items.mount.rs—PythonMount(impl Mount),PyCommand,PythonMount::spawn.
§Guest ABI used here
eval(ptr,len) -> i32— run UTF-8 source in a FRESH interpreter; 0 = ok, nonzero = a Python error. Driven viaSandbox::call_export.py_op(op, ptr, len) -> i64— run an operation against the PERSISTENT interpreter, returning a packed(out_ptr<<32)|out_lenreply whose first byte is a status tag. Driven byPythonShellover the genericPersistentInstance.
§Security
The guest only ever reaches the host capabilities the engine’s Linker grants
(env::host_random + the Subject-scoped env::vfs_*); everything else traps. DoS
bounds (fuel / epoch) are enforced by the engine. import os; os.system(...) is
inert — there is no syscall surface.
Re-exports§
pub use mount::PyCommand;pub use mount::PythonMount;
Modules§
- mount
/lang/python/VFS mount backed by the wasm-sandboxed python guest.
Structs§
- Python
Shell - A persistent python shell over a single wasm guest instance.
Enums§
- PyResult
- The outcome of a
py_op: a status tag plus the UTF-8 payload.
Functions§
- eval
- Run Python
sourcein a FRESH interpreter with the given fuel budget. - eval_
with_ epoch_ deadline - Run Python
source(FRESH interpreter) with a WALL-CLOCK epoch deadline ofticksepoch increments.