Plugin SDKs & Open Protocol v2

Tomoyo Launcher executes extensions strictly on demand and reaps idle processes so plugins consume 0 MB resident memory when inactive.

1. CLI Workflow (tomoyo-cli)

tomoyo-cli new my-plugin --lang rust     # or wasm | python | webview
tomoyo-cli dev ./my-plugin --query "hi" --once
tomoyo-cli verify ./my-plugin
tomoyo-cli hash ./my-plugin
tomoyo-cli import-utools ./utools-plugin-dir

2. Rust STDIO Plugin (tomoyo-sdk)

use tomoyo_sdk::{PluginMeta, QueryContext, ResultItem, TomoyoPlugin};

struct MyPlugin;

impl TomoyoPlugin for MyPlugin {
    fn meta(&self) -> PluginMeta { PluginMeta::new("My Plugin", "0.1.0") }
    fn query(&self, _ctx: &QueryContext) -> Vec<ResultItem> { vec![] }
}

fn main() { tomoyo_sdk::run(MyPlugin); }

3. Sandboxed WASM Plugin (tomoyo-wasm-sdk)

Compiled to wasm32-unknown-unknown and executed in wasmi with fuel caps, bounded linear memory, and zero ambient host access.

use tomoyo_wasm_sdk::{export_tomoyo_wasm_plugin, QueryContext, ResultItem, TomoyoWasmPlugin};

struct WasmToolkit;
impl TomoyoWasmPlugin for WasmToolkit {
    fn query(_ctx: &QueryContext) -> Vec<ResultItem> { vec![] }
}
export_tomoyo_wasm_plugin!(WasmToolkit);

4. WebView & uTools Compatibility

WebView plugins run inside short-lived tomoyo-webview-host (WebKitGTK 4.1 on Linux, WebView2 on Windows) with window.tomoyo and a baseline window.utools compatibility bridge. Closing the window terminates the WebView process completely.