story-kit: merge 133_story_clean_up_agent_state_on_story_archive_and_add_ttl_for_completed_entries
This commit is contained in:
@@ -66,7 +66,7 @@ struct WorktreeListEntry {
|
||||
/// Used to exclude agents for already-archived stories from the `list_agents`
|
||||
/// response so the agents panel is not cluttered with old completed items on
|
||||
/// frontend startup.
|
||||
fn story_is_archived(project_root: &path::Path, story_id: &str) -> bool {
|
||||
pub fn story_is_archived(project_root: &path::Path, story_id: &str) -> bool {
|
||||
project_root
|
||||
.join(".story_kit")
|
||||
.join("work")
|
||||
|
||||
@@ -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."
|
||||
|
||||
Reference in New Issue
Block a user