Coder Social home page Coder Social logo

extism / extism Goto Github PK

View Code? Open in Web Editor NEW
3.8K 27.0 98.0 8.54 MB

The framework for building with WebAssembly (wasm). Easily load wasm modules, move data, call functions, and build extensible apps.

Home Page: https://extism.org

License: BSD 3-Clause "New" or "Revised" License

Makefile 1.24% C 4.46% Rust 93.33% Shell 0.44% CMake 0.53%
plugin-system c cpp go ocaml python ruby rust haskell wasm

extism's Introduction

Overview

Extism is a lightweight framework for building with WebAssembly (Wasm). It supports running Wasm code on servers, the edge, CLIs, IoT, browsers and everything in between. Extism is designed to be "universal" in that it supports a common interface, no matter where it runs.

Note: One of the primary use cases for Extism is building extensible software & plugins. You want to be able to execute arbitrary, untrusted code from your users? Extism makes this safe and practical to do.

Additionally, Extism adds some extra utilities on top of standard Wasm runtimes. For example, we support persistent memory/module-scope variables, secure & host-controlled HTTP without WASI, runtime limiters & timers, simpler host function linking, and more. Extism users build:

  • plug-in systems
  • FaaS platforms
  • code generators
  • web applications
  • & much more...

Run WebAssembly In Your App

Pick a SDK to import into your program, and refer to the documentation to get started:

