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
29 changes: 15 additions & 14 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 = "c581ba338e39fe84b98a7200bd56c2cf147c7d59" }
harness-gateway-client = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "c581ba338e39fe84b98a7200bd56c2cf147c7d59" }
plugin-mcp = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "c581ba338e39fe84b98a7200bd56c2cf147c7d59" }
runvil = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "f87bfbf5155dae6b8b6ed2752b29fb91ac29c182" }
harness-gateway-client = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "f87bfbf5155dae6b8b6ed2752b29fb91ac29c182" }
plugin-mcp = { version = "0.3.0", git = "https://github.com/cppalliance/runvil-harness", rev = "f87bfbf5155dae6b8b6ed2752b29fb91ac29c182" }
# The safe layer over the C Plugin contract, version 0.6, 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
13 changes: 8 additions & 5 deletions crates/workshop/agents/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@ rand.workspace = true
serde.workspace = true
serde_json.workspace = true
thiserror.workspace = true
# `sync` for the conversation's broadcasts and state watch; `time` for the
# timer every run sleeps on; `rt` for the blocking pool a conversation
# parses its agent on.
tokio = { workspace = true, features = ["rt", "sync", "time"] }
# `sync` for the conversation's broadcasts and state watch; `rt` for the
# blocking pool a conversation parses its agent on.
tokio = { workspace = true, features = ["rt", "sync"] }
tracing.workspace = true

[dev-dependencies]
# The stock tokio timer that the fixture Host of the conversation suite
# sleeps on.
harness-gateway-client.workspace = true
# The discovery suite seeds an agents directory on disk.
tempfile.workspace = true
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
# `time` for the deadline the conversation suite sets on each wait.
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "time"] }

[lints]
workspace = true
11 changes: 5 additions & 6 deletions crates/workshop/agents/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//! workshop-agents - Workshop's agent conversations: the conversation
//! table keyed by a Workshop-minted id, each conversation's transcript,
//! state, and failure reports, the operator's messages to its run,
//! discovery over the agents folder with the built-in `chat` agent, the
//! Host's timer, and the recorder tee every run of a conversation writes
//! through.
//! discovery over the agents folder with the built-in `chat` agent, and
//! the recorder tee every run of a conversation writes through.
//!
//! A conversation is one launched agent and its one run. The server
//! builds that run's `RunSetup` around the recorder tee the
Expand All @@ -23,7 +22,9 @@
//! service crates (`workshop-gateway`, `workshop-menu`,
//! `workshop-status`), `runvil`, the one crate a Host depends on for
//! the Harness and the Engine, and third-party crates; today it names
//! none of the Workshop crates. Never on `workshop-server`, another
//! none of the Workshop crates. Its tests also name
//! `harness-gateway-client`, the Harness's second public crate, for
//! the stock tokio timer. Never on `workshop-server`, another
//! feature crate, an Engine crate, or a private Harness or Gateway
//! crate.
//! `cargo test -p build-xtask` enforces the product and container
Expand All @@ -41,12 +42,10 @@ mod protocol;
mod state;
mod table;
mod tee;
mod timer;
mod transcript;

pub use conversation::Conversation;
pub use discovery::{BUILTIN_CHAT_SOURCE, LaunchError, discover_agents, load_agent};
pub use protocol::{ConversationId, Delta, DeltaKind, SessionEvent};
pub use state::{FailureKind, SessionFailure, SessionState};
pub use table::Conversations;
pub use timer::TokioTimer;
20 changes: 0 additions & 20 deletions crates/workshop/agents/src/timer.rs

This file was deleted.

25 changes: 7 additions & 18 deletions crates/workshop/agents/tests/it/support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

use std::sync::Arc;

use runvil::harness::{MemoryRecorder, OfflineBroker, Packs};
use harness_gateway_client::TokioTimer;
use runvil::harness::{FindTextPrompt, MemoryRecorder, OfflineBroker, Packs};
use runvil::plugin::PackRegistry;
use runvil::{Error, ErrorCode, Host, RunSetup};
use workshop_agents::{Conversation, TokioTimer};
use runvil::{Host, RunSetup};
use workshop_agents::Conversation;

