omx(team): auto-checkpoint worker-1 [1]

This commit is contained in:
bellman
2026-05-15 11:12:10 +09:00
parent 8fd5894022
commit d04a74cc97

View File

@@ -3791,6 +3791,35 @@ fn run_resume_command(
session: &Session,
command: &SlashCommand,
) -> Result<ResumeCommandOutcome, Box<dyn std::error::Error>> {
let session_list_outcome = || -> Result<ResumeCommandOutcome, Box<dyn std::error::Error>> {
let sessions = list_managed_sessions().unwrap_or_default();
let session_ids: Vec<String> = sessions.iter().map(|s| s.id.clone()).collect();
let session_details: Vec<serde_json::Value> = sessions
.iter()
.map(|session| {
serde_json::json!({
"id": session.id,
"path": session.path.display().to_string(),
"message_count": session.message_count,
"updated_at_ms": session.updated_at_ms,
"lifecycle": session.lifecycle.json_value(),
})
})
.collect();
let active_id = session.session_id.clone();
let text = render_session_list(&active_id).unwrap_or_else(|e| format!("error: {e}"));
Ok(ResumeCommandOutcome {
session: session.clone(),
message: Some(text),
json: Some(serde_json::json!({
"kind": "session_list",
"sessions": session_ids,
"session_details": session_details,
"active": active_id,
})),
})
};
match command {
SlashCommand::Help => Ok(ResumeCommandOutcome {
session: session.clone(),
@@ -4116,37 +4145,11 @@ fn run_resume_command(
})
}
// /session list can be served from the sessions directory without a live session.
SlashCommand::Session { action: None, .. } => session_list_outcome(),
SlashCommand::Session {
action: Some(ref act),
..
} if act == "list" => {
let sessions = list_managed_sessions().unwrap_or_default();
let session_ids: Vec<String> = sessions.iter().map(|s| s.id.clone()).collect();
let session_details: Vec<serde_json::Value> = sessions
.iter()
.map(|session| {
serde_json::json!({
"id": session.id,
"path": session.path.display().to_string(),
"message_count": session.message_count,
"updated_at_ms": session.updated_at_ms,
"lifecycle": session.lifecycle.json_value(),
})
})
.collect();
let active_id = session.session_id.clone();
let text = render_session_list(&active_id).unwrap_or_else(|e| format!("error: {e}"));
Ok(ResumeCommandOutcome {
session: session.clone(),
message: Some(text),
json: Some(serde_json::json!({
"kind": "session_list",
"sessions": session_ids,
"session_details": session_details,
"active": active_id,
})),
})
}
} if act == "list" => session_list_outcome(),
SlashCommand::Bughunter { .. }
| SlashCommand::Commit { .. }
| SlashCommand::Pr { .. }
@@ -4167,6 +4170,7 @@ fn run_resume_command(
| SlashCommand::Fast
| SlashCommand::Exit
| SlashCommand::Summary
| SlashCommand::Session { .. }
| SlashCommand::Desktop
| SlashCommand::Brief
| SlashCommand::Advisor