This PR adds the `kernel` directory which contains a port of the Extism
memory allocator compiled to WebAssembly and removes
`runtime/src/memory.rs` completely.
Being able to re-use memory functions as a WASM module allows us to
begin to experiment with porting Extism to new runtimes!
This is in a draft state while I'm verifying some of these changes.
Currently wasmtime `8.0.0` - `10.0.0` are compatible with
`extism-runtime`, in the interest of remaining compatible with as many
applications as possible, this PR updates the wasmtime version
requirement from a single version to a range of acceptable versions.
## Breaking Changes
* https://github.com/extism/extism/pull/315
HTTP calls will be disallowed by default now. If you want to enable HTTP
you need to specify the hosts that the plug-in is allowed to communicate
with. If you want to allow all hosts you can set it to `{allowed_hosts:
["*"]}` in the manifest. However, this isn't recommended unless you have
some trust in the plug-in or are controlling the networking by some
other means.
* https://github.com/extism/extism/pull/335
In this PR we are creating an implicit context so people don't need to
know about it if they don't care. In some languages function signatures
have changed to make context an optional argument when creating a
plug-in.
Unsure if now is the best time to do the `extism` crate version bumps,
but I figured they'd need to happen at some point in the near future
anyways. Happy to revert if there is any opposition. Also, I added back
the local `path` property to the Elixir NIF crate manifest. I want to
see if this breaks again in CI, or if we can leave it.
---------
Co-authored-by: zach <zach@dylib.so>
Let's get the last changes in this week for a release. Will hold this PR
until all changes we want are in.
Release checklist:
- [x] test: updates across CI to test for Host Function output /
integration (#219)
- this should probably look something like a grep for some kind of
output proving guest/host interop?
- [x] Fix for userData pointer issue in Go host functions (#220)
- [x] docs: Host Functions in SDKs
- [ ] sdk: C
- [ ] sdk: C++
- [ ] sdk: Python
- [ ] sdk: Node
- [ ] sdk: Go
- [ ] sdk: Rust
- [x] docs: Manifest property names (http `headers` & memory
`max_pages`)
- [ ] blog: announcing v0.2.0, including host functions, Zig SDK/PDK,
Java SDK, .NET SDK, + ...
- Adds `Manifest::timeout_ms` field to specify the plugin timeout in
milliseconds
- Sets a 30 second default timeout
Co-authored-by: Steve Manuel <steve@dylib.so>
- Updates codebase to use the latest version of wasmtime, wasmtime-wasi
and wasmtime-wasi-nn
- Allows functions with no return values to be called, this provides
basic support for `_start` functions
- For now `_start` functions called by extism still need to use the
extism input/output functions instead of the command line arguments
- Adds `allowed_hosts` to the manifest
- If there are any `allowed_hosts` then `extism_http_request` checks to
make sure a URL's host is listed before performing the reques