From 26e37116af6f2f83425f21f93fba6adea8eb2a2f Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 14 Oct 2026 01:43:21 -0700 Subject: [PATCH 01/27] test: prompt bookmarks persist in the acpmux session (red) Behavior tests for _acpmux/bookmark_get and _acpmux/bookmark_set before they exist: restart, prompt-only seqs, fork, transfer, peer forwarding, the pane relay's scope and params, and the minimap popover's store. Co-Authored-By: Claude Opus 5.5 --- .../AgentPaneBookmarksRelayTests.swift | 54 +++++ .../acpmux/tests/hub_integration/bookmarks.rs | 187 ++++++++++++++++++ .../acpmux/tests/hub_integration/drafts.rs | 4 + .../crates/acpmux/tests/peer_integration.rs | 41 ++++ .../tests/cases/params.json | 58 ++++++ .../tests/cases/sessions.json | 80 ++++++++ webviews/test/thread-bookmarks.test.tsx | 173 ++++++++++++++++ 7 files changed, 597 insertions(+) create mode 100644 Packages/macOS/CmuxNext/Tests/CmuxNextAgentPaneTests/AgentPaneBookmarksRelayTests.swift create mode 100644 cmux-tui/crates/acpmux/tests/hub_integration/bookmarks.rs create mode 100644 webviews/test/thread-bookmarks.test.tsx diff --git a/Packages/macOS/CmuxNext/Tests/CmuxNextAgentPaneTests/AgentPaneBookmarksRelayTests.swift b/Packages/macOS/CmuxNext/Tests/CmuxNextAgentPaneTests/AgentPaneBookmarksRelayTests.swift new file mode 100644 index 000000000000..673b9d08b6da --- /dev/null +++ b/Packages/macOS/CmuxNext/Tests/CmuxNextAgentPaneTests/AgentPaneBookmarksRelayTests.swift @@ -0,0 +1,54 @@ +import Foundation +import Testing +@testable import CmuxNextAgentPane + +/// Prompt bookmarks at the relay boundary (the page's frames into ``AgentPaneTransport``, out to +/// acpmux): the thread minimap reads and toggles the marks of the chat it shows. Both methods +/// reach acpmux only for a chat in the pane's scope and only in the shape the pane sends; they +/// grant nothing, so they need no gesture. +@Suite(.serialized) +@MainActor +struct AgentPaneBookmarksRelayTests { + static func frame(id: Int, method: String, params: String) -> String { + #"{"jsonrpc":"2.0","id":\#(id),"method":"\#(method)","params":\#(params)}"# + } + + @Test func bookmarksGoOutOnlyForTheChatInTheShapeThePaneSends() async throws { + let server = AcpmuxStandInServer() + try await server.start() + defer { server.stop() } + let inbox = AgentPaneRelayedAllowTests.PageInbox() + let transport = AgentPaneTransport() + transport.deliver = { event, done in inbox.deliver(event.frames); done() } + let id = try await transport.open(AcpmuxConnection(url: server.url, dashboardToken: "t", localAppToken: nil)) + #expect(await transport.send(connection: id, frames: [#"{"jsonrpc":"2.0","id":0,"method":"initialize","params":{}}"#]) == nil) + transport.sessions.add("s") + let sent = { server.peers.first?.frames.filter { $0.contains("_acpmux/bookmark_") } ?? [] } + let set = "_acpmux/bookmark_set", get = "_acpmux/bookmark_get" + + #expect(await transport.send(connection: id, frames: [Self.frame(id: 1, method: set, params: #"{"sessionId":"other","seq":3,"bookmarked":true}"#)]) != nil, + "a chat outside the pane's scope") + #expect(await transport.send(connection: id, frames: [Self.frame(id: 2, method: get, params: #"{"sessionId":"other"}"#)]) != nil, + "a chat outside the pane's scope") + #expect(await transport.send(connection: id, frames: [Self.frame(id: 3, method: set, params: #"{"sessionId":"s","seq":3,"bookmarked":true,"command":"ls"}"#)]) != nil, + "a param the pane never sends") + #expect(await transport.send(connection: id, frames: [Self.frame(id: 4, method: get, params: #"{"sessionId":"s","cwd":"/"}"#)]) != nil, + "a param the pane never sends") + #expect(await transport.send(connection: id, frames: [Self.frame(id: 5, method: set, params: #"{"seq":3,"bookmarked":true}"#)]) != nil, + "no chat named") + #expect(sent().isEmpty, "a refused frame reached acpmux: \(sent())") + + // No gesture: a mark grants nothing. + #expect(await transport.send(connection: id, frames: [Self.frame(id: 6, method: set, params: #"{"sessionId":"s","seq":3,"bookmarked":true}"#)]) == nil) + _ = await inbox.frame(containing: #""id":6"#) + #expect(await transport.send(connection: id, frames: [Self.frame(id: 7, method: get, params: #"{"sessionId":"s"}"#)]) == nil) + _ = await inbox.frame(containing: #""id":7"#) + let frames = sent() + #expect(frames.count == 2, "\(frames)") + let object = try JSONSerialization.jsonObject(with: Data(try #require(frames.first).utf8)) as? [String: Any] + let params = try #require(object?["params"] as? [String: Any]) + #expect(params["sessionId"] as? String == "s") + #expect(params["seq"] as? Int == 3) + #expect(params["bookmarked"] as? Bool == true) + } +} diff --git a/cmux-tui/crates/acpmux/tests/hub_integration/bookmarks.rs b/cmux-tui/crates/acpmux/tests/hub_integration/bookmarks.rs new file mode 100644 index 000000000000..c29b60f4e6f4 --- /dev/null +++ b/cmux-tui/crates/acpmux/tests/hub_integration/bookmarks.rs @@ -0,0 +1,187 @@ +//! Prompt bookmarks (`_acpmux/bookmark_get`, `_acpmux/bookmark_set`): the thread minimap's marks +//! on a chat's own prompts, kept with the session so they survive a restart, a fork and a move, +//! and reach every pane attached to the chat. + +use super::*; + +const GET: &str = "_acpmux/bookmark_get"; +const SET: &str = "_acpmux/bookmark_set"; + +/// The seqs of every record of `kind` in a session's log, oldest first. +async fn seqs(c: &mut TestClient, id: &str, kind: &str) -> Vec { + let page = c + .request(method::MUX_EVENTS, json!({"sessionId": id, "afterSeq": 0, "limit": 5000})) + .await + .unwrap(); + page["events"] + .as_array() + .unwrap() + .iter() + .filter(|e| e["kind"] == kind) + .filter_map(|e| e["seq"].as_u64()) + .collect() +} + +fn local_hub(dir: &std::path::Path) -> (Config, Arc) { + let fake = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/fake_agent.py"); + let mut agents = BTreeMap::new(); + agents.insert( + "fake".to_owned(), + HarnessProfile { + kind: Default::default(), + argv: vec!["python3".into(), fake.into()], + env: BTreeMap::new(), + description: None, + fallback: None, + family: None, + models: vec![], + model: None, + effort: None, + policy: None, + }, + ); + let mut cfg = + Config { harnesses: agents, default_harness: Some("fake".into()), ..Default::default() }; + cfg.store.mode = StoreMode::Local; + let hub = Hub::new(cfg.clone(), acpmux::store::open(&cfg.store, dir).unwrap()); + (cfg, hub) +} + +#[tokio::test] +async fn a_bookmark_marks_only_a_prompt_and_survives_a_daemon_restart() { + let dir = std::env::temp_dir().join(format!("acpmux-bookmarks-{}", uuid::Uuid::now_v7())); + let (cfg, hub) = local_hub(&dir); + let mut c = connect(&hub).await; + let id = new_session(&mut c, "marks").await; + for text in ["first", "second"] { + c.request( + method::SESSION_PROMPT, + json!({"sessionId": id, "prompt": [{"type": "text", "text": text}]}), + ) + .await + .unwrap(); + } + let prompts = seqs(&mut c, &id, "user_message").await; + assert_eq!(prompts.len(), 2, "{prompts:?}"); + let reply = seqs(&mut c, &id, "turn_result").await[0]; + + let empty = c.request(GET, json!({"sessionId": id})).await.unwrap(); + assert_eq!(empty["bookmarks"], json!([]), "{empty}"); + + // Only the chat's own prompts can be marked. + let not_a_prompt = + c.request(SET, json!({"sessionId": id, "seq": reply, "bookmarked": true})).await; + assert!( + not_a_prompt.as_ref().is_err_and(|e| e.contains("not a prompt")), + "{not_a_prompt:?}" + ); + let past_the_end = + c.request(SET, json!({"sessionId": id, "seq": 1_000_000, "bookmarked": true})).await; + assert!( + past_the_end.as_ref().is_err_and(|e| e.contains("not a prompt")), + "{past_the_end:?}" + ); + let no_flag = c.request(SET, json!({"sessionId": id, "seq": prompts[0]})).await; + assert!(no_flag.is_err(), "{no_flag:?}"); + + // Another pane on the chat hears every change. + let mut other = connect(&hub).await; + other.request(method::MUX_ATTACH, json!({"sessionId": id, "limit": 0})).await.unwrap(); + + let set = c + .request(SET, json!({"sessionId": id, "seq": prompts[1], "bookmarked": true})) + .await + .unwrap(); + assert_eq!(set["bookmarks"], json!([prompts[1]]), "{set}"); + let heard = other + .wait_for(method::MUX_EVENT, |p| p["sessionId"] == id.as_str() && p["kind"] == "bookmarks") + .await; + assert_eq!(heard["msg"]["bookmarks"], json!([prompts[1]]), "{heard}"); + let set = c + .request(SET, json!({"sessionId": id, "seq": prompts[0], "bookmarked": true})) + .await + .unwrap(); + assert_eq!(set["bookmarks"], json!([prompts[0], prompts[1]]), "{set}"); + let cleared = c + .request(SET, json!({"sessionId": id, "seq": prompts[1], "bookmarked": false})) + .await + .unwrap(); + assert_eq!(cleared["bookmarks"], json!([prompts[0]]), "{cleared}"); + + hub.shutdown_all().await; + drop(hub); + let hub2 = Hub::new(cfg.clone(), acpmux::store::open(&cfg.store, &dir).unwrap()); + let mut c2 = connect(&hub2).await; + let loaded = c2.request(GET, json!({"sessionId": id})).await.unwrap(); + assert_eq!(loaded["bookmarks"], json!([prompts[0]]), "{loaded}"); + hub2.shutdown_all().await; + let _ = std::fs::remove_dir_all(&dir); +} + +#[tokio::test] +async fn a_fork_keeps_the_bookmarks_of_the_prompts_it_copies() { + let (hub, mut c) = setup(PermissionPolicy::ApproveAll).await; + let id = new_session(&mut c, "fork-marks").await; + for text in ["first", "second"] { + c.request( + method::SESSION_PROMPT, + json!({"sessionId": id, "prompt": [{"type": "text", "text": text}]}), + ) + .await + .unwrap(); + } + let prompts = seqs(&mut c, &id, "user_message").await; + c.request(SET, json!({"sessionId": id, "seq": prompts[1], "bookmarked": true})).await.unwrap(); + let through = *seqs(&mut c, &id, "turn_result").await.last().unwrap(); + + let f = c + .request("acp.session.fork", json!({"sessionId": id, "throughSeq": through})) + .await + .unwrap(); + let fid = f["sessionId"].as_str().unwrap().to_owned(); + // The fork numbers its copy of the history itself: the mark follows the prompt. + let copied = seqs(&mut c, &fid, "user_message").await; + assert_eq!(copied.len(), 2, "{copied:?}"); + let forked = c.request(GET, json!({"sessionId": fid})).await.unwrap(); + assert_eq!(forked["bookmarks"], json!([copied[1]]), "{forked}"); + // The two chats mark on their own from here. + c.request(SET, json!({"sessionId": fid, "seq": copied[0], "bookmarked": true})).await.unwrap(); + let parent = c.request(GET, json!({"sessionId": id})).await.unwrap(); + assert_eq!(parent["bookmarks"], json!([prompts[1]]), "{parent}"); + drop(hub); +} + +#[tokio::test] +async fn a_moved_chat_keeps_its_bookmarks_and_the_source_keeps_none() { + let (_a, mut src) = setup(PermissionPolicy::ApproveAll).await; + let (_b, mut dst) = setup(PermissionPolicy::ApproveAll).await; + let id = new_session(&mut src, "moved-marks").await; + src.request( + method::SESSION_PROMPT, + json!({"sessionId": id, "prompt": [{"type": "text", "text": "hi"}]}), + ) + .await + .unwrap(); + let hi = seqs(&mut src, &id, "user_message").await[0]; + src.request(SET, json!({"sessionId": id, "seq": hi, "bookmarked": true})).await.unwrap(); + + // The move keeps the log's seqs, so the mark still names the same prompt there. + let begin = src.request("_acpmux/transfer_begin", json!({"sessionId": id})).await.unwrap(); + let received = + dst.request("_acpmux/transfer_receive", json!({"manifest": begin})).await.unwrap(); + let receive_id = received["receiveId"].as_str().unwrap().to_owned(); + super::super::transfer::copy_bundle(&mut src, &mut dst, &begin, &receive_id).await; + dst.request("_acpmux/transfer_finish", json!({"receiveId": receive_id})).await.unwrap(); + src.request( + "_acpmux/transfer_commit", + json!({"sessionId": id, "transferId": begin["transferId"], "to": {"sessionId": id}}), + ) + .await + .unwrap(); + + let there = dst.request(GET, json!({"sessionId": id})).await.unwrap(); + assert_eq!(there["bookmarks"], json!([hi]), "{there}"); + assert_eq!(seqs(&mut dst, &id, "user_message").await, [hi]); + let here = src.request(GET, json!({"sessionId": id})).await.unwrap(); + assert_eq!(here["bookmarks"], json!([]), "the source keeps no bookmarks: {here}"); +} diff --git a/cmux-tui/crates/acpmux/tests/hub_integration/drafts.rs b/cmux-tui/crates/acpmux/tests/hub_integration/drafts.rs index 43aac7abf708..083d9f352497 100644 --- a/cmux-tui/crates/acpmux/tests/hub_integration/drafts.rs +++ b/cmux-tui/crates/acpmux/tests/hub_integration/drafts.rs @@ -1,5 +1,9 @@ use super::*; +// Prompt bookmarks live in session meta beside the draft, and share these helpers. +#[path = "bookmarks.rs"] +mod bookmarks; + #[tokio::test] async fn composer_draft_rpc_round_trip_and_clear() { let (_hub, mut c) = setup(PermissionPolicy::ApproveAll).await; diff --git a/cmux-tui/crates/acpmux/tests/peer_integration.rs b/cmux-tui/crates/acpmux/tests/peer_integration.rs index c25ae1b20c8a..ec78091d20a6 100644 --- a/cmux-tui/crates/acpmux/tests/peer_integration.rs +++ b/cmux-tui/crates/acpmux/tests/peer_integration.rs @@ -584,3 +584,44 @@ async fn every_answer_for_a_peers_prompt_goes_to_the_peer_within_a_hop_limit() { .await; assert_eq!(decided["msg"]["outcome"]["optionId"], "no", "{decided}"); } + +/// Prompt bookmarks of a peer's chat live on the daemon that owns it: A forwards both +/// `_acpmux/bookmark_set` and `_acpmux/bookmark_get` to B, which checks the seq in its own log. +#[tokio::test] +async fn a_peer_sessions_bookmarks_are_kept_by_the_daemon_that_owns_it() { + let b = hub(config(PermissionPolicy::ApproveAll)).await; + let (port, peer_token) = listen_with_peer_token(b.clone(), "marks").await; + let mut cb = client(b.clone()).await; + let s = cb.call(method::SESSION_NEW, json!({"cwd": std::env::temp_dir(), "mcpServers": [], "_meta": {"acpmux": {"name": "marked"}}})).await.unwrap(); + let remote_id = s["sessionId"].as_str().unwrap().to_owned(); + let prompt = json!({"sessionId": remote_id, "prompt": [{"type": "text", "text": "hi"}]}); + cb.call(method::SESSION_PROMPT, prompt).await.unwrap(); + let page = cb.call(method::MUX_EVENTS, json!({"sessionId": remote_id, "limit": 5000})).await; + let page = page.unwrap(); + let events = page["events"].as_array().unwrap(); + let seq_of = |kind: &str| events.iter().find(|e| e["kind"] == kind).unwrap()["seq"].clone(); + let (prompt_seq, reply_seq) = (seq_of("user_message"), seq_of("turn_result")); + + let a = hub(config(PermissionPolicy::ApproveAll)).await; + a.add_peer("b", &format!("ws://127.0.0.1:{port}"), Some("tok".into()), Some(peer_token), true) + .await + .unwrap(); + let mut ca = client(a.clone()).await; + let refused = ca + .call("_acpmux/bookmark_set", json!({"sessionId": remote_id, "seq": reply_seq, "bookmarked": true})) + .await; + assert!(refused.as_ref().is_err_and(|e| e.contains("not a prompt")), "{refused:?}"); + let set = ca + .call("_acpmux/bookmark_set", json!({"sessionId": remote_id, "seq": prompt_seq, "bookmarked": true})) + .await + .unwrap(); + assert_eq!(set["peer"], "b", "{set}"); + assert_eq!(set["bookmarks"], json!([prompt_seq]), "{set}"); + let got = ca.call("_acpmux/bookmark_get", json!({"sessionId": remote_id})).await.unwrap(); + assert_eq!(got["peer"], "b", "{got}"); + assert_eq!(got["bookmarks"], json!([prompt_seq]), "{got}"); + // B holds it, in its own session. + let on_b = cb.call("_acpmux/bookmark_get", json!({"sessionId": remote_id})).await.unwrap(); + assert_eq!(on_b["bookmarks"], json!([prompt_seq]), "{on_b}"); + assert!(on_b.get("peer").is_none(), "{on_b}"); +} diff --git a/cmux-tui/crates/cmux-agent-pane-policy/tests/cases/params.json b/cmux-tui/crates/cmux-agent-pane-policy/tests/cases/params.json index 806e472a4918..a9eed2635ef5 100644 --- a/cmux-tui/crates/cmux-agent-pane-policy/tests/cases/params.json +++ b/cmux-tui/crates/cmux-agent-pane-policy/tests/cases/params.json @@ -924,5 +924,63 @@ }, "mode_fields": null, "breaks": true + }, + { + "name": "_acpmux/bookmark_get every known param", + "frame": { + "jsonrpc": "2.0", + "id": 1, + "method": "_acpmux/bookmark_get", + "params": { + "sessionId": 1 + } + }, + "mode_fields": null, + "breaks": false + }, + { + "name": "_acpmux/bookmark_set every known param", + "frame": { + "jsonrpc": "2.0", + "id": 1, + "method": "_acpmux/bookmark_set", + "params": { + "sessionId": 1, + "seq": 1, + "bookmarked": 1 + } + }, + "mode_fields": null, + "breaks": false + }, + { + "name": "_acpmux/bookmark_set with a command param breaks", + "frame": { + "jsonrpc": "2.0", + "id": 1, + "method": "_acpmux/bookmark_set", + "params": { + "sessionId": 1, + "seq": 1, + "bookmarked": 1, + "command": 1 + } + }, + "mode_fields": null, + "breaks": true + }, + { + "name": "_acpmux/bookmark_get with another param breaks", + "frame": { + "jsonrpc": "2.0", + "id": 1, + "method": "_acpmux/bookmark_get", + "params": { + "sessionId": 1, + "cwd": 1 + } + }, + "mode_fields": null, + "breaks": true } ] diff --git a/cmux-tui/crates/cmux-agent-pane-policy/tests/cases/sessions.json b/cmux-tui/crates/cmux-agent-pane-policy/tests/cases/sessions.json index af1013a63a90..8bdbaa6beb2b 100644 --- a/cmux-tui/crates/cmux-agent-pane-policy/tests/cases/sessions.json +++ b/cmux-tui/crates/cmux-agent-pane-policy/tests/cases/sessions.json @@ -216,5 +216,85 @@ } }, "refused": true + }, + { + "name": "bookmark_set on the pane's own session passes", + "frame": { + "jsonrpc": "2.0", + "id": 4, + "method": "_acpmux/bookmark_set", + "params": { + "sessionId": "a", + "seq": 3, + "bookmarked": true + } + }, + "sessions": [ + "a" + ], + "refused": false + }, + { + "name": "bookmark_set on another session is refused", + "frame": { + "jsonrpc": "2.0", + "id": 4, + "method": "_acpmux/bookmark_set", + "params": { + "sessionId": "b", + "seq": 3, + "bookmarked": true + } + }, + "sessions": [ + "a" + ], + "refused": true + }, + { + "name": "bookmark_set naming no session is refused", + "frame": { + "jsonrpc": "2.0", + "id": 4, + "method": "_acpmux/bookmark_set", + "params": { + "seq": 3, + "bookmarked": true + } + }, + "sessions": [ + "a" + ], + "refused": true + }, + { + "name": "bookmark_get of the pane's own session passes", + "frame": { + "jsonrpc": "2.0", + "id": 4, + "method": "_acpmux/bookmark_get", + "params": { + "sessionId": "a" + } + }, + "sessions": [ + "a" + ], + "refused": false + }, + { + "name": "bookmark_get of another session is refused", + "frame": { + "jsonrpc": "2.0", + "id": 4, + "method": "_acpmux/bookmark_get", + "params": { + "sessionId": "b" + } + }, + "sessions": [ + "a" + ], + "refused": true } ] diff --git a/webviews/test/thread-bookmarks.test.tsx b/webviews/test/thread-bookmarks.test.tsx new file mode 100644 index 000000000000..cb0398e1f4a9 --- /dev/null +++ b/webviews/test/thread-bookmarks.test.tsx @@ -0,0 +1,173 @@ +// Prompt bookmarks at the pane boundary: the thread minimap's popover bookmark reads and toggles the +// chat's marks in acpmux (`_acpmux/bookmark_get`, `_acpmux/bookmark_set`), so a mark survives a +// reload, a restart and a move, and shows in every pane on the chat. A toggle shows at once and is +// taken back when acpmux refuses it. +import { afterAll, expect, test } from "bun:test"; +import { JSDOM, VirtualConsole } from "jsdom"; +import type { AcpmuxRow, ConversationLayout } from "../src/agent-session/acpmux/model"; + +const dom = new JSDOM("
", { + url: "http://localhost/", + pretendToBeVisual: true, + virtualConsole: new VirtualConsole(), +}); +const scope = globalThis as Record; +const replacements: Record = { + window: dom.window, + document: dom.window.document, + navigator: dom.window.navigator, + HTMLElement: dom.window.HTMLElement, + Element: dom.window.Element, + Node: dom.window.Node, + localStorage: dom.window.localStorage, + requestAnimationFrame: dom.window.requestAnimationFrame.bind(dom.window), + cancelAnimationFrame: dom.window.cancelAnimationFrame.bind(dom.window), + IS_REACT_ACT_ENVIRONMENT: true, +}; +for (const key of Object.getOwnPropertyNames(dom.window)) + if (/^(HTML|SVG|Mutation)/.test(key) && !(key in scope)) + replacements[key] = (dom.window as unknown as Record)[key]; +const saved = Object.keys(replacements).map((key) => [key, key in scope, scope[key]] as const); +Object.assign(scope, replacements); + +const { act, createElement, createRef } = await import("react"); +const { createRoot } = await import("react-dom/client"); +const { ThreadMinimap } = await import("../src/agent-session/acpmux/threadMinimap/ThreadMinimap"); +const { setBookmarkTransport } = await import("../src/agent-session/acpmux/threadMinimap/bookmarks"); + +afterAll(() => { + setBookmarkTransport(undefined); + dom.window.close(); + for (const [key, had, value] of saved) { + if (had) scope[key] = value; + else delete scope[key]; + } +}); + +const row = (id: string, kind: string, text: string): AcpmuxRow => ({ id, kind, text, version: 1, at: 1 }); +// Two prompts (acpmux seqs 3 and 7), each with a reply. +const rows = [ + row("user-3", "user", "first prompt"), + row("assistant-4", "assistant", "first reply"), + row("user-7", "user", "second prompt"), + row("assistant-8", "assistant", "second reply"), +]; +const layout: ConversationLayout = { + tops: Float64Array.from([0, 100, 200, 300]), + heights: Float64Array.from([100, 100, 100, 100]), + totalHeight: 400, +}; + +type Call = { sessionId: string; seq: number; bookmarked: boolean }; +/// acpmux as the pane reaches it: a chat's marks, and a set that answers with the new list. +function daemon(initial: number[], refuse = false) { + const marks = new Set(initial); + const calls: Call[] = []; + const gets: string[] = []; + let release: () => void = () => {}; + const transport = { + get: async (sessionId: string) => { + gets.push(sessionId); + return { sessionId, bookmarks: [...marks].sort((a, b) => a - b) }; + }, + set: (sessionId: string, seq: number, bookmarked: boolean) => { + calls.push({ sessionId, seq, bookmarked }); + return new Promise((resolve, reject) => { + release = () => { + if (refuse) return reject(new Error("refused")); + if (bookmarked) marks.add(seq); + else marks.delete(seq); + resolve({ sessionId, bookmarks: [...marks].sort((a, b) => a - b) }); + }; + }); + }, + }; + return { transport, calls, gets, answer: () => release() }; +} + +const settle = () => act(async () => await new Promise((resolve) => setTimeout(resolve, 0))); + +async function mount() { + const host = dom.window.document.createElement("div"); + dom.window.document.body.append(host); + const root = createRoot(host); + const scroller = createRef(); + await act(async () => + root.render( + createElement(ThreadMinimap, { + rows, + sessionId: "chat-1", + layout, + scroller, + scrollTop: 0, + viewportHeight: 600, + width: 1040, + }), + ), + ); + await settle(); + return { host, root }; +} + +/// Points at tick `index` (jsdom lays nothing out: the rail starts at 0) and returns its popover button. +async function bookmarkOf(host: HTMLElement, index: number): Promise { + const rail = host.querySelector(".acpmux-minimap__rail")!; + const tick = host.querySelector(`[data-tick="${index}"]`)!; + const pitch = parseFloat(tick.style.height); + await act(async () => { + rail.dispatchEvent(new dom.window.MouseEvent("pointermove", { bubbles: true, clientY: pitch * index + 1 })); + }); + return host.querySelector(".acpmux-minimap__bookmark")!; +} + +test("the popover bookmark sets the mark in acpmux and shows what acpmux answers", async () => { + const acpmux = daemon([]); + setBookmarkTransport(acpmux.transport); + const { host, root } = await mount(); + expect(acpmux.gets).toEqual(["chat-1"]); + const button = await bookmarkOf(host, 0); + expect(button.getAttribute("aria-pressed")).toBe("false"); + + await act(async () => button.click()); + // Shown at once, before acpmux answers. + expect(host.querySelector(".acpmux-minimap__bookmark")!.getAttribute("aria-pressed")).toBe("true"); + expect(acpmux.calls).toEqual([{ sessionId: "chat-1", seq: 3, bookmarked: true }]); + await act(async () => acpmux.answer()); + await settle(); + expect(host.querySelector(".acpmux-minimap__bookmark")!.getAttribute("aria-pressed")).toBe("true"); + + await act(async () => (host.querySelector(".acpmux-minimap__bookmark") as HTMLButtonElement).click()); + expect(acpmux.calls.at(-1)).toEqual({ sessionId: "chat-1", seq: 3, bookmarked: false }); + await act(async () => acpmux.answer()); + await settle(); + expect(host.querySelector(".acpmux-minimap__bookmark")!.getAttribute("aria-pressed")).toBe("false"); + await act(async () => root.unmount()); + host.remove(); +}); + +test("a reloaded pane shows the marks acpmux keeps", async () => { + // A fresh page: nothing local, the chat's marks come from bookmark_get. + const acpmux = daemon([7]); + setBookmarkTransport(acpmux.transport); + const { host, root } = await mount(); + expect(acpmux.gets).toEqual(["chat-1"]); + expect((await bookmarkOf(host, 1)).getAttribute("aria-pressed")).toBe("true"); + expect((await bookmarkOf(host, 0)).getAttribute("aria-pressed")).toBe("false"); + await act(async () => root.unmount()); + host.remove(); +}); + +test("a refused toggle is taken back", async () => { + const acpmux = daemon([], true); + setBookmarkTransport(acpmux.transport); + const { host, root } = await mount(); + const button = await bookmarkOf(host, 1); + await act(async () => button.click()); + expect(host.querySelector(".acpmux-minimap__bookmark")!.getAttribute("aria-pressed")).toBe("true"); + expect(acpmux.calls).toEqual([{ sessionId: "chat-1", seq: 7, bookmarked: true }]); + await act(async () => acpmux.answer()); + await settle(); + expect(host.querySelector(".acpmux-minimap__bookmark")!.getAttribute("aria-pressed")).toBe("false"); + await act(async () => root.unmount()); + host.remove(); +}); From b5e2f061cd92ef80293d5b59f6592dbd6cb96c14 Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 14 Oct 2026 01:54:36 -0700 Subject: [PATCH 02/27] acpmux: prompt bookmarks persist in the session _acpmux/bookmark_get and _acpmux/bookmark_set keep the thread minimap's marks in SessionMeta.bookmarks: seqs of the chat's user_message records, checked against its log and capped at 1000. A change logs a mux bookmarks record, as tags do, so attached panes hear it; the chat keeps its place in the session list. A fork carries the marks of the prompts it copies under its own seqs; a move carries them (the log keeps its seqs) and the source keeps none. Peers' chats forward to their owner. The pane relay allows both methods for a chat in the pane's scope with only sessionId, seq and bookmarked. The minimap's store reads them from acpmux, toggles optimistically with rollback, and imports this pane's old localStorage marks for the chat once. Co-Authored-By: Claude Opus 5.5 --- .../AcpmuxPaneMethods+Params.swift | 2 + .../CmuxNextAgentPane/AcpmuxPaneMethods.swift | 5 +- cmux-tui/crates/acpmux/src/hub/bookmarks.rs | 82 +++++++ cmux-tui/crates/acpmux/src/hub/fork.rs | 12 +- cmux-tui/crates/acpmux/src/hub/mod.rs | 1 + cmux-tui/crates/acpmux/src/hub/resolve.rs | 1 + cmux-tui/crates/acpmux/src/hub/transfer.rs | 1 + .../crates/acpmux/src/hub/transfer_out.rs | 9 +- cmux-tui/crates/acpmux/src/rpc.rs | 2 + cmux-tui/crates/acpmux/src/server/requests.rs | 6 +- .../acpmux/src/server/requests/composer.rs | 38 +++- cmux-tui/crates/acpmux/src/store.rs | 6 +- .../acpmux/tests/hub_integration/bookmarks.rs | 10 +- .../crates/acpmux/tests/peer_integration.rs | 10 +- .../crates/cmux-agent-pane-policy/policy.json | 6 +- webviews/src/agent-session/acpmux/App.tsx | 7 + webviews/src/agent-session/acpmux/direct.ts | 18 +- webviews/src/agent-session/acpmux/mock.ts | 11 + .../acpmux/threadMinimap/ThreadMinimap.tsx | 37 +-- .../acpmux/threadMinimap/bookmarks.ts | 214 +++++++++++++----- .../acpmux/threadMinimap/model.ts | 5 +- .../threadMinimap/threadMinimap.gallery.ts | 2 +- 22 files changed, 389 insertions(+), 96 deletions(-) create mode 100644 cmux-tui/crates/acpmux/src/hub/bookmarks.rs diff --git a/Packages/macOS/CmuxNext/Sources/CmuxNextAgentPane/AcpmuxPaneMethods+Params.swift b/Packages/macOS/CmuxNext/Sources/CmuxNextAgentPane/AcpmuxPaneMethods+Params.swift index 4c3c3b7e21a6..dff2e7bdfafb 100644 --- a/Packages/macOS/CmuxNext/Sources/CmuxNextAgentPane/AcpmuxPaneMethods+Params.swift +++ b/Packages/macOS/CmuxNext/Sources/CmuxNextAgentPane/AcpmuxPaneMethods+Params.swift @@ -31,6 +31,8 @@ nonisolated extension AcpmuxPaneMethods { "_acpmux/status": ([], []), "_acpmux/draft_get": (["sessionId"], []), "_acpmux/draft_set": (["sessionId", "text"], []), + "_acpmux/bookmark_get": (["sessionId"], []), + "_acpmux/bookmark_set": (["sessionId", "seq", "bookmarked"], []), "_acpmux/ask": (["sessionId", "text"], []), "_acpmux/queue_remove": (["sessionId", "promptId"], []), "_acpmux/queue_edit": (["sessionId", "promptId", "op", "text", "index"], []), diff --git a/Packages/macOS/CmuxNext/Sources/CmuxNextAgentPane/AcpmuxPaneMethods.swift b/Packages/macOS/CmuxNext/Sources/CmuxNextAgentPane/AcpmuxPaneMethods.swift index 1280522002b2..59864586280f 100644 --- a/Packages/macOS/CmuxNext/Sources/CmuxNextAgentPane/AcpmuxPaneMethods.swift +++ b/Packages/macOS/CmuxNext/Sources/CmuxNextAgentPane/AcpmuxPaneMethods.swift @@ -27,6 +27,9 @@ nonisolated enum AcpmuxPaneMethods { "_acpmux/status", "_acpmux/draft_get", // Session-scoped draft writes are kept separate from the filtered replies above. "_acpmux/draft_set", + // The thread minimap's prompt bookmarks of a chat in the pane's scope (direct.ts + // readBookmarks, setBookmark): a seq and a flag, kept in acpmux's session meta. + "_acpmux/bookmark_get", "_acpmux/bookmark_set", // A side question about a chat in the pane's scope (direct.ts ask, `/btw`): acpmux answers // it in a throwaway fork under deny-all, so it runs an agent turn like a prompt (cx-ef2m). "_acpmux/ask", @@ -196,7 +199,7 @@ nonisolated enum AcpmuxPaneMethods { /// one click) is a read-only view, and the pane never sends anything to it. public static let sessionScoped: Set = [ "session/prompt", "session/set_mode", "session/set_config_option", "session/set_model", "session/cancel", - "_acpmux/kill", "_acpmux/draft_get", "_acpmux/draft_set", "_acpmux/ask", "_acpmux/queue_remove", "_acpmux/queue_edit", "_acpmux/permission_respond", "_acpmux/permission_group_respond", "_acpmux/permission_chat_revoke", + "_acpmux/kill", "_acpmux/draft_get", "_acpmux/draft_set", "_acpmux/bookmark_get", "_acpmux/bookmark_set", "_acpmux/ask", "_acpmux/queue_remove", "_acpmux/queue_edit", "_acpmux/permission_respond", "_acpmux/permission_group_respond", "_acpmux/permission_chat_revoke", "_acpmux/secret_submit", "_acpmux/archive", "_acpmux/markUnread", "_acpmux/side", ] diff --git a/cmux-tui/crates/acpmux/src/hub/bookmarks.rs b/cmux-tui/crates/acpmux/src/hub/bookmarks.rs new file mode 100644 index 000000000000..7f7745552589 --- /dev/null +++ b/cmux-tui/crates/acpmux/src/hub/bookmarks.rs @@ -0,0 +1,82 @@ +//! Part of `Hub`; see `hub/mod.rs`. Prompt bookmarks (`_acpmux/bookmark_get`, +//! `_acpmux/bookmark_set`): the person's marks on a chat's own prompts, from +//! the pane's thread minimap. Each is the seq of a `user_message` record in +//! the chat's log, kept in its `SessionMeta` so a restart, a move and every +//! attached pane see the same marks. A change is logged as a mux `bookmarks` +//! record, as tags are, which is how attached panes hear of it. + +use super::*; +use std::collections::BTreeSet; + +impl Hub { + /// The most bookmarks one chat keeps. + pub const MAX_BOOKMARKS: usize = 1000; + + /// Mark or unmark the prompt logged at `seq`, and return the chat's marks. + /// Only a `user_message` record of this chat can be marked; unmarking takes + /// any seq, so a mark whose prompt is gone can still be cleared. + pub fn set_bookmark( + &self, + session: &Session, + seq: u64, + bookmarked: bool, + ) -> Result, RpcError> { + if session.moving().is_some() { + return Err(queue::moving_error()); + } + if bookmarked && !self.is_prompt(session, seq) { + return Err(RpcError::invalid_params(format!( + "seq {seq} is not a prompt in session {}", + session.id + ))); + } + let (marks, changed) = { + let mut meta = session.meta.lock().unwrap_or_else(|e| e.into_inner()); + if bookmarked + && !meta.bookmarks.contains(&seq) + && meta.bookmarks.len() >= Self::MAX_BOOKMARKS + { + return Err(RpcError::invalid_params(format!( + "a chat keeps at most {} bookmarks", + Self::MAX_BOOKMARKS + ))); + } + let changed = + if bookmarked { meta.bookmarks.insert(seq) } else { meta.bookmarks.remove(&seq) }; + (meta.bookmarks.iter().copied().collect::>(), changed) + }; + if changed { + // A mark is not chat activity: the session keeps its place in the list. + let before = session.meta().updated_at; + let record = self.append(session, "mux", "bookmarks", json!({"bookmarks": marks})); + { + let mut meta = session.meta.lock().unwrap_or_else(|e| e.into_inner()); + if meta.updated_at == record.at { + meta.updated_at = before; + } + } + self.save_meta(session); + } + Ok(marks) + } + + /// Whether `seq` is a prompt (`user_message`) in the chat's log. + fn is_prompt(&self, session: &Session, seq: u64) -> bool { + if seq == 0 || seq > session.seq.load(Ordering::SeqCst) { + return false; + } + let mut found = false; + let _ = self.store.scan(&session.id, seq - 1, &mut |e: EventRecord| { + found = e.seq == seq && e.dir == "mux" && e.kind == "user_message"; + false + }); + found + } +} + +/// `marks` cut to the newest `Hub::MAX_BOOKMARKS`: a bundle from elsewhere may hold any number. +pub(super) fn capped(marks: &mut BTreeSet) { + while marks.len() > Hub::MAX_BOOKMARKS { + marks.pop_first(); + } +} diff --git a/cmux-tui/crates/acpmux/src/hub/fork.rs b/cmux-tui/crates/acpmux/src/hub/fork.rs index e684cb26daf3..70110dd134d6 100644 --- a/cmux-tui/crates/acpmux/src/hub/fork.rs +++ b/cmux-tui/crates/acpmux/src/hub/fork.rs @@ -144,6 +144,8 @@ impl Hub { adopted_cwd: None, harness_roots: vec![], composer_draft: None, + // Filled below with the fork's own seqs of the marked prompts it copies. + bookmarks: Default::default(), }; let new = self.make_session(meta); if is_claude && cut.is_none() { @@ -171,7 +173,15 @@ impl Hub { ) { // Each keeps its time: a later fork through it cuts Claude's // transcript there (`fork_at.rs`), and a replay plays it then. - self.append_at(&new, &e.dir, &e.kind, e.msg, None, Some(e.at)); + let marked = parent_meta.bookmarks.contains(&e.seq) && e.kind == "user_message"; + let (copy, _) = self.append_at(&new, &e.dir, &e.kind, e.msg, None, Some(e.at)); + if marked { + new.meta + .lock() + .unwrap_or_else(|e| e.into_inner()) + .bookmarks + .insert(copy.seq); + } } } } diff --git a/cmux-tui/crates/acpmux/src/hub/mod.rs b/cmux-tui/crates/acpmux/src/hub/mod.rs index 55fc91c9e828..328ec97cf09d 100644 --- a/cmux-tui/crates/acpmux/src/hub/mod.rs +++ b/cmux-tui/crates/acpmux/src/hub/mod.rs @@ -6,6 +6,7 @@ mod adoption; mod aside; +mod bookmarks; mod catalog_reload; mod cursor_ext; mod fork; diff --git a/cmux-tui/crates/acpmux/src/hub/resolve.rs b/cmux-tui/crates/acpmux/src/hub/resolve.rs index 0158a482d0a3..c46979dfa5f0 100644 --- a/cmux-tui/crates/acpmux/src/hub/resolve.rs +++ b/cmux-tui/crates/acpmux/src/hub/resolve.rs @@ -194,5 +194,6 @@ pub(super) fn draft_meta(d: Draft<'_>) -> SessionMeta { adopted_cwd: None, harness_roots: vec![], composer_draft: None, + bookmarks: Default::default(), } } diff --git a/cmux-tui/crates/acpmux/src/hub/transfer.rs b/cmux-tui/crates/acpmux/src/hub/transfer.rs index a21439ac9b67..116c1455b48b 100644 --- a/cmux-tui/crates/acpmux/src/hub/transfer.rs +++ b/cmux-tui/crates/acpmux/src/hub/transfer.rs @@ -105,6 +105,7 @@ impl Hub { .map_err(|e| RpcError::invalid_params(format!("parse session.json: {e}")))?; // A store comes from this machine's chat index, never from a bundle. meta.chat_store = None; + super::bookmarks::capped(&mut meta.bookmarks); // The id becomes a directory name under the sessions root. if !is_plain_id(&meta.id) { return Err(RpcError::invalid_params(format!( diff --git a/cmux-tui/crates/acpmux/src/hub/transfer_out.rs b/cmux-tui/crates/acpmux/src/hub/transfer_out.rs index b5f9c2ce2a1c..5433a794278f 100644 --- a/cmux-tui/crates/acpmux/src/hub/transfer_out.rs +++ b/cmux-tui/crates/acpmux/src/hub/transfer_out.rs @@ -268,7 +268,7 @@ impl Hub { } /// The chat lives on the target now: its queue is withdrawn here (the target runs it), its - /// draft cleared, and it closes. + /// draft and bookmarks cleared, and it closes. pub(super) async fn transfer_commit( &self, session: &Arc, @@ -285,7 +285,12 @@ impl Hub { for q in session.queue() { self.remove_queued(session, &q.prompt_id); } - session.meta.lock().unwrap_or_else(|e| e.into_inner()).composer_draft = None; + { + // The chat's draft and bookmarks live on the target now. + let mut meta = session.meta.lock().unwrap_or_else(|e| e.into_inner()); + meta.composer_draft = None; + meta.bookmarks.clear(); + } self.append(session, "mux", "transferred", json!({"transferId": transfer_id, "to": to})); self.kill(session, false).await?; let _ = std::fs::remove_dir_all(transfers_dir().join(transfer_id)); diff --git a/cmux-tui/crates/acpmux/src/rpc.rs b/cmux-tui/crates/acpmux/src/rpc.rs index 6a45314cabc3..1432874d2be3 100644 --- a/cmux-tui/crates/acpmux/src/rpc.rs +++ b/cmux-tui/crates/acpmux/src/rpc.rs @@ -241,6 +241,8 @@ pub mod method { /// Read or replace the unsent composer text for one session. pub const MUX_DRAFT_GET: &str = "_acpmux/draft_get"; pub const MUX_DRAFT_SET: &str = "_acpmux/draft_set"; + pub const MUX_BOOKMARK_GET: &str = "_acpmux/bookmark_get"; + pub const MUX_BOOKMARK_SET: &str = "_acpmux/bookmark_set"; pub const MUX_ASK: &str = "_acpmux/ask"; pub const MUX_SCHEMA: &str = "_acpmux/schema"; pub const MUX_EXPORT: &str = "_acpmux/export"; diff --git a/cmux-tui/crates/acpmux/src/server/requests.rs b/cmux-tui/crates/acpmux/src/server/requests.rs index 615dbf2e4182..2145c8d75452 100644 --- a/cmux-tui/crates/acpmux/src/server/requests.rs +++ b/cmux-tui/crates/acpmux/src/server/requests.rs @@ -136,7 +136,7 @@ async fn dispatch_request( method::MUX_STATUS, method::MUX_SESSIONS, method::MUX_HARNESSES, method::MUX_RELOAD_CONFIG, method::MUX_ATTACH, method::MUX_WARM, method::MUX_PREWARM, method::MUX_DETACH, method::MUX_WATCH, method::MUX_RENAME, method::MUX_KILL, method::MUX_QUEUE_REMOVE, method::MUX_QUEUE_EDIT, method::MUX_INFO, method::MUX_EVENTS, method::MUX_PERMISSION_RESPOND, - method::MUX_DRAFT_GET, method::MUX_DRAFT_SET, method::MUX_ASK, method::MUX_VIEW, method::MUX_MARK_UNREAD, method::MUX_ARCHIVE, method::MUX_SIDE, + method::MUX_DRAFT_GET, method::MUX_DRAFT_SET, method::MUX_BOOKMARK_GET, method::MUX_BOOKMARK_SET, method::MUX_ASK, method::MUX_VIEW, method::MUX_MARK_UNREAD, method::MUX_ARCHIVE, method::MUX_SIDE, method::MUX_SET_POLICY, method::MUX_EXPORT, method::MUX_IMPORT, method::MUX_SHUTDOWN, ], "operations": crate::hub::HANDOFF_OPERATIONS.iter().chain(crate::hub::PERMISSION_GROUP_OPERATIONS.iter()).chain(super::FORK_OPERATIONS.iter()).collect::>(), "handoff": {"maxCapsuleBytes": crate::hub::MAX_CAPSULE_BYTES}, "features": ["promptAccepted", "turnIds", "eventPaging", "eventKinds", "eventStream", "cancelRequest", "messageSuperseded", "turnErrorText", "permissionGroups", "trustGate", "chiefBuiltinPresets", "personChallenge", "queueEdit", "steerInterrupt", "personHolds", "sessionTransfer"], "trustGate": true}} @@ -863,9 +863,7 @@ async fn dispatch_request( let limit = params.get("limit").and_then(Value::as_u64).unwrap_or(20) as usize; Ok(json!({"sessionId": s.id, "turns": hub.history(&s, limit)})) } - method::MUX_DRAFT_GET | method::MUX_DRAFT_SET | method::MUX_ASK => { - composer::handle(hub, conn, m, ¶ms).await - } + m if composer::handles(m) => composer::handle(hub, conn, m, ¶ms).await, method::MUX_TAG => { let s = hub.resolve(session_key(¶ms)?)?; let remove: Vec = params diff --git a/cmux-tui/crates/acpmux/src/server/requests/composer.rs b/cmux-tui/crates/acpmux/src/server/requests/composer.rs index bd46967cdfe3..d42ce01a3ba2 100644 --- a/cmux-tui/crates/acpmux/src/server/requests/composer.rs +++ b/cmux-tui/crates/acpmux/src/server/requests/composer.rs @@ -1,14 +1,30 @@ //! The composer's requests: a chat's unsent draft (`_acpmux/draft_get`, `_acpmux/draft_set`) and -//! a side question about it (`_acpmux/ask`, `hub/aside.rs`). +//! a side question about it (`_acpmux/ask`, `hub/aside.rs`), and its prompt bookmarks +//! (`_acpmux/bookmark_get`, `_acpmux/bookmark_set`, `hub/bookmarks.rs`). use super::*; +/// Whether `m` is one of the composer's requests. +pub(super) fn handles(m: &str) -> bool { + matches!( + m, + method::MUX_DRAFT_GET + | method::MUX_DRAFT_SET + | method::MUX_BOOKMARK_GET + | method::MUX_BOOKMARK_SET + | method::MUX_ASK + ) +} + pub(super) async fn handle( hub: &Arc, conn: &Arc, m: &str, params: &Value, ) -> Result { + if m == method::MUX_BOOKMARK_GET || m == method::MUX_BOOKMARK_SET { + return bookmarks(hub, m, params); + } let s = hub.resolve(session_key(params)?)?; if m == method::MUX_DRAFT_GET { return Ok(json!({"sessionId": s.id, "draft": s.meta().composer_draft})); @@ -27,3 +43,23 @@ pub(super) async fn handle( }; hub.ask_aside(&s, text, &conn.label(), opts).await } + +/// `_acpmux/bookmark_get` and `_acpmux/bookmark_set`: the chat's prompt bookmarks +/// (`hub/bookmarks.rs`). A peer's chat never gets here: `peer_forward.rs` sends it to its owner. +fn bookmarks(hub: &Arc, m: &str, params: &Value) -> Result { + let s = hub.resolve(session_key(params)?)?; + if m == method::MUX_BOOKMARK_GET { + let marks: Vec = s.meta().bookmarks.iter().copied().collect(); + return Ok(json!({"sessionId": s.id, "bookmarks": marks})); + } + let seq = params + .get("seq") + .and_then(Value::as_u64) + .ok_or_else(|| RpcError::invalid_params("seq is required"))?; + let bookmarked = params + .get("bookmarked") + .and_then(Value::as_bool) + .ok_or_else(|| RpcError::invalid_params("bookmarked is required"))?; + let marks = hub.set_bookmark(&s, seq, bookmarked)?; + Ok(json!({"sessionId": s.id, "bookmarks": marks})) +} diff --git a/cmux-tui/crates/acpmux/src/store.rs b/cmux-tui/crates/acpmux/src/store.rs index 709371e4e3b1..d86a31744791 100644 --- a/cmux-tui/crates/acpmux/src/store.rs +++ b/cmux-tui/crates/acpmux/src/store.rs @@ -8,7 +8,7 @@ use crate::config::{StoreConfig, StoreMode, write_atomic}; use anyhow::{Context, Result}; use serde::{Deserialize, Serialize}; use serde_json::Value; -use std::collections::{BTreeMap, HashMap}; +use std::collections::{BTreeMap, BTreeSet, HashMap}; use std::fs::{File, OpenOptions}; use std::io::{BufRead, BufReader, Write}; use std::path::{Path, PathBuf}; @@ -175,6 +175,10 @@ pub struct SessionMeta { /// Unsent composer text owned by this acpmux session. #[serde(default, skip_serializing_if = "Option::is_none")] pub composer_draft: Option, + /// The seqs of this chat's `user_message` records the person bookmarked (the pane's thread + /// minimap; `hub/bookmarks.rs`). A fork renumbers its copies; a move keeps the log's seqs. + #[serde(default, skip_serializing_if = "BTreeSet::is_empty")] + pub bookmarks: BTreeSet, } impl SessionMeta { diff --git a/cmux-tui/crates/acpmux/tests/hub_integration/bookmarks.rs b/cmux-tui/crates/acpmux/tests/hub_integration/bookmarks.rs index c29b60f4e6f4..82177aacccde 100644 --- a/cmux-tui/crates/acpmux/tests/hub_integration/bookmarks.rs +++ b/cmux-tui/crates/acpmux/tests/hub_integration/bookmarks.rs @@ -71,16 +71,10 @@ async fn a_bookmark_marks_only_a_prompt_and_survives_a_daemon_restart() { // Only the chat's own prompts can be marked. let not_a_prompt = c.request(SET, json!({"sessionId": id, "seq": reply, "bookmarked": true})).await; - assert!( - not_a_prompt.as_ref().is_err_and(|e| e.contains("not a prompt")), - "{not_a_prompt:?}" - ); + assert!(not_a_prompt.as_ref().is_err_and(|e| e.contains("not a prompt")), "{not_a_prompt:?}"); let past_the_end = c.request(SET, json!({"sessionId": id, "seq": 1_000_000, "bookmarked": true})).await; - assert!( - past_the_end.as_ref().is_err_and(|e| e.contains("not a prompt")), - "{past_the_end:?}" - ); + assert!(past_the_end.as_ref().is_err_and(|e| e.contains("not a prompt")), "{past_the_end:?}"); let no_flag = c.request(SET, json!({"sessionId": id, "seq": prompts[0]})).await; assert!(no_flag.is_err(), "{no_flag:?}"); diff --git a/cmux-tui/crates/acpmux/tests/peer_integration.rs b/cmux-tui/crates/acpmux/tests/peer_integration.rs index ec78091d20a6..7ee2473b6649 100644 --- a/cmux-tui/crates/acpmux/tests/peer_integration.rs +++ b/cmux-tui/crates/acpmux/tests/peer_integration.rs @@ -608,11 +608,17 @@ async fn a_peer_sessions_bookmarks_are_kept_by_the_daemon_that_owns_it() { .unwrap(); let mut ca = client(a.clone()).await; let refused = ca - .call("_acpmux/bookmark_set", json!({"sessionId": remote_id, "seq": reply_seq, "bookmarked": true})) + .call( + "_acpmux/bookmark_set", + json!({"sessionId": remote_id, "seq": reply_seq, "bookmarked": true}), + ) .await; assert!(refused.as_ref().is_err_and(|e| e.contains("not a prompt")), "{refused:?}"); let set = ca - .call("_acpmux/bookmark_set", json!({"sessionId": remote_id, "seq": prompt_seq, "bookmarked": true})) + .call( + "_acpmux/bookmark_set", + json!({"sessionId": remote_id, "seq": prompt_seq, "bookmarked": true}), + ) .await .unwrap(); assert_eq!(set["peer"], "b", "{set}"); diff --git a/cmux-tui/crates/cmux-agent-pane-policy/policy.json b/cmux-tui/crates/cmux-agent-pane-policy/policy.json index 7a4bc8ade62e..d20a45a844a9 100644 --- a/cmux-tui/crates/cmux-agent-pane-policy/policy.json +++ b/cmux-tui/crates/cmux-agent-pane-policy/policy.json @@ -6,7 +6,7 @@ "session/new", "session/prompt", "session/set_model", "session/set_mode", "session/set_config_option", "_acpmux/watch", "_acpmux/events", "_acpmux/attach", "_acpmux/detach", "_acpmux/view", "_acpmux/warm", "_acpmux/kill", "_acpmux/prewarm", "_acpmux/harnesses", "_acpmux/models", "_acpmux/permission_respond", - "_acpmux/status", "_acpmux/draft_get", "_acpmux/draft_set", "_acpmux/ask", "_acpmux/queue_remove", "_acpmux/queue_edit", + "_acpmux/status", "_acpmux/draft_get", "_acpmux/draft_set", "_acpmux/bookmark_get", "_acpmux/bookmark_set", "_acpmux/ask", "_acpmux/queue_remove", "_acpmux/queue_edit", "_acpmux/handoff_prepare", "_acpmux/handoff_get", "_acpmux/handoff_draft", "_acpmux/handoff_start", "_acpmux/handoff_discard", "_acpmux/permission_groups", "_acpmux/permission_group_respond", "_acpmux/permission_chat_revoke", @@ -20,7 +20,7 @@ "gesture_ticket_key": "cmuxGesture", "session_scoped": [ "session/prompt", "session/set_mode", "session/set_config_option", "session/set_model", "session/cancel", - "_acpmux/kill", "_acpmux/draft_get", "_acpmux/draft_set", "_acpmux/ask", "_acpmux/queue_remove", "_acpmux/queue_edit", "_acpmux/permission_respond", "_acpmux/permission_group_respond", "_acpmux/permission_chat_revoke", + "_acpmux/kill", "_acpmux/draft_get", "_acpmux/draft_set", "_acpmux/bookmark_get", "_acpmux/bookmark_set", "_acpmux/ask", "_acpmux/queue_remove", "_acpmux/queue_edit", "_acpmux/permission_respond", "_acpmux/permission_group_respond", "_acpmux/permission_chat_revoke", "_acpmux/secret_submit", "_acpmux/archive", "_acpmux/markUnread", "_acpmux/side" ], "optionally_session_scoped": ["acp.trust.get", "acp.trust.set"], @@ -61,6 +61,8 @@ "_acpmux/status": {"params": [], "acpmux": []}, "_acpmux/draft_get": {"params": ["sessionId"], "acpmux": []}, "_acpmux/draft_set": {"params": ["sessionId", "text"], "acpmux": []}, + "_acpmux/bookmark_get": {"params": ["sessionId"], "acpmux": []}, + "_acpmux/bookmark_set": {"params": ["sessionId", "seq", "bookmarked"], "acpmux": []}, "_acpmux/ask": {"params": ["sessionId", "text"], "acpmux": []}, "_acpmux/queue_remove": {"params": ["sessionId", "promptId"], "acpmux": []}, "_acpmux/queue_edit": {"params": ["sessionId", "promptId", "op", "text", "index"], "acpmux": []}, diff --git a/webviews/src/agent-session/acpmux/App.tsx b/webviews/src/agent-session/acpmux/App.tsx index dff419f4ab76..0d6f4392d4c2 100644 --- a/webviews/src/agent-session/acpmux/App.tsx +++ b/webviews/src/agent-session/acpmux/App.tsx @@ -51,6 +51,7 @@ import { StyleSwitch } from "./newtab/StyleSwitch"; import { pageStyle, pickNewTabStyle, screenTemplate, shownTemplate } from "./newtab/templates"; import { isAgentHome, projectLabel } from "./sessionList"; import { ThreadMinimap } from "./threadMinimap/ThreadMinimap"; +import { setBookmarkTransport } from "./threadMinimap/bookmarks"; import { composerDraft, notifyDraftActionsChanged } from "./composerDraft"; import { paneContext } from "./paneContext"; import { @@ -3516,6 +3517,11 @@ function AcpmuxPane() { return; } directClient.current = client; + // The minimap's prompt bookmarks live in acpmux's session (threadMinimap/bookmarks.ts). + setBookmarkTransport({ + get: (id) => client.readBookmarks(id), + set: (id, seq, on) => client.setBookmark(id, seq, on), + }); // Every trust refusal (a new chat, a resumed one, a switch, a prewarm, a prompt) shows the // folder's one question above the composer; Trust re-runs the refused step (cx-nn3e). client.onTrustRefused = (refusal, again) => { @@ -3989,6 +3995,7 @@ function AcpmuxPane() { if (retryTimer !== undefined) window.clearTimeout(retryTimer); directClient.current?.close(); directClient.current = undefined; + setBookmarkTransport(undefined); delete window.cmuxAcpmuxActions; notifyDraftActionsChanged(); }; diff --git a/webviews/src/agent-session/acpmux/direct.ts b/webviews/src/agent-session/acpmux/direct.ts index ca47b459f3ed..f8b01bb4b387 100644 --- a/webviews/src/agent-session/acpmux/direct.ts +++ b/webviews/src/agent-session/acpmux/direct.ts @@ -32,6 +32,7 @@ import { errorMessage } from "./transportErrors"; import { isWarmableCwd } from "./warmFolders"; import { SubagentFold } from "./subagents/subagentFold"; import { WORKSPACE_CONTEXT } from "./workspaceContext"; +import { BOOKMARKS_KIND, bookmarksHeard } from "./threadMinimap/bookmarks"; export type AcpmuxHostConfig = { protocolVersion: number; @@ -1047,6 +1048,16 @@ export class AcpmuxDirectClient { return this.request("_acpmux/draft_set", { sessionId, text }); } + /// The session's prompt bookmarks (`{bookmarks: [seq...]}`), kept in acpmux (threadMinimap/bookmarks.ts). + readBookmarks(sessionId: string): Promise { + return this.request("_acpmux/bookmark_get", { sessionId }); + } + + /// Marks or unmarks the prompt logged at `seq`; acpmux answers with the session's marks. + setBookmark(sessionId: string, seq: number, bookmarked: boolean): Promise { + return this.request("_acpmux/bookmark_set", { sessionId, seq, bookmarked }); + } + /// Files under `path` (else the selected session's folder) whose path matches `query`, best /// first (fileSearchModel.ts). acpmux serves no file search: the native host runs it on the /// session host as `git.files.search`, and mock mode's in-page daemon answers it. @@ -1184,7 +1195,7 @@ export class AcpmuxDirectClient { const attaching = this.request("_acpmux/attach", { sessionId, limit: 400, - kinds: ["transcript", COMMANDS_KIND, USAGE_KIND, CONFIG_KIND, ...SECRET_KINDS], + kinds: ["transcript", COMMANDS_KIND, USAGE_KIND, CONFIG_KIND, BOOKMARKS_KIND, ...SECRET_KINDS], eventStream: true, visible, }); @@ -1440,7 +1451,10 @@ export class AcpmuxDirectClient { return; } if (event.dir === "mux") { - if (event.kind === "forked") { + if (event.kind === BOOKMARKS_KIND) { + // Another pane (or the TUI) marked a prompt: the minimap shows acpmux's marks. + bookmarksHeard(event.sessionId ?? this.selectedSessionId, event.msg?.bookmarks); + } else if (event.kind === "forked") { this.forkedAtSeq = event.seq; } else if (event.kind === "user_message") { // A prompt, or a steer (which starts no turn but splits it), starts a new checklist. diff --git a/webviews/src/agent-session/acpmux/mock.ts b/webviews/src/agent-session/acpmux/mock.ts index af329295bb1e..e724b161d161 100644 --- a/webviews/src/agent-session/acpmux/mock.ts +++ b/webviews/src/agent-session/acpmux/mock.ts @@ -184,6 +184,7 @@ export class MockAcpmuxSocket { private trust = new Map([["~/code/atlas-web", "trusted"]]); /// Folder profiles the user enabled (`_acpmux/harness_enable`), by id. private enabledProfiles = new Set(); + private bookmarks = new Map>(); private handoffs = new MockHandoffs( () => this.sessions, (source, harness) => { @@ -450,6 +451,16 @@ export class MockAcpmuxSocket { throw Object.assign(new Error("no such session"), { code: -32001 }); this.touch(target, { unread: true }, false); return {}; + // Prompt bookmarks, as acpmux keeps them (hub/bookmarks.rs), without its seq check. + case "_acpmux/bookmark_get": + case "_acpmux/bookmark_set": { + const marks = this.bookmarks.get(target) ?? new Set(); + if (method === "_acpmux/bookmark_set") + if (params.bookmarked === true) marks.add(Number(params.seq)); + else marks.delete(Number(params.seq)); + this.bookmarks.set(target, marks); + return { sessionId: target, bookmarks: [...marks].sort((a, b) => a - b) }; + } case "_acpmux/events": return this.page(target, params); case "_acpmux/permission_respond": diff --git a/webviews/src/agent-session/acpmux/threadMinimap/ThreadMinimap.tsx b/webviews/src/agent-session/acpmux/threadMinimap/ThreadMinimap.tsx index c06d218d0196..f3f88d217ec7 100644 --- a/webviews/src/agent-session/acpmux/threadMinimap/ThreadMinimap.tsx +++ b/webviews/src/agent-session/acpmux/threadMinimap/ThreadMinimap.tsx @@ -7,7 +7,7 @@ import React, { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react"; import { transcriptColumn, type AcpmuxRow, type ConversationLayout } from "../model"; import { useT } from "../i18n"; -import { useBookmarks } from "./bookmarks"; +import { promptSeq, useBookmarks } from "./bookmarks"; import { MinimapTick } from "../../../ui/MinimapTick"; import { currentTurn, @@ -51,7 +51,7 @@ export function ThreadMinimap({ width: number; }) { const t = useT(); - const bookmarks = useBookmarks(); + const bookmarks = useBookmarks(sessionId); const lastTurns = useRef(undefined); const turns = useMemo(() => { const next = minimapTurns(rows, sessionId, lastTurns.current); @@ -176,7 +176,9 @@ export function ThreadMinimap({ const center = first + active * pitch; /// The column's top edge: the first tick's band starts half a pitch above its center. const railTop = first - pitch / 2; - const marked = turn ? bookmarks.marks.has(turn.key) : false; + /// The hovered prompt's seq in acpmux's log; a prompt not logged yet has no bookmark. + const seq = turn ? promptSeq(turn.id) : undefined; + const marked = seq !== undefined && bookmarks.marks.has(seq); return (
- )} + const index = indexAt(event.clientY); + if (index === state.at) return; + state.at = index; + setHovered(index); + setCardRow(index); + jump(index, "scrub"); + }} + onPointerUp={endScrub} + onPointerCancel={endScrub} + > + {turns.map((turn, index) => ( + = onScreen.first && index <= onScreen.last} + marked={marks.has(turn)} + describedBy={showCard && cardRow === index ? cardId : undefined} + label={t(marks.has(turn) ? "minimap.tickBookmarked" : "minimap.tick", { + index: index + 1, + count: turns.length, + prompt: turn.prompt, + })} + actions={actions} + /> + ))} + + {showCard && ( +
timing.enter()} + onPointerLeave={() => timing.leave()} + > +
+ {cardTurn.prompt} + +
+ {cardTurn.reply.length > 0 && ( +
+ {cardTurn.reply.map((block, blockIndex) => ( +

+ {block.spans.map((span, spanIndex) => + span.bold ? {span.text} : span.text, + )} +

+ ))} +
+ )} +
+ )} ); } +type TickActions = { + enter(index: number): void; + focus(index: number): void; + blur(index: number): void; + escape(): void; + click(index: number, target: EventTarget): void; +}; + +/// One prompt's row: a 10 px by 36 px button with its tick and, past the tick, the bookmark dot. const Tick = memo(function Tick({ index, - top, - pitch, - width, - tone, - tabbable, + last, + progress, + active, current, + marked, + describedBy, label, - onJump, - onFocusTick, - onMove, - last, + actions, }: { index: number; - top: number; - pitch: number; - width: number; - tone: "rest" | "current" | "active"; - tabbable: boolean; + last: number; + progress: number; + active: boolean; current: boolean; + marked: boolean; + describedBy?: string; label: string; - onJump: (index: number) => void; - onFocusTick: (index: number, immediately: boolean) => void; - onMove: (index: number) => void; - last: number; + actions: TickActions; }) { + const length = tickLength(progress); return ( onJump(index)} - onFocus={(event) => { - if (event.currentTarget.matches(":focus-visible")) onFocusTick(index, true); - }} + aria-current={current ? "true" : undefined} + aria-describedby={describedBy} + onPointerEnter={() => actions.enter(index)} + onFocus={() => actions.focus(index)} + onBlur={() => actions.blur(index)} + onClick={(event) => actions.click(index, event.target)} keyboard={(event) => { + if (event.key === "Escape") actions.escape(); const to = event.key === "ArrowUp" ? index - 1 @@ -321,27 +447,15 @@ const Tick = memo(function Tick({ : event.key === "End" ? last : undefined; - if (to !== undefined) onMove(to); + if (to !== undefined) + event.currentTarget.parentElement + ?.querySelector(`[data-tick="${Math.max(0, Math.min(last, to))}"]`) + ?.focus(); }} > - + + + ); }); - -function BookmarkIcon({ filled }: { filled: boolean }) { - return ( - - ); -} diff --git a/webviews/src/agent-session/acpmux/threadMinimap/cardTiming.ts b/webviews/src/agent-session/acpmux/threadMinimap/cardTiming.ts new file mode 100644 index 000000000000..2018429130f3 --- /dev/null +++ b/webviews/src/agent-session/acpmux/threadMinimap/cardTiming.ts @@ -0,0 +1,67 @@ +// When the minimap's preview card shows (the Codex app's tooltip timing): it opens +// CARD_OPEN_DELAY_MS after the pointer reaches the rail, at once when one closed less than +// CARD_WARM_MS before or the keyboard focused a row, and closes CARD_CLOSE_DELAY_MS after the +// pointer leaves the rail and the card. It appears and disappears on one frame. +import { CARD_CLOSE_DELAY_MS, CARD_OPEN_DELAY_MS, CARD_WARM_MS } from "./model"; + +export class CardTiming { + private opening: ReturnType | undefined; + private closing: ReturnType | undefined; + private closedAt = -Infinity; + private shown = false; + + constructor(private readonly show: (open: boolean) => void) {} + + get open(): boolean { + return this.shown; + } + + /// The pointer reached the rail or the card. + enter(): void { + clearTimeout(this.closing); + this.closing = undefined; + if (this.shown || this.opening !== undefined) return; + if (performance.now() - this.closedAt < CARD_WARM_MS) this.set(true); + else + this.opening = setTimeout(() => { + this.opening = undefined; + this.set(true); + }, CARD_OPEN_DELAY_MS); + } + + /// The pointer left the rail and the card. + leave(): void { + clearTimeout(this.opening); + this.opening = undefined; + if (!this.shown || this.closing !== undefined) return; + this.closing = setTimeout(() => { + this.closing = undefined; + this.set(false); + }, CARD_CLOSE_DELAY_MS); + } + + /// Keyboard focus: the card shows on this frame. + now(): void { + this.cancel(); + this.set(true); + } + + /// Escape, or focus leaving: the card goes on this frame. + close(): void { + this.cancel(); + this.set(false); + } + + cancel(): void { + clearTimeout(this.opening); + clearTimeout(this.closing); + this.opening = this.closing = undefined; + } + + private set(open: boolean): void { + if (open === this.shown) return; + this.shown = open; + if (!open) this.closedAt = performance.now(); + this.show(open); + } +} diff --git a/webviews/src/agent-session/acpmux/threadMinimap/model.ts b/webviews/src/agent-session/acpmux/threadMinimap/model.ts index e8c9c019d462..0d72fd0540f2 100644 --- a/webviews/src/agent-session/acpmux/threadMinimap/model.ts +++ b/webviews/src/agent-session/acpmux/threadMinimap/model.ts @@ -1,6 +1,5 @@ // The thread minimap's model: one tick per user message at the transcript's left edge -// (the Codex app's thread minimap). Pure functions, so geometry and previews test without a DOM. -// Measurements are in the lane notes (.cmux-scratch/pane-protocol/thread-minimap/minimap-spec.md). +// (the Codex desktop app's prompt rail). Pure functions, so geometry and previews need no DOM. import type { AcpmuxRow } from "../model"; export type ReplySpan = { text: string; bold: boolean }; @@ -18,47 +17,80 @@ export type MinimapTurn = { reply: ReplyBlock[]; }; -/// Tick geometry (CSS px); the drawn sizes live in threadMinimap.css. The offsets are transforms. -export const TICK_PITCH = 10; -export const TICK_LEFT = 15.5; -/// Where the popover's left edge sits: 35 px right of the ticks. -export const POPOVER_LEFT = TICK_LEFT + 35; -/// Fisheye widths by index distance from the hovered tick; farther ticks rest at the last. -const TICK_WIDTHS = [26, 20, 14, 10, 6] as const; -export const TICK_MAX_WIDTH = TICK_WIDTHS[0]; -export const TICK_REST_WIDTH = TICK_WIDTHS[TICK_WIDTHS.length - 1]; -/// The turn being read rests longer than the others (and in the accent, threadMinimap.css), so the -/// reader sees where they are in the thread at a glance (cx-f7c). -export const TICK_CURRENT_WIDTH = TICK_WIDTHS[2]; -/// Space kept free above and below the column and the popover. +/// The rail's geometry and timing, measured from 60 Hz recordings of the Codex desktop app's prompt +/// rail (lane notes: minimap-ref/SPEC.md). CSS px and ms; the drawn sizes live in threadMinimap.css. +/// The rail shows from this many prompts... +export const MIN_PROMPTS = 4; +/// ...and only when the transcript column starts this far right of the scroller's left edge. +export const MIN_GUTTER = 48; +/// The rail's left edge, in from the scroller's. +export const RAIL_LEFT = 16; +/// One row per prompt: a fixed 10 px pitch (not proportional to the thread), 36 px wide to hit. +export const ROW_PITCH = 10; +export const ROW_WIDTH = 36; +/// The tick's line box; a tick draws `tickLength(progress)` of it from the left. +export const TICK_BOX = 26; +/// Rows past this many, or past 70% of the window's height, scroll inside the rail. +export const RAIL_MAX_ROWS = 64; +export const RAIL_MAX_SHARE = 0.7; +/// The fisheye by row distance from the hovered (or scrubbed) row: 26, 20, 14, 10, then 6 px. +const PROGRESS = [1, 0.7, 0.4, 0.2] as const; +/// The preview card: it opens this long after the pointer reaches the rail, at once when one closed +/// less than CARD_WARM_MS before, and closes this long after the pointer leaves rail and card. +export const CARD_OPEN_DELAY_MS = 250; +export const CARD_WARM_MS = 300; +export const CARD_CLOSE_DELAY_MS = 100; +/// Space kept free above and below the card inside the transcript's viewport. export const EDGE_MARGIN = 8; -/// The pause before the first popover shows; moving between ticks shows the next at once. -export const POPOVER_DELAY_MS = 110; -/// Blocks of a reply the preview keeps (the popover clamps to three lines). +/// A jump lands the prompt's bubble this far below the top of the transcript's viewport. +export const LANDING_OFFSET = 35; +/// The transcript thread's top padding (.acpmux-thread): row tops start this far down the scroller. +export const THREAD_PADDING_TOP = 16; +/// A click's smooth scroll (Codex's Chromium smooth scroll, fitted), and a Previous or Next Turn step's. +export const JUMP_CURVE = [0.35, 0.05, 0, 1] as const; +export const STEP_CURVE = [0.3, 0.2, 0, 1] as const; +export const STEP_MS = 200; +/// The landing highlight on the prompt's bubble. +export const HIGHLIGHT_MS = 1400; +export const HIGHLIGHT_EASING = "cubic-bezier(0.23, 1, 0.32, 1)"; +/// Blocks of a reply the preview keeps (the card clamps to three lines). const PREVIEW_BLOCKS = 4; const PREVIEW_CHARS = 360; -export function tickWidth(distance: number | undefined): number { - if (distance === undefined) return TICK_REST_WIDTH; - return TICK_WIDTHS[Math.min(Math.abs(distance), TICK_WIDTHS.length - 1)]; +/// How magnified a row is (0 to 1) at `distance` rows from the hovered one; undefined is no hover. +export function tickProgress(distance: number | undefined): number { + if (distance === undefined) return 0; + return PROGRESS[Math.abs(distance)] ?? 0; } -/// The first tick's center and the pitch, for `count` ticks centered in a viewport `height` tall. -export function tickLayout(count: number, height: number): { first: number; pitch: number } { - if (count <= 1) return { first: height / 2, pitch: TICK_PITCH }; - const room = Math.max(0, height - 2 * EDGE_MARGIN); - // Many turns share the column: the pitch tightens until the column fits the viewport. - const pitch = Math.min(TICK_PITCH, room / (count - 1)); - return { first: (height - pitch * (count - 1)) / 2, pitch }; +/// The drawn length of a tick at `progress`: 6 px at rest, 26 px hovered. +export const tickLength = (progress: number) => TICK_BOX * (0.2308 + 0.7692 * progress); + +/// The rail's height for `count` rows in a window `windowHeight` tall: every row up to 64 rows or +/// 70% of the window, after which the rows scroll. +export function railHeight(count: number, windowHeight: number): number { + return Math.min(count * ROW_PITCH, RAIL_MAX_ROWS * ROW_PITCH, Math.floor(windowHeight * RAIL_MAX_SHARE)); } -/// The popover's top for a tick centered at `center`: centered on it, kept inside the viewport. -export function popoverOffset(center: number, popoverHeight: number, viewportHeight: number): number { - const top = center - popoverHeight / 2; - const max = viewportHeight - EDGE_MARGIN - popoverHeight; +/// The card's top for a row centered at `center`: centered on it, kept inside the viewport. +export function cardOffset(center: number, cardHeight: number, viewportHeight: number): number { + const top = center - cardHeight / 2; + const max = viewportHeight - EDGE_MARGIN - cardHeight; return Math.max(EDGE_MARGIN, Math.min(top, max)); } +/// How long a click's smooth scroll takes for `distance` px: about 200 ms for 150 px up to 400 ms +/// for 650 px and more, as the recorded Chromium scrolls took. +export function jumpDuration(distance: number): number { + const share = Math.min(1, Math.max(0, (Math.abs(distance) - 150) / 500)); + return Math.round(200 + 200 * share); +} + +/// A turn's stable key: session id, row id and a hash of the prompt, since every session numbers +/// its rows `user-` and a row's `at` is not stable across snapshots. The transcript's own +/// bookmark button (UserBubble) keys a prompt the same way. +export const turnKey = (sessionId: string, rowId: string, text: string) => `${sessionId}#${rowId}#${hash(text)}`; + /// Each prompt's turn and the reply it previews, by row object: rows are immutable, so a long /// chat's snapshot hashes and previews only the turns that changed. const turnsByPrompt = new WeakMap(); @@ -89,7 +121,7 @@ export function minimapTurns(rows: readonly AcpmuxRow[], sessionId = "", previou const turn: MinimapTurn = { index: userIndex, id: user.id, - key: `${sessionId}#${user.id}#${hash(user.text ?? "")}`, + key: turnKey(sessionId, user.id, user.text ?? ""), prompt: (user.text ?? "").replace(/\s+/g, " ").trim(), reply: reply?.text ? replyPreview(reply.text) : [], }; @@ -157,9 +189,9 @@ export function visibleTurns( return { first, last }; } -/// The scroll offset that puts a turn's prompt at the top of the viewport (the thread's padding stays above it). +/// The scroll offset that lands a turn's prompt bubble LANDING_OFFSET below the viewport's top. export function turnScrollTop(turn: MinimapTurn, tops: Float64Array): number { - return Math.max(0, tops[turn.index] ?? 0); + return Math.max(0, THREAD_PADDING_TOP + (tops[turn.index] ?? 0) - LANDING_OFFSET); } /// The start of a reply as plain blocks with bold spans; code, headings' marks and link targets drop. diff --git a/webviews/src/agent-session/acpmux/threadMinimap/parity.html b/webviews/src/agent-session/acpmux/threadMinimap/parity.html index f59ab15bb005..01eba3b90cec 100644 --- a/webviews/src/agent-session/acpmux/threadMinimap/parity.html +++ b/webviews/src/agent-session/acpmux/threadMinimap/parity.html @@ -2,7 +2,7 @@ - + Thread minimap parity diff --git a/webviews/src/agent-session/acpmux/threadMinimap/parity.tsx b/webviews/src/agent-session/acpmux/threadMinimap/parity.tsx index 23ff35aedc27..b76f0442edbe 100644 --- a/webviews/src/agent-session/acpmux/threadMinimap/parity.tsx +++ b/webviews/src/agent-session/acpmux/threadMinimap/parity.tsx @@ -1,85 +1,51 @@ -// Dev server only (threadMinimap/parity.html): the minimap over the Codex reference's nine turns, -// in the reference theme, so a capture compares frame by frame with reference.mov. The transcript -// rows are absent; the layout gives each turn a fixed height. +// l10n-allow-file: dev page fixture prompts (the Codex reference thread), not shipped UI. +// Dev server only (threadMinimap/parity.html): the transcript and its minimap over the Codex +// reference thread (eighteen "Reply with only the word ok and the number N" prompts) in the dark +// reference theme, at the recorded window's size, so a capture of hover, the card, a click jump +// with its highlight, Tab, a scrub and a bookmark compares with the Codex clips (minimap-ref). +// `?w=` and `?h=` size the page; `?prompts=` changes the count. import "../../shared/styles.css"; +import "../styles.css"; +import "../conversation/conversation.css"; import "./threadMinimap.css"; -import React, { useRef } from "react"; import { createRoot } from "react-dom/client"; import type { AcpmuxRow } from "../model"; -import { ThreadMinimap } from "./ThreadMinimap"; +import { turnView } from "../conversation/turns"; +import { VirtualTranscript } from "../App"; globalThis.__cmuxPaneStrings ??= (await import("../generated/strings.json")).default; -const turns: [string, string][] = [ - [ - "let's work on harness research stuff together, starting from the chief of staff idea", - "My starting hypothesis: **one chief of staff that owns priorities, saved state for each project, and temporary workers for specific tasks.**", - ], - [ - "let's enumerate every possible topology and compare them", - "Yes. The “chief plus workers” design assumes a human organization: one accountable coordinator, delegated labor, and summarized reporting back up the chain.", - ], - [ - "i want to see visualizations of each open it the right panel", - "I created an interactive topology explorer and opened it in the right panel. It includes:\n\n- Central planner\n- Blackboard\n- Market", - ], - [ - "```mermaid flowchart TD U[You] <--> C[Chief] C --> W1[Worker]", - "I will replace the node diagrams with Mermaid flowcharts for all topology families, start a local preview, and open that preview in the right panel.", - ], - [ - "u opened the file but not browser? maybe open it in chrome", - "The Mermaid flowcharts are now open in Chrome in the right panel. I corrected the rendering issue, and all topology diagrams display: chief, swarm, market and pipeline.", - ], - [ - "RLM techinically encompasses the chief of staff design right?", - "Yes, with an important distinction.\n\nAn **RLM is a control strategy for inference**:", - ], - [ - "is there a more generalized thing than RLM?", - "Yes. The more general concept is an **environment-interacting agent runtime**.\n\nAn RLM is one particular operator inside that runtime, alongside tools and memory.", - ], - [ - "what are the main issues with rlms", - "The main issue is that **recursion is not automatically intelligence**. It gives a model more ways to inspect context, but it also gives it more ways to fail.", - ], - [ - "remember my idea about convergent thing where events start agents", - "Built and running: **Convergent**.\n\n- Each event starts a fresh coding agent with an event-file pointer. The agent reads it and converges.", - ], -]; -const rows: AcpmuxRow[] = turns.flatMap(([prompt, reply], index) => [ - { id: `user-${index}`, version: 1, at: index + 1, kind: "user", text: prompt }, - { id: `reply-${index}`, version: 1, at: index + 1, kind: "assistant", text: reply }, -]); -const TURN = 400; -const tops = new Float64Array(rows.map((_, index) => (index >> 1) * TURN + (index & 1) * 60)); -const heights = new Float64Array(rows.map((_, index) => (index & 1 ? TURN - 60 : 60))); -const layout = { tops, heights, totalHeight: turns.length * TURN }; const params = new URLSearchParams(location.search); -const width = Number(params.get("w") ?? 546); -const height = Number(params.get("h") ?? 336); -/// The reference rests on its seventh turn. -const scrollTop = Number(params.get("top") ?? 6 * TURN); +const width = Number(params.get("w") ?? 1280); +const height = Number(params.get("h") ?? 820); +const prompts = Number(params.get("prompts") ?? 18); +const row = (id: string, kind: string, text?: string, extra: Partial = {}): AcpmuxRow => ({ + id, + kind, + text, + version: 1, + at: 1, + ...extra, +}); +const rows = Array.from({ length: prompts }, (_, index) => [ + row(`user-${index + 1}`, "user", `Reply with only the word ok and the number ${index + 1}. No tools.`), + row(`answer-${index + 1}`, "assistant", `ok ${index + 1}`), + row(`end-${index + 1}`, "turnSummary", undefined, { status: "completed", durationMs: 32_000 }), +]).flat(); -function Parity() { - const scroller = useRef(null); - return ( -
- -
- ); -} - -document.documentElement.style.setProperty("--agent-text", "rgb(255 255 254)"); -document.documentElement.style.setProperty("--agent-page-bg", "rgb(33 33 28)"); -document.documentElement.style.setProperty("--acpmux-base", "rgb(33 33 28)"); -document.body.style.cssText = "margin:0;background:rgb(33 33 28)"; -createRoot(document.getElementById("root")!).render(); +const style = document.documentElement.style; +style.setProperty("--agent-text", "rgb(218 218 218)"); +style.setProperty("--agent-muted", "rgb(129 129 129)"); +style.setProperty("--agent-page-bg", "rgb(22 22 22)"); +style.setProperty("--acpmux-base", "rgb(22 22 22)"); +document.body.style.cssText = "margin:0;background:rgb(22 22 22)"; +const root = document.getElementById("root")!; +Object.assign(root.style, { width: `${width}px`, height: `${height}px`, display: "flex", flexDirection: "column" }); +createRoot(root).render( + {}} + expanded={new Set()} + />, +); diff --git a/webviews/src/agent-session/acpmux/threadMinimap/promptMarks.ts b/webviews/src/agent-session/acpmux/threadMinimap/promptMarks.ts new file mode 100644 index 000000000000..b6d63299a121 --- /dev/null +++ b/webviews/src/agent-session/acpmux/threadMinimap/promptMarks.ts @@ -0,0 +1,30 @@ +// Bookmarked prompts as the rail, its card and the transcript's own prompt rows see them. The +// marks live in bookmarks.ts (its store and persistence); this is the one place that reads its API, +// so a change in how a mark is keyed stays here. +import { createContext, useContext } from "react"; +import { useBookmarks } from "./bookmarks"; +import { turnKey } from "./model"; + +/// A prompt as a mark names it: its row id and its key (model.ts turnKey). +export type MarkedPrompt = { id: string; key: string }; + +/// The transcript's session, for prompt rows that key their own marks (VirtualTranscript provides it). +export const PromptMarksSession = createContext(""); + +export function usePromptMarks(): { + has: (prompt: MarkedPrompt) => boolean; + toggle: (prompt: MarkedPrompt) => void; + /// Changes with every mark, for memoized consumers. + version: unknown; +} { + const { marks, toggle } = useBookmarks(); + return { has: (prompt) => marks.has(prompt.key), toggle: (prompt) => toggle(prompt.key), version: marks }; +} + +/// The mark of a transcript prompt row in the session being shown. +export function usePromptRowMark(row: { id: string; text?: string }): { marked: boolean; toggle: () => void } { + const sessionId = useContext(PromptMarksSession); + const marks = usePromptMarks(); + const prompt = { id: row.id, key: turnKey(sessionId, row.id, row.text ?? "") }; + return { marked: marks.has(prompt), toggle: () => marks.toggle(prompt) }; +} diff --git a/webviews/src/agent-session/acpmux/threadMinimap/scrollMotion.ts b/webviews/src/agent-session/acpmux/threadMinimap/scrollMotion.ts new file mode 100644 index 000000000000..819d1472a073 --- /dev/null +++ b/webviews/src/agent-session/acpmux/threadMinimap/scrollMotion.ts @@ -0,0 +1,72 @@ +// Scroll motion for the thread minimap: a JS-driven scroll on a cubic-bezier curve (the browser's +// smooth scroll cannot take a curve), the landing highlight on a prompt's bubble, and the Reduce +// Motion check both use. One scroll runs per scroller; the reader's own wheel, touch, pointer or key +// ends it where it is. +import { bezierAt, type CubicBezier } from "../../../ui/cubicBezier"; +import { HIGHLIGHT_EASING, HIGHLIGHT_MS } from "./model"; + +const running = new WeakMap void>(); +const READER_INPUTS = ["wheel", "pointerdown", "touchstart", "keydown"] as const; + +/// Reduce Motion: the system's, or the app's (its motion tokens are 0 when Reduce Motion is on or +/// ui.animationSpeed is off; AgentPaneTheme.motion). +export function reducedMotion(): boolean { + if (globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return true; + try { + const value = getComputedStyle(document.documentElement).getPropertyValue("--agent-motion-in").trim(); + return value === "0s" || value === "0ms"; + } catch { + return false; + } +} + +/// Ends the scroll running on `node`, if any, where it is. +export function stopScroll(node: HTMLElement): void { + running.get(node)?.(); +} + +/// Scrolls `node` to `target()` over `duration` ms on `curve`. The target is read each frame, so rows +/// that measure meanwhile move the landing with them. A zero duration jumps. +export function animateScroll(node: HTMLElement, target: () => number, duration: number, curve: CubicBezier): void { + stopScroll(node); + if (duration <= 0 || typeof requestAnimationFrame !== "function") { + node.scrollTop = target(); + return; + } + const from = node.scrollTop; + const start = performance.now(); + let frame = 0; + const end = () => { + cancelAnimationFrame(frame); + for (const name of READER_INPUTS) node.removeEventListener(name, end); + if (running.get(node) === end) running.delete(node); + }; + const step = (now: number) => { + const progress = Math.min(1, Math.max(0, (now - start) / duration)); + node.scrollTop = from + (target() - from) * bezierAt(curve, progress); + if (progress < 1) frame = requestAnimationFrame(step); + else end(); + }; + for (const name of READER_INPUTS) node.addEventListener(name, end, { passive: true }); + running.set(node, end); + frame = requestAnimationFrame(step); +} + +/// The landing highlight: the bubble's background starts at `--acpmux-landing-highlight` and eases +/// back to its own over HIGHLIGHT_MS. None under Reduce Motion. +export function highlightBubble(bubble: HTMLElement | null | undefined): void { + if (!bubble || typeof bubble.animate !== "function" || reducedMotion()) return; + const style = getComputedStyle(bubble); + const highlight = style.getPropertyValue("--acpmux-landing-highlight").trim(); + if (!highlight) return; + for (const animation of bubble.getAnimations?.() ?? []) if (animation.id === "acpmux-landing") animation.cancel(); + const animation = bubble.animate( + [ + { backgroundColor: highlight }, + { backgroundColor: highlight, offset: 0.35 }, + { backgroundColor: style.backgroundColor }, + ], + { duration: HIGHLIGHT_MS, easing: HIGHLIGHT_EASING }, + ); + animation.id = "acpmux-landing"; +} diff --git a/webviews/src/agent-session/acpmux/threadMinimap/threadMinimap.css b/webviews/src/agent-session/acpmux/threadMinimap/threadMinimap.css index 92b3b42b3d63..f392896c04ff 100644 --- a/webviews/src/agent-session/acpmux/threadMinimap/threadMinimap.css +++ b/webviews/src/agent-session/acpmux/threadMinimap/threadMinimap.css @@ -1,6 +1,7 @@ -/* Thread minimap (ThreadMinimap.tsx). Values are measured from the Codex app recording - (lane notes: thread-minimap/minimap-spec.md). Colors mix the theme's text into its page - color; motion is transform only, and opacity changes on the frame the hovered tick does. */ +/* Thread minimap (ThreadMinimap.tsx), as the Codex desktop app's prompt rail; numbers from its 60 Hz + recordings (minimap-ref SPEC, model.ts). Colors are the theme's tokens: in the dark reference + theme a resting tick is the muted text at 40% (#3d3d3d on #161616), a current one the text at + 60%, a hovered or focused one the text. Motion is transform only. */ .acpmux-minimap { position: sticky; top: 0; @@ -8,87 +9,171 @@ height: 0; /* Mixed into the opaque base (styles.css --acpmux-base), as the menus are: the page color can be clear. */ --acpmux-minimap-base: var(--acpmux-base, var(--agent-page-bg)); - --acpmux-minimap-fill: color-mix(in srgb, var(--agent-text) 7.2%, var(--acpmux-minimap-base)); + --acpmux-minimap-rest: var(--agent-muted); + --acpmux-minimap-text: var(--agent-text); + --acpmux-minimap-card: color-mix(in srgb, var(--agent-text) 7.5%, var(--acpmux-minimap-base)); + --acpmux-minimap-card-ring: color-mix(in srgb, var(--agent-text) 5%, var(--acpmux-minimap-base)); + /* The Codex rail's spring: 160 ms with about 0.8% overshoot. */ + --acpmux-minimap-spring: linear(0, 0.398 10%, 0.682 20%, 0.843 30%, 0.925 40%, 0.972 50%, 1.004 60%, 1.008 70%, 1.003 80%, 1); } .acpmux-minimap__rail { position: absolute; - top: 0; - left: 0; - width: 50.5px; - font: 13px -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; + margin: 0; + animation: acpmux-minimap-in 150ms cubic-bezier(0.23, 1, 0.32, 1); +} +@keyframes acpmux-minimap-in { + from { + opacity: 0; + } +} +.acpmux-minimap__list { + display: flex; + flex-direction: column; + height: 100%; + overflow-x: hidden; + overflow-y: auto; + overscroll-behavior: contain; + scrollbar-width: none; +} +.acpmux-minimap__list::-webkit-scrollbar { + display: none; +} +/* A rail longer than its room fades 2.5rem at an edge with more rows past it. */ +.acpmux-minimap__list[data-fade-top] { + mask-image: linear-gradient(to bottom, transparent, #000 2.5rem); +} +.acpmux-minimap__list[data-fade-bottom] { + mask-image: linear-gradient(to top, transparent, #000 2.5rem); +} +.acpmux-minimap__list[data-fade-top][data-fade-bottom] { + mask-image: linear-gradient(to bottom, transparent, #000 2.5rem, #000 calc(100% - 2.5rem), transparent); } .acpmux-minimap__tick { - position: absolute; - top: 0; - left: 0; - width: 100%; + position: relative; + flex: none; + display: block; + width: 36px; + height: 10px; margin: 0; padding: 0; border: 0; background: none; + color: var(--acpmux-minimap-rest); cursor: pointer; outline: none; + contain: layout paint; } -.acpmux-minimap__bar { +.acpmux-minimap__bar, +.acpmux-minimap__dot { position: absolute; - top: 50%; + top: 4px; left: 0; - width: 26px; - height: 1.8px; - margin-top: -0.9px; - background: var(--agent-text); - opacity: 0.19; + background: currentColor; + opacity: 0.4; transform-origin: 0 50%; - transition: transform 50ms cubic-bezier(0.33, 1, 0.68, 1); + /* Hovering in: the spring (the first line is the fallback for an engine without linear()). */ + transition: transform 160ms cubic-bezier(0.25, 1, 0.5, 1); + transition: transform 160ms var(--acpmux-minimap-spring); } -/* Leaving the column settles faster than hovering grows (reference frames 151-155). */ -.acpmux-minimap__rail:not([data-hovering]) .acpmux-minimap__bar { - transition-duration: 35ms; +.acpmux-minimap__bar { + width: 26px; + height: 2px; +} +/* The bookmark dot: 2 px round, 2 px past the tick's end; it moves with the tick. */ +.acpmux-minimap__dot { + left: 2px; + width: 2px; + height: 2px; + border-radius: 50%; + opacity: 0; +} +/* Leaving the rail: every row eases back to rest in 150 ms. */ +.acpmux-minimap__rail:not([data-hovering]) .acpmux-minimap__bar, +.acpmux-minimap__rail:not([data-hovering]) .acpmux-minimap__dot { + transition-duration: 150ms; +} +/* A scrub switches rows with no transition; so does Reduce Motion. */ +.acpmux-minimap__rail[data-scrubbing] .acpmux-minimap__bar, +.acpmux-minimap__rail[data-scrubbing] .acpmux-minimap__dot, +.acpmux-minimap__rail[data-reduce] .acpmux-minimap__bar, +.acpmux-minimap__rail[data-reduce] .acpmux-minimap__dot { + transition: none; +} +@media (prefers-reduced-motion: reduce) { + .acpmux-minimap__rail { + animation: none; + } + .acpmux-minimap__bar, + .acpmux-minimap__dot { + transition: none; + } +} +/* Prompts on screen: the text at 60%; back to rest while the pointer is on the rail. */ +.acpmux-minimap__tick[data-tone="current"] { + color: var(--acpmux-minimap-text); } .acpmux-minimap__tick[data-tone="current"] .acpmux-minimap__bar { - opacity: 0.54; + opacity: 0.6; +} +.acpmux-minimap__rail[data-hovering] .acpmux-minimap__tick[data-tone="current"] { + color: var(--acpmux-minimap-rest); +} +.acpmux-minimap__rail[data-hovering] .acpmux-minimap__tick[data-tone="current"] .acpmux-minimap__bar { + opacity: 0.4; +} +/* The hovered, scrubbed or focused row: the text, at once (no color transition). */ +.acpmux-minimap__tick[data-tone="active"] { + color: var(--acpmux-minimap-text); } .acpmux-minimap__tick[data-tone="active"] .acpmux-minimap__bar { opacity: 1; } -/* The turn being read: longer (ThreadMinimap TICK_CURRENT_WIDTH) and in the accent (cx-f7c). */ -.acpmux-minimap__tick[data-current] .acpmux-minimap__bar { - background: var(--agent-accent); +/* A bookmarked prompt draws its tick and dot at full opacity in its color. */ +.acpmux-minimap__tick[data-bookmarked] .acpmux-minimap__bar, +.acpmux-minimap__tick[data-bookmarked] .acpmux-minimap__dot, +.acpmux-minimap__rail[data-hovering] .acpmux-minimap__tick[data-bookmarked] .acpmux-minimap__bar { opacity: 1; } -.acpmux-minimap__tick:focus-visible .acpmux-minimap__bar { - opacity: 1; - box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--agent-text) 45%, transparent); +/* No bookmark yet: the hovered row shows a faint dot where a click would set one, a little + stronger over the spot itself. */ +.acpmux-minimap__tick[data-tone="active"]:hover:not([data-bookmarked]) .acpmux-minimap__dot { + opacity: 0.3; +} +.acpmux-minimap__tick[data-tone="active"]:not([data-bookmarked]):has(.acpmux-minimap__dot-hit:hover) .acpmux-minimap__dot { + opacity: 0.6; +} +/* The dot's hit area: the row's right end past a hovered tick (26 px), so the tick keeps its click. */ +.acpmux-minimap__dot-hit { + position: absolute; + top: 0; + right: 0; + width: 9px; + height: 10px; } -.acpmux-minimap__popover { +.acpmux-minimap__card { position: absolute; top: 0; left: 0; - width: 321px; - max-width: calc(100vw - 58.5px); + width: 320px; + max-width: calc(100vw - 16px); box-sizing: border-box; - /* The 0.5 px edge is an inset shadow: a 0.5 px border draws two device pixels wide. */ - padding: 8.5px 9px 7px; - border-radius: 11px; - background: var(--acpmux-minimap-fill); + padding: 8px; + border-radius: 12px; + background: var(--acpmux-minimap-card); box-shadow: - inset 0 0 0 0.5px color-mix(in srgb, var(--agent-text) 12.6%, var(--acpmux-minimap-base)), - 0 4px 14px color-mix(in srgb, var(--agent-shadow, rgb(0 0 0 / 20%)) 45%, transparent); + 0 0 0 0.5px var(--acpmux-minimap-card-ring), + 0 12px 32px -4px color-mix(in srgb, var(--agent-shadow, rgb(0 0 0 / 20%)) 55%, transparent), + 0 4px 10px -2px color-mix(in srgb, var(--agent-shadow, rgb(0 0 0 / 20%)) 35%, transparent); color: var(--agent-text); + font: var(--text-body, 13px) / 20px -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; -webkit-font-smoothing: antialiased; cursor: default; } -.acpmux-minimap__popover[hidden] { - display: block; - visibility: hidden; - pointer-events: none; -} .acpmux-minimap__title { display: flex; align-items: center; - gap: 9px; + gap: 8px; height: 20px; - line-height: 20px; font-weight: 500; } .acpmux-minimap__prompt { @@ -101,19 +186,24 @@ .acpmux-minimap__bookmark { flex: none; display: inline-flex; - width: 16px; - height: 16px; + align-items: center; + justify-content: center; + width: 20px; + height: 20px; margin: 0; padding: 0; border: 0; border-radius: 4px; background: none; - color: color-mix(in srgb, var(--agent-text) 48%, transparent); + color: var(--agent-muted); cursor: pointer; } -.acpmux-minimap__bookmark:hover, +.acpmux-minimap__bookmark:hover { + background: color-mix(in srgb, var(--agent-text) 8%, transparent); + color: var(--agent-text); +} .acpmux-minimap__bookmark[aria-pressed="true"] { - color: color-mix(in srgb, var(--agent-text) 80%, transparent); + color: var(--agent-text); } .acpmux-minimap__bookmark:focus-visible { outline: 1.5px solid color-mix(in srgb, var(--agent-text) 45%, transparent); @@ -124,19 +214,14 @@ -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; - margin-top: 5px; - line-height: 21px; - color: color-mix(in srgb, var(--agent-text) 45%, transparent); + margin-top: 4px; + color: var(--agent-muted); } .acpmux-minimap__reply p { margin: 0; } .acpmux-minimap__reply p + p { - margin-top: 13px; -} -.acpmux-minimap__reply p + .acpmux-minimap__item, -.acpmux-minimap__item + .acpmux-minimap__item { - margin-top: 3.5px; + margin-top: 4px; } .acpmux-minimap__reply strong { font-weight: 600; @@ -151,8 +236,8 @@ width: 10px; text-indent: 0; } -@media (prefers-reduced-motion: reduce) { - .acpmux-minimap__bar { - transition: none; - } +/* The landing highlight's first color (scrollMotion.ts highlightBubble): the bubble's own fill, a + step brighter (#2d2d2d over #1e1e1e in the dark reference theme). */ +.acpmux-row .cv-user__bubble { + --acpmux-landing-highlight: color-mix(in srgb, var(--agent-text) 22%, var(--acpmux-base, var(--agent-page-bg))); } diff --git a/webviews/src/agent-session/acpmux/threadMinimap/threadMinimap.gallery.ts b/webviews/src/agent-session/acpmux/threadMinimap/threadMinimap.gallery.ts index 71bb2f18c051..4b6c0c7b65f3 100644 --- a/webviews/src/agent-session/acpmux/threadMinimap/threadMinimap.gallery.ts +++ b/webviews/src/agent-session/acpmux/threadMinimap/threadMinimap.gallery.ts @@ -17,7 +17,7 @@ const turns: Array<[string, string]> = [ ], [ "Make the overview easy to scan while scrolling", - "The current turn uses a brighter tick, while every turn in the viewport is lit together. Hovering grows nearby ticks with a short fisheye transition.", + "Every turn in the viewport is lit together. Hovering grows nearby ticks with a 160 ms spring, all rows at once.", ], [ "Add a preview without making the transcript jump", @@ -25,7 +25,7 @@ const turns: Array<[string, string]> = [ ], [ "Keep keyboard navigation predictable", - "The rail is a roving-tabindex navigation. Arrow keys move one turn, Home and End jump to the bounds, and Enter or Space follows the turn into the transcript.", + "Every row is a tab stop, as in Codex. Focus grows the row and opens its card at once; Enter or Space follows the turn into the transcript and Escape closes the card.", ], [ "Let me mark turns I want to revisit", @@ -33,7 +33,7 @@ const turns: Array<[string, string]> = [ ], [ "Check the long-chat recording against the implementation", - "The measured reference has a 10 px pitch, 6 px resting ticks, a 26 px hovered tick, and a 110 ms preview delay. The parity fixture replays those timings frame by frame.", + "The measured reference has a 10 px pitch, 6 px resting ticks, a 26 px hovered tick, and a 250 ms preview delay. The parity page replays those timings.", ], [ "Summarize what is ready to land", @@ -41,10 +41,18 @@ const turns: Array<[string, string]> = [ ], ]; -const rows = turns.flatMap(([prompt, reply], index) => [ - user(prompt, 30 - index * 2), - assistant(reply, 29.8 - index * 2), - summary(29.6 - index * 2, { status: "completed" }), +/// Eighteen prompts, as the Codex reference thread has: the nine above, then short follow-ups. +const all: Array<[string, string]> = [ + ...turns, + ...Array.from({ length: 9 }, (_, index): [string, string] => [ + `Follow-up ${index + 1}: tighten the rail's spacing check`, + `Checked again: the rows keep a 10 px pitch and the card stays flush right of row ${index + 10}.`, + ]), +]; +const rows = all.flatMap(([prompt, reply], index) => [ + user(prompt, 60 - index * 2), + assistant(reply, 59.8 - index * 2), + summary(59.6 - index * 2, { status: "completed" }), ]); export default agentPaneEntry({ @@ -57,17 +65,31 @@ export default agentPaneEntry({ covers: [ "agent-session/acpmux/App.tsx#VirtualTranscript", "agent-session/acpmux/threadMinimap/ThreadMinimap.tsx#ThreadMinimap", + "agent-session/acpmux/threadMinimap/BookmarkIcon.tsx#BookmarkIcon", ], variants: { "long-chat": { - note: "A long conversation with one overview tick per prompt, a viewport run of lit turns, and the turn being read as a longer accent tick. The narrow gallery width stays above the minimap's 28 px gutter threshold.", + note: "Eighteen prompts as the Codex rail: 10 px rows 16 px from the left edge, the prompts on screen brighter. Hovering row 8 magnifies it and its neighbors (26, 20, 14, 10 px) and opens the preview card 250 ms later, flush right of the row.", snapshot: chat(rows, { title: "Thread minimap review" }), play: async (ctx) => { - // The PR diff runner also replays removed base widths, where the product intentionally - // hides the minimap below its gutter threshold. Current head widths always expose tick 4. - if (!ctx.document.querySelector('[data-tick="4"]')) return; - await ctx.hover({ selector: '[data-tick="4"]' }); - await ctx.waitFor(() => ctx.document.querySelector(".acpmux-minimap__popover:not([hidden])")); + // The PR diff runner also replays base widths where the rail can be hidden; skip there. + if (!ctx.document.querySelector('[data-tick="8"]')) return; + await ctx.hover({ selector: '[data-tick="8"]' }); + await ctx.waitFor(() => ctx.document.querySelector(".acpmux-minimap__card")); + }, + }, + bookmarked: { + note: "A bookmarked prompt: its tick at full opacity with the 2 px dot past it, and the card's bookmark filled. The card's button (or a click on the dot's spot, or the prompt's own row button) sets it.", + snapshot: chat(rows, { title: "Thread minimap bookmarks" }), + play: async (ctx) => { + if (!ctx.document.querySelector('[data-tick="5"]')) return; + await ctx.focus({ selector: '[data-tick="5"]' }); + await ctx.waitFor(() => ctx.document.querySelector(".acpmux-minimap__card")); + if (!ctx.document.querySelector('[data-tick="5"][data-bookmarked]')) + await ctx.click({ selector: ".acpmux-minimap__bookmark" }); + await ctx.waitFor(() => ctx.document.querySelector('[data-tick="5"][data-bookmarked]')); + await ctx.hover({ selector: '[data-tick="5"]' }); + await ctx.waitFor(() => ctx.document.querySelector('.acpmux-minimap__bookmark[aria-pressed="true"]')); }, }, }, diff --git a/webviews/test/thread-minimap-motion.test.ts b/webviews/test/thread-minimap-motion.test.ts index cec6abd9c1fb..912869871a70 100644 --- a/webviews/test/thread-minimap-motion.test.ts +++ b/webviews/test/thread-minimap-motion.test.ts @@ -123,11 +123,13 @@ await requireBrowserLane("thread-minimap-motion.test.ts", async () => { await sampling; const over = await page.evaluate(() => (window as unknown as { __over: number }).__over); const after = (await samples(page)).filter((entry) => entry.t >= over); - const at = (ms: number) => after.find((entry) => entry.t - over >= ms)!.width; - // Moving by the second frame (no dwell), not there yet, there by 160 ms (plus a frame). - expect(at(40)).toBeGreaterThan(7); - expect(at(40)).toBeLessThan(25.5); - expect(at(180)).toBeGreaterThan(25.4); + // It starts moving within two frames of the pointer (no dwell), passes through the lengths + // between (a transition, not a jump) and is there 160 ms (plus a frame) after it started. + const start = after.find((entry) => entry.width > 6.5)!; + expect(start.t - over).toBeLessThan(60); + expect(after.some((entry) => entry.width > 8 && entry.width < 24)).toBe(true); + expect(after.find((entry) => entry.t - start.t >= 160)!.width).toBeGreaterThan(25.4); + expect(after.find((entry) => entry.t - start.t >= 40)!.width).toBeLessThan(25.4); expect(Math.max(...after.map((entry) => entry.width))).toBeLessThan(26 * 1.012); const hovered = await page.evaluate(() => { const css = getComputedStyle(document.querySelector('[data-tick="5"] .acpmux-minimap__bar')!); @@ -150,13 +152,14 @@ await requireBrowserLane("thread-minimap-motion.test.ts", async () => { await page.mouse.move(point.x, point.y); await page.waitForTimeout(400); const sampling = sample(page, 900); - await page.evaluate(() => { - document.addEventListener("click", () => ((window as unknown as { __over: number }).__over = performance.now()), { - once: true, - capture: true, - }); - }); - await page.mouse.click(point.x, point.y); + // The click, while the target's row is mounted (an unmounted one jumps at once, by design). + const mounted = await page.evaluate((index) => { + const row = document.querySelector(`.acpmux-row[data-row-id="t${index}-user"]`); + (window as unknown as { __over: number }).__over = performance.now(); + document.querySelector(`[data-tick="${index}"]`)!.click(); + return row !== null; + }, target); + expect(mounted).toBe(true); await sampling; const clicked = await page.evaluate(() => (window as unknown as { __over: number }).__over); const scrolls = (await samples(page)).filter((entry) => entry.t >= clicked); @@ -196,7 +199,8 @@ await requireBrowserLane("thread-minimap-motion.test.ts", async () => { const css = getComputedStyle(document.querySelector('[data-tick="9"] .acpmux-minimap__bar')!); return { duration: css.transitionDuration, width: 26 * new DOMMatrixReadOnly(css.transform).a }; }); - expect(hovered.duration).toBe("0s"); + // No transition (an engine may report a stylesheet's near-zero reduce-motion duration). + expect(parseFloat(hovered.duration)).toBeLessThan(0.001); expect(Math.round(hovered.width)).toBe(26); const result = await page.evaluate(async () => { const scroller = document.querySelector(".acpmux-scroll")!; From c6a863f3a267a70c6c0ea2f212cebd689dca469c Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 14 Oct 2026 03:25:59 -0700 Subject: [PATCH 05/27] cmux-next: regenerate action exports for the bookmarked-prompt steps Generated by scripts/measure/export-action-surfaces.sh on the fleet. Co-Authored-By: Claude Opus 5.5 --- plans/cmux-next/action-surfaces.json | 186 ++++++++++++++++--------- plans/cmux-next/actions.md | 10 +- web/data/cmux-shortcuts.generated.json | 140 +++++++++---------- 3 files changed, 195 insertions(+), 141 deletions(-) diff --git a/plans/cmux-next/action-surfaces.json b/plans/cmux-next/action-surfaces.json index 2f54d282e57e..6f58a515a78d 100644 --- a/plans/cmux-next/action-surfaces.json +++ b/plans/cmux-next/action-surfaces.json @@ -18231,72 +18231,6 @@ "title_key" : "action.agentPane.searchChats", "title_table" : "ActionCatalog" }, - { - "cli" : "guiOnly", - "cli_name" : "action agent-pane-previous-turn", - "context_menu" : "guiOnly", - "context_menus" : [ - - ], - "default_aliases" : [ - - ], - "default_chord" : null, - "default_shortcut" : { - "key" : "", - "modifiers" : [ - "ctrl", - "opt" - ] - }, - "id" : "agentPane.previousTurn", - "mcp" : "guiOnly", - "palette" : "offered", - "palette_section" : { - "id" : "category.agents", - "order" : 109, - "title" : "Agents", - "title_key" : "category.agents", - "title_table" : "Localizable" - }, - "palette_suggested" : null, - "title" : "Previous Turn", - "title_key" : "action.agentPane.previousTurn", - "title_table" : "ActionCatalog" - }, - { - "cli" : "guiOnly", - "cli_name" : "action agent-pane-next-turn", - "context_menu" : "guiOnly", - "context_menus" : [ - - ], - "default_aliases" : [ - - ], - "default_chord" : null, - "default_shortcut" : { - "key" : "", - "modifiers" : [ - "ctrl", - "opt" - ] - }, - "id" : "agentPane.nextTurn", - "mcp" : "guiOnly", - "palette" : "offered", - "palette_section" : { - "id" : "category.agents", - "order" : 109, - "title" : "Agents", - "title_key" : "category.agents", - "title_table" : "Localizable" - }, - "palette_suggested" : null, - "title" : "Next Turn", - "title_key" : "action.agentPane.nextTurn", - "title_table" : "ActionCatalog" - }, { "cli" : "guiOnly", "cli_name" : "action agent-pane-permission-allow-once", @@ -19050,6 +18984,126 @@ "title_key" : "action.computerUseStop", "title_table" : "ActionCatalog" }, + { + "cli" : "guiOnly", + "cli_name" : "action agent-pane-previous-turn", + "context_menu" : "guiOnly", + "context_menus" : [ + + ], + "default_aliases" : [ + + ], + "default_chord" : null, + "default_shortcut" : { + "key" : "", + "modifiers" : [ + "ctrl", + "opt" + ] + }, + "id" : "agentPane.previousTurn", + "mcp" : "guiOnly", + "palette" : "offered", + "palette_section" : { + "id" : "category.agents", + "order" : 109, + "title" : "Agents", + "title_key" : "category.agents", + "title_table" : "Localizable" + }, + "palette_suggested" : null, + "title" : "Previous Turn", + "title_key" : "action.agentPane.previousTurn", + "title_table" : "ActionCatalog" + }, + { + "cli" : "guiOnly", + "cli_name" : "action agent-pane-next-turn", + "context_menu" : "guiOnly", + "context_menus" : [ + + ], + "default_aliases" : [ + + ], + "default_chord" : null, + "default_shortcut" : { + "key" : "", + "modifiers" : [ + "ctrl", + "opt" + ] + }, + "id" : "agentPane.nextTurn", + "mcp" : "guiOnly", + "palette" : "offered", + "palette_section" : { + "id" : "category.agents", + "order" : 109, + "title" : "Agents", + "title_key" : "category.agents", + "title_table" : "Localizable" + }, + "palette_suggested" : null, + "title" : "Next Turn", + "title_key" : "action.agentPane.nextTurn", + "title_table" : "ActionCatalog" + }, + { + "cli" : "guiOnly", + "cli_name" : "action agent-pane-previous-bookmarked-prompt", + "context_menu" : "guiOnly", + "context_menus" : [ + + ], + "default_aliases" : [ + + ], + "default_chord" : null, + "default_shortcut" : null, + "id" : "agentPane.previousBookmarkedPrompt", + "mcp" : "guiOnly", + "palette" : "offered", + "palette_section" : { + "id" : "category.agents", + "order" : 109, + "title" : "Agents", + "title_key" : "category.agents", + "title_table" : "Localizable" + }, + "palette_suggested" : null, + "title" : "Previous Bookmarked Prompt", + "title_key" : "action.agentPane.previousBookmarkedPrompt", + "title_table" : "ActionCatalog" + }, + { + "cli" : "guiOnly", + "cli_name" : "action agent-pane-next-bookmarked-prompt", + "context_menu" : "guiOnly", + "context_menus" : [ + + ], + "default_aliases" : [ + + ], + "default_chord" : null, + "default_shortcut" : null, + "id" : "agentPane.nextBookmarkedPrompt", + "mcp" : "guiOnly", + "palette" : "offered", + "palette_section" : { + "id" : "category.agents", + "order" : 109, + "title" : "Agents", + "title_key" : "category.agents", + "title_table" : "Localizable" + }, + "palette_suggested" : null, + "title" : "Next Bookmarked Prompt", + "title_key" : "action.agentPane.nextBookmarkedPrompt", + "title_table" : "ActionCatalog" + }, { "cli" : "offered", "cli_name" : "agent add-harness", diff --git a/plans/cmux-next/actions.md b/plans/cmux-next/actions.md index 6d29de10c793..063aa88f296d 100644 --- a/plans/cmux-next/actions.md +++ b/plans/cmux-next/actions.md @@ -44,14 +44,14 @@ Declare its placements (menu, group, rank) and whether the CLI offers it, or nam - `browser`: 168 - `sidebar`: 72 - `notifications`: 21 -- `agents`: 58 +- `agents`: 60 - `cloud`: 52 - `remote`: 10 - `settings`: 79 -## Counts (950 actions) +## Counts (952 actions) -Palette 914, CLI verbs 511, right-click 492, MCP tools 442. +Palette 916, CLI verbs 511, right-click 492, MCP tools 442. ## Menus @@ -112,7 +112,7 @@ Palette 914, CLI verbs 511, right-click 492, MCP tools 442. **liveInput** (96): `taskManager.killProcess`, `toggleChecklistItemComplete`, `groupSelectedWorkspaces`, `canvasAlignLeft`, `canvasAlignRight`, `canvasAlignTop`, `canvasAlignBottom`, `canvasEqualizeWidths`, `canvasEqualizeHeights`, `canvasDistributeHorizontally`, `canvasDistributeVertically`, `simulatorHome`, `simulatorRotateLeft`, `simulatorRotateRight`, `simulatorToggleAppearance`, `simulatorToggleSoftwareKeyboard`, `toggleTerminalCopyMode`, `palette.terminalToggleTextBoxInput`, `cycleTextBoxSubmitAction`, `attachTextBoxFile`, `sendCtrlFToTerminal`, `pasteLastScreenshot`, `find`, `findInDirectory`, `findNext`, `findPrevious`, `hideFind`, `useSelectionForFind`, `terminalCopy`, `terminalPaste`, `browserScreenshotSection`, `saveFilePreview`, `toggleFileEditorWordWrap`, `diffViewerNextLine`, `diffViewerPreviousLine`, `diffViewerHalfPageDown`, `diffViewerHalfPageUp`, `diffViewerNextHunk`, `diffViewerPreviousHunk`, `diffViewerGoToBottom`, `diffViewerGoToTop`, `diffViewerSearch`, `diffViewerNextFile`, `diffViewerPreviousFile`, `omnibar.openInBackgroundTab`, `omnibar.openInForegroundTab`, `browser.prompt.allow`, `browser.prompt.block`, `fileEditorGotoLine`, `fileEditorReplace`, `fileEditorAction`, `fileExplorerOpenSelection`, `fileExplorerOpenSelectionFinderAlias`, `fileExplorerOpenInCmux`, `fileExplorerReveal`, `fileExplorerCopyPath`, `fileExplorerCopyRelativePath`, `fileExplorerOpenWith`, `vaultOpenSession`, `vaultResumeInNewWorkspace`, `vaultCopyResumeCommand`, `vaultOpenPullRequest`, `checklistEditItem`, `checklistMarkInProgress`, `checklistCompleteItem`, `checklistRemoveItem`, `checklistOpenAsPane`, `checklistAttachImages`, `toggleUnread`, `notificationCopy`, `notificationToggleRead`, `notificationDismiss`, `palette.toggleDictation`, `terminal.selectAll`, `terminal.scrollToSelection`, `markdownSave`, `markdownLink`, `markdownBack`, `markdownForward`, `list.next`, `list.previous`, `paletteKey.firstItem`, `paletteKey.lastItem`, `paletteKey.pageUp`, `paletteKey.pageDown`, `paletteKey.submit`, `paletteKey.submitAlternate`, `paletteKey.openActions`, `paletteKey.closeActions`, `paletteKey.toggleActions`, `paletteKey.escape`, `paletteKey.enterRow`, `paletteKey.leaveLevel`, `paletteKey.back`, `paletteKey.filterDeleteBackward`, `paletteKey.closeItem` -**guiOnly** (145): `openSettings`, `closeAllWindows`, `zoomWindow`, `selectNextWindow`, `selectPreviousWindow`, `minimizeWindow`, `toggleFullScreen`, `globalSearch`, `commandPalette`, `palette.openTaskManager`, `palette.sleepyMode`, `about`, `revealWorkspaceInFinder`, `workspaceGroup.editConfig`, `manageLayouts`, `palette.openWorkspacePullRequests`, `palette.findWork`, `toggleSplitZoom`, `canvasOverview`, `hints.show`, `palette.toggleFullWidthTab`, `tab.showResources`, `workspace.showResources`, `home.newMessage`, `toggleBrowserDeveloperTools`, `showBrowserJavaScriptConsole`, `inspectBrowserElement`, `toggleBrowserFocusMode`, `toggleBrowserDesignMode`, `toggleReactGrab`, `browserLinkHints`, `browserLinkHintsNewSplit`, `palette.browserToggleOmnibar`, `importFromBrowser`, `password.importCSV`, `passwords.open`, `openLinkInDefaultBrowser`, `browserPrint`, `filePreviewOpenWith`, `filePreviewOpenExternally`, `filePreviewRevealInFinder`, `palette.vscodeServeWebStop`, `palette.vscodeServeWebRestart`, `browser.allowAgentWithExtensions`, `browser.importFromFiles`, `browser.media.show`, `browser.downloads.show`, `browser.profile.choose`, `browser.overflow.menu`, `browser.openLocally`, `browser.openOnMachine`, `browser.download.openBlockedSiteSettings`, `browser.link.saveAs`, `browser.image.saveAs`, `browser.selection.lookUp`, `browser.pageInfo`, `browser.pageInfo.connection`, `browser.pageInfo.certificate`, `browser.pageInfo.cookies`, `browser.pageInfo.manageSiteData`, `browser.pageInfo.siteSettings`, `browser.pageInfo.aboutThisPage`, `browser.certificateWarning.proceed`, `browser.certificateWarning.goBack`, `browser.extensions.menu`, `browser.extensions.manage`, `browser.extensions.webStore`, `browser.extension.options`, `browserProfile.delete`, `browserProfile.manageExtensions`, `sidebar.profileMenu`, `browser.downloads.showFolder`, `toggleSidebar`, `toggleRightSidebar`, `switchRightSidebarToFiles`, `switchRightSidebarToFind`, `switchRightSidebarToSessions`, `switchRightSidebarToFeed`, `switchRightSidebarToDock`, `switchRightSidebarToMachines`, `feed.show`, `showNotifications`, `notifications.dismissHighlight`, `palette.addHarness`, `agentPane.continueIn`, `agentPane.switchModel`, `agentPane.createCheckpoint`, `agentPane.searchFiles`, `agentPane.copyLastCodeBlock`, `agentPane.archiveChat`, `agentPane.searchChats`, `agentPane.previousTurn`, `agentPane.nextTurn`, `agentPane.permission.allowOnce`, `agentPane.permission.allowChat`, `agentPane.permission.deny`, `agentPane.permission.expand`, `agentPane.permission.retry`, `agentPane.permission.revoke`, `agentPane.permission.refresh`, `palette.openTerminalChatView`, `palette.computerUse.setup`, `palette.computerUse.accessibility`, `palette.computerUse.screenRecording`, `home.toggleChiefSettings`, `home.stopChief`, `agent.harness.addFromRegistry`, `agent.harness.updateAll`, `palette.cloud.tools`, `cloudOpenMachine`, `openTeamPicker`, `palette.mobileConnect`, `palette.openCmuxSettingsFile`, `palette.openGhosttySettings`, `ghostty.showDiagnostics`, `palette.searchShortcuts`, `palette.pro.upgrade`, `sendFeedback`, `help.featureFlags`, `help.documentation`, `appearance.customize`, `recentlyFocused`, `recentlyClosed`, `history.commands`, `agentHistory.show`, `browserShowHistory`, `history.search`, `bookmark.toggleBar`, `bookmark.manager`, `sidebar.section.hide`, `sidebar.projects.hide`, `sidebar.sections.showHidden`, `sidebar.spaces.hide`, `sidebar.spaces.show`, `sidebar.profileControl.hide`, `sidebar.profileControl.show`, `sidebar.groupBy.none`, `sidebar.groupBy.folder`, `sidebar.density.compact`, `sidebar.density.expanded`, `sidebar.workspaceTabs.toggle`, `appStore.showInstalled`, `tasks.new`, `app.shareCmux`, `server.showPanel` +**guiOnly** (147): `openSettings`, `closeAllWindows`, `zoomWindow`, `selectNextWindow`, `selectPreviousWindow`, `minimizeWindow`, `toggleFullScreen`, `globalSearch`, `commandPalette`, `palette.openTaskManager`, `palette.sleepyMode`, `about`, `revealWorkspaceInFinder`, `workspaceGroup.editConfig`, `manageLayouts`, `palette.openWorkspacePullRequests`, `palette.findWork`, `toggleSplitZoom`, `canvasOverview`, `hints.show`, `palette.toggleFullWidthTab`, `tab.showResources`, `workspace.showResources`, `home.newMessage`, `toggleBrowserDeveloperTools`, `showBrowserJavaScriptConsole`, `inspectBrowserElement`, `toggleBrowserFocusMode`, `toggleBrowserDesignMode`, `toggleReactGrab`, `browserLinkHints`, `browserLinkHintsNewSplit`, `palette.browserToggleOmnibar`, `importFromBrowser`, `password.importCSV`, `passwords.open`, `openLinkInDefaultBrowser`, `browserPrint`, `filePreviewOpenWith`, `filePreviewOpenExternally`, `filePreviewRevealInFinder`, `palette.vscodeServeWebStop`, `palette.vscodeServeWebRestart`, `browser.allowAgentWithExtensions`, `browser.importFromFiles`, `browser.media.show`, `browser.downloads.show`, `browser.profile.choose`, `browser.overflow.menu`, `browser.openLocally`, `browser.openOnMachine`, `browser.download.openBlockedSiteSettings`, `browser.link.saveAs`, `browser.image.saveAs`, `browser.selection.lookUp`, `browser.pageInfo`, `browser.pageInfo.connection`, `browser.pageInfo.certificate`, `browser.pageInfo.cookies`, `browser.pageInfo.manageSiteData`, `browser.pageInfo.siteSettings`, `browser.pageInfo.aboutThisPage`, `browser.certificateWarning.proceed`, `browser.certificateWarning.goBack`, `browser.extensions.menu`, `browser.extensions.manage`, `browser.extensions.webStore`, `browser.extension.options`, `browserProfile.delete`, `browserProfile.manageExtensions`, `sidebar.profileMenu`, `browser.downloads.showFolder`, `toggleSidebar`, `toggleRightSidebar`, `switchRightSidebarToFiles`, `switchRightSidebarToFind`, `switchRightSidebarToSessions`, `switchRightSidebarToFeed`, `switchRightSidebarToDock`, `switchRightSidebarToMachines`, `feed.show`, `showNotifications`, `notifications.dismissHighlight`, `palette.addHarness`, `agentPane.continueIn`, `agentPane.switchModel`, `agentPane.createCheckpoint`, `agentPane.searchFiles`, `agentPane.copyLastCodeBlock`, `agentPane.archiveChat`, `agentPane.searchChats`, `agentPane.permission.allowOnce`, `agentPane.permission.allowChat`, `agentPane.permission.deny`, `agentPane.permission.expand`, `agentPane.permission.retry`, `agentPane.permission.revoke`, `agentPane.permission.refresh`, `palette.openTerminalChatView`, `palette.computerUse.setup`, `palette.computerUse.accessibility`, `palette.computerUse.screenRecording`, `home.toggleChiefSettings`, `home.stopChief`, `agentPane.previousTurn`, `agentPane.nextTurn`, `agentPane.previousBookmarkedPrompt`, `agentPane.nextBookmarkedPrompt`, `agent.harness.addFromRegistry`, `agent.harness.updateAll`, `palette.cloud.tools`, `cloudOpenMachine`, `openTeamPicker`, `palette.mobileConnect`, `palette.openCmuxSettingsFile`, `palette.openGhosttySettings`, `ghostty.showDiagnostics`, `palette.searchShortcuts`, `palette.pro.upgrade`, `sendFeedback`, `help.featureFlags`, `help.documentation`, `appearance.customize`, `recentlyFocused`, `recentlyClosed`, `history.commands`, `agentHistory.show`, `browserShowHistory`, `history.search`, `bookmark.toggleBar`, `bookmark.manager`, `sidebar.section.hide`, `sidebar.projects.hide`, `sidebar.sections.showHidden`, `sidebar.spaces.hide`, `sidebar.spaces.show`, `sidebar.profileControl.hide`, `sidebar.profileControl.show`, `sidebar.groupBy.none`, `sidebar.groupBy.folder`, `sidebar.density.compact`, `sidebar.density.expanded`, `sidebar.workspaceTabs.toggle`, `appStore.showInstalled`, `tasks.new`, `app.shareCmux`, `server.showPanel` **clipboard** (22): `copyWorkspaceSSHError`, `palette.copyWorkspaceID`, `palette.copyWorkspaceIDAndRef`, `palette.copyWorkspaceLink`, `workspace.copyPath`, `workspaceGroup.copyID`, `palette.copyIdentifiers`, `palette.copyPaneID`, `palette.copyPaneLink`, `palette.copySurfaceID`, `palette.copySurfaceLink`, `browser.copyURL`, `browser.link.copy`, `browser.link.copyText`, `browser.image.copy`, `browser.image.copyAddress`, `browser.selection.copy`, `cloudCopyLink`, `cloudCopyPort`, `cloudCopyMachineID`, `remote.copyError`, `bookmark.copyLink` @@ -136,7 +136,7 @@ Palette 914, CLI verbs 511, right-click 492, MCP tools 442. **liveInput** (22): `hints.show`, `toggleTerminalCopyMode`, `palette.terminalToggleTextBoxInput`, `cycleTextBoxSubmitAction`, `attachTextBoxFile`, `sendCtrlFToTerminal`, `pasteLastScreenshot`, `findInDirectory`, `findNext`, `findPrevious`, `hideFind`, `browserLinkHints`, `browserLinkHintsNewSplit`, `omnibar.openInBackgroundTab`, `omnibar.openInForegroundTab`, `browser.prompt.allow`, `browser.prompt.block`, `toggleUnread`, `palette.toggleDictation`, `terminal.scrollToSelection`, `list.next`, `list.previous` -**guiOnly** (20): `browser.media.show`, `browser.downloads.show`, `browser.profile.choose`, `browser.overflow.menu`, `browser.download.openBlockedSiteSettings`, `agentPane.continueIn`, `agentPane.switchModel`, `agentPane.createCheckpoint`, `agentPane.searchFiles`, `agentPane.copyLastCodeBlock`, `agentPane.archiveChat`, `agentPane.previousTurn`, `agentPane.nextTurn`, `agentPane.permission.allowOnce`, `agentPane.permission.allowChat`, `agentPane.permission.deny`, `agentPane.permission.expand`, `agentPane.permission.retry`, `agentPane.permission.revoke`, `agentPane.permission.refresh` +**guiOnly** (22): `browser.media.show`, `browser.downloads.show`, `browser.profile.choose`, `browser.overflow.menu`, `browser.download.openBlockedSiteSettings`, `agentPane.continueIn`, `agentPane.switchModel`, `agentPane.createCheckpoint`, `agentPane.searchFiles`, `agentPane.copyLastCodeBlock`, `agentPane.archiveChat`, `agentPane.permission.allowOnce`, `agentPane.permission.allowChat`, `agentPane.permission.deny`, `agentPane.permission.expand`, `agentPane.permission.retry`, `agentPane.permission.revoke`, `agentPane.permission.refresh`, `agentPane.previousTurn`, `agentPane.nextTurn`, `agentPane.previousBookmarkedPrompt`, `agentPane.nextBookmarkedPrompt` **noObject** (186): `openSettings`, `newWindow`, `newIncognitoWindow`, `closeWindow`, `closeAllWindows`, `zoomWindow`, `selectNextWindow`, `selectPreviousWindow`, `minimizeWindow`, `toggleFullScreen`, `quit`, `quitKeepSessions`, `quitEndSessions`, `quitEndEverything`, `globalSearch`, `palette.open`, `commandPalette`, `palette.openTaskManager`, `palette.sleepyMode`, `keepMacAwake`, `about`, `workspace.closeAllInAllWindows`, `manageLayouts`, `palette.findWork`, `workspace.importClassic`, `reopenClosedBrowserPanel`, `home.show`, `home.tab`, `home.channels`, `home.attachFiles`, `home.newMessage`, `home.invite`, `home.newChief`, `home.saveFlightRecording`, `palette.browserClearHistory`, `importFromBrowser`, `password.importCSV`, `passwords.open`, `palette.enableBrowser`, `palette.disableBrowser`, `browser.allowAgentWithExtensions`, `browser.importFromFiles`, `sidebar.profileMenu`, `browser.downloads.showFolder`, `toggleRightSidebar`, `switchRightSidebarToFiles`, `switchRightSidebarToFind`, `switchRightSidebarToSessions`, `switchRightSidebarToFeed`, `switchRightSidebarToDock`, `switchRightSidebarToMachines`, `palette.toggleMatchTerminalBackground`, `feed.show`, `showNotifications`, `markAllNotificationsRead`, `clearAllNotifications`, `notifications.toggleBanners`, `notifications.dismissal.keystroke`, `notifications.dismissal.focus`, `notifications.dismissal.click`, `notifications.dismissal.explicit`, `notifications.dismissal.timeout`, `notifications.dismissal.never`, `palette.quickAgentChat`, `palette.startAgentFromAnyApp`, `palette.addHarness`, `palette.openTerminalChatView`, `palette.launchClaudeTeams`, `palette.launchCodexTeams`, `palette.computerUse.setup`, `palette.computerUse.accessibility`, `palette.computerUse.screenRecording`, `agent.openSessionWorkspace`, `home.toggleChiefSettings`, `home.stopChief`, `chief.openMemoryInspector`, `agentActivity.open`, `computerUseStop`, `agent.harness.add`, `agent.harness.addFromRegistry`, `agent.harness.remove`, `agent.harness.restore`, `agent.harness.doctor`, `agent.harness.updateAll`, `newCloudMachine`, `cloudDiagnostics`, `openTeamPicker`, `palette.auth.signIn`, `palette.auth.signOut`, `palette.mobileConnect`, `accounts.show`, `accounts.refresh`, `accounts.reauthenticate`, `accounts.connect`, `accounts.remove`, `remote.openBrowserTab`, `remote.openLocalBrowserTab`, `reloadConfiguration`, `palette.openCmuxSettingsFile`, `palette.openGhosttySettings`, `ghostty.showDiagnostics`, `palette.makeDefaultBrowser`, `palette.makeDefaultTerminal`, `palette.toggleSetting`, `palette.shortcutKeymap`, `palette.searchShortcuts`, `keybindings.open`, `palette.installCLI`, `palette.uninstallCLI`, `palette.restartSocketListener`, `palette.checkForUpdates`, `updates.whatsNew`, `announcements.show`, `announcements.hide`, `palette.applyUpdateIfAvailable`, `palette.switchAppChannel`, `palette.pro.upgrade`, `sendFeedback`, `help.showCrashLogs`, `help.featureFlags`, `help.documentation`, `appearance.density.compact`, `appearance.density.comfortable`, `appearance.animationSpeed.fast`, `appearance.animationSpeed.normal`, `appearance.animationSpeed.off`, `browser.defaultEngine.chromium`, `browser.defaultEngine.webkit`, `appearance.paneBorder.toggle`, `appearance.panePadding.toggle`, `appearance.paneCorners.toggle`, `layout.centerFocusedColumn.never`, `layout.centerFocusedColumn.always`, `layout.centerFocusedColumn.onOverflow`, `focusRing.toggle`, `focusRing.style.ring`, `focusRing.style.glow`, `focusRing.singlePane.toggle`, `appearance.paneBorderWidth.toggle`, `appearance.paneBorderColor.reset`, `appearance.titlebar.minimal`, `appearance.titlebar.standard`, `appearance.customize`, `appearance.chromeStyle.default`, `appearance.chromeStyle.card`, `appearance.chromeStyle.cardOutlined`, `appearance.chromeStyle.flat`, `appearance.chromeStyle.flatSidebarLine`, `appearance.chromeStyle.bare`, `appearance.chromeStyle.panes`, `appearance.chromeStyle.twoTone`, `browser.hibernation.off`, `browser.hibernation.moderate`, `browser.hibernation.aggressive`, `layout.toggleStripScrollbar`, `recentlyFocused`, `recentlyClosed`, `history.commands`, `history.show`, `agentHistory.show`, `browserShowHistory`, `history.search`, `history.resumeAgentSession`, `history.reopen`, `history.open`, `history.clear`, `layout.undo`, `bookmark.add`, `bookmark.import`, `bookmark.importFromBrowser`, `bookmark.export`, `appStore.showInstalled`, `app.hide`, `app.unhide`, `app.open`, `app.command.run`, `tasks.show`, `tasks.new`, `tasks.showMine`, `link.open`, `app.shareCmux`, `server.makeThisMacAServer`, `server.stopServing`, `server.addServer`, `server.showPanel`, `server.showHealth` diff --git a/web/data/cmux-shortcuts.generated.json b/web/data/cmux-shortcuts.generated.json index 33d2e6c0d970..072f6ceadcfa 100644 --- a/web/data/cmux-shortcuts.generated.json +++ b/web/data/cmux-shortcuts.generated.json @@ -7621,76 +7621,6 @@ } ] }, - { - "id": "agentPane.previousTurn", - "title": { - "en": "Previous Turn", - "ar": "الدور السابق", - "bs": "Prethodni krug", - "da": "Forrige tur", - "de": "Vorherige Runde", - "es": "Turno anterior", - "fr": "Tour précédent", - "it": "Turno precedente", - "ja": "前のターン", - "km": "វេនមុន", - "ko": "이전 턴", - "no": "Forrige runde", - "pl": "Poprzednia tura", - "pt-BR": "Turno anterior", - "ru": "Предыдущий ход", - "th": "เทิร์นก่อนหน้า", - "tr": "Önceki tur", - "uk": "Попередній хід", - "vi": "Lượt trước", - "zh-CN": "上一轮", - "zh-TW": "上一輪" - }, - "shortcut": { - "key": "", - "modifiers": [ - "ctrl", - "opt" - ] - }, - "chord": null, - "aliases": [] - }, - { - "id": "agentPane.nextTurn", - "title": { - "en": "Next Turn", - "ar": "الدور التالي", - "bs": "Sljedeći krug", - "da": "Næste tur", - "de": "Nächste Runde", - "es": "Siguiente turno", - "fr": "Tour suivant", - "it": "Turno successivo", - "ja": "次のターン", - "km": "វេនបន្ទាប់", - "ko": "다음 턴", - "no": "Neste runde", - "pl": "Następna tura", - "pt-BR": "Próximo turno", - "ru": "Следующий ход", - "th": "เทิร์นถัดไป", - "tr": "Sonraki tur", - "uk": "Наступний хід", - "vi": "Lượt tiếp theo", - "zh-CN": "下一轮", - "zh-TW": "下一輪" - }, - "shortcut": { - "key": "", - "modifiers": [ - "ctrl", - "opt" - ] - }, - "chord": null, - "aliases": [] - }, { "id": "agentPane.permission.allowOnce", "title": { @@ -7830,6 +7760,76 @@ }, "chord": null, "aliases": [] + }, + { + "id": "agentPane.previousTurn", + "title": { + "en": "Previous Turn", + "ar": "الدور السابق", + "bs": "Prethodni krug", + "da": "Forrige tur", + "de": "Vorherige Runde", + "es": "Turno anterior", + "fr": "Tour précédent", + "it": "Turno precedente", + "ja": "前のターン", + "km": "វេនមុន", + "ko": "이전 턴", + "no": "Forrige runde", + "pl": "Poprzednia tura", + "pt-BR": "Turno anterior", + "ru": "Предыдущий ход", + "th": "เทิร์นก่อนหน้า", + "tr": "Önceki tur", + "uk": "Попередній хід", + "vi": "Lượt trước", + "zh-CN": "上一轮", + "zh-TW": "上一輪" + }, + "shortcut": { + "key": "", + "modifiers": [ + "ctrl", + "opt" + ] + }, + "chord": null, + "aliases": [] + }, + { + "id": "agentPane.nextTurn", + "title": { + "en": "Next Turn", + "ar": "الدور التالي", + "bs": "Sljedeći krug", + "da": "Næste tur", + "de": "Nächste Runde", + "es": "Siguiente turno", + "fr": "Tour suivant", + "it": "Turno successivo", + "ja": "次のターン", + "km": "វេនបន្ទាប់", + "ko": "다음 턴", + "no": "Neste runde", + "pl": "Następna tura", + "pt-BR": "Próximo turno", + "ru": "Следующий ход", + "th": "เทิร์นถัดไป", + "tr": "Sonraki tur", + "uk": "Наступний хід", + "vi": "Lượt tiếp theo", + "zh-CN": "下一轮", + "zh-TW": "下一輪" + }, + "shortcut": { + "key": "", + "modifiers": [ + "ctrl", + "opt" + ] + }, + "chord": null, + "aliases": [] } ] }, From 898f172f163b49d15abd81a89b840f6433d54ea8 Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 14 Oct 2026 03:27:19 -0700 Subject: [PATCH 06/27] test: concurrent bookmark sets log the kept marks; legacy marks wait for acpmux (red) Co-Authored-By: Claude Opus 5.5 --- .../acpmux/tests/hub_integration/bookmarks.rs | 46 +++++++++++++++++++ webviews/test/thread-bookmarks.test.tsx | 41 +++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/cmux-tui/crates/acpmux/tests/hub_integration/bookmarks.rs b/cmux-tui/crates/acpmux/tests/hub_integration/bookmarks.rs index 82177aacccde..2ddacabb5d47 100644 --- a/cmux-tui/crates/acpmux/tests/hub_integration/bookmarks.rs +++ b/cmux-tui/crates/acpmux/tests/hub_integration/bookmarks.rs @@ -179,3 +179,49 @@ async fn a_moved_chat_keeps_its_bookmarks_and_the_source_keeps_none() { let here = src.request(GET, json!({"sessionId": id})).await.unwrap(); assert_eq!(here["bookmarks"], json!([]), "the source keeps no bookmarks: {here}"); } + +/// Sets from many panes at once: the last `bookmarks` record in the log (what every attached pane +/// and an attach replay end on) is always the chat's marks as acpmux keeps them. +#[tokio::test(flavor = "multi_thread", worker_threads = 8)] +async fn concurrent_sets_log_the_marks_in_the_order_they_change_them() { + let (hub, mut c) = setup(PermissionPolicy::ApproveAll).await; + let id = new_session(&mut c, "racing-marks").await; + for text in ["first", "second"] { + c.request( + method::SESSION_PROMPT, + json!({"sessionId": id, "prompt": [{"type": "text", "text": text}]}), + ) + .await + .unwrap(); + } + let prompts = seqs(&mut c, &id, "user_message").await; + for round in 0..10 { + let mut writers = Vec::new(); + for w in 0..8usize { + let mut wc = connect(&hub).await; + let (id, prompts) = (id.clone(), prompts.clone()); + writers.push(tokio::spawn(async move { + for n in 0..20usize { + let seq = prompts[(w + n) % prompts.len()]; + let on = (w + n + round) % 2 == 0; + wc.request(SET, json!({"sessionId": id, "seq": seq, "bookmarked": on})) + .await + .unwrap(); + } + })); + } + for writer in writers { + writer.await.unwrap(); + } + let kept = c.request(GET, json!({"sessionId": id})).await.unwrap(); + let page = c + .request(method::MUX_EVENTS, json!({"sessionId": id, "afterSeq": 0, "limit": 50_000})) + .await + .unwrap(); + let events = page["events"].as_array().unwrap(); + let last = events.iter().rev().find(|e| e["kind"] == "bookmarks"); + if let Some(last) = last { + assert_eq!(last["msg"]["bookmarks"], kept["bookmarks"], "round {round}: {kept}"); + } + } +} diff --git a/webviews/test/thread-bookmarks.test.tsx b/webviews/test/thread-bookmarks.test.tsx index cb0398e1f4a9..f446a7765be0 100644 --- a/webviews/test/thread-bookmarks.test.tsx +++ b/webviews/test/thread-bookmarks.test.tsx @@ -171,3 +171,44 @@ test("a refused toggle is taken back", async () => { await act(async () => root.unmount()); host.remove(); }); + +test("an old local mark leaves localStorage only once acpmux keeps it", async () => { + const KEY = "cmux.agentPane.threadBookmarks.v1"; + const keys = ["chat-1#user-3#a1", "chat-1#user-7#b2", "other#user-3#c3"]; + dom.window.localStorage.setItem(KEY, JSON.stringify(keys)); + // acpmux keeps the first and refuses the second (unreachable for a moment, say). + const calls: Call[] = []; + setBookmarkTransport({ + get: async (sessionId) => ({ sessionId, bookmarks: [] }), + set: async (sessionId, seq, bookmarked) => { + calls.push({ sessionId, seq, bookmarked }); + if (seq === 7) throw new Error("unreachable"); + return { sessionId, bookmarks: [seq] }; + }, + }); + const first = await mount(); + await settle(); + expect(calls).toEqual([ + { sessionId: "chat-1", seq: 3, bookmarked: true }, + { sessionId: "chat-1", seq: 7, bookmarked: true }, + ]); + expect(JSON.parse(dom.window.localStorage.getItem(KEY) ?? "[]")).toEqual(["chat-1#user-7#b2", "other#user-3#c3"]); + await act(async () => first.root.unmount()); + first.host.remove(); + + // The next attach tries the one acpmux did not take again. + const again: Call[] = []; + setBookmarkTransport({ + get: async (sessionId) => ({ sessionId, bookmarks: [3] }), + set: async (sessionId, seq, bookmarked) => { + again.push({ sessionId, seq, bookmarked }); + return { sessionId, bookmarks: [3, seq] }; + }, + }); + const second = await mount(); + await settle(); + expect(again).toEqual([{ sessionId: "chat-1", seq: 7, bookmarked: true }]); + expect(JSON.parse(dom.window.localStorage.getItem(KEY) ?? "[]")).toEqual(["other#user-3#c3"]); + await act(async () => second.root.unmount()); + second.host.remove(); +}); From c13d6b810d6089171d9ead0d82d2fdec7968ec4d Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 14 Oct 2026 03:30:04 -0700 Subject: [PATCH 07/27] acpmux: log bookmark changes in order; keep legacy marks until acpmux holds them set_bookmark changes, logs and saves the marks under the chat's move lock, so concurrent sets log in the order they change the marks and a move begins before or after a change. The prompt check scans the log on a blocking thread. The pane forgets an old localStorage mark only once bookmark_set succeeds for it. Co-Authored-By: Claude Opus 5.5 --- cmux-tui/crates/acpmux/src/hub/bookmarks.rs | 59 +++++++++++-------- .../acpmux/src/server/requests/composer.rs | 6 +- .../acpmux/threadMinimap/bookmarks.ts | 47 +++++++++------ 3 files changed, 67 insertions(+), 45 deletions(-) diff --git a/cmux-tui/crates/acpmux/src/hub/bookmarks.rs b/cmux-tui/crates/acpmux/src/hub/bookmarks.rs index 7f7745552589..5731793d8933 100644 --- a/cmux-tui/crates/acpmux/src/hub/bookmarks.rs +++ b/cmux-tui/crates/acpmux/src/hub/bookmarks.rs @@ -15,22 +15,26 @@ impl Hub { /// Mark or unmark the prompt logged at `seq`, and return the chat's marks. /// Only a `user_message` record of this chat can be marked; unmarking takes /// any seq, so a mark whose prompt is gone can still be cleared. - pub fn set_bookmark( - &self, + pub async fn set_bookmark( + self: &Arc, session: &Session, seq: u64, bookmarked: bool, ) -> Result, RpcError> { - if session.moving().is_some() { - return Err(queue::moving_error()); - } - if bookmarked && !self.is_prompt(session, seq) { + if bookmarked && !self.is_prompt(session, seq).await { return Err(RpcError::invalid_params(format!( "seq {seq} is not a prompt in session {}", session.id ))); } - let (marks, changed) = { + // One section under the chat's move lock for the check, the change, its record and its + // save: two sets log (and save) in the order they change the marks, so the last record + // every pane hears is the marks kept; and a move begins before the change or after it. + let moving = session.moving.lock().unwrap_or_else(|e| e.into_inner()); + if moving.is_some() { + return Err(queue::moving_error()); + } + let (marks, before) = { let mut meta = session.meta.lock().unwrap_or_else(|e| e.into_inner()); if bookmarked && !meta.bookmarks.contains(&seq) @@ -43,34 +47,41 @@ impl Hub { } let changed = if bookmarked { meta.bookmarks.insert(seq) } else { meta.bookmarks.remove(&seq) }; - (meta.bookmarks.iter().copied().collect::>(), changed) + let marks = meta.bookmarks.iter().copied().collect::>(); + if !changed { + return Ok(marks); + } + (marks, meta.updated_at) }; - if changed { + let record = self.append(session, "mux", "bookmarks", json!({"bookmarks": marks})); + { // A mark is not chat activity: the session keeps its place in the list. - let before = session.meta().updated_at; - let record = self.append(session, "mux", "bookmarks", json!({"bookmarks": marks})); - { - let mut meta = session.meta.lock().unwrap_or_else(|e| e.into_inner()); - if meta.updated_at == record.at { - meta.updated_at = before; - } + let mut meta = session.meta.lock().unwrap_or_else(|e| e.into_inner()); + if meta.updated_at == record.at { + meta.updated_at = before; } - self.save_meta(session); } + self.save_meta(session); + drop(moving); Ok(marks) } - /// Whether `seq` is a prompt (`user_message`) in the chat's log. - fn is_prompt(&self, session: &Session, seq: u64) -> bool { + /// Whether `seq` is a prompt (`user_message`) in the chat's log. The store reads files, so + /// the scan runs off the async workers. + async fn is_prompt(self: &Arc, session: &Session, seq: u64) -> bool { if seq == 0 || seq > session.seq.load(Ordering::SeqCst) { return false; } - let mut found = false; - let _ = self.store.scan(&session.id, seq - 1, &mut |e: EventRecord| { - found = e.seq == seq && e.dir == "mux" && e.kind == "user_message"; - false + let (hub, id) = (self.clone(), session.id.clone()); + let scan = tokio::task::spawn_blocking(move || { + let mut found = false; + let _ = hub.store.scan(&id, seq - 1, &mut |e: EventRecord| { + found = e.seq == seq && e.dir == "mux" && e.kind == "user_message"; + false + }); + found }); - found + scan.await.unwrap_or(false) } } diff --git a/cmux-tui/crates/acpmux/src/server/requests/composer.rs b/cmux-tui/crates/acpmux/src/server/requests/composer.rs index d42ce01a3ba2..1b1819315e2c 100644 --- a/cmux-tui/crates/acpmux/src/server/requests/composer.rs +++ b/cmux-tui/crates/acpmux/src/server/requests/composer.rs @@ -23,7 +23,7 @@ pub(super) async fn handle( params: &Value, ) -> Result { if m == method::MUX_BOOKMARK_GET || m == method::MUX_BOOKMARK_SET { - return bookmarks(hub, m, params); + return bookmarks(hub, m, params).await; } let s = hub.resolve(session_key(params)?)?; if m == method::MUX_DRAFT_GET { @@ -46,7 +46,7 @@ pub(super) async fn handle( /// `_acpmux/bookmark_get` and `_acpmux/bookmark_set`: the chat's prompt bookmarks /// (`hub/bookmarks.rs`). A peer's chat never gets here: `peer_forward.rs` sends it to its owner. -fn bookmarks(hub: &Arc, m: &str, params: &Value) -> Result { +async fn bookmarks(hub: &Arc, m: &str, params: &Value) -> Result { let s = hub.resolve(session_key(params)?)?; if m == method::MUX_BOOKMARK_GET { let marks: Vec = s.meta().bookmarks.iter().copied().collect(); @@ -60,6 +60,6 @@ fn bookmarks(hub: &Arc, m: &str, params: &Value) -> Result .get("bookmarked") .and_then(Value::as_bool) .ok_or_else(|| RpcError::invalid_params("bookmarked is required"))?; - let marks = hub.set_bookmark(&s, seq, bookmarked)?; + let marks = hub.set_bookmark(&s, seq, bookmarked).await?; Ok(json!({"sessionId": s.id, "bookmarks": marks})) } diff --git a/webviews/src/agent-session/acpmux/threadMinimap/bookmarks.ts b/webviews/src/agent-session/acpmux/threadMinimap/bookmarks.ts index 0d1eaecb4ce8..2a1841acbcbd 100644 --- a/webviews/src/agent-session/acpmux/threadMinimap/bookmarks.ts +++ b/webviews/src/agent-session/acpmux/threadMinimap/bookmarks.ts @@ -68,7 +68,8 @@ export function bookmarksHeard(sessionId: string | undefined, list: unknown): vo } /// Reads the session's marks from acpmux, once per transport, and brings over the marks this pane -/// kept in localStorage for it before (keys `#user-#`), then forgets those. +/// kept in localStorage for it before (keys `#user-#`). A key is forgotten +/// only once acpmux holds its mark; one it refused waits for the next attach. function load(sessionId: string): void { const via = transport; if (!via || loaded.has(sessionId)) return; @@ -78,7 +79,9 @@ function load(sessionId: string): void { if (via !== transport) return; const held = seqs(reply) ?? []; settle(sessionId, held); - for (const seq of takeLocalMarks(sessionId)) if (!held.includes(seq)) toggleWith(via, sessionId, seq, true); + for (const { key, seq } of localMarks(sessionId)) + if (seq === undefined || held.includes(seq)) forgetLocalMark(key); + else toggleWith(via, sessionId, seq, true, () => forgetLocalMark(key)); }, () => { // Unreachable or an older acpmux: no marks, and the next transport asks again. @@ -87,7 +90,8 @@ function load(sessionId: string): void { ); } -function toggleWith(via: BookmarkTransport, sessionId: string, seq: number, on: boolean): void { +/// `kept` runs once acpmux has taken the change. +function toggleWith(via: BookmarkTransport, sessionId: string, seq: number, on: boolean, kept?: () => void): void { const waiting = pending.get(sessionId) ?? new Map(); pending.set(sessionId, waiting.set(seq, on)); const before = marks.get(sessionId) ?? NONE; @@ -101,6 +105,7 @@ function toggleWith(via: BookmarkTransport, sessionId: string, seq: number, on: }; via.set(sessionId, seq, on).then( (reply) => { + kept?.(); if (via !== transport) return; done(); const held = seqs(reply); @@ -154,22 +159,28 @@ function subscribe(listener: () => void): () => void { const currentVersion = () => version; -/// The seqs this pane kept for `sessionId` in localStorage, removed from it. -function takeLocalMarks(sessionId: string): number[] { +/// The marks this pane kept for `sessionId` in localStorage: each key and its seq (none if unreadable). +function localMarks(sessionId: string): { key: string; seq: number | undefined }[] { + const prefix = `${sessionId}#user-`; + return readLocalMarks() + .filter((key) => key.startsWith(prefix)) + .map((key) => ({ key, seq: promptSeq(key.slice(sessionId.length + 1).split("#")[0] ?? "") })); +} + +function forgetLocalMark(key: string): void { + try { + const rest = readLocalMarks().filter((kept) => kept !== key); + if (rest.length) globalThis.localStorage.setItem(STORAGE_KEY, JSON.stringify(rest)); + else globalThis.localStorage.removeItem(STORAGE_KEY); + } catch { + // Storage blocked: the key stays, and acpmux already holds its mark. + } +} + +function readLocalMarks(): string[] { try { - const storage = globalThis.localStorage; - const parsed: unknown = JSON.parse(storage?.getItem(STORAGE_KEY) ?? "[]"); - if (!Array.isArray(parsed)) return []; - const prefix = `${sessionId}#user-`; - const mine = parsed.filter((key): key is string => typeof key === "string" && key.startsWith(prefix)); - if (!mine.length) return []; - const rest = parsed.filter((key) => !mine.includes(key)); - if (rest.length) storage.setItem(STORAGE_KEY, JSON.stringify(rest)); - else storage.removeItem(STORAGE_KEY); - return mine.flatMap((key) => { - const seq = promptSeq(key.slice(sessionId.length + 1).split("#")[0] ?? ""); - return seq === undefined ? [] : [seq]; - }); + const parsed: unknown = JSON.parse(globalThis.localStorage?.getItem(STORAGE_KEY) ?? "[]"); + return Array.isArray(parsed) ? parsed.filter((key): key is string => typeof key === "string") : []; } catch { return []; } From bd45ad56dd6e95908fa0ebf75cdddc9551872a2f Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 14 Oct 2026 04:20:42 -0700 Subject: [PATCH 08/27] test: a clicked minimap row takes focus so Tab goes on from the rail WebKit does not focus a clicked button, so in the app Tab after a click left the rail for the transcript. Codex's rail (Chromium) focuses it. Co-Authored-By: Claude Opus 5.5 --- webviews/test/thread-minimap-rail.test.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/webviews/test/thread-minimap-rail.test.tsx b/webviews/test/thread-minimap-rail.test.tsx index 63b874feaedb..7557b6adae10 100644 --- a/webviews/test/thread-minimap-rail.test.tsx +++ b/webviews/test/thread-minimap-rail.test.tsx @@ -259,6 +259,25 @@ test("keyboard focus grows its row alone and opens the card at once; Escape clos } }); +test("a clicked row takes focus, as a clicked button does in Codex, so Tab goes on from the rail; the click does not hold the card open", async () => { + const view = await mount(12); + jest.useFakeTimers(); + try { + await enter(4); + await advance(300); + expect(card()?.textContent).toContain("Question 4"); + // WebKit does not focus a clicked button; the rail does, so Tab moves to the next row. + await act(async () => tick(4).click()); + expect(document.activeElement).toBe(tick(4)); + await leave(4); + await advance(200); + expect(card()).toBeNull(); + expect(Math.round(length(4))).toBe(6); + } finally { + await view.unmount(); + } +}); + test("dragging on the rail scrubs: each row crossed jumps the transcript to it, and the drag's click does not", async () => { const view = await mount(12); try { From 82f7d7b55f77364aac1706e70677a4ea14717828 Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 14 Oct 2026 04:23:39 -0700 Subject: [PATCH 09/27] fix: focus a clicked minimap row so Tab goes on from the rail Co-Authored-By: Claude Opus 5.5 --- .../agent-session/acpmux/threadMinimap/ThreadMinimap.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/webviews/src/agent-session/acpmux/threadMinimap/ThreadMinimap.tsx b/webviews/src/agent-session/acpmux/threadMinimap/ThreadMinimap.tsx index 562c447830dd..a92dff194738 100644 --- a/webviews/src/agent-session/acpmux/threadMinimap/ThreadMinimap.tsx +++ b/webviews/src/agent-session/acpmux/threadMinimap/ThreadMinimap.tsx @@ -238,6 +238,15 @@ export function ThreadMinimap({ } const turn = live.current.turns[index]; if (!turn) return; + // A clicked row takes focus, as a clicked button does in Chromium (WebKit focuses none), so + // Tab goes on from the rail. Like a pointer's focus there, it neither grows the row nor + // holds the card open. + const row = target instanceof Element ? target.closest("[data-tick]") : null; + if (row && row.ownerDocument.activeElement !== row) { + pressing.current = true; + row.focus({ preventScroll: true }); + pressing.current = false; + } // The bookmark dot's spot past the tick (the row's right end) toggles the mark. if (target instanceof Element && target.closest("[data-dot-hit]") && live.current.marks.can(turn)) { live.current.marks.toggle(turn); From a72dc7e8f5a7e1590e975dc0316d51f2ae1c84e0 Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 14 Oct 2026 05:11:26 -0700 Subject: [PATCH 10/27] test: read the minimap hover transition by seeking it, not by frame samples CI's headless WebKit paced frames unevenly, so a sample 40 ms into the transition could come long after it ended. Co-Authored-By: Claude Opus 5.5 --- webviews/test/thread-minimap-motion.test.ts | 81 +++++++++++++++------ 1 file changed, 58 insertions(+), 23 deletions(-) diff --git a/webviews/test/thread-minimap-motion.test.ts b/webviews/test/thread-minimap-motion.test.ts index 912869871a70..4842ac8f3683 100644 --- a/webviews/test/thread-minimap-motion.test.ts +++ b/webviews/test/thread-minimap-motion.test.ts @@ -97,16 +97,6 @@ await requireBrowserLane("thread-minimap-motion.test.ts", async () => { const box = document.querySelector(`[data-tick="${at}"]`)!.getBoundingClientRect(); return { x: box.left + 8, y: box.top + box.height / 2 }; }, index); - /// Marks the time the pointer reached `selector` (its pointerover). - const markOver = (page: Page) => - page.evaluate(() => { - document.addEventListener( - "pointerover", - () => ((window as unknown as { __over: number }).__over = performance.now()), - { once: true, capture: true }, - ); - }); - test("hover grows the tick to 26 px within 160 ms, with no delay, on the spring curve", async () => { const page = await open(false); const style = await page.evaluate(() => { @@ -117,20 +107,65 @@ await requireBrowserLane("thread-minimap-motion.test.ts", async () => { expect(style.duration).toBe("0.15s"); // at rest: the 150 ms settle; hovered rows use 160 ms const point = await tickPoint(page, 5); await page.mouse.move(point.x + 300, point.y); - await markOver(page); - const sampling = sample(page, 400); + // The pointer's arrival starts a transform transition at once (no dwell). Its timeline is read + // by holding and seeking it, not by sampling frames: a CI runner's headless WebKit paces + // frames unevenly. The hold starts in the transition's own `transitionrun`. + await page.evaluate(() => { + const bar = document.querySelector('[data-tick="5"] .acpmux-minimap__bar')!; + const held = window as unknown as { __held?: Animation; __over: number }; + held.__over = 0; + document.addEventListener("pointerover", () => (held.__over = performance.now()), { once: true, capture: true }); + bar.addEventListener( + "transitionrun", + () => { + const running = bar + .getAnimations() + .find((entry) => (entry as CSSTransition).transitionProperty === "transform"); + running?.pause(); + held.__held = running; + (held as unknown as { __run: number }).__run = performance.now(); + }, + { once: true }, + ); + }); await page.mouse.move(point.x, point.y); - await sampling; - const over = await page.evaluate(() => (window as unknown as { __over: number }).__over); - const after = (await samples(page)).filter((entry) => entry.t >= over); - // It starts moving within two frames of the pointer (no dwell), passes through the lengths - // between (a transition, not a jump) and is there 160 ms (plus a frame) after it started. - const start = after.find((entry) => entry.width > 6.5)!; - expect(start.t - over).toBeLessThan(60); - expect(after.some((entry) => entry.width > 8 && entry.width < 24)).toBe(true); - expect(after.find((entry) => entry.t - start.t >= 160)!.width).toBeGreaterThan(25.4); - expect(after.find((entry) => entry.t - start.t >= 40)!.width).toBeLessThan(25.4); - expect(Math.max(...after.map((entry) => entry.width))).toBeLessThan(26 * 1.012); + await page.waitForFunction(() => "__held" in window, undefined, { timeout: 5_000 }); + const transition = await page.evaluate(() => { + const bar = document.querySelector('[data-tick="5"] .acpmux-minimap__bar')!; + const held = window as unknown as { __held?: Animation; __over: number; __run: number }; + const running = held.__held; + if (!running) return undefined; + const timing = running.effect!.getComputedTiming(); + const width = (ms: number) => { + running.pause(); + running.currentTime = ms; + return 26 * new DOMMatrixReadOnly(getComputedStyle(bar).transform).a; + }; + const widths = [0, 40, 80, 112, 160].map(width); + running.currentTime = 160; + running.play(); + return { + duration: timing.duration, + delay: timing.delay, + // From the pointer reaching the row to the transition starting. + wait: held.__run - held.__over, + widths, + }; + }); + expect(transition).toBeDefined(); + expect(transition!.wait).toBeLessThan(60); + // 160 ms, no delay, on the spring (the CSS `linear()` curve, or its cubic-bezier fallback). + expect(transition!.duration).toBe(160); + expect(transition!.delay).toBe(0); + const [w0, w40, w80, w112, w160] = transition!.widths; + // From the 6 px rest through the lengths between (a transition, not a jump) to 26 px. + expect(Math.round(w0!)).toBe(6); + expect(w40!).toBeGreaterThan(8); + expect(w40!).toBeLessThan(25.4); + expect(w80!).toBeGreaterThan(w40!); + // The spring's small overshoot (about 0.8%), then 26 px. + expect(w112!).toBeLessThan(26 * 1.012); + expect(Math.round(w160!)).toBe(26); const hovered = await page.evaluate(() => { const css = getComputedStyle(document.querySelector('[data-tick="5"] .acpmux-minimap__bar')!); return { delay: css.transitionDelay, duration: css.transitionDuration }; From 568dba62ae7ad7a708c90b267554c96acda856af Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 14 Oct 2026 05:43:32 -0700 Subject: [PATCH 11/27] chore: regenerate action exports on the merged head Co-Authored-By: Claude Opus 5.5 --- plans/cmux-next/action-surfaces.json | 255 +++++++++++++++++++++++---- plans/cmux-next/actions.md | 18 +- 2 files changed, 230 insertions(+), 43 deletions(-) diff --git a/plans/cmux-next/action-surfaces.json b/plans/cmux-next/action-surfaces.json index 6f58a515a78d..3e89e54f1c37 100644 --- a/plans/cmux-next/action-surfaces.json +++ b/plans/cmux-next/action-surfaces.json @@ -133,7 +133,34 @@ "title_table" : "ActionCatalog" }, { - "cli" : "guiOnly", + "cli" : "offered", + "cli_name" : "app close-other-windows", + "context_menu" : "noObject", + "context_menus" : [ + + ], + "default_aliases" : [ + + ], + "default_chord" : null, + "default_shortcut" : null, + "id" : "window.closeOthers", + "mcp" : "offered", + "palette" : "offered", + "palette_section" : { + "id" : "category.window", + "order" : 100, + "title" : "Window", + "title_key" : "category.window", + "title_table" : "Localizable" + }, + "palette_suggested" : null, + "title" : "Close Other Windows", + "title_key" : "action.window.closeOthers", + "title_table" : "ActionCatalog" + }, + { + "cli" : "offered", "cli_name" : "app close-all-windows", "context_menu" : "noObject", "context_menus" : [ @@ -145,7 +172,7 @@ "default_chord" : null, "default_shortcut" : null, "id" : "closeAllWindows", - "mcp" : "guiOnly", + "mcp" : "offered", "palette" : "offered", "palette_section" : { "id" : "category.window", @@ -3952,6 +3979,60 @@ "title_key" : "action.workspaceGroup.closeWorkspaces", "title_table" : "ActionCatalog" }, + { + "cli" : "offered", + "cli_name" : "workspace-group close-others", + "context_menu" : "offered", + "context_menus" : [ + "workspaceGroup" + ], + "default_aliases" : [ + + ], + "default_chord" : null, + "default_shortcut" : null, + "id" : "workspaceGroup.closeOthers", + "mcp" : "offered", + "palette" : "offered", + "palette_section" : { + "id" : "category.workspace", + "order" : 101, + "title" : "Workspace", + "title_key" : "category.workspace", + "title_table" : "Localizable" + }, + "palette_suggested" : null, + "title" : "Close Other Groups", + "title_key" : "action.workspaceGroup.closeOthers", + "title_table" : "ActionCatalog" + }, + { + "cli" : "offered", + "cli_name" : "workspace-group duplicate", + "context_menu" : "offered", + "context_menus" : [ + "workspaceGroup" + ], + "default_aliases" : [ + + ], + "default_chord" : null, + "default_shortcut" : null, + "id" : "workspaceGroup.duplicate", + "mcp" : "offered", + "palette" : "offered", + "palette_section" : { + "id" : "category.workspace", + "order" : 101, + "title" : "Workspace", + "title_key" : "category.workspace", + "title_table" : "Localizable" + }, + "palette_suggested" : null, + "title" : "Duplicate Workspace Group", + "title_key" : "action.workspaceGroup.duplicate", + "title_table" : "ActionCatalog" + }, { "cli" : "offered", "cli_name" : "workspace-group move-to-new-window", @@ -18108,8 +18189,8 @@ "title_table" : "ActionCatalog" }, { - "cli" : "guiOnly", - "cli_name" : "action agent-pane-archive-chat", + "cli" : "offered", + "cli_name" : "agent archive-chat", "context_menu" : "guiOnly", "context_menus" : [ @@ -18126,7 +18207,7 @@ ] }, "id" : "agentPane.archiveChat", - "mcp" : "guiOnly", + "mcp" : "offered", "palette" : "offered", "palette_section" : { "id" : "category.agents", @@ -25837,6 +25918,60 @@ "title_key" : "action.sidebar.section.remove", "title_table" : "SidebarSectionActions" }, + { + "cli" : "offered", + "cli_name" : "sidebar close-section-workspaces", + "context_menu" : "offered", + "context_menus" : [ + "sidebarSection" + ], + "default_aliases" : [ + + ], + "default_chord" : null, + "default_shortcut" : null, + "id" : "sidebar.section.closeWorkspaces", + "mcp" : "offered", + "palette" : "offered", + "palette_section" : { + "id" : "category.sidebar", + "order" : 107, + "title" : "Sidebar", + "title_key" : "category.sidebar", + "title_table" : "Localizable" + }, + "palette_suggested" : null, + "title" : "Close All Workspaces in Section", + "title_key" : "action.sidebar.section.closeWorkspaces", + "title_table" : "SidebarSectionActions" + }, + { + "cli" : "offered", + "cli_name" : "sidebar new-section-workspace", + "context_menu" : "offered", + "context_menus" : [ + "sidebarSection" + ], + "default_aliases" : [ + + ], + "default_chord" : null, + "default_shortcut" : null, + "id" : "sidebar.section.newWorkspace", + "mcp" : "offered", + "palette" : "offered", + "palette_section" : { + "id" : "category.sidebar", + "order" : 107, + "title" : "Sidebar", + "title_key" : "category.sidebar", + "title_table" : "Localizable" + }, + "palette_suggested" : null, + "title" : "New Workspace in Section", + "title_key" : "action.sidebar.section.newWorkspace", + "title_table" : "SidebarSectionActions" + }, { "cli" : "guiOnly", "cli_name" : "action sidebar-section-hide", @@ -32297,7 +32432,7 @@ }, { "enabled_when" : "can_perform", - "id" : "sidebar.item.add", + "id" : "sidebar.section.newWorkspace", "kind" : "action", "order" : 1, "visible_when" : { @@ -32308,15 +32443,28 @@ ] } }, + { + "enabled_when" : "can_perform", + "id" : "sidebar.item.add", + "kind" : "action", + "order" : 2, + "visible_when" : { + "debug_only" : false, + "feature" : null, + "requires" : [ + + ] + } + }, { "kind" : "separator", - "order" : 2 + "order" : 3 }, { "enabled_when" : "can_perform", "id" : "sidebar.section.rename", "kind" : "action", - "order" : 3, + "order" : 4, "visible_when" : { "debug_only" : false, "feature" : null, @@ -32447,7 +32595,7 @@ ], "folder" : "appearance", "kind" : "folder", - "order" : 4, + "order" : 5, "title" : "Appearance", "title_key" : "menu.folder.appearance", "title_table" : "Localizable" @@ -32483,20 +32631,20 @@ ], "folder" : "options", "kind" : "folder", - "order" : 5, + "order" : 6, "title" : "Options", "title_key" : "menu.folder.options", "title_table" : "Localizable" }, { "kind" : "separator", - "order" : 6 + "order" : 7 }, { "enabled_when" : "can_perform", "id" : "sidebar.section.toggleCollapsed", "kind" : "action", - "order" : 7, + "order" : 8, "visible_when" : { "debug_only" : false, "feature" : null, @@ -32507,7 +32655,7 @@ }, { "kind" : "separator", - "order" : 8 + "order" : 9 }, { "children" : [ @@ -32553,20 +32701,20 @@ ], "folder" : "move", "kind" : "folder", - "order" : 9, + "order" : 10, "title" : "Move", "title_key" : "menu.folder.move", "title_table" : "Localizable" }, { "kind" : "separator", - "order" : 10 + "order" : 11 }, { "enabled_when" : "can_perform", "id" : "sidebar.section.hide", "kind" : "action", - "order" : 11, + "order" : 12, "visible_when" : { "debug_only" : false, "feature" : null, @@ -32577,13 +32725,26 @@ }, { "kind" : "separator", - "order" : 12 + "order" : 13 }, { "enabled_when" : "can_perform", "id" : "sidebar.section.remove", "kind" : "action", - "order" : 13, + "order" : 14, + "visible_when" : { + "debug_only" : false, + "feature" : null, + "requires" : [ + + ] + } + }, + { + "enabled_when" : "can_perform", + "id" : "sidebar.section.closeWorkspaces", + "kind" : "action", + "order" : 15, "visible_when" : { "debug_only" : false, "feature" : null, @@ -32596,7 +32757,7 @@ "enabled_when" : "can_perform", "id" : "sidebar.item.hideApp", "kind" : "action", - "order" : 14, + "order" : 16, "visible_when" : { "debug_only" : false, "feature" : null, @@ -34372,15 +34533,28 @@ ] } }, + { + "enabled_when" : "can_perform", + "id" : "workspaceGroup.duplicate", + "kind" : "action", + "order" : 1, + "visible_when" : { + "debug_only" : false, + "feature" : null, + "requires" : [ + + ] + } + }, { "kind" : "separator", - "order" : 1 + "order" : 2 }, { "enabled_when" : "can_perform", "id" : "workspaceGroup.rename", "kind" : "action", - "order" : 2, + "order" : 3, "visible_when" : { "debug_only" : false, "feature" : null, @@ -34393,7 +34567,7 @@ "enabled_when" : "can_perform", "id" : "workspaceGroup.togglePin", "kind" : "action", - "order" : 3, + "order" : 4, "visible_when" : { "debug_only" : false, "feature" : null, @@ -34567,7 +34741,7 @@ ], "folder" : "appearance", "kind" : "folder", - "order" : 4, + "order" : 5, "title" : "Appearance", "title_key" : "menu.folder.appearance", "title_table" : "Localizable" @@ -34616,20 +34790,20 @@ ], "folder" : "options", "kind" : "folder", - "order" : 5, + "order" : 6, "title" : "Options", "title_key" : "menu.folder.options", "title_table" : "Localizable" }, { "kind" : "separator", - "order" : 6 + "order" : 7 }, { "enabled_when" : "can_perform", "id" : "toggleFocusedWorkspaceGroupCollapsed", "kind" : "action", - "order" : 7, + "order" : 8, "visible_when" : { "debug_only" : false, "feature" : null, @@ -34669,14 +34843,14 @@ ], "folder" : "group", "kind" : "folder", - "order" : 8, + "order" : 9, "title" : "Group", "title_key" : "menu.folder.group", "title_table" : "Localizable" }, { "kind" : "separator", - "order" : 9 + "order" : 10 }, { "children" : [ @@ -34761,20 +34935,20 @@ ], "folder" : "move", "kind" : "folder", - "order" : 10, + "order" : 11, "title" : "Move", "title_key" : "menu.folder.move", "title_table" : "Localizable" }, { "kind" : "separator", - "order" : 11 + "order" : 12 }, { "enabled_when" : "can_perform", "id" : "workspaceGroup.editConfig", "kind" : "action", - "order" : 12, + "order" : 13, "visible_when" : { "debug_only" : false, "feature" : null, @@ -34787,7 +34961,7 @@ "enabled_when" : "can_perform", "id" : "workspaceGroup.copyID", "kind" : "action", - "order" : 13, + "order" : 14, "visible_when" : { "debug_only" : false, "feature" : null, @@ -34798,7 +34972,7 @@ }, { "kind" : "separator", - "order" : 14 + "order" : 15 }, { "children" : [ @@ -34838,13 +35012,26 @@ "feature" : null, "requires" : [ + ] + } + }, + { + "enabled_when" : "can_perform", + "id" : "workspaceGroup.closeOthers", + "kind" : "action", + "order" : 3, + "visible_when" : { + "debug_only" : false, + "feature" : null, + "requires" : [ + ] } } ], "folder" : "close", "kind" : "folder", - "order" : 15, + "order" : 16, "title" : "Close", "title_key" : "menu.folder.close", "title_table" : "Localizable" diff --git a/plans/cmux-next/actions.md b/plans/cmux-next/actions.md index 063aa88f296d..5a121195839a 100644 --- a/plans/cmux-next/actions.md +++ b/plans/cmux-next/actions.md @@ -35,23 +35,23 @@ Declare its placements (menu, group, rank) and whether the CLI offers it, or nam ## Catalog counts -- `window`: 71 -- `workspace`: 148 +- `window`: 72 +- `workspace`: 150 - `pane`: 80 - `screen`: 65 - `tab`: 90 - `terminal`: 36 - `browser`: 168 -- `sidebar`: 72 +- `sidebar`: 74 - `notifications`: 21 - `agents`: 60 - `cloud`: 52 - `remote`: 10 - `settings`: 79 -## Counts (952 actions) +## Counts (957 actions) -Palette 916, CLI verbs 511, right-click 492, MCP tools 442. +Palette 921, CLI verbs 518, right-click 496, MCP tools 449. ## Menus @@ -61,7 +61,7 @@ Palette 916, CLI verbs 511, right-click 492, MCP tools 442. - **screenGroup**: screenGroup.newScreen | screenGroup.rename [appearance] > (screenGroup.setColor > (screenGroup.color.grey screenGroup.color.blue screenGroup.color.red screenGroup.color.yellow screenGroup.color.green screenGroup.color.pink screenGroup.color.purple screenGroup.color.cyan screenGroup.color.orange) screenGroup.setIcon screenGroup.clearIcon) | screenGroup.toggleCollapsed [group] > (screenGroup.save screenGroup.unsave) | [move] > (screenGroup.moveLeft screenGroup.moveRight screenGroup.moveToWorkspace screenGroup.moveToNewWorkspace screenGroup.moveToNewWindow) | screenGroup.ungroup screenGroup.close - **pane**: splitRight splitDown toggleSplitZoom renamePane [more] > ([new] > (newColumn newRow splitLeft splitUp splitBrowserRight splitBrowserDown remote.openTerminalHere newPaneAutoLayout | palette.newSimulatorPane) | | [move] > (pane.moveToNewWorkspace swapPaneLeft swapPaneRight swapPaneUp swapPaneDown column.moveLeft column.moveRight) | [layout] > (equalizeSplits toggleCanvasLayout pane.toggleTabBar | column.dock column.undock column.float column.dockLeft column.dockRight column.dockTop column.dockBottom | column.widthOneThird column.widthHalf column.widthTwoThirds column.widthFull column.center agentPaneZoomIn agentPaneZoomOut agentPaneZoomReset) | [connection] > (palette.swapWithSession reconnectPane) | triggerFlash [copy] > (palette.copyPaneID palette.copyPaneLink) | pane.closeOthers) | closePane - **workspaceRow**: renameWorkspace palette.toggleWorkspacePin palette.workspaceColor[choices] workspace.newBelow | moveWorkspaceToGroup[choices] groupSelectedWorkspaces removeWorkspaceFromGroup | [more] > ([new] > (workspace.newLikeThis workspace.newAbove workspace.newInNewGroup workspace.duplicate workspace.duplicateTerminalsOnly | palette.openFolderInVSCodeInline palette.openWorkspaceTodoPane palette.layout.open) | [appearance] > (palette.resetWorkspaceColor workspace.setIcon workspace.clearIcon workspace.setTheme[choices] workspace.clearTheme) [options] > (palette.clearWorkspaceName editWorkspaceDescription palette.clearWorkspaceDescription palette.workspaceStatus markWorkspaceDone palette.markWorkspaceRead notifications.dismissHighlight palette.markWorkspaceUnread notifications.toggleWorkspaceMute clearWorkspaceNotifications palette.addWorkspaceChecklistItem | browserProfile.setWorkspaceDefault browserProfile.clearWorkspaceDefault | reconnectWorkspace disconnectWorkspace | sidebar.workspaceTabs.toggle) | [group] > (saveLayoutTemplate) | [move] > (moveWorkspaceUp moveWorkspaceDown palette.moveWorkspaceToTop workspace.moveToBottom moveWorkspaceToWindow moveWorkspaceToNewWindow workspace.toggleTop workspace.moveToSpace workspace.duplicateToSpace workspace.mergeInto) | [copy] > (workspace.copyPath palette.copyWorkspaceID palette.copyWorkspaceLink palette.copyWorkspaceIDAndRef copyWorkspaceSSHError) [tools] > (workspace.showResources revealWorkspaceInFinder palette.openWorkspacePullRequests) | [close] > (palette.closeOtherWorkspaces workspace.closeOthersInGroup palette.closeWorkspacesBelow palette.closeWorkspacesAbove workspace.closeAll)) | closeWorkspace -- **workspaceGroup**: workspaceGroup.newWorkspace | workspaceGroup.rename workspaceGroup.togglePin [appearance] > (workspaceGroup.setColor > (workspaceGroup.color.grey workspaceGroup.color.blue workspaceGroup.color.red workspaceGroup.color.yellow workspaceGroup.color.green workspaceGroup.color.pink workspaceGroup.color.purple workspaceGroup.color.cyan workspaceGroup.color.orange) workspaceGroup.setIcon workspaceGroup.clearIcon) [options] > (workspaceGroup.markRead workspaceGroup.markUnread workspaceGroup.clearNotifications) | toggleFocusedWorkspaceGroupCollapsed [group] > (workspaceGroup.collapseAll workspaceGroup.expandAll) | [move] > (workspaceGroup.moveUp workspaceGroup.moveDown workspaceGroup.moveToNewWindow workspaceGroup.moveToWindow workspaceGroup.moveToSpace workspaceGroup.addToSection) | workspaceGroup.editConfig workspaceGroup.copyID | [close] > (workspaceGroup.ungroup workspaceGroup.closeWorkspaces workspaceGroup.delete) +- **workspaceGroup**: workspaceGroup.newWorkspace workspaceGroup.duplicate | workspaceGroup.rename workspaceGroup.togglePin [appearance] > (workspaceGroup.setColor > (workspaceGroup.color.grey workspaceGroup.color.blue workspaceGroup.color.red workspaceGroup.color.yellow workspaceGroup.color.green workspaceGroup.color.pink workspaceGroup.color.purple workspaceGroup.color.cyan workspaceGroup.color.orange) workspaceGroup.setIcon workspaceGroup.clearIcon) [options] > (workspaceGroup.markRead workspaceGroup.markUnread workspaceGroup.clearNotifications) | toggleFocusedWorkspaceGroupCollapsed [group] > (workspaceGroup.collapseAll workspaceGroup.expandAll) | [move] > (workspaceGroup.moveUp workspaceGroup.moveDown workspaceGroup.moveToNewWindow workspaceGroup.moveToWindow workspaceGroup.moveToSpace workspaceGroup.addToSection) | workspaceGroup.editConfig workspaceGroup.copyID | [close] > (workspaceGroup.ungroup workspaceGroup.closeWorkspaces workspaceGroup.delete workspaceGroup.closeOthers) - **sidebarBackground**: newTab newBrowserWorkspace openFolder newWorkspaceGroup [new] > (workspace.newAtTop workspace.newAtBottom workspace.newOnMachine space.new reopenClosedWorkspace reopenPreviousSession | newCloudWorkspace remote.connect | sidebar.home.add sidebar.item.add sidebar.section.add) | [options] > (sidebar.workspaceTabs.toggle palette.enableMinimalMode palette.disableMinimalMode sidebar.density.compact sidebar.density.expanded | sidebar.layout.reset) | [group] > (workspaceGroup.collapseAll workspaceGroup.expandAll sidebar.groupBy.none sidebar.groupBy.folder) | [move] > (workspace.sortByName workspace.sortByLastUsed workspace.sortByDirectory) | sidebar.projects.hide sidebar.sections.showHidden | toggleSidebar appStore.show - **terminalSelection**: terminalCopy terminalPaste terminal.selectAll useSelectionForFind terminal.sendText | [split] > (splitRight splitDown splitLeft splitUp) [agent] > (palette.forkAgentConversationRight palette.forkAgentConversationNewTab palette.forkAgentConversationLeft palette.forkAgentConversationTop palette.forkAgentConversationBottom palette.forkAgentConversationNewWorkspace) | [options] > (clearScreenKeepScrollback resetTerminal terminal.clear) | toggleSplitZoom | palette.terminalOpenDirectory - **browserPage**: browserBack browserForward browserReload browserHardReload browser.copyURL browser.openLocally | browserTheme[choices] [options] > (toggleBrowserFocusMode toggleBrowserDesignMode) | browserPrint | bookmark.addPage | toggleBrowserDeveloperTools [tools] > (palette.browserOpenDefault browserScreenshotPage browserScreenshotSection browserDevice | browser.pageInfo > (browser.pageInfo browser.pageInfo.connection browser.pageInfo.certificate browser.pageInfo.reenableCertificateWarnings | browser.pageInfo.setPermission browser.pageInfo.resetPermissions | browser.pageInfo.cookies browser.pageInfo.manageSiteData browser.pageInfo.deleteSiteData | browser.pageInfo.siteSettings browser.pageInfo.aboutThisPage) showBrowserJavaScriptConsole inspectBrowserElement | browser.extensions.menu browser.extensions.manage browser.extensions.webStore browser.extensions.loadUnpacked) @@ -80,7 +80,7 @@ Palette 916, CLI verbs 511, right-click 492, MCP tools 442. - **notification**: notificationOpen | notificationToggleRead | notificationCopy | notificationDismiss - **sidebarItem**: sidebar.item.toggleLabel | sidebar.profileControl.hide | sidebar.item.removeEverywhere sidebar.item.remove sidebar.item.hideApp - **sidebarFooter**: sidebar.spaces.show sidebar.profileControl.show -- **sidebarSection**: sidebar.section.add sidebar.item.add | sidebar.section.rename [appearance] > (sidebar.section.useBuiltInLook sidebar.section.useListLook sidebar.section.toggleTitle sidebar.section.layoutList sidebar.section.layoutInline sidebar.section.layoutGrid sidebar.section.setAlignment sidebar.section.setGap sidebar.section.setColumns) [options] > (sidebar.section.toggleSpaceScope sidebar.section.setMaxRows) | sidebar.section.toggleCollapsed | [move] > (sidebar.section.moveToTop sidebar.section.moveToScrolling sidebar.section.moveToBottom) | sidebar.section.hide | sidebar.section.remove sidebar.item.hideApp +- **sidebarSection**: sidebar.section.add sidebar.section.newWorkspace sidebar.item.add | sidebar.section.rename [appearance] > (sidebar.section.useBuiltInLook sidebar.section.useListLook sidebar.section.toggleTitle sidebar.section.layoutList sidebar.section.layoutInline sidebar.section.layoutGrid sidebar.section.setAlignment sidebar.section.setGap sidebar.section.setColumns) [options] > (sidebar.section.toggleSpaceScope sidebar.section.setMaxRows) | sidebar.section.toggleCollapsed | [move] > (sidebar.section.moveToTop sidebar.section.moveToScrolling sidebar.section.moveToBottom) | sidebar.section.hide | sidebar.section.remove sidebar.section.closeWorkspaces sidebar.item.hideApp - **agentChat**: appearance.changeBackground workspace.setTheme[choices] | cloudMove cloudBringBack | agentPaneZoomIn agentPaneZoomOut agentPaneZoomReset | find | agentPane.toggleInspector - **windowBackground**: appearance.changeBackground @@ -112,7 +112,7 @@ Palette 916, CLI verbs 511, right-click 492, MCP tools 442. **liveInput** (96): `taskManager.killProcess`, `toggleChecklistItemComplete`, `groupSelectedWorkspaces`, `canvasAlignLeft`, `canvasAlignRight`, `canvasAlignTop`, `canvasAlignBottom`, `canvasEqualizeWidths`, `canvasEqualizeHeights`, `canvasDistributeHorizontally`, `canvasDistributeVertically`, `simulatorHome`, `simulatorRotateLeft`, `simulatorRotateRight`, `simulatorToggleAppearance`, `simulatorToggleSoftwareKeyboard`, `toggleTerminalCopyMode`, `palette.terminalToggleTextBoxInput`, `cycleTextBoxSubmitAction`, `attachTextBoxFile`, `sendCtrlFToTerminal`, `pasteLastScreenshot`, `find`, `findInDirectory`, `findNext`, `findPrevious`, `hideFind`, `useSelectionForFind`, `terminalCopy`, `terminalPaste`, `browserScreenshotSection`, `saveFilePreview`, `toggleFileEditorWordWrap`, `diffViewerNextLine`, `diffViewerPreviousLine`, `diffViewerHalfPageDown`, `diffViewerHalfPageUp`, `diffViewerNextHunk`, `diffViewerPreviousHunk`, `diffViewerGoToBottom`, `diffViewerGoToTop`, `diffViewerSearch`, `diffViewerNextFile`, `diffViewerPreviousFile`, `omnibar.openInBackgroundTab`, `omnibar.openInForegroundTab`, `browser.prompt.allow`, `browser.prompt.block`, `fileEditorGotoLine`, `fileEditorReplace`, `fileEditorAction`, `fileExplorerOpenSelection`, `fileExplorerOpenSelectionFinderAlias`, `fileExplorerOpenInCmux`, `fileExplorerReveal`, `fileExplorerCopyPath`, `fileExplorerCopyRelativePath`, `fileExplorerOpenWith`, `vaultOpenSession`, `vaultResumeInNewWorkspace`, `vaultCopyResumeCommand`, `vaultOpenPullRequest`, `checklistEditItem`, `checklistMarkInProgress`, `checklistCompleteItem`, `checklistRemoveItem`, `checklistOpenAsPane`, `checklistAttachImages`, `toggleUnread`, `notificationCopy`, `notificationToggleRead`, `notificationDismiss`, `palette.toggleDictation`, `terminal.selectAll`, `terminal.scrollToSelection`, `markdownSave`, `markdownLink`, `markdownBack`, `markdownForward`, `list.next`, `list.previous`, `paletteKey.firstItem`, `paletteKey.lastItem`, `paletteKey.pageUp`, `paletteKey.pageDown`, `paletteKey.submit`, `paletteKey.submitAlternate`, `paletteKey.openActions`, `paletteKey.closeActions`, `paletteKey.toggleActions`, `paletteKey.escape`, `paletteKey.enterRow`, `paletteKey.leaveLevel`, `paletteKey.back`, `paletteKey.filterDeleteBackward`, `paletteKey.closeItem` -**guiOnly** (147): `openSettings`, `closeAllWindows`, `zoomWindow`, `selectNextWindow`, `selectPreviousWindow`, `minimizeWindow`, `toggleFullScreen`, `globalSearch`, `commandPalette`, `palette.openTaskManager`, `palette.sleepyMode`, `about`, `revealWorkspaceInFinder`, `workspaceGroup.editConfig`, `manageLayouts`, `palette.openWorkspacePullRequests`, `palette.findWork`, `toggleSplitZoom`, `canvasOverview`, `hints.show`, `palette.toggleFullWidthTab`, `tab.showResources`, `workspace.showResources`, `home.newMessage`, `toggleBrowserDeveloperTools`, `showBrowserJavaScriptConsole`, `inspectBrowserElement`, `toggleBrowserFocusMode`, `toggleBrowserDesignMode`, `toggleReactGrab`, `browserLinkHints`, `browserLinkHintsNewSplit`, `palette.browserToggleOmnibar`, `importFromBrowser`, `password.importCSV`, `passwords.open`, `openLinkInDefaultBrowser`, `browserPrint`, `filePreviewOpenWith`, `filePreviewOpenExternally`, `filePreviewRevealInFinder`, `palette.vscodeServeWebStop`, `palette.vscodeServeWebRestart`, `browser.allowAgentWithExtensions`, `browser.importFromFiles`, `browser.media.show`, `browser.downloads.show`, `browser.profile.choose`, `browser.overflow.menu`, `browser.openLocally`, `browser.openOnMachine`, `browser.download.openBlockedSiteSettings`, `browser.link.saveAs`, `browser.image.saveAs`, `browser.selection.lookUp`, `browser.pageInfo`, `browser.pageInfo.connection`, `browser.pageInfo.certificate`, `browser.pageInfo.cookies`, `browser.pageInfo.manageSiteData`, `browser.pageInfo.siteSettings`, `browser.pageInfo.aboutThisPage`, `browser.certificateWarning.proceed`, `browser.certificateWarning.goBack`, `browser.extensions.menu`, `browser.extensions.manage`, `browser.extensions.webStore`, `browser.extension.options`, `browserProfile.delete`, `browserProfile.manageExtensions`, `sidebar.profileMenu`, `browser.downloads.showFolder`, `toggleSidebar`, `toggleRightSidebar`, `switchRightSidebarToFiles`, `switchRightSidebarToFind`, `switchRightSidebarToSessions`, `switchRightSidebarToFeed`, `switchRightSidebarToDock`, `switchRightSidebarToMachines`, `feed.show`, `showNotifications`, `notifications.dismissHighlight`, `palette.addHarness`, `agentPane.continueIn`, `agentPane.switchModel`, `agentPane.createCheckpoint`, `agentPane.searchFiles`, `agentPane.copyLastCodeBlock`, `agentPane.archiveChat`, `agentPane.searchChats`, `agentPane.permission.allowOnce`, `agentPane.permission.allowChat`, `agentPane.permission.deny`, `agentPane.permission.expand`, `agentPane.permission.retry`, `agentPane.permission.revoke`, `agentPane.permission.refresh`, `palette.openTerminalChatView`, `palette.computerUse.setup`, `palette.computerUse.accessibility`, `palette.computerUse.screenRecording`, `home.toggleChiefSettings`, `home.stopChief`, `agentPane.previousTurn`, `agentPane.nextTurn`, `agentPane.previousBookmarkedPrompt`, `agentPane.nextBookmarkedPrompt`, `agent.harness.addFromRegistry`, `agent.harness.updateAll`, `palette.cloud.tools`, `cloudOpenMachine`, `openTeamPicker`, `palette.mobileConnect`, `palette.openCmuxSettingsFile`, `palette.openGhosttySettings`, `ghostty.showDiagnostics`, `palette.searchShortcuts`, `palette.pro.upgrade`, `sendFeedback`, `help.featureFlags`, `help.documentation`, `appearance.customize`, `recentlyFocused`, `recentlyClosed`, `history.commands`, `agentHistory.show`, `browserShowHistory`, `history.search`, `bookmark.toggleBar`, `bookmark.manager`, `sidebar.section.hide`, `sidebar.projects.hide`, `sidebar.sections.showHidden`, `sidebar.spaces.hide`, `sidebar.spaces.show`, `sidebar.profileControl.hide`, `sidebar.profileControl.show`, `sidebar.groupBy.none`, `sidebar.groupBy.folder`, `sidebar.density.compact`, `sidebar.density.expanded`, `sidebar.workspaceTabs.toggle`, `appStore.showInstalled`, `tasks.new`, `app.shareCmux`, `server.showPanel` +**guiOnly** (145): `openSettings`, `zoomWindow`, `selectNextWindow`, `selectPreviousWindow`, `minimizeWindow`, `toggleFullScreen`, `globalSearch`, `commandPalette`, `palette.openTaskManager`, `palette.sleepyMode`, `about`, `revealWorkspaceInFinder`, `workspaceGroup.editConfig`, `manageLayouts`, `palette.openWorkspacePullRequests`, `palette.findWork`, `toggleSplitZoom`, `canvasOverview`, `hints.show`, `palette.toggleFullWidthTab`, `tab.showResources`, `workspace.showResources`, `home.newMessage`, `toggleBrowserDeveloperTools`, `showBrowserJavaScriptConsole`, `inspectBrowserElement`, `toggleBrowserFocusMode`, `toggleBrowserDesignMode`, `toggleReactGrab`, `browserLinkHints`, `browserLinkHintsNewSplit`, `palette.browserToggleOmnibar`, `importFromBrowser`, `password.importCSV`, `passwords.open`, `openLinkInDefaultBrowser`, `browserPrint`, `filePreviewOpenWith`, `filePreviewOpenExternally`, `filePreviewRevealInFinder`, `palette.vscodeServeWebStop`, `palette.vscodeServeWebRestart`, `browser.allowAgentWithExtensions`, `browser.importFromFiles`, `browser.media.show`, `browser.downloads.show`, `browser.profile.choose`, `browser.overflow.menu`, `browser.openLocally`, `browser.openOnMachine`, `browser.download.openBlockedSiteSettings`, `browser.link.saveAs`, `browser.image.saveAs`, `browser.selection.lookUp`, `browser.pageInfo`, `browser.pageInfo.connection`, `browser.pageInfo.certificate`, `browser.pageInfo.cookies`, `browser.pageInfo.manageSiteData`, `browser.pageInfo.siteSettings`, `browser.pageInfo.aboutThisPage`, `browser.certificateWarning.proceed`, `browser.certificateWarning.goBack`, `browser.extensions.menu`, `browser.extensions.manage`, `browser.extensions.webStore`, `browser.extension.options`, `browserProfile.delete`, `browserProfile.manageExtensions`, `sidebar.profileMenu`, `browser.downloads.showFolder`, `toggleSidebar`, `toggleRightSidebar`, `switchRightSidebarToFiles`, `switchRightSidebarToFind`, `switchRightSidebarToSessions`, `switchRightSidebarToFeed`, `switchRightSidebarToDock`, `switchRightSidebarToMachines`, `feed.show`, `showNotifications`, `notifications.dismissHighlight`, `palette.addHarness`, `agentPane.continueIn`, `agentPane.switchModel`, `agentPane.createCheckpoint`, `agentPane.searchFiles`, `agentPane.copyLastCodeBlock`, `agentPane.searchChats`, `agentPane.permission.allowOnce`, `agentPane.permission.allowChat`, `agentPane.permission.deny`, `agentPane.permission.expand`, `agentPane.permission.retry`, `agentPane.permission.revoke`, `agentPane.permission.refresh`, `palette.openTerminalChatView`, `palette.computerUse.setup`, `palette.computerUse.accessibility`, `palette.computerUse.screenRecording`, `home.toggleChiefSettings`, `home.stopChief`, `agentPane.previousTurn`, `agentPane.nextTurn`, `agentPane.previousBookmarkedPrompt`, `agentPane.nextBookmarkedPrompt`, `agent.harness.addFromRegistry`, `agent.harness.updateAll`, `palette.cloud.tools`, `cloudOpenMachine`, `openTeamPicker`, `palette.mobileConnect`, `palette.openCmuxSettingsFile`, `palette.openGhosttySettings`, `ghostty.showDiagnostics`, `palette.searchShortcuts`, `palette.pro.upgrade`, `sendFeedback`, `help.featureFlags`, `help.documentation`, `appearance.customize`, `recentlyFocused`, `recentlyClosed`, `history.commands`, `agentHistory.show`, `browserShowHistory`, `history.search`, `bookmark.toggleBar`, `bookmark.manager`, `sidebar.section.hide`, `sidebar.projects.hide`, `sidebar.sections.showHidden`, `sidebar.spaces.hide`, `sidebar.spaces.show`, `sidebar.profileControl.hide`, `sidebar.profileControl.show`, `sidebar.groupBy.none`, `sidebar.groupBy.folder`, `sidebar.density.compact`, `sidebar.density.expanded`, `sidebar.workspaceTabs.toggle`, `appStore.showInstalled`, `tasks.new`, `app.shareCmux`, `server.showPanel` **clipboard** (22): `copyWorkspaceSSHError`, `palette.copyWorkspaceID`, `palette.copyWorkspaceIDAndRef`, `palette.copyWorkspaceLink`, `workspace.copyPath`, `workspaceGroup.copyID`, `palette.copyIdentifiers`, `palette.copyPaneID`, `palette.copyPaneLink`, `palette.copySurfaceID`, `palette.copySurfaceLink`, `browser.copyURL`, `browser.link.copy`, `browser.link.copyText`, `browser.image.copy`, `browser.image.copyAddress`, `browser.selection.copy`, `cloudCopyLink`, `cloudCopyPort`, `cloudCopyMachineID`, `remote.copyError`, `bookmark.copyLink` @@ -138,7 +138,7 @@ Palette 916, CLI verbs 511, right-click 492, MCP tools 442. **guiOnly** (22): `browser.media.show`, `browser.downloads.show`, `browser.profile.choose`, `browser.overflow.menu`, `browser.download.openBlockedSiteSettings`, `agentPane.continueIn`, `agentPane.switchModel`, `agentPane.createCheckpoint`, `agentPane.searchFiles`, `agentPane.copyLastCodeBlock`, `agentPane.archiveChat`, `agentPane.permission.allowOnce`, `agentPane.permission.allowChat`, `agentPane.permission.deny`, `agentPane.permission.expand`, `agentPane.permission.retry`, `agentPane.permission.revoke`, `agentPane.permission.refresh`, `agentPane.previousTurn`, `agentPane.nextTurn`, `agentPane.previousBookmarkedPrompt`, `agentPane.nextBookmarkedPrompt` -**noObject** (186): `openSettings`, `newWindow`, `newIncognitoWindow`, `closeWindow`, `closeAllWindows`, `zoomWindow`, `selectNextWindow`, `selectPreviousWindow`, `minimizeWindow`, `toggleFullScreen`, `quit`, `quitKeepSessions`, `quitEndSessions`, `quitEndEverything`, `globalSearch`, `palette.open`, `commandPalette`, `palette.openTaskManager`, `palette.sleepyMode`, `keepMacAwake`, `about`, `workspace.closeAllInAllWindows`, `manageLayouts`, `palette.findWork`, `workspace.importClassic`, `reopenClosedBrowserPanel`, `home.show`, `home.tab`, `home.channels`, `home.attachFiles`, `home.newMessage`, `home.invite`, `home.newChief`, `home.saveFlightRecording`, `palette.browserClearHistory`, `importFromBrowser`, `password.importCSV`, `passwords.open`, `palette.enableBrowser`, `palette.disableBrowser`, `browser.allowAgentWithExtensions`, `browser.importFromFiles`, `sidebar.profileMenu`, `browser.downloads.showFolder`, `toggleRightSidebar`, `switchRightSidebarToFiles`, `switchRightSidebarToFind`, `switchRightSidebarToSessions`, `switchRightSidebarToFeed`, `switchRightSidebarToDock`, `switchRightSidebarToMachines`, `palette.toggleMatchTerminalBackground`, `feed.show`, `showNotifications`, `markAllNotificationsRead`, `clearAllNotifications`, `notifications.toggleBanners`, `notifications.dismissal.keystroke`, `notifications.dismissal.focus`, `notifications.dismissal.click`, `notifications.dismissal.explicit`, `notifications.dismissal.timeout`, `notifications.dismissal.never`, `palette.quickAgentChat`, `palette.startAgentFromAnyApp`, `palette.addHarness`, `palette.openTerminalChatView`, `palette.launchClaudeTeams`, `palette.launchCodexTeams`, `palette.computerUse.setup`, `palette.computerUse.accessibility`, `palette.computerUse.screenRecording`, `agent.openSessionWorkspace`, `home.toggleChiefSettings`, `home.stopChief`, `chief.openMemoryInspector`, `agentActivity.open`, `computerUseStop`, `agent.harness.add`, `agent.harness.addFromRegistry`, `agent.harness.remove`, `agent.harness.restore`, `agent.harness.doctor`, `agent.harness.updateAll`, `newCloudMachine`, `cloudDiagnostics`, `openTeamPicker`, `palette.auth.signIn`, `palette.auth.signOut`, `palette.mobileConnect`, `accounts.show`, `accounts.refresh`, `accounts.reauthenticate`, `accounts.connect`, `accounts.remove`, `remote.openBrowserTab`, `remote.openLocalBrowserTab`, `reloadConfiguration`, `palette.openCmuxSettingsFile`, `palette.openGhosttySettings`, `ghostty.showDiagnostics`, `palette.makeDefaultBrowser`, `palette.makeDefaultTerminal`, `palette.toggleSetting`, `palette.shortcutKeymap`, `palette.searchShortcuts`, `keybindings.open`, `palette.installCLI`, `palette.uninstallCLI`, `palette.restartSocketListener`, `palette.checkForUpdates`, `updates.whatsNew`, `announcements.show`, `announcements.hide`, `palette.applyUpdateIfAvailable`, `palette.switchAppChannel`, `palette.pro.upgrade`, `sendFeedback`, `help.showCrashLogs`, `help.featureFlags`, `help.documentation`, `appearance.density.compact`, `appearance.density.comfortable`, `appearance.animationSpeed.fast`, `appearance.animationSpeed.normal`, `appearance.animationSpeed.off`, `browser.defaultEngine.chromium`, `browser.defaultEngine.webkit`, `appearance.paneBorder.toggle`, `appearance.panePadding.toggle`, `appearance.paneCorners.toggle`, `layout.centerFocusedColumn.never`, `layout.centerFocusedColumn.always`, `layout.centerFocusedColumn.onOverflow`, `focusRing.toggle`, `focusRing.style.ring`, `focusRing.style.glow`, `focusRing.singlePane.toggle`, `appearance.paneBorderWidth.toggle`, `appearance.paneBorderColor.reset`, `appearance.titlebar.minimal`, `appearance.titlebar.standard`, `appearance.customize`, `appearance.chromeStyle.default`, `appearance.chromeStyle.card`, `appearance.chromeStyle.cardOutlined`, `appearance.chromeStyle.flat`, `appearance.chromeStyle.flatSidebarLine`, `appearance.chromeStyle.bare`, `appearance.chromeStyle.panes`, `appearance.chromeStyle.twoTone`, `browser.hibernation.off`, `browser.hibernation.moderate`, `browser.hibernation.aggressive`, `layout.toggleStripScrollbar`, `recentlyFocused`, `recentlyClosed`, `history.commands`, `history.show`, `agentHistory.show`, `browserShowHistory`, `history.search`, `history.resumeAgentSession`, `history.reopen`, `history.open`, `history.clear`, `layout.undo`, `bookmark.add`, `bookmark.import`, `bookmark.importFromBrowser`, `bookmark.export`, `appStore.showInstalled`, `app.hide`, `app.unhide`, `app.open`, `app.command.run`, `tasks.show`, `tasks.new`, `tasks.showMine`, `link.open`, `app.shareCmux`, `server.makeThisMacAServer`, `server.stopServing`, `server.addServer`, `server.showPanel`, `server.showHealth` +**noObject** (187): `openSettings`, `newWindow`, `newIncognitoWindow`, `closeWindow`, `window.closeOthers`, `closeAllWindows`, `zoomWindow`, `selectNextWindow`, `selectPreviousWindow`, `minimizeWindow`, `toggleFullScreen`, `quit`, `quitKeepSessions`, `quitEndSessions`, `quitEndEverything`, `globalSearch`, `palette.open`, `commandPalette`, `palette.openTaskManager`, `palette.sleepyMode`, `keepMacAwake`, `about`, `workspace.closeAllInAllWindows`, `manageLayouts`, `palette.findWork`, `workspace.importClassic`, `reopenClosedBrowserPanel`, `home.show`, `home.tab`, `home.channels`, `home.attachFiles`, `home.newMessage`, `home.invite`, `home.newChief`, `home.saveFlightRecording`, `palette.browserClearHistory`, `importFromBrowser`, `password.importCSV`, `passwords.open`, `palette.enableBrowser`, `palette.disableBrowser`, `browser.allowAgentWithExtensions`, `browser.importFromFiles`, `sidebar.profileMenu`, `browser.downloads.showFolder`, `toggleRightSidebar`, `switchRightSidebarToFiles`, `switchRightSidebarToFind`, `switchRightSidebarToSessions`, `switchRightSidebarToFeed`, `switchRightSidebarToDock`, `switchRightSidebarToMachines`, `palette.toggleMatchTerminalBackground`, `feed.show`, `showNotifications`, `markAllNotificationsRead`, `clearAllNotifications`, `notifications.toggleBanners`, `notifications.dismissal.keystroke`, `notifications.dismissal.focus`, `notifications.dismissal.click`, `notifications.dismissal.explicit`, `notifications.dismissal.timeout`, `notifications.dismissal.never`, `palette.quickAgentChat`, `palette.startAgentFromAnyApp`, `palette.addHarness`, `palette.openTerminalChatView`, `palette.launchClaudeTeams`, `palette.launchCodexTeams`, `palette.computerUse.setup`, `palette.computerUse.accessibility`, `palette.computerUse.screenRecording`, `agent.openSessionWorkspace`, `home.toggleChiefSettings`, `home.stopChief`, `chief.openMemoryInspector`, `agentActivity.open`, `computerUseStop`, `agent.harness.add`, `agent.harness.addFromRegistry`, `agent.harness.remove`, `agent.harness.restore`, `agent.harness.doctor`, `agent.harness.updateAll`, `newCloudMachine`, `cloudDiagnostics`, `openTeamPicker`, `palette.auth.signIn`, `palette.auth.signOut`, `palette.mobileConnect`, `accounts.show`, `accounts.refresh`, `accounts.reauthenticate`, `accounts.connect`, `accounts.remove`, `remote.openBrowserTab`, `remote.openLocalBrowserTab`, `reloadConfiguration`, `palette.openCmuxSettingsFile`, `palette.openGhosttySettings`, `ghostty.showDiagnostics`, `palette.makeDefaultBrowser`, `palette.makeDefaultTerminal`, `palette.toggleSetting`, `palette.shortcutKeymap`, `palette.searchShortcuts`, `keybindings.open`, `palette.installCLI`, `palette.uninstallCLI`, `palette.restartSocketListener`, `palette.checkForUpdates`, `updates.whatsNew`, `announcements.show`, `announcements.hide`, `palette.applyUpdateIfAvailable`, `palette.switchAppChannel`, `palette.pro.upgrade`, `sendFeedback`, `help.showCrashLogs`, `help.featureFlags`, `help.documentation`, `appearance.density.compact`, `appearance.density.comfortable`, `appearance.animationSpeed.fast`, `appearance.animationSpeed.normal`, `appearance.animationSpeed.off`, `browser.defaultEngine.chromium`, `browser.defaultEngine.webkit`, `appearance.paneBorder.toggle`, `appearance.panePadding.toggle`, `appearance.paneCorners.toggle`, `layout.centerFocusedColumn.never`, `layout.centerFocusedColumn.always`, `layout.centerFocusedColumn.onOverflow`, `focusRing.toggle`, `focusRing.style.ring`, `focusRing.style.glow`, `focusRing.singlePane.toggle`, `appearance.paneBorderWidth.toggle`, `appearance.paneBorderColor.reset`, `appearance.titlebar.minimal`, `appearance.titlebar.standard`, `appearance.customize`, `appearance.chromeStyle.default`, `appearance.chromeStyle.card`, `appearance.chromeStyle.cardOutlined`, `appearance.chromeStyle.flat`, `appearance.chromeStyle.flatSidebarLine`, `appearance.chromeStyle.bare`, `appearance.chromeStyle.panes`, `appearance.chromeStyle.twoTone`, `browser.hibernation.off`, `browser.hibernation.moderate`, `browser.hibernation.aggressive`, `layout.toggleStripScrollbar`, `recentlyFocused`, `recentlyClosed`, `history.commands`, `history.show`, `agentHistory.show`, `browserShowHistory`, `history.search`, `history.resumeAgentSession`, `history.reopen`, `history.open`, `history.clear`, `layout.undo`, `bookmark.add`, `bookmark.import`, `bookmark.importFromBrowser`, `bookmark.export`, `appStore.showInstalled`, `app.hide`, `app.unhide`, `app.open`, `app.command.run`, `tasks.show`, `tasks.new`, `tasks.showMine`, `link.open`, `app.shareCmux`, `server.makeThisMacAServer`, `server.stopServing`, `server.addServer`, `server.showPanel`, `server.showHealth` **noTargetSurface** (81): `taskManager.killProcess`, `toggleChecklistItemComplete`, `canvasOverview`, `canvasTidy`, `canvasAlignLeft`, `canvasAlignRight`, `canvasAlignTop`, `canvasAlignBottom`, `canvasEqualizeWidths`, `canvasEqualizeHeights`, `canvasDistributeHorizontally`, `canvasDistributeVertically`, `simulatorHome`, `simulatorRotateLeft`, `simulatorRotateRight`, `simulatorToggleAppearance`, `simulatorToggleSoftwareKeyboard`, `file.open`, `home.archiveChief`, `tabGroup.deleteSaved`, `tabGroup.reopenSaved`, `screenGroup.reopenSaved`, `screenGroup.deleteSaved`, `resumeCommandSet`, `resumeCommandEdit`, `resumeCommandClear`, `saveFilePreview`, `toggleFileEditorWordWrap`, `filePreviewOpenWith`, `filePreviewOpenExternally`, `filePreviewRevealInFinder`, `diffViewerNextLine`, `diffViewerPreviousLine`, `diffViewerHalfPageDown`, `diffViewerHalfPageUp`, `diffViewerNextHunk`, `diffViewerPreviousHunk`, `diffViewerGoToBottom`, `diffViewerGoToTop`, `diffViewerSearch`, `diffViewerNextFile`, `diffViewerPreviousFile`, `palette.vscodeServeWebStop`, `palette.vscodeServeWebRestart`, `browser.openOnMachine`, `openDiffViewer`, `palette.openDirectoryDiffViewer`, `openMarkdownFile`, `fileEditorGotoLine`, `fileEditorReplace`, `fileEditorAction`, `browser.certificateWarning.proceed`, `browser.certificateWarning.goBack`, `browserProfile.openLink`, `fileExplorerOpenSelection`, `fileExplorerOpenSelectionFinderAlias`, `fileExplorerOpenInCmux`, `fileExplorerReveal`, `fileExplorerCopyPath`, `fileExplorerCopyRelativePath`, `fileExplorerOpenWith`, `vaultOpenSession`, `vaultResumeInNewWorkspace`, `vaultCopyResumeCommand`, `vaultOpenPullRequest`, `checklistEditItem`, `checklistMarkInProgress`, `checklistCompleteItem`, `checklistRemoveItem`, `checklistOpenAsPane`, `checklistAttachImages`, `agentPane.git.commit`, `agentPane.git.push`, `agentPane.searchChats`, `cloudExec`, `cloudDomainList`, `cloudPublicationList`, `markdownSave`, `markdownLink`, `markdownBack`, `markdownForward` From fda520f4c48ec7427d6c586bf3ff64381976d43d Mon Sep 17 00:00:00 2001 From: "cmux-autofix[bot]" Date: Wed, 14 Oct 2026 12:54:49 +0000 Subject: [PATCH 12/27] chore(next): PR autofix at 568dba62ae7a - vp fmt webviews/test/ime-composition-keys.test.ts - cargo fmt in Native/OptChat/optchat-chief Autofix-Run: https://github.com/manaflow-ai/cmux/actions/runs/38566033765 --- .../optchat-chief/src/chief_profile.rs | 13 ++++-- Native/OptChat/optchat-chief/src/host.rs | 3 +- .../OptChat/optchat-chief/src/session_dir.rs | 7 ++- Native/OptChat/optchat-chief/src/subagents.rs | 16 +++---- .../optchat-chief/tests/profile_daemon.rs | 43 ++++++++++++++----- webviews/test/ime-composition-keys.test.ts | 20 +++++++-- 6 files changed, 72 insertions(+), 30 deletions(-) diff --git a/Native/OptChat/optchat-chief/src/chief_profile.rs b/Native/OptChat/optchat-chief/src/chief_profile.rs index 18a58a050a3f..a60666239e25 100644 --- a/Native/OptChat/optchat-chief/src/chief_profile.rs +++ b/Native/OptChat/optchat-chief/src/chief_profile.rs @@ -332,7 +332,9 @@ impl ChiefTools { } fn read(&self) -> std::sync::RwLockReadGuard<'_, Loaded> { - self.state.read().unwrap_or_else(std::sync::PoisonError::into_inner) + self.state + .read() + .unwrap_or_else(std::sync::PoisonError::into_inner) } /// Whether the record is still to be read (a default Chief whose daemon @@ -364,11 +366,16 @@ impl ChiefTools { } } Err(e) => { - log(format!("chief record: still not read ({e}); zoom and date only")); + log(format!( + "chief record: still not read ({e}); zoom and date only" + )); return; } }; - *self.state.write().unwrap_or_else(std::sync::PoisonError::into_inner) = next; + *self + .state + .write() + .unwrap_or_else(std::sync::PoisonError::into_inner) = next; self.log_record(log); log("chief record: the profile text reaches the prompt at the brain's next start".into()); } diff --git a/Native/OptChat/optchat-chief/src/host.rs b/Native/OptChat/optchat-chief/src/host.rs index 4b4c3a8709bb..bb0e0f761405 100644 --- a/Native/OptChat/optchat-chief/src/host.rs +++ b/Native/OptChat/optchat-chief/src/host.rs @@ -1331,7 +1331,8 @@ fn start( }); // A default Chief that could not read its record at start reads it each // time the link comes up, until it has it (zoom and date only until then). - let sink = crate::chief_profile::read_record_on_up(chief_tools.clone(), sink, brain_log.clone()); + let sink = + crate::chief_profile::read_record_on_up(chief_tools.clone(), sink, brain_log.clone()); match source { Source::Local { token_file } => { let (display_name, title) = LinkConfig::names_from_env(); diff --git a/Native/OptChat/optchat-chief/src/session_dir.rs b/Native/OptChat/optchat-chief/src/session_dir.rs index 5cc96f83ae4d..0955bb1fb3bb 100644 --- a/Native/OptChat/optchat-chief/src/session_dir.rs +++ b/Native/OptChat/optchat-chief/src/session_dir.rs @@ -294,8 +294,11 @@ pub fn write(paths: &Paths, setup: &SessionSetup) -> io::Result<()> { // turns, engine.rs); Claude Code reads only CLAUDE.md, which only the // old layout of a Claude harness keeps. let chief = paths.bin.join("chief").display().to_string(); - let agents = - chief_system_text(setup.instructions.as_deref(), &Tools::Cli(chief), setup.profile_tool); + let agents = chief_system_text( + setup.instructions.as_deref(), + &Tools::Cli(chief), + setup.profile_tool, + ); write_if_changed(&paths.session.join("AGENTS.md"), agents.as_bytes())?; match setup.tools { Tools::Mcp => { diff --git a/Native/OptChat/optchat-chief/src/subagents.rs b/Native/OptChat/optchat-chief/src/subagents.rs index 695d2c12924c..20e02595564f 100644 --- a/Native/OptChat/optchat-chief/src/subagents.rs +++ b/Native/OptChat/optchat-chief/src/subagents.rs @@ -698,15 +698,13 @@ impl Orchestrator for Spawner { let run = self.engine_settings(plan.engine.as_ref()); // The person's grant: a harness outside it starts nothing. let grant = self.grant.as_ref().map(|g| g.grant()); - let refused = grant - .filter(|g| !g.allows_harness(&run.harness)) - .map(|g| { - format!( - "the person has not given this Chief's subagents the {} harness; it may use {}", - run.harness, - g.harnesses.iter().cloned().collect::>().join(", ") - ) - }); + let refused = grant.filter(|g| !g.allows_harness(&run.harness)).map(|g| { + format!( + "the person has not given this Chief's subagents the {} harness; it may use {}", + run.harness, + g.harnesses.iter().cloned().collect::>().join(", ") + ) + }); self.trace.emit( "spawn", json!({ diff --git a/Native/OptChat/optchat-chief/tests/profile_daemon.rs b/Native/OptChat/optchat-chief/tests/profile_daemon.rs index 7424febc72d8..55088e073d1b 100644 --- a/Native/OptChat/optchat-chief/tests/profile_daemon.rs +++ b/Native/OptChat/optchat-chief/tests/profile_daemon.rs @@ -508,7 +508,10 @@ fn the_default_chief_serves_only_zoom_and_date_until_it_reads_its_record() { "the daemon is away: the default Chief's grant is not known, so it gets zoom and date only" ); let (refused, why) = mcp.call("tell", json!({"id": "a1", "message": "x"})); - assert!(refused && why.contains("not given"), "tell is refused while the grant is not known: {why}"); + assert!( + refused && why.contains("not given"), + "tell is refused while the grant is not known: {why}" + ); // The daemon comes up; the person narrows the default Chief's tools; the // brain's token is there; the link connects and the brain reads its record. @@ -527,16 +530,24 @@ fn the_default_chief_serves_only_zoom_and_date_until_it_reads_its_record() { let record = &updated["value"]; assert_eq!(record["tools"], json!(["tell"]), "{updated}"); let mut expected = vec!["zoom", "date", "tell"]; - if record["self_edit"].as_array().is_some_and(|a| !a.is_empty()) { + if record["self_edit"] + .as_array() + .is_some_and(|a| !a.is_empty()) + { expected.push("profile"); } let minted = me.token_file(dir.path(), "agent_mux"); std::fs::rename(&minted, &token).unwrap(); - wait_until(&host_log, "the host reading the default Chief's record", || { - mcp.names() == expected - }); + wait_until( + &host_log, + "the host reading the default Chief's record", + || mcp.names() == expected, + ); let (refused, why) = mcp.call("spawn", json!({"tasks": ["build it"]})); - assert!(refused && why.contains("not given"), "the record's grant holds: {why}"); + assert!( + refused && why.contains("not given"), + "the record's grant holds: {why}" + ); drop(mcp); drop(host); } @@ -567,11 +578,17 @@ fn a_chief_with_self_edit_reads_of_chief_profile_in_its_launcher_prompt() { let host_log = dir.path().join("host.log"); let _host = start_host(dir.path(), &daemon.socket, &token, Some(&scout)); let agents_md = dir.path().join("mux/optchat/session/AGENTS.md"); - let chief = dir.path().join("mux/optchat/bin/chief").display().to_string(); + let chief = dir + .path() + .join("mux/optchat/bin/chief") + .display() + .to_string(); let line = format!("- Your profile: `{chief} profile` prints your record"); - wait_until(&host_log, "the launcher prompt naming chief profile", || { - std::fs::read_to_string(&agents_md).is_ok_and(|text| text.contains(&line)) - }); + wait_until( + &host_log, + "the launcher prompt naming chief profile", + || std::fs::read_to_string(&agents_md).is_ok_and(|text| text.contains(&line)), + ); } /// S5 gap 4: the person's `harnesses` grant reaches the spawn path. A Chief @@ -600,7 +617,11 @@ fn a_spawn_on_a_harness_outside_the_grant_starts_nothing() { let token = me.token_file(dir.path(), &builder); let tools = Arc::new( ChiefTools::start( - Some(ProfileClient::new(daemon.socket.clone(), Some(token), builder.clone())), + Some(ProfileClient::new( + daemon.socket.clone(), + Some(token), + builder.clone(), + )), false, &|_| {}, ) diff --git a/webviews/test/ime-composition-keys.test.ts b/webviews/test/ime-composition-keys.test.ts index 68b0647a2c71..604661433b3d 100644 --- a/webviews/test/ime-composition-keys.test.ts +++ b/webviews/test/ime-composition-keys.test.ts @@ -67,7 +67,14 @@ await requireBrowserLane("ime-composition-keys.test.ts", async () => { return page.evaluate( ({ key, isComposing }) => { const target = document.activeElement ?? document.body; - const event = new KeyboardEvent("keydown", { key, code: key, keyCode: 229, isComposing, bubbles: true, cancelable: true }); + const event = new KeyboardEvent("keydown", { + key, + code: key, + keyCode: 229, + isComposing, + bubbles: true, + cancelable: true, + }); // Some engines ignore keyCode in the init dictionary. if (event.keyCode !== 229) Object.defineProperty(event, "keyCode", { get: () => 229 }); target.dispatchEvent(event); @@ -78,7 +85,9 @@ await requireBrowserLane("ime-composition-keys.test.ts", async () => { } const selectedRow = (page: Page) => - page.evaluate(() => document.querySelector(".history-row[aria-selected='true'] .history-row-title")?.textContent ?? null); + page.evaluate( + () => document.querySelector(".history-row[aria-selected='true'] .history-row-title")?.textContent ?? null, + ); for (const [name, engine] of installed) { describe(`IME composition keys (${name})`, () => { @@ -100,7 +109,9 @@ await requireBrowserLane("ime-composition-keys.test.ts", async () => { test("Escape that cancels a composition keeps the search text; a plain Escape clears it", async () => { await page.focus(".history-search"); await page.keyboard.type("re"); - await page.waitForFunction(() => (document.querySelector(".history-search") as HTMLInputElement).value === "re"); + await page.waitForFunction( + () => (document.querySelector(".history-search") as HTMLInputElement).value === "re", + ); // Chromium and WebKit during composition. expect(await imeKey(page, "Escape", true)).toBe(false); @@ -123,7 +134,8 @@ await requireBrowserLane("ime-composition-keys.test.ts", async () => { await page.keyboard.press("ArrowDown"); await page.waitForFunction((was) => { - const now = document.querySelector(".history-row[aria-selected='true'] .history-row-title")?.textContent ?? null; + const now = + document.querySelector(".history-row[aria-selected='true'] .history-row-title")?.textContent ?? null; return now !== was; }, before); }); From 6d83590f120af3c4c69d3c8902b3055cf1d08844 Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 14 Oct 2026 06:14:17 -0700 Subject: [PATCH 13/27] chore: regenerate action exports after merging #20556's head Co-Authored-By: Claude Opus 5.5 --- plans/cmux-next/action-surfaces.json | 46 ++++++++++++++++++++++++++-- plans/cmux-next/actions.md | 10 +++--- 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/plans/cmux-next/action-surfaces.json b/plans/cmux-next/action-surfaces.json index 3e89e54f1c37..8fe742023b93 100644 --- a/plans/cmux-next/action-surfaces.json +++ b/plans/cmux-next/action-surfaces.json @@ -26242,6 +26242,33 @@ "title_key" : "action.sidebar.density.compact", "title_table" : "SidebarSectionActions" }, + { + "cli" : "guiOnly", + "cli_name" : "action sidebar-density-comfortable", + "context_menu" : "offered", + "context_menus" : [ + "sidebarBackground" + ], + "default_aliases" : [ + + ], + "default_chord" : null, + "default_shortcut" : null, + "id" : "sidebar.density.comfortable", + "mcp" : "guiOnly", + "palette" : "offered", + "palette_section" : { + "id" : "category.sidebar", + "order" : 107, + "title" : "Sidebar", + "title_key" : "category.sidebar", + "title_table" : "Localizable" + }, + "palette_suggested" : null, + "title" : "Sidebar Density: Comfortable", + "title_key" : "action.sidebar.density.comfortable", + "title_table" : "SidebarSectionActions" + }, { "cli" : "guiOnly", "cli_name" : "action sidebar-density-expanded", @@ -32082,7 +32109,7 @@ }, { "enabled_when" : "can_perform", - "id" : "sidebar.density.expanded", + "id" : "sidebar.density.comfortable", "kind" : "action", "order" : 4, "visible_when" : { @@ -32093,15 +32120,28 @@ ] } }, + { + "enabled_when" : "can_perform", + "id" : "sidebar.density.expanded", + "kind" : "action", + "order" : 5, + "visible_when" : { + "debug_only" : false, + "feature" : null, + "requires" : [ + + ] + } + }, { "kind" : "separator", - "order" : 5 + "order" : 6 }, { "enabled_when" : "can_perform", "id" : "sidebar.layout.reset", "kind" : "action", - "order" : 6, + "order" : 7, "visible_when" : { "debug_only" : false, "feature" : null, diff --git a/plans/cmux-next/actions.md b/plans/cmux-next/actions.md index 5a121195839a..3e6c562c6a8b 100644 --- a/plans/cmux-next/actions.md +++ b/plans/cmux-next/actions.md @@ -42,16 +42,16 @@ Declare its placements (menu, group, rank) and whether the CLI offers it, or nam - `tab`: 90 - `terminal`: 36 - `browser`: 168 -- `sidebar`: 74 +- `sidebar`: 75 - `notifications`: 21 - `agents`: 60 - `cloud`: 52 - `remote`: 10 - `settings`: 79 -## Counts (957 actions) +## Counts (958 actions) -Palette 921, CLI verbs 518, right-click 496, MCP tools 449. +Palette 922, CLI verbs 518, right-click 497, MCP tools 449. ## Menus @@ -62,7 +62,7 @@ Palette 921, CLI verbs 518, right-click 496, MCP tools 449. - **pane**: splitRight splitDown toggleSplitZoom renamePane [more] > ([new] > (newColumn newRow splitLeft splitUp splitBrowserRight splitBrowserDown remote.openTerminalHere newPaneAutoLayout | palette.newSimulatorPane) | | [move] > (pane.moveToNewWorkspace swapPaneLeft swapPaneRight swapPaneUp swapPaneDown column.moveLeft column.moveRight) | [layout] > (equalizeSplits toggleCanvasLayout pane.toggleTabBar | column.dock column.undock column.float column.dockLeft column.dockRight column.dockTop column.dockBottom | column.widthOneThird column.widthHalf column.widthTwoThirds column.widthFull column.center agentPaneZoomIn agentPaneZoomOut agentPaneZoomReset) | [connection] > (palette.swapWithSession reconnectPane) | triggerFlash [copy] > (palette.copyPaneID palette.copyPaneLink) | pane.closeOthers) | closePane - **workspaceRow**: renameWorkspace palette.toggleWorkspacePin palette.workspaceColor[choices] workspace.newBelow | moveWorkspaceToGroup[choices] groupSelectedWorkspaces removeWorkspaceFromGroup | [more] > ([new] > (workspace.newLikeThis workspace.newAbove workspace.newInNewGroup workspace.duplicate workspace.duplicateTerminalsOnly | palette.openFolderInVSCodeInline palette.openWorkspaceTodoPane palette.layout.open) | [appearance] > (palette.resetWorkspaceColor workspace.setIcon workspace.clearIcon workspace.setTheme[choices] workspace.clearTheme) [options] > (palette.clearWorkspaceName editWorkspaceDescription palette.clearWorkspaceDescription palette.workspaceStatus markWorkspaceDone palette.markWorkspaceRead notifications.dismissHighlight palette.markWorkspaceUnread notifications.toggleWorkspaceMute clearWorkspaceNotifications palette.addWorkspaceChecklistItem | browserProfile.setWorkspaceDefault browserProfile.clearWorkspaceDefault | reconnectWorkspace disconnectWorkspace | sidebar.workspaceTabs.toggle) | [group] > (saveLayoutTemplate) | [move] > (moveWorkspaceUp moveWorkspaceDown palette.moveWorkspaceToTop workspace.moveToBottom moveWorkspaceToWindow moveWorkspaceToNewWindow workspace.toggleTop workspace.moveToSpace workspace.duplicateToSpace workspace.mergeInto) | [copy] > (workspace.copyPath palette.copyWorkspaceID palette.copyWorkspaceLink palette.copyWorkspaceIDAndRef copyWorkspaceSSHError) [tools] > (workspace.showResources revealWorkspaceInFinder palette.openWorkspacePullRequests) | [close] > (palette.closeOtherWorkspaces workspace.closeOthersInGroup palette.closeWorkspacesBelow palette.closeWorkspacesAbove workspace.closeAll)) | closeWorkspace - **workspaceGroup**: workspaceGroup.newWorkspace workspaceGroup.duplicate | workspaceGroup.rename workspaceGroup.togglePin [appearance] > (workspaceGroup.setColor > (workspaceGroup.color.grey workspaceGroup.color.blue workspaceGroup.color.red workspaceGroup.color.yellow workspaceGroup.color.green workspaceGroup.color.pink workspaceGroup.color.purple workspaceGroup.color.cyan workspaceGroup.color.orange) workspaceGroup.setIcon workspaceGroup.clearIcon) [options] > (workspaceGroup.markRead workspaceGroup.markUnread workspaceGroup.clearNotifications) | toggleFocusedWorkspaceGroupCollapsed [group] > (workspaceGroup.collapseAll workspaceGroup.expandAll) | [move] > (workspaceGroup.moveUp workspaceGroup.moveDown workspaceGroup.moveToNewWindow workspaceGroup.moveToWindow workspaceGroup.moveToSpace workspaceGroup.addToSection) | workspaceGroup.editConfig workspaceGroup.copyID | [close] > (workspaceGroup.ungroup workspaceGroup.closeWorkspaces workspaceGroup.delete workspaceGroup.closeOthers) -- **sidebarBackground**: newTab newBrowserWorkspace openFolder newWorkspaceGroup [new] > (workspace.newAtTop workspace.newAtBottom workspace.newOnMachine space.new reopenClosedWorkspace reopenPreviousSession | newCloudWorkspace remote.connect | sidebar.home.add sidebar.item.add sidebar.section.add) | [options] > (sidebar.workspaceTabs.toggle palette.enableMinimalMode palette.disableMinimalMode sidebar.density.compact sidebar.density.expanded | sidebar.layout.reset) | [group] > (workspaceGroup.collapseAll workspaceGroup.expandAll sidebar.groupBy.none sidebar.groupBy.folder) | [move] > (workspace.sortByName workspace.sortByLastUsed workspace.sortByDirectory) | sidebar.projects.hide sidebar.sections.showHidden | toggleSidebar appStore.show +- **sidebarBackground**: newTab newBrowserWorkspace openFolder newWorkspaceGroup [new] > (workspace.newAtTop workspace.newAtBottom workspace.newOnMachine space.new reopenClosedWorkspace reopenPreviousSession | newCloudWorkspace remote.connect | sidebar.home.add sidebar.item.add sidebar.section.add) | [options] > (sidebar.workspaceTabs.toggle palette.enableMinimalMode palette.disableMinimalMode sidebar.density.compact sidebar.density.comfortable sidebar.density.expanded | sidebar.layout.reset) | [group] > (workspaceGroup.collapseAll workspaceGroup.expandAll sidebar.groupBy.none sidebar.groupBy.folder) | [move] > (workspace.sortByName workspace.sortByLastUsed workspace.sortByDirectory) | sidebar.projects.hide sidebar.sections.showHidden | toggleSidebar appStore.show - **terminalSelection**: terminalCopy terminalPaste terminal.selectAll useSelectionForFind terminal.sendText | [split] > (splitRight splitDown splitLeft splitUp) [agent] > (palette.forkAgentConversationRight palette.forkAgentConversationNewTab palette.forkAgentConversationLeft palette.forkAgentConversationTop palette.forkAgentConversationBottom palette.forkAgentConversationNewWorkspace) | [options] > (clearScreenKeepScrollback resetTerminal terminal.clear) | toggleSplitZoom | palette.terminalOpenDirectory - **browserPage**: browserBack browserForward browserReload browserHardReload browser.copyURL browser.openLocally | browserTheme[choices] [options] > (toggleBrowserFocusMode toggleBrowserDesignMode) | browserPrint | bookmark.addPage | toggleBrowserDeveloperTools [tools] > (palette.browserOpenDefault browserScreenshotPage browserScreenshotSection browserDevice | browser.pageInfo > (browser.pageInfo browser.pageInfo.connection browser.pageInfo.certificate browser.pageInfo.reenableCertificateWarnings | browser.pageInfo.setPermission browser.pageInfo.resetPermissions | browser.pageInfo.cookies browser.pageInfo.manageSiteData browser.pageInfo.deleteSiteData | browser.pageInfo.siteSettings browser.pageInfo.aboutThisPage) showBrowserJavaScriptConsole inspectBrowserElement | browser.extensions.menu browser.extensions.manage browser.extensions.webStore browser.extensions.loadUnpacked) - **browserLink**: browser.link.openInNewTab browser.link.openInNewWindow browser.link.openInNewSpace browser.link.openInNewWorkspace browser.link.openInSplit openLinkInDefaultBrowser | browser.link.openInIncognitoWindow | browser.link.saveAs browser.link.copy browser.link.copyText @@ -112,7 +112,7 @@ Palette 921, CLI verbs 518, right-click 496, MCP tools 449. **liveInput** (96): `taskManager.killProcess`, `toggleChecklistItemComplete`, `groupSelectedWorkspaces`, `canvasAlignLeft`, `canvasAlignRight`, `canvasAlignTop`, `canvasAlignBottom`, `canvasEqualizeWidths`, `canvasEqualizeHeights`, `canvasDistributeHorizontally`, `canvasDistributeVertically`, `simulatorHome`, `simulatorRotateLeft`, `simulatorRotateRight`, `simulatorToggleAppearance`, `simulatorToggleSoftwareKeyboard`, `toggleTerminalCopyMode`, `palette.terminalToggleTextBoxInput`, `cycleTextBoxSubmitAction`, `attachTextBoxFile`, `sendCtrlFToTerminal`, `pasteLastScreenshot`, `find`, `findInDirectory`, `findNext`, `findPrevious`, `hideFind`, `useSelectionForFind`, `terminalCopy`, `terminalPaste`, `browserScreenshotSection`, `saveFilePreview`, `toggleFileEditorWordWrap`, `diffViewerNextLine`, `diffViewerPreviousLine`, `diffViewerHalfPageDown`, `diffViewerHalfPageUp`, `diffViewerNextHunk`, `diffViewerPreviousHunk`, `diffViewerGoToBottom`, `diffViewerGoToTop`, `diffViewerSearch`, `diffViewerNextFile`, `diffViewerPreviousFile`, `omnibar.openInBackgroundTab`, `omnibar.openInForegroundTab`, `browser.prompt.allow`, `browser.prompt.block`, `fileEditorGotoLine`, `fileEditorReplace`, `fileEditorAction`, `fileExplorerOpenSelection`, `fileExplorerOpenSelectionFinderAlias`, `fileExplorerOpenInCmux`, `fileExplorerReveal`, `fileExplorerCopyPath`, `fileExplorerCopyRelativePath`, `fileExplorerOpenWith`, `vaultOpenSession`, `vaultResumeInNewWorkspace`, `vaultCopyResumeCommand`, `vaultOpenPullRequest`, `checklistEditItem`, `checklistMarkInProgress`, `checklistCompleteItem`, `checklistRemoveItem`, `checklistOpenAsPane`, `checklistAttachImages`, `toggleUnread`, `notificationCopy`, `notificationToggleRead`, `notificationDismiss`, `palette.toggleDictation`, `terminal.selectAll`, `terminal.scrollToSelection`, `markdownSave`, `markdownLink`, `markdownBack`, `markdownForward`, `list.next`, `list.previous`, `paletteKey.firstItem`, `paletteKey.lastItem`, `paletteKey.pageUp`, `paletteKey.pageDown`, `paletteKey.submit`, `paletteKey.submitAlternate`, `paletteKey.openActions`, `paletteKey.closeActions`, `paletteKey.toggleActions`, `paletteKey.escape`, `paletteKey.enterRow`, `paletteKey.leaveLevel`, `paletteKey.back`, `paletteKey.filterDeleteBackward`, `paletteKey.closeItem` -**guiOnly** (145): `openSettings`, `zoomWindow`, `selectNextWindow`, `selectPreviousWindow`, `minimizeWindow`, `toggleFullScreen`, `globalSearch`, `commandPalette`, `palette.openTaskManager`, `palette.sleepyMode`, `about`, `revealWorkspaceInFinder`, `workspaceGroup.editConfig`, `manageLayouts`, `palette.openWorkspacePullRequests`, `palette.findWork`, `toggleSplitZoom`, `canvasOverview`, `hints.show`, `palette.toggleFullWidthTab`, `tab.showResources`, `workspace.showResources`, `home.newMessage`, `toggleBrowserDeveloperTools`, `showBrowserJavaScriptConsole`, `inspectBrowserElement`, `toggleBrowserFocusMode`, `toggleBrowserDesignMode`, `toggleReactGrab`, `browserLinkHints`, `browserLinkHintsNewSplit`, `palette.browserToggleOmnibar`, `importFromBrowser`, `password.importCSV`, `passwords.open`, `openLinkInDefaultBrowser`, `browserPrint`, `filePreviewOpenWith`, `filePreviewOpenExternally`, `filePreviewRevealInFinder`, `palette.vscodeServeWebStop`, `palette.vscodeServeWebRestart`, `browser.allowAgentWithExtensions`, `browser.importFromFiles`, `browser.media.show`, `browser.downloads.show`, `browser.profile.choose`, `browser.overflow.menu`, `browser.openLocally`, `browser.openOnMachine`, `browser.download.openBlockedSiteSettings`, `browser.link.saveAs`, `browser.image.saveAs`, `browser.selection.lookUp`, `browser.pageInfo`, `browser.pageInfo.connection`, `browser.pageInfo.certificate`, `browser.pageInfo.cookies`, `browser.pageInfo.manageSiteData`, `browser.pageInfo.siteSettings`, `browser.pageInfo.aboutThisPage`, `browser.certificateWarning.proceed`, `browser.certificateWarning.goBack`, `browser.extensions.menu`, `browser.extensions.manage`, `browser.extensions.webStore`, `browser.extension.options`, `browserProfile.delete`, `browserProfile.manageExtensions`, `sidebar.profileMenu`, `browser.downloads.showFolder`, `toggleSidebar`, `toggleRightSidebar`, `switchRightSidebarToFiles`, `switchRightSidebarToFind`, `switchRightSidebarToSessions`, `switchRightSidebarToFeed`, `switchRightSidebarToDock`, `switchRightSidebarToMachines`, `feed.show`, `showNotifications`, `notifications.dismissHighlight`, `palette.addHarness`, `agentPane.continueIn`, `agentPane.switchModel`, `agentPane.createCheckpoint`, `agentPane.searchFiles`, `agentPane.copyLastCodeBlock`, `agentPane.searchChats`, `agentPane.permission.allowOnce`, `agentPane.permission.allowChat`, `agentPane.permission.deny`, `agentPane.permission.expand`, `agentPane.permission.retry`, `agentPane.permission.revoke`, `agentPane.permission.refresh`, `palette.openTerminalChatView`, `palette.computerUse.setup`, `palette.computerUse.accessibility`, `palette.computerUse.screenRecording`, `home.toggleChiefSettings`, `home.stopChief`, `agentPane.previousTurn`, `agentPane.nextTurn`, `agentPane.previousBookmarkedPrompt`, `agentPane.nextBookmarkedPrompt`, `agent.harness.addFromRegistry`, `agent.harness.updateAll`, `palette.cloud.tools`, `cloudOpenMachine`, `openTeamPicker`, `palette.mobileConnect`, `palette.openCmuxSettingsFile`, `palette.openGhosttySettings`, `ghostty.showDiagnostics`, `palette.searchShortcuts`, `palette.pro.upgrade`, `sendFeedback`, `help.featureFlags`, `help.documentation`, `appearance.customize`, `recentlyFocused`, `recentlyClosed`, `history.commands`, `agentHistory.show`, `browserShowHistory`, `history.search`, `bookmark.toggleBar`, `bookmark.manager`, `sidebar.section.hide`, `sidebar.projects.hide`, `sidebar.sections.showHidden`, `sidebar.spaces.hide`, `sidebar.spaces.show`, `sidebar.profileControl.hide`, `sidebar.profileControl.show`, `sidebar.groupBy.none`, `sidebar.groupBy.folder`, `sidebar.density.compact`, `sidebar.density.expanded`, `sidebar.workspaceTabs.toggle`, `appStore.showInstalled`, `tasks.new`, `app.shareCmux`, `server.showPanel` +**guiOnly** (146): `openSettings`, `zoomWindow`, `selectNextWindow`, `selectPreviousWindow`, `minimizeWindow`, `toggleFullScreen`, `globalSearch`, `commandPalette`, `palette.openTaskManager`, `palette.sleepyMode`, `about`, `revealWorkspaceInFinder`, `workspaceGroup.editConfig`, `manageLayouts`, `palette.openWorkspacePullRequests`, `palette.findWork`, `toggleSplitZoom`, `canvasOverview`, `hints.show`, `palette.toggleFullWidthTab`, `tab.showResources`, `workspace.showResources`, `home.newMessage`, `toggleBrowserDeveloperTools`, `showBrowserJavaScriptConsole`, `inspectBrowserElement`, `toggleBrowserFocusMode`, `toggleBrowserDesignMode`, `toggleReactGrab`, `browserLinkHints`, `browserLinkHintsNewSplit`, `palette.browserToggleOmnibar`, `importFromBrowser`, `password.importCSV`, `passwords.open`, `openLinkInDefaultBrowser`, `browserPrint`, `filePreviewOpenWith`, `filePreviewOpenExternally`, `filePreviewRevealInFinder`, `palette.vscodeServeWebStop`, `palette.vscodeServeWebRestart`, `browser.allowAgentWithExtensions`, `browser.importFromFiles`, `browser.media.show`, `browser.downloads.show`, `browser.profile.choose`, `browser.overflow.menu`, `browser.openLocally`, `browser.openOnMachine`, `browser.download.openBlockedSiteSettings`, `browser.link.saveAs`, `browser.image.saveAs`, `browser.selection.lookUp`, `browser.pageInfo`, `browser.pageInfo.connection`, `browser.pageInfo.certificate`, `browser.pageInfo.cookies`, `browser.pageInfo.manageSiteData`, `browser.pageInfo.siteSettings`, `browser.pageInfo.aboutThisPage`, `browser.certificateWarning.proceed`, `browser.certificateWarning.goBack`, `browser.extensions.menu`, `browser.extensions.manage`, `browser.extensions.webStore`, `browser.extension.options`, `browserProfile.delete`, `browserProfile.manageExtensions`, `sidebar.profileMenu`, `browser.downloads.showFolder`, `toggleSidebar`, `toggleRightSidebar`, `switchRightSidebarToFiles`, `switchRightSidebarToFind`, `switchRightSidebarToSessions`, `switchRightSidebarToFeed`, `switchRightSidebarToDock`, `switchRightSidebarToMachines`, `feed.show`, `showNotifications`, `notifications.dismissHighlight`, `palette.addHarness`, `agentPane.continueIn`, `agentPane.switchModel`, `agentPane.createCheckpoint`, `agentPane.searchFiles`, `agentPane.copyLastCodeBlock`, `agentPane.searchChats`, `agentPane.permission.allowOnce`, `agentPane.permission.allowChat`, `agentPane.permission.deny`, `agentPane.permission.expand`, `agentPane.permission.retry`, `agentPane.permission.revoke`, `agentPane.permission.refresh`, `palette.openTerminalChatView`, `palette.computerUse.setup`, `palette.computerUse.accessibility`, `palette.computerUse.screenRecording`, `home.toggleChiefSettings`, `home.stopChief`, `agentPane.previousTurn`, `agentPane.nextTurn`, `agentPane.previousBookmarkedPrompt`, `agentPane.nextBookmarkedPrompt`, `agent.harness.addFromRegistry`, `agent.harness.updateAll`, `palette.cloud.tools`, `cloudOpenMachine`, `openTeamPicker`, `palette.mobileConnect`, `palette.openCmuxSettingsFile`, `palette.openGhosttySettings`, `ghostty.showDiagnostics`, `palette.searchShortcuts`, `palette.pro.upgrade`, `sendFeedback`, `help.featureFlags`, `help.documentation`, `appearance.customize`, `recentlyFocused`, `recentlyClosed`, `history.commands`, `agentHistory.show`, `browserShowHistory`, `history.search`, `bookmark.toggleBar`, `bookmark.manager`, `sidebar.section.hide`, `sidebar.projects.hide`, `sidebar.sections.showHidden`, `sidebar.spaces.hide`, `sidebar.spaces.show`, `sidebar.profileControl.hide`, `sidebar.profileControl.show`, `sidebar.groupBy.none`, `sidebar.groupBy.folder`, `sidebar.density.compact`, `sidebar.density.comfortable`, `sidebar.density.expanded`, `sidebar.workspaceTabs.toggle`, `appStore.showInstalled`, `tasks.new`, `app.shareCmux`, `server.showPanel` **clipboard** (22): `copyWorkspaceSSHError`, `palette.copyWorkspaceID`, `palette.copyWorkspaceIDAndRef`, `palette.copyWorkspaceLink`, `workspace.copyPath`, `workspaceGroup.copyID`, `palette.copyIdentifiers`, `palette.copyPaneID`, `palette.copyPaneLink`, `palette.copySurfaceID`, `palette.copySurfaceLink`, `browser.copyURL`, `browser.link.copy`, `browser.link.copyText`, `browser.image.copy`, `browser.image.copyAddress`, `browser.selection.copy`, `cloudCopyLink`, `cloudCopyPort`, `cloudCopyMachineID`, `remote.copyError`, `bookmark.copyLink` From 9d25b9467ac6349ddf58996501f6846834de0943 Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 14 Oct 2026 13:18:10 -0700 Subject: [PATCH 14/27] test: the minimap's card follows the app hover intent (red) Base's hover-intent and elevation tests now drive the rewritten rail (.acpmux-minimap__card, the rows' pointerenter/pointerleave), and the rail test pins the app hover intent (450 ms delay, warm 500 ms, gone as the pointer leaves unless it enters the card) instead of CardTiming's 250/300/100 ms. heavy --mem 3G bun test test/hover-intent-cards.test.tsx test/subtle-elevation.test.ts test/thread-minimap-rail.test.tsx (fail) the card follows the app's hover intent: it waits the hover delay, follows the pointer at once while warm, and goes as the pointer leaves thread-minimap-rail.test.tsx:210 expect(card()).toBeNull() after 400 ms: the card opened at 250 ms (fail) the minimap's turn preview waits the hover delay, then follows the pointer at once until the rail cools hover-intent-cards.test.tsx:117 expect(visible()).toBe(false) right after leaving: CardTiming keeps it 100 ms (fail) one subtle elevation scale > .lg-sheet casts --elevation-2 (base red, ledger.css untouched) The .acpmux-minimap__card casts --elevation-2 case passes (the merge already moved the card to it). Co-Authored-By: Claude Opus 5.5 --- webviews/test/hover-intent-cards.test.tsx | 21 ++++++++++++---- webviews/test/subtle-elevation.test.ts | 2 +- webviews/test/thread-minimap-rail.test.tsx | 28 ++++++++++++---------- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/webviews/test/hover-intent-cards.test.tsx b/webviews/test/hover-intent-cards.test.tsx index a9d2618fa788..55c735ee927e 100644 --- a/webviews/test/hover-intent-cards.test.tsx +++ b/webviews/test/hover-intent-cards.test.tsx @@ -80,17 +80,28 @@ test("the minimap's turn preview waits the hover delay, then follows the pointer ); const rail = dom.window.document.querySelector(".acpmux-minimap__rail")!; expect(rail).not.toBeNull(); - const pitch = Number.parseFloat(rail.style.height) / TURNS; - const popover = () => dom.window.document.querySelector(".acpmux-minimap__popover"); + const tick = (index: number) => + dom.window.document.querySelectorAll(".acpmux-minimap__tick")[index]!; + const popover = () => dom.window.document.querySelector(".acpmux-minimap__card"); const visible = () => popover() !== null && !popover()!.hidden; + // The rail's rows take the pointer (their pointerenter and pointerleave, which React draws + // from pointerover and pointerout): onto the rail from outside, then from row to row. + let under: number | undefined; + const pointer = (type: string, target: Element, relatedTarget: Element | null) => + target.dispatchEvent(new dom.window.MouseEvent(type, { bubbles: true, relatedTarget })); const move = (index: number) => act(async () => { - rail.dispatchEvent(new dom.window.MouseEvent("pointermove", { bubbles: true, clientY: pitch * index + 1 })); + if (under === undefined) pointer("pointerover", tick(index), dom.window.document.body); + else if (under !== index) { + pointer("pointerout", tick(under), tick(index)); + pointer("pointerover", tick(index), tick(under)); + } + under = index; }); const leave = () => act(async () => { - rail.dispatchEvent(new dom.window.MouseEvent("pointerout", { bubbles: true, relatedTarget: null })); - rail.dispatchEvent(new dom.window.MouseEvent("pointerleave", { bubbles: false, relatedTarget: null })); + if (under !== undefined) pointer("pointerout", tick(under), null); + under = undefined; }); await move(2); diff --git a/webviews/test/subtle-elevation.test.ts b/webviews/test/subtle-elevation.test.ts index d17f98360a52..9b797779b5d3 100644 --- a/webviews/test/subtle-elevation.test.ts +++ b/webviews/test/subtle-elevation.test.ts @@ -233,7 +233,7 @@ describe("one subtle elevation scale", () => { ["agent-session/acpmux/styles.css", ".acpmux-shell[data-sidebar=open] .acpmux-sidebar", "--elevation-2"], ["agent-session/acpmux/conversation/conversation.css", ".acpmux-find__bar", "--elevation-2"], ["agent-session/acpmux/conversation/conversation.css", ".acpmux-jump-latest", "--elevation-2"], - ["agent-session/acpmux/threadMinimap/threadMinimap.css", ".acpmux-minimap__popover", "--elevation-2"], + ["agent-session/acpmux/threadMinimap/threadMinimap.css", ".acpmux-minimap__card", "--elevation-2"], ["agent-session/acpmux/summary/summary.css", ".acpmux-summary-card", "--elevation-2"], ["agent-session/acpmux/addProject.css", ".acpmux-add-project-dialog", "--elevation-2"], ["agent-session/acpmux/composerAttachments.css", ".acpmux-pdf-viewer", "--elevation-2"], diff --git a/webviews/test/thread-minimap-rail.test.tsx b/webviews/test/thread-minimap-rail.test.tsx index 7557b6adae10..3fd84314deef 100644 --- a/webviews/test/thread-minimap-rail.test.tsx +++ b/webviews/test/thread-minimap-rail.test.tsx @@ -201,12 +201,12 @@ test("rows are 10 px tab stops; every prompt on screen is current; hover magnifi } }); -test("the card opens 250 ms after the pointer reaches the rail, at once within 300 ms of closing, and closes 100 ms after it leaves", async () => { +test("the card follows the app's hover intent: it waits the hover delay, follows the pointer at once while warm, and goes as the pointer leaves", async () => { const view = await mount(8); jest.useFakeTimers(); try { await enter(3); - await advance(200); + await advance(400); expect(card()).toBeNull(); await advance(60); expect(card()).not.toBeNull(); @@ -215,22 +215,24 @@ test("the card opens 250 ms after the pointer reaches the rail, at once within 3 await enter(4); expect(card()!.textContent).toContain("Question 4"); expect(tick(4).getAttribute("aria-describedby")).toBe(card()!.id); - // Leaving: the card stays for 100 ms, then goes. + // Leaving the rail (not for the card): the card goes at once. await leave(4); - await advance(90); - expect(card()).not.toBeNull(); - await advance(20); expect(card()).toBeNull(); - // Back within 300 ms of closing: at once. - await advance(150); + // Back while the rail is warm: at once. + await advance(300); await enter(2); expect(card()!.textContent).toContain("Question 2"); - await leave(2); - await advance(110 + 400); - // Long after: the 250 ms wait again. + // Into the card: it stays. + await pointer("pointerout", tick(2), { relatedTarget: card() }); + await advance(1_000); + expect(card()!.textContent).toContain("Question 2"); + await pointer("pointerout", card()!, { relatedTarget: document.body }); + expect(card()).toBeNull(); + await advance(600); + // Cooled: the hover delay again. await enter(6); expect(card()).toBeNull(); - await advance(260); + await advance(460); expect(card()).not.toBeNull(); } finally { await view.unmount(); @@ -264,7 +266,7 @@ test("a clicked row takes focus, as a clicked button does in Codex, so Tab goes jest.useFakeTimers(); try { await enter(4); - await advance(300); + await advance(500); expect(card()?.textContent).toContain("Question 4"); // WebKit does not focus a clicked button; the rail does, so Tab moves to the next row. await act(async () => tick(4).click()); From 6cf54078a68434be11538c54cb74436e83639df6 Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 14 Oct 2026 13:20:26 -0700 Subject: [PATCH 15/27] fix: the minimap's card follows the app hover intent The preview card now runs on ui/hoverIntent's useHoverIntent, as base's minimap did: the first waits the hover delay, the card then follows the pointer from row to row at once while the rail is warm, and it goes as the pointer leaves the rail (moving into the card, or back, keeps it). Keyboard focus still shows it at once; Escape dismisses it and focus-out closes it on that frame. cardTiming.ts and the CARD_* constants are gone. thread-bookmarks.test.tsx goes back to the PR's version: the merge took base's half, which drives the old rail's pointermove on two prompts. heavy --mem 3G bun test test/hover-intent-cards.test.tsx test/subtle-elevation.test.ts test/thread-minimap-rail.test.tsx 46 pass, 1 fail (.lg-sheet casts --elevation-2: base red, ledger.css untouched) heavy --mem 3G bun test test/thread-minimap-current.test.tsx test/thread-bookmarks.test.tsx test/thread-turn-keys.test.tsx test/hover-intent-parity.test.ts test/hover-row-sweep.test.ts test/thread-minimap-motion.test.ts 7 pass, 0 fail (browser lanes skipped locally) heavy --mem 4G bun run check: pass Co-Authored-By: Claude Opus 5.5 --- .../acpmux/threadMinimap/ThreadMinimap.tsx | 41 ++++++++---- .../acpmux/threadMinimap/cardTiming.ts | 67 ------------------- .../acpmux/threadMinimap/model.ts | 5 -- webviews/test/hover-intent-cards.test.tsx | 3 +- webviews/test/thread-bookmarks.test.tsx | 27 +++----- 5 files changed, 38 insertions(+), 105 deletions(-) delete mode 100644 webviews/src/agent-session/acpmux/threadMinimap/cardTiming.ts diff --git a/webviews/src/agent-session/acpmux/threadMinimap/ThreadMinimap.tsx b/webviews/src/agent-session/acpmux/threadMinimap/ThreadMinimap.tsx index a92dff194738..a97dd20feedf 100644 --- a/webviews/src/agent-session/acpmux/threadMinimap/ThreadMinimap.tsx +++ b/webviews/src/agent-session/acpmux/threadMinimap/ThreadMinimap.tsx @@ -1,6 +1,6 @@ // The thread minimap, as the Codex desktop app's prompt rail: one 10 px row per user prompt, 16 px in // from the transcript's left edge and centered on it. Hovering magnifies the rows near the pointer -// like the Dock and, after CARD_OPEN_DELAY_MS, opens a preview card (the prompt, its bookmark and +// like the Dock and, after the app's hover delay (ui/hoverIntent.ts), opens a preview card (the prompt, its bookmark and // the start of the reply) beside the hovered row. A click scrolls the transcript so the prompt // lands near the top and flashes its bubble; dragging scrubs; Tab walks the rows. Bookmarks show // as a dot past the tick, and clicking the dot's spot toggles one. Geometry comes from the @@ -12,7 +12,7 @@ import { transcriptColumn, type AcpmuxRow, type ConversationLayout } from "../mo import { useT } from "../i18n"; import { MinimapTick } from "../../../ui/MinimapTick"; import { usePromptMarks } from "./promptMarks"; -import { CardTiming } from "./cardTiming"; +import { useHoverIntent } from "../../../ui/hoverIntent"; import { animateScroll, highlightBubble, reducedMotion, stopScroll } from "./scrollMotion"; import { BookmarkIcon } from "./BookmarkIcon"; import { @@ -52,6 +52,10 @@ function mountedRow(scroller: HTMLElement, id: string): HTMLElement | undefined return undefined; } +/// Whether the pointer went to `to` inside `element` (a leave's `relatedTarget` may be no node: the window, or null). +const within = (element: Element | null, to: EventTarget | null) => + !!element && !!to && "nodeType" in to && element.contains(to as Node); + const bubbleOf = (row: HTMLElement | undefined) => row?.querySelector(".cv-user__bubble"); export function ThreadMinimap({ @@ -85,12 +89,18 @@ export function ThreadMinimap({ const [focused, setFocused] = useState(undefined); /// The row the card shows (it stays while the pointer is in the card). const [cardRow, setCardRow] = useState(undefined); - const [cardOpen, setCardOpen] = useState(false); - const [timing] = useState(() => new CardTiming(setCardOpen)); + // The card's hover intent (ui/hoverIntent.ts), as every hover card's: the first waits the hover + // delay, then the card follows the pointer from row to row at once, and the rail cools a moment + // after it goes. Keyboard focus shows it at once. + const preview = useHoverIntent<"rail">(); + const cardOpen = preview.shown !== null; + const intend = preview.hover; + const dismiss = preview.dismiss; const [scrubbing, setScrubbing] = useState(false); const [reduce, setReduce] = useState(false); const [listTop, setListTop] = useState(0); const [cardHeight, setCardHeight] = useState(0); + const rail = useRef(null); const list = useRef(null); const card = useRef(null); const cardId = useId(); @@ -109,7 +119,6 @@ export function ThreadMinimap({ useLayoutEffect(() => { live.current = { turns, tops: layout.tops, total: layout.totalHeight, marks }; }); - useEffect(() => () => timing.cancel(), [timing]); /// Scrolls the transcript to turn `index`: smoothly on the measured curve when its row is mounted, /// at once when it is not (or under Reduce Motion, or while scrubbing). A click or a bookmark jump @@ -216,20 +225,20 @@ export function ThreadMinimap({ setReduce(reducedMotion()); setHovered(index); setCardRow(index); - timing.enter(); + intend("rail"); }, focus(index) { if (pressing.current) return; setReduce(reducedMotion()); setFocused(index); setCardRow(index); - timing.now(); + intend("rail", 0); }, blur(index) { setFocused((current) => (current === index ? undefined : current)); }, escape() { - timing.close(); + dismiss(); }, click(index, target) { if (swallowClick.current) { @@ -256,7 +265,7 @@ export function ThreadMinimap({ jump(index, "click"); }, }), - [timing, jump], + [intend, dismiss, jump], ); if (!shown) return null; @@ -288,21 +297,23 @@ export function ThreadMinimap({ return (