ticket: add plugin authoring roadmap

This commit is contained in:
2026-06-20 13:43:16 +09:00
parent c8877b49a4
commit 8b42e319e2
10 changed files with 537 additions and 3 deletions
@@ -0,0 +1,37 @@
{
"version": 1,
"relations": [
{
"ticket_id": "00001KVHKWNQA",
"kind": "depends_on",
"target": "00001KVG0HR96",
"note": "PDK targets the Component Model Tool runtime.",
"author": "yoi ticket",
"at": "2026-06-20T04:17:24Z"
},
{
"ticket_id": "00001KVHKWNQA",
"kind": "related",
"target": "00001KVFD3YSV",
"note": "PDK authoring flow should pair with read-only plugin inspection.",
"author": "yoi ticket",
"at": "2026-06-20T04:17:24Z"
},
{
"ticket_id": "00001KVHKWNQA",
"kind": "related",
"target": "00001KVFDX9AF",
"note": "PDK should later wrap https host API ergonomically.",
"author": "yoi ticket",
"at": "2026-06-20T04:17:24Z"
},
{
"ticket_id": "00001KVHKWNQA",
"kind": "related",
"target": "00001KVFDX9AY",
"note": "PDK should later wrap fs host API ergonomically.",
"author": "yoi ticket",
"at": "2026-06-20T04:17:24Z"
}
]
}
+88
View File
@@ -0,0 +1,88 @@
---
title: 'Plugin: add Rust PDK and embedded authoring templates for Component Model Tools'
state: 'ready'
created_at: '2026-06-20T04:16:14Z'
updated_at: '2026-06-20T04:17:24Z'
assignee: null
readiness: 'implementation_ready'
risk_flags: ['plugin', 'pdk', 'component-model', 'authoring', 'templates', 'sdk', 'no-crates-io']
---
## Background
Yoi can now discover Plugin packages, register Tool surfaces, execute sandboxed WASM/Component Model Tool Plugins, enforce Plugin grants, expose `https` / `fs` host APIs, and inspect Plugin state through CLI. The next gap is authoring: independent Plugin developers should not need to write raw WIT/ABI glue or copy ad-hoc examples by hand.
This Ticket adds a first-party Rust PDK for Component Model Tool Plugins and embeds a starter template into Yoi resources. It deliberately does not publish to crates.io yet and does not fetch remote templates. The PDK/API and WIT world are still young, so out-of-tree authors should initially use a git rev or generated local path dependency rather than depending on a public semver crate.
## Requirements
- Add a Rust PDK crate inside the Yoi workspace.
- Suggested package name: `yoi-plugin-pdk`.
- Suggested path: `crates/plugin-pdk`.
- Target Component Model Tool Plugins, not raw core-Wasm as the primary authoring path.
- PDK must be guest-side only.
- Do not depend on host runtime crates such as `pod`, `llm-worker`, `tui`, or `client`.
- Keep dependencies minimal, e.g. `serde`, `serde_json`, and WIT binding support.
- Do not expose ambient fs/network/env authority.
- Provide ergonomic Tool helpers.
- Typed JSON input parsing.
- Typed JSON output serialization.
- Structured `ToolError` / error-code helpers.
- `ToolContext` containing at least the tool name.
- Helper equivalent to `run_json_tool` that returns the ToolOutput JSON expected by the Yoi runtime.
- Provide Component Model binding glue.
- Re-export or wrap generated WIT bindings enough that an author does not need to hand-write raw pointer/length ABI code.
- Prefer a minimal `Guest` impl helper first; add a macro only if it is simpler and testable.
- Include embedded authoring templates under runtime resources.
- Suggested path: `resources/plugin/templates/rust-component-tool/`.
- Template includes `Cargo.toml`, `src/lib.rs`, `plugin.toml`, and a short README.
- Template should be usable by a future `yoi plugin new` command without network access.
- Template dependency policy:
- In checkout/dev mode, template may use a local path dependency to `crates/plugin-pdk`.
- For out-of-tree authors, docs/template comments should show a git `rev` dependency pattern.
- Do not publish or require crates.io for this Ticket.
- Do not use `curl | sh` or remote template fetch.
- Include at least one example or fixture Plugin using the PDK.
- Echo-style Component Model Tool is enough.
- It should compile to a component artifact through the documented toolchain or, if full component build automation is not yet available, be covered by a clear fixture/test boundary.
- Update Plugin development docs.
- Explain that Component Model + PDK is the preferred authoring path.
- Explain that raw core-Wasm ABI is compatibility/transitional.
- Explain why crates.io publication and remote templates are intentionally deferred.
## Acceptance criteria
- Workspace contains a guest-side `yoi-plugin-pdk` crate.
- A Rust Component Model Tool Plugin can use the PDK to implement a JSON Tool without raw pointer/length ABI code.
- PDK-produced Tool success output is accepted by the existing Yoi Plugin Tool runtime.
- PDK-produced Tool errors are bounded and represented as ordinary Tool result/error content.
- PDK does not grant or imply authority; host-side Plugin grants still decide `https` / `fs` / Tool execution access.
- Embedded `rust-component-tool` template exists in runtime resources and is suitable for future `yoi plugin new` expansion.
- No crates.io publication is required or performed.
- No remote template fetch is implemented.
- Tests cover:
- PDK JSON input/output happy path;
- PDK error output path;
- PDK sample/template compiles or fixture is validated;
- sample Plugin can be executed by Yoi component runtime if feasible in current test infrastructure;
- PDK has no host-runtime crate dependency.
- Validation: focused PDK/plugin tests, `cargo fmt --check`, relevant `cargo check` / `cargo test`, `git diff --check`, and `nix build .#yoi` because workspace/package/resources may change.
## Non-goals
- Publishing `yoi-plugin-pdk` to crates.io.
- Remote template fetch or `curl | sh` setup.
- `yoi plugin new/check/pack` CLI implementation.
- Multi-language PDKs.
- Service / Ingress authoring.
- WebSocket / inbound HTTP bridge support.
- Replacing Plugin grants with PDK-side checks.
## Related work
- `00001KVG0HR9M` — Objective: Plugin platform roadmap.
- `00001KVG0HR96` — Plugin Component Model runtime.
- `00001KVFD3YSV` — Plugin read-only CLI inspection.
- `00001KVFDX9AF` — Plugin https host API.
- `00001KVFDX9AY` — Plugin fs host API.
- `docs/development/plugin-development.md` — current Plugin development guide.
+7
View File
@@ -0,0 +1,7 @@
<!-- event: create author: "yoi ticket" at: 2026-06-20T04:16:14Z -->
## 作成
LocalTicketBackend によって作成されました。
---
@@ -0,0 +1,29 @@
{
"version": 1,
"relations": [
{
"ticket_id": "00001KVHKWNQS",
"kind": "depends_on",
"target": "00001KVHKWNQA",
"note": "Authoring new/check/pack uses the Rust PDK and embedded templates.",
"author": "yoi ticket",
"at": "2026-06-20T04:17:24Z"
},
{
"ticket_id": "00001KVHKWNQS",
"kind": "related",
"target": "00001KVFD3YSV",
"note": "Authoring check/pack diagnostics should align with plugin list/show inspection.",
"author": "yoi ticket",
"at": "2026-06-20T04:17:24Z"
},
{
"ticket_id": "00001KVHKWNQS",
"kind": "related",
"target": "00001KVG0HR96",
"note": "Authoring CLI validates Component Model Tool package metadata.",
"author": "yoi ticket",
"at": "2026-06-20T04:17:24Z"
}
]
}
+91
View File
@@ -0,0 +1,91 @@
---
title: 'Plugin: add authoring CLI new/check/pack'
state: 'ready'
created_at: '2026-06-20T04:16:14Z'
updated_at: '2026-06-20T04:17:24Z'
assignee: null
readiness: 'implementation_ready'
risk_flags: ['plugin', 'cli', 'authoring', 'templates', 'package-validation', 'packaging', 'read-only-check']
---
## Background
After the Rust PDK and embedded templates exist, independent Plugin developers need first-party CLI tooling to scaffold, validate, and package Plugins without relying on remote shell scripts or hand-written ZIP commands.
This Ticket adds authoring commands for local Plugin development. It complements read-only operational inspection (`yoi plugin list/show`) but serves a different audience: Plugin authors preparing a package before enabling it in Yoi.
## Requirements
- Add Plugin authoring subcommands to the product CLI.
- `yoi plugin new rust-component-tool <path-or-name>`
- `yoi plugin check <path-or-package>`
- `yoi plugin pack <path> [--output <file>]`
- `new` uses embedded templates only.
- No remote template fetch.
- No `curl | sh` flow.
- Generated files should include `Cargo.toml`, `src/lib.rs`, `plugin.toml`, and README/next-steps.
- Generated dependency should be appropriate for the current checkout/release mode: local path in checkout mode, or documented git rev/tag pattern if out-of-tree.
- `check` validates a Plugin directory or `.yoi-plugin` package without executing Plugin code.
- Parse `plugin.toml`.
- Validate package id/version/source-compatible shape.
- Validate runtime kind and referenced artifact presence.
- Validate Component Model world metadata where possible.
- Validate Tool schema shape.
- Validate requested permissions / host API declarations.
- Validate archive safety for packages: path traversal, root escape, unsupported compression, bounded file count/size.
- Calculate and print deterministic digest.
- Produce actionable diagnostics and a suggested enablement/grant snippet.
- `pack` creates a deterministic `.yoi-plugin` package.
- Include required manifest/runtime files.
- Use currently supported archive format, including stored entries if compression is not supported.
- Reject unsafe paths / root escapes.
- Print output path and digest.
- Do not modify workspace enablement config.
- Provide JSON output for automation where useful.
- At minimum `check --json` and `pack --json`.
- Keep commands safe.
- `check` and `pack` do not execute Plugin code.
- `new` only writes into the requested destination and refuses to overwrite non-empty directories unless an explicit safe option is added.
- No secrets are generated or embedded.
- Integrate with existing inspection language.
- Diagnostics/statuses should align with `yoi plugin list/show` where possible.
## Acceptance criteria
- `yoi plugin new rust-component-tool ./my-plugin` creates a usable template without network access.
- `yoi plugin check ./my-plugin` validates the generated template and reports next steps/digest/enablement guidance.
- `yoi plugin pack ./my-plugin` creates a `.yoi-plugin` package that Yoi discovery can read.
- `check` can validate an existing `.yoi-plugin` archive.
- `check --json` returns a stable typed report suitable for tests/agents.
- `pack --json` returns output path and digest.
- Unsafe package paths / traversal / unsupported compression / missing manifest / missing runtime artifact are rejected with clear diagnostics.
- Commands do not execute Plugin code or mutate enablement config.
- Tests cover:
- `new` generated file set;
- refusal to overwrite non-empty destination;
- `check` valid directory;
- `check` invalid manifest;
- `check` missing runtime artifact;
- `check` unsafe package archive;
- `pack` deterministic digest;
- `pack` package is discoverable by existing Plugin discovery;
- JSON report shape.
- Validation: focused CLI/plugin authoring tests, relevant `cargo check` / `cargo test`, `cargo fmt --check`, `git diff --check`, and `nix build .#yoi` because product CLI/resources/packaging behavior changes.
## Non-goals
- Remote template fetching.
- Publishing or installing from a registry.
- Enabling/disabling Plugins in workspace config.
- Executing Plugin code during `check`.
- crates.io publication of PDK.
- Service / Ingress scaffolding.
- Multi-language templates beyond Rust Component Model Tool.
## Related work
- `00001KVG0HR9M` — Objective: Plugin platform roadmap.
- `00001KVHKWNQA` — Rust PDK and embedded authoring templates.
- `00001KVFD3YSV` — Plugin read-only CLI inspection list/show.
- `00001KVG0HR96` — Plugin Component Model runtime.
- `docs/development/plugin-development.md` — current Plugin development guide.
+7
View File
@@ -0,0 +1,7 @@
<!-- event: create author: "yoi ticket" at: 2026-06-20T04:16:14Z -->
## 作成
LocalTicketBackend によって作成されました。
---