diff --git a/Cargo.lock b/Cargo.lock index f15c30f0..8c0b9fd2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1379,7 +1379,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -1606,7 +1606,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -1882,17 +1882,24 @@ dependencies = [ [[package]] name = "gateway-client" version = "0.1.0" -source = "git+https://github.com/cppalliance/gateway-client?rev=91e4685c4bdbd70cc89a10fa791e1a37641f728f#91e4685c4bdbd70cc89a10fa791e1a37641f728f" +source = "git+https://github.com/cppalliance/gateway-client?rev=5315394ac4e44c00f727e0e69789c34c6dfc86b5#5315394ac4e44c00f727e0e69789c34c6dfc86b5" dependencies = [ "bytes", - "libc", + "gateway-types", "reqwest", "serde", "serde_json", - "thiserror 2.0.19", "tokio", "url", - "windows-sys 0.61.2", +] + +[[package]] +name = "gateway-types" +version = "0.1.0" +source = "git+https://github.com/cppalliance/gateway-client?rev=5315394ac4e44c00f727e0e69789c34c6dfc86b5#5315394ac4e44c00f727e0e69789c34c6dfc86b5" +dependencies = [ + "serde", + "serde_json", ] [[package]] @@ -2020,8 +2027,8 @@ dependencies = [ "libc", "log", "rustversion", - "windows-link 0.1.3", - "windows-result 0.3.4", + "windows-link 0.2.1", + "windows-result 0.4.1", ] [[package]] @@ -2243,11 +2250,10 @@ dependencies = [ [[package]] name = "harness-gateway-client" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=a4c98668d7cc5ce67d57fb3e6623e385d3bbb144#a4c98668d7cc5ce67d57fb3e6623e385d3bbb144" +source = "git+https://github.com/cppalliance/runvil-harness?rev=018caab4f6acc9db871e8480eb82b9eb55ddc71b#018caab4f6acc9db871e8480eb82b9eb55ddc71b" dependencies = [ "gateway-client", "runvil", - "serde", "serde_json", "tokio", ] @@ -2255,7 +2261,7 @@ dependencies = [ [[package]] name = "harness-plugin-loader" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=a4c98668d7cc5ce67d57fb3e6623e385d3bbb144#a4c98668d7cc5ce67d57fb3e6623e385d3bbb144" +source = "git+https://github.com/cppalliance/runvil-harness?rev=018caab4f6acc9db871e8480eb82b9eb55ddc71b#018caab4f6acc9db871e8480eb82b9eb55ddc71b" dependencies = [ "libloading 0.8.9", "runvil-plugin", @@ -2266,9 +2272,10 @@ dependencies = [ [[package]] name = "harness-runner" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=a4c98668d7cc5ce67d57fb3e6623e385d3bbb144#a4c98668d7cc5ce67d57fb3e6623e385d3bbb144" +source = "git+https://github.com/cppalliance/runvil-harness?rev=018caab4f6acc9db871e8480eb82b9eb55ddc71b#018caab4f6acc9db871e8480eb82b9eb55ddc71b" dependencies = [ "futures-util", + "gateway-types", "harness-plugin-loader", "rand 0.9.5", "runvil-engine", @@ -3426,7 +3433,7 @@ dependencies = [ "png 0.18.1", "serde", "thiserror 2.0.19", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -3504,7 +3511,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -4042,7 +4049,7 @@ dependencies = [ [[package]] name = "plugin-mcp" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=a4c98668d7cc5ce67d57fb3e6623e385d3bbb144#a4c98668d7cc5ce67d57fb3e6623e385d3bbb144" +source = "git+https://github.com/cppalliance/runvil-harness?rev=018caab4f6acc9db871e8480eb82b9eb55ddc71b#018caab4f6acc9db871e8480eb82b9eb55ddc71b" dependencies = [ "futures-util", "reqwest", @@ -4363,7 +4370,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -4712,7 +4719,7 @@ dependencies = [ [[package]] name = "runvil" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=a4c98668d7cc5ce67d57fb3e6623e385d3bbb144#a4c98668d7cc5ce67d57fb3e6623e385d3bbb144" +source = "git+https://github.com/cppalliance/runvil-harness?rev=018caab4f6acc9db871e8480eb82b9eb55ddc71b#018caab4f6acc9db871e8480eb82b9eb55ddc71b" dependencies = [ "harness-plugin-loader", "harness-runner", @@ -4723,10 +4730,10 @@ dependencies = [ [[package]] name = "runvil-engine" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=a4c98668d7cc5ce67d57fb3e6623e385d3bbb144#a4c98668d7cc5ce67d57fb3e6623e385d3bbb144" +source = "git+https://github.com/cppalliance/runvil-harness?rev=018caab4f6acc9db871e8480eb82b9eb55ddc71b#018caab4f6acc9db871e8480eb82b9eb55ddc71b" dependencies = [ + "gateway-types", "runvil-lua", - "runvil-model-client", "runvil-prompt", "runvil-runtime", "runvil-types", @@ -4736,11 +4743,11 @@ dependencies = [ [[package]] name = "runvil-lua" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=a4c98668d7cc5ce67d57fb3e6623e385d3bbb144#a4c98668d7cc5ce67d57fb3e6623e385d3bbb144" +source = "git+https://github.com/cppalliance/runvil-harness?rev=018caab4f6acc9db871e8480eb82b9eb55ddc71b#018caab4f6acc9db871e8480eb82b9eb55ddc71b" dependencies = [ + "gateway-types", "mlua", "runvil-markdown", - "runvil-model-client", "runvil-types", "runvil-vfs", "serde", @@ -4750,7 +4757,7 @@ dependencies = [ [[package]] name = "runvil-markdown" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=a4c98668d7cc5ce67d57fb3e6623e385d3bbb144#a4c98668d7cc5ce67d57fb3e6623e385d3bbb144" +source = "git+https://github.com/cppalliance/runvil-harness?rev=018caab4f6acc9db871e8480eb82b9eb55ddc71b#018caab4f6acc9db871e8480eb82b9eb55ddc71b" dependencies = [ "pulldown-cmark", "serde", @@ -4758,20 +4765,10 @@ dependencies = [ "serde_yaml_ng", ] -[[package]] -name = "runvil-model-client" -version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=a4c98668d7cc5ce67d57fb3e6623e385d3bbb144#a4c98668d7cc5ce67d57fb3e6623e385d3bbb144" -dependencies = [ - "runvil-types", - "serde", - "serde_json", -] - [[package]] name = "runvil-plugin" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=a4c98668d7cc5ce67d57fb3e6623e385d3bbb144#a4c98668d7cc5ce67d57fb3e6623e385d3bbb144" +source = "git+https://github.com/cppalliance/runvil-harness?rev=018caab4f6acc9db871e8480eb82b9eb55ddc71b#018caab4f6acc9db871e8480eb82b9eb55ddc71b" dependencies = [ "runvil-types", "runvil-vfs", @@ -4794,7 +4791,7 @@ source = "git+https://github.com/cppalliance/runvil-plugin-api?rev=450afa2d3b0d7 [[package]] name = "runvil-prompt" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=a4c98668d7cc5ce67d57fb3e6623e385d3bbb144#a4c98668d7cc5ce67d57fb3e6623e385d3bbb144" +source = "git+https://github.com/cppalliance/runvil-harness?rev=018caab4f6acc9db871e8480eb82b9eb55ddc71b#018caab4f6acc9db871e8480eb82b9eb55ddc71b" dependencies = [ "pulldown-cmark", "runvil-lua", @@ -4807,13 +4804,13 @@ dependencies = [ [[package]] name = "runvil-runtime" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=a4c98668d7cc5ce67d57fb3e6623e385d3bbb144#a4c98668d7cc5ce67d57fb3e6623e385d3bbb144" +source = "git+https://github.com/cppalliance/runvil-harness?rev=018caab4f6acc9db871e8480eb82b9eb55ddc71b#018caab4f6acc9db871e8480eb82b9eb55ddc71b" dependencies = [ + "gateway-types", "mlua", "regex", "runvil-lua", "runvil-markdown", - "runvil-model-client", "runvil-prompt", "runvil-types", "runvil-vfs", @@ -4825,8 +4822,9 @@ dependencies = [ [[package]] name = "runvil-types" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=a4c98668d7cc5ce67d57fb3e6623e385d3bbb144#a4c98668d7cc5ce67d57fb3e6623e385d3bbb144" +source = "git+https://github.com/cppalliance/runvil-harness?rev=018caab4f6acc9db871e8480eb82b9eb55ddc71b#018caab4f6acc9db871e8480eb82b9eb55ddc71b" dependencies = [ + "gateway-types", "serde", "serde_json", "sha2 0.11.0", @@ -4835,7 +4833,7 @@ dependencies = [ [[package]] name = "runvil-vfs" version = "0.3.0" -source = "git+https://github.com/cppalliance/runvil-harness?rev=a4c98668d7cc5ce67d57fb3e6623e385d3bbb144#a4c98668d7cc5ce67d57fb3e6623e385d3bbb144" +source = "git+https://github.com/cppalliance/runvil-harness?rev=018caab4f6acc9db871e8480eb82b9eb55ddc71b#018caab4f6acc9db871e8480eb82b9eb55ddc71b" [[package]] name = "rust-embed" @@ -4927,7 +4925,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -4984,7 +4982,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -5574,7 +5572,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -5666,7 +5664,7 @@ dependencies = [ "cfg-if", "libc", "psm", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -6265,7 +6263,7 @@ dependencies = [ "getrandom 0.4.3", "once_cell", "rustix 1.1.4", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -6730,7 +6728,7 @@ dependencies = [ "png 0.18.1", "serde", "thiserror 2.0.19", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -6981,7 +6979,7 @@ checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" dependencies = [ "memoffset", "tempfile", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -7470,7 +7468,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index ff82404c..762f758e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,9 +25,9 @@ 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 = "a4c98668d7cc5ce67d57fb3e6623e385d3bbb144" } -harness-gateway-client = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "a4c98668d7cc5ce67d57fb3e6623e385d3bbb144" } -plugin-mcp = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "a4c98668d7cc5ce67d57fb3e6623e385d3bbb144" } +runvil = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "018caab4f6acc9db871e8480eb82b9eb55ddc71b" } +harness-gateway-client = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "018caab4f6acc9db871e8480eb82b9eb55ddc71b" } +plugin-mcp = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "018caab4f6acc9db871e8480eb82b9eb55ddc71b" } # 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 diff --git a/crates/workshop/agents/agents/chat.md b/crates/workshop/agents/agents/chat.md index 7796d176..e6536db0 100644 --- a/crates/workshop/agents/agents/chat.md +++ b/crates/workshop/agents/agents/chat.md @@ -17,38 +17,9 @@ tools.offer("std") tools.offer("bash") tools.offer("web") tools.offer(tools.packs.extras()) -local function compact(reason) - local first = 1 - while messages[first] and messages[first].role == "system" do - first = first + 1 - end - local cut, turns = first, 0 - for i = #messages, first, -1 do - if messages[i].role == "user" then - turns = turns + 1 - if turns == 2 then cut = i break end - end - end - if cut == first then return compactors.fail(reason) end - local lines, room = {}, 48000 - for i = cut - 1, first, -1 do - local text = json.encode(messages[i].content) - if #text > 1500 then text = text:sub(1, utf8.offset(text, 0, 1501) - 1) end - local line = messages[i].role .. ": " .. text - if #line > room then break end - room = room - #line - table.insert(lines, 1, line) - end - local summary = models.infer("Summarize this conversation:\n" .. table.concat(lines, "\n")) - messages:replace(first, cut - 1, { - role = "user", - content = "Summary of the earlier conversation: " .. summary, - meta = { summary = true }, - }) -end --messages:system("Runvil prompting language documentation can be found in /_runvil/language-guide") while true do messages:user(tasks.receive()) - pcall(function() return models.loop(compact) end) + pcall(models.loop) end ``` diff --git a/crates/workshop/server/src/agents.rs b/crates/workshop/server/src/agents.rs index f3023c5a..d805d5bc 100644 --- a/crates/workshop/server/src/agents.rs +++ b/crates/workshop/server/src/agents.rs @@ -768,9 +768,6 @@ fn live_pieces(conversation: Conversation) -> impl Fn(Round, HarnessDelta) + Sen let (kind, content) = match piece { HarnessDelta::Text(text) => (DeltaKind::Text, text), HarnessDelta::Reasoning(text) => (DeltaKind::Reasoning, text), - // The enum is non-exhaustive across the crate seam; any other - // piece has no delta kind and stays unshown. - _ => return, }; conversation.publish_delta(round.id, kind, content); } diff --git a/crates/workshop/server/src/agents/broker-tests.rs b/crates/workshop/server/src/agents/broker-tests.rs index 9bd0f5a9..c7f72732 100644 --- a/crates/workshop/server/src/agents/broker-tests.rs +++ b/crates/workshop/server/src/agents/broker-tests.rs @@ -124,7 +124,7 @@ async fn round(broker: &WorkshopBroker) -> Result { .await?; match completion.result() { CompletionResult::Text(text) => Ok(text.clone()), - other => panic!("the round replies with text: {other:?}"), + other @ CompletionResult::ToolCalls(_) => panic!("the round replies with text: {other:?}"), } } @@ -152,7 +152,7 @@ async fn streamed_round(broker: &WorkshopBroker) -> (Result, Vec< .await; let reply = completion.map(|completion| match completion.result() { CompletionResult::Text(text) => text.clone(), - other => panic!("the round replies with text: {other:?}"), + other @ CompletionResult::ToolCalls(_) => panic!("the round replies with text: {other:?}"), }); let pieces = kept.lock().unwrap_or_else(PoisonError::into_inner).clone(); (reply, pieces) diff --git a/crates/workshop/server/src/agents/broker.rs b/crates/workshop/server/src/agents/broker.rs index dcc3aac9..177c60d3 100644 --- a/crates/workshop/server/src/agents/broker.rs +++ b/crates/workshop/server/src/agents/broker.rs @@ -129,12 +129,12 @@ impl InferenceBroker for WorkshopBroker { .catalog() .latest() .map_or_else(Vec::new, |push| push.models); - if let Some(pick_window) = - narrower_pick_window(&models, &pick, binding.context()) + if let Some(bound) = binding.context() + && let Some(pick_window) = narrower_pick_window(&models, &pick, bound) { tracing::warn!( pick_window, - binding_window = binding.context().get(), + binding_window = bound.get(), "the selected model's context window is smaller than the launch model's; \ the round is sent to the selected model anyway" );