/// The name the fixture Host finds its one agent by.
pub(crate) const AGENT: &str = "fixture";
Expand All @@ -30,22 +31,10 @@ pub(crate) fn run_for(
) -> (Arc<Host>, RunSetup) {
let host = Arc::new(Host {
packs: Packs::new(PackRegistry::new()),
prompts: Arc::new(move |name: &str| {
if name == AGENT {
return Ok(source.clone());
}
let code = ErrorCode::NotFound;
Err(Error::new(
code,
format!("no agent named {name}"),
code.prose(),
))
}),
prompts: Arc::new(FindTextPrompt::new(AGENT, source)),
timer: Arc::new(TokioTimer),
});
let setup = RunSetup {
has_user: true,
..RunSetup::new(conversation.recorder(recorder), Arc::new(OfflineBroker))
};
let setup =
RunSetup::new(conversation.recorder(recorder), Arc::new(OfflineBroker)).has_user(true);
(host, setup)
}
24 changes: 13 additions & 11 deletions crates/workshop/server/src/agents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
//! with the file-tool Pack, the bashkit Plugin with the shell Pack, and
//! the web Plugin with the web Pack among them, and the built-ins
//! subagents and user; a finder that reads each agent from the agents
//! folder through `load_agent`; and the tokio timer. Every tool call of a
//! folder through `load_agent`; and the stock tokio timer of the Gateway
//! client. Every tool call of a
//! library Plugin is lent the server's [`resources`]: the Gateway the
//! registry holds as the call starts, which is where the web Pack sends a
//! search. Each launch opens a conversation in `workshop-agents` and builds
Expand All @@ -30,9 +31,9 @@
//! off. The filesystem has no policy of its own, so the default one,
//! `AllowAll`, admits every operation: the file tools and the shell change
//! the files of the in-memory root, which end with the run, and a
//! read-only mount refuses each change. The run's setup carries the Host
//! state ([`bindings`]): the menu's pick and the workspace's granted
//! roots, read once the menu's catalog holds a chat-capable model.
//! read-only mount refuses each change. The run's setup takes the Host
//! state ([`bindings`]): the menu's pick, read once the menu's catalog
//! holds a chat-capable model.
//! Status-bar reporting stays in the server (`status`): a
//! per-conversation reporter derives it from the conversation's events,
//! deltas, and failure reports.
Expand All @@ -59,14 +60,15 @@ use std::io;
use std::path::{Path, PathBuf};
use std::sync::Arc;

use harness_gateway_client::{GatewayEndpoint, SecretString, provide_gateway_resources};
use harness_gateway_client::{
GatewayEndpoint, SecretString, TokioTimer, provide_gateway_resources,
};
use runvil::harness::{HostResources, Packs, PluginReport, RunId, insert_plugin_dir};
use runvil::plugin::PackRegistry;
use runvil::{Error, ErrorCode, ErrorFact, Host, RunSetup};
use serde_json::Value;
use workshop_agents::{
Conversation, ConversationId, Conversations, LaunchError, TokioTimer, discover_agents,
load_agent,
Conversation, ConversationId, Conversations, LaunchError, discover_agents, load_agent,
};
use workshop_gateway::GatewayHandles;
use workshop_registry::Registry;
Expand Down Expand Up @@ -369,7 +371,7 @@ struct Inner {
broker: WorkshopBroker,
/// What every run shares: the installed Packs each run makes its
/// instances of, the finder that reads each agent from the agents
/// folder, and the tokio timer.
/// folder, and the stock tokio timer.
host: Arc<Host>,
/// What the Plugin directory loaded, held so that a library Plugin
/// which inserted no Pack still stays loaded for as long as the
Expand Down Expand Up @@ -406,19 +408,19 @@ impl AgentSessions {
config.agents.plugins.as_deref(),
);
let agents_path = config.agents.path.clone();
let host = Host {
let host = Arc::new(Host {
packs,
prompts: Arc::new(agent_finder(agents_path.clone())),
timer: Arc::new(TokioTimer),
};
});
Self {
inner: Arc::new(Inner {
agents_path,
recorder: Arc::new(TursoRecorder::new(
config.server.state_dir.join(HARNESS_STATE_DIR),
)),
broker: WorkshopBroker::new(registry.clone()),
host: Arc::new(host),
host,
_plugins: plugins,
conversations: Conversations::new(),
registry,
Expand Down
3 changes: 2 additions & 1 deletion crates/workshop/server/src/agents/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::time::Duration;

use harness_gateway_client::TokioTimer;
use runvil::harness::{HostResources, MemoryRecorder, OfflineBroker, Packs, PluginSource};
use runvil::plugin::PackRegistry;
use runvil::vfs::{Origin, VfsRef};
use runvil::{Error, ErrorCode, ErrorFact, Host, RunSetup};
use serde_json::json;
use workshop_agents::{Conversations, SessionState, TokioTimer, load_agent};
use workshop_agents::{Conversations, SessionState, load_agent};
use workshop_registry::Registry;

use super::{
Expand Down
Loading