Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,35 @@ repository = "https://github.com/cppalliance/runvil-workshop"
# Workshop links in. All three name one commit, because two commits would
# be two copies of every type the crates share. `version` beside `git`
# keeps cargo-deny's wildcard check quiet.
runvil = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "942835504ee66f32538c9dcb6dea59dd057e61f1" }
harness-gateway-client = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "942835504ee66f32538c9dcb6dea59dd057e61f1" }
plugin-mcp = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "942835504ee66f32538c9dcb6dea59dd057e61f1" }
# The safe layer over the C Plugin contract, version 0.7, from its own
runvil = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "faf6d613bb9e76fd422fbaba3e5aba6b67ba58e0" }
harness-gateway-client = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "faf6d613bb9e76fd422fbaba3e5aba6b67ba58e0" }
plugin-mcp = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "faf6d613bb9e76fd422fbaba3e5aba6b67ba58e0" }
# The safe layer over the C Plugin contract, version 0.8, from its own
# repository, pinned by commit. Only the library Plugin crates under
# `crates/workshop/` name it, for `export_plugin!`. The commit is the one
# runvil-harness pins the contract's `runvil-plugin-sys` at: that crate
# sets `links`, so Cargo refuses two commits of the contract in one build.
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 std Plugin, from its own repository, pinned by commit, which must be
# built against the contract commit above. default-features off drops its
# own export of `runvil_plugin`, which `workshop-plugin-std` makes instead.
# The key is `std-plugin` because that crate's own library is named
# `plugin_std`, the name of the file Workshop ships.
std-plugin = { package = "plugin-std", version = "0.1.0", git = "https://github.com/cppalliance/runvil-plugin-std", rev = "f1541bf93b2a7fe75abfc905e4588906104f3a16", default-features = false }
std-plugin = { package = "plugin-std", version = "0.1.0", git = "https://github.com/cppalliance/runvil-plugin-std", rev = "c3653768df3817a7140059c1de66195e51408b70", default-features = false }
# The bashkit Plugin, from its own repository, pinned by commit and built
# against the same contract commit. default-features off drops its own
# export of `runvil_plugin`, which `workshop-plugin-bashkit` makes
# instead. The key is `bashkit-plugin` for the reason std's is
# `std-plugin`: the crate's own library has the name of the file Workshop
# ships, `plugin_bashkit`.
bashkit-plugin = { package = "plugin-bashkit", version = "0.1.0", git = "https://github.com/cppalliance/runvil-plugin-bashkit", rev = "35f8e4b72a9c14a4611899abcdb43a888a3287a3", default-features = false }
bashkit-plugin = { package = "plugin-bashkit", version = "0.1.0", git = "https://github.com/cppalliance/runvil-plugin-bashkit", rev = "67cc930c47bedace9af648982f72b6e12c77ba08", default-features = false }
# The web Plugin, from its own repository, pinned by commit and built
# against the same contract commit. default-features off drops its own
# export of `runvil_plugin`, which `workshop-plugin-web` makes instead.
# The key is `web-plugin` for the reason std's is `std-plugin`: the
# crate's own library has the name of the file Workshop ships,
# `plugin_web`.
web-plugin = { package = "plugin-web", version = "0.1.0", git = "https://github.com/cppalliance/runvil-plugin-web", rev = "1d5aefccada1b49d924cada1d2c2080a22b3db3b", default-features = false }
web-plugin = { package = "plugin-web", version = "0.1.0", git = "https://github.com/cppalliance/runvil-plugin-web", rev = "a24f3400022e43f237319db89ec4454063ec859a", default-features = false }
workshop-gateway-discovery = { path = "crates/workshop/gateway-discovery" }
workshop-server = { path = "crates/workshop/server" }
workshop-server-api = { path = "crates/workshop/server-api" }
Expand Down
31 changes: 31 additions & 0 deletions plan/2026-12-02-1-tool-call-model-and-origin.plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
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: workshop-pin-0-8
content: "runvil-workshop: testable commits for plan copy and pinning Harness, SDK 0.8, and Plugins; verify, push to origin, open PR, monitor GitHub Actions and CodeRabbit comments, address findings, and merge to upstream"
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 3: `runvil-workshop`

- Commit 1: Plan record `plan/2026-12-02-1-tool-call-model-and-origin.plan.md`.
- Commit 2: `Pin the Harness, the SDK, and the Plugins at contract 0.8` in `Cargo.toml` and `Cargo.lock`.
- Verify with a fresh verifier subagent, push, open a PR, wait for green CI, and merge.
Loading