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.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
hn 0.1.21: a plainer Commands list; Continue with your phone (#1102)
lingrdc2314dff6b52
diff --git a/tui/Cargo.lock b/tui/Cargo.lockindex 56c86c693..c40c48072 100644--- a/tui/Cargo.lock+++ b/tui/Cargo.lock@@ -654,7 +654,7 @@ dependencies = [[[package]]name = "harness-tui"-version = "0.1.20"+version = "0.1.21"dependencies = ["alacritty_terminal","base64",diff --git a/tui/Cargo.toml b/tui/Cargo.tomlindex f9e65c8d1..20120a205 100644--- a/tui/Cargo.toml+++ b/tui/Cargo.toml@@ -1,6 +1,6 @@[package]name = "harness-tui"-version = "0.1.20"+version = "0.1.21"edition = "2024"[dependencies]diff --git a/tui/src/account.rs b/tui/src/account.rsindex 91aad1d62..9f39d3552 100644--- a/tui/src/account.rs+++ b/tui/src/account.rs@@ -171,7 +171,7 @@ pub fn fill(app: &App, picker: &mut Picker) {_ => {rows.push(Row::new("account:google", "Continue with Google"));rows.push(Row::new("account:apple", "Continue with Apple"));- rows.push(Row::new("account:qr", "Sign in with your phone"));+ rows.push(Row::new("account:qr", "Continue with your phone"));}},}@@ -206,7 +206,7 @@ pub fn preview(app: &App, _: &str) -> Vec<Line<'static>> {match &app.account.phase {Phase::Browser(_) => {lines.push(Line::raw("Finish signing in in your browser."));- lines.push(Line::raw("Using SSH? Cancel and choose Sign in with your phone."));+ lines.push(Line::raw("Using SSH? Cancel and choose Continue with your phone."));}Phase::Phone { expires, .. } => {lines.clear();@@ -264,7 +264,7 @@ pub fn draw(buf: &mut Buffer, app: &App, body: Rect, picker: &mut Picker) -> Opt_ => vec![Line::raw("Connect computers and sync your workspace."), Line::raw("Use models on a linked machine. Follow work from your phone."),Line::raw(""), Line::raw("Sign-in is optional. Keep working locally anytime.")],},- Phase::Browser(_) => vec![Line::raw("Finish signing in in your browser."), Line::raw("Using SSH? Cancel and choose Sign in with your phone.")],+ Phase::Browser(_) => vec![Line::raw("Finish signing in in your browser."), Line::raw("Using SSH? Cancel and choose Continue with your phone.")],Phase::Failed(message) => vec![Line::raw(message.clone())],Phase::Phone { .. } => preview(app, ""),Phase::Starting => vec![Line::raw(app.account.waiting.clone().unwrap_or_else(|| "Opening sign-in…".into()))],@@ -416,7 +416,7 @@ fn open_browser(app: &mut App, url: String) {tokio::time::timeout(Duration::from_secs(10), command.status()).await.is_ok_and(|s| s.is_ok_and(|s| s.success()))}, |app, opened| {if !opened { if let Some(Modal::Picker { kind: PickerKind::Account, picker }) = &mut app.modal {- picker.say("Could not open a browser. Copy the link, or use Sign in with your phone.");+ picker.say("Could not open a browser. Copy the link, or use Continue with your phone.");} }});}@@ -613,7 +613,7 @@ mod tests {crate::input::picker(&mut app, PickerKind::Account, "Your Harness account", "");let (text, _) = render(&mut app, 40, 12);for label in if signed_in { vec!["Connect a machine", "Add your phone", "Sign out"] }- else { vec!["Continue with Google", "Continue with Apple", "Sign in with your phone", "Keep using locally"] } {+ else { vec!["Continue with Google", "Continue with Apple", "Continue with your phone", "Keep using locally"] } {assert!(text.contains(label), "{label}\n{text}");}if signed_in { for gone in ["Models on your machines", "Back to workspace"] { assert!(!text.contains(gone), "{gone} is not offered\n{text}") } }diff --git a/tui/src/devices.rs b/tui/src/devices.rsindex 150a058c0..ca406305c 100644--- a/tui/src/devices.rs+++ b/tui/src/devices.rs@@ -1747,7 +1747,7 @@ mod tests {let app = app((150, 42));let rows = crate::modal::command_rows(&app);// (Connect a computer… only went to Connect machines…: one way in. Its command still runs.)- for (id, label) in [("devices", "Connect machines…"), ("add-phone", "Add phone…"), ("machines", "List machines")] {+ for (id, label) in [("devices", "Connect machines"), ("add-phone", "Add phone"), ("machines", "List machines")] {let row = rows.iter().find(|r| r.id == format!("cmd:{id}")).unwrap_or_else(|| panic!("{id} missing"));assert_eq!((row.label.as_str(), row.group.as_deref()), (label, Some("Machines")));}diff --git a/tui/src/input.rs b/tui/src/input.rsindex 4558786cd..3048d8895 100644--- a/tui/src/input.rs+++ b/tui/src/input.rs@@ -896,8 +896,9 @@ fn fill_rows(app: &App, kind: &PickerKind, picker: &mut Picker) {picker.hints = vec![("→/enter", "open"), ("enter", "set"), ("esc", "done")];}// (Typed into, it ranks by match, best first, as fzf does; empty, it keeps its groups. A- // query matches a command's name and keywords, not the description shown beside it.)- PickerKind::Commands => { picker.live = true; picker.set_rows(modal::command_rows_for(app, !picker.query.is_empty(), crate::settings::in_tmux(picker))); picker.hints = vec![("enter", "run"), ("M-k", "change its key")] }+ // query matches a command's name and its keywords — what a row used to say beside it is+ // searched, not shown, so hn's own commands still rank above tmux's.)+ PickerKind::Commands => { picker.live = true; picker.search_extra = true; picker.set_rows(modal::command_rows_for(app, !picker.query.is_empty(), crate::settings::in_tmux(picker))); picker.hints = vec![("enter", "run"), ("M-k", "change its key")] }// ── keys ──PickerKind::Keybinds => { picker.keep_order = true; picker.set_rows(modal::keybind_rows(app)); picker.hints = vec![("enter", "change"), ("esc", "done")] }PickerKind::Help => { picker.set_rows(modal::mode_rows(app)); picker.hints = vec![("enter", "go")] }diff --git a/tui/src/modal.rs b/tui/src/modal.rsindex bc1df6879..1faaba66e 100644--- a/tui/src/modal.rs+++ b/tui/src/modal.rs@@ -208,11 +208,13 @@ pub const ENGINES: [&str; 15] = ["claude", "codex", "opencode", "cursor", "pi",/// The palette's commands: (id, title, keys, hint, group).pub const COMMANDS: &[(&str, &str, &str, &str, &str)] = &[- ("account", "Account / sign in…", "", "connect computers, sync your workspace and add your phone", "General"),+ ("account", "Account…", "", "sign in, sign out, connect computers, sync your workspace and add your phone", "General"),("signout", "Sign out", "", "leave your Harness account here — harnesses on this computer keep running", "General"),- ("open", "Harnesses…", "⌥P", "every harness on every machine", "Harness"),- ("projects", "Projects…", "⌥O", "a project, then one of its harnesses", "Harness"),- ("models", "Models…", "⌥I", "local, shared, subscriptions, APIs — use one on this harness", "Harness"),+ // (Together with the rows above: one General group, not two. Listed to a search only.)+ ("take", "Take control", "", "reclaim all panes across every tab", "General"),+ ("open", "Open harness…", "⌥P", "every harness on every machine", "Harness"),+ ("projects", "Open project…", "⌥O", "a project, then one of its harnesses", "Harness"),+ ("models", "Open models…", "⌥I", "local, shared, subscriptions, APIs — use one on this harness", "Harness"),("change-agent", "Change agent…", "", "continue this project with another agent", "Harness"),("terminal", "New pane", "⌥N", "a shell on this pane's machine", "Harness"),("inbox", "Harnesses needing input", "⌥⇧I", "", "Harness"),@@ -223,7 +225,6 @@ pub const COMMANDS: &[(&str, &str, &str, &str, &str)] = &[("restart", "Restart harness", "⌥⇧E", "", "Harness"),("pause", "Pause harness", "", "stop the engine, keep the conversation", "Harness"),("rename", "Rename harness…", "", "", "Harness"),- ("take", "Take control", "", "reclaim all panes across every tab", "General"),("tab", "New Tab", "⌥T", "", "Tabs"),("rename-tab", "Rename Tab…", "⌥⇧R", "", "Tabs"),("close-tab", "Close Tab", "⌥⇧W", "save and stop; confirm active work", "Tabs"),@@ -526,18 +527,19 @@ pub fn command_rows(app: &App) -> Vec<Row> {let own = COMMANDS.iter().map(|(id, title, _, hint, group)| {let key = own_key(app, id).unwrap_or_default();// (Tier 0: searched, listed above every tmux command that matches — `appe` is Appearance,- // not a word in set-buffer's description.)- Row::new(format!("cmd:{id}"), *title).extra(format!("{id} {hint} {group}")).detail(vec![span(*hint, fg(theme::MUTED))]).right(key).group(*group)+ // not a word in set-buffer's description. A row shows its name and key only: the hint is+ // searched, not printed, so the list is not a wall of text.)+ Row::new(format!("cmd:{id}"), title.trim_end_matches('…')).extra(format!("{id} {hint} {group}")).right(key).group(*group)});// tmux's after them, grouped (Windows, Panes…), and none one of hn's runs already (Copy mode is// copy-mode): each group's rows together, in TMUX_GROUPS' order.let ours: Vec<&str> = COMMANDS.iter().filter_map(|(id, ..)| runs_of(id)).collect();- let mut tmux: Vec<(usize, Row)> = crate::commands::COMMANDS.iter().filter(|(name, ..)| !ours.contains(name)).map(|(name, alias, about)| {+ let mut tmux: Vec<(usize, Row)> = crate::commands::COMMANDS.iter().filter(|(name, ..)| !ours.contains(name)).map(|(name, alias, _)| {let key = app.keymap.key_for_name(name).unwrap_or_default();let group = tmux_group(name);- // (Found by its name and alias: its description is shown, not searched — a word in it+ // (Found by its name and alias: its description is neither shown nor searched — a word in it// would outrank what you meant, `appe` → set-buffer's "appends".)- let row = Row::new(format!("tmux:{name}"), *name).extra(alias.to_string()).detail(vec![span(*about, fg(theme::MUTED))]).right(key).group(format!("tmux · {group}")).tier(1);+ let row = Row::new(format!("tmux:{name}"), *name).extra(alias.to_string()).right(key).group(format!("tmux · {group}")).tier(1);(TMUX_GROUPS.iter().position(|g| *g == group).unwrap_or(TMUX_GROUPS.len()), row)}).collect();tmux.sort_by_key(|(g, _)| *g);@@ -567,10 +569,11 @@ fn tmux_group(name: &str) -> &'static str {pub fn command_rows_for(app: &App, searching: bool, in_tmux: bool) -> Vec<Row> {let all = command_rows(app);if in_tmux { return all.into_iter().filter(|r| r.id.starts_with("tmux:")).collect() }- let n = crate::commands::COMMANDS.len();- let more = Row::new("cmd:tmux-commands", "tmux commands…").extra("tmux every command")- .detail(vec![span(format!("every tmux command, grouped — {n} of them"), fg(theme::MUTED))]).group("Settings & help");- let (own, tmux): (Vec<Row>, Vec<Row>) = all.into_iter().filter(|r| searching || r.group.as_deref() != Some("Panes")).partition(|r| r.id.starts_with("cmd:"));+ let more = Row::new("cmd:tmux-commands", "tmux commands").extra("tmux every command").group("Settings & help");+ // (Sign out is in the Account panel already, and Take control is a rare repair: both are listed+ // only to a search, as the Panes commands are.)+ let rare = |r: &Row| matches!(r.id.as_str(), "cmd:signout" | "cmd:take");+ let (own, tmux): (Vec<Row>, Vec<Row>) = all.into_iter().filter(|r| searching || (r.group.as_deref() != Some("Panes") && !rare(r))).partition(|r| r.id.starts_with("cmd:"));// (The row for tmux's after hn's own settings, before Close hn.)let at = own.iter().position(|r| r.id == "cmd:quit").unwrap_or(own.len());let mut rows = own;@@ -1027,6 +1030,7 @@ mod theme_row_tests {assert!(tmux.iter().any(|r| r.label == "select-layout"));// Searched: hn's matches before tmux's, whatever they score.let mut p = crate::picker::Picker::new("Commands", "");+ p.search_extra = true; // as the panel opens it: a row's hint is searched, not shownp.set_rows(command_rows_for(&app, true, false));p.set_query("lay");let shown: Vec<&str> = p.visible.iter().map(|(i, _)| p.rows[*i].id.as_str()).collect();@@ -1034,6 +1038,37 @@ mod theme_row_tests {assert!(shown[..first_tmux].contains(&"cmd:layout") && shown[first_tmux..].iter().all(|id| id.starts_with("tmux:")), "{shown:?}");}+ /// The list is names and keys: no description beside a row. Account is one row (Sign out is in+ /// it), so Sign out is listed only to a search, and both words find their way.+ #[test]+ fn commands_show_names_and_keys_only_and_sign_out_is_found_by_search() {+ let app = app();+ for searching in [false, true] {+ for row in command_rows_for(&app, searching, false).iter().chain(command_rows_for(&app, searching, true).iter()) {+ assert!(row.detail.is_empty(), "{} has text beside it", row.label);+ }+ }+ let listed = command_rows_for(&app, false, false);+ assert!(listed.iter().any(|r| r.id == "cmd:account" && r.label == "Account"), "one Account row, without a sign-in suffix");+ assert!(listed.iter().all(|r| !r.label.ends_with('…')), "names only, no trailing ellipsis");+ assert!(!listed.iter().any(|r| r.id == "cmd:signout" || r.id == "cmd:take"), "Sign out and Take control are not listed");+ for searching in [false, true] {+ let mut groups: Vec<String> = Vec::new();+ for g in command_rows_for(&app, searching, false).iter().filter(|r| r.id.starts_with("cmd:")).filter_map(|r| r.group.clone()) { if groups.last() != Some(&g) { groups.push(g) } }+ assert_eq!(groups.iter().filter(|g| *g == "General").count(), 1, "one General heading (searching {searching}): {groups:?}");+ }+ let find = |query: &str| {+ let mut p = crate::picker::Picker::new("Commands", "");+ p.search_extra = true;+ p.set_rows(command_rows_for(&app, true, false));+ p.set_query(query);+ p.visible.iter().map(|(i, _)| p.rows[*i].id.clone()).collect::<Vec<_>>()+ };+ assert!(find("sign out").contains(&"cmd:signout".to_string()), "searching finds Sign out");+ assert!(find("sign in").contains(&"cmd:account".to_string()), "searching finds Account");+ assert!(find("take control").contains(&"cmd:take".to_string()), "searching finds Take control");+ }+/// Keybinds: the prefix and the second one first, then the commands grouped with their keys/// now. Appearance has no keys section.#[test]diff --git a/tui/src/settings.rs b/tui/src/settings.rsindex 5a3191f7f..c2c38f08a 100644--- a/tui/src/settings.rs+++ b/tui/src/settings.rs@@ -509,8 +509,9 @@ const SHARE: u16 = 9;const PALETTE_SHARE_H: u16 = 7;/// Large: as wide as this at most, however wide the window.const LARGE_MAX_W: u16 = 160;-/// (Room for a command's name, its hint and its key apart.)-const PALETTE_W: u16 = 96;+/// (Room for a command's name and its key apart: no description beside them any more. Commands,+/// Keybinds and Layout are the palettes, and they keep one width so the panel stays put between them.)+const PALETTE_W: u16 = 76;/// (New harness's form: its chooser opens beside it where there is room.)const FORM_W: u16 = 60;/// A form keeps this many rows however short the window (its action stays on screen), up to the@@ -1680,12 +1681,12 @@ mod tests {let medium = Rect::new(0, 0, 120, 40);assert_eq!(area(medium, PanelSize::Large, 0), Rect::new(6, 2, 108, 36));// (Rows and chrome; at most seven tenths of the height; in the upper third.)- assert_eq!(area(medium, PanelSize::Palette, 5), Rect::new(12, 6, 96, 13));- assert_eq!(area(medium, PanelSize::Palette, 100), Rect::new(12, 6, 96, 28));+ assert_eq!(area(medium, PanelSize::Palette, 5), Rect::new(22, 6, 76, 13));+ assert_eq!(area(medium, PanelSize::Palette, 100), Rect::new(22, 6, 76, 28));assert_eq!(area(medium, PanelSize::Form, 20), Rect::new(30, 10, 60, 20));let wide = Rect::new(0, 0, 400, 60);assert_eq!(area(wide, PanelSize::Large, 0), Rect::new(120, 3, 160, 54));- assert_eq!(area(wide, PanelSize::Palette, 5), Rect::new(152, 10, 96, 13));+ assert_eq!(area(wide, PanelSize::Palette, 5), Rect::new(162, 10, 76, 13));assert_eq!(area(wide, PanelSize::Form, 20), Rect::new(170, 20, 60, 20));}diff --git a/tui/tests/workspace-controls.py b/tui/tests/workspace-controls.pyindex 3d46732e3..51be31a5d 100644--- a/tui/tests/workspace-controls.py+++ b/tui/tests/workspace-controls.py@@ -726,13 +726,13 @@ try:# A phone approval is explicit. Closing its UI cancels the driver, and reopening never# accepts a previously selected row as consent to a different account.hn('account')- click_text('Sign in with your phone')+ click_text('Continue with your phone')shown('Cancel sign-in')snapshot('phone-sign-in')keys('Escape')wait(lambda: login_events() == ['start', 'cancel'], 'closing account cancels the pending login')hn('account')- click_text('Sign in with your phone')+ click_text('Continue with your phone')shown('Cancel sign-in')(BASE / 'approve').touch()# The phone that approved is signed in to the account: no second question here.