move the send and turn row markers into hive-types
This commit is contained in:
parent
e4a9005468
commit
6084fb6329
9 changed files with 119 additions and 43 deletions
|
|
@ -128,41 +128,6 @@ pub fn iso8601_utc(unix_seconds: i64) -> String {
|
|||
.to_rfc3339_opts(SecondsFormat::Secs, true)
|
||||
}
|
||||
|
||||
/// Icon of the row an agent's `send` tool call makes.
|
||||
pub const SEND_ICON: &str = "📤";
|
||||
|
||||
/// What a `send` row's summary starts with; the recipient follows. A
|
||||
/// multi-line body appends ` · <N>L`, which [`send_recipient`] drops.
|
||||
pub const SEND_SUMMARY_PREFIX: &str = "send* → ";
|
||||
|
||||
/// Icon of the row a turn started by a message makes.
|
||||
pub const TURN_ICON: &str = "◆";
|
||||
|
||||
/// What a turn-start row's summary starts with; the sender follows.
|
||||
pub const TURN_SUMMARY_PREFIX: &str = "TURN ← ";
|
||||
|
||||
/// The recipient a `send` row's summary names, without the line-count suffix.
|
||||
#[must_use]
|
||||
pub fn send_recipient(summary: &str) -> Option<&str> {
|
||||
let rest = summary.strip_prefix(SEND_SUMMARY_PREFIX)?;
|
||||
Some(match rest.rsplit_once(" · ") {
|
||||
Some((to, lines))
|
||||
if lines
|
||||
.strip_suffix('L')
|
||||
.is_some_and(|n| !n.is_empty() && n.bytes().all(|b| b.is_ascii_digit())) =>
|
||||
{
|
||||
to
|
||||
}
|
||||
_ => rest,
|
||||
})
|
||||
}
|
||||
|
||||
/// The sender a turn-start row's summary names.
|
||||
#[must_use]
|
||||
pub fn turn_sender(summary: &str) -> Option<&str> {
|
||||
summary.strip_prefix(TURN_SUMMARY_PREFIX)
|
||||
}
|
||||
|
||||
/// Per-connection/per-request classification state. A live SSE stream keeps
|
||||
/// one of these alive for the connection's lifetime — `tool_use` id → name
|
||||
/// correlation, so a `tool_result` can tell it's answering a `recv` call and
|
||||
|
|
|
|||
Loading…
Reference in a new issue