You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(js-host-api): add host function registration for Node.js (#31)
Add support for registering host-side JavaScript callbacks that guest
sandboxed code can call via ES module imports.
New APIs:
- proto.hostModule(name) - Create a builder for registering functions
- builder.register(name, callback) - Register a host function
- proto.register(module, fn, callback) - Convenience method
Guest code imports host modules as 'import * as math from "host:math"'
and calls functions like math.add(1, 2). Arguments are JSON-serialized
across the sandbox boundary. Both sync and async callbacks are supported.
Changes:
- hyperlight-js: Add register_raw() for dynamic NAPI scenarios
- js-host-api: Add HostModule wrapper, ThreadsafeFunction bridge
- js-host-api: Update Cargo.toml to use tokio_rt feature
- Add comprehensive tests (22 new JS tests, 4 new Rust tests)
- Add host-functions.js example
- Update README with Host Functions documentation
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
0 commit comments