refactor(#2569): rename hive-agent-sock to hive-core-agent-sock
This commit is contained in:
parent
84b750fba5
commit
795dd882bb
26 changed files with 184 additions and 161 deletions
|
|
@ -1064,13 +1064,14 @@ async fn poll_once(
|
|||
continue;
|
||||
};
|
||||
|
||||
let req = hive_agent_sock::Request::Wake {
|
||||
let req = hive_core_agent_sock::Request::Wake {
|
||||
from: "forge".to_owned(),
|
||||
body,
|
||||
};
|
||||
let deliver_result = crate::client::request::<_, hive_agent_sock::Response>(socket, &req)
|
||||
.await
|
||||
.map(|_| ());
|
||||
let deliver_result =
|
||||
crate::client::request::<_, hive_core_agent_sock::Response>(socket, &req)
|
||||
.await
|
||||
.map(|_| ());
|
||||
match deliver_result {
|
||||
Ok(()) => {
|
||||
debug!(%id, "forge_notify: delivered");
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ use crate::login::LoginState;
|
|||
use crate::turn_stats::TurnStats;
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use hive_agent_sock::{Request, Response};
|
||||
use hive_core_agent_sock::{Request, Response};
|
||||
use hive_sh4re::{HelperEvent, SYSTEM_SENDER};
|
||||
|
||||
#[derive(Parser)]
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub(super) async fn post_send(
|
|||
}
|
||||
match super::broker_request(
|
||||
&state.socket,
|
||||
&hive_agent_sock::Request::OperatorMsg { body },
|
||||
&hive_core_agent_sock::Request::OperatorMsg { body },
|
||||
)
|
||||
.await
|
||||
{
|
||||
|
|
@ -35,8 +35,10 @@ pub(super) async fn post_send(
|
|||
// resulting `TurnStart` SSE event drives the terminal + the
|
||||
// inbox row gets consumed by the time `TurnEnd` fires the
|
||||
// existing turn-end refresh.
|
||||
Ok(hive_agent_sock::Response::Ok) => (axum::http::StatusCode::OK, "ok").into_response(),
|
||||
Ok(hive_agent_sock::Response::Err { message }) => error_response(
|
||||
Ok(hive_core_agent_sock::Response::Ok) => {
|
||||
(axum::http::StatusCode::OK, "ok").into_response()
|
||||
}
|
||||
Ok(hive_core_agent_sock::Response::Err { message }) => error_response(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
&format!("send failed: {message}"),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -302,11 +302,11 @@ enum BrokerError {
|
|||
/// web-UI handler that talks to the broker goes through it.
|
||||
async fn broker_request(
|
||||
socket: &Path,
|
||||
req: &hive_agent_sock::Request,
|
||||
) -> std::result::Result<hive_agent_sock::Response, BrokerError> {
|
||||
req: &hive_core_agent_sock::Request,
|
||||
) -> std::result::Result<hive_core_agent_sock::Response, BrokerError> {
|
||||
match tokio::time::timeout(
|
||||
SOCKET_FETCH_TIMEOUT,
|
||||
crate::client::request::<_, hive_agent_sock::Response>(socket, req),
|
||||
crate::client::request::<_, hive_core_agent_sock::Response>(socket, req),
|
||||
)
|
||||
.await
|
||||
{
|
||||
|
|
|
|||
|
|
@ -366,8 +366,13 @@ async fn recent_inbox(socket: &std::path::Path) -> Vec<hive_sh4re::InboxRow> {
|
|||
const LIMIT: u64 = 30;
|
||||
// Deadline-bounded (via `broker_request`): `/api/state` must render even
|
||||
// when hive-c0re is busy — an empty inbox section beats a hung snapshot.
|
||||
match super::broker_request(socket, &hive_agent_sock::Request::Recent { limit: LIMIT }).await {
|
||||
Ok(hive_agent_sock::Response::Recent { rows }) => rows,
|
||||
match super::broker_request(
|
||||
socket,
|
||||
&hive_core_agent_sock::Request::Recent { limit: LIMIT },
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(hive_core_agent_sock::Response::Recent { rows }) => rows,
|
||||
_ => Vec::new(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,14 +35,14 @@ async fn fetch_reminder_stats(
|
|||
) -> Option<hive_sh4re::ReminderStats> {
|
||||
match super::broker_request(
|
||||
socket,
|
||||
&hive_agent_sock::Request::ReminderRollup {
|
||||
&hive_core_agent_sock::Request::ReminderRollup {
|
||||
since_secs: window_secs,
|
||||
agent: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(hive_agent_sock::Response::ReminderRollup(stats)) => Some(stats),
|
||||
Ok(hive_core_agent_sock::Response::ReminderRollup(stats)) => Some(stats),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
@ -57,14 +57,14 @@ async fn fetch_reminder_stats(
|
|||
pub(super) async fn api_loose_ends(State(state): State<AppState>) -> Response {
|
||||
match super::broker_request(
|
||||
&state.socket,
|
||||
&hive_agent_sock::Request::GetLooseEnds { agent: None },
|
||||
&hive_core_agent_sock::Request::GetLooseEnds { agent: None },
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(hive_agent_sock::Response::LooseEnds { loose_ends }) => {
|
||||
Ok(hive_core_agent_sock::Response::LooseEnds { loose_ends }) => {
|
||||
axum::Json(serde_json::json!({ "loose_ends": loose_ends })).into_response()
|
||||
}
|
||||
Ok(hive_agent_sock::Response::Err { message }) => error_response(
|
||||
Ok(hive_core_agent_sock::Response::Err { message }) => error_response(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
&format!("get_loose_ends: {message}"),
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in a new issue