feat: Matrix ChatOps bot (Task 5)

- Matrix bot via matrix-sdk: connect, join room, sync loop
- /fleet status: list all agents with status table
- /assign <agent> <issue>: manual task assignment
- /retry <issue>: re-queue failed/agent_lost task
- Notification formatting: task assigned/completed/failed, agent offline
- Per-agent thread support via Matrix Relation::Thread
- 15 tests: command parsing, notification formatting, fleet status table
This commit is contained in:
Zer4tul 2026-05-12 01:12:59 +08:00
parent 1dacd17231
commit 6efca09018
5 changed files with 550 additions and 0 deletions

View file

@ -106,5 +106,21 @@ async fn main() {
.expect("failed to bind");
tracing::info!("listening on {}", listener.local_addr().unwrap());
// Start Matrix bot
if !config.matrix.access_token.is_empty() && !config.matrix.room_id.is_empty() {
let matrix_cfg = config.matrix.clone();
let matrix_store = store.clone();
let matrix_sm = state_machine.clone();
tokio::spawn(async move {
match crate::integrations::matrix::start_bot(matrix_cfg, matrix_store, matrix_sm).await {
Ok(_) => tracing::info!("Matrix bot stopped"),
Err(e) => tracing::error!("Matrix bot error: {e}"),
}
});
} else {
tracing::info!("Matrix bot disabled (no access_token or room_id configured)");
}
axum::serve(listener, app).await.expect("server error");
}