Skip to content

feat: WASM import path — (import "bar" :exec executor) #274

@lthibault

Description

@lthibault

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions