huskies: merge 1034

This commit is contained in:
dave
2026-05-14 13:57:27 +00:00
parent 8625b9a7fc
commit 8faf19f3ab
11 changed files with 362 additions and 246 deletions
@@ -272,35 +272,26 @@ pub(in crate::chat::transport::matrix::bot) async fn on_room_message(
// Check for the assign command, which requires async agent ops (stop +
// start) and cannot be handled by the sync command registry.
if let Some(assign_cmd) = super::super::super::assign::extract_assign_command(
// Only handle the well-formed variant; BadArgs falls through to the LLM.
if let Some(super::super::super::assign::AssignCommand::Assign {
story_number,
model,
}) = super::super::super::assign::extract_assign_command(
&user_message,
&ctx.services.bot_name,
ctx.matrix_user_id.as_str(),
) {
let response = match assign_cmd {
super::super::super::assign::AssignCommand::Assign {
story_number,
model,
} => {
slog!(
"[matrix-bot] Handling assign command from {sender}: story {story_number} model={model}"
);
super::super::super::assign::handle_assign(
&ctx.services.bot_name,
&story_number,
&model,
&effective_root,
&ctx.services.agents,
)
.await
}
super::super::super::assign::AssignCommand::BadArgs => {
format!(
"Usage: `{} assign <number> <model>` (e.g. `assign 42 opus`)",
ctx.services.bot_name
)
}
};
slog!(
"[matrix-bot] Handling assign command from {sender}: story {story_number} model={model}"
);
let response = super::super::super::assign::handle_assign(
&ctx.services.bot_name,
&story_number,
&model,
&effective_root,
&ctx.services.agents,
)
.await;
let html = markdown_to_html(&response);
if let Ok(msg_id) = ctx
.transport
@@ -346,26 +337,22 @@ pub(in crate::chat::transport::matrix::bot) async fn on_room_message(
// 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::super::super::delete::extract_delete_command(
&user_message,
&ctx.services.bot_name,
ctx.matrix_user_id.as_str(),
) {
let response = match del_cmd {
super::super::super::delete::DeleteCommand::Delete { story_number } => {
slog!("[matrix-bot] Handling delete command from {sender}: story {story_number}");
super::super::super::delete::handle_delete(
&ctx.services.bot_name,
&story_number,
&effective_root,
&ctx.services.agents,
)
.await
}
super::super::super::delete::DeleteCommand::BadArgs => {
format!("Usage: `{} delete <number>`", ctx.services.bot_name)
}
};
// Only handle the well-formed variant; BadArgs falls through to the LLM.
if let Some(super::super::super::delete::DeleteCommand::Delete { story_number }) =
super::super::super::delete::extract_delete_command(
&user_message,
&ctx.services.bot_name,
ctx.matrix_user_id.as_str(),
)
{
slog!("[matrix-bot] Handling delete command from {sender}: story {story_number}");
let response = super::super::super::delete::handle_delete(
&ctx.services.bot_name,
&story_number,
&effective_root,
&ctx.services.agents,
)
.await;
let html = markdown_to_html(&response);
if let Ok(msg_id) = ctx
.transport
@@ -380,26 +367,22 @@ pub(in crate::chat::transport::matrix::bot) async fn on_room_message(
// Check for the rmtree command, which requires async agent/worktree ops
// and cannot be handled by the sync command registry.
if let Some(rmtree_cmd) = super::super::super::rmtree::extract_rmtree_command(
&user_message,
&ctx.services.bot_name,
ctx.matrix_user_id.as_str(),
) {
let response = match rmtree_cmd {
super::super::super::rmtree::RmtreeCommand::Rmtree { story_number } => {
slog!("[matrix-bot] Handling rmtree command from {sender}: story {story_number}");
super::super::super::rmtree::handle_rmtree(
&ctx.services.bot_name,
&story_number,
&effective_root,
&ctx.services.agents,
)
.await
}
super::super::super::rmtree::RmtreeCommand::BadArgs => {
format!("Usage: `{} rmtree <number>`", ctx.services.bot_name)
}
};
// Only handle the well-formed variant; BadArgs falls through to the LLM.
if let Some(super::super::super::rmtree::RmtreeCommand::Rmtree { story_number }) =
super::super::super::rmtree::extract_rmtree_command(
&user_message,
&ctx.services.bot_name,
ctx.matrix_user_id.as_str(),
)
{
slog!("[matrix-bot] Handling rmtree command from {sender}: story {story_number}");
let response = super::super::super::rmtree::handle_rmtree(
&ctx.services.bot_name,
&story_number,
&effective_root,
&ctx.services.agents,
)
.await;
let html = markdown_to_html(&response);
if let Ok(msg_id) = ctx
.transport
@@ -414,35 +397,26 @@ pub(in crate::chat::transport::matrix::bot) async fn on_room_message(
// Check for the start command, which requires async agent ops and cannot
// be handled by the sync command registry.
if let Some(start_cmd) = super::super::super::start::extract_start_command(
// Only handle the well-formed variant; BadArgs falls through to the LLM.
if let Some(super::super::super::start::StartCommand::Start {
story_number,
agent_hint,
}) = super::super::super::start::extract_start_command(
&user_message,
&ctx.services.bot_name,
ctx.matrix_user_id.as_str(),
) {
let response = match start_cmd {
super::super::super::start::StartCommand::Start {
story_number,
agent_hint,
} => {
slog!(
"[matrix-bot] Handling start command from {sender}: story {story_number} agent={agent_hint:?}"
);
super::super::super::start::handle_start(
&ctx.services.bot_name,
&story_number,
agent_hint.as_deref(),
&effective_root,
&ctx.services.agents,
)
.await
}
super::super::super::start::StartCommand::BadArgs => {
format!(
"Usage: `{} start <number>` or `{} start <number> opus`",
ctx.services.bot_name, ctx.services.bot_name
)
}
};
slog!(
"[matrix-bot] Handling start command from {sender}: story {story_number} agent={agent_hint:?}"
);
let response = super::super::super::start::handle_start(
&ctx.services.bot_name,
&story_number,
agent_hint.as_deref(),
&effective_root,
&ctx.services.agents,
)
.await;
let html = markdown_to_html(&response);
if let Ok(msg_id) = ctx
.transport