chore: rename fai-studio-plugin-sdk → fai-plugin-sdk
Adopts the three SDK families convention documented in fai/platform/docs/architecture/sdks.md: each base SDK (module, plugin, client) gets a language suffix on dir + repo so polyglot variants can be added later without renaming. fai_studio_plugin_sdk → fai_plugin_sdk_rust fai-studio-plugin-sdk → fai-plugin-sdk fai/studio-plugin-sdk → fai/plugin-sdk-rust Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
parent
3753c6bc37
commit
25353adb43
3 changed files with 36 additions and 20 deletions
30
Cargo.toml
30
Cargo.toml
|
|
@ -1,4 +1,4 @@
|
||||||
# fai-studio-plugin-sdk
|
# fai-plugin-sdk
|
||||||
#
|
#
|
||||||
# Ergonomic wrapper around the WIT bindings declared in
|
# Ergonomic wrapper around the WIT bindings declared in
|
||||||
# `wit/studio-plugin.wit`. Studio plugins depend on this crate
|
# `wit/studio-plugin.wit`. Studio plugins depend on this crate
|
||||||
|
|
@ -8,27 +8,33 @@
|
||||||
# provides. The macro lands in v0.2 once the contract is
|
# provides. The macro lands in v0.2 once the contract is
|
||||||
# stable enough.
|
# stable enough.
|
||||||
#
|
#
|
||||||
|
# Naming: this is the Rust SDK for building plugins. Sister
|
||||||
|
# crates per the SDK-family convention in
|
||||||
|
# `docs/architecture/sdks.md`:
|
||||||
|
# - fai-module-sdk (Rust) — flow modules
|
||||||
|
# - fai-plugin-sdk (Rust) — Studio plugins ← this crate
|
||||||
|
# - fai-client-sdk (Dart) — clients talking to the hub
|
||||||
|
# Each gets a language-suffix on the dir / repo
|
||||||
|
# (fai_plugin_sdk_rust / git.flemming.ai/fai/plugin-sdk-rust)
|
||||||
|
# so polyglot variants can be added later without renaming.
|
||||||
|
#
|
||||||
# Build a plugin:
|
# Build a plugin:
|
||||||
#
|
#
|
||||||
# cargo build --release --target wasm32-wasip2
|
# cargo build --release --target wasm32-wasip2
|
||||||
#
|
#
|
||||||
# Use:
|
# Use:
|
||||||
#
|
#
|
||||||
# use fai_studio_plugin_sdk::{export_plugin, theme, ColorScheme,
|
# use fai_plugin_sdk::{export_plugin, bindings};
|
||||||
# PluginError};
|
|
||||||
#
|
#
|
||||||
# struct MyTheme;
|
# struct MyTheme;
|
||||||
# impl theme::Guest for MyTheme {
|
# impl bindings::exports::fai::studio_plugin::theme::Guest for MyTheme {
|
||||||
# fn theme_for(brightness: String)
|
# fn theme_for(brightness: String) -> Result<_, _> { ... }
|
||||||
# -> Result<ColorScheme, PluginError> {
|
|
||||||
# ...
|
|
||||||
# }
|
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
# export_plugin!(MyTheme with_types_in fai_studio_plugin_sdk::bindings);
|
# export_plugin!(MyTheme);
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "fai-studio-plugin-sdk"
|
name = "fai-plugin-sdk"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
# edition 2021 for now — wit-bindgen 0.36 emits the older
|
# edition 2021 for now — wit-bindgen 0.36 emits the older
|
||||||
# `#[link_section]` / `unsafe`-attribute syntax that the
|
# `#[link_section]` / `unsafe`-attribute syntax that the
|
||||||
|
|
@ -39,8 +45,8 @@ edition = "2021"
|
||||||
authors = ["Dr. Stefan Flemming <platform@flemming.ai>"]
|
authors = ["Dr. Stefan Flemming <platform@flemming.ai>"]
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
publish = false
|
publish = false
|
||||||
description = "F∆I Studio Plugin SDK — Rust wrapper for the studio-plugin WIT"
|
description = "F∆I Plugin SDK (Rust) — wrapper for the studio-plugin WIT"
|
||||||
repository = "https://git.flemming.ai/fai/studio-plugin-sdk"
|
repository = "https://git.flemming.ai/fai/plugin-sdk-rust"
|
||||||
rust-version = "1.85"
|
rust-version = "1.85"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
||||||
22
README.md
22
README.md
|
|
@ -1,6 +1,16 @@
|
||||||
# fai-studio-plugin-sdk
|
# fai-plugin-sdk (Rust)
|
||||||
|
|
||||||
Rust SDK for writing F∆I Studio plugins.
|
Rust SDK for writing F∆I plugins (Studio extensions). One of
|
||||||
|
three SDK families documented in
|
||||||
|
`fai/platform/docs/architecture/sdks.md`:
|
||||||
|
|
||||||
|
* `fai-module-sdk` (Rust) — building flow modules
|
||||||
|
* `fai-plugin-sdk` (Rust) — building plugins ← this crate
|
||||||
|
* `fai-client-sdk` (Dart) — building hub-talking clients
|
||||||
|
|
||||||
|
Each gets a language-suffix on its dir/repo so polyglot
|
||||||
|
variants can be added later without renaming the existing
|
||||||
|
ones (e.g. a future `fai-plugin-sdk-go`).
|
||||||
|
|
||||||
## Status
|
## Status
|
||||||
|
|
||||||
|
|
@ -8,14 +18,14 @@ Rust SDK for writing F∆I Studio plugins.
|
||||||
world declared in `wit/studio-plugin.wit` can be compiled to
|
world declared in `wit/studio-plugin.wit` can be compiled to
|
||||||
`wasm32-wasip2` against this crate today. The proof-of-
|
`wasm32-wasip2` against this crate today. The proof-of-
|
||||||
contract plugin is `studio-theme-solarized` in the
|
contract plugin is `studio-theme-solarized` in the
|
||||||
fai-modules namespace.
|
fai-plugins namespace.
|
||||||
|
|
||||||
What's NOT yet implemented:
|
What's NOT yet implemented:
|
||||||
|
|
||||||
- **Hub side**: a Component-Model loader path for
|
- **Hub side**: a Component-Model loader path for
|
||||||
`studio-plugin`-world components + the `InvokePlugin`
|
`studio-plugin`-world components + the `InvokePlugin`
|
||||||
gRPC RPC that Studio talks to. Tracked in
|
gRPC RPC that Studio talks to. Tracked in
|
||||||
`fai/platform/docs/advanced/studio-plugin-sdk.md`.
|
`fai/platform/docs/advanced/plugin-sdk.md`.
|
||||||
- **Studio side**: `plugin_host.dart` that discovers
|
- **Studio side**: `plugin_host.dart` that discovers
|
||||||
installed `studio.*` capabilities and dispatches.
|
installed `studio.*` capabilities and dispatches.
|
||||||
- **Per-hook worlds**: today's v0.1 ships a single world
|
- **Per-hook worlds**: today's v0.1 ships a single world
|
||||||
|
|
@ -43,12 +53,12 @@ edition = "2021" # match SDK edition
|
||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
fai-studio-plugin-sdk = { git = "https://git.flemming.ai/fai/studio-plugin-sdk", branch = "main" }
|
fai-plugin-sdk = { git = "https://git.flemming.ai/fai/plugin-sdk-rust", branch = "main" }
|
||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
// src/lib.rs of your plugin
|
// src/lib.rs of your plugin
|
||||||
use fai_studio_plugin_sdk::{bindings, export_plugin};
|
use fai_plugin_sdk::{bindings, export_plugin};
|
||||||
|
|
||||||
type ColorScheme = bindings::fai::studio_plugin::plugin_types::ColorScheme;
|
type ColorScheme = bindings::fai::studio_plugin::plugin_types::ColorScheme;
|
||||||
type PluginError = bindings::fai::studio_plugin::plugin_types::PluginError;
|
type PluginError = bindings::fai::studio_plugin::plugin_types::PluginError;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
//! `fai-studio-plugin-sdk` — ergonomic wrapper around the
|
//! `fai-plugin-sdk` — ergonomic wrapper around the
|
||||||
//! Studio-plugin WIT contract.
|
//! Studio-plugin WIT contract.
|
||||||
//!
|
//!
|
||||||
//! Studio plugins are WASM components targeting the
|
//! Studio plugins are WASM components targeting the
|
||||||
|
|
@ -75,7 +75,7 @@ pub mod bindings {
|
||||||
/// `Guest` traits.
|
/// `Guest` traits.
|
||||||
///
|
///
|
||||||
/// ```ignore
|
/// ```ignore
|
||||||
/// use fai_studio_plugin_sdk::{export_plugin, bindings};
|
/// use fai_plugin_sdk::{export_plugin, bindings};
|
||||||
///
|
///
|
||||||
/// struct MyTheme;
|
/// struct MyTheme;
|
||||||
/// impl bindings::exports::fai::studio_plugin::theme::Guest for MyTheme {
|
/// impl bindings::exports::fai::studio_plugin::theme::Guest for MyTheme {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue