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
46 changes: 24 additions & 22 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 = "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
runvil = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "64b085369f9432073f0baa9e40d9cbdbe0a720cd" }
harness-gateway-client = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "64b085369f9432073f0baa9e40d9cbdbe0a720cd" }
plugin-mcp = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "64b085369f9432073f0baa9e40d9cbdbe0a720cd" }
# The safe layer over the C Plugin contract, version 0.9, 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.8.0", git = "https://github.com/cppalliance/runvil-plugin-api", rev = "f2d42cc41b0f28f81ac73193f21c2eacfafc11d9" }
runvil-plugin-sdk = { version = "0.9.0", git = "https://github.com/cppalliance/runvil-plugin-api", rev = "4c10a7d4d26c11e6a3055c6f6c4b5657f1bf2faa" }
# 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 = "c3653768df3817a7140059c1de66195e51408b70", default-features = false }
std-plugin = { package = "plugin-std", version = "0.1.0", git = "https://github.com/cppalliance/runvil-plugin-std", rev = "d45fa9e1746ed1afa099dee9392925d819c475d6", 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 = "67cc930c47bedace9af648982f72b6e12c77ba08", default-features = false }
bashkit-plugin = { package = "plugin-bashkit", version = "0.1.0", git = "https://github.com/cppalliance/runvil-plugin-bashkit", rev = "f41b5002ae5a1412b04443236483ea6350197199", 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 = "a24f3400022e43f237319db89ec4454063ec859a", default-features = false }
web-plugin = { package = "plugin-web", version = "0.1.0", git = "https://github.com/cppalliance/runvil-plugin-web", rev = "0f2189478645a9d5ae892a13ab9b6879438ca794", 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
8 changes: 4 additions & 4 deletions crates/workshop/server/src/agents/broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ use harness_gateway_client::GatewayBroker;
use runvil::effect::Round;
use runvil::harness::{InferenceBroker, PieceSink};
use runvil::model::{
Completion, CompletionOptions, Message, ModelBinding, ModelCatalog, ToolSchema,
make_completion_error, phrase,
Completion, CompletionOptions, Message, ModelBinding, ModelCatalog, make_completion_error,
phrase,
};
use runvil::{BoxFuture, Error, ErrorCode};
use runvil::{BoxFuture, Error, ErrorCode, ToolInfo};
use serde_json::Value;
use workshop_menu::MenuHandles;
use workshop_registry::Registry;
Expand Down Expand Up @@ -111,7 +111,7 @@ impl InferenceBroker for WorkshopBroker {
&self,
binding: ModelBinding,
messages: Vec<Message>,
tools: Vec<ToolSchema>,
tools: Vec<Arc<ToolInfo>>,
mut options: CompletionOptions,
round: Round,
on_piece: Option<PieceSink>,
Expand Down
52 changes: 47 additions & 5 deletions crates/workshop/server/src/routes/prompts-tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ async fn a_full_frontmatter_prompt_answers_every_contract_section() {
{ "id": "poop" },
])
);
// The declaration is sent as JSON Schema: every object node writes
// `additionalProperties`, and `required` lists the fields a caller
// must send.
// The declaration is sent as JSON Schema under `input_schema`: every
// object node writes `additionalProperties`, and `required` lists the
// fields a caller must send.
assert_eq!(
json["args"],
json["input_schema"],
serde_json::json!({
"type": "object",
"properties": {
Expand Down Expand Up @@ -147,7 +147,7 @@ async fn a_prompt_without_args_yields_the_default_declaration() {
let (status, json) = post_contract(body).await;
assert_eq!(status, StatusCode::OK);
assert_eq!(
json["args"],
json["input_schema"],
serde_json::json!({
"type": "object",
"properties": {
Expand Down Expand Up @@ -208,4 +208,46 @@ async fn the_dto_serializes_absent_declarations_as_nulls() {
// Absent declarations serialize as explicit nulls, not missing keys.
assert!(json["max_tool_iterations"].is_null());
assert!(json["runvil"].is_null());
// Optional ToolInfo fields that the prompt leaves out are omitted.
for omitted in [
"title",
"read_only_hint",
"destructive_hint",
"idempotent_hint",
"open_world_hint",
] {
assert!(
json.get(omitted).is_none(),
"an unset {omitted} is omitted from the flattened ToolInfo: {json}"
);
}
}

#[tokio::test]
async fn title_and_annotations_flatten_onto_the_contract_through_tool_info() {
let text = r"---
name: annotated
title: Paper Screener
description: screens a submission
annotations:
readOnlyHint: true
destructiveHint: false
idempotentHint: true
openWorldHint: false
---

## S

p
";
let body = serde_json::json!({ "name": "annotated", "text": text });
let (status, json) = post_contract(body).await;
assert_eq!(status, StatusCode::OK);
assert_eq!(json["name"], "annotated");
assert_eq!(json["title"], "Paper Screener");
assert_eq!(json["description"], "screens a submission");
assert_eq!(json["read_only_hint"], true);
assert_eq!(json["destructive_hint"], false);
assert_eq!(json["idempotent_hint"], true);
assert_eq!(json["open_world_hint"], false);
}
Loading
Loading