Watch
0
0
Fork
You've already forked hyperhive
0

drop the hyperhive send/recv/ack_until tools: agents message over matrix

This commit is contained in:
damocles 2026-11-07 11:55:45 +01:00 • committed by mara
commit bffb2c07a8
2 changed files with 52 additions and 397 deletions

View file

@ -994,7 +994,6 @@ async fn handle_turn<S: Surface>(
let from = first.from;
let body = first.body;
let redelivered = first.redelivered;
let msg_id = first.id;
log_system_event(bus, &from, &body);
tracing::info!(%from, %body, %redelivered, "inbox");
let unread = S::inbox_unread(socket).await;
@ -1011,14 +1010,7 @@ async fn handle_turn<S: Surface>(
// the "you were interrupted" banner, then the flag resets so a later
// ordinary turn doesn't repeat a stale notice.
let was_interrupted = interrupted.swap(false, std::sync::atomic::Ordering::Relaxed);
let prompt = serve_common::format_wake_prompt(
msg_id,
&from,
&body,
unread,
redelivered,
was_interrupted,
);
let prompt = serve_common::format_wake_prompt(&from, &body, redelivered, was_interrupted);
let outcome = turn::drive_turn(&prompt, files, bus, session).await;
turn::emit_turn_end(bus, &outcome);
bus.set_state(TurnState::Idle);

View file

@ -9,23 +9,13 @@ use crate::turn::{TurnError, TurnOutcome};
use crate::turn_stats::TurnStatRow;
/// Assemble the per-turn wake prompt string. The role/tools/etc. live in the
/// system prompt; this is just the wake signal body. `id` is the broker row
/// id, rendered as a `[msg #<id>]` marker so the agent can reference it in
/// `ack_until`. `unread` is the inbox depth after this message was popped.
/// `redelivered` prepends a "may already be handled" banner; `interrupted`
/// system prompt; this is just the wake signal body. `redelivered` prepends a "may already be handled" banner; `interrupted`
/// prepends a "previous turn was /cancel'd" banner instead (the two are
/// mutually exclusive in practice — a redelivered message means the harness
/// itself restarted, which also clears the in-memory interrupted flag — so
/// `redelivered` takes priority if both were somehow set).
#[must_use]
pub fn format_wake_prompt(
id: i64,
from: &str,
body: &str,
unread: u64,
redelivered: bool,
interrupted: bool,
) -> String {
pub fn format_wake_prompt(from: &str, body: &str, redelivered: bool, interrupted: bool) -> String {
let banner = if redelivered {
hive_sh4re::inbox::REDELIVERY_HINT
} else if interrupted {
@ -33,13 +23,7 @@ pub fn format_wake_prompt(
} else {
""
};
let tag = if id > 0 {
format!("[msg #{id}] ")
} else {
String::new()
};
let pending = hive_sh4re::inbox::pending_hint(unread);
format!("{banner}{tag}Incoming message from `{from}`:\n---\n{body}\n---{pending}")
format!("{banner}Incoming message from `{from}`:\n---\n{body}\n---")
}
/// Field-named args for [`build_row`]. Mirrors the turn-stats row