(re)Standardize Session Name Attribute (#5279)

This commit is contained in:
Will Pfleger
2025-10-24 13:34:08 -04:00
committed by GitHub
parent b22abfc623
commit 044b227fdb
29 changed files with 1196 additions and 235 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ async fn get_session_id(identifier: Identifier) -> Result<String> {
sessions
.into_iter()
.find(|s| s.id == name || s.description.contains(&name))
.find(|s| s.name == name || s.id == name)
.map(|s| s.id)
.ok_or_else(|| anyhow::anyhow!("No session found with name '{}'", name))
} else if let Some(path) = identifier.path {
+1 -1
View File
@@ -222,7 +222,7 @@ pub async fn handle_schedule_sessions(id: String, limit: Option<usize>) -> Resul
" - Session ID: {}, Working Dir: {}, Description: \"{}\", Schedule ID: {:?}",
session_name, // Display the session_name as Session ID
metadata.working_dir.display(),
metadata.description,
metadata.name,
metadata.schedule_id.as_deref().unwrap_or("N/A")
);
}
+9 -12
View File
@@ -14,7 +14,7 @@ const TRUNCATED_DESC_LENGTH: usize = 60;
pub async fn remove_sessions(sessions: Vec<Session>) -> Result<()> {
println!("The following sessions will be removed:");
for session in &sessions {
println!("- {} {}", session.id, session.description);
println!("- {} {}", session.id, session.name);
}
let should_delete = confirm("Are you sure you want to delete these sessions?")
@@ -46,10 +46,10 @@ fn prompt_interactive_session_removal(sessions: &[Session]) -> Result<Vec<Sessio
let display_map: std::collections::HashMap<String, Session> = sessions
.iter()
.map(|s| {
let desc = if s.description.is_empty() {
"(no description)"
let desc = if s.name.is_empty() {
"(no name)"
} else {
&s.description
&s.name
};
let truncated_desc = safe_truncate(desc, TRUNCATED_DESC_LENGTH);
let display_text = format!("{} - {} ({})", s.updated_at, truncated_desc, s.id);
@@ -155,10 +155,7 @@ pub async fn handle_session_list(
println!("Available sessions:");
for session in sessions {
let output = format!(
"{} - {} - {}",
session.id, session.description, session.updated_at
);
let output = format!("{} - {} - {}", session.id, session.name, session.updated_at);
println!("{}", output);
}
}
@@ -189,7 +186,7 @@ pub async fn handle_session_export(
let conversation = session
.conversation
.ok_or_else(|| anyhow::anyhow!("Session has no messages"))?;
export_session_to_markdown(conversation.messages().to_vec(), &session.description)
export_session_to_markdown(conversation.messages().to_vec(), &session.name)
}
_ => return Err(anyhow::anyhow!("Unsupported format: {}", format)),
};
@@ -323,10 +320,10 @@ pub async fn prompt_interactive_session_selection() -> Result<String> {
let display_map: std::collections::HashMap<String, Session> = sessions
.iter()
.map(|s| {
let desc = if s.description.is_empty() {
"(no description)"
let desc = if s.name.is_empty() {
"(no name)"
} else {
&s.description
&s.name
};
let truncated_desc = safe_truncate(desc, TRUNCATED_DESC_LENGTH);
+1 -1
View File
@@ -290,7 +290,7 @@ async fn list_sessions() -> Json<serde_json::Value> {
session_info.push(serde_json::json!({
"name": session.id,
"path": session.id,
"description": session.description,
"description": session.name,
"message_count": session.message_count,
"working_dir": session.working_dir
}));