clippy pedantic clean + wired into flake checks

This commit is contained in:
müde 2026-05-14 22:57:47 +02:00
parent f12837fe32
commit fef2dee92a
12 changed files with 55 additions and 25 deletions

View file

@ -2,7 +2,7 @@
//! authenticates the caller: connecting to `<.../agents/foo/mcp.sock>` means
//! you are `foo`.
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use anyhow::{Context, Result};
@ -18,23 +18,24 @@ pub struct AgentSocket {
pub handle: JoinHandle<()>,
}
pub async fn start(
agent: String,
socket_path: PathBuf,
pub fn start(
agent: &str,
socket_path: &Path,
broker: Arc<Broker>,
) -> Result<AgentSocket> {
let agent = agent.to_owned();
if let Some(parent) = socket_path.parent() {
std::fs::create_dir_all(parent)
.with_context(|| format!("create agent socket dir {}", parent.display()))?;
}
if socket_path.exists() {
std::fs::remove_file(&socket_path).context("remove stale agent socket")?;
std::fs::remove_file(socket_path).context("remove stale agent socket")?;
}
let listener = UnixListener::bind(&socket_path)
let listener = UnixListener::bind(socket_path)
.with_context(|| format!("bind agent socket {}", socket_path.display()))?;
tracing::info!(%agent, socket = %socket_path.display(), "agent socket listening");
let path = socket_path.clone();
let path = socket_path.to_path_buf();
let handle = tokio::spawn(async move {
loop {
match listener.accept().await {
@ -83,7 +84,7 @@ async fn serve(stream: UnixStream, agent: String, broker: Arc<Broker>) -> Result
fn dispatch(req: &AgentRequest, agent: &str, broker: &Broker) -> AgentResponse {
match req {
AgentRequest::Send { to, body } => {
match broker.send(Message {
match broker.send(&Message {
from: agent.to_owned(),
to: to.clone(),
body: body.clone(),