drop hive and agent response fields the frontend never reads
This commit is contained in:
parent
1875181d59
commit
a437f9ccd5
1 changed files with 347 additions and 598 deletions
|
|
@ -2,7 +2,6 @@
|
|||
//! returns, plus the per-account matrix identity shape surfaced by
|
||||
//! `GetAgentMeta`.
|
||||
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// One row in a `HostRequest::AgentStatus` result — the operator-CLI
|
||||
|
|
@ -46,24 +45,6 @@ pub struct AgentStatusRow {
|
|||
/// paused while stopped, and pause survives a restart.
|
||||
#[serde(default)]
|
||||
pub paused: bool,
|
||||
/// The Claude model the agent's harness is currently using. Mirrors
|
||||
/// `container_view::ContainerView::active_model`: `None` when the
|
||||
/// agent has never started a turn, the field is absent from its
|
||||
/// harness state file, or the container isn't running.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub active_model: Option<String>,
|
||||
/// The agent's current free-text status, set via the `set_status`
|
||||
/// tool. `None` when unset or the container isn't running — a
|
||||
/// stopped agent's on-disk status is a stale snapshot from before
|
||||
/// the stop (same rule `container_view::read_agent_status_live`
|
||||
/// applies for every other reader of this data).
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub status_text: Option<String>,
|
||||
/// When `status_text` was last set, RFC 3339 UTC on the wire (see
|
||||
/// `hive_sh4re::wire_time`). `None` exactly when `status_text` is
|
||||
/// `None`.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub status_set_at: Option<DateTime<Utc>>,
|
||||
/// This agent's own web UI, behind the gateway
|
||||
/// (`https://<dashboard-domain>/agent/<name>/`) — the same URL the operator
|
||||
/// dashboard's "open" action uses. `None` when the dashboard's domain isn't
|
||||
|
|
@ -93,3 +74,42 @@ pub struct MatrixIdentity {
|
|||
/// Homeserver base URL this account is on.
|
||||
pub homeserver: String,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::AgentStatusRow;
|
||||
|
||||
/// The roster row carries exactly these keys; a field added back needs a reader.
|
||||
#[test]
|
||||
fn the_agent_status_row_serialises_exactly_its_fields() {
|
||||
let row = AgentStatusRow {
|
||||
name: "alice".to_owned(),
|
||||
running: true,
|
||||
failed: false,
|
||||
needs_login: false,
|
||||
pending_reminders: 0,
|
||||
paused: false,
|
||||
url: Some("https://example.invalid/agent/alice/".to_owned()),
|
||||
};
|
||||
let value = serde_json::to_value(&row).unwrap();
|
||||
let mut keys: Vec<&str> = value
|
||||
.as_object()
|
||||
.unwrap()
|
||||
.keys()
|
||||
.map(String::as_str)
|
||||
.collect();
|
||||
keys.sort_unstable();
|
||||
assert_eq!(
|
||||
keys,
|
||||
[
|
||||
"failed",
|
||||
"name",
|
||||
"needs_login",
|
||||
"paused",
|
||||
"pending_reminders",
|
||||
"running",
|
||||
"url"
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue