use crate::attention::AttentionKind;
use crate::boundary::answer::queue::QueueRow;
use serde_json::{Value, json};
pub(super) fn queue_row(row: &QueueRow) -> Value {
json!({
"workspace": row.workspace.to_string_lossy(),
"agent": row.agent,
"display": row.display,
"state": super::rows::state_token(row.state),
"uncertain": row.uncertain,
"signals": row.signals.iter().map(|k| signal_token(*k)).collect::<Vec<&str>>(),
"preview": row.preview,
"age_secs": row.age_secs,
"pending": row.pending,
"held": row.held.as_ref().map(held),
})
}
fn held(held: &crate::control::hold::Held) -> Value {
json!({ "tool_use": held.tool_use_id, "tool": held.tool, "reason": held.reason })
}
fn signal_token(kind: AttentionKind) -> &'static str {
match kind {
AttentionKind::Notify => "notify",
AttentionKind::Stopped => "stopped",
AttentionKind::Budget => "budget",
AttentionKind::Conflicted => "conflicted",
AttentionKind::Mail => "mail",
AttentionKind::Held => "held",
}
}