Parent
Part of #272 (Glia import system)
Summary
Implement the WASM import path: (import "bar" :exec executor) resolves /lib/bar.wasm, spawns a WASI process via the provided executor capability, bootstraps a Cap'n Proto RPC capability over data_streams, and returns it to the caller.
Scope
- Extend
import.rs resolution to handle .wasm extension (falls through from .glia)
- Parse
:exec keyword arg from import form
- Error if
.wasm resolved but no :exec provided
- Spawn WASM process via executor's
Dispatch call
- Bootstrap Cap'n Proto capability over
data_streams channel (NOT stdio)
- Return capability reference (
Val) to caller
- Default 30s bootstrap timeout, configurable via
:timeout keyword arg
- Support absolute
/ipfs/-prefixed paths for WASM modules
Non-goals
- Multi-process data_streams (protocol extension — separate work)
- Import caching (TODOS.md)
- Connection rate limiting (TODOS.md)
Test cases (from design doc)
(import "chess" :exec executor) → capability returned, (perform chess :move ...) works
.wasm without :exec → error
- WASM module that never exports bootstrap → timeout after 30s (or custom
:timeout)
- Both
.glia and .wasm exist → .glia wins
- WASM handler crash during bootstrap → clean error, process killed
/ipfs/-prefixed absolute WASM import
Dependencies
Parent
Part of #272 (Glia import system)
Summary
Implement the WASM import path:
(import "bar" :exec executor)resolves/lib/bar.wasm, spawns a WASI process via the provided executor capability, bootstraps a Cap'n Proto RPC capability overdata_streams, and returns it to the caller.Scope
import.rsresolution to handle.wasmextension (falls through from.glia):execkeyword arg from import form.wasmresolved but no:execprovidedDispatchcalldata_streamschannel (NOT stdio)Val) to caller:timeoutkeyword arg/ipfs/-prefixed paths for WASM modulesNon-goals
Test cases (from design doc)
(import "chess" :exec executor)→ capability returned,(perform chess :move ...)works.wasmwithout:exec→ error:timeout).gliaand.wasmexist →.gliawins/ipfs/-prefixed absolute WASM importDependencies
data_streamsprotocol extension for multi-process support