use super::World;
use crate::reply::transcript::{Block, Entry, EntryKind, Usage};
use crate::test_support::window::{said, seated};
fn entry(kind: EntryKind) -> Entry {
Entry {
name: "002-model-a.json".to_owned(),
raw: "{}".to_owned(),
kind,
}
}
fn call() -> [Entry; 2] {
[
entry(EntryKind::Model {
model_id: "model-a".to_owned(),
blocks: vec![Block::ToolUse {
id: "tu-1".to_owned(),
name: "bash".to_owned(),
input: "{\"command\":\"cargo test\"}".to_owned(),
}],
usage: Usage::new(),
}),
entry(EntryKind::ToolResult {
tool_use_id: "tu-1".to_owned(),
content: "Exit code: 0\ntest result: ok".to_owned(),
is_error: false,
}),
]
}
fn turn(name: &'static str, tail: Option<Entry>) -> World {
let mut model = seated();
model.transcript.entries = [said("op", "port it")]
.into_iter()
.chain(call())
.chain(tail)
.collect();
World { name, model }
}
pub(super) fn answered() -> World {
let answer = entry(EntryKind::Model {
model_id: "model-a".to_owned(),
blocks: vec![Block::Text("the suite is green".to_owned())],
usage: Usage::new(),
});
turn("answered", Some(answer))
}
pub(super) fn answering() -> World {
turn("answering", None)
}