Expand description
WEFT Package SDK — shared types and host function wrappers for WASM packages.
All WASM packages built for WEFT should depend on this crate. It provides ergonomic wrappers around Extism host functions registered by weft-core.
Re-exports§
pub use extism_pdk;pub use serde;pub use serde_json;
Structs§
- DirEntry
- Exec
Advanced Options - Exec
Result - Package
Result - Standard package response.
- Process
Stdout Read - Sqlite
Exec Result - Sqlite
Query Result - WsRequest
- WebSocket message envelope (matches weft-core’s PackageWsMessage.payload).
Traits§
- From
Bytes FromBytesis used to define how a type should be decoded when working with Extism memory. It is used for plugin output and host function input.- ToBytes
ToBytesis used to define how a type should be encoded when working with Extism memory. It is used for plugin input and host function output.
Functions§
- call_
capability_ action - call_
package - Call another package exported function.
- call_
package_ ws_ action - chat_
completion - chat_
completion_ stream - env_get
- exec_
command - Execute a shell command.
- exec_
command_ advanced_ with_ options - host_
call_ ⚠package - host_
call_ ⚠package_ ws - host_
capability_ ⚠call - host_
chat_ ⚠completion - host_
chat_ ⚠completion_ stream - host_
env_ ⚠get - host_
exec ⚠ - host_
exec_ ⚠advanced - host_
http_ ⚠request - host_
kv_ ⚠delete - host_
kv_ ⚠get - host_
kv_ ⚠list - host_
kv_ ⚠set - host_
list_ ⚠dir - host_
log ⚠ - host_
now_ ⚠ms - host_
process_ ⚠read_ stdout - host_
process_ ⚠spawn - host_
process_ ⚠status - host_
process_ ⚠stop - host_
process_ ⚠write_ stdin - host_
read_ ⚠file - host_
sqlite_ ⚠batch - host_
sqlite_ ⚠execute - host_
sqlite_ ⚠query - host_
write_ ⚠file - host_
write_ ⚠file_ base64 - http_
request - Issue an arbitrary HTTP request through the host (supports custom headers, e.g. Authorization for external model APIs). Returns the response body on 2xx.
- kv_
delete - kv_get
- Get a value from the KV store.
- kv_list
- kv_set
- Set a value in the KV store.
- list_
dir - List directory entries. Returns JSON array of {name, is_dir}.
- log
- Log a message at the given level.
- log_
debug - log_
error - log_
info - log_
warn - now_ms
- process_
read_ stdout - process_
spawn - Spawn a managed process.
- process_
status - Get status of a managed process.
- process_
stop - Stop a managed process.
- process_
write_ stdin - read_
file - Read a file. Returns content or error JSON.
- sqlite_
batch - sqlite_
execute - sqlite_
query - write_
file - Write a file.
- write_
file_ base64 - Write binary content (given as base64) to a file. For large media that can’t go through write_file’s String content. Returns the path on success.
Type Aliases§
- FnResult
- The return type of a plugin function
Attribute Macros§
- plugin_
fn plugin_fnis used to define an Extism callable function to export