feat: v0.1.0 — Studio Plugin SDK
First release of the SDK that Studio plugins depend on. What v0.1 ships: - WIT contract under wit/ (studio-plugin.wit + deps/platform/world.wit, both verbatim from fai/platform/wit/). - wit-bindgen 0.36 generate! call with pub_export_macro enabled so the emitted __export_studio_plugin_impl! macro is reachable from downstream plugin crates. - export_plugin!(MyType) convenience macro that wraps the bindgen-generated impl macro. - README documenting usage + v0.1 limits (single-world -> all-three-hooks-required, no proc-macro yet, edition 2021 pinned by wit-bindgen output). What v0.1 doesn't yet do: - Plugins still declare all three Guest impls (theme, translate, output-view). v0.2 splits the WIT into one world per hook. - No #[plugin(...)] proc-macro. v0.2 wraps generate! + Guest impl generation into a single attribute. - Host-side: the hub doesn't yet load studio-plugin-world components or expose InvokePlugin RPC — that's the next push. Validated against the in-tree studio-theme-solarized plugin: 22 KiB stripped .wasm artefact, valid Component Model, passes wasm-tools component wit inspection. Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
commit
3753c6bc37
7 changed files with 562 additions and 0 deletions
57
Cargo.toml
Normal file
57
Cargo.toml
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
# fai-studio-plugin-sdk
|
||||
#
|
||||
# Ergonomic wrapper around the WIT bindings declared in
|
||||
# `wit/studio-plugin.wit`. Studio plugins depend on this crate
|
||||
# rather than dealing with raw wit-bindgen output. v0.1 ships
|
||||
# WITHOUT the `#[plugin(...)]` proc-macro: plugins write the
|
||||
# `export!()` invocation themselves with the structs the SDK
|
||||
# provides. The macro lands in v0.2 once the contract is
|
||||
# stable enough.
|
||||
#
|
||||
# Build a plugin:
|
||||
#
|
||||
# cargo build --release --target wasm32-wasip2
|
||||
#
|
||||
# Use:
|
||||
#
|
||||
# use fai_studio_plugin_sdk::{export_plugin, theme, ColorScheme,
|
||||
# PluginError};
|
||||
#
|
||||
# struct MyTheme;
|
||||
# impl theme::Guest for MyTheme {
|
||||
# fn theme_for(brightness: String)
|
||||
# -> Result<ColorScheme, PluginError> {
|
||||
# ...
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# export_plugin!(MyTheme with_types_in fai_studio_plugin_sdk::bindings);
|
||||
|
||||
[package]
|
||||
name = "fai-studio-plugin-sdk"
|
||||
version = "0.1.0"
|
||||
# edition 2021 for now — wit-bindgen 0.36 emits the older
|
||||
# `#[link_section]` / `unsafe`-attribute syntax that the
|
||||
# edition-2024 compiler rejects. Bump to 2024 when moving
|
||||
# to a wit-bindgen version with edition-2024-compatible
|
||||
# codegen.
|
||||
edition = "2021"
|
||||
authors = ["Dr. Stefan Flemming <platform@flemming.ai>"]
|
||||
license = "Apache-2.0"
|
||||
publish = false
|
||||
description = "F∆I Studio Plugin SDK — Rust wrapper for the studio-plugin WIT"
|
||||
repository = "https://git.flemming.ai/fai/studio-plugin-sdk"
|
||||
rust-version = "1.85"
|
||||
|
||||
[lib]
|
||||
crate-type = ["rlib"]
|
||||
|
||||
[dependencies]
|
||||
wit-bindgen = "0.36"
|
||||
|
||||
[package.metadata.component]
|
||||
package = "fai:studio-plugin-sdk"
|
||||
|
||||
[package.metadata.component.target]
|
||||
path = "wit"
|
||||
world = "studio-plugin"
|
||||
Loading…
Add table
Add a link
Reference in a new issue