2.0 KiB
Rust Component Tool Template
This is the embedded starter template for a Yoi Component Model Tool Plugin written with the first-party Rust PDK.
What this template demonstrates
wasm-componentruntime targetingyoi:plugin/tool@1.0.0.- Guest-side WIT binding generation through the PDK's
wit_bindgenre-export. - Typed JSON input parsing through
run_json_toolviaexport_component_tool!. - Typed JSON output serialization with
ToolOutput::json. - Structured, bounded
ToolErroroutput for user-visible Tool failures.
The PDK is guest-side only. It does not grant filesystem, network, or environment authority. Host-side Plugin manifests and grants remain the authority boundary for Tool execution and host APIs.
Checkout/development dependency
Inside the Yoi checkout this template uses a local path dependency and declares an empty [workspace] so it can be checked in place without becoming a member of Yoi's root workspace:
yoi-plugin-pdk = { path = "../../../../crates/plugin-pdk" }
If this template is copied elsewhere before crates.io publication exists, pin a Yoi source revision instead of fetching an unpinned remote template:
yoi-plugin-pdk = { git = "https://github.com/example/yoi.git", package = "yoi-plugin-pdk", rev = "<pinned-yoi-revision>" }
Crates.io publication, remote template fetching, and yoi plugin new/check/pack are intentionally deferred to later authoring-tooling work.
Next steps
- Replace package/plugin ids, names, descriptions, and Tool schema.
- Replace
EchoInput/EchoOutputandhandle_echowith your Tool logic. - Build a component for
wasm32-unknown-unknownwith the Component Model tooling used by your environment. - Package
plugin.tomlandplugin.component.wasminto a.yoi-pluginarchive. - Use
yoi plugin list/yoi plugin showplus focused runtime tests to inspect and validate the package.
The exact component build/pack command is not part of this template yet because deterministic yoi plugin new/check/pack authoring commands are a separate planned Ticket.