Type Language Source Code Package
Rust SDK Rust SDK https://github.com/extism/extism/tree/main/runtime Crates.io
JS SDK JS SDK https://github.com/extism/js-sdk
(supports Web, Node, Deno & Bun!)
NPM
Elixir SDK Elixir SDK https://github.com/extism/elixir-sdk Hex
Go SDK Go SDK https://github.com/extism/go-sdk Go mod
Haskell SDK Haskell SDK https://github.com/extism/haskell-sdk Hackage
Java SDK Java SDK https://github.com/extism/java-sdk Sonatype
.NET SDK .NET SDK https://github.com/extism/dotnet-sdk
(supports C# & F#!)
Nuget
OCaml SDK OCaml SDK https://github.com/extism/ocaml-sdk opam
Perl SDK Perl SDK https://github.com/extism/perl-sdk N/A
PHP SDK PHP SDK https://github.com/extism/php-sdk Packagist
Python SDK Python SDK https://github.com/extism/python-sdk PyPi
Ruby SDK Ruby SDK https://github.com/extism/ruby-sdk RubyGems
Zig SDK Zig SDK https://github.com/extism/zig-sdk N/A
C SDK C SDK https://github.com/extism/extism/tree/main/libextism N/A
C++ SDK C++ SDK https://github.com/extism/cpp-sdk N/A

Compile WebAssembly to run in Extism Hosts

Extism Hosts (running the SDK) must execute WebAssembly code that has a PDK library compiled in to the .wasm binary. PDKs make it easy for plug-in / extension code authors to read input from the host and return data back, read provided configuration, set/get variables, make outbound HTTP calls if allowed, and more.

Pick a PDK to import into your Wasm program, and refer to the documentation to get started:

Type Language Source Code Package
Rust PDK Rust PDK https://github.com/extism/rust-pdk Crates.io
JS PDK JS PDK https://github.com/extism/js-pdk N/A
Go PDK Go PDK https://github.com/extism/go-pdk Go mod
Haskell PDK Haskell PDK https://github.com/extism/haskell-pdk Hackage
AssemblyScript PDK AssemblyScript PDK https://github.com/extism/assemblyscript-pdk NPM
.NET PDK .NET PDK https://github.com/extism/dotnet-pdk
(supports C# & F#!)
https://www.nuget.org/packages/Extism.Pdk
C PDK C PDK https://github.com/extism/c-pdk N/A
Zig PDK Zig PDK https://github.com/extism/zig-pdk N/A

Support

Discord

If you experience any problems or have any questions, please join our Discord and let us know. Our community is very responsive and happy to help get you started.

Usage

Head to the project website for more information and docs. Also, consider reading an overview of Extism and its goals & approach.

Contribution

Thank you for considering a contribution to Extism, we are happy to help you make a PR or find something to work on!

The easiest way to start would be to join the Discord or open an issue on the extism/proposals issue tracker, which can eventually become an Extism Improvement Proposal (EIP).

For more information, please read the Contributing guide.


Who's behind this?

Extism is an open-source product from the team at:

Reach out and tell us what you're building! We'd love to help: [email protected]

extism's People

Contributors

bhelx avatar brettcannon avatar chances avatar chrisdickinson avatar cosmichorrordev avatar dependabot[bot] avatar g4vi avatar george-hopkins avatar jhaines1988 avatar marton6 avatar mathieuancelin avatar mhmd-azeez avatar modprog avatar neuronicnobody avatar nilslice avatar oluwamuyiwa avatar thomas-zahner avatar thomasdarimont avatar usdogu avatar wikiwong avatar zshipko avatar zwiterrion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

extism's Issues

Javadoc warnings prevented publishing

When trying to publish to nexus i was getting the following error. I changed the javadoc plugin to ignore the warnings but we should probably fix these.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.4.1:jar (attach-javadoc) on project extism: MavenReportException: Error while generating Javadoc: 
[ERROR] Exit code: 1 - Loading source files for package org.extism.sdk...
[ERROR] Loading source files for package org.extism.sdk.manifest...
[ERROR] Loading source files for package org.extism.sdk.wasm...
[ERROR] Loading source files for package org.extism.sdk.support...
[ERROR] Constructing Javadoc information...
[ERROR] Building index for all the packages and classes...
[ERROR] Standard Doclet version 19
[ERROR] Building tree for all the packages and classes...
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/MemoryOptions.java:9: error: invalid use of @param
[ERROR]  * @param max Max number of pages.
[ERROR]    ^
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/wasm/ByteArrayWasmSource.html...
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/wasm/WasmSource.java:10: warning: no description for @return
[ERROR]      * @return
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/wasm/WasmSource.java:16: warning: no description for @return
[ERROR]      * @return
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/wasm/ByteArrayWasmSource.java:15: warning: no description for @param
[ERROR]      * @param name
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/wasm/ByteArrayWasmSource.java:17: warning: no description for @param
[ERROR]      * @param hash
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/wasm/ByteArrayWasmSource.java:35: warning: no comment
[ERROR]     public byte[] data() {
[ERROR]                   ^
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/Context.html...
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/Context.java:66: warning: no description for @param
[ERROR]      * @param plugin
[ERROR]        ^
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/Extism.html...
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/Extism.java:16: warning: no description for @param
[ERROR]      * @param path
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/Extism.java:17: warning: no description for @param
[ERROR]      * @param level
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/Extism.java:11: warning: use of default constructor, which does not provide a comment
[ERROR] public class Extism {
[ERROR]        ^
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/Extism.LogLevel.html...
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/Extism.java:72: warning: no comment
[ERROR]         public String getLevel() {
[ERROR]                       ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/Extism.java:60: warning: no comment
[ERROR]         DEBUG("debug"), //
[ERROR]         ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/Extism.java:58: warning: no comment
[ERROR]         INFO("info"), //
[ERROR]         ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/Extism.java:64: warning: no comment
[ERROR]         TRACE("trace");
[ERROR]         ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/Extism.java:62: warning: no comment
[ERROR]         WARN("warn"), //
[ERROR]         ^
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/ExtismException.html...
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/ExtismException.java:8: warning: no comment
[ERROR]     public ExtismException() {
[ERROR]            ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/ExtismException.java:11: warning: no comment
[ERROR]     public ExtismException(String message) {
[ERROR]            ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/ExtismException.java:15: warning: no comment
[ERROR]     public ExtismException(String message, Throwable cause) {
[ERROR]            ^
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/support/Hashing.html...
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/support/Hashing.java:5: warning: no comment
[ERROR] public class Hashing {
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/support/Hashing.java:5: warning: use of default constructor, which does not provide a comment
[ERROR] public class Hashing {
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/support/Hashing.java:7: warning: no comment
[ERROR]     public static String sha256HexDigest(byte[] input) {
[ERROR]                          ^
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/support/JsonSerde.html...
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/support/JsonSerde.java:18: warning: no comment
[ERROR] public class JsonSerde {
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/support/JsonSerde.java:18: warning: use of default constructor, which does not provide a comment
[ERROR] public class JsonSerde {
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/support/JsonSerde.java:32: warning: no comment
[ERROR]     public static String toJson(Manifest manifest) {
[ERROR]                          ^
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/LibExtism.html...
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:21: warning: no @return
[ERROR]     Pointer extism_context_new();
[ERROR]             ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:26: warning: no @param for contextPointer
[ERROR]     void extism_context_free(Pointer contextPointer);
[ERROR]          ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:31: warning: no description for @param
[ERROR]      * @param contextPointer
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:47: warning: no description for @param
[ERROR]      * @param contextPointer
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:48: warning: no description for @param
[ERROR]      * @param pluginId
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:49: warning: no description for @return
[ERROR]      * @return
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:69: warning: no @return
[ERROR]     String extism_version();
[ERROR]            ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:79: error: reference not found
[ERROR]      * @see #extism_plugin_new(long, byte[], long, boolean)
[ERROR]             ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:86: warning: no description for @param
[ERROR]      * @param contextPointer
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:87: warning: no description for @param
[ERROR]      * @param pluginIndex
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:98: warning: no description for @param
[ERROR]      * @param contextPointer
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:99: warning: no description for @param
[ERROR]      * @param pluginIndex
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:107: warning: no description for @param
[ERROR]      * @param contextPointer
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:108: warning: no description for @param
[ERROR]      * @param pluginIndex
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:109: warning: no description for @return
[ERROR]      * @return
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:115: error: reference not found
[ERROR]      * Similar to {@link #extism_plugin_new(long, byte[], long, boolean)} but takes an {@code pluginIndex} argument to specify which plugin to update.
[ERROR]                          ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:118: warning: no description for @param
[ERROR]      * @param contextPointer
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:119: warning: no description for @param
[ERROR]      * @param pluginIndex
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:120: warning: no description for @param
[ERROR]      * @param wasm
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:121: warning: no description for @param
[ERROR]      * @param length
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:124: warning: no description for @param
[ERROR]      * @param withWASI
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:132: warning: no description for @param
[ERROR]      * @param contextPointer
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:133: warning: no description for @param
[ERROR]      * @param pluginIndex
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:140: warning: no description for @param
[ERROR]      * @param contextPointer
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:141: warning: no description for @param
[ERROR]      * @param pluginIndex
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:142: warning: no description for @param
[ERROR]      * @param json
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/LibExtism.java:143: warning: no description for @param
[ERROR]      * @param jsonLength
[ERROR]        ^
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/manifest/Manifest.html...
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/Manifest.java:11: warning: no comment
[ERROR] public class Manifest {
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/Manifest.java:26: warning: no comment
[ERROR]     public Manifest() {
[ERROR]            ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/Manifest.java:34: warning: no comment
[ERROR]     public Manifest(List<WasmSource> sources) {
[ERROR]            ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/Manifest.java:38: warning: no comment
[ERROR]     public Manifest(List<WasmSource> sources, MemoryOptions memoryOptions) {
[ERROR]            ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/Manifest.java:42: warning: no comment
[ERROR]     public Manifest(List<WasmSource> sources, MemoryOptions memoryOptions, Map<String, String> config) {
[ERROR]            ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/Manifest.java:46: warning: no comment
[ERROR]     public Manifest(List<WasmSource> sources, MemoryOptions memoryOptions, Map<String, String> config, List<String> allowedHosts) {
[ERROR]            ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/Manifest.java:30: warning: no comment
[ERROR]     public Manifest(WasmSource source) {
[ERROR]            ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/Manifest.java:53: warning: no comment
[ERROR]     public void addSource(WasmSource source) {
[ERROR]                 ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/Manifest.java:72: warning: no comment
[ERROR]     public List<String> getAllowedHosts() {
[ERROR]                         ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/Manifest.java:65: warning: no comment
[ERROR]     public Map<String, String> getConfig() {
[ERROR]                                ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/Manifest.java:61: warning: no comment
[ERROR]     public MemoryOptions getMemoryOptions() {
[ERROR]                          ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/Manifest.java:57: warning: no comment
[ERROR]     public List<WasmSource> getSources() {
[ERROR]                             ^
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/manifest/ManifestHttpRequest.html...
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/ManifestHttpRequest.java:6: warning: no comment
[ERROR] public class ManifestHttpRequest {
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/ManifestHttpRequest.java:12: warning: no comment
[ERROR]     public ManifestHttpRequest(String url, Map<String, String> header, String method) {
[ERROR]            ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/ManifestHttpRequest.java:22: warning: no comment
[ERROR]     public Map<String, String> header() {
[ERROR]                                ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/ManifestHttpRequest.java:26: warning: no comment
[ERROR]     public String method() {
[ERROR]                   ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/ManifestHttpRequest.java:18: warning: no comment
[ERROR]     public String url() {
[ERROR]                   ^
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/manifest/MemoryOptions.html...
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/manifest/MemoryOptions.java:15: warning: no comment
[ERROR]     public MemoryOptions(Integer max) {
[ERROR]            ^
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/wasm/PathWasmSource.html...
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/wasm/PathWasmSource.java:16: warning: no description for @param
[ERROR]      * @param name
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/wasm/PathWasmSource.java:17: warning: no description for @param
[ERROR]      * @param path
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/wasm/PathWasmSource.java:18: warning: no description for @param
[ERROR]      * @param hash
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/wasm/PathWasmSource.java:36: warning: no comment
[ERROR]     public String path() {
[ERROR]                   ^
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/Plugin.html...
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/Plugin.java:142: warning: no description for @param
[ERROR]      * @param json
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/Plugin.java:143: warning: no description for @return
[ERROR]      * @return
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/Plugin.java:153: warning: no description for @param
[ERROR]      * @param jsonBytes
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/Plugin.java:49: warning: no comment
[ERROR]     public Plugin(Context context, Manifest manifest, boolean withWASI) {
[ERROR]            ^
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/wasm/WasmSource.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/wasm/WasmSourceResolver.html...
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/wasm/WasmSourceResolver.java:14: warning: use of default constructor, which does not provide a comment
[ERROR] public class WasmSourceResolver {
[ERROR]        ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/wasm/WasmSourceResolver.java:43: warning: no comment
[ERROR]     protected String hash(byte[] bytes) {
[ERROR]                      ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/wasm/WasmSourceResolver.java:35: warning: no comment
[ERROR]     protected String hash(Path wasmFile) {
[ERROR]                      ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/wasm/WasmSourceResolver.java:31: warning: no comment
[ERROR]     public ByteArrayWasmSource resolve(String name, byte[] bytes) {
[ERROR]                                ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/wasm/WasmSourceResolver.java:20: warning: no comment
[ERROR]     public PathWasmSource resolve(String name, Path path) {
[ERROR]                           ^
[ERROR] /Users/ben/Code/dylibso/extism/java/src/main/java/org/extism/sdk/wasm/WasmSourceResolver.java:16: warning: no comment
[ERROR]     public PathWasmSource resolve(Path path) {
[ERROR]                           ^
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/package-summary.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/package-tree.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/manifest/package-summary.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/manifest/package-tree.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/support/package-summary.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/support/package-tree.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/wasm/package-summary.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/wasm/package-tree.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/serialized-form.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/class-use/Extism.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/class-use/Extism.LogLevel.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/class-use/Context.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/class-use/Plugin.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/class-use/LibExtism.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/class-use/ExtismException.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/manifest/class-use/ManifestHttpRequest.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/manifest/class-use/MemoryOptions.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/manifest/class-use/Manifest.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/wasm/class-use/WasmSource.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/wasm/class-use/ByteArrayWasmSource.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/wasm/class-use/WasmSourceResolver.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/wasm/class-use/PathWasmSource.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/support/class-use/Hashing.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/support/class-use/JsonSerde.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/package-use.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/manifest/package-use.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/support/package-use.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/org/extism/sdk/wasm/package-use.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/overview-tree.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/deprecated-list.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/index.html...
[ERROR] Building index for all classes...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/allclasses-index.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/allpackages-index.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/index-all.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/search.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/overview-summary.html...
[ERROR] Generating /Users/ben/Code/dylibso/extism/java/target/apidocs/help-doc.html...
[ERROR] 3 errors
[ERROR] 80 warnings
[ERROR] 
[ERROR] Command line was: /opt/homebrew/Cellar/openjdk/19/libexec/openjdk.jdk/Contents/Home/bin/javadoc @options @packages
[ERROR] 
[ERROR] Refer to the generated Javadoc files in '/Users/ben/Code/dylibso/extism/java/target/apidocs' dir.
[ERROR] 
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

PHP Host-SDK: Cannot parse libextism.dylib

Running into an issue on mac when the FFIMe library tries to recursively resolve symbols in libextism.dylib:

PHP Warning:  file_get_contents(/System/Library/Frameworks/Security.framework/Versions/A/Security): Failed to open stream: No such file or directory in /private/tmp/extism-php/vendor/ircmaxell/php-object-symbolresolver/lib/Parser.php on line 18

Warning: file_get_contents(/System/Library/Frameworks/Security.framework/Versions/A/Security): Failed to open stream: No such file or directory in /private/tmp/extism-php/vendor/ircmaxell/php-object-symbolresolver/lib/Parser.php on line 18
PHP Fatal error:  Uncaught LogicException: File is neither in ELF nor Mach-O format in /private/tmp/extism-php/vendor/ircmaxell/php-object-symbolresolver/lib/Parser.php:28
Stack trace:
#0 /private/tmp/extism-php/vendor/ircmaxell/php-object-symbolresolver/lib/MachO/ObjectFile.php(50): PHPObjectSymbolResolver\Parser::parseFor('/System/Library...')
#1 /private/tmp/extism-php/vendor/ircmaxell/php-object-symbolresolver/lib/MachO/ObjectFile.php(59): PHPObjectSymbolResolver\MachO\ObjectFile->resolveDependentObjectsRecursively()
#2 /private/tmp/extism-php/vendor/ircmaxell/ffime/lib/FFIMe.php(86): PHPObjectSymbolResolver\MachO\ObjectFile->getAllSymbolsRecursively()
#3 /private/tmp/extism-php/vendor/extism/extism/php/src/Context.php(8): FFIMe\FFIMe->__construct('libextism.dylib')
#4 /private/tmp/extism-php/vendor/extism/extism/php/src/Context.php(29): Extism\generate_extism_lib()
#5 /private/tmp/extism-php/vendor/composer/autoload_real.php(55): require('/private/tmp/ex...')
#6 /private/tmp/extism-php/vendor/composer/autoload_real.php(38): composerRequire86fe5302a9cb56b04c03c0b0891eaa17('2e9cc0389558e6d...', '/private/tmp/ex...')
#7 /private/tmp/extism-php/vendor/autoload.php(25): ComposerAutoloaderInit86fe5302a9cb56b04c03c0b0891eaa17::getLoader()
#8 /private/tmp/extism-php/index.php(3): require_once('/private/tmp/ex...')
#9 {main}
  thrown in /private/tmp/extism-php/vendor/ircmaxell/php-object-symbolresolver/lib/Parser.php on line 28

Fatal error: Uncaught LogicException: File is neither in ELF nor Mach-O format in /private/tmp/extism-php/vendor/ircmaxell/php-object-symbolresolver/lib/Parser.php:28
Stack trace:
#0 /private/tmp/extism-php/vendor/ircmaxell/php-object-symbolresolver/lib/MachO/ObjectFile.php(50): PHPObjectSymbolResolver\Parser::parseFor('/System/Library...')
#1 /private/tmp/extism-php/vendor/ircmaxell/php-object-symbolresolver/lib/MachO/ObjectFile.php(59): PHPObjectSymbolResolver\MachO\ObjectFile->resolveDependentObjectsRecursively()
#2 /private/tmp/extism-php/vendor/ircmaxell/ffime/lib/FFIMe.php(86): PHPObjectSymbolResolver\MachO\ObjectFile->getAllSymbolsRecursively()
#3 /private/tmp/extism-php/vendor/extism/extism/php/src/Context.php(8): FFIMe\FFIMe->__construct('libextism.dylib')
#4 /private/tmp/extism-php/vendor/extism/extism/php/src/Context.php(29): Extism\generate_extism_lib()
#5 /private/tmp/extism-php/vendor/composer/autoload_real.php(55): require('/private/tmp/ex...')
#6 /private/tmp/extism-php/vendor/composer/autoload_real.php(38): composerRequire86fe5302a9cb56b04c03c0b0891eaa17('2e9cc0389558e6d...', '/private/tmp/ex...')
#7 /private/tmp/extism-php/vendor/autoload.php(25): ComposerAutoloaderInit86fe5302a9cb56b04c03c0b0891eaa17::getLoader()
#8 /private/tmp/extism-php/index.php(3): require_once('/private/tmp/ex...')
#9 {main}
  thrown in /private/tmp/extism-php/vendor/ircmaxell/php-object-symbolresolver/lib/Parser.php on line 28

This is happening on an M1 Mac (macOS 12.5.1). It appears that macOS is injecting these links to these security shared libraries in the libextism.dylib:

$ otool -L /usr/local/lib/libextism.dylib
/usr/local/lib/libextism.dylib:
	/Users/runner/work/extism/extism/target/aarch64-apple-darwin/release/deps/libextism.dylib (compatibility version 0.0.0, current version 0.0.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 60157.60.19)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1856.105.0)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)
	/usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)

This php symbol resolver library that FFIMe uses does seem to know how to resolve these.

I tried compiling libextism.dylib myself as well as pulling down the pre-built binaries and they are still there.

[Java SDK] UnsatisfiedLink error on macos

Running the tests on macos i get UnsatisfiedLink Error.

[ERROR] Errors: 
[ERROR]   PluginTests.shouldAllowInvokeHostFunctionFromPDK:138 ยป UnsatisfiedLink Error l...
[ERROR]   PluginTests.shouldAllowInvokeHostFunctionWithoutUserData:177 ยป UnsatisfiedLink

Problem appears to be that JNA cannot find the library by name: https://github.com/extism/extism/blob/main/java/src/main/java/org/extism/sdk/LibExtism.java#L14

If i change to

    LibExtism INSTANCE = Native.load("/usr/local/lib/libextism.dylib", LibExtism.class);

It works. There is supposedly a java property jna.library.path that you can set to help JNA find the library, but it doesn't seem to work for me.

Also reported by @k33g

FR: Iterable Object for Functions

Hi,

It would be amazing to have an iterable object for the functions available to call on the wasm module.
The online playground does this to populate the dropdown but I believe it requires secondary files. If possible, loading from the .wasm file would be amazing for schema checking and matching functions at runtime.
Checking if a specific function exists on the wasm object is currently implemented, however creating an iterable opens this up further.

Keep up the great work,
Bowbee

.NET Sample & Extism 0.4.0 -> thread panicked

I took the code from the docs verbatim:

https://github.com/christophwille/ExtismHello/blob/main/src/ExtismHello/Program.cs

What I got was the expected output plus a panicked message:

{"count": 3}
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74\library\std\src\thread\mod.rs:1458:40
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

D:\GitWorkspace\ExtismHello\src\ExtismHello\bin\Debug\net7.0\ExtismHello.exe (process 20556) exited with code -1073740791.

Is that what is supposed to happen? (Note my sample is on .NET 7)

Zig SDK?

Congrats for Extism, which looks like a really useful project.

However, especially given the number of supported languages, and its maturity regarding WebAssembly support, I was surprised to see Zig missing from the list.

Is a Zig SDK planned soon?

Rich `Context` API and decoupling `Plugin`s

extism::Context has two, very minimal functions for managing a pool of plugins. Underneath the hood, in extism_runtime::Context, there are numerous useful functions that could be exposed so that the user doesn't need to reimplement it themselves.

I found that I often need to manage a pool of Plugins. To currently do this, you must create your own collection, when extism_runtime::Context already does this for you.

On that note, I think it might be a little nicer to decouple a Plugin and a Context. You can create a plugin on your own, then when you want to use it, you upload it to a Context. I think the reason this wasn't done originally is so that you don't have to pass a Context to Plugin::call, which is why I also think that there should be a distinction between a Plugin and a PluginSchema. Essentially, a PluginSchema is a way to upload a WASM module to a Context with a given Manifest and other additional information. After upload, it will return a reference to the Plugin to which you can then call functions on. When you need it for another time, you pull the Plugin from the Context, using the proper API, then operate on it. This turns a Context into a custom collection for managing Plugins.

In addition to the above, it would also be useful to expose PluginIndexs and possibly extism_runtime::Context::next_id. I found that I want to generate ids for plugins to identify them, however, these plugins are not directly managed by extism. Maybe the "unique id" system should be decoupled into a separate struct that is used by a Context and could be passed by the user (otherwise defaulted).

Edit: I see the point of why Contexts aren't a proper collection is because a Plugin can be freed after being dropped. That's nice and all, but often times I need to store it and call it later. Why force the user to create their own collection when it's done internally? extism can still expose a wrapper struct around a Plugin that frees on drop, but I just don't think it's that useful when users can free them by calling a separate function.

Should improve error message when no passing config key

Plugin content

use extism_pdk::*;
// use openai::{completions::Completion, set_key};
use serde::Serialize;
use tokio::runtime;

#[plugin_fn]
pub fn openai(input: String) -> FnResult<String> {
  let api_key = config::get("api_key").expect("apikey set in config");

  let prompt = "Say hello";

  let rt = runtime::Builder::new_current_thread().build()?;
  rt.block_on(async {
    // let completion = Completion::builder("text-davinci-003")
    //   .prompt(prompt)
    //   .max_tokens(1024)
    //   .create()
    //   .await
    //   .unwrap()
    //   .unwrap();

    Ok(api_key)
  })
}

run with

cargo build --release --target wasm32-unknown-unknown && extism call target/wasm32-unknown-unknown/release/memelooop_plugin_openai.wasm openai --input "this is a test" --config aaa=myValue

will have error

๏ปฟ๏ปฟ   Compiling memelooop-plugin-openai v0.1.0 (/Users/linonetwo/Desktop/repo/memeloop/memeloop-plugin-examples/memelooop-plugin-openai)
warning: unused variable: `prompt`
  --> src/lib.rs:55:7
   |
55 |   let prompt = "Say hello";
   |       ^^^^^^ help: if this is intentional, prefix it with an underscore: `_prompt`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `input`
  --> src/lib.rs:51:15
   |
51 | pub fn openai(input: String) -> FnResult<String> {
   |               ^^^^^ help: if this is intentional, prefix it with an underscore: `_input`

warning: `memelooop-plugin-openai` (lib) generated 2 warnings
    Finished release [optimized] target(s) in 1.72s
extism_runtime::sdk ERROR 2023-03-28T13:09:26.221118+08:00 - Call: error while executing at wasm backtrace:
    0: 0x1b174 - <unknown>!__rust_start_panic
    1: 0x1b054 - <unknown>!rust_panic
    2: 0x1b024 - <unknown>!std::panicking::rust_panic_with_hook::ha23c8ba67d558e34
    3: 0x1a6d4 - <unknown>!std::panicking::begin_panic_handler::{{closure}}::h17240ff11865f8cf
    4: 0x1a5fe - <unknown>!std::sys_common::backtrace::__rust_end_short_backtrace::h4c1464e549336429
    5: 0x1ac7b - <unknown>!rust_begin_unwind
    6: 0x1bd3f - <unknown>!core::panicking::panic_fmt::h573ffd15dee74109
    7: 0x21a27 - <unknown>!core::panicking::panic_display::h841fa5626059a29b
    8: 0x218e7 - <unknown>!core::panicking::panic_str::h7c1f6e559acd8011
    9: 0x218b5 - <unknown>!core::option::expect_failed::h040ee3c555851d85
   10: 0x7241 - <unknown>!openai
note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information

Caused by:
    wasm trap: wasm `unreachable` instruction executed
Traceback (most recent call last):
  File "/usr/local/bin/extism", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/extism_cli/__init__.py", line 602, in main
    r = plugin.call(args.function, input, parse=None)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/extism/extism.py", line 378, in call
    self._check_error(
  File "/usr/local/lib/python3.11/site-packages/extism/extism.py", line 337, in _check_error
    raise Error(_ffi.string(error).decode())
extism.extism.Error: Call failed

Caused by:
    0: error while executing at wasm backtrace:
           0: 0x1b174 - <unknown>!__rust_start_panic
           1: 0x1b054 - <unknown>!rust_panic
           2: 0x1b024 - <unknown>!std::panicking::rust_panic_with_hook::ha23c8ba67d558e34
           3: 0x1a6d4 - <unknown>!std::panicking::begin_panic_handler::{{closure}}::h17240ff11865f8cf
           4: 0x1a5fe - <unknown>!std::sys_common::backtrace::__rust_end_short_backtrace::h4c1464e549336429
           5: 0x1ac7b - <unknown>!rust_begin_unwind
           6: 0x1bd3f - <unknown>!core::panicking::panic_fmt::h573ffd15dee74109
           7: 0x21a27 - <unknown>!core::panicking::panic_display::h841fa5626059a29b
           8: 0x218e7 - <unknown>!core::panicking::panic_str::h7c1f6e559acd8011
           9: 0x218b5 - <unknown>!core::option::expect_failed::h040ee3c555851d85
          10: 0x7241 - <unknown>!openai
       note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information
    1: wasm trap: wasm `unreachable` instruction executed

which is very unfriendly.

P.S. run with cargo build --release --target wasm32-unknown-unknown && extism call target/wasm32-unknown-unknown/release/memelooop_plugin_openai.wasm openai --input "this is a test" --config api_key=myValue won't have error.

Rust:How to write hello_world function to invoke plugin ?

error message:

Caused by:
    0: error while executing at wasm backtrace:
           0: 0x3690 - <unknown>!.Lhello_world_bitcast_invalid
           1: 0x35d3 - <unknown>!hello_world
           2: 0x3816 - <unknown>!count_vowels
       note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information
    1: wasm trap: wasm `unreachable` instruction executed', app/src/main.rs:49:62

my main.rs is

use extism::{Context, Error, Plugin, ValType};
use extism::{CurrentPlugin, UserData, Val};
use serde::{Deserialize, Serialize};

use std::collections::BTreeMap;

#[derive(Serialize, Deserialize)]
struct Output {
    pub count: i32,
}

fn hello_world(
    _plugin: &mut CurrentPlugin,
    inputs: &[Val],
    outputs: &mut [Val],
    _user_data: UserData,
) -> Result<(), Error> {
    println!("Hello from Rust, {:?}!", inputs[0].clone(),);
    outputs[0] = inputs[0].clone();
    Ok(())
}

fn main() {
    // test_simple();
    test_host_functions();
}
fn test_host_functions() {
    let context = Context::new();
    let wasm =
        include_bytes!("../../target/wasm32-unknown-unknown/release/add_host_functions.wasm");
    let f = extism::Function::new(
        "hello_world",
        [ValType::I64],
        [ValType::I64],
        None,
        hello_world,
    );
    let functions = [&f];
    println!("1---");
    let mut plugin = Plugin::new(&context, wasm, functions, true).unwrap();
    println!("2---");
    let mut config: BTreeMap<String, Option<String>> = BTreeMap::new();
    config.insert("thing".to_string(), Some("xx".to_string()));
    if let Err(e) = plugin.set_config(&config) {
        println!("err: {}", e);
        return;
    }
    println!("3---");
    let data = plugin.call("count_vowels", "this is a test").unwrap();
    println!("4---");
    println!("{}", String::from_utf8_lossy(data))
}

fn test_simple() {
    let wasm = include_bytes!("../../target/wasm32-unknown-unknown/release/add.wasm");
    let context = Context::new();
    let mut plugin = Plugin::new(&context, wasm, [], false).unwrap();
    let mut config: BTreeMap<String, Option<String>> = BTreeMap::new();
    config.insert("thing".to_string(), Some("xx".to_string()));
    if let Err(e) = plugin.set_config(&config) {
        println!("err: {}", e);
        return;
    }
    let data = plugin.call("count_vowels", "this is a test").unwrap();
    println!("{}", String::from_utf8_lossy(data))
}

my plugin, use rust-pdk extims examples:

#![no_main]

use extism_pdk::*;
use serde::{Deserialize, Serialize};

const VOWELS: &[char] = &['a', 'A', 'e', 'E', 'i', 'I', 'o', 'O', 'u', 'U'];

#[derive(Serialize, Deserialize)]
struct Output {
    pub count: i32,
}

#[host_fn]
extern "ExtismHost" {
    fn hello_world(count: Json<Output>) -> Json<Output>;
}

#[plugin_fn]
pub unsafe fn count_vowels<'a>(input: String) -> FnResult<Json<Output>> {
    let mut count = 0;
    for ch in input.chars() {
        if VOWELS.contains(&ch) {
            count += 1;
        }
    }

    let output = Output { count };
    let output = unsafe { hello_world(Json(output))? };
    Ok(output)
}

Shared library size and ARM32 support

Is there a shared library? If so, how large is it? We recently had a go with wasmedge (which is more like a vm), but the shared library is quite large (40 MB).

Does Extism have support or plan to have support for ARM32 host systems?

Vlang PDK?

I'm currently learning Vlang, and quite interested in the clear grammar, and super quick compiling (this is why I turn to Vlang from Rust). Vlang can compile to wasm and c also, but I do not find any instance of using other wasms. I'm trying to put most of my work on Vlang for the current project, so I would like to invoke some wasms that are compiled from other languages.

If there is extism pdk for Vlang, all this will be fantastic.

Thanks for your attention and thanks for your time.

Configurable HTTP timeouts

For extism_http_request in particular, we should add both host-configurable HTTP timeouts for call-outs made from a plug-in, as well as a way to set it from the PDK, but not to exceed one if set by the host. The PDK should only be able to set a timeout that is shorter than one set by the host.

bug

image

composer remove extism/extism

image
Your latest version has been corrected. These outputs should not appear

How to use Rust SDK in an async/tokio runtime?

Hey all, I'm trying to use the host SDK to support plugins in my app, and I can't get past the first step. I use tokio + async, and my plugin struct (that will wrap extism) is Send + Sync, but it looks like extism isn't Sync compatible?

This is the error I get:

error[E0277]: `*mut CurrentPlugin` cannot be sent between threads safely
  --> crates/wasm-plugin/src/verify.rs:6:31
   |
6  | impl<'ext> Verifiable<'_> for WasmPlugin<'ext> {
   |                               ^^^^^^^^^^^^^^^^ `*mut CurrentPlugin` cannot be sent between threads safely
   |
   = help: within `wasmtime::store::StoreInner<extism_runtime::plugin::Internal>`, the trait `Send` is not implemented for `*mut CurrentPlugin`
   = note: required because it appears within the type `Internal`
   = note: required because it appears within the type `ManuallyDrop<Internal>`
   = note: required because it appears within the type `StoreInner<Internal>`
   = note: required for `Unique<wasmtime::store::StoreInner<extism_runtime::plugin::Internal>>` to implement `Send`
   = note: required because it appears within the type `Box<StoreInner<Internal>>`
   = note: required because it appears within the type `ManuallyDrop<Box<StoreInner<Internal>>>`
   = note: required because it appears within the type `Store<Internal>`
   = note: required because it appears within the type `PluginMemory`
   = note: required because it appears within the type `CurrentPlugin`
   = note: required because it appears within the type `UnsafeCell<CurrentPlugin>`
   = note: required for `alloc::collections::btree::node::NodeRef<alloc::collections::btree::node::marker::Owned, i32, UnsafeCell<CurrentPlugin>, alloc::collections::btree::node::marker::LeafOrInternal>` to implement `Send`
   = note: required because it appears within the type `Option<NodeRef<Owned, i32, UnsafeCell<CurrentPlugin>, LeafOrInternal>>`
   = note: required because it appears within the type `BTreeMap<i32, UnsafeCell<CurrentPlugin>>`
   = note: required because it appears within the type `Context`
   = note: required for `Mutex<extism_runtime::context::Context>` to implement `Sync`
   = note: 1 redundant requirement hidden
   = note: required for `Arc<Mutex<extism_runtime::context::Context>>` to implement `Sync`
   = note: required because it appears within the type `Context`
   = note: required because it appears within the type `&Context`
   = note: required because it appears within the type `Plugin<'ext>`
note: required because it appears within the type `WasmPlugin<'ext>`
  --> crates/wasm-plugin/src/lib.rs:20:12
   |
20 | pub struct WasmPlugin<'ext> {
   |            ^^^^^^^^^^
note: required by a bound in `Verifiable`
  --> /Users/miles/Projects/proto/crates/core/src/verifier.rs:10:37
   |
10 | pub trait Verifiable<'tool>: Send + Sync + Downloadable<'tool> {
   |                                     ^^^^ required by this bound in `Verifiable`

I've tried wrapping in Arc/RwLock/Mutex with no luck.

use typescript for node sdk

While it adds a compile step to testing and release, I think having a typed API for node will be an improvement.

use double;

PHP 8.1.13 (cli) (built: Dec 6 2022 16:56:17) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.13, Copyright (c) Zend Technologies

Package operations: 4 installs, 0 updates, 0 removals

  • Installing ircmaxell/php-object-symbolresolver (dev-master dfe1b1a): Extracting archive
  • Installing ircmaxell/php-c-parser (dev-master fd8f5ef): Extracting archive
  • Installing ircmaxell/ffime (dev-master f6911d7): Extracting archive
  • Installing extism/extism (v0.1.0): Extracting archive
    Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postAutoloadDump
Script Illuminate\Foundation\ComposerScripts::postAutoloadDump handling the post-autoload-dump event terminated with an exception

In ExtismLib.php line 1:

The use statement with non-compound name 'double' has no effect

<?php use double;//ใ€Š=why
interface iExtismLib {}
interface iExtismLib_ptr {}

composer require extism/extism

why?

`error[E0786]: found invalid metadata files for crate` when building a rust host application (extism `0.2.0`)

Hello, I get this after running cargo run:

   Compiling log4rs v1.2.0
   Compiling wiggle v4.0.0
error[E0786]: found invalid metadata files for crate `file_per_thread_logger` which `wasmtime` depends on
  --> /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/wiggle-4.0.0/src/lib.rs:36:13
   |
36 |     pub use wasmtime::*;
   |             ^^^^^^^^
   |
   = note: failed to open rmeta metadata: '/home/ubuntu/samples/extism-xp/demo/target/debug/deps/libfile_per_thread_logger-81223c493d0f04ac.rmeta'
   = note: failed to open file '/home/ubuntu/samples/extism-xp/demo/target/debug/deps/libfile_per_thread_logger-81223c493d0f04ac.rlib': Operation not permitted (os error 1)

error: error writing dependencies to `/home/ubuntu/samples/extism-xp/demo/target/debug/deps/wiggle-c1426c5fb8af1d0f.d`: Operation not permitted (os error 1)

For more information about this error, try `rustc --explain E0786`.
error: could not compile `wiggle` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

[Node Host SDK | Host function] the value returned by a host function is truncated if I use emojis

๐Ÿ‘‹ Hello,
I'm using the Node Host SDK and the Go PDK.

On the Node.js side, this is the code of the host function:

function hey_peeps(currentPlugin, inputs, outputs, userData, userData1) {
  console.log("๐Ÿค— Hello from Javascript ๐Ÿ’œ")

  // Read the function parameter from the memory
  let mem = currentPlugin.memory(inputs[0].v.i64)
  // Display the string argument passed to the host function
  console.log("๐Ÿค–", mem.toString()) 
  
  // Print user data
  console.log("๐Ÿ–๏ธ", userData)
  console.log("๐Ÿ––", userData1)
  
  // Return a value
  const helloMessage = `๐Ÿ‘‹ Hello ${mem.toString()} ๐ŸŒ`
  var offs = currentPlugin.memoryAlloc(helloMessage.length)
  currentPlugin.memory(offs).write(helloMessage)
  outputs[0].v.i64 = offs;
}

On the TinyGo side, this is the code of the plugin:

package main

import (
	"github.com/extism/go-pdk"
)

//export hey_peeps
func hey_peeps(x uint64) uint64

//export heyPeople
func heyPeople() int32 {
	// Read the function parameter
	name := pdk.Input()

	// Call the host function whith the name as parameter
	// 1. copy the parameter to the memory
	mem_param := pdk.AllocateString(string(name))
	// 2. call the host function
	offs := hey_peeps(mem_param.Offset())

	// 3. read the return data
	mem_param = pdk.FindMemory(offs)

	// 4. copy the content of the memory to a buffer
	b := make([]byte, mem_param.Length())
	mem_param.Load(b)

	// 5. prepare the JSON value to return
	output := `{"message": "๐Ÿ‘‹ Hello World ๐ŸŒ from Go","input": "` +
		string(name) +
		`","result":"` + string(b) + `"}`

	// Allocate space into the memory
	mem := pdk.AllocateString(output)
	// zero-copy output to host
	pdk.OutputMemory(mem)

	return 0
}

func main() {}

The result of the call of the plugin is:

{"message":"๐Ÿ‘‹ Hello World ๐ŸŒ from Go","input":"Jane Doe","result":"๐Ÿ‘‹ Hello Jane Doe "}

The expected result should be:

{"message":"๐Ÿ‘‹ Hello World ๐ŸŒ from Go","input":"Jane Doe","result":"๐Ÿ‘‹ Hello Jane Doe ๐ŸŒ"}

Question - .Net Native AoT Support

Hi just ran into this as am looking for Plugin management runtime solutions that support plugins developed different languages.

The host environment I'm developing in is .Net 7 - and we're looking to leverage Native AoT.

Are there any pointers to whether extism will support both native AoT complied hosts, and in the case of .Net plugins those be native AoT compiled too ?

Installation Issue on MacOS Monterey - M1 Mac Pro

I ran into an issue installing extism CLI on an M1 Pro Macbook with Monterey with the extism install latest command. I had to sudo extism install latest for the /usr/local/lib/include path to be created correctly.

Without Sudo:

โžœ  extism install latest
Getting release for latest
Installing to /usr/local (version v0.1.0)
Password:
Installed /usr/local/lib/libextism.dylib
cp: /usr/local/include/extism.h: No such file or directory
Installed /usr/local/include/extism.h

โžœ  cat /usr/local/include/extism.h
cat: /usr/local/include/extism.h: No such file or directory

โžœ  extism version
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/extism_cli/__init__.py", line 472, in import_extism
    import extism
[... snip stacktrace ...]
extism.extism.Error: Unable to locate the extism library and header file

With Sudo:

โžœ  sudo extism install latest
Getting release for latest
Installing to /usr/local (version v0.1.0)
Installed /usr/local/lib/libextism.dylib
Installed /usr/local/include/extism.h

โžœ  extism version            
0.1.0

Looks like my user doesn't have rights to create the /usr/local/include/ path or something's wrong with the first time run of the script, something like that.

Granular HTTP permisisons

It would be nice if we had more control over how and which plugins use HTTP. Currently, we have to compile extism with a feature flag that enables it for all plugins.

Here are some ideas:

  • Individual HTTP permissions per plugin
  • List of permitted domains per plugin (similar to the new filesystem path permissions)

Exporting `main` conflicts with rust's entrypoint

When creating a plugin from the Rust PDK, you cannot export a main function as there will always be a main function in the output wasm module.

#[plugin_fn]
pub fn main(input: Vec<u8>) -> FnResult<Json<WidgetSchema>> {
  โ€ฆ
}

Trying to call this using extism cli will error out with

venv โฏ WASMTIME_BACKTRACE_DETAILS=1 extism call --input "abcdef" target/wasm32-unknown-unknown/release/mural_rust.wasm main
Traceback (most recent call last):
  File "/home/mbergeron/git/mural.co/mdk-env/mural-extism/venv/bin/extism", line 8, in <module>
    sys.exit(main())
  File "/home/mbergeron/git/mural.co/mdk-env/mural-extism/venv/lib/python3.8/site-packages/extism_cli/__init__.py", line 602, in main
    r = plugin.call(args.function, input, parse=None)
  File "/home/mbergeron/git/mural.co/mdk-env/mural-extism/venv/lib/python3.8/site-packages/extism/extism.py", line 288, in call
    self._check_error(
  File "/home/mbergeron/git/mural.co/mdk-env/mural-extism/venv/lib/python3.8/site-packages/extism/extism.py", line 247, in _check_error
    raise Error(_ffi.string(error).decode())
extism.extism.Error: Call failed

Caused by:
    expected 2 arguments, got 0

Renaming the function to init fixed the issue, so there might be some sort of compile time warning or doc to explain this workaround.

Node-SDK: Intermittent failure in FFI code

We are getting an intermittent failure when running the tests in Github actions. We have not seen this locally yet.

#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 0x7fff36019ad0
 1: 0xb6cab1  [node]
 2: 0x1bef8b4 V8_Fatal(char const*, ...) [node]
 3: 0xfb2ef1 v8::internal::GlobalBackingStoreRegistry::Register(std::shared_ptr<v8::internal::BackingStore>) [node]
 4: 0xd04968 v8::ArrayBuffer::GetBackingStore() [node]
 5: 0xab8d00 napi_get_typedarray_info [node]
 6: 0x7fcb54c68d50  [/home/runner/work/extism/extism/node/node_modules/ref-napi/prebuilds/linux-x64/node.napi.node]
 7: 0x7fcb640bf620 FFI::FFI::FFICall(Napi::CallbackInfo const&) [/home/runner/work/extism/extism/node/node_modules/ffi-napi/build/Release/ffi_bindings.node]
 8: 0x7fcb640c282d Napi::details::CallbackData<void (*)(Napi::CallbackInfo const&), void>::Wrapper(napi_env__*, napi_callback_info__*) [/home/runner/work/extism/extism/node/node_modules/ffi-napi/build/Release/ffi_bindings.node]
 9: 0xaaf64d  [node]
10: 0xd3976e  [node]
11: 0xd3ab8f v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
12: 0x15d55d9  [node]
Trace/breakpoint trap (core dumped)
Error: Process completed with exit code 133.

It could be related to this issue nodejs/node#32463

WASI-based filesystem access

All the use-cases I might want to use extism for (a shell, a package manager) involve fairly heavy filesystem access, and I think it would make a lot of sense to provide filesystem access to plugins (with configurable scope limitations). I saw on the site how you were looking for feedback on this front so you can consider this an official feature request for the functionality. Extism looks awesome and I'd love to make use of it!

Support wasmtime "fuel" limits

The Wasmtime runtime has a concept of "fuel" which meters the consumption of WASM instructions. This would allow the host to limit a plugin's execution. The host could have some defaults and maybe dymanically change the amount of fuel given to a plugin depending on their customer's needs.

https://docs.wasmtime.dev/api/wasmtime/struct.Store.html#method.add_fuel

This is probably not hard to add but might have a broader discussion about how to expose this in the Host SDK API.

Failed to run simple rust plugin in playground

Following error was found while trying to run a pluin following the tutorial "write a plugin in rust". I also tried to upload code.wasm shipped with source code and it works fine instead.

image

  • env
    rustc 1.66.0 (69f9c33d7 2022-12-12)

  • my cargo.toml:

[lib]
crate_type = ["cdylib"]

[dependencies]
extism-pdk = "0.1.1"
serde = { version = "1.0", features = ["derive"] }

wasm_web_plugin.zip

building for macOS-x86_64 but attempting to link with file built for macOS-arm64 GoLang 1.19.3 version

I'm trying to execute the sample Go code from Extism from https://extism.org/docs/integrate-into-your-codebase/go-host-sdk. After the error, I tried to debug the problem, so I ran this pretty minimal code.

import (
	"github.com/extism/extism"
)

func callWasm() {
	ctx := extism.NewContext()
	defer ctx.Free() // this will free the context and all associated plugins
}

I'm getting the following error.

GoLang Version: 1.19.3

Mac Chip: Apple M1 Pro

# github.com/extism/extism
ld: warning: ignoring file /usr/local/lib/libextism.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
  "_extism_context_free", referenced from:
      __cgo_48636a3be7c2_Cfunc_extism_context_free in _x002.o
     (maybe you meant: __cgo_48636a3be7c2_Cfunc_extism_context_free)
  "_extism_context_new", referenced from:
      __cgo_48636a3be7c2_Cfunc_extism_context_new in _x002.o
     (maybe you meant: __cgo_48636a3be7c2_Cfunc_extism_context_new)
  "_extism_context_reset", referenced from:
      __cgo_48636a3be7c2_Cfunc_extism_context_reset in _x002.o
     (maybe you meant: __cgo_48636a3be7c2_Cfunc_extism_context_reset)
  "_extism_error", referenced from:
      __cgo_48636a3be7c2_Cfunc_extism_error in _x002.o
     (maybe you meant: __cgo_48636a3be7c2_Cfunc_extism_error)
  "_extism_log_file", referenced from:
      __cgo_48636a3be7c2_Cfunc_extism_log_file in _x002.o
     (maybe you meant: __cgo_48636a3be7c2_Cfunc_extism_log_file)
  "_extism_plugin_call", referenced from:
      __cgo_48636a3be7c2_Cfunc_extism_plugin_call in _x002.o
     (maybe you meant: __cgo_48636a3be7c2_Cfunc_extism_plugin_call)
  "_extism_plugin_config", referenced from:
      __cgo_48636a3be7c2_Cfunc_extism_plugin_config in _x002.o
     (maybe you meant: __cgo_48636a3be7c2_Cfunc_extism_plugin_config)
  "_extism_plugin_free", referenced from:
      __cgo_48636a3be7c2_Cfunc_extism_plugin_free in _x002.o
     (maybe you meant: __cgo_48636a3be7c2_Cfunc_extism_plugin_free)
  "_extism_plugin_function_exists", referenced from:
      __cgo_48636a3be7c2_Cfunc_extism_plugin_function_exists in _x002.o
     (maybe you meant: __cgo_48636a3be7c2_Cfunc_extism_plugin_function_exists)
  "_extism_plugin_new", referenced from:
      __cgo_48636a3be7c2_Cfunc_extism_plugin_new in _x002.o
     (maybe you meant: __cgo_48636a3be7c2_Cfunc_extism_plugin_new)
  "_extism_plugin_output_data", referenced from:
      __cgo_48636a3be7c2_Cfunc_extism_plugin_output_data in _x002.o
     (maybe you meant: __cgo_48636a3be7c2_Cfunc_extism_plugin_output_data)
  "_extism_plugin_output_length", referenced from:
      __cgo_48636a3be7c2_Cfunc_extism_plugin_output_length in _x002.o
     (maybe you meant: __cgo_48636a3be7c2_Cfunc_extism_plugin_output_length)
  "_extism_plugin_update", referenced from:
      __cgo_48636a3be7c2_Cfunc_extism_plugin_update in _x002.o
     (maybe you meant: __cgo_48636a3be7c2_Cfunc_extism_plugin_update)
  "_extism_version", referenced from:
      __cgo_48636a3be7c2_Cfunc_extism_version in _x002.o
     (maybe you meant: __cgo_48636a3be7c2_Cfunc_extism_version)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Note:
I'm able to run the sample wasm file with the Extism command line tool in my machine, only the GoLang code is not working

Lua PDK?

I'd be intrigued about a Lua PDK, since a lot of plug-in developers write in Lua. I can see why this would be a strange choice, since why not just embed Lua directly if that's what I want... but it seems like if I used the Extism SDK, offering Lua as an option also makes all the other PDK languages available.

Dart support

Dart (via Flutter) might have the best cross-platform GUI toolkit available.

It would be killer to be able to use Extism plugins.

Java SDK?

The README image suggests that Java (or maybe just Android?) is a "coming soon" target language. I'd be keen to know when that lands.

expected ident at line 1 column 2

Don't know what this error message talk about

Plugin:

#[plugin_fn]
// see https://docs.rs/extism-pdk/latest/extism_pdk/struct.HttpRequest.html for docs on this type
pub fn http_get(Json(req): Json<HttpRequest>) -> FnResult<()> {
  info!("Request to: {}", req.url);
  // let mut headers = BTreeMap::new();
  // headers.insert("User-Agent".to_owned(), "my-http-client/1.0".to_owned());
  // let request = HttpRequest::new(String::from("https://bing.com"));
  // let res = http::request::<()>(&request, None)?;
  // Ok(res)
  Ok(())
}

Run

cargo build --release --target wasm32-unknown-unknown && extism call target/wasm32-unknown-unknown/release/memelooop_plugin_openai.wasm http_get --input "this is a test"

Fix php release / composer configuration

The PHP SDK, located within the php directory in the root, is published to Packagist using the composer.json file in the root. This needs some love!

Join us on Discord to chat about this issue:

Discord

Extism panics on Windows

While working on #239 I have found out that the runtime published on nuget panics when creating new contexts.

Repro:

using Extism.Sdk.Native;

Console.WriteLine($"Version: {Context.GetExtismVersion()}");

using var context = new Context(); // The panic happens here

Download full repro: panic_bug.zip

the Context constructor calls extism_context_new:

public Context()
{
    NativeHandle = LibExtism.extism_context_new();
}

Logs

Extism.runtime.win-x64 v0.4.0

Version: 0.3.0
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74\library\std\src\thread\mod.rs:1458:40
stack backtrace:
   0:     0x7ffe81c8cd42 - set_vmctx_memory
   1:     0x7ffe81ca8dfb - set_vmctx_memory
   2:     0x7ffe81c855ea - set_vmctx_memory
   3:     0x7ffe81c8ca8b - set_vmctx_memory
   4:     0x7ffe81c8f3b9 - set_vmctx_memory
   5:     0x7ffe81c8f03b - set_vmctx_memory
   6:     0x7ffe81c8fc50 - set_vmctx_memory
   7:     0x7ffe81c8f99b - set_vmctx_memory
   8:     0x7ffe81c8d75f - set_vmctx_memory
   9:     0x7ffe81c8f690 - set_vmctx_memory
  10:     0x7ffe81d58be5 - _jit_debug_register_code
  11:     0x7ffe81d58c9c - _jit_debug_register_code
  12:     0x7ffe81595270 - extism_version
  13:     0x7ffe8158085d - extism_version
  14:     0x7ffe815787a0 - extism_version
  15:     0x7ffe81580516 - extism_version
  16:     0x7fff518d3a83 - _sys_nerr
  17:     0x7fff518a006e - o_free
  18:     0x7fff5189da1d - execute_onexit_table
  19:     0x7ffe81d1fcf9 - _jit_debug_register_code
  20:     0x7ffe81d1fe1e - _jit_debug_register_code
  21:     0x7fff53eb868f - RtlActivateActivationContextUnsafeFast
  22:     0x7fff53ee1096 - LdrShutdownProcess
  23:     0x7fff53ee0c8d - RtlExitUserProcess
  24:     0x7fff51f882bb - ExitProcess
  25:     0x7fff5189bac0 - exit
  26:     0x7fff5189bcd9 - exit
  27:     0x7ff6d8cb421f - <unknown>
  28:     0x7fff51f826bd - BaseThreadInitThunk
  29:     0x7fff53eea9f8 - RtlUserThreadStart

Extism.runtime.win-x64 v0.3.0

Version: 0.2.0
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6\library\std\src\thread\mod.rs:1451:9
stack backtrace:
   0:     0x7ffe81c9fa32 - set_vmctx_memory
   1:     0x7ffe81cbbe5b - set_vmctx_memory
   2:     0x7ffe81c97baa - set_vmctx_memory
   3:     0x7ffe81c9f77b - set_vmctx_memory
   4:     0x7ffe81ca2109 - set_vmctx_memory
   5:     0x7ffe81ca1d8a - set_vmctx_memory
   6:     0x7ffe81ca2991 - set_vmctx_memory
   7:     0x7ffe81ca26da - set_vmctx_memory
   8:     0x7ffe81ca045f - set_vmctx_memory
   9:     0x7ffe81ca23e0 - set_vmctx_memory
  10:     0x7ffe81d64275 - _jit_debug_register_code
  11:     0x7ffe81d6436c - _jit_debug_register_code
  12:     0x7ffe81694580 - extism_version
  13:     0x7ffe815fc02d - extism_version
  14:     0x7ffe815e6e61 - extism_version
  15:     0x7ffe815fbddb - extism_version
  16:     0x7fff518d3a83 - _sys_nerr
  17:     0x7fff518a006e - o_free
  18:     0x7fff5189da1d - execute_onexit_table
  19:     0x7ffe81d2d419 - _jit_debug_register_code
  20:     0x7ffe81d2d53e - _jit_debug_register_code
  21:     0x7fff53eb868f - RtlActivateActivationContextUnsafeFast
  22:     0x7fff53ee1096 - LdrShutdownProcess
  23:     0x7fff53ee0c8d - RtlExitUserProcess
  24:     0x7fff51f882bb - ExitProcess
  25:     0x7fff5189bac0 - exit
  26:     0x7fff5189bcd9 - exit
  27:     0x7ff70730421f - <unknown>
  28:     0x7fff51f826bd - BaseThreadInitThunk
  29:     0x7fff53eea9f8 - RtlUserThreadStart

Extism.runtime.win-x64 v0.2.0

Version: 0.1.0

Note: The nuget version is ahead of the extism runtime version by 1 because of a stupid mistake I made while creating the GitHub actions.

Embedding runtime in a rust based compiler

Hey there!
So I'm fond of a programming language called gleam. It's a functional language that compiles to erlang and javascript and the compiler is written in rust.
I'd like to explore an SDK for gleam, but not sure where to start. I think I'd like to try skipping the whole c ffi thing, and use the runtime crate directly from the gleam compiler (also written in rust). The idea would be basically language level support for loading extism plugins, honestly because it sounds easier than trying to create all the binding infrastructure over again in gleam.
So I'm creating this issue to ask basically what you think the viability is and get some hints on where to start with the runtime crate?

Is there a way to ignore unexpected "__wbindgen_*" functions?

While trying to build one larger module with extism, I got below message while loading the wasm file in playground.

It seems that there are some wasm-bindgen related artifacts in the wasm file. Maybe it's caused by rand/getrandom crate but I have not look into this issue. On the other hand, I can load the resutant wasm file with same funtionality generated by wasm-pack instead.

  • error message
TypeError: import object field '__wbindgen_placeholder__' is not an Object
  • screenshot

image

image

Maybe better naming and API interface?

Hi team Extism,

I really like this project, and I think the dream of universal libraries that are cross language is coming a lot closer because of projects like this!

Of course ideally languages supporting WASM directly would be the utopia. But until then Extism is a fantastic bridge.

The only thing that struck me is that the SDK for both the client AND the host could be less "boiler plate" and made simpler, it's my own strong opinion that most developers are super lazy, and the simpler you make something the more developers are likely to bother to use it.

So here is some pseudo code that I feel would attract more lazy developers to potentially use/adopt Extism:

Host Side:

const plugin = Extism.load("app.wasm");
const result = plugin.run("my_function", "{age: 10, name: 'bob'}");
console.log(result);

Client/Plugin Side:

val input = Extism.input()
val myEnv = Extism.env("myEnv")
val name = Extism.get("name")
Extism.set("name", "fred") // setting a variable
Extism.return("hello friend!")

The above is what 90% of developers would want to see, they don't care for the low level details and boiler plate.

Also the library could also expose some of the finer "advanced" APIs so that those that need it can certainly use them as well.

Package Manager for distributing Wasm files

Hi,
This project is inspiring, I usually develop backend applications using javascript and am used to npm I was wondering if there are anything like npm for web assembly files/packages if not

  • What are the possibilities of developing a wasm registry?
  • Is it a good idea?
  • Do you think that it is necessary?
  • What should the MVP contain for a wasm registry?
  • Is it aligned with the purpose/vision of extism?

Apologies if this issue is out of context and place

Python PDK?

Python is also a common language for plugin development.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.