Built-in sandbox SHIM: a Pillow (PIL)-compatible PIL package for the model's
Python sandbox, backed by the com.blockether/imaging FFM stack (Rust
image + resvg + tiny-skia). NOTHING here touches java.desktop: no
CPython Pillow wheel ships in the sandbox, and no Java2D/ImageIO either; this
extension contributes a
:ext/sandbox-shims entry that env-python/build-agent-context installs into
every sandbox Context (main + every sub_loop fork): the host bridge callables
are wired onto the globals, then the Python preamble publishes a PIL package
(with Image, ImageDraw, ImageFilter, ImageOps, ImageColor,
ImageEnhance, ImageChops, ImageFont, ImageMath submodules) into
sys.modules (so from PIL import Image works) and staples them onto builtins.
Images live HOST-side as Rasters -- a plain packed-0xAARRGGBB int[] plus
width/height -- in a per-JVM registry keyed by an integer handle; the Python
Image object is a thin handle wrapper. All pixel ops, drawing, filtering,
geometry and codec work happen on the host; only small metadata vectors and
base64 blobs cross the strings-only boundary. Codecs, resampling, rotation and
vector drawing go through com.blockether.imaging; per-pixel algorithms stay
in Clojure over the raster. Reuses mpl-capture/record-attachment! so
Image.show() surfaces the image inline as a session attachment.
Built-in sandbox SHIM: a Pillow (PIL)-compatible `PIL` package for the model's Python sandbox, backed by the `com.blockether/imaging` FFM stack (Rust `image` + `resvg` + `tiny-skia`). NOTHING here touches `java.desktop`: no CPython Pillow wheel ships in the sandbox, and no Java2D/ImageIO either; this extension contributes a `:ext/sandbox-shims` entry that `env-python/build-agent-context` installs into every sandbox Context (main + every `sub_loop` fork): the host bridge callables are wired onto the globals, then the Python preamble publishes a `PIL` package (with `Image`, `ImageDraw`, `ImageFilter`, `ImageOps`, `ImageColor`, `ImageEnhance`, `ImageChops`, `ImageFont`, `ImageMath` submodules) into `sys.modules` (so `from PIL import Image` works) and staples them onto builtins. Images live HOST-side as `Raster`s -- a plain packed-0xAARRGGBB `int[]` plus width/height -- in a per-JVM registry keyed by an integer handle; the Python `Image` object is a thin handle wrapper. All pixel ops, drawing, filtering, geometry and codec work happen on the host; only small metadata vectors and base64 blobs cross the strings-only boundary. Codecs, resampling, rotation and vector drawing go through `com.blockether.imaging`; per-pixel algorithms stay in Clojure over the raster. Reuses `mpl-capture/record-attachment!` so `Image.show()` surfaces the image inline as a session attachment.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |