refactor: remove Matrix bot, make agent-fleet platform-agnostic API service

- Remove src/integrations/matrix/ (bot connection, command parsing, notification formatting)
- Remove matrix-sdk dependency from Cargo.toml
- Remove MatrixConfig from config.rs and [matrix] from config.example.toml
- Add GET /api/v1/tasks (list with status/agent_id filter)
- Add POST /api/v1/tasks/{task_id}/retry (Failed/AgentLost → Assigned)
- Add EventStore::list_tasks() with parameterized query
- 29/29 tests pass

Platform integration (Telegram, Matrix, Feishu) is Agent-side responsibility.
agent-fleet is now a pure HTTP API orchestration engine.
This commit is contained in:
Zer4tul 2026-05-12 10:59:19 +08:00
parent 6efca09018
commit 1bc7580ecc
15 changed files with 435 additions and 2367 deletions

View file

@ -87,10 +87,15 @@ async fn main() {
let app = axum::Router::new()
.route("/healthz", axum::routing::get(|| async { "ok" }))
// Agent registry
.route("/api/v1/agents/register", axum::routing::post(api::register_agent))
.route("/api/v1/agents/heartbeat", axum::routing::post(api::heartbeat))
.route("/api/v1/agents/deregister", axum::routing::post(api::deregister))
.route("/api/v1/agents", axum::routing::get(api::list_agents))
// Task management
.route("/api/v1/tasks", axum::routing::get(api::list_tasks))
.route("/api/v1/tasks/{task_id}/retry", axum::routing::post(api::retry_task))
// Receipts & webhooks
.route("/api/v1/receipts", axum::routing::post(api::submit_receipt))
.route(
"/api/v1/webhooks/forgejo",
@ -106,21 +111,5 @@ 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");
}