story-kit: merge 310_story_bot_delete_command_removes_a_story_from_the_pipeline

This commit is contained in:
Dave
2026-03-19 16:03:03 +00:00
parent a23fe71232
commit c4282ab2fa
4 changed files with 412 additions and 0 deletions
+34
View File
@@ -827,6 +827,40 @@ async fn on_room_message(
return;
}
// Check for the delete command, which requires async agent/worktree ops
// and cannot be handled by the sync command registry.
if let Some(del_cmd) = super::delete::extract_delete_command(
&user_message,
&ctx.bot_name,
ctx.bot_user_id.as_str(),
) {
let response = match del_cmd {
super::delete::DeleteCommand::Delete { story_number } => {
slog!(
"[matrix-bot] Handling delete command from {sender}: story {story_number}"
);
super::delete::handle_delete(
&ctx.bot_name,
&story_number,
&ctx.project_root,
&ctx.agents,
)
.await
}
super::delete::DeleteCommand::BadArgs => {
format!("Usage: `{} delete <number>`", ctx.bot_name)
}
};
let html = markdown_to_html(&response);
if let Ok(resp) = room
.send(RoomMessageEventContent::text_html(response, html))
.await
{
ctx.bot_sent_event_ids.lock().await.insert(resp.event_id);
}
return;
}
// Spawn a separate task so the Matrix sync loop is not blocked while we
// wait for the LLM response (which can take several seconds).
tokio::spawn(async move {