Skip to main content

Crate weft_package_sdk

Crate weft_package_sdk 

Source
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
ExecAdvancedOptions
ExecResult
PackageResult
Standard package response.
ProcessStdoutRead
SqliteExecResult
SqliteQueryResult
WsRequest
WebSocket message envelope (matches weft-core’s PackageWsMessage.payload).

Traits§

FromBytes
FromBytes is 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
ToBytes is 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_fn is used to define an Extism callable function to export

Derive Macros§

FromBytes
ToBytes