Skip to main content

Crate diaryx_extism

Crate diaryx_extism 

Source
Expand description

Extism-based third-party plugin runtime for Diaryx.

Loads WebAssembly plugin modules via the Extism runtime and adapts them to the diaryx_core [Plugin], [WorkspacePlugin], and [FilePlugin] traits. Guest plugins communicate with the host through a JSON protocol defined in protocol.

§Usage

use diaryx_extism::{HostContext, load_plugins_from_dir};
use std::sync::Arc;

let host_ctx = Arc::new(HostContext { fs: my_async_fs.clone() });
let plugins = load_plugins_from_dir(&plugins_dir, host_ctx)?;
for plugin in plugins {
    let arc = Arc::new(plugin);
    registry.register_workspace_plugin(arc.clone());
    registry.register_file_plugin(arc);
}

Re-exports§

pub use adapter::ExtismPluginAdapter;
pub use host_fns::BatchGetEntry;
pub use host_fns::BatchGetResult;
pub use host_fns::DEFAULT_STORAGE_QUOTA_BYTES;
pub use host_fns::EventEmitter;
pub use host_fns::FilePluginSecretStore;
pub use host_fns::FilePluginStorage;
pub use host_fns::FileProvider;
pub use host_fns::HostContext;
pub use host_fns::MapFileProvider;
pub use host_fns::NamespaceEntry;
pub use host_fns::NamespaceObjectMeta;
pub use host_fns::NamespaceProvider;
pub use host_fns::NoopEventEmitter;
pub use host_fns::NoopFileProvider;
pub use host_fns::NoopNamespaceProvider;
pub use host_fns::NoopPluginCommandBridge;
pub use host_fns::NoopRuntimeContextProvider;
pub use host_fns::NoopSecretStore;
pub use host_fns::NoopStorage;
pub use host_fns::NoopWebSocketBridge;
pub use host_fns::PermissionChecker;
pub use host_fns::PluginCommandBridge;
pub use host_fns::PluginSecretStore;
pub use host_fns::PluginStorage;
pub use host_fns::RuntimeContextProvider;
pub use host_fns::WebSocketBridge;
pub use host_fns::parse_multipart_batch;
pub use loader::ExtismLoadError;
pub use loader::inspect_plugin_wasm_manifest;
pub use loader::load_plugin_from_wasm;
pub use loader::load_plugins_from_dir;
pub use permission_checker::AllowAllPermissionChecker;
pub use permission_checker::DenyAllPermissionChecker;
pub use permission_checker::FrontmatterPermissionChecker;
pub use plugin_fs::PluginFileSystem;

Modules§

adapter
Adapter wrapping an Extism WASM plugin as a diaryx_core plugin.
binary_protocol
Binary action envelope parsing for the host side.
host_fns
Host functions exposed to guest WASM plugins.
loader
Plugin loader — scans a directory for WASM plugins and loads them.
permission_checker
Permission checker implementations for Extism host function gating.
plugin_fs
PluginFileSystem — adapts an Extism storage plugin into an AsyncFileSystem.
protocol
JSON protocol types shared between the host and guest WASM plugins.