The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.
TypeScript code-editorcross-platformdapdatabase-clientdebuggerdesktop-appdeveloper-toolsgithttp-clientideintellijlsprusttauriterminal
fix(agents): Show the title the agent gives the session
l0ng-ai44b021392ac6
diff --git a/crates/ide-agent/src/lib.rs b/crates/ide-agent/src/lib.rsindex f58cd5da8..437dac00a 100644--- a/crates/ide-agent/src/lib.rs+++ b/crates/ide-agent/src/lib.rs@@ -882,6 +882,16 @@ impl Task {fn on_update(self: &Arc<Self>, update: &Value) {let kind = update.get("sessionUpdate").and_then(Value::as_str).unwrap_or_default();+ if kind == "session_info_update" {+ // The agent's own title for the session replaces the first line of the prompt.+ let title = update.get("title").and_then(Value::as_str).map(str::trim).filter(|t| !t.is_empty());+ if let Some(title) = title {+ self.state.lock().task.title = title.to_owned();+ self.persist();+ self.emit_task();+ }+ return;+ }// Session state (also while `session/load` replays history).let provider = self.state.lock().task.provider.clone();let task_changed = {diff --git a/crates/ide-agent/src/tests.rs b/crates/ide-agent/src/tests.rsindex 5075cb283..457fa2e46 100644--- a/crates/ide-agent/src/tests.rs+++ b/crates/ide-agent/src/tests.rs@@ -66,6 +66,7 @@ impl Handler for FakeAgent {"availableCommands": [{"name": "review", "description": "Review", "input": {"hint": "focus"}}]}),);self.update(&session, json!({"sessionUpdate": "usage_update", "used": 50, "size": 1000}));+ self.update(&session, json!({"sessionUpdate": "session_info_update", "title": "Lexer fix"}));self.say(&session, "Hi");self.update(&session,@@ -226,6 +227,7 @@ async fn a_task_runs_asks_for_permission_and_survives_a_restart() {assert_eq!((modes.via, modes.current.as_deref()), (AgentConfigVia::Mode, Some("ask")));assert_eq!(t.commands.iter().map(|c| c.name.as_str()).collect::<Vec<_>>(), ["review"]);assert_eq!(t.usage.as_ref().map(|u| (u.used, u.size)), Some((50, 1000)));+ assert_eq!(t.title, "Lexer fix", "the agent's title replaces the prompt's first line");}mgr.set_config(&task.id, "mode", "code".into()).await.unwrap();assert!(agent.calls.lock().contains(&"session/set_mode \"code\"".to_owned()));@@ -260,6 +262,7 @@ async fn a_task_runs_asks_for_permission_and_survives_a_restart() {let agent2 = Arc::new(FakeAgent::default());let mgr2 = manager(tmp.path(), agent2.clone());assert_eq!(mgr2.entries(&task.id).unwrap().len(), 5);+ assert_eq!(mgr2.task(&task.id).unwrap().state.lock().task.title, "Lexer fix");assert_eq!(mgr2.providers().iter().find(|p| p.id == "claude").unwrap().config.len(), 2);mgr2.prompt(&task.id, text("again"), false).await.unwrap();tokio::time::sleep(Duration::from_millis(50)).await;