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
|
|
@ -11,11 +11,11 @@
|
|||
/// everything else here via a catch-all arm (`other => reply_err(other, tool)`),
|
||||
/// so the triplet lives in exactly one place.
|
||||
pub(super) fn reply_err(
|
||||
resp: Result<hive_agent_sock::Response, anyhow::Error>,
|
||||
resp: Result<hive_core_agent_sock::Response, anyhow::Error>,
|
||||
tool: &str,
|
||||
) -> String {
|
||||
match resp {
|
||||
Ok(hive_agent_sock::Response::Err { message }) => format!("{tool} failed: {message}"),
|
||||
Ok(hive_core_agent_sock::Response::Err { message }) => format!("{tool} failed: {message}"),
|
||||
Ok(other) => format!("{tool} unexpected response: {other:?}"),
|
||||
Err(e) => format!("{tool} transport error: {e:#}"),
|
||||
}
|
||||
|
|
@ -26,12 +26,12 @@ pub(super) fn reply_err(
|
|||
/// behavior.
|
||||
#[must_use]
|
||||
pub fn format_ack(
|
||||
resp: Result<hive_agent_sock::Response, anyhow::Error>,
|
||||
resp: Result<hive_core_agent_sock::Response, anyhow::Error>,
|
||||
tool: &str,
|
||||
ok_msg: String,
|
||||
) -> String {
|
||||
match resp {
|
||||
Ok(hive_agent_sock::Response::Ok) => ok_msg,
|
||||
Ok(hive_core_agent_sock::Response::Ok) => ok_msg,
|
||||
other => reply_err(other, tool),
|
||||
}
|
||||
}
|
||||
|
|
@ -47,9 +47,12 @@ pub fn format_ack(
|
|||
/// so the model can tell where one ends and the next begins;
|
||||
/// per-message redelivery banners included.
|
||||
#[must_use]
|
||||
pub fn format_recv(resp: Result<hive_agent_sock::Response, anyhow::Error>, waited: bool) -> String {
|
||||
pub fn format_recv(
|
||||
resp: Result<hive_core_agent_sock::Response, anyhow::Error>,
|
||||
waited: bool,
|
||||
) -> String {
|
||||
match resp {
|
||||
Ok(hive_agent_sock::Response::Messages {
|
||||
Ok(hive_core_agent_sock::Response::Messages {
|
||||
messages,
|
||||
remaining,
|
||||
}) => render_recv_messages(&messages, remaining, waited),
|
||||
|
|
@ -60,7 +63,7 @@ pub fn format_recv(resp: Result<hive_agent_sock::Response, anyhow::Error>, waite
|
|||
// stop unmissably tells claude to flush + end. `remaining` is forced
|
||||
// to 0 — the inbox is fenced, so a "N more pending" hint would be
|
||||
// misleading.
|
||||
Ok(hive_agent_sock::Response::GracefulStop) => {
|
||||
Ok(hive_core_agent_sock::Response::GracefulStop) => {
|
||||
render_recv_messages(&[graceful_stop_message()], 0, waited)
|
||||
}
|
||||
other => reply_err(other, "recv"),
|
||||
|
|
@ -357,9 +360,9 @@ pub(super) fn loose_end_kind_label(kind: hive_sh4re::CancelLooseEndKind) -> &'st
|
|||
/// `running: no` line tells the caller WHY. See
|
||||
/// `docs/turn-loop/mcp.md::Core tools` (`get_agent_meta`).
|
||||
#[must_use]
|
||||
pub fn format_agent_meta(resp: Result<hive_agent_sock::Response, anyhow::Error>) -> String {
|
||||
pub fn format_agent_meta(resp: Result<hive_core_agent_sock::Response, anyhow::Error>) -> String {
|
||||
match resp {
|
||||
Ok(hive_agent_sock::Response::AgentMeta {
|
||||
Ok(hive_core_agent_sock::Response::AgentMeta {
|
||||
name,
|
||||
running,
|
||||
hyperhive_rev,
|
||||
|
|
@ -480,7 +483,7 @@ mod tests {
|
|||
#[test]
|
||||
fn empty_recv_after_wait_appends_idle_hint() {
|
||||
let out = format_recv(
|
||||
Ok(hive_agent_sock::Response::Messages {
|
||||
Ok(hive_core_agent_sock::Response::Messages {
|
||||
messages: vec![],
|
||||
remaining: 0,
|
||||
}),
|
||||
|
|
@ -493,7 +496,7 @@ mod tests {
|
|||
#[test]
|
||||
fn empty_recv_without_wait_has_no_hint() {
|
||||
let out = format_recv(
|
||||
Ok(hive_agent_sock::Response::Messages {
|
||||
Ok(hive_core_agent_sock::Response::Messages {
|
||||
messages: vec![],
|
||||
remaining: 0,
|
||||
}),
|
||||
|
|
@ -505,7 +508,7 @@ mod tests {
|
|||
#[test]
|
||||
fn single_recv_with_remaining_appends_pending_hint() {
|
||||
let out = format_recv(
|
||||
Ok(hive_agent_sock::Response::Messages {
|
||||
Ok(hive_core_agent_sock::Response::Messages {
|
||||
messages: vec![msg(7, "alice", "hi")],
|
||||
remaining: 3,
|
||||
}),
|
||||
|
|
@ -519,7 +522,7 @@ mod tests {
|
|||
#[test]
|
||||
fn single_recv_no_remaining_has_no_pending_hint() {
|
||||
let out = format_recv(
|
||||
Ok(hive_agent_sock::Response::Messages {
|
||||
Ok(hive_core_agent_sock::Response::Messages {
|
||||
messages: vec![msg(7, "alice", "hi")],
|
||||
remaining: 0,
|
||||
}),
|
||||
|
|
@ -531,7 +534,7 @@ mod tests {
|
|||
#[test]
|
||||
fn batch_recv_with_remaining_appends_pending_hint_once() {
|
||||
let out = format_recv(
|
||||
Ok(hive_agent_sock::Response::Messages {
|
||||
Ok(hive_core_agent_sock::Response::Messages {
|
||||
messages: vec![msg(7, "alice", "hi"), msg(8, "bob", "yo")],
|
||||
remaining: 9,
|
||||
}),
|
||||
|
|
|
|||
Loading…
Reference in a new issue