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
90 changes: 44 additions & 46 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 1 addition & 30 deletions crates/workshop/agents/agents/chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
3 changes: 0 additions & 3 deletions crates/workshop/server/src/agents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions crates/workshop/server/src/agents/broker-tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ async fn round(broker: &WorkshopBroker) -> Result<String, Error> {
.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:?}"),
}
}

Expand Down Expand Up @@ -152,7 +152,7 @@ async fn streamed_round(broker: &WorkshopBroker) -> (Result<String, Error>, 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)
Expand Down
Loading
Loading