storkit: merge 380_story_assign_command_restarts_coder_when_story_is_already_in_progress
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
//! `POST /api/bot/command` lets the web UI invoke the same deterministic bot
|
||||
//! commands available in Matrix without going through the LLM.
|
||||
//!
|
||||
//! Synchronous commands (status, assign, git, cost, move, show, overview,
|
||||
//! help) are dispatched directly through the matrix command registry.
|
||||
//! Asynchronous commands (start, delete, rebuild) are dispatched to their
|
||||
//! dedicated async handlers. The `reset` command is handled by the frontend
|
||||
//! Synchronous commands (status, git, cost, move, show, overview, help) are
|
||||
//! dispatched directly through the matrix command registry.
|
||||
//! Asynchronous commands (assign, start, delete, rebuild) are dispatched to
|
||||
//! their dedicated async handlers. The `reset` command is handled by the frontend
|
||||
//! (it clears local session state and message history) and is not routed here.
|
||||
|
||||
use crate::http::context::{AppContext, OpenApiResult};
|
||||
@@ -75,6 +75,7 @@ async fn dispatch_command(
|
||||
agents: &Arc<crate::agents::AgentPool>,
|
||||
) -> String {
|
||||
match cmd {
|
||||
"assign" => dispatch_assign(args, project_root, agents).await,
|
||||
"start" => dispatch_start(args, project_root, agents).await,
|
||||
"delete" => dispatch_delete(args, project_root, agents).await,
|
||||
"rebuild" => dispatch_rebuild(project_root, agents).await,
|
||||
@@ -123,6 +124,24 @@ fn dispatch_sync(
|
||||
}
|
||||
}
|
||||
|
||||
async fn dispatch_assign(
|
||||
args: &str,
|
||||
project_root: &std::path::Path,
|
||||
agents: &Arc<crate::agents::AgentPool>,
|
||||
) -> String {
|
||||
// args: "<number> <model>"
|
||||
let mut parts = args.splitn(2, char::is_whitespace);
|
||||
let number_str = parts.next().unwrap_or("").trim();
|
||||
let model_str = parts.next().unwrap_or("").trim();
|
||||
|
||||
if number_str.is_empty() || !number_str.chars().all(|c| c.is_ascii_digit()) || model_str.is_empty() {
|
||||
return "Usage: `/assign <number> <model>` (e.g. `/assign 42 opus`)".to_string();
|
||||
}
|
||||
|
||||
crate::matrix::assign::handle_assign("web-ui", number_str, model_str, project_root, agents)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn dispatch_start(
|
||||
args: &str,
|
||||
project_root: &std::path::Path,
|
||||
|
||||
Reference in New Issue
Block a user