story-kit: merge 133_story_clean_up_agent_state_on_story_archive_and_add_ttl_for_completed_entries

This commit is contained in:
Dave
2026-02-24 13:20:59 +00:00
parent e49be6b905
commit 6170a7d984
4 changed files with 267 additions and 13 deletions

View File

@@ -1032,9 +1032,16 @@ async fn tool_stop_agent(args: &Value, ctx: &AppContext) -> Result<String, Strin
}
fn tool_list_agents(ctx: &AppContext) -> Result<String, String> {
let project_root = ctx.agents.get_project_root(&ctx.state).ok();
let agents = ctx.agents.list_agents()?;
serde_json::to_string_pretty(&json!(agents
.iter()
.filter(|a| {
project_root
.as_deref()
.map(|root| !crate::http::agents::story_is_archived(root, &a.story_id))
.unwrap_or(true)
})
.map(|a| json!({
"story_id": a.story_id,
"agent_name": a.agent_name,
@@ -1283,6 +1290,7 @@ fn tool_accept_story(args: &Value, ctx: &AppContext) -> Result<String, String> {
let project_root = ctx.agents.get_project_root(&ctx.state)?;
move_story_to_archived(&project_root, story_id)?;
ctx.agents.remove_agents_for_story(story_id);
Ok(format!(
"Story '{story_id}' accepted, moved to archived/, and committed to master."
@@ -1381,6 +1389,7 @@ fn tool_close_bug(args: &Value, ctx: &AppContext) -> Result<String, String> {
let root = ctx.agents.get_project_root(&ctx.state)?;
close_bug_to_archive(&root, bug_id)?;
ctx.agents.remove_agents_for_story(bug_id);
Ok(format!(
"Bug '{bug_id}' closed, moved to bugs/archive/, and committed to master."