aboutsummaryrefslogtreecommitdiff
path: root/src/terminal/metadata.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-07-13 03:26:03 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-07-13 03:30:13 +0300
commit5cfe5e5e730246948b0c9428ad876b6938590aad (patch)
tree53d4bbe1aff6887f63f279eed1b5e4e11e7331b7 /src/terminal/metadata.rs
parent7f3364a468f7dcfd8c9c84e5737fe5699f0e3a93 (diff)
feat: add configurable sidebar metadata tokens
Diffstat (limited to 'src/terminal/metadata.rs')
-rw-r--r--src/terminal/metadata.rs439
1 files changed, 112 insertions, 327 deletions
diff --git a/src/terminal/metadata.rs b/src/terminal/metadata.rs
index 2666b32f..225d609a 100644
--- a/src/terminal/metadata.rs
+++ b/src/terminal/metadata.rs
@@ -12,12 +12,10 @@ pub struct AgentMetadata {
pub applies_to_source: Option<String>,
pub title: Option<String>,
pub display_agent: Option<String>,
- pub custom_status: Option<String>,
pub state_labels: HashMap<String, String>,
pub reported_at: Instant,
title_reported_at: Option<Instant>,
display_agent_reported_at: Option<Instant>,
- custom_status_reported_at: Option<Instant>,
state_label_reported_at: HashMap<String, Instant>,
pub ttl: Option<Duration>,
expiry_event_pending: bool,
@@ -30,11 +28,9 @@ pub struct AgentMetadataReport {
pub applies_to_source: Option<String>,
pub title: Option<String>,
pub display_agent: Option<String>,
- pub custom_status: Option<String>,
pub state_labels: HashMap<String, String>,
pub clear_title: bool,
pub clear_display_agent: bool,
- pub clear_custom_status: bool,
pub clear_state_labels: bool,
pub ttl: Option<Duration>,
pub seq: Option<u64>,
@@ -44,7 +40,6 @@ pub struct AgentMetadataReport {
pub struct EffectivePresentation {
pub title: Option<String>,
pub display_agent: Option<String>,
- pub custom_status: Option<String>,
pub state_labels: HashMap<String, String>,
}
@@ -53,36 +48,67 @@ impl EffectivePresentation {
Self {
title: None,
display_agent: None,
- custom_status: None,
state_labels: HashMap::new(),
}
}
}
impl TerminalState {
- fn accept_metadata_report(&mut self, source: &str, seq: Option<u64>) -> bool {
+ pub(crate) fn metadata_report_sequence_is_fresh(&self, source: &str, seq: Option<u64>) -> bool {
+ crate::metadata_tokens::sequence_is_fresh(&self.metadata_report_sequences, source, seq)
+ }
+
+ pub(crate) fn accept_metadata_report(
+ &mut self,
+ source: &str,
+ seq: Option<u64>,
+ includes_tokens: bool,
+ ) -> Result<bool, ()> {
let Some(seq) = seq else {
- return true;
+ return Ok(true);
};
-
- if self
- .metadata_report_sequences
- .get(source)
- .is_some_and(|last_seq| seq <= *last_seq)
+ if !self.metadata_report_sequence_is_fresh(source, Some(seq)) {
+ return Ok(false);
+ }
+ if includes_tokens
+ && !self.metadata_token_sequence_sources.contains(source)
+ && self.metadata_token_sequence_sources.len()
+ >= crate::metadata_tokens::MAX_SEQUENCE_SOURCES
{
- return false;
+ return Err(());
}
-
self.metadata_report_sequences
.insert(source.to_string(), seq);
- true
+ if includes_tokens {
+ self.metadata_token_sequence_sources
+ .insert(source.to_string());
+ }
+ Ok(true)
+ }
+
+ fn metadata_guards_match(
+ &self,
+ agent_label: Option<&str>,
+ applies_to_source: Option<&str>,
+ ) -> bool {
+ if agent_label.is_some_and(|agent| self.effective_agent_label() != Some(agent)) {
+ return false;
+ }
+ !applies_to_source.is_some_and(|source| {
+ self.hook_authority
+ .as_ref()
+ .is_none_or(|authority| authority.source != source)
+ })
}
pub fn set_agent_metadata(
&mut self,
report: AgentMetadataReport,
) -> Option<TerminalStateMutation> {
- if !self.accept_metadata_report(&report.source, report.seq) {
+ if !matches!(
+ self.accept_metadata_report(&report.source, report.seq, false),
+ Ok(true)
+ ) {
return None;
}
@@ -100,17 +126,12 @@ impl TerminalState {
let previous_presentation = self.effective_presentation_for_state_at(previous_state, now);
let has_set_fields = report.title.is_some()
|| report.display_agent.is_some()
- || report.custom_status.is_some()
|| !report.state_labels.is_empty();
let report_source = report.source.clone();
let report_has_ttl = report.ttl.is_some();
- if report.clear_title
- || report.clear_display_agent
- || report.clear_custom_status
- || report.clear_state_labels
- {
+ if report.clear_title || report.clear_display_agent || report.clear_state_labels {
let metadata = self
.agent_metadata
.entry(report.source.clone())
@@ -120,12 +141,10 @@ impl TerminalState {
applies_to_source: report.applies_to_source.clone(),
title: None,
display_agent: None,
- custom_status: None,
state_labels: HashMap::new(),
reported_at: now,
title_reported_at: None,
display_agent_reported_at: None,
- custom_status_reported_at: None,
state_label_reported_at: HashMap::new(),
ttl: report.ttl,
expiry_event_pending: false,
@@ -138,10 +157,6 @@ impl TerminalState {
metadata.display_agent = None;
metadata.display_agent_reported_at = None;
}
- if report.clear_custom_status {
- metadata.custom_status = None;
- metadata.custom_status_reported_at = None;
- }
if report.clear_state_labels {
metadata.state_labels.clear();
metadata.state_label_reported_at.clear();
@@ -160,10 +175,6 @@ impl TerminalState {
metadata.display_agent = Some(display_agent);
metadata.display_agent_reported_at = Some(now);
}
- if let Some(custom_status) = report.custom_status {
- metadata.custom_status = Some(custom_status);
- metadata.custom_status_reported_at = Some(now);
- }
for (state, label) in report.state_labels {
metadata.state_labels.insert(state.clone(), label);
metadata.state_label_reported_at.insert(state, now);
@@ -176,7 +187,6 @@ impl TerminalState {
} else {
let title_reported_at = report.title.as_ref().map(|_| now);
let display_agent_reported_at = report.display_agent.as_ref().map(|_| now);
- let custom_status_reported_at = report.custom_status.as_ref().map(|_| now);
let state_label_reported_at = report
.state_labels
.keys()
@@ -190,12 +200,10 @@ impl TerminalState {
applies_to_source: report.applies_to_source,
title: report.title,
display_agent: report.display_agent,
- custom_status: report.custom_status,
state_labels: report.state_labels,
reported_at: now,
title_reported_at,
display_agent_reported_at,
- custom_status_reported_at,
state_label_reported_at,
ttl: report.ttl,
expiry_event_pending: false,
@@ -231,11 +239,6 @@ impl TerminalState {
session_ref_changed: false,
})
}
- pub fn effective_custom_status(&self) -> Option<String> {
- self.effective_presentation_for_state_at(self.state, Instant::now())
- .custom_status
- }
-
pub fn effective_title(&self) -> Option<String> {
self.effective_presentation_for_state_at(self.state, Instant::now())
.title
@@ -337,7 +340,7 @@ impl TerminalState {
fn effective_presentation_for_state_at_with_ttl(
&self,
- state: AgentState,
+ _state: AgentState,
now: Instant,
enforce_ttl: bool,
) -> EffectivePresentation {
@@ -345,30 +348,9 @@ impl TerminalState {
presentation.title = self.newest_metadata_title(now, enforce_ttl);
presentation.display_agent = self.newest_metadata_display_agent(now, enforce_ttl);
presentation.state_labels = self.effective_metadata_state_labels(now, enforce_ttl);
- presentation.custom_status =
- self.effective_custom_status_for_state_at_with_ttl(state, now, enforce_ttl);
presentation
}
- fn effective_custom_status_for_state_at_with_ttl(
- &self,
- _state: AgentState,
- now: Instant,
- enforce_ttl: bool,
- ) -> Option<String> {
- if let Some(custom_status) = self.newest_metadata_custom_status(now, enforce_ttl) {
- return Some(custom_status);
- }
-
- if self.visible_blocker_overrides_hook() {
- return None;
- }
-
- self.hook_authority
- .as_ref()
- .and_then(|authority| authority.custom_status.clone())
- }
-
fn valid_agent_metadata(
&self,
now: Instant,
@@ -393,13 +375,6 @@ impl TerminalState {
.and_then(|metadata| metadata.display_agent.clone())
}
- fn newest_metadata_custom_status(&self, now: Instant, enforce_ttl: bool) -> Option<String> {
- self.valid_agent_metadata(now, enforce_ttl)
- .filter(|metadata| metadata.custom_status.is_some())
- .max_by_key(|metadata| metadata.custom_status_reported_at)
- .and_then(|metadata| metadata.custom_status.clone())
- }
-
fn effective_metadata_state_labels(
&self,
now: Instant,
@@ -432,7 +407,6 @@ impl TerminalState {
) -> bool {
if metadata.title.is_none()
&& metadata.display_agent.is_none()
- && metadata.custom_status.is_none()
&& metadata.state_labels.is_empty()
{
return false;
@@ -446,7 +420,6 @@ impl TerminalState {
fn agent_metadata_is_visible_ignoring_ttl(&self, metadata: &AgentMetadata) -> bool {
(metadata.title.is_some()
|| metadata.display_agent.is_some()
- || metadata.custom_status.is_some()
|| !metadata.state_labels.is_empty())
&& self.agent_metadata_matches_guards(metadata)
}
@@ -483,21 +456,10 @@ impl TerminalState {
}
fn agent_metadata_matches_guards(&self, metadata: &AgentMetadata) -> bool {
- if metadata
- .agent_label
- .as_deref()
- .is_some_and(|agent| self.effective_agent_label() != Some(agent))
- {
- return false;
- }
- if metadata.applies_to_source.as_deref().is_some_and(|source| {
- self.hook_authority
- .as_ref()
- .is_none_or(|authority| authority.source != source)
- }) {
- return false;
- }
- true
+ self.metadata_guards_match(
+ metadata.agent_label.as_deref(),
+ metadata.applies_to_source.as_deref(),
+ )
}
}
@@ -513,129 +475,39 @@ mod tests {
TerminalState::new(TerminalId::alloc(), "/tmp".into())
}
- fn set_metadata_custom_status(
- terminal: &mut TerminalState,
- source: &str,
- agent_label: Option<&str>,
- applies_to_source: Option<&str>,
- custom_status: Option<&str>,
- clear_custom_status: bool,
- ) -> Option<TerminalStateMutation> {
- terminal.set_agent_metadata(AgentMetadataReport {
- source: source.into(),
- agent_label: agent_label.map(str::to_string),
- applies_to_source: applies_to_source.map(str::to_string),
- title: None,
- display_agent: None,
- custom_status: custom_status.map(str::to_string),
- state_labels: HashMap::new(),
- clear_title: false,
- clear_display_agent: false,
- clear_custom_status,
- clear_state_labels: false,
- ttl: None,
- seq: None,
- })
- }
-
- #[test]
- fn user_agent_metadata_overrides_hook_custom_status_without_changing_state() {
- let mut terminal = test_terminal();
- terminal.set_hook_authority_with_custom_status(
- "herdr:claude".into(),
- "claude".into(),
- AgentState::Working,
- None,
- Some("thinking".into()),
- None,
- );
-
- let mutation = set_metadata_custom_status(
- &mut terminal,
- "user:claude-title",
- Some("claude"),
- Some("herdr:claude"),
- Some("refactor auth"),
- false,
- );
-
- assert_eq!(terminal.state, AgentState::Working);
- assert_eq!(
- terminal.effective_custom_status().as_deref(),
- Some("refactor auth")
- );
- let change = mutation.unwrap().effective_state_change.unwrap();
- assert_eq!(change.previous_state, AgentState::Working);
- assert_eq!(change.state, AgentState::Working);
- assert_eq!(
- change.previous_presentation.custom_status.as_deref(),
- Some("thinking")
- );
- assert_eq!(
- change.presentation.custom_status.as_deref(),
- Some("refactor auth")
- );
- }
-
- #[test]
- fn user_agent_metadata_requires_matching_lifecycle_source() {
- let mut terminal = test_terminal();
- terminal.set_hook_authority(
- "herdr:codex".into(),
- "codex".into(),
- AgentState::Working,
- None,
- None,
- );
- set_metadata_custom_status(
- &mut terminal,
- "user:claude-title",
- Some("claude"),
- Some("herdr:claude"),
- Some("refactor auth"),
- false,
- );
-
- assert_eq!(terminal.effective_custom_status(), None);
- }
-
#[test]
- fn clearing_user_agent_metadata_restores_hook_custom_status() {
+ fn presentation_sequences_remain_unbounded_while_token_sequences_are_bounded() {
let mut terminal = test_terminal();
- terminal.set_hook_authority_with_custom_status(
- "herdr:claude".into(),
- "claude".into(),
- AgentState::Working,
- None,
- Some("thinking".into()),
- None,
- );
- set_metadata_custom_status(
- &mut terminal,
- "user:claude-title",
- Some("claude"),
- Some("herdr:claude"),
- Some("refactor auth"),
- false,
- );
-
- set_metadata_custom_status(&mut terminal, "user:claude-title", None, None, None, true);
-
+ for index in 0..=crate::metadata_tokens::MAX_SEQUENCE_SOURCES {
+ assert_eq!(
+ terminal.accept_metadata_report(&format!("source-{index}"), Some(1), false),
+ Ok(true)
+ );
+ }
+ for index in 0..crate::metadata_tokens::MAX_SEQUENCE_SOURCES {
+ assert_eq!(
+ terminal.accept_metadata_report(&format!("source-{index}"), Some(2), true),
+ Ok(true)
+ );
+ }
assert_eq!(
- terminal.effective_custom_status().as_deref(),
- Some("thinking")
+ terminal.accept_metadata_report(
+ &format!("source-{}", crate::metadata_tokens::MAX_SEQUENCE_SOURCES),
+ Some(2),
+ true,
+ ),
+ Err(())
);
}
#[test]
fn user_agent_metadata_overrides_presentation_fields_only() {
let mut terminal = test_terminal();
- terminal.set_hook_authority_with_custom_status(
+ terminal.set_hook_authority(
"herdr:claude".into(),
"claude".into(),
AgentState::Working,
None,
- Some("thinking".into()),
None,
);
@@ -645,11 +517,9 @@ mod tests {
applies_to_source: Some("herdr:claude".into()),
title: Some("Refactor auth".into()),
display_agent: Some("Claude: auth".into()),
- custom_status: Some("middleware".into()),
state_labels: HashMap::from([("working".into(), "deep in the mines".into())]),
clear_title: false,
clear_display_agent: false,
- clear_custom_status: false,
clear_state_labels: false,
ttl: None,
seq: None,
@@ -660,7 +530,6 @@ mod tests {
let presentation = terminal.effective_presentation();
assert_eq!(presentation.title.as_deref(), Some("Refactor auth"));
assert_eq!(presentation.display_agent.as_deref(), Some("Claude: auth"));
- assert_eq!(presentation.custom_status.as_deref(), Some("middleware"));
assert_eq!(
presentation.state_labels.get("working").map(String::as_str),
Some("deep in the mines")
@@ -679,11 +548,9 @@ mod tests {
applies_to_source: None,
title: Some("Prompt title".into()),
display_agent: None,
- custom_status: None,
state_labels: HashMap::new(),
clear_title: false,
clear_display_agent: false,
- clear_custom_status: false,
clear_state_labels: false,
ttl: None,
seq: None,
@@ -707,27 +574,23 @@ mod tests {
None,
);
- set_metadata_custom_status(
- &mut terminal,
- "user:claude-title",
- Some("claude"),
- Some("herdr:claude"),
- Some("first"),
- false,
- );
- set_metadata_custom_status(
- &mut terminal,
- "user:claude-title",
- Some("claude"),
- Some("herdr:claude"),
- Some("second"),
- false,
- );
+ for title in ["first", "second"] {
+ terminal.set_agent_metadata(AgentMetadataReport {
+ source: "user:claude-title".into(),
+ agent_label: Some("claude".into()),
+ applies_to_source: Some("herdr:claude".into()),
+ title: Some(title.into()),
+ display_agent: None,
+ state_labels: HashMap::new(),
+ clear_title: false,
+ clear_display_agent: false,
+ clear_state_labels: false,
+ ttl: None,
+ seq: None,
+ });
+ }
- assert_eq!(
- terminal.effective_custom_status().as_deref(),
- Some("second")
- );
+ assert_eq!(terminal.effective_title().as_deref(), Some("second"));
}
#[test]
@@ -746,11 +609,9 @@ mod tests {
applies_to_source: Some("herdr:claude".into()),
title: Some("Prompt title".into()),
display_agent: None,
- custom_status: None,
state_labels: HashMap::new(),
clear_title: false,
clear_display_agent: false,
- clear_custom_status: false,
clear_state_labels: false,
ttl: None,
seq: Some(1),
@@ -760,12 +621,10 @@ mod tests {
agent_label: Some("claude".into()),
applies_to_source: Some("herdr:claude".into()),
title: None,
- display_agent: None,
- custom_status: Some("activity".into()),
+ display_agent: Some("Claude activity".into()),
state_labels: HashMap::new(),
clear_title: false,
clear_display_agent: false,
- clear_custom_status: false,
clear_state_labels: false,
ttl: None,
seq: Some(1),
@@ -773,7 +632,10 @@ mod tests {
let presentation = terminal.effective_presentation();
assert_eq!(presentation.title.as_deref(), Some("Prompt title"));
- assert_eq!(presentation.custom_status.as_deref(), Some("activity"));
+ assert_eq!(
+ presentation.display_agent.as_deref(),
+ Some("Claude activity")
+ );
}
#[test]
@@ -792,26 +654,9 @@ mod tests {
applies_to_source: Some("herdr:claude".into()),
title: None,
display_agent: Some("First display".into()),
- custom_status: Some("old".into()),
- state_labels: HashMap::new(),
- clear_title: false,
- clear_display_agent: false,
- clear_custom_status: false,
- clear_state_labels: false,
- ttl: None,
- seq: Some(1),
- });
- terminal.set_agent_metadata(AgentMetadataReport {
- source: "user:second".into(),
- agent_label: Some("claude".into()),
- applies_to_source: Some("herdr:claude".into()),
- title: None,
- display_agent: None,
- custom_status: Some("new".into()),
state_labels: HashMap::new(),
clear_title: false,
clear_display_agent: false,
- clear_custom_status: false,
clear_state_labels: false,
ttl: None,
seq: Some(1),
@@ -822,11 +667,9 @@ mod tests {
applies_to_source: Some("herdr:claude".into()),
title: Some("Fresh title".into()),
display_agent: None,
- custom_status: None,
state_labels: HashMap::new(),
clear_title: false,
clear_display_agent: true,
- clear_custom_status: false,
clear_state_labels: false,
ttl: None,
seq: Some(2),
@@ -835,40 +678,6 @@ mod tests {
let presentation = terminal.effective_presentation();
assert_eq!(presentation.title.as_deref(), Some("Fresh title"));
assert_eq!(presentation.display_agent, None);
- assert_eq!(presentation.custom_status.as_deref(), Some("new"));
- }
-
- #[test]
- fn metadata_can_set_other_fields_while_clearing_missing_source() {
- let mut terminal = test_terminal();
- terminal.set_hook_authority(
- "herdr:claude".into(),
- "claude".into(),
- AgentState::Working,
- None,
- None,
- );
-
- terminal.set_agent_metadata(AgentMetadataReport {
- source: "user:status".into(),
- agent_label: Some("claude".into()),
- applies_to_source: Some("herdr:claude".into()),
- title: None,
- display_agent: None,
- custom_status: Some("activity".into()),
- state_labels: HashMap::new(),
- clear_title: true,
- clear_display_agent: false,
- clear_custom_status: false,
- clear_state_labels: false,
- ttl: None,
- seq: None,
- });
-
- assert_eq!(
- terminal.effective_custom_status().as_deref(),
- Some("activity")
- );
}
#[test]
@@ -887,11 +696,9 @@ mod tests {
applies_to_source: Some("herdr:claude".into()),
title: Some("Old title".into()),
display_agent: None,
- custom_status: Some("old".into()),
state_labels: HashMap::new(),
clear_title: false,
clear_display_agent: false,
- clear_custom_status: false,
clear_state_labels: false,
ttl: Some(Duration::from_millis(1)),
seq: None,
@@ -902,27 +709,25 @@ mod tests {
source: "user:status".into(),
agent_label: Some("claude".into()),
applies_to_source: Some("herdr:claude".into()),
- title: None,
+ title: Some("Fresh title".into()),
display_agent: None,
- custom_status: Some("fresh".into()),
state_labels: HashMap::new(),
- clear_title: true,
+ clear_title: false,
clear_display_agent: false,
- clear_custom_status: false,
clear_state_labels: false,
ttl: None,
seq: None,
});
assert_eq!(terminal.next_agent_metadata_expiry(), None);
- assert_eq!(terminal.effective_custom_status().as_deref(), Some("fresh"));
+ assert_eq!(terminal.effective_title().as_deref(), Some("Fresh title"));
assert!(terminal
.expire_agent_metadata_at(
old_deadline + Duration::from_millis(1),
old_deadline + Duration::from_millis(1)
)
.is_none());
- assert_eq!(terminal.effective_custom_status().as_deref(), Some("fresh"));
+ assert_eq!(terminal.effective_title().as_deref(), Some("Fresh title"));
}
#[test]
@@ -940,12 +745,10 @@ mod tests {
agent_label: Some("claude".into()),
applies_to_source: Some("herdr:claude".into()),
title: Some("Prompt title".into()),
- display_agent: None,
- custom_status: Some("old".into()),
+ display_agent: Some("Old display".into()),
state_labels: HashMap::new(),
clear_title: false,
clear_display_agent: false,
- clear_custom_status: false,
clear_state_labels: false,
ttl: Some(Duration::from_millis(1)),
seq: None,
@@ -958,11 +761,9 @@ mod tests {
applies_to_source: None,
title: None,
display_agent: None,
- custom_status: None,
state_labels: HashMap::new(),
clear_title: false,
- clear_display_agent: false,
- clear_custom_status: true,
+ clear_display_agent: true,
clear_state_labels: false,
ttl: None,
seq: None,
@@ -973,7 +774,7 @@ mod tests {
terminal.effective_presentation().title.as_deref(),
Some("Prompt title")
);
- assert_eq!(terminal.effective_custom_status(), None);
+ assert_eq!(terminal.effective_presentation().display_agent, None);
let mutation = terminal
.expire_agent_metadata_at(old_deadline, old_deadline)
@@ -996,13 +797,11 @@ mod tests {
source: "user:status".into(),
agent_label: Some("claude".into()),
applies_to_source: Some("herdr:claude".into()),
- title: None,
+ title: Some("Activity".into()),
display_agent: None,
- custom_status: Some("activity".into()),
state_labels: HashMap::new(),
clear_title: false,
clear_display_agent: false,
- clear_custom_status: false,
clear_state_labels: false,
ttl: Some(Duration::from_millis(1)),
seq: None,
@@ -1017,11 +816,11 @@ mod tests {
assert_eq!(change.previous_state, AgentState::Working);
assert_eq!(change.state, AgentState::Working);
assert_eq!(
- change.previous_presentation.custom_status.as_deref(),
- Some("activity")
+ change.previous_presentation.title.as_deref(),
+ Some("Activity")
);
- assert_eq!(change.presentation.custom_status, None);
- assert_eq!(terminal.effective_custom_status(), None);
+ assert_eq!(change.presentation.title, None);
+ assert_eq!(terminal.effective_title(), None);
}
#[test]
@@ -1038,13 +837,11 @@ mod tests {
source: "user:status".into(),
agent_label: Some("claude".into()),
applies_to_source: Some("herdr:claude".into()),
- title: None,
+ title: Some("Stale".into()),
display_agent: None,
- custom_status: Some("stale".into()),
state_labels: HashMap::new(),
clear_title: false,
clear_display_agent: false,
- clear_custom_status: false,
clear_state_labels: false,
ttl: Some(Duration::from_millis(1)),
seq: None,
@@ -1055,7 +852,7 @@ mod tests {
.and_then(|metadata| terminal.agent_metadata_expiry(metadata))
.unwrap();
assert_eq!(terminal.next_agent_metadata_expiry(), None);
- assert_eq!(terminal.effective_custom_status(), None);
+ assert_eq!(terminal.effective_title(), None);
terminal.set_hook_authority(
"herdr:claude".into(),
@@ -1071,7 +868,7 @@ mod tests {
assert!(mutation.is_none());
assert!(!terminal.agent_metadata.contains_key("user:status"));
- assert_eq!(terminal.effective_custom_status(), None);
+ assert_eq!(terminal.effective_title(), None);
}
#[test]
@@ -1090,11 +887,9 @@ mod tests {
applies_to_source: Some("herdr:claude".into()),
title: Some("First".into()),
display_agent: None,
- custom_status: None,
state_labels: HashMap::new(),
clear_title: false,
clear_display_agent: false,
- clear_custom_status: false,
clear_state_labels: false,
ttl: Some(Duration::from_millis(1)),
seq: None,
@@ -1106,11 +901,9 @@ mod tests {
applies_to_source: Some("herdr:claude".into()),
title: None,
display_agent: Some("Second".into()),
- custom_status: None,
state_labels: HashMap::new(),
clear_title: false,
clear_display_agent: false,
- clear_custom_status: false,
clear_state_labels: false,
ttl: Some(Duration::from_millis(2)),
seq: None,
@@ -1149,13 +942,11 @@ mod tests {
source: "user:status".into(),
agent_label: Some("claude".into()),
applies_to_source: Some("herdr:claude".into()),
- title: None,
+ title: Some("Instant".into()),
display_agent: None,
- custom_status: Some("instant".into()),
state_labels: HashMap::new(),
clear_title: false,
clear_display_agent: false,
- clear_custom_status: false,
clear_state_labels: false,
ttl: Some(Duration::ZERO),
seq: None,
@@ -1170,11 +961,11 @@ mod tests {
let change = mutation.effective_state_change.unwrap();
assert_eq!(
- change.previous_presentation.custom_status.as_deref(),
- Some("instant")
+ change.previous_presentation.title.as_deref(),
+ Some("Instant")
);
- assert_eq!(change.presentation.custom_status, None);
- assert_eq!(terminal.effective_custom_status(), None);
+ assert_eq!(change.presentation.title, None);
+ assert_eq!(terminal.effective_title(), None);
}
#[test]
@@ -1191,13 +982,11 @@ mod tests {
source: "user:status".into(),
agent_label: Some("claude".into()),
applies_to_source: Some("herdr:claude".into()),
- title: None,
+ title: Some("Instant".into()),
display_agent: None,
- custom_status: Some("instant".into()),
state_labels: HashMap::new(),
clear_title: false,
clear_display_agent: false,
- clear_custom_status: false,
clear_state_labels: false,
ttl: Some(Duration::ZERO),
seq: None,
@@ -1220,7 +1009,7 @@ mod tests {
);
assert_eq!(terminal.next_agent_metadata_expiry(), None);
- assert_eq!(terminal.effective_custom_status(), None);
+ assert_eq!(terminal.effective_title(), None);
}
#[test]
@@ -1239,11 +1028,9 @@ mod tests {
applies_to_source: Some("herdr:claude".into()),
title: Some("Expired title".into()),
display_agent: None,
- custom_status: None,
state_labels: HashMap::new(),
clear_title: false,
clear_display_agent: false,
- clear_custom_status: false,
clear_state_labels: false,
ttl: Some(Duration::ZERO),
seq: None,
@@ -1256,11 +1043,9 @@ mod tests {
applies_to_source: Some("herdr:claude".into()),
title: None,
display_agent: Some("Fresh display".into()),
- custom_status: None,
state_labels: HashMap::new(),
clear_title: false,
clear_display_agent: false,
- clear_custom_status: true,
clear_state_labels: false,
ttl: None,
seq: None,