Commit Graph

178 Commits

Author SHA1 Message Date
zach
1897276ee8 cleanup(runtime): get rid of more unwraps/panics 2022-09-24 11:17:14 -07:00
zach
a23e4a8b88 cleanup(runtime): improve pdk memory access 2022-09-24 10:46:05 -07:00
zach
631eb14cca fix: more helpful error message for manifests 2022-09-24 10:43:50 -07:00
zach
460b477b87 fix: don't panic on invalid plugin id 2022-09-24 10:43:50 -07:00
zach
15cd047569 fix: invalid length in config_get, vars_get 2022-09-23 16:15:05 -07:00
zach
958e56ba6d fix: compilation error when building without http_request support 2022-09-22 15:44:06 -07:00
zach
a4921e2d73 cleanup(runtime): better handling of reclaimed IDs 2022-09-21 10:57:18 -07:00
zach
15b7d0fa1f chore: update wasmtime to 1.0 2022-09-20 14:05:02 -07:00
zach
87be73570d Add ExtismContext to SDK + better errors for failed register/update (#19)
- Adds `ExtismContext` instead of global `PLUGINS` registry
- Adds `extism_context_new`, `extism_context_free` and
`extism_context_reset`
- Requires updating nearly every SDK function to add context parameter
- Renames some SDK functions to follow better naming conventions
   - `extism_plugin_register` -> `extism_plugin_new`
   - `extism_output_get` -> `extism_plugin_output_data`
   - `extism_output_length` -> `extism_plugin_output_length`
   - `extism_call` -> `extism_plugin_call`
- Updates `extism_error` to return the context error when -1 issued for
the plug-in ID
- Adds `extism_plugin_free` to remove an existing plugin
- Updates SDKs to include these functions
- Updates SDK examples and comments

Co-authored-by: Steve Manuel <steve@dylib.so>
2022-09-20 14:53:15 -06:00
zach
f473be9044 meta: add scripts directory with SDK coverage script (#16)
Adds a script to check which runtime API functions are not used in each host SDK. Provides a coverage report with percent of functions called in each SDK. 

Co-authored-by: Steve Manuel <steve@dylib.so>
2022-09-14 11:12:05 -06:00
Steve Manuel
f9e9ff28d9 chore: bump versions for release, minimize c sdk imports (#15)
Co-authored-by: zach <zachshipko@gmail.com>
2022-09-13 13:27:58 -06:00
zach
4a49408045 fix: handle large allocations (missing commits) (#14) 2022-09-13 00:17:05 -06:00
zach
ddde19b6f4 fix: handle large allocations (#13)
This PR fixes an issue where large allocations are currently causing
some arithmetic to wrap which caused a panic.

This was discovered by calling `http_get` on `youtube.com` from the http
example in the Rust PDK
2022-09-12 20:26:31 -06:00
Steve Manuel
e7b3688c11 ci: add host sdk releases (#12)
Adds automated releases for crates.io, pypi, and npm for Rust, Python,
and Node host SDKs respectively.
2022-09-12 13:32:06 -06:00
zach
8bc608d1e9 feat: access input/output buffers directly (#11)
This PR updates `extism_output_get` to return an actual pointer to the
output value (`const uint8_t* extism_output_get(PluginIndex plugin)`
instead of `void extism_output_get(PluginIndex plugin, uint8_t *buffer,
uint64_t length)`), this pointer will only be valid until the next call,
but it makes it possible to access the output data without copying.

The input buffer is also not copied and the same issue applies: 
the input buffer must not change during `call`.

Co-authored-by: Steve Manuel <steve@dylib.so>
2022-09-12 09:34:50 -06:00
zach
4d3d966498 Handle missing config keys without raising an error (#9)
- Makes it so `extism_length(0)` returns 0, as far as I can tell this
seems safe
- Returns 0 when a key can't be found
2022-09-09 16:56:18 -06:00
zach
981728057f refactor: remove unused code 2022-09-09 08:18:05 -07:00
zach
88058ca31e fix: let linker tell us which functions are missing 2022-09-09 07:58:13 -07:00
zach
7b27d4f883 feat: add extism_plugin_update (#6)
This gives host the ability to re-use plugin descriptors instead of
loading a new plugin each time. The plugin memory and everything is
reset, so no state is shared with the newly loaded plugin.

Co-authored-by: Steve Manuel <steve@dylib.so>
2022-09-09 00:39:57 -06:00
zach
05e9084277 fix: var_set 2022-09-06 20:35:47 -07:00
zach
2b075ee5e4 chore: add more logging 2022-08-31 17:00:42 -07:00
zach
83edfe4214 refactor: improve logging, only show logs from extism-runtime 2022-08-31 16:35:09 -07:00
zach
fd96dfede4 chore: update Wasmtime, add missing dependencies 2022-08-30 15:39:38 -07:00
zach
537c21dbd2 fix: Remove start and end quotes from error strings 2022-08-29 16:42:43 -07:00
zach
afe66b0b1c fix: typos 2022-08-26 06:36:52 -07:00
zach
64856207d0 refactor: port over missing changes 2022-08-25 20:26:36 -07:00
zach
f233f36728 refactor: stop exporting memory 2022-08-25 19:13:10 -07:00
Steve Manuel
e27fae9193 v0.0.1 alpha
Co-authored-by: Zach Shipko <zach@dylib.so>
2022-08-25 14:36:47 -06:00