Files
figcraft/crates/plugin/src/lib.rs
T
DubblbindongandClaude Sonnet 5.5 ed74fc67d0 feat(plugin): add saveFile permission with host-owned save dialog
Plugins can hand the host a file name, MIME type and bytes through the new
`save_file` import (plugin API 4, `permissions.saveFile`). The host asks the
user where to save (browser download on the web), so the plugin never sees a
path. Includes the SDK wrapper and the `export-names` example plugin.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Assisted-by: Claude (Anthropic)
2026-10-16 20:12:54 +02:00

26 lines
980 B
Rust

//! FigCraft plugins: the manifest (`figcraft-plugin.json`) and the WebAssembly sandbox a plugin
//! runs in, and the widget descriptions a plugin hands back. The engine decides what a plugin may
//! do (its permissions, which commands it may call, one undo step per run, panel or widget
//! callback, where settings are kept); this crate only runs modules safely: a metered interpreter
//! with a memory cap, no WASI and a handful of host functions. See `docs/plugins.md`.
pub mod bundle;
pub mod manifest;
mod sandbox;
pub mod widget;
pub use manifest::{API_VERSION, Access, MANIFEST_FILE, Manifest, Panel, Param, ParamKind, Permissions, PluginCommand};
pub use sandbox::{ENTRY, Host, IMPORT_MODULE, Instance, Limits, PluginError, RunOutput, UiChange, check_module, run};
pub use widget::{WidgetKind, WidgetNode, WidgetRender};
#[cfg(test)]
mod bundle_tests;
#[cfg(test)]
mod save_file_tests;
#[cfg(test)]
mod tests;
#[cfg(test)]
mod v2_tests;
#[cfg(test)]
mod widget_tests;