Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
Island names a search or helper step's kind, never its words (19a) (#674)
Oleksandr Ivanchenkoc269fa9bb4f6
diff --git a/src/drivers/activity.rs b/src/drivers/activity.rsindex 1c8bf4a5..05fa5baa 100644--- a/src/drivers/activity.rs+++ b/src/drivers/activity.rs@@ -732,13 +732,57 @@ fn command_line(args: &Value) -> Option<String> {/// shell tools: [`summarize`] titles them "Running `…`", and the desktop island names only their/// program (server/activity.rs).pub fn is_shell_tool(name: &str) -> bool {- let tool = name.strip_prefix("mcp__").and_then(|r| r.split_once("__")).map_or(name, |(_, t)| t);matches!(- tool.to_ascii_lowercase().as_str(),+ tool_part(name).to_ascii_lowercase().as_str(),"bash" | "shell" | "exec" | "exec_command" | "command_execution" | "run_terminal_cmd" | "run_shell_command" | "local_shell")}+/// The tools whose argument is the bot's own words (a search pattern, a web query, a helper's+/// brief), by kind. The one list of them: [`summarize`] titles them with the words ("Searching the+/// web for “…”"), and the desktop island shows only the kind ([`island_kind_title`]).+#[derive(Clone, Copy, Debug, PartialEq, Eq)]+enum WordsTool {+ Files,+ Web,+ Helper,+}++impl WordsTool {+ /// `tool` is the name without its `mcp__server__` prefix, lowercased.+ fn of(tool: &str) -> Option<Self> {+ match tool {+ "glob" | "grep" | "search_files" | "list_dir" | "ls" | "find" => Some(Self::Files),+ "websearch" | "web_search" | "search" => Some(Self::Web),+ "task" | "agent" => Some(Self::Helper),+ _ => None,+ }+ }++ /// The title without the words: what the island shows, and the chat's title when the+ /// argument is missing.+ fn bare(self) -> &'static str {+ match self {+ Self::Files => "Searching files",+ Self::Web => "Searching the web",+ Self::Helper => "Starting a helper",+ }+ }+}++/// The desktop island's title for a search or helper tool (`Grep`, `WebSearch`, `Task`,+/// `mcp__x__grep`), ignoring an `mcp__server__` prefix and case: "Searching files", "Searching the+/// web" or "Starting a helper", never the query or brief (19a). `None` for every other tool.+pub fn island_kind_title(name: &str) -> Option<&'static str> {+ WordsTool::of(&tool_part(name).to_ascii_lowercase()).map(WordsTool::bare)+}++/// A tool's name without its `mcp__server__` prefix (`mcp__x__grep` gives `grep`), as+/// [`summarize`] reads it; `name` itself when it has none.+fn tool_part(name: &str) -> &str {+ name.strip_prefix("mcp__").and_then(|r| r.split_once("__")).map_or(name, |(_, t)| t)+}+/// A short title for a tool call, and the detail to show when the step is opened (the whole/// command, address or query). Neither is redacted here.pub fn summarize(name: &str, args: &Value) -> (String, Option<String>) {@@ -757,35 +801,29 @@ pub fn summarize(name: &str, args: &Value) -> (String, Option<String>) {let lower = tool.to_ascii_lowercase();let path = || arg(args, &["file_path", "path", "filePath", "notebook_path", "target_file"]).map(short_path);let url = arg(args, &["url", "href", "uri"]);+ if let Some(kind) = WordsTool::of(&lower) {+ let title = match kind {+ WordsTool::Files => arg(args, &["pattern", "query", "glob", "path"]).map(|p| format!("Searching files for `{}`", cut(p, 60))),+ WordsTool::Web => arg(args, &["query", "q"]).map(|q| format!("Searching the web for “{}”", cut(q, 80))),+ WordsTool::Helper => arg(args, &["description", "subagent_type"]).map(|d| format!("Starting a helper: {}", cut(d, 80))),+ };+ return (title.unwrap_or_else(|| kind.bare().to_string()), None);+ }match lower.as_str() {"read" | "read_file" | "view" | "cat" => (path().map_or("Reading a file".into(), |p| format!("Reading {p}")), None),"edit" | "multiedit" | "edit_file" | "str_replace" | "str_replace_based_edit_tool" | "apply_patch" | "file_change"| "notebookedit" => (path().map_or("Editing files".into(), |p| format!("Editing {p}")), None),"write" | "write_file" | "create_file" => (path().map_or("Writing a file".into(), |p| format!("Writing {p}")), None),- "glob" | "grep" | "search_files" | "list_dir" | "ls" | "find" => {- match arg(args, &["pattern", "query", "glob", "path"]) {- Some(p) => (format!("Searching files for `{}`", cut(p, 60)), None),- None => ("Searching files".into(), None),- }- }"webfetch" | "fetch" | "web_fetch" | "browser_open" | "browser_navigate" | "navigate" | "open_url" => match url {Some(u) => (format!("Opening {}", host_of(u)), Some(u.to_string())),None => ("Opening a page".into(), None),},- "websearch" | "web_search" | "search" => match arg(args, &["query", "q"]) {- Some(q) => (format!("Searching the web for “{}”", cut(q, 80)), None),- None => ("Searching the web".into(), None),- },"browser_page" | "browser_snapshot" | "browser_read" => ("Reading the browser page".into(), None),"browser_screenshot" => ("Looking at the browser page".into(), None),"browser_cite" => ("Checking a quote on the browser page".into(), None),"browser_act" | "browser_click" | "browser_type" => ("Using the browser".into(), None),"ask_user" => ("Asking you a question".into(), None),"request_human_step" => ("Asking you to do a step in the browser".into(), arg(args, &["reason"]).map(str::to_string)),- "task" | "agent" => match arg(args, &["description", "subagent_type"]) {- Some(d) => (format!("Starting a helper: {}", cut(d, 80)), None),- None => ("Starting a helper".into(), None),- },"todowrite" | "todo_list" | "update_plan" => ("Updating the plan".into(), None),_ => {let shown = match server {@@ -961,6 +999,13 @@ mod tests {("WebFetch", json!({"url": "https://www.github.com/x/y"}), "Opening github.com"),("mcp__kwnt__browser_open", json!({"url": "https://example.com/login"}), "Opening example.com"),("WebSearch", json!({"query": "rust sse"}), "Searching the web for “rust sse”"),+ ("WebSearch", json!({}), "Searching the web"),+ ("Grep", json!({"pattern": "TODO"}), "Searching files for `TODO`"),+ ("mcp__x__grep", json!({"pattern": "TODO"}), "Searching files for `TODO`"),+ ("Glob", json!({}), "Searching files"),+ ("Task", json!({"description": "Find the bug"}), "Starting a helper: Find the bug"),+ ("Agent", json!({"subagent_type": "Explore"}), "Starting a helper: Explore"),+ ("Task", json!({}), "Starting a helper"),("mcp__kwnt__ask_user", json!({}), "Asking you a question"),("mcp__linear__list_issues", json!({}), "Using list_issues (linear)"),("something_else", json!({}), "Using something_else"),@@ -975,6 +1020,33 @@ mod tests {assert!(s[0].detail.as_ref().unwrap().chars().count() <= MAX_DETAIL);}+ /// 19a: the island's bare title per search or helper kind, ignoring an mcp prefix and case;+ /// every other tool (shell included) has none.+ #[test]+ fn island_kind_titles_name_the_kind_only() {+ for (name, want) in [+ ("Grep", Some("Searching files")),+ ("Glob", Some("Searching files")),+ ("mcp__x__grep", Some("Searching files")),+ ("mcp__kwnt__SEARCH_FILES", Some("Searching files")),+ ("WebSearch", Some("Searching the web")),+ ("web_search", Some("Searching the web")),+ ("Task", Some("Starting a helper")),+ ("mcp__x__agent", Some("Starting a helper")),+ ("Bash", None),+ ("Read", None),+ ("WebFetch", None),+ ("mcp__linear__list_issues", None),+ ("mcp__grep", None),+ ] {+ assert_eq!(island_kind_title(name), want, "{name}");+ // The island's title is the chat's title without its words+ if let Some(bare) = want {+ assert_eq!(summarize(name, &Value::Null).0, bare, "{name}");+ }+ }+ }+#[test]fn home_folders_are_hidden() {assert_eq!(diff --git a/src/server/activity.rs b/src/server/activity.rsindex c771a45c..e24b4640 100644--- a/src/server/activity.rs+++ b/src/server/activity.rs@@ -190,12 +190,20 @@ fn step_now(steps: &[Step]) -> Option<(String, String)> {steps.iter().rev().find(|s| s.kind != "thinking").map(|s| (island_title(s), s.started_at.clone()))}-/// A step's title as the island shows it (17a). A shell step names only its program ("Running-/// git"), never the command: the island sits on the person's screen above every app, shared-/// screens and calls included, and redaction only catches known secret shapes. The chat's-/// activity list keeps the full command. Every other step keeps its title.+/// A step's title as the island shows it (17a, 19a). A shell step names only its program+/// ("Running git"), never the command, and a search or helper step only its kind ("Searching the+/// web"), never the query or brief: the island sits on the person's screen above every app, shared+/// screens and calls included, and redaction only catches known secret shapes. The chat's activity+/// list keeps the full titles. Every other step keeps its title.fn island_title(s: &Step) -> String {- if s.kind != "tool" || !s.tool.as_deref().is_some_and(crate::drivers::activity::is_shell_tool) {+ let tool = match s.tool.as_deref() {+ Some(tool) if s.kind == "tool" => tool,+ _ => return s.title.clone(),+ };+ if let Some(bare) = crate::drivers::activity::island_kind_title(tool) {+ return bare.to_string();+ }+ if !crate::drivers::activity::is_shell_tool(tool) {return s.title.clone();}match shell_program(&s.title) {@@ -312,6 +320,50 @@ mod tests {assert_eq!(current_step("turn-island-other").unwrap().0, "Waiting for your approval: Running a command");}+ /// 19a: the island names a search or helper step's kind, never its query or brief; the chat's+ /// activity list keeps them.+ #[test]+ fn current_step_names_a_search_or_helper_kind_never_its_words() {+ let words = "acme invoice 4471";+ let cases: Vec<(&str, Value, &str)> = vec![+ ("Grep", json!({"pattern": words}), "Searching files"),+ ("Glob", json!({"pattern": format!("**/{words}*")}), "Searching files"),+ ("mcp__x__grep", json!({"query": words}), "Searching files"),+ ("WebSearch", json!({"query": words}), "Searching the web"),+ ("mcp__kwnt__web_search", json!({"q": words}), "Searching the web"),+ ("Task", json!({"description": format!("Find {words} in the mail")}), "Starting a helper"),+ ("Agent", json!({"subagent_type": words}), "Starting a helper"),+ ("WebSearch", Value::Null, "Searching the web"),+ ];+ let (tx, _rx) = broadcast::channel(64);+ for (n, (tool, args, want)) in cases.into_iter().enumerate() {+ let id = format!("turn-island-words-{n}");+ let tag = TurnTag { turn_id: id.clone(), kwant_id: "k".into(), context_id: "c".into(), thread_id: None };+ let turn = TurnActivity::start(tx.clone(), tag);+ turn.observe(&RuntimeEvent::ToolCallPending { id: "1".into(), name: tool.into(), args: args.clone() });+ assert_eq!(current_step(&id).unwrap().0, want, "{tool} {args}");+ // The chat's activity list keeps the words, byte for byte+ let chat = turn.with_log(|log| log.steps()[0].clone());+ assert_eq!(chat.title, crate::drivers::activity::summarize(tool, &args).0);+ assert_eq!(chat.title.contains(words), !args.is_null(), "{}", chat.title);+ // Between steps, the finished step still names only its kind+ turn.observe(&RuntimeEvent::ToolCallCompleted { id: "1".into(), result: json!({"status": "ok"}) });+ let (title, _) = current_step(&id).unwrap();+ assert_eq!(title, want);+ assert!(!title.contains("acme") && !title.contains("4471"), "{title}");+ }++ // An approval for a search keeps its (already bare) title; a Reading step keeps its path+ let tag = TurnTag { turn_id: "turn-island-words-other".into(), kwant_id: "k".into(), context_id: "c".into(), thread_id: None };+ let turn = TurnActivity::start(tx, tag);+ approval_waiting("turn-island-words-other", "ap", "WebSearch");+ assert_eq!(current_step("turn-island-words-other").unwrap().0, "Waiting for your approval: Searching the web");+ approval_settled("turn-island-words-other", "ap", "ok");+ let read = json!({"file_path": "/tmp/acme.md"});+ turn.observe(&RuntimeEvent::ToolCallPending { id: "2".into(), name: "Read".into(), args: read.clone() });+ assert_eq!(current_step("turn-island-words-other").unwrap().0, crate::drivers::activity::summarize("Read", &read).0);+ }+#[test]fn turn_waits_reads_the_waiting_step_and_the_running_tool() {let (tx, _rx) = broadcast::channel(16);