use crate::AppModel;
use crate::cli_outbound::Cli;
use crate::keymap::InspectorTab;
use std::path::Path;
mod controls;
mod fork;
mod rail;
mod vms;
mod work;
pub(in crate::shell) use vms::build_transcript;
use super::ShellState;
pub fn tabs_and_content(
ui: &mut egui::Ui,
model: &mut AppModel,
state: &mut ShellState,
ws: &Path,
lernie: &Cli,
bl: &Cli,
) {
let active = model.inspector_tab();
super::row::peers(ui, |ui| {
for tab in InspectorTab::all() {
if ui
.selectable_label(tab == active, tab.label())
.on_hover_text(format!(
"{} Press ({}): the strip is (1) to (6) bare, Ctrl+1 to Ctrl+6 \
from inside the composer.",
tab_hint(tab),
tab.digit(),
))
.clicked()
{
model.select_tab(tab);
}
}
});
let Some(agent) = model.focused_agent() else {
ui.weak("select an agent to inspect");
return;
};
let focus = vms::Focus {
agent_id: agent.agent_id.clone(),
tip: agent.tip_oid.clone(),
state: agent.state,
};
let data = vms::tab_data(active, model, state, ws, &focus);
controls::per_tab_controls(
ui,
active,
model,
&mut state.inspector,
&data.steps,
lernie,
bl,
);
fork::seat(
ui,
model,
&mut state.inspector,
&fork::Seat {
ws: ws.to_path_buf(),
agent_id: focus.agent_id.clone(),
pin: data.pin.clone(),
},
lernie,
bl,
);
let follow = crate::inspector::render(ui, active, &data, &mut state.inspector.eph);
if let Some(child) = follow {
state.inspector.eph.notch_sel = None;
super::focus::conversation(model, state, ws, &child);
}
if active == InspectorTab::Config {
super::delete_agent::danger_row(ui, model, state, lernie, ws);
}
}
fn tab_hint(tab: InspectorTab) -> &'static str {
match tab {
InspectorTab::Transcript => {
"What was said: one line per delivered message, model reply, thinking \
block, tool call and tool result, each folding open to its full text."
}
InspectorTab::Steps => {
"One row per model call — how it ended, when, how many attempts and \
tokens — and a drill-in showing the exact bytes of each record."
}
InspectorTab::Inbox => {
"Messages deposited for this agent that it has not picked up yet. Scan \
is what delivers them."
}
InspectorTab::Files => {
"This agent's worktree, read-only: its goal, notes, skills and work \
products, with a preview of whichever file you pick."
}
InspectorTab::Config => {
"The config commit this conversation is frozen on, and what it says. \
Changing it is the ⚙ Config editors, or the model line above."
}
InspectorTab::Work => {
"What this workspace's agents have actually changed in the project they work \
in: every ball it holds, the files that ball's branch has touched, and each \
file's changes."
}
}
}