refactor: rename WIT contract fai:platform/fai:studio-plugin->chain:*

Tracks the platform WIT ABI rename. Plugin world package becomes
chain:studio-plugin and host imports chain:platform/host. Crate name
stays fai-plugin-sdk (vendor namespace) for now.

Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
flemming-it 2026-06-15 22:18:53 +02:00
parent 25353adb43
commit 0b60b71360
5 changed files with 23 additions and 23 deletions

View file

@ -27,7 +27,7 @@
# use fai_plugin_sdk::{export_plugin, bindings};
#
# struct MyTheme;
# impl bindings::exports::fai::studio_plugin::theme::Guest for MyTheme {
# impl bindings::exports::chain::studio_plugin::theme::Guest for MyTheme {
# fn theme_for(brightness: String) -> Result<_, _> { ... }
# }
#
@ -56,7 +56,7 @@ crate-type = ["rlib"]
wit-bindgen = "0.36"
[package.metadata.component]
package = "fai:studio-plugin-sdk"
package = "chain:studio-plugin-sdk"
[package.metadata.component.target]
path = "wit"

View file

@ -60,13 +60,13 @@ fai-plugin-sdk = { git = "https://git.flemming.ai/fai/plugin-sdk-rust", branch =
// src/lib.rs of your plugin
use fai_plugin_sdk::{bindings, export_plugin};
type ColorScheme = bindings::fai::studio_plugin::plugin_types::ColorScheme;
type PluginError = bindings::fai::studio_plugin::plugin_types::PluginError;
type RenderedOutput = bindings::fai::studio_plugin::plugin_types::RenderedOutput;
type ColorScheme = bindings::chain::studio_plugin::plugin_types::ColorScheme;
type PluginError = bindings::chain::studio_plugin::plugin_types::PluginError;
type RenderedOutput = bindings::chain::studio_plugin::plugin_types::RenderedOutput;
struct MyPlugin;
impl bindings::exports::fai::studio_plugin::theme::Guest for MyPlugin {
impl bindings::exports::chain::studio_plugin::theme::Guest for MyPlugin {
fn theme_for(brightness: String) -> Result<ColorScheme, PluginError> {
// Return a ColorScheme or PluginError::Declined.
}
@ -74,12 +74,12 @@ impl bindings::exports::fai::studio_plugin::theme::Guest for MyPlugin {
// v0.1: every plugin must declare all three hooks. Plugins
// that don't actually serve a hook return Declined.
impl bindings::exports::fai::studio_plugin::translate::Guest for MyPlugin {
impl bindings::exports::chain::studio_plugin::translate::Guest for MyPlugin {
fn translate(_: String, _: String, _: String) -> Result<String, PluginError> {
Err(PluginError::Declined("not a translate plugin".to_string()))
}
}
impl bindings::exports::fai::studio_plugin::output_view::Guest for MyPlugin {
impl bindings::exports::chain::studio_plugin::output_view::Guest for MyPlugin {
fn render(_: String, _: Vec<u8>) -> Result<RenderedOutput, PluginError> {
Err(PluginError::Declined("not a view plugin".to_string()))
}
@ -99,10 +99,10 @@ fai pack . -o my-plugin-0.1.0.fai
```
wit/
├── studio-plugin.wit # main world, fai:studio-plugin@0.1.0
├── studio-plugin.wit # main world, chain:studio-plugin@0.1.0
└── deps/
└── platform/
└── world.wit # fai:platform@1.0.0 (host imports)
└── world.wit # chain:platform@1.0.0 (host imports)
```
Both files are verbatim copies of the authoritative versions

View file

@ -43,7 +43,7 @@ pub mod bindings {
world: "studio-plugin",
path: "wit",
// Generate bindings for the entire WIT package
// (incl. fai:platform/host that studio-plugin imports
// (incl. chain:platform/host that studio-plugin imports
// for log emission), so plugins don't need a separate
// `with: …` mapping.
generate_all,
@ -59,12 +59,12 @@ pub mod bindings {
// v0.1: plugin authors reference paths inside `bindings::`
// directly. The typical ones are:
//
// bindings::exports::fai::studio_plugin::theme::Guest
// bindings::exports::fai::studio_plugin::translate::Guest
// bindings::exports::fai::studio_plugin::output_view::Guest
// bindings::fai::studio_plugin::plugin_types::ColorScheme
// bindings::fai::studio_plugin::plugin_types::PluginError
// bindings::fai::studio_plugin::plugin_types::RenderedOutput
// bindings::exports::chain::studio_plugin::theme::Guest
// bindings::exports::chain::studio_plugin::translate::Guest
// bindings::exports::chain::studio_plugin::output_view::Guest
// bindings::chain::studio_plugin::plugin_types::ColorScheme
// bindings::chain::studio_plugin::plugin_types::PluginError
// bindings::chain::studio_plugin::plugin_types::RenderedOutput
//
// Stable re-exports under terser names land in v0.2 — they
// have to wait for the proc-macro that materialises the
@ -78,10 +78,10 @@ pub mod bindings {
/// use fai_plugin_sdk::{export_plugin, bindings};
///
/// struct MyTheme;
/// impl bindings::exports::fai::studio_plugin::theme::Guest for MyTheme {
/// impl bindings::exports::chain::studio_plugin::theme::Guest for MyTheme {
/// fn theme_for(b: String)
/// -> Result<bindings::fai::studio_plugin::plugin_types::ColorScheme,
/// bindings::fai::studio_plugin::plugin_types::PluginError>
/// -> Result<bindings::chain::studio_plugin::plugin_types::ColorScheme,
/// bindings::chain::studio_plugin::plugin_types::PluginError>
/// {
/// // ...
/// }

View file

@ -24,7 +24,7 @@
// stable, ergonomic surface. That is what protects modules
// from any future evolution of this contract.
package fai:platform@1.0.0;
package chain:platform@1.0.0;
/// Types that flow between the host (hub) and modules.
interface types {

View file

@ -27,7 +27,7 @@
// hook function per declared `studio_extension.hook` in
// module.yaml, and renders / wires the result.
package fai:studio-plugin@0.1.0;
package chain:studio-plugin@0.1.0;
// =============================================================
// Shared types
@ -177,7 +177,7 @@ world studio-plugin {
/// Plugins import the same `host` interface as flow modules,
/// so they can emit structured logs without a separate
/// bridge. Logs flow into the hub's event log.
import fai:platform/host@1.0.0;
import chain:platform/host@1.0.0;
/// Hook exports. Each is optional; the hub introspects the
/// component to learn which the plugin supports.