diff --git a/Cargo.lock b/Cargo.lock index 330ffe7..b764924 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1083,9 +1083,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" +checksum = "f120c8d5021b34abd2f2ffd7ee96687cbcd6c54a3e68d86b6169f4a5cd480ffe" [[package]] name = "pkg-config" @@ -1347,16 +1347,16 @@ dependencies = [ [[package]] name = "runvil-plugin-sdk" -version = "0.7.0" -source = "git+https://github.com/cppalliance/runvil-plugin-api?rev=450afa2d3b0d70c3f2a4a9f89f5938da5ef0fb78#450afa2d3b0d70c3f2a4a9f89f5938da5ef0fb78" +version = "0.8.0" +source = "git+https://github.com/cppalliance/runvil-plugin-api?rev=f2d42cc41b0f28f81ac73193f21c2eacfafc11d9#f2d42cc41b0f28f81ac73193f21c2eacfafc11d9" dependencies = [ "runvil-plugin-sys", ] [[package]] name = "runvil-plugin-sys" -version = "0.7.0" -source = "git+https://github.com/cppalliance/runvil-plugin-api?rev=450afa2d3b0d70c3f2a4a9f89f5938da5ef0fb78#450afa2d3b0d70c3f2a4a9f89f5938da5ef0fb78" +version = "0.8.0" +source = "git+https://github.com/cppalliance/runvil-plugin-api?rev=f2d42cc41b0f28f81ac73193f21c2eacfafc11d9#f2d42cc41b0f28f81ac73193f21c2eacfafc11d9" [[package]] name = "rustc-hash" diff --git a/Cargo.toml b/Cargo.toml index 03dfbab..75103f6 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.7, pinned to a commit. A Host loads this +# The Plugin SDK at contract 0.8, pinned to a commit. A Host loads this # Plugin only when its Harness speaks the same contract version. -runvil-plugin-sdk = { version = "0.7.0", git = "https://github.com/cppalliance/runvil-plugin-api", rev = "450afa2d3b0d70c3f2a4a9f89f5938da5ef0fb78" } +runvil-plugin-sdk = { version = "0.8.0", git = "https://github.com/cppalliance/runvil-plugin-api", rev = "f2d42cc41b0f28f81ac73193f21c2eacfafc11d9" } # The HTTP client, over rustls with one crypto backend, aws-lc-rs. reqwest # 0.13 has no feature that picks `ring`, and CI checks that `ring` stays # out of the workspace's normal dependency graph. Root certificates come diff --git a/plan/2026-12-02-1-tool-call-model-and-origin.plan.md b/plan/2026-12-02-1-tool-call-model-and-origin.plan.md new file mode 100644 index 0000000..b359395 --- /dev/null +++ b/plan/2026-12-02-1-tool-call-model-and-origin.plan.md @@ -0,0 +1,32 @@ +--- +name: Model and Origin on Tool Calls +overview: Pass the call's origin (caller, section, entry) and the requesting round's full ModelInfo to every tool call across the Engine, Harness, and C Plugin contract (version 0.8), and update the documentation and downstream pins across all repositories. +todos: + - id: plugins-pin-0-8 + content: "runvil-plugin-std, runvil-plugin-bashkit, runvil-plugin-web: testable commits for plan copies, Pin SDK 0.8, and std README update" + status: pending +isProject: false +--- + +# Pass the Model and Origin to Tool Calls (Contract 0.8) + +## The idea in plain terms + +Today a render (`RV_PACK_RENDER` and `RenderContext`) learns the section entry (`sys.id`) and the full `ModelInfo` (`server`, `name`, `description`, `context`, `thinking`, and `provider`) of the section's first model round, while a tool call learns less: + +- In the Engine and Harness (`Effect::ToolCall` and `ToolContext`), a tool call receives `ToolCallOrigin` (`section`, `caller`, `entry`, and `model` as a bare model-name string), without the rest of the round's `ModelInfo`. +- Across the C Plugin contract (`RvToolCallArgs` and `runvil_plugin_sdk::ToolCall`), a tool call receives only `tool`, `arguments`, `resources`, the file functions, and `waker`. A contract Plugin cannot tell whether a script or a model called it, which section or entry made the call, or which model requested the call. + +This change gives every tool call both the call's origin and, when a model round requested the call, that round's full model facts: + +- **In the Engine (`runvil-lua` and `runvil-runtime`):** `MessageList::commit` records the round's `ModelInfo` (`binding.render_info()`) instead of only `binding.id().name()`. When a model round requests a tool call (`CallSite::Model` or `CallSite::Batch`), `prepare_catalog_call` attaches `Some(ModelInfo)` to `Effect::ToolCall` and sets `origin.model` to the model's name as before. When Lua calls `tools.call` directly (`CallSite::Script`), `model` is `None`. +- **In the Harness (`runvil-plugin` and `harness-runner`):** `ToolContext<'a>` gains `model: Option<&'a ModelInfo>` and `ToolContext::model(&self) -> Option<&'a ModelInfo>`, populated by `RunPacks::call`. +- **In the C contract (`runvil-plugin-sys` v0.8):** `RvToolCallArgs` gains `caller: RvCaller` (`RV_CALLER_MODEL = 0`, `RV_CALLER_SCRIPT = 1`, placed in the 4-byte `reserved` slot after `size`) and three `RvStr` fields at the end: `section`, `entry` (empty when unset), and `model` (the same JSON object shape as `RvPackRenderArgs.model` when a model round asked for the call, and empty for a script call). Every step of one call gets the same values. +- **In the SDK (`runvil-plugin-sdk` v0.8):** `ToolCall<'a>` gains `caller(&self) -> Caller`, `section(&self) -> &'a str`, `entry(&self) -> Option<&'a str>`, and `model(&self) -> Option<&'a str>`, backed by copies in `CallState` taken on the first step. The fake Host (`testing`) defaults a call to `Caller::Model`, `section: "Test"`, `entry: Some("0.0")`, and `model: None`, and adds builder setters on `testing::Call` so existing Plugin test suites compile unchanged while new tests can exercise every field. + +## Wave 2: `runvil-harness` and the three Plugin repositories + +- **The three Plugin repositories (in parallel with `runvil-harness` after Wave 1 merges):** + - `runvil-plugin-std`: `Pin SDK 0.8` in `Cargo.toml`, `Cargo.lock`, and `README.md`. + - `runvil-plugin-bashkit` and `runvil-plugin-web`: plan record commit + `Pin SDK 0.8` in `Cargo.toml` and `Cargo.lock`. + - Verify each with a fresh verifier subagent, push, open PRs, wait for green CI, and merge Wave 2.