diff --git a/Cargo.lock b/Cargo.lock index c5ec9c82..78f037ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1097,21 +1097,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crc" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d" -dependencies = [ - "crc-catalog", -] - -[[package]] -name = "crc-catalog" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853" - [[package]] name = "crc32c" version = "0.6.8" @@ -2258,7 +2243,7 @@ dependencies = [ [[package]] name = "harness-gateway-client" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=92abc305b9223513621eba95107648bdf8e4e47f#92abc305b9223513621eba95107648bdf8e4e47f" +source = "git+https://github.com/cppalliance/runvil-harness?rev=af336702ac76ca8f9c1ebe918028a776473ae917#af336702ac76ca8f9c1ebe918028a776473ae917" dependencies = [ "gateway-client", "runvil", @@ -2270,7 +2255,7 @@ dependencies = [ [[package]] name = "harness-plugin-loader" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=92abc305b9223513621eba95107648bdf8e4e47f#92abc305b9223513621eba95107648bdf8e4e47f" +source = "git+https://github.com/cppalliance/runvil-harness?rev=af336702ac76ca8f9c1ebe918028a776473ae917#af336702ac76ca8f9c1ebe918028a776473ae917" dependencies = [ "libloading 0.8.9", "runvil-plugin", @@ -2281,7 +2266,7 @@ dependencies = [ [[package]] name = "harness-runner" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=92abc305b9223513621eba95107648bdf8e4e47f#92abc305b9223513621eba95107648bdf8e4e47f" +source = "git+https://github.com/cppalliance/runvil-harness?rev=af336702ac76ca8f9c1ebe918028a776473ae917#af336702ac76ca8f9c1ebe918028a776473ae917" dependencies = [ "futures-util", "harness-plugin-loader", @@ -2355,9 +2340,9 @@ dependencies = [ [[package]] name = "htmd" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5a1c7113c831fec68cbd79cd8bf281a84e5b6943f51473dc266b0b88a6a017e" +checksum = "efd66117e0b1eac329399e316f30b9530afcb7cfbd0df59a007023b6673a6c37" dependencies = [ "html5ever 0.38.0", "markup5ever_rcdom", @@ -3057,21 +3042,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "kuchikikiki" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14683223e533503d404478bfd32826a4cba1b4906034ff74135404372390e87b" -dependencies = [ - "bitflags 2.13.1", - "crc", - "cssparser", - "html5ever 0.36.1", - "indexmap 2.14.0", - "precomputed-hash", - "selectors 0.33.0", -] - [[package]] name = "lazy_static" version = "1.5.0" @@ -4060,7 +4030,7 @@ dependencies = [ [[package]] name = "plugin-bashkit" version = "0.1.0" -source = "git+https://github.com/cppalliance/runvil-plugin-bashkit?rev=5afe8ff835774709fda6d0f70c6b28b76005c4cd#5afe8ff835774709fda6d0f70c6b28b76005c4cd" +source = "git+https://github.com/cppalliance/runvil-plugin-bashkit?rev=488e845ad2bd7b3114092a3255b7b3d6105489f4#488e845ad2bd7b3114092a3255b7b3d6105489f4" dependencies = [ "bashkit", "runvil-plugin-sdk", @@ -4072,7 +4042,7 @@ dependencies = [ [[package]] name = "plugin-mcp" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=92abc305b9223513621eba95107648bdf8e4e47f#92abc305b9223513621eba95107648bdf8e4e47f" +source = "git+https://github.com/cppalliance/runvil-harness?rev=af336702ac76ca8f9c1ebe918028a776473ae917#af336702ac76ca8f9c1ebe918028a776473ae917" dependencies = [ "reqwest", "rmcp", @@ -4085,7 +4055,7 @@ dependencies = [ [[package]] name = "plugin-std" version = "0.1.0" -source = "git+https://github.com/cppalliance/runvil-plugin-std?rev=0eda071d07531b57dcbcb1a255b6207d8110f91c#0eda071d07531b57dcbcb1a255b6207d8110f91c" +source = "git+https://github.com/cppalliance/runvil-plugin-std?rev=1da424b5ee5beac900c7ce93653a54b4e957c893#1da424b5ee5beac900c7ce93653a54b4e957c893" dependencies = [ "regex", "runvil-plugin-sdk", @@ -4096,11 +4066,13 @@ dependencies = [ [[package]] name = "plugin-web" version = "0.1.0" -source = "git+https://github.com/cppalliance/runvil-plugin-web?rev=afc7f54916bcdc03887675f4450cdd9d3cf10cdd#afc7f54916bcdc03887675f4450cdd9d3cf10cdd" +source = "git+https://github.com/cppalliance/runvil-plugin-web?rev=2bde099da58faaef7285e6ec46f4344806b3472f#2bde099da58faaef7285e6ec46f4344806b3472f" dependencies = [ "encoding_rs", "htmd", + "html5ever 0.38.0", "ipnet", + "markup5ever_rcdom", "mime", "readabilityrs", "reqwest", @@ -4531,18 +4503,17 @@ checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" [[package]] name = "readabilityrs" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d90c6e1dad698d9f3c80a8d91bc0efc8c2397cb5ca4bbffb9c0fb88a9a66e6b8" +checksum = "7c42603b08707aa2d44baa0ff2ec8fb89d66fbce4bc8eb5eec894009b6d18159" dependencies = [ "bitflags 2.13.1", - "kuchikikiki", - "once_cell", + "ego-tree", "regex", "scraper", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror 2.0.19", "url", "v_htmlescape", ] @@ -4740,7 +4711,7 @@ dependencies = [ [[package]] name = "runvil" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=92abc305b9223513621eba95107648bdf8e4e47f#92abc305b9223513621eba95107648bdf8e4e47f" +source = "git+https://github.com/cppalliance/runvil-harness?rev=af336702ac76ca8f9c1ebe918028a776473ae917#af336702ac76ca8f9c1ebe918028a776473ae917" dependencies = [ "harness-plugin-loader", "harness-runner", @@ -4751,7 +4722,7 @@ dependencies = [ [[package]] name = "runvil-engine" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=92abc305b9223513621eba95107648bdf8e4e47f#92abc305b9223513621eba95107648bdf8e4e47f" +source = "git+https://github.com/cppalliance/runvil-harness?rev=af336702ac76ca8f9c1ebe918028a776473ae917#af336702ac76ca8f9c1ebe918028a776473ae917" dependencies = [ "runvil-lua", "runvil-model-client", @@ -4764,7 +4735,7 @@ dependencies = [ [[package]] name = "runvil-lua" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=92abc305b9223513621eba95107648bdf8e4e47f#92abc305b9223513621eba95107648bdf8e4e47f" +source = "git+https://github.com/cppalliance/runvil-harness?rev=af336702ac76ca8f9c1ebe918028a776473ae917#af336702ac76ca8f9c1ebe918028a776473ae917" dependencies = [ "mlua", "runvil-markdown", @@ -4778,7 +4749,7 @@ dependencies = [ [[package]] name = "runvil-markdown" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=92abc305b9223513621eba95107648bdf8e4e47f#92abc305b9223513621eba95107648bdf8e4e47f" +source = "git+https://github.com/cppalliance/runvil-harness?rev=af336702ac76ca8f9c1ebe918028a776473ae917#af336702ac76ca8f9c1ebe918028a776473ae917" dependencies = [ "pulldown-cmark", "serde_json", @@ -4788,7 +4759,7 @@ dependencies = [ [[package]] name = "runvil-model-client" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=92abc305b9223513621eba95107648bdf8e4e47f#92abc305b9223513621eba95107648bdf8e4e47f" +source = "git+https://github.com/cppalliance/runvil-harness?rev=af336702ac76ca8f9c1ebe918028a776473ae917#af336702ac76ca8f9c1ebe918028a776473ae917" dependencies = [ "runvil-types", "serde", @@ -4798,7 +4769,7 @@ dependencies = [ [[package]] name = "runvil-plugin" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=92abc305b9223513621eba95107648bdf8e4e47f#92abc305b9223513621eba95107648bdf8e4e47f" +source = "git+https://github.com/cppalliance/runvil-harness?rev=af336702ac76ca8f9c1ebe918028a776473ae917#af336702ac76ca8f9c1ebe918028a776473ae917" dependencies = [ "runvil-types", "runvil-vfs", @@ -4807,21 +4778,21 @@ dependencies = [ [[package]] name = "runvil-plugin-sdk" -version = "0.6.0" -source = "git+https://github.com/cppalliance/runvil-plugin-api?rev=74f9e08ba9cc524520fb4c90bd8ac372ba7f303f#74f9e08ba9cc524520fb4c90bd8ac372ba7f303f" +version = "0.7.0" +source = "git+https://github.com/cppalliance/runvil-plugin-api?rev=42c109fdc8bffd15ee6b6d7afcc04383aa27373a#42c109fdc8bffd15ee6b6d7afcc04383aa27373a" dependencies = [ "runvil-plugin-sys", ] [[package]] name = "runvil-plugin-sys" -version = "0.6.0" -source = "git+https://github.com/cppalliance/runvil-plugin-api?rev=74f9e08ba9cc524520fb4c90bd8ac372ba7f303f#74f9e08ba9cc524520fb4c90bd8ac372ba7f303f" +version = "0.7.0" +source = "git+https://github.com/cppalliance/runvil-plugin-api?rev=42c109fdc8bffd15ee6b6d7afcc04383aa27373a#42c109fdc8bffd15ee6b6d7afcc04383aa27373a" [[package]] name = "runvil-prompt" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=92abc305b9223513621eba95107648bdf8e4e47f#92abc305b9223513621eba95107648bdf8e4e47f" +source = "git+https://github.com/cppalliance/runvil-harness?rev=af336702ac76ca8f9c1ebe918028a776473ae917#af336702ac76ca8f9c1ebe918028a776473ae917" dependencies = [ "pulldown-cmark", "runvil-lua", @@ -4834,7 +4805,7 @@ dependencies = [ [[package]] name = "runvil-runtime" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=92abc305b9223513621eba95107648bdf8e4e47f#92abc305b9223513621eba95107648bdf8e4e47f" +source = "git+https://github.com/cppalliance/runvil-harness?rev=af336702ac76ca8f9c1ebe918028a776473ae917#af336702ac76ca8f9c1ebe918028a776473ae917" dependencies = [ "mlua", "regex", @@ -4852,7 +4823,7 @@ dependencies = [ [[package]] name = "runvil-types" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=92abc305b9223513621eba95107648bdf8e4e47f#92abc305b9223513621eba95107648bdf8e4e47f" +source = "git+https://github.com/cppalliance/runvil-harness?rev=af336702ac76ca8f9c1ebe918028a776473ae917#af336702ac76ca8f9c1ebe918028a776473ae917" dependencies = [ "serde", "serde_json", @@ -4862,7 +4833,7 @@ dependencies = [ [[package]] name = "runvil-vfs" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=92abc305b9223513621eba95107648bdf8e4e47f#92abc305b9223513621eba95107648bdf8e4e47f" +source = "git+https://github.com/cppalliance/runvil-harness?rev=af336702ac76ca8f9c1ebe918028a776473ae917#af336702ac76ca8f9c1ebe918028a776473ae917" [[package]] name = "rust-embed" diff --git a/Cargo.toml b/Cargo.toml index f5b3566a..535becfa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 = "92abc305b9223513621eba95107648bdf8e4e47f" } -harness-gateway-client = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "92abc305b9223513621eba95107648bdf8e4e47f" } -plugin-mcp = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "92abc305b9223513621eba95107648bdf8e4e47f" } -# The safe layer over the C Plugin contract, version 0.6, from its own +runvil = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "af336702ac76ca8f9c1ebe918028a776473ae917" } +harness-gateway-client = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "af336702ac76ca8f9c1ebe918028a776473ae917" } +plugin-mcp = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "af336702ac76ca8f9c1ebe918028a776473ae917" } +# The safe layer over the C Plugin contract, version 0.7, 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.6.0", git = "https://github.com/cppalliance/runvil-plugin-api", rev = "74f9e08ba9cc524520fb4c90bd8ac372ba7f303f" } +runvil-plugin-sdk = { version = "0.7.0", git = "https://github.com/cppalliance/runvil-plugin-api", rev = "42c109fdc8bffd15ee6b6d7afcc04383aa27373a" } # 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 = "0eda071d07531b57dcbcb1a255b6207d8110f91c", default-features = false } +std-plugin = { package = "plugin-std", version = "0.1.0", git = "https://github.com/cppalliance/runvil-plugin-std", rev = "1da424b5ee5beac900c7ce93653a54b4e957c893", 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 = "5afe8ff835774709fda6d0f70c6b28b76005c4cd", default-features = false } +bashkit-plugin = { package = "plugin-bashkit", version = "0.1.0", git = "https://github.com/cppalliance/runvil-plugin-bashkit", rev = "488e845ad2bd7b3114092a3255b7b3d6105489f4", 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 = "afc7f54916bcdc03887675f4450cdd9d3cf10cdd", default-features = false } +web-plugin = { package = "plugin-web", version = "0.1.0", git = "https://github.com/cppalliance/runvil-plugin-web", rev = "2bde099da58faaef7285e6ec46f4344806b3472f", 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" } diff --git a/plan/2026-11-26-1-pack-render-verb.plan.md b/plan/2026-11-26-1-pack-render-verb.plan.md new file mode 100644 index 00000000..38968417 --- /dev/null +++ b/plan/2026-11-26-1-pack-render-verb.plan.md @@ -0,0 +1,87 @@ +--- +name: Pack render verb +overview: "Pin the Harness, the SDK, and the Plugins at contract 0.7, which adds the verb RV_PACK_RENDER. Workshop writes no code for it: its Plugins keep the default render and the Harness sends the verb to a library Pack. This file holds the parts of the plan that concern this repository." +todos: + - id: w-plan + content: "Commit 1: add this plan" + status: pending + - id: w-pin + content: "Commit 2: pin the Harness, the SDK, and the Plugins at contract 0.7" + status: pending +isProject: false +--- + +# Pack render verb + +This is the part of the plan for contract 0.7 that concerns this repository. The contract, the Harness, and the Plugins merge first; this repository pins each of them at the commit that merge made, and the SDK at the contract commit. + +## The idea in plain terms + +- **Catalog tool.** A tool a Pack declares when a run starts, such as `fs/edit`. Lua can call it by id, a prompt offers it with `tools.offer("fs/edit")` or `tools.offer("fs")`, and its parameters are documented and fixed for the run. +- **Model-facing tool.** A tool that exists only in a render's answer, such as `fs/str_replace` for Anthropic models or `fs/apply_patch` for OpenAI models. Only the model can call it. Lua can't name it. +- **Render.** At a section entry's first `models.loop` round, the Harness asks each offered Pack: "here are the tools the section offered and here is the model, what should the model see?" The answer is frozen for that section entry. +- **The name-locked rule.** A tool name always means one parameter schema. A render may give a catalog tool another wire name and description, but different parameters need a different tool name. So a Plugin's `call` matches on the tool name it receives and keeps no memory of what it rendered. +- **What exists today.** The Engine and Harness already do all of this for Rust Packs (`Effect::Render`, the merge, the run log). The C contract stops at verb 6, so a library Pack always passes its tools through unchanged. Today's merge also lets a render rewrite a catalog tool's parameters. +- **What this plan adds.** The verb, the SDK method, the loader's use of it, and the name-locked check in the Engine's merge. + +## The contract change + +In runvil-plugin-api/crates/runvil-plugin-sys/src/lib.rs, verb 7 leaves the reserved list (8 stays reserved) and the version becomes 0.7: + +```rust +pub const RV_PACK_RENDER: RvVerb = 7; + +#[repr(C)] +pub struct RvPackRenderArgs { + pub size: u32, + pub reserved: u32, + pub ctx: *mut c_void, + pub entry: RvStr, // the section entry, Lua's sys.id + pub model: RvStr, // JSON object of the model's facts + pub offered: *const RvToolInfo, // the tools the section offered from this Pack, in one set + pub offered_len: usize, + pub refuse: unsafe extern "C" fn(ctx: *mut c_void, reason: RvStr) -> RvStatus, + pub add_tool: unsafe extern "C" fn(ctx: *mut c_void, info: *const RvToolInfo) -> RvStatus, +} +``` + +- **Call shape.** `call->pack_run` is the instance, as for `RV_TOOL_CALL`. The Plugin calls `add_tool` once for each tool the model should see, in order, and returns `RV_OK`. +- **Statuses.** + - `RV_ERR_UNSUPPORTED`: the Pack doesn't render, and the offered tools pass through. + - `refuse`, at most once, with a reason of at most `RV_MAX_LINE` bytes, returns `RV_ERR_REFUSED`: the render failed. It has the same form as `refuse` in `RvPackNewArgs`. + - Any other status, or a misuse, also fails the render. A failed render fails the round that asked for it. +- **Rules.** It returns promptly, with no I/O and no blocking, like `RV_PACK_NEW`. It may come on any thread, beside tool calls of the same instance, and never beside `RV_PACK_DELETE`. Everything it is lent is valid for the call only. +- **What each offered tool holds.** `name` is the tool's name without the Pack id. `wire_name` is empty when the Host derives it. `parameters` is the Host's own JSON text of the schema, which can differ in spacing and key order from the text the Plugin gave `RV_PACK_NEW`. `flags` are the catalog's. +- **Sets.** The Host sends the verb once for each set the section offered the Pack into, the Static Set and the Dynamic Set, so a section entry sends it once or twice. Both get the same `entry` and `model`. +- **Model facts as JSON.** Keys: `server`, `name`, `description`, `context`, `thinking` (`never`, `always`, `switchable`), and `provider` when the catalog names one. New facts become new keys, with no struct change. For a model outside the Host's catalog, `thinking` is `never`. +- **Names.** A returned name that matches an offered one is that catalog tool, and it keeps the offered parameters. Any other name is a model-facing tool, which takes the flags the render gives it. A returned name that is a catalog tool the section did not offer fails the round. +- **No change to `RV_TOOL_CALL`.** The tool name already says which schema the arguments follow. + +## Repository order + +```mermaid +flowchart LR + api[plugin-api] --> harness + api --> std[plugin-std] + api --> bash[plugin-bashkit] + api --> web[plugin-web] + harness --> workshop + std --> workshop + bash --> workshop + web --> workshop + workshop --> runvil + harness --> docs + api --> classroom +``` + +Each repository pins the one before it by commit, so each wave waits for the previous wave's merge. The four repositories in wave 2 run in parallel. + +**The contract commit.** Every repository that names the contract uses one commit id of `runvil-plugin-api`: the Harness, the three Plugins, and Workshop's SDK line. `runvil-plugin-sys` sets `links`, so Cargo refuses two commits of the contract in one build. The id is recorded once, after wave 1 merges. If `runvil-plugin-api` gets another commit after that, all five are pinned again. + +## Wave 3: runvil-workshop + +Two commits. + +- **Commit 1, `Add the plan for the pin of contract 0.7`.** Workshop's part of this plan under `plan/`. +- **Commit 2, `Pin the Harness, the SDK, and the Plugins at contract 0.7`.** In runvil-workshop/Cargo.toml: the three Harness lines and the three Plugin lines, each `rev` read from that repository's `upstream/master`; the SDK line, with `rev` set to the contract commit; and the comment that says "version 0.6". Also `Cargo.lock`, and whatever `deny.toml` and the `harness_pin` check name. +- Verify with Workshop's `AGENTS.md` commands.