From e9b398703c0e3f0cb45c13b9e3c80a11fde27e38 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Wed, 2 Dec 2026 12:28:29 -0800 Subject: [PATCH 1/2] Add `plan/2026-12-02-2-unified-tool-info.plan.md` Add `plan/2026-12-02-2-unified-tool-info.plan.md` to record the update to `runvil-plugin-sdk` version `0.9.0` and `ToolInfo`. Plan: /plan/2026-12-02-2-unified-tool-info.plan.md --- plan/2026-12-02-2-unified-tool-info.plan.md | 153 ++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 plan/2026-12-02-2-unified-tool-info.plan.md diff --git a/plan/2026-12-02-2-unified-tool-info.plan.md b/plan/2026-12-02-2-unified-tool-info.plan.md new file mode 100644 index 0000000..5b5c855 --- /dev/null +++ b/plan/2026-12-02-2-unified-tool-info.plan.md @@ -0,0 +1,153 @@ +--- +name: Unified ToolInfo +overview: Consolidate all tool, MCP function, and prompt callable metadata into a single plain pub struct ToolInfo in gateway-types (using explicit Arc at shared catalog/binding/chat sites), sync its source verbatim into runvil-plugin-sdk over a JSON RvToolInfo C ABI (v0.9.0), and roll it out in small testable commits across Waves 1-4 (pushing to origin, opening PRs, waiting on CI, and merging to upstream at each wave). +todos: + - id: wave1-gateway-client + content: "Wave 1a (gateway-client): 3 testable commits (plan copy, add gateway_types::ToolInfo, replace ToolSchema with concrete Arc); verify all CI gates, push to origin, open PR to upstream, wait for green CI/reviews, and merge to upstream (SHA G)" + status: completed + - id: wave1-plugin-api + content: "Wave 1b (runvil-plugin-api, parallel with 1a once tool.rs is written): 3 testable commits (plan copy, sync tool_info.rs + xtask check + serde deps, bump contract to 0.9.0 with 24-byte JSON RvToolInfo); verify 1.85 MSRV + c-layout, push to origin, open PR, merge to upstream (SHA P)" + status: completed + - id: wave2-three-plugins + content: "Wave 2a (runvil-plugin-std, bashkit, web in parallel): 2 testable commits per repo (plan copy, pin SDK 0.9.0 at SHA P + Value/with_* updates); verify, push to origin, open PRs, and merge to upstream (SHAs S, B, W)" + status: in_progress + - id: wave2-harness + content: "Wave 2b (runvil-harness, parallel with 2a): 4 testable commits (plan copy, pin G + adopt ToolInfo across engine/harness/mcp on 0.8 loader, embed Arc in Frontmatter & drop Annotations, pin contract 0.9.0 at P + JSON RvToolInfo in loader/test-plugin + decisions); verify, push to origin, open PR, merge to upstream (SHA H)" + status: pending + - id: wave3-workshop-and-runvil + content: "Wave 3 (runvil-workshop, then runvil): 3 testable commits in workshop (plan copy, pin H/P/S/B/W + WorkshopBroker::chat, flatten prompt.tool_info() into /prompts/contract + UI tests), PR & merge to upstream (SHA K); then pin Workshop SHA K in runvil, PR & merge to upstream" + status: pending +isProject: false +--- + +# Unify Tool, Prompt, and MCP Metadata into `gateway_types::ToolInfo` + +## Goal and Design Summary + +Replace the separate tool, prompt-annotation, MCP-listing, and wire-schema structs across the fleet with one plain `pub struct ToolInfo` defined in `gateway-types` and copied verbatim into `runvil-plugin-sdk`: + +- **Plain struct + explicit `Arc` for \(O(1)\) sharing (zero `serde/rc` needed)**: `ToolInfo` is a plain Rust struct with `pub` fields matching `ModelInfo`, `Message`, and `Error` in `gateway-types`. Single-owner boundaries (`Pack::tools() -> Vec`, `Pack::render(...) -> Result>`, `PackToolSets` in `EffectAnswer::Render`) move `ToolInfo` by value in \(O(1)\) so `Pack::render` mutates fields naturally and `EffectAnswer::Render` serializes without enabling `serde/rc`. Shared multi-owner lifetimes (`ToolCatalog`, `OfferedTool`, `ToolBinding`, `LuaToolHandle`, `Prompt`, `Effect::Chat`, `InferenceBroker::chat`) hold `Arc` explicitly so schemas and descriptions are never deep-copied across runs, Lua VMs, or model rounds. +- **100% self-describing flat struct (zero helper structs)**: `ToolInfo` holds `name`, `pack` (losslessly splitting 2+ segment `ToolId`s at the first `/`, e.g. `pack = Some("fixtures")`, `name = "tools/inspect"`), `wire_name` (plus `effective_wire_name` and `qualified_name` helpers), `title`, `description`, `input_schema`, optional `output_schema`, the 4 closed MCP hints (`read_only_hint`, `destructive_hint`, `idempotent_hint`, `open_world_hint`), and the 5 Engine execution flags (`structured_output`, `survives_stop`, `describes_tools`, `model_only_call`, `changes_files`). +- **Third-party safe & Engine-stage validated**: `ToolInfo::new` is infallible (preserving Engine tests that place unvalidated schemas into `ToolCatalog` and reject them at `scope` freeze), `output_schema: Option` is descriptive and optional, and `structured_output: bool` remains the explicit opt-in switch for Lua `tools.call` JSON decoding. +- **Standalone plugin repo**: `tool.rs` uses only `std`, `serde`, and `serde_json` (Rust 1.85 syntax, functions `<= 100` lines and `<= 7` args, no `#[non_exhaustive]`) and is copied into `runvil-plugin-sdk` and committed to Git, passing JSON text across `RvToolInfo` in C ABI v0.9.0. + +## Git, Commit, PR, and Upstream Merge Protocol + +Every downstream `Cargo.toml` pins `https://github.com/cppalliance/` (`upstream`) by exact commit SHA, while local `master` pushes to `git@github.com:vinniefalco/.git` (`origin`). Therefore each wave completes its `origin` push -> PR -> green CI -> `upstream` merge cycle before the next wave pins its merged `upstream` SHA: + +1. **Stay on `master`** (no topical branches; `origin` is the fork, `upstream` is `cppalliance/*`). Sync `master` with `upstream/master` before starting each repo. +2. **Plan copy commit first**: Commit 1 in every touched repo adds `plan/2026-12-02-2-unified-tool-info.plan.md` so every commit message follows `.cursor/rules/commit.mdc` (`Plan: /plan/2026-12-02-2-unified-tool-info.plan.md`). +3. **Every commit is independently green**: Before each `git commit`, run `cargo fmt`, `cargo clippy` (warnings denied), and the workspace test suite (+ `xtask` / `public-api` / MSRV checks where applicable) so `git bisect` passes at every single commit. +4. **PR & merge per wave**: Push `master` to `origin`, open a PR against `cppalliance/:master` via `gh pr create`, monitor GitHub Actions checks and review comments until green, address any findings in follow-up testable commits, merge the PR to `upstream` via `gh pr merge`, and `git fetch upstream && git merge --ff-only upstream/master` locally to capture the exact merged `upstream` SHA for the next wave. + +```mermaid +flowchart TD + GatewayTypes["gateway-types"] -->|"copy tool.rs"| PluginApi["plugin-api 0.9"] + GatewayTypes -->|"upstream SHA G"| Harness["runvil-harness"] + PluginApi -->|"upstream SHA P"| PluginStd["plugin-std"] + PluginApi -->|"upstream SHA P"| PluginBash["plugin-bashkit"] + PluginApi -->|"upstream SHA P"| PluginWeb["plugin-web"] + PluginApi -->|"upstream SHA P"| Harness + PluginStd -->|"upstream SHA S"| Workshop["runvil-workshop"] + PluginBash -->|"upstream SHA B"| Workshop + PluginWeb -->|"upstream SHA W"| Workshop + Harness -->|"upstream SHA H"| Workshop + Workshop -->|"upstream SHA K"| Runvil["runvil"] +``` + +## Wave 1: `gateway-client` and `runvil-plugin-api` (Parallel PRs once `tool.rs` is written) + +### Wave 1a: `gateway-client` (3 Testable Commits -> Merged Upstream SHA `G`) + +- **Commit 1**: Add `plan/2026-12-02-2-unified-tool-info.plan.md`. +- **Commit 2 (additive, keeps `ToolSchema` compiling)**: Add `[gateway-client/crates/gateway-types/src/tool.rs](c:/Users/Vinnie/cursor/gateway-client/crates/gateway-types/src/tool.rs)` + unit tests, re-export `ToolInfo` from `[gateway-client/crates/gateway-types/src/lib.rs](c:/Users/Vinnie/cursor/gateway-client/crates/gateway-types/src/lib.rs)` and `[gateway-client/crates/gateway-client/src/lib.rs](c:/Users/Vinnie/cursor/gateway-client/crates/gateway-client/src/lib.rs)`, and update both `public-api.txt` snapshots: + - Rust 1.85 syntax (no `let` chains), no `#[non_exhaustive]`, `<= 100` lines and `<= 7` args per function, `use std::fmt;`, text-only doc fences, and intra-doc links scoped strictly to `ToolInfo`: + +```rust +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[expect( + clippy::struct_excessive_bools, + reason = "the five execution flags are independent properties of one tool" +)] +pub struct ToolInfo { + pub name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pack: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub wire_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + pub description: String, + pub input_schema: Value, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub output_schema: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub read_only_hint: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub destructive_hint: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub idempotent_hint: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub open_world_hint: Option, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub structured_output: bool, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub survives_stop: bool, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub describes_tools: bool, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub model_only_call: bool, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub changes_files: bool, +} +``` + + - Provide infallible `ToolInfo::new(name, description, input_schema)`, `with_*` builders, `effective_wire_name(&self) -> Cow<'_, str>`, `qualified_name(&self) -> Cow<'_, str>`, and field getters. +- **Commit 3 (replace `ToolSchema` with concrete `Arc`)**: Update `[gateway-client/crates/gateway-types/src/request.rs](c:/Users/Vinnie/cursor/gateway-client/crates/gateway-types/src/request.rs)`, `request-tests.rs`, `[gateway-client/crates/gateway-types/src/broker.rs](c:/Users/Vinnie/cursor/gateway-client/crates/gateway-types/src/broker.rs)`, and `[gateway-client/crates/gateway-client/src/transport.rs](c:/Users/Vinnie/cursor/gateway-client/crates/gateway-client/src/transport.rs)`. Keep `tools` concrete (`Option<&[Arc]>` on `build_request_body` and `GatewayClient::complete`; `Vec>` on `InferenceBroker::chat`) so all 22 bare `None` / `Some(&[])` call sites infer cleanly without `E0282`. Validate `(tool.effective_wire_name(), &tool.input_schema)` via `validate_tool_schema` (retaining `ErrorCode::ToolSchemaInvalid = 509`), refresh both `public-api.txt` files, verify all CI gates (`+1.88`, `dylint`, `deny`, `nextest`), push to `origin`, open PR, and merge to `upstream` -> SHA `G`. + +### Wave 1b: `runvil-plugin-api` v0.9.0 (3 Testable Commits -> Merged Upstream SHA `P`) + +- **Commit 1**: Add `plan/2026-12-02-2-unified-tool-info.plan.md`. +- **Commit 2 (sync `tool_info.rs` + `xtask` check, keeping 0.8 ABI intact)**: Add `serde` and `serde_json` to `[runvil-plugin-api/Cargo.toml](c:/Users/Vinnie/cursor/runvil-plugin-api/Cargo.toml)` and `[runvil-plugin-api/crates/runvil-plugin-sdk/Cargo.toml](c:/Users/Vinnie/cursor/runvil-plugin-api/crates/runvil-plugin-sdk/Cargo.toml)` (`runvil-plugin-sys` stays `#![no_std]` with zero dependencies), copy `tool.rs` verbatim to `[runvil-plugin-api/crates/runvil-plugin-sdk/src/tool_info.rs](c:/Users/Vinnie/cursor/runvil-plugin-api/crates/runvil-plugin-sdk/src/tool_info.rs)`, and add `sync-tool-info` check in `[runvil-plugin-api/crates/build-xtask/src/main.rs](c:/Users/Vinnie/cursor/runvil-plugin-api/crates/build-xtask/src/main.rs)`. Verify `+1.85 check` and `cargo test` pass. +- **Commit 3 (bump C contract & SDK to `0.9.0` with JSON `RvToolInfo`)**: + - Update `[runvil-plugin-api/crates/runvil-plugin-sys/src/lib.rs](c:/Users/Vinnie/cursor/runvil-plugin-api/crates/runvil-plugin-sys/src/lib.rs)` (`RV_API_MINOR = 9`, `RvToolInfo { size: u32, reserved: u32, json: RvStr }` size 24, `RV_MAX_TOOL_JSON = 262_144`, keeping `RV_MAX_TOOL_TEXT = 65_536` for `description`), regenerate `[runvil-plugin-api/crates/runvil-plugin-sys/include/runvil_plugin.h](c:/Users/Vinnie/cursor/runvil-plugin-api/crates/runvil-plugin-sys/include/runvil_plugin.h)`, and update `[runvil-plugin-api/tests/c-layout/src/lib.rs](c:/Users/Vinnie/cursor/runvil-plugin-api/tests/c-layout/src/lib.rs)` + `layout.c`. + - Switch `runvil-plugin-sdk` (`src/tool.rs`, `src/entry/{pack,tool,file}.rs`, `src/testing.rs`, `src/testing/{pack,render,fixture}.rs`, `examples/hello-plugin/src/lib.rs`, `AGENTS.md`, `README.md`) to re-export `tool_info::ToolInfo`, keeping `let jsons: Vec` alive across `extern "C"` render calls and updating `Mode::Respaced` in `testing/render.rs` for semantic JSON `Value` comparison. + - Verify all CI checks (`+1.85`, `c-layout`, `clippy`, `doc`), push to `origin`, open PR, and merge to `upstream` -> SHA `P`. + +## Wave 2: Three Plugin Repos + `runvil-harness` (4 Parallel PRs once `G` and `P` Merge) + +### Wave 2a: `runvil-plugin-std`, `runvil-plugin-bashkit`, and `runvil-plugin-web` (2 Testable Commits Each -> Merged SHAs `S`, `B`, `W`) + +In each of `[runvil-plugin-std](c:/Users/Vinnie/cursor/runvil-plugin-std)`, `[runvil-plugin-bashkit](c:/Users/Vinnie/cursor/runvil-plugin-bashkit)`, and `[runvil-plugin-web](c:/Users/Vinnie/cursor/runvil-plugin-web)` independently in parallel: +- **Commit 1**: Add `plan/2026-12-02-2-unified-tool-info.plan.md`. +- **Commit 2**: Pin `runvil-plugin-sdk = "0.9.0"` at `P`, pass `serde_json::Value` directly to `ToolInfo::new` using `.with_wire_name(...)` and `.with_changes_files(true)`, update `[ToolInfo::with_changes_files]` doc link in `[runvil-plugin-std/crates/plugin-std/src/lib.rs](c:/Users/Vinnie/cursor/runvil-plugin-std/crates/plugin-std/src/lib.rs)`, and update `tool.input_schema` assertions in `pack-tests.rs` and `web-tests.rs`. +- Verify all checks (`build-checks`, `clippy`, `test`, `doc`), push to `origin`, open PRs, and merge to `upstream` -> SHAs `S`, `B`, `W`. + +### Wave 2b: `runvil-harness` (4 Testable Commits -> Merged Upstream SHA `H`) + +- **Commit 1**: Add `plan/2026-12-02-2-unified-tool-info.plan.md`. +- **Commit 2 (pin `gateway-types` at `G` and unify `ToolInfo` across Engine, Harness, and `plugin-mcp` while keeping loader on 0.8)**: + - Update `[runvil-harness/Cargo.toml](c:/Users/Vinnie/cursor/runvil-harness/Cargo.toml)` to pin `gateway-client` / `gateway-types` at `G`. + - Delete `runvil_types::tools::ToolInfo` in `[runvil-harness/crates/runvil-internal/types/src/tools.rs](c:/Users/Vinnie/cursor/runvil-harness/crates/runvil-internal/types/src/tools.rs)` and re-export `gateway_types::ToolInfo`. Split 2+ segment `ToolId`s at the first `/` (`pack` + `name`) and index `(ToolId, Arc)` inside `ToolCatalog`, `OfferedTool::Catalog`, `ToolBinding`, and `LuaToolHandle` (keeping `.id() -> &ToolId` borrowed at all 30+ Engine sites and `.parameters` userdata reading `input_schema`). + - Update `Effect::Chat` (`tools: Vec>`), `scope.rs`, `RunPacks`, `plugin-mcp` (`rmcp::model::Tool` -> `Arc` preserving `title`, `output_schema`, and hints while keeping `mcp/get_dynamic_tools` output unchanged), `harness-plugin-loader` (adapting 0.8 `RvToolInfo` into new `ToolInfo`), `harness-gateway-client`, and facades (`runvil-engine`, `runvil`, dropping `ToolSchema` re-exports and blessing `public-api.txt`). Every workspace test and `xtask` check passes at this commit. +- **Commit 3 (embed `Arc` in `Frontmatter` / `Prompt` and drop `pub struct Annotations`)**: + - In `[runvil-harness/crates/runvil-internal/prompt/src/frontmatter.rs](c:/Users/Vinnie/cursor/runvil-harness/crates/runvil-internal/prompt/src/frontmatter.rs)` and `prompt.rs`, keep private `RawAnnotations` so every YAML error message and span test in `frontmatter-tests-annotations.rs` stays identical, build `tool: Arc` on `Frontmatter` (keeping `.name()`, `.description()`, `.title()`, `.args()` delegating on `Frontmatter` and adding `Frontmatter::tool_info` + `Prompt::tool_info`), remove `Annotations` from `runvil-engine` and `runvil`, and bless `public-api.txt`. +- **Commit 4 (pin `runvil-plugin-sys = "0.9.0"` at `P` and switch loader + `test-plugin` to JSON `RvToolInfo`)**: + - Pin `runvil-plugin-sys = "0.9.0"` at `P` in `Cargo.toml`. + - Delete `AddedTool`, `Offered`, and `raw_parameters` in `[runvil-harness/crates/harness-internal/plugin-loader/src/pack.rs](c:/Users/Vinnie/cursor/runvil-harness/crates/harness-internal/plugin-loader/src/pack.rs)` and `session.rs`, deserializing `RvToolInfo.json` straight into `ToolInfo` (keeping `Vec` alive across `send_render`). + - Update zero-dep `[runvil-harness/crates/harness-internal/test-plugin/src/lib.rs](c:/Users/Vinnie/cursor/runvil-harness/crates/harness-internal/test-plugin/src/lib.rs)` + `lib-tests.rs` to contract `0.9` (`size == 24`, balanced-brace `object_of` helper for `"shape"`), add a `build-xtask` sync check when sibling repos are present, and update `decisions/tools-and-packs.md` and `decisions/prompt-language.md`. +- Run full pre-push + CI suite (`docs-claims.mjs`, `clippy`, `nextest`, `xtask tidy`, `+nightly-2026-09-05 xtask api`, `dylint`, `deny`), push to `origin`, open PR, and merge to `upstream` -> SHA `H`. + +## Wave 3: `runvil-workshop` and `runvil` (Sequential Final Wave) + +### Wave 3a: `runvil-workshop` (3 Testable Commits -> Merged Upstream SHA `K`) + +- **Commit 1**: Add `plan/2026-12-02-2-unified-tool-info.plan.md`. +- **Commit 2 (pins + broker)**: Update `[runvil-workshop/Cargo.toml](c:/Users/Vinnie/cursor/runvil-workshop/Cargo.toml)` to pin `runvil-harness` (`H`), `runvil-plugin-sdk` `0.9.0` (`P`), and `std-plugin` (`S`), `bashkit-plugin` (`B`), `web-plugin` (`W`), and switch `WorkshopBroker::chat` in `[runvil-workshop/crates/workshop/server/src/agents/broker.rs](c:/Users/Vinnie/cursor/runvil-workshop/crates/workshop/server/src/agents/broker.rs)` to `Vec>`. Verify `cargo test` and `xtask tidy`. +- **Commit 3 (`/prompts/contract` + UI)**: Flatten `&**prompt.tool_info()` onto `ContractResponse` in `[runvil-workshop/crates/workshop/server/src/routes/prompts.rs](c:/Users/Vinnie/cursor/runvil-workshop/crates/workshop/server/src/routes/prompts.rs)` (keeping explicit `null` for absent `runvil` and `max_tool_iterations`), and update `prompts-tests.rs`, `[runvil-workshop/crates/workshop/ui/src/services/run-api.ts](c:/Users/Vinnie/cursor/runvil-workshop/crates/workshop/ui/src/services/run-api.ts)`, `run-rows.ts`, `test/run-api.mjs`, and `test/run-panel.mjs`. +- Verify Rust + UI tests + `xtask tidy`, push to `origin`, open PR, and merge to `upstream` -> SHA `K`. + +### Wave 3b: `runvil` (2 Testable Commits -> Merged Upstream) + +- **Commit 1**: Add `plan/2026-12-02-2-unified-tool-info.plan.md`. +- **Commit 2**: Pin `[workspace.metadata.workshop]` in `[runvil/Cargo.toml](c:/Users/Vinnie/cursor/runvil/Cargo.toml)` to SHA `K`, verify `xtask`, push to `origin`, open PR, and merge to `upstream`. From 30474633258b4ae31e7f57e505ac2eb0aa42b816 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Wed, 2 Dec 2026 12:34:28 -0800 Subject: [PATCH 2/2] Pin `runvil-plugin-sdk` `0.9.0` and update `ToolInfo` Pin `runvil-plugin-sdk` to version `0.9.0` at `4c10a7d4d26c11e6a3055c6f6c4b5657f1bf2faa` in `Cargo.toml` and `Cargo.lock` to adopt the JSON-backed `ToolInfo` contract. Update `StdPack` in `crates/plugin-std/src/pack.rs` to pass `definition.parameters` directly to `ToolInfo::new` and call `with_wire_name` and `with_changes_files`. Update `crates/plugin-std/src/pack-tests.rs` to check `tool.input_schema` directly, and update `crates/plugin-std/src/lib.rs`, `AGENTS.md`, and `README.md` to match `ToolInfo::with_changes_files` and contract `0.9`. Plan: /plan/2026-12-02-2-unified-tool-info.plan.md --- AGENTS.md | 2 +- Cargo.lock | 10 ++++++---- Cargo.toml | 4 ++-- README.md | 2 +- crates/plugin-std/src/lib.rs | 2 +- crates/plugin-std/src/pack-tests.rs | 6 ++---- crates/plugin-std/src/pack.rs | 6 +++--- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 64c0532..50cbd8d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -27,7 +27,7 @@ Anything else gets a qualified lowercase name, such as Rust's built-in test harn - Behavior changes ship with tests in the same change. Preserve behavior tests during refactors. - The Plugin crate depends on `runvil-plugin-sdk` and outside libraries alone, and writes no `unsafe`. The SDK owns the C boundary. - A tool reaches files only through `Source` (`crates/plugin-std/src/source.rs`), which the call's `ToolCall` implements, so every file operation goes through the Host and the run's policy applies to it. A test runs a tool's own code over the SDK's `testing::Files` tree, or over `FakeSource` (`crates/plugin-std/src/fake.rs`) for what that tree cannot hold. -- A tool that changes files says so with `ToolInfo::changes_files`, so the Host runs each of its calls by itself among the calls of one model reply. +- A tool that changes files says so with `ToolInfo::with_changes_files`, so the Host runs each of its calls by itself among the calls of one model reply. - A tool's description and parameter schema come from its JSON file under `crates/plugin-std/schemas`. `EDITS.md` beside them records every difference from Cursor's definition, and a change to a JSON file changes `EDITS.md` with it. - A tool that does a long job awaits `next_step()` after each bounded slice of work, as Grep does every 32 files or directories, so that no step of its call works for long and the Host can abandon the call between two steps. - A Plugin shares its process with the Host, so nothing here installs process-global state, such as a panic hook (`clippy.toml` bans `std::panic::set_hook`), and nothing starts a thread that outlives the Plugin's unload. What every run shares lives in the Plugin instance and never in a `static`, so an unload frees it. diff --git a/Cargo.lock b/Cargo.lock index e299b8d..d6682e3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -154,16 +154,18 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" [[package]] name = "runvil-plugin-sdk" -version = "0.8.0" -source = "git+https://github.com/cppalliance/runvil-plugin-api?rev=f2d42cc41b0f28f81ac73193f21c2eacfafc11d9#f2d42cc41b0f28f81ac73193f21c2eacfafc11d9" +version = "0.9.0" +source = "git+https://github.com/cppalliance/runvil-plugin-api?rev=4c10a7d4d26c11e6a3055c6f6c4b5657f1bf2faa#4c10a7d4d26c11e6a3055c6f6c4b5657f1bf2faa" dependencies = [ "runvil-plugin-sys", + "serde", + "serde_json", ] [[package]] name = "runvil-plugin-sys" -version = "0.8.0" -source = "git+https://github.com/cppalliance/runvil-plugin-api?rev=f2d42cc41b0f28f81ac73193f21c2eacfafc11d9#f2d42cc41b0f28f81ac73193f21c2eacfafc11d9" +version = "0.9.0" +source = "git+https://github.com/cppalliance/runvil-plugin-api?rev=4c10a7d4d26c11e6a3055c6f6c4b5657f1bf2faa#4c10a7d4d26c11e6a3055c6f6c4b5657f1bf2faa" [[package]] name = "rustix" diff --git a/Cargo.toml b/Cargo.toml index 0c93cc5..ca4ab3f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,9 +7,9 @@ edition = "2024" license = "BSL-1.0" [workspace.dependencies] -# The Plugin SDK at contract 0.8, pinned to a commit. A Host loads this +# The Plugin SDK at contract 0.9, pinned to a commit. A Host loads this # Plugin only when its Harness speaks the same contract version. -runvil-plugin-sdk = { version = "0.8.0", git = "https://github.com/cppalliance/runvil-plugin-api", rev = "f2d42cc41b0f28f81ac73193f21c2eacfafc11d9" } +runvil-plugin-sdk = { version = "0.9.0", git = "https://github.com/cppalliance/runvil-plugin-api", rev = "4c10a7d4d26c11e6a3055c6f6c4b5657f1bf2faa" } # Each tool's definition is embedded JSON, and a call's arguments arrive # as JSON text. serde = { version = "1", features = ["derive"] } diff --git a/README.md b/README.md index ea9f2d4..8fc3088 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ The Plugin inserts one Pack, `runvil/std`, which gives a run the standard file t cargo build -p plugin-std --release ``` -This writes `plugin_std.dll` (Windows), `libplugin_std.so` (Linux), or `libplugin_std.dylib` (macOS) to `target/release`. That one file goes in the Host's Plugin directory. The Plugin speaks contract 0.8, the version that the pin of `runvil-plugin-sdk` in `Cargo.toml` names, and a Host loads it only when its Harness speaks the same version. +This writes `plugin_std.dll` (Windows), `libplugin_std.so` (Linux), or `libplugin_std.dylib` (macOS) to `target/release`. That one file goes in the Host's Plugin directory. The Plugin speaks contract 0.9, the version that the pin of `runvil-plugin-sdk` in `Cargo.toml` names, and a Host loads it only when its Harness speaks the same version. A Host can also link the crate in. It turns the `dll` feature off, so the crate exports no symbol, and passes `runvil_plugin_sdk::entry::` to the Harness's `insert_plugin`. diff --git a/crates/plugin-std/src/lib.rs b/crates/plugin-std/src/lib.rs index f9e73a3..19e641c 100644 --- a/crates/plugin-std/src/lib.rs +++ b/crates/plugin-std/src/lib.rs @@ -144,7 +144,7 @@ //! through. Grep alone accepts `-n` when it is `true`, because Cursor's //! definition once declared it. //! - A tool that changes files is flagged with -//! [`ToolInfo::changes_files`](runvil_plugin_sdk::ToolInfo::changes_files), +//! [`ToolInfo::with_changes_files`](runvil_plugin_sdk::ToolInfo::with_changes_files), //! and a test holds the flags in place. mod check; diff --git a/crates/plugin-std/src/pack-tests.rs b/crates/plugin-std/src/pack-tests.rs index 8d1605a..044902b 100644 --- a/crates/plugin-std/src/pack-tests.rs +++ b/crates/plugin-std/src/pack-tests.rs @@ -71,7 +71,7 @@ fn the_specs_are_the_seven_the_crate_names_in_order() { } #[test] -fn an_instance_names_each_tool_by_its_segment_with_its_schema_as_json_text() { +fn an_instance_names_each_tool_by_its_segment_with_its_input_schema() { let definitions: Arc<[Definition]> = spec::load().expect("every definition parses").into(); let pack = StdPack::new(Arc::clone(&definitions)); assert_eq!(pack.tools.len(), definitions.len()); @@ -82,9 +82,7 @@ fn an_instance_names_each_tool_by_its_segment_with_its_schema_as_json_text() { Some(definition.wire_name.as_str()) ); assert_eq!(tool.description, definition.description); - let parameters: serde_json::Value = - serde_json::from_str(&tool.parameters).expect("the schema is JSON text"); - assert_eq!(parameters, definition.parameters, "{}", tool.name); + assert_eq!(tool.input_schema, definition.parameters, "{}", tool.name); } } diff --git a/crates/plugin-std/src/pack.rs b/crates/plugin-std/src/pack.rs index af35275..d20a9d7 100644 --- a/crates/plugin-std/src/pack.rs +++ b/crates/plugin-std/src/pack.rs @@ -52,11 +52,11 @@ impl StdPack { let tool = ToolInfo::new( definition.segment, definition.description.clone(), - definition.parameters.to_string(), + definition.parameters.clone(), ) - .wire_name(definition.wire_name.clone()); + .with_wire_name(definition.wire_name.clone()); if changes_files(definition.segment) { - tool.changes_files() + tool.with_changes_files(true) } else { tool }