Skip to main content

Module mount

Module mount 

Source
Expand description

/lang/python/ VFS mount backed by the wasm-sandboxed python guest.

Exposes a /lang/python layout driven by a PythonShell over the wasm guest, so the interpreter is the sandboxed guest rather than a native one.

Layout:

  • /lang/python/eval — ctl: write a Python EXPRESSION, read repr(result) (with \n---\n<stdout> appended if it printed)
  • /lang/python/stdout — ctl: write Python STATEMENTS, read captured stdout
  • /lang/python/vars/ — dynamic dir: non-dunder globals as readable files
  • /lang/python/defs/ — dynamic dir: callable globals (functions/classes)

§Why a command channel

A PythonShell owns a long-lived wasmtime Store. When the sandbox holds a VFS capability, its vfs_* host fns blocking_send on the proxy — so the shell MUST be driven from a NON-async thread, never a tokio worker. The async [Mount] methods therefore cannot call the shell directly: PythonMount holds a tokio::sync::mpsc::Sender<PyCommand> and forwards each request to the thread that owns the shell, which replies over a oneshot.

PythonMount::spawn wires this end-to-end: it opens the shell, spawns the driver thread, and keeps the command channel internal. The driver exits when the mount is dropped. Mount the result at /lang/python; the namespace is the only interface (epic #508, issue #634).

Built on hyprstream-vfs’s devfile primitives (ControlFile for eval/stdout, DynamicDir for vars/defs) rather than hand-rolling the write→latch→read state machine — see hyprstream_vfs::devfile (#609).

Structs§

PythonMount
VFS mount that proxies /lang/python requests to a PythonShell owned by the mount itself.

Enums§

PyCommand
A request from PythonMount to the thread owning the PythonShell.