Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

hn 0.1.44: C-b s grouped by machine and folder; no harness counts; username on the side bar (#2283)

lingrd8b92884c023d
diff --git a/tui/Cargo.lock b/tui/Cargo.lock
index ab4ed876e..2e201aadf 100644
--- a/tui/Cargo.lock
+++ b/tui/Cargo.lock
@@ -661,7 +661,7 @@ dependencies = [
[[package]]
name = "harness-tui"
-version = "0.1.43"
+version = "0.1.44"
dependencies = [
"alacritty_terminal",
"base64",
diff --git a/tui/Cargo.toml b/tui/Cargo.toml
index 30d796fe2..bce68c562 100644
--- a/tui/Cargo.toml
+++ b/tui/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "harness-tui"
-version = "0.1.43"
+version = "0.1.44"
edition = "2024"
[dependencies]
diff --git a/tui/src/account.rs b/tui/src/account.rs
index 7565c2f30..bb329c545 100644
--- a/tui/src/account.rs
+++ b/tui/src/account.rs
@@ -163,6 +163,15 @@ pub fn label(app: &App) -> &'static str {
if app.account.status == Status::SignedOut { "Sign in" } else { "Account" }
}
+/// The side bar's account button: whose account it is — the email's name, its domain left off
+/// (`tuan.dev` for [email protected]) — once the email is known, else [label].
+pub fn button(app: &App) -> String {
+ match &app.account.status {
+ Status::SignedIn { email: Some(email), .. } => email.split_once('@').map_or(email.as_str(), |(name, _)| name).to_string(),
+ _ => label(app).to_string(),
+ }
+}
+
pub fn open(app: &mut App) {
crate::input::picker(app, PickerKind::Account, "Your Harness account", "");
refresh(app, true);
@@ -709,6 +718,17 @@ mod tests {
crate::input::handle(app, Event::Key(KeyEvent::new(code, KeyModifiers::NONE)));
}
+ /// The side bar's account button says whose it is: the email's name, not its domain.
+ #[test]
+ fn the_account_button_says_the_username() {
+ let mut app = app();
+ assert_eq!(button(&app), "Sign in");
+ app.account.status = Status::SignedIn { offline: false, email: None };
+ assert_eq!(button(&app), "Account", "until the email is known");
+ app.account.status = Status::SignedIn { offline: false, email: Some("[email protected]".into()) };
+ assert_eq!(button(&app), "tuan.dev");
+ }
+
fn select(app: &mut App, id: &str) {
let Some(Modal::Picker { picker, .. }) = &mut app.modal else { panic!("account is not open") };
picker.select(id);
diff --git a/tui/src/bar_more.rs b/tui/src/bar_more.rs
index 75e6f1b17..4c245a32c 100644
--- a/tui/src/bar_more.rs
+++ b/tui/src/bar_more.rs
@@ -1,6 +1,6 @@
//! The status bar down a side, its footer: what tmux's status line shows on its right (the
-//! subscription left, the harnesses' counts, the daemon, where you are, the time), which has no
-//! line of its own while the bar stands in for it.
+//! subscription left, the daemon, where you are, the time), which has no line of its own while
+//! the bar stands in for it.
use ratatui::buffer::Buffer;
use ratatui::layout::Rect;
use ratatui::style::Style;
@@ -8,13 +8,12 @@ use ratatui::style::Style;
use crate::app::App;
use crate::theme;
-/// The footer's lines, each one thing: the daemon when it is down, the subscription left, the
-/// harnesses' counts on one line. (Where you are — the machine, which names the session too — is
-/// the bar's own heading, and the folder each pane's title: not said again.)
-const LINES: [&str; 3] = [
+/// The footer's lines, each one thing: the daemon when it is down, the subscription left. (Where
+/// you are — the machine, which names the session too — is the bar's own heading, and the folder
+/// each pane's title; the harnesses' states are their rows' marks: not said again.)
+const LINES: [&str; 2] = [
"#{?daemon_down,#[fg=red#,bold]daemon down#[default],}",
"#{?usage_remaining,#{usage_remaining_icons},}",
- "#{?fleet,#{s/ / /:fleet},}",
];
fn items(app: &App) -> Vec<String> {
@@ -69,6 +68,21 @@ mod tests {
app
}
+ /// Neither the bar's footer nor the status line counts the harnesses by state (`⠋1`): each
+ /// harness's row and window mark say how it is.
+ #[test]
+ fn no_harness_counts_by_the_subscription() {
+ let mut app = app();
+ app.fleet.merge_roster("local", &[serde_json::json!({"id": "a1", "name": "fix login", "engine": "claude"})]);
+ app.fleet.agents.values_mut().for_each(|a| a.working = true);
+ let counts = crate::format::expand(&app, "#{fleet}", app.active, app.focused(), true);
+ assert!(!counts.is_empty(), "a harness is working");
+ assert!(!items(&app).iter().any(|l| l.contains(&counts)), "{:?}", items(&app));
+ let right = app.options.get("status-right", "", None).unwrap_or_default();
+ let line = crate::format::expand(&app, &right, app.active, app.focused(), true);
+ assert!(!line.contains(&counts), "{line}");
+ }
+
/// The footer says one thing a line and nothing twice: the daemon when down (bold) — no machine,
/// session, path or time (the bar's heading has the machine, which names the session).
#[test]
diff --git a/tui/src/input.rs b/tui/src/input.rs
index 6c75ff465..687853979 100644
--- a/tui/src/input.rs
+++ b/tui/src/input.rs
@@ -815,6 +815,8 @@ fn fill_rows(app: &App, kind: &PickerKind, picker: &mut Picker) {
// Picker::refilter preserves the selected identity as rows arrive.
let mut recency: std::collections::HashMap<String,u64> = app.fleet.agents.values()
.map(|a| (format!("{}:{}",a.machine_id,a.id),a.recency())).collect();
+ // (One list by last activity: its harnesses not headed by where they work.)
+ for r in rows.iter_mut().filter(|r| recency.contains_key(&r.id)) { r.group = None }
for x in app.said.iter().chain(app.shell_context.catalog.iter()).filter_map(|s| s.external.as_ref()) {
let at = recency.entry(format!("external:{}:{}",x.machine,x.session_id)).or_default();
*at = (*at).max(x.last_at);
@@ -823,9 +825,10 @@ fn fill_rows(app: &App, kind: &PickerKind, picker: &mut Picker) {
.then_with(|| a.label.cmp(&b.label)).then_with(|| a.id.cmp(&b.id)));
picker.hold = None;
} else {
- // Workspace navigation holds its existing rows still; typing re-ranks.
+ // Workspace navigation holds its existing rows still; typing re-ranks. A harness
+ // that comes while it is open joins its machine and folder's heading.
match &picker.hold {
- Some(order) => { let at = |id: &str| order.iter().position(|o| o == id).unwrap_or(usize::MAX); rows.sort_by_key(|r| at(&r.id)) }
+ Some(order) => { let at = |id: &str| order.iter().position(|o| o == id).unwrap_or(usize::MAX); rows.sort_by_key(|r| at(&r.id)); rows = modal::grouped_in_order(rows) }
None => picker.hold = Some(rows.iter().map(|r| r.id.clone()).collect()),
}
}
@@ -3772,6 +3775,33 @@ pub fn menu_mouse(app: &mut App, m: &crate::mouse::Event) {
mod tests {
use super::*;
+ /// C-b s holds its rows still while open; a harness that comes meanwhile joins its machine and
+ /// folder's heading instead of starting the same heading again at the end.
+ #[test]
+ fn a_harness_coming_while_the_list_is_open_joins_its_heading() {
+ let (sink, _) = tokio::sync::mpsc::unbounded_channel();
+ let mut app = App::new(19813, sink, (120, 36));
+ app.fleet.local_id = "local".into();
+ app.fleet.machines.push(crate::fleet::Machine { shared: false, id: "local".into(), name: "studio".into(), local: true, status: "online".into(), reach: crate::fleet::Reach::Ready });
+ let folder = |name: &str| json!({"name": name, "cwd": format!("/src/{name}")});
+ app.fleet.merge_roster("local", &[
+ json!({"id": "a1", "name": "fix login", "engine": "claude", "project": folder("webapp"), "updatedAt": "2026-10-30T09:50:00.000Z"}),
+ json!({"id": "a2", "name": "rate limit", "engine": "codex", "project": folder("api"), "updatedAt": "2026-10-30T09:40:00.000Z"}),
+ ]);
+ let kind = PickerKind::Open { filter: crate::modal::Filter::All, machine: None, project: None };
+ let mut picker = Picker::new("", "");
+ fill(&app, &kind, &mut picker);
+ app.fleet.merge_roster("local", &[
+ json!({"id": "a1", "name": "fix login", "engine": "claude", "project": folder("webapp"), "updatedAt": "2026-10-30T09:50:00.000Z"}),
+ json!({"id": "a2", "name": "rate limit", "engine": "codex", "project": folder("api"), "updatedAt": "2026-10-30T09:40:00.000Z"}),
+ json!({"id": "a3", "name": "release notes", "engine": "claude", "project": folder("webapp"), "updatedAt": "2026-10-30T09:55:00.000Z"}),
+ ]);
+ fill(&app, &kind, &mut picker);
+ // (Its harnesses: other tests' sessions can be listed after them.)
+ let shown: Vec<(&str, &str)> = picker.rows.iter().filter(|r| !r.id.starts_with("session:")).map(|r| (r.group.as_deref().unwrap_or(""), r.label.as_str())).collect();
+ assert_eq!(shown, [("studio · webapp", "fix login"), ("studio · webapp", "release notes"), ("studio · api", "rate limit")]);
+ }
+
/// What the person typed into hn's own box is marked as theirs, as the desktop's composer marks
/// its own; the same text from a command (`broadcast`, `send-task`) never is. The Store's read says
/// a person opened it only when one did.
diff --git a/tui/src/modal.rs b/tui/src/modal.rs
index 7220c3a1a..7bc7d95bc 100644
--- a/tui/src/modal.rs
+++ b/tui/src/modal.rs
@@ -10,7 +10,7 @@ use crate::app::App;
use crate::terminal_themes::TERMINAL_THEMES;
use crate::fleet::{ago, Reach, State};
use crate::picker::{Picker, Row};
-use crate::theme::{self, engine_label, engine_mark, fg, state_mark};
+use crate::theme::{self, engine_label, engine_mark, fg};
/// Which harnesses a list shows. Only All is reachable from a key today.
#[allow(dead_code)]
@@ -270,51 +270,43 @@ fn span(text: impl Into<String>, style: Style) -> Span<'static> { Span::styled(t
#[derive(Clone, Debug, Default)]
pub struct PopupLook { pub lines: String, pub style: String, pub border_style: String }
+/// The folder a harness works in, as its group heading names it: its project, else the last
+/// part of where it works.
+fn folder_of(a: &crate::fleet::Agent) -> String {
+ if !a.project.is_empty() { return a.project.clone() }
+ std::path::Path::new(&a.cwd).file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_else(|| "No folder".into())
+}
+
pub fn agent_rows(app: &App, filter: Filter, machine: Option<&str>, project: Option<&str>) -> Vec<Row> {
- let many = app.fleet.visible_machines().filter(|m| m.usable()).count() > 1;
- // The project in each row when the harnesses work in more than one.
- let projects = { let mut p: Vec<&str> = app.fleet.agents.values().map(|a| a.project.as_str()).filter(|p| !p.is_empty()).collect(); p.sort(); p.dedup(); p.len() > 1 };
- let open: Vec<(String, String)> = app.panes.values().map(|p| (p.machine_id.clone(), p.agent_id.clone())).collect();
- // As the desktop's Cmd-P lists them ("Recently active"): the one active last first — a query
- // ranks by how well it matches, this order breaking ties. (C-b A lists those waiting on you.)
+ // By the time each row shows, the shortest first (the one that came to be as it is last) — a
+ // query ranks by how well it matches, this order breaking ties. (C-b A lists those waiting
+ // on you.)
+ let since = |a: &crate::fleet::Agent| a.state_since(app.fleet.state_of(a));
let mut agents: Vec<&crate::fleet::Agent> = app.fleet.agents.values().collect();
- agents.sort_by(|a, b| b.recency().cmp(&a.recency()).then_with(|| a.name.cmp(&b.name)).then_with(|| a.id.cmp(&b.id)));
- agents.into_iter()
+ agents.sort_by(|a, b| since(b).cmp(&since(a)).then_with(|| a.name.cmp(&b.name)).then_with(|| a.id.cmp(&b.id)));
+ let rows: Vec<Row> = agents.into_iter()
.filter(|a| machine.map(|m| a.machine_id == m).unwrap_or(true))
.filter(|a| project.map(|p| a.project_root == p || a.cwd == p).unwrap_or(true))
.filter(|a| filter.keeps(app.fleet.state_of(a)))
.map(|a| {
let state = app.fleet.state_of(a);
- let (dot, _, color) = state_mark(state, app.tick);
let (mark, mark_color) = engine_mark(&a.engine);
- // (No headings by state: the list is one, the one active last first — its mark says
- // what each is doing.)
- let is_open = open.contains(&a.key());
- // Its one line: the question it asks, what it is doing now, what its last turn came to,
- // why it failed — the rest in the finder's dim.
- let (line, loud) = match state {
- State::NeedsInput => (a.question.as_ref().map(|q| q.prompt.clone()).unwrap_or_default(), true),
- State::Working => (a.doing.clone().unwrap_or_else(|| "Working".into()), false),
- State::Done => (a.did.clone().unwrap_or_else(|| "Finished".into()), false),
- State::Failed => (Some(a.launch_error.clone()).filter(|e| !e.is_empty()).or_else(|| a.did.clone()).unwrap_or_else(|| "Failed to start".into()), true),
- State::Starting => ("Starting".into(), false),
- _ => (a.did.clone().unwrap_or_default(), false),
- };
- let quiet = matches!(state, State::Ready | State::Paused | State::Offline);
- // An idle one's line is where it works (its last turn in the preview).
- let line = if quiet && line.is_empty() { [a.project.clone(), a.branch.clone()].into_iter().filter(|s| !s.is_empty()).collect::<Vec<_>>().join(" ") } else { line };
- let detail = vec![span(line, if loud { fg(theme::ATTENTION) } else if quiet { fg(theme::MUTED) } else { Style::default() })];
- // Where it works and how long it has been as it is (waiting on you since its question,
- // working since its turn began, done since it ended).
+ // Headed by where it works — its machine and folder (the folder alone in one machine's
+ // list) — so a row is its agent's icon, its name, and how it is in a word by how long
+ // it has been so (`idle 15s`: waiting on you since its question, working since its turn
+ // began, done since it ended); what it is doing is in the preview. Only one waiting on
+ // you keeps its question in its row, as M-1…9 answer it from here with the preview
+ // hidden too.
+ let question = a.question.as_ref().filter(|_| state == State::NeedsInput).map(|q| q.prompt.clone()).unwrap_or_default();
+ let folder = folder_of(a);
+ let group = if machine.is_some() { folder } else { format!("{} · {folder}", app.fleet.machine_name(&a.machine_id)) };
let since = a.state_since(state);
- // Right: the machine (when there are several) and how long — the name and its line
- // come first; where it works is searchable and in the preview's title.
- // Its pull request, where it has one (what it cost is in the preview).
let pr = a.pr.as_ref().map(|p| p.label()).unwrap_or_default();
- let _ = is_open;
let narrow = ago(since);
- let right = [pr.clone(), if projects { a.project.clone() } else { String::new() }, if many { app.fleet.machine_name(&a.machine_id) } else { String::new() }, ago(since)]
- .into_iter().filter(|s| !s.is_empty()).collect::<Vec<_>>().join(" ");
+ let status = match state {
+ State::NeedsInput => "waiting", State::Failed => "failed", State::Done => "done", State::Working => "working",
+ State::Starting => "starting", State::Unknown => "unknown", State::Ready => "idle", State::Paused => "paused", State::Offline => "offline",
+ };
let live = !matches!(state, State::Paused | State::Offline);
// What a query finds it by besides its name: where it works, its engine, its pull
// request, and its state in words ('failed, 'done, 'waiting, 'working, 'idle).
@@ -325,17 +317,27 @@ pub fn agent_rows(app: &App, filter: Filter, machine: Option<&str>, project: Opt
// Its pull request's state in words too: 'pr, 'open, 'merged.
let pr_words = a.pr.as_ref().map(|p| format!("pr {}", p.state.to_lowercase())).unwrap_or_default();
Row::new(format!("{}:{}", a.machine_id, a.id), a.name.clone())
+ .group(group)
.boost(if state == State::NeedsInput { 60 } else if live { 30 } else { 0 })
- .extra(format!("{} {} {} {} {} {} {} {} {}", a.project, a.branch, app.fleet.machine_name(&a.machine_id), a.engine, engine_label(&a.engine), a.dsh, pr, pr_words, words))
- // What it is doing now and how long it has been as it is change as you look.
- .volatile(matches!(state, State::Working | State::Starting), narrow.chars().count())
- .lead(vec![span(dot, fg(color)), span(" ", Style::default()), span(mark, fg(mark_color)), span(" ", Style::default())])
- .detail(detail)
- .right(right)
- .right_narrow(narrow)
- .line_first(loud)
+ .extra(format!("{} {} {} {} {} {} {} {} {} {}", a.project, a.branch, a.cwd, app.fleet.machine_name(&a.machine_id), a.engine, engine_label(&a.engine), a.dsh, pr, pr_words, words))
+ // How long it has been as it is changes as you look.
+ .volatile(false, narrow.chars().count())
+ .lead(vec![span(mark, fg(mark_color)), span(" ", Style::default())])
+ .detail(vec![span(question, fg(theme::ATTENTION))])
+ .right(format!("{status} {narrow}"))
+ .line_first(true)
})
- .collect()
+ .collect();
+ grouped_in_order(rows)
+}
+
+/// [rows] with each group's rows together, in the order of each group's first row (the one
+/// active last's group first), each group's rows in their own order.
+pub fn grouped_in_order(mut rows: Vec<Row>) -> Vec<Row> {
+ let mut first: Vec<Option<String>> = Vec::new();
+ for r in &rows { if !first.contains(&r.group) { first.push(r.group.clone()) } }
+ rows.sort_by_key(|r| first.iter().position(|g| *g == r.group));
+ rows
}
/// The Claude Code and Codex conversations Harness did not start that C-b s's query found by what
@@ -878,6 +880,124 @@ pub fn route_rows(reply: &Value) -> Vec<Row> {
rows
}
+#[cfg(test)]
+mod agent_row_tests {
+ use super::*;
+ use crate::app::App;
+ use serde_json::json;
+
+ /// studio (this computer) and lab, harnesses in webapp and api on both, one with no folder.
+ fn app() -> App {
+ let (sink, _) = tokio::sync::mpsc::unbounded_channel();
+ let mut app = App::new(19789, sink, (150, 42));
+ app.fleet.local_id = "local".into();
+ for (id, name) in [("local", "studio"), ("lab", "lab")] {
+ app.fleet.machines.push(crate::fleet::Machine { shared: false, id: id.into(), name: name.into(), local: id == "local", status: "online".into(), reach: crate::fleet::Reach::Ready });
+ }
+ let at = |minute: u32| format!("2026-01-30T09:{minute:02}:00.000Z");
+ let in_folder = |name: &str| json!({"name": name, "cwd": format!("/src/{name}"), "branch": "main"});
+ app.fleet.merge_roster("local", &[
+ json!({"id": "a1", "name": "fix login", "engine": "claude", "project": in_folder("webapp"), "updatedAt": at(50)}),
+ json!({"id": "a2", "name": "rate limit", "engine": "codex", "project": in_folder("api"), "updatedAt": at(40)}),
+ json!({"id": "a3", "name": "release notes", "engine": "claude", "project": in_folder("webapp"), "updatedAt": at(30)}),
+ json!({"id": "a4", "name": "scratch", "engine": "claude", "updatedAt": at(5)}),
+ ]);
+ app.fleet.merge_roster("lab", &[
+ json!({"id": "b1", "name": "train", "engine": "codex", "project": in_folder("webapp"), "updatedAt": at(45)}),
+ json!({"id": "b2", "name": "ops shell", "engine": "terminal", "project": {"cwd": "/home/me/ops"}, "updatedAt": at(20)}),
+ ]);
+ app
+ }
+
+ fn by_group(rows: &[Row]) -> Vec<(String, Vec<String>)> {
+ let mut out: Vec<(String, Vec<String>)> = Vec::new();
+ for r in rows {
+ let g = r.group.clone().unwrap_or_default();
+ match out.last_mut() { Some((last, names)) if *last == g => names.push(r.label.clone()), _ => out.push((g, vec![r.label.clone()])) }
+ }
+ out
+ }
+
+ /// C-b s: one heading per machine and folder, the one active last first, each harness under its
+ /// own once (never a heading twice), its folder from where it works when it has no project.
+ #[test]
+ fn harnesses_are_grouped_by_machine_and_folder() {
+ let app = app();
+ let groups = by_group(&agent_rows(&app, Filter::All, None, None));
+ assert_eq!(groups, vec![
+ ("studio · webapp".to_string(), vec!["fix login".to_string(), "release notes".to_string()]),
+ ("lab · webapp".to_string(), vec!["train".to_string()]),
+ ("studio · api".to_string(), vec!["rate limit".to_string()]),
+ ("lab · ops".to_string(), vec!["ops shell".to_string()]),
+ ("studio · No folder".to_string(), vec!["scratch".to_string()]),
+ ]);
+ }
+
+ /// A row is its status, name and time: where it works is its heading, not said again in it.
+ #[test]
+ fn a_row_says_no_machine_or_folder() {
+ let mut app = app();
+ app.fleet.agents.get_mut(&("local".to_string(), "a1".to_string())).unwrap().pr = Some(crate::fleet::Pr { number: 4812, state: "Open".into(), url: String::new() });
+ let rows = agent_rows(&app, Filter::All, None, None);
+ let row = rows.iter().find(|r| r.label == "fix login").unwrap();
+ for word in ["studio", "webapp", "4812"] { assert!(!row.right.contains(word), "{word} in {:?}", row.right); }
+ assert!(row.detail.iter().all(|s| s.content.is_empty()), "{:?}", row.detail);
+ assert!(!row.right.is_empty(), "how long it has been as it is");
+ // Still found by where it works and its pull request.
+ assert!(row.extra.contains("studio") && row.extra.contains("webapp") && row.extra.contains("4812"), "{}", row.extra);
+ }
+
+ /// A harness waiting on you keeps its question in its row: M-1…9 answer it from the list, the
+ /// preview hidden or not.
+ #[test]
+ fn a_waiting_harness_keeps_its_question() {
+ let mut app = app();
+ app.fleet.agents.get_mut(&("local".to_string(), "a2".to_string())).unwrap().question = Some(crate::fleet::Question {
+ request_id: "r1".into(), answer_key: String::new(), prompt: "Use Redis?".into(), options: vec![], multi: false, since: std::time::Instant::now(),
+ });
+ let rows = agent_rows(&app, Filter::All, None, None);
+ let line = |name: &str| rows.iter().find(|r| r.label == name).unwrap().detail.iter().map(|s| s.content.to_string()).collect::<String>();
+ assert_eq!(line("rate limit"), "Use Redis?");
+ assert_eq!(line("fix login"), "");
+ }
+
+ /// A row leads with its agent's icon alone; how it is, in a word, comes before the time
+ /// (`idle 15s`), not as a mark.
+ #[test]
+ fn a_rows_status_is_a_word_by_its_time() {
+ let mut app = app();
+ app.fleet.agents.get_mut(&("local".to_string(), "a2".to_string())).unwrap().working = true;
+ let rows = agent_rows(&app, Filter::All, None, None);
+ let row = |name: &str| rows.iter().find(|r| r.label == name).unwrap();
+ let lead: String = row("fix login").lead.iter().map(|s| s.content.to_string()).collect();
+ assert_eq!(lead, format!("{} ", engine_mark("claude").0));
+ assert!(row("fix login").right.starts_with("idle "), "{}", row("fix login").right);
+ assert!(row("rate limit").right.starts_with("working "), "{}", row("rate limit").right);
+ assert!(row("rate limit").right.ends_with(&ago(app.fleet.agents[&("local".to_string(), "a2".to_string())].state_since(State::Working))));
+ }
+
+ /// The list goes by the time each row shows: the shortest first (a turn that just began
+ /// before one last active a while ago), and its heading with it.
+ #[test]
+ fn the_shortest_time_comes_first() {
+ let mut app = app();
+ let a2 = app.fleet.agents.get_mut(&("local".to_string(), "a2".to_string())).unwrap();
+ a2.working = true;
+ a2.since = crate::fleet::now_ms();
+ let groups = by_group(&agent_rows(&app, Filter::All, None, None));
+ assert_eq!(groups[0], ("studio · api".to_string(), vec!["rate limit".to_string()]));
+ assert_eq!(groups[1].0, "studio · webapp");
+ }
+
+ /// One machine's harnesses (from the machines list) are headed by their folder alone.
+ #[test]
+ fn one_machines_list_heads_by_folder() {
+ let app = app();
+ let groups: Vec<String> = by_group(&agent_rows(&app, Filter::All, Some("lab"), None)).into_iter().map(|(g, _)| g).collect();
+ assert_eq!(groups, ["webapp", "ops"]);
+ }
+}
+
#[cfg(test)]
mod theme_row_tests {
use super::*;
diff --git a/tui/src/options/mod.rs b/tui/src/options/mod.rs
index b9c30b311..8b941dd3f 100644
--- a/tui/src/options/mod.rs
+++ b/tui/src/options/mod.rs
@@ -100,12 +100,14 @@ pub fn defaults() -> &'static BTreeMap<String, String> {
// has it] when another window has the pane to type in, and its project and branch
// where there is room. Git context stays here; the status bar keeps the location cue.
m.insert("pane-border-format".into(), " #{pane_heading}#{?pane_where,#[align=right] #[dim]#{pane_where} #[nodim],}".into());
- // Window navigation on the left; connection, a model being got, quota, fleet, machine and
- // clock on the right. The quoted name is this computer's name in Harness, independent of focus.
+ // Window navigation on the left; connection, a model being got, quota, machine and clock
+ // on the right. (No harness counts: each window's mark and the harness list say them;
+ // #{fleet} is there for a format of your own.) The quoted name is this computer's name
+ // in Harness, independent of focus.
// One cell at each outer edge aligns status text with the pane surfaces.
// Two spaces separate the window list from the information on the right.
m.insert("status-left".into(), " #{?client_prefix,#[bold]›#[nobold] ,}".into());
- m.insert("status-right".into(), " #{?hn_controls,#{hn_controls} ,}#{?daemon_down,#[bold]daemon down#[nobold] ,}#{?model_progress,#{model_progress} ,}#{?usage_remaining,#{usage_remaining_mark} ,}#{?fleet,#{s/ / /:fleet} ,}#{?pane_watching,[watching] ,}#{?shell_context,#{=/36/…:shell_context},\"#{=/21/…:local_machine}\"} %H:%M ".into());
+ m.insert("status-right".into(), " #{?hn_controls,#{hn_controls} ,}#{?daemon_down,#[bold]daemon down#[nobold] ,}#{?model_progress,#{model_progress} ,}#{?usage_remaining,#{usage_remaining_mark} ,}#{?pane_watching,[watching] ,}#{?shell_context,#{=/36/…:shell_context},\"#{=/21/…:local_machine}\"} %H:%M ".into());
// Each window's most urgent harness at a glance (the symbol its pane titles show) and its
// name in a few whole words (#{window_short_name}): a harness is named for its task.
// Keep tmux's familiar current/previous markers beside the name, then any other
diff --git a/tui/src/workspace_controls.rs b/tui/src/workspace_controls.rs
index eb5112f2e..ddc71b018 100644
--- a/tui/src/workspace_controls.rs
+++ b/tui/src/workspace_controls.rs
@@ -147,7 +147,9 @@ pub fn status(app: &App) -> String {
/// The sidebar uses the same actions on its existing header/footer rows.
pub fn side_actions(buf: &mut Buffer, app: &App, rect: Rect, style: Style, account: bool) {
if !enabled(app) { return }
- let items: Vec<(&str, Action)> = if account { vec![(crate::account::label(app), Action::Account)] }
+ // The account's username, shortened to the room there is.
+ let user = crate::format::short_name(&crate::account::button(app), rect.width as usize);
+ let items: Vec<(&str, Action)> = if account { vec![(user.as_str(), Action::Account)] }
else { vec![("+", Action::New), (MENU_GLYPH, Action::Menu)] };
let total: u16 = items.iter().map(|(label, _)| label.width() as u16).sum::<u16>() + items.len().saturating_sub(1) as u16 * 2;
if total > rect.width { return }
diff --git a/tui/tests/mock-daemon.mjs b/tui/tests/mock-daemon.mjs
index fd1750722..80727eb48 100644
--- a/tui/tests/mock-daemon.mjs
+++ b/tui/tests/mock-daemon.mjs
@@ -241,6 +241,8 @@ const server = http.createServer((req, res) => {
return
}
if (req.url === '/api/status') return json(res, { machineId: LOCAL, signedIn: true, version: 'mock', webUrl: process.env.MOCK_WEB_URL || 'https://harness.example' })
+ // Whose account it is: the side bar's account button names the email's user (`dev.tester`).
+ if (req.url === '/api/auth/me') return json(res, { user: { email: '[email protected]' } })
if (req.url === '/api/machines') return json(res, { machines: [
{ machineId: LOCAL, name: process.env.MOCK_PROJECT_SEARCH === '1' ? 'M2' : DEMO ? 'studio' : 'mock-local', status: 'running' },
{ machineId: REMOTE, name: process.env.MOCK_PROJECT_SEARCH === '1' ? 'office' : DEMO ? 'gpu-box' : 'mock-remote', status: 'running' },