use std::collections::BTreeMap;
mod rail;
mod science;
mod steps;
mod workdiff;
use super::super::super::super::Reply;
use super::preview;
use crate::files_view::{FileEntry, FilesView, Preview};
use crate::inboxview::{Deposit, Epitaph, InboxEntry};
use crate::login::auth::AuthFailure;
use crate::steps_view::{Orphan, StepsView, Wound};
use crate::transcript::{Block, Entry, EntryKind, Transcript};
use rail::rail;
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-20260814T000000Z-ab12.md",
EntryKind::Delivered {
sender: "20260814T000000Z-ab12".into(),
sender_name: Some("DulcetMongoose".into()),
epitaph: Some(Epitaph::BudgetExhausted),
body: "hello".into(),
},
),
entry(
"002-user.md",
EntryKind::Delivered {
sender: "user".into(),
sender_name: None,
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(
"«wound»",
EntryKind::Wounded {
wound: Wound::Refused(AuthFailure::Row("anthropic".into())),
},
),
entry(
"«wound»",
EntryKind::Wounded {
wound: Wound::Refused(AuthFailure::Unrouted),
},
),
entry(
"«wound»",
EntryKind::Wounded {
wound: Wound::Spoke("the adapter's last words".into()),
},
),
entry("«wound»", EntryKind::Wounded { wound: Wound::Mute }),
entry(
"«wound»",
EntryKind::Wounded {
wound: Wound::OutputLimit,
},
),
entry("005-junk.json", EntryKind::Raw),
],
}
}
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()),
from_name: Some("DulcetMongoose".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::boundary::reply::FollowFrame::default()),
Reply::Follow(crate::boundary::reply::FollowFrame {
stream: crate::git_tree::Stream {
thinking: Some("first I".into()),
text: None,
last_delta: Some(crate::git_tree::Delta::Thinking),
},
tools: vec![],
}),
Reply::Follow(crate::boundary::reply::FollowFrame {
stream: crate::git_tree::Stream {
thinking: Some("first I".into()),
text: Some("then this".into()),
last_delta: Some(crate::git_tree::Delta::Text),
},
tools: vec![
crate::git_tree::ToolEvent {
tool_use: "toolu_01".into(),
name: Some("box2_Bash".into()),
input: Some("{\"command\":\"hostname && uptime\"}".into()),
exit_code: None,
held: None,
},
crate::git_tree::ToolEvent {
tool_use: "toolu_01".into(),
exit_code: Some(0),
..crate::git_tree::ToolEvent::default()
},
],
}),
Reply::Follow(crate::boundary::reply::FollowFrame {
stream: crate::git_tree::Stream::default(),
tools: vec![crate::git_tree::ToolEvent {
tool_use: "toolu_02".into(),
name: Some("box2_service_status".into()),
held: Some(
"box2_service_status {} classified opaque (not a tool this control \
implements and its input carries no command line)"
.into(),
),
..crate::git_tree::ToolEvent::default()
}],
}),
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())),
working_dir: Some("/home/u/proj".into()),
},
Reply::Files {
view: FilesView::AbsentWorktree,
preview: Some(Preview::Binary { size: 4 }),
working_dir: None,
},
Reply::Rail(rail()),
Reply::Inbox(inbox()),
]
}