use std::collections::BTreeMap;
mod science;
mod steps;
mod workdiff;
use super::super::super::super::Reply;
use super::preview;
use crate::files_view::{FileEntry, FilesView, Preview};
use crate::git_tree::AgentState;
use crate::inboxview::{Deposit, Epitaph, InboxEntry};
use crate::rail::{ChildCard, Notch, Place, Rail};
use crate::steps_view::{Orphan, StepsView};
use crate::transcript::{Block, Entry, EntryKind, Transcript};
use science::science;
use steps::{step_detail, steps};
use workdiff::attempts;
fn transcript() -> Transcript {
let entry = |name: &str, kind| Entry {
name: name.into(),
raw: b"{}".to_vec(),
kind,
};
Transcript {
entries: vec![
entry(
"001-user.md",
EntryKind::Delivered {
sender: "user".into(),
epitaph: Some(Epitaph::BudgetExhausted),
body: "hello".into(),
},
),
entry(
"002-user.md",
EntryKind::Delivered {
sender: "user".into(),
epitaph: None,
body: String::new(),
},
),
entry(
"003-claude.json",
EntryKind::Model {
model_id: "opus".into(),
blocks: vec![
Block::Text("said".into()),
Block::Thinking("thought".into()),
Block::ToolUse {
id: "toolu_1".into(),
name: "Read".into(),
input_summary: "file".into(),
},
],
usage: BTreeMap::from([("input_tokens".to_owned(), 5_u64)]),
},
),
entry(
"004-tool.json",
EntryKind::ToolResult {
tool_use_id: "toolu_1".into(),
content: "out".into(),
is_error: true,
},
),
entry(
"streaming",
EntryKind::Streaming {
thinking: "...".into(),
text: "partial".into(),
},
),
entry(
"«006–008»",
EntryKind::Compacted {
first: 6,
last: 8,
summary: "what the compactor cut".into(),
},
),
entry("005-junk.json", EntryKind::Raw),
],
}
}
fn rail() -> Rail {
Rail {
notches: vec![
Notch {
seq: "001".into(),
commit: Some("abcdef1234567890".into()),
budget: 120,
place: Some(Place {
row: "003-claude.json".into(),
cut: 2,
}),
},
Notch {
seq: "002".into(),
commit: None,
budget: 120,
place: None,
},
],
cards: vec![
ChildCard {
agent_id: "c-1-a".into(),
name: "Cobalt".into(),
fork: "from here".into(),
state: AgentState::Live,
tokens: 9,
tail: Some("working".into()),
provenance_notch: 0,
},
ChildCard {
agent_id: "c-1-b".into(),
name: "Dun".into(),
fork: "from config/main".into(),
state: AgentState::Stopped,
tokens: 0,
tail: None,
provenance_notch: 1,
},
],
}
}
fn inbox() -> Vec<InboxEntry> {
vec![
InboxEntry {
name: "user-001.md".into(),
raw: b"---\nfrom: user\n---\nhi".to_vec(),
deposit: Deposit {
sender: Some("user".into()),
deposited_at: Some("t0".into()),
epitaph: Some(Epitaph::Unknown("sideways".into())),
terminal_ref: Some("refs/x".into()),
body: "hi".into(),
},
},
InboxEntry {
name: "raw.md".into(),
raw: b"bare".to_vec(),
deposit: Deposit::default(),
},
]
}
pub(super) fn inspector() -> Vec<Reply> {
vec![
Reply::WorkDiff {
attempts: attempts(),
patch: Some(preview()),
},
Reply::WorkDiff {
attempts: vec![],
patch: None,
},
Reply::Science(science()),
Reply::Science(vec![]),
Reply::Transcript(transcript()),
Reply::Follow(crate::git_tree::Stream::default()),
Reply::Follow(crate::git_tree::Stream {
thinking: Some("first I".into()),
text: None,
last_delta: Some(crate::git_tree::Delta::Thinking),
}),
Reply::Follow(crate::git_tree::Stream {
thinking: Some("first I".into()),
text: Some("then this".into()),
last_delta: Some(crate::git_tree::Delta::Text),
}),
Reply::Steps(steps()),
Reply::Steps(StepsView {
steps: vec![],
orphan: Orphan::Mute(crate::steps_view::Tail::ToolWindow),
}),
Reply::Steps(StepsView::default()),
Reply::Step(step_detail()),
Reply::Files {
view: FilesView::Present {
entries: vec![FileEntry {
rel_path: "src/a.rs".into(),
size: 12,
is_dir: false,
}],
truncated: true,
},
preview: Some(Preview::Text("body".into())),
},
Reply::Files {
view: FilesView::AbsentWorktree,
preview: Some(Preview::Binary { size: 4 }),
},
Reply::Rail(rail()),
Reply::Inbox(inbox()),
]
}