aboutsummaryrefslogtreecommitdiff
path: root/src/terminal/state.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/state.rs
parent7f3364a468f7dcfd8c9c84e5737fe5699f0e3a93 (diff)
feat: add configurable sidebar metadata tokens
Diffstat (limited to 'src/terminal/state.rs')
-rw-r--r--src/terminal/state.rs229
1 files changed, 65 insertions, 164 deletions
diff --git a/src/terminal/state.rs b/src/terminal/state.rs
index 2b17404a..632558fd 100644
--- a/src/terminal/state.rs
+++ b/src/terminal/state.rs
@@ -22,7 +22,6 @@ pub struct HookAuthority {
pub agent_label: String,
pub state: AgentState,
pub message: Option<String>,
- pub custom_status: Option<String>,
pub reported_at: Instant,
pub session_ref: Option<crate::agent_resume::AgentSessionRef>,
}
@@ -59,6 +58,12 @@ pub struct EffectiveStateChange {
pub presentation: EffectivePresentation,
}
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
+pub(crate) struct TerminalTitleChange {
+ pub(crate) raw_changed: bool,
+ pub(crate) stripped_changed: bool,
+}
+
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub struct TerminalStateMutation {
pub effective_state_change: Option<EffectiveStateChange>,
@@ -79,13 +84,16 @@ pub struct TerminalState {
fallback_observed_at: Option<Instant>,
pub hook_authority: Option<HookAuthority>,
pub agent_metadata: HashMap<String, AgentMetadata>,
+ pub metadata_tokens: crate::metadata_tokens::MetadataTokens,
pub persisted_agent_session: Option<crate::agent_resume::PersistedAgentSession>,
+ pub terminal_title: Option<String>,
pub manual_label: Option<String>,
pub agent_name: Option<String>,
hook_report_sequences: HashMap<String, u64>,
suppressed_full_lifecycle_hook_reports: HashMap<String, SuppressedFullLifecycleHookReport>,
stale_full_lifecycle_hook_sessions: HashMap<String, Vec<StaleFullLifecycleHookSession>>,
metadata_report_sequences: HashMap<String, u64>,
+ metadata_token_sequence_sources: std::collections::HashSet<String>,
pub state: AgentState,
pub last_agent_state_change_seq: Option<u64>,
pub revision: u64,
@@ -106,13 +114,16 @@ impl TerminalState {
fallback_observed_at: None,
hook_authority: None,
agent_metadata: HashMap::new(),
+ metadata_tokens: crate::metadata_tokens::MetadataTokens::default(),
persisted_agent_session: None,
+ terminal_title: None,
manual_label: None,
agent_name: None,
hook_report_sequences: HashMap::new(),
suppressed_full_lifecycle_hook_reports: HashMap::new(),
stale_full_lifecycle_hook_sessions: HashMap::new(),
metadata_report_sequences: HashMap::new(),
+ metadata_token_sequence_sources: std::collections::HashSet::new(),
state: AgentState::Unknown,
last_agent_state_change_seq: None,
revision: 0,
@@ -123,6 +134,28 @@ impl TerminalState {
}
}
+ pub(crate) fn terminal_title_stripped(&self) -> Option<String> {
+ self.terminal_title
+ .as_deref()
+ .and_then(super::stripped_terminal_title)
+ }
+
+ pub(crate) fn set_terminal_title(&mut self, title: Option<String>) -> TerminalTitleChange {
+ if self.terminal_title == title {
+ return TerminalTitleChange::default();
+ }
+ let previous_stripped = self.terminal_title_stripped();
+ self.terminal_title = title;
+ let stripped_changed = previous_stripped != self.terminal_title_stripped();
+ if stripped_changed {
+ self.revision = self.revision.wrapping_add(1);
+ }
+ TerminalTitleChange {
+ raw_changed: true,
+ stripped_changed,
+ }
+ }
+
pub fn with_launch_argv(mut self, argv: Vec<String>) -> Self {
self.launch_argv = Some(argv);
self
@@ -331,25 +364,11 @@ impl TerminalState {
message: Option<String>,
seq: Option<u64>,
) -> Option<EffectiveStateChange> {
- self.set_hook_authority_with_custom_status(source, agent_label, state, message, None, seq)
- }
-
- #[cfg(test)]
- pub fn set_hook_authority_with_custom_status(
- &mut self,
- source: String,
- agent_label: String,
- state: AgentState,
- message: Option<String>,
- custom_status: Option<String>,
- seq: Option<u64>,
- ) -> Option<EffectiveStateChange> {
- self.set_hook_authority_with_custom_status_at(
+ self.set_hook_authority_at(
source,
agent_label,
state,
message,
- custom_status,
None,
seq,
Instant::now(),
@@ -363,29 +382,26 @@ impl TerminalState {
agent_label: String,
state: AgentState,
message: Option<String>,
- custom_status: Option<String>,
session_ref: Option<crate::agent_resume::AgentSessionRef>,
seq: Option<u64>,
) -> Option<TerminalStateMutation> {
- self.set_hook_authority_with_custom_status_at(
+ self.set_hook_authority_at(
source,
agent_label,
state,
message,
- custom_status,
session_ref,
seq,
Instant::now(),
)
}
- pub fn set_hook_authority_with_custom_status_at(
+ pub fn set_hook_authority_at(
&mut self,
source: String,
agent_label: String,
state: AgentState,
message: Option<String>,
- custom_status: Option<String>,
session_ref: Option<crate::agent_resume::AgentSessionRef>,
seq: Option<u64>,
now: Instant,
@@ -476,7 +492,6 @@ impl TerminalState {
agent_label,
state,
message,
- custom_status,
reported_at: now,
session_ref,
});
@@ -1524,7 +1539,6 @@ mod tests {
"pi".into(),
AgentState::Idle,
None,
- None,
crate::agent_resume::AgentSessionRef::path(old_session),
Some(10),
);
@@ -1548,7 +1562,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(new_session.clone()),
Some(12),
);
@@ -1576,7 +1589,6 @@ mod tests {
"pi".into(),
AgentState::Idle,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_a.clone()),
Some(10),
);
@@ -1593,7 +1605,6 @@ mod tests {
"pi".into(),
AgentState::Idle,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_b.clone()),
Some(12),
);
@@ -1610,7 +1621,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_a.clone()),
Some(14),
);
@@ -1628,7 +1638,6 @@ mod tests {
"pi".into(),
AgentState::Idle,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_b),
Some(15),
);
@@ -1681,7 +1690,6 @@ mod tests {
"pi".into(),
AgentState::Idle,
None,
- None,
crate::agent_resume::AgentSessionRef::path(old_session.clone()),
Some(10),
);
@@ -1698,7 +1706,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(new_session),
Some(12),
);
@@ -1725,7 +1732,6 @@ mod tests {
"omp".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(old_session.clone()),
Some(10),
);
@@ -1754,7 +1760,6 @@ mod tests {
"omp".into(),
AgentState::Blocked,
Some("waiting".into()),
- None,
crate::agent_resume::AgentSessionRef::path(new_session.clone()),
Some(12),
);
@@ -1771,7 +1776,6 @@ mod tests {
"omp".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(old_session),
Some(13),
);
@@ -1785,13 +1789,12 @@ mod tests {
let now = Instant::now();
let mut terminal = test_terminal();
terminal.set_detected_state(Some(Agent::Pi), AgentState::Working);
- terminal.set_hook_authority_with_custom_status_at(
+ terminal.set_hook_authority_at(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
None,
- None,
Some(10),
now,
);
@@ -1813,13 +1816,12 @@ mod tests {
AgentState::Working
);
- let stale = terminal.set_hook_authority_with_custom_status_at(
+ let stale = terminal.set_hook_authority_at(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
None,
- None,
Some(9),
now + Duration::from_millis(2),
);
@@ -1833,13 +1835,12 @@ mod tests {
let now = Instant::now();
let mut terminal = test_terminal();
terminal.set_detected_state(Some(Agent::Pi), AgentState::Working);
- terminal.set_hook_authority_with_custom_status_at(
+ terminal.set_hook_authority_at(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
None,
- None,
Some(20),
now,
);
@@ -1853,12 +1854,11 @@ mod tests {
true,
now + Duration::from_millis(1),
);
- let late = terminal.set_hook_authority_with_custom_status_at(
+ let late = terminal.set_hook_authority_at(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
- Some("late".into()),
None,
Some(21),
now + Duration::from_millis(2),
@@ -1881,7 +1881,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_path.clone()),
Some(20),
);
@@ -1900,7 +1899,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- Some("late".into()),
crate::agent_resume::AgentSessionRef::path(session_path),
Some(21),
);
@@ -1946,7 +1944,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_path.clone()),
Some(20),
);
@@ -1957,7 +1954,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_path),
Some(22),
);
@@ -1976,7 +1972,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(test_session_path("old.jsonl")),
Some(20),
);
@@ -1987,7 +1982,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(test_session_path("new.jsonl")),
Some(22),
);
@@ -2006,7 +2000,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(test_session_path("old.jsonl")),
Some(1000),
);
@@ -2017,7 +2010,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(test_session_path("new.jsonl")),
Some(1500),
);
@@ -2039,7 +2031,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_a.clone()),
Some(1000),
);
@@ -2050,7 +2041,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_b),
Some(1500),
);
@@ -2062,7 +2052,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- Some("late".into()),
crate::agent_resume::AgentSessionRef::path(session_a),
Some(2500),
);
@@ -2071,7 +2060,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_c),
Some(2500),
);
@@ -2091,7 +2079,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(test_session_path("one.jsonl")),
Some(20),
);
@@ -2101,7 +2088,6 @@ mod tests {
"pi".into(),
AgentState::Idle,
None,
- None,
crate::agent_resume::AgentSessionRef::path(test_session_path("two.jsonl")),
Some(21),
);
@@ -2219,7 +2205,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(old_session.clone()),
Some(1000),
);
@@ -2259,7 +2244,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- Some("late".into()),
crate::agent_resume::AgentSessionRef::path(old_session),
Some(500),
);
@@ -2268,7 +2252,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(new_session),
Some(500),
);
@@ -2286,12 +2269,11 @@ mod tests {
let new_session = test_session_path("new-after-process-exit.jsonl");
let now = Instant::now();
terminal.set_detected_state(Some(Agent::Pi), AgentState::Idle);
- terminal.set_hook_authority_with_custom_status_at(
+ terminal.set_hook_authority_at(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(old_session),
Some(1000),
now,
@@ -2306,12 +2288,11 @@ mod tests {
now + Duration::from_millis(1),
);
- let early_new = terminal.set_hook_authority_with_custom_status_at(
+ let early_new = terminal.set_hook_authority_at(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(new_session.clone()),
Some(500),
now + Duration::from_millis(2),
@@ -2338,12 +2319,11 @@ mod tests {
false,
now + Duration::from_millis(4),
);
- let fresh_new = terminal.set_hook_authority_with_custom_status_at(
+ let fresh_new = terminal.set_hook_authority_at(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(new_session),
Some(500),
now + Duration::from_millis(5),
@@ -2360,12 +2340,11 @@ mod tests {
let old_session = test_session_path("old-before-nosession-process-exit.jsonl");
let now = Instant::now();
terminal.set_detected_state(Some(Agent::Pi), AgentState::Idle);
- terminal.set_hook_authority_with_custom_status_at(
+ terminal.set_hook_authority_at(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(old_session),
Some(1000),
now,
@@ -2380,13 +2359,12 @@ mod tests {
now + Duration::from_millis(1),
);
- let early_without_session = terminal.set_hook_authority_with_custom_status_at(
+ let early_without_session = terminal.set_hook_authority_at(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
None,
- None,
Some(500),
now + Duration::from_millis(2),
);
@@ -2412,13 +2390,12 @@ mod tests {
false,
now + Duration::from_millis(4),
);
- let fresh_without_session = terminal.set_hook_authority_with_custom_status_at(
+ let fresh_without_session = terminal.set_hook_authority_at(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
None,
- None,
Some(500),
now + Duration::from_millis(5),
);
@@ -2436,12 +2413,11 @@ mod tests {
let session_c = test_session_path("generation-c.jsonl");
let now = Instant::now();
terminal.set_detected_state(Some(Agent::Pi), AgentState::Idle);
- terminal.set_hook_authority_with_custom_status_at(
+ terminal.set_hook_authority_at(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_a.clone()),
Some(1000),
now,
@@ -2474,12 +2450,11 @@ mod tests {
false,
now + Duration::from_millis(3),
);
- let generation_b = terminal.set_hook_authority_with_custom_status_at(
+ let generation_b = terminal.set_hook_authority_at(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_b),
Some(500),
now + Duration::from_millis(4),
@@ -2514,22 +2489,20 @@ mod tests {
now + Duration::from_millis(7),
);
- let late_generation_a = terminal.set_hook_authority_with_custom_status_at(
+ let late_generation_a = terminal.set_hook_authority_at(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
- Some("late".into()),
crate::agent_resume::AgentSessionRef::path(session_a),
Some(250),
now + Duration::from_millis(8),
);
- let generation_c = terminal.set_hook_authority_with_custom_status_at(
+ let generation_c = terminal.set_hook_authority_at(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_c),
Some(250),
now + Duration::from_millis(9),
@@ -2596,7 +2569,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::id("fresh-session"),
Some(22),
);
@@ -2638,7 +2610,6 @@ mod tests {
"mastracode".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::id("mastracode-new"),
Some(20),
)
@@ -2669,7 +2640,6 @@ mod tests {
agent_label.into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::id(&old_session),
Some(20),
);
@@ -2682,7 +2652,6 @@ mod tests {
agent_label.into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::id(&old_session),
Some(22),
);
@@ -2695,7 +2664,6 @@ mod tests {
agent_label.into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::id(&new_session),
Some(23),
);
@@ -2709,12 +2677,11 @@ mod tests {
let now = Instant::now();
let mut terminal = test_terminal();
terminal.set_detected_state(Some(Agent::Omp), AgentState::Idle);
- terminal.set_hook_authority_with_custom_status_at(
+ terminal.set_hook_authority_at(
"herdr:omp".into(),
"omp".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::id("omp-old"),
Some(1000),
now,
@@ -2734,7 +2701,6 @@ mod tests {
"omp".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::id("omp-old"),
Some(500),
);
@@ -2764,7 +2730,6 @@ mod tests {
"omp".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::id("omp-new"),
Some(500),
);
@@ -2898,41 +2863,15 @@ mod tests {
}
#[test]
- fn visible_blocker_suppresses_stale_hook_custom_status() {
- let mut terminal = test_terminal();
- terminal.set_detected_state(Some(Agent::Codex), AgentState::Idle);
- terminal.set_hook_authority_with_custom_status(
- "herdr:codex".into(),
- "codex".into(),
- AgentState::Working,
- None,
- Some("planning".into()),
- None,
- );
-
- terminal.set_detected_state_with_visible_blocker(
- Some(Agent::Codex),
- AgentState::Blocked,
- true,
- false,
- false,
- );
-
- assert_eq!(terminal.state, AgentState::Blocked);
- assert_eq!(terminal.effective_custom_status(), None);
- }
-
- #[test]
fn fallback_idle_does_not_override_hook_working() {
let now = Instant::now();
let mut terminal = test_terminal();
terminal.set_detected_state(Some(Agent::Claude), AgentState::Working);
- terminal.set_hook_authority_with_custom_status_at(
+ terminal.set_hook_authority_at(
"herdr:claude".into(),
"claude".into(),
AgentState::Working,
None,
- Some("thinking".into()),
None,
None,
now,
@@ -2950,10 +2889,6 @@ mod tests {
assert_eq!(terminal.fallback_state, AgentState::Idle);
assert_eq!(terminal.state, AgentState::Working);
- assert_eq!(
- terminal.effective_custom_status().as_deref(),
- Some("thinking")
- );
}
#[test]
@@ -2961,12 +2896,11 @@ mod tests {
let now = Instant::now();
let mut terminal = test_terminal();
terminal.set_detected_state(Some(Agent::OpenCode), AgentState::Working);
- terminal.set_hook_authority_with_custom_status_at(
+ terminal.set_hook_authority_at(
"herdr:opencode".into(),
"opencode".into(),
AgentState::Working,
None,
- Some("thinking".into()),
None,
None,
now,
@@ -2983,10 +2917,6 @@ mod tests {
assert_eq!(terminal.fallback_state, AgentState::Working);
assert_eq!(terminal.state, AgentState::Working);
- assert_eq!(
- terminal.effective_custom_status().as_deref(),
- Some("thinking")
- );
}
#[test]
@@ -2994,14 +2924,13 @@ mod tests {
let now = Instant::now();
let mut terminal = test_terminal();
terminal.set_detected_state(Some(Agent::Claude), AgentState::Idle);
- terminal.set_hook_authority_with_custom_status_at(
+ terminal.set_hook_authority_at(
"herdr:claude".into(),
"claude".into(),
AgentState::Idle,
None,
None,
None,
- None,
now,
);
@@ -3025,14 +2954,13 @@ mod tests {
let now = Instant::now();
let mut terminal = test_terminal();
terminal.set_detected_state(Some(Agent::Hermes), AgentState::Idle);
- terminal.set_hook_authority_with_custom_status_at(
+ terminal.set_hook_authority_at(
"herdr:hermes".into(),
"hermes".into(),
AgentState::Idle,
None,
None,
None,
- None,
now,
);
@@ -3056,14 +2984,13 @@ mod tests {
let now = Instant::now();
let mut terminal = test_terminal();
terminal.set_detected_state(Some(Agent::Kilo), AgentState::Idle);
- terminal.set_hook_authority_with_custom_status_at(
+ terminal.set_hook_authority_at(
"herdr:kilo".into(),
"kilo".into(),
AgentState::Idle,
None,
None,
None,
- None,
now,
);
@@ -3096,14 +3023,13 @@ mod tests {
now,
);
- let change = terminal.set_hook_authority_with_custom_status_at(
+ let change = terminal.set_hook_authority_at(
"herdr:claude".into(),
"claude".into(),
AgentState::Idle,
None,
None,
None,
- None,
now + Duration::from_millis(100),
);
@@ -3131,12 +3057,11 @@ mod tests {
false,
now,
);
- terminal.set_hook_authority_with_custom_status_at(
+ terminal.set_hook_authority_at(
"herdr:codex".into(),
"codex".into(),
AgentState::Blocked,
None,
- Some("permission".into()),
None,
None,
now + Duration::from_millis(1201),
@@ -3156,10 +3081,6 @@ mod tests {
assert_eq!(terminal.fallback_state, AgentState::Working);
assert_eq!(terminal.state, AgentState::Blocked);
- assert_eq!(
- terminal.effective_custom_status().as_deref(),
- Some("permission")
- );
assert!(change.effective_state_change.is_none());
}
@@ -3271,14 +3192,13 @@ mod tests {
let now = Instant::now();
let mut terminal = test_terminal();
terminal.set_detected_state(Some(Agent::Pi), AgentState::Idle);
- terminal.set_hook_authority_with_custom_status_at(
+ terminal.set_hook_authority_at(
"herdr:pi".into(),
"pi".into(),
AgentState::Working,
None,
None,
None,
- None,
now,
);
@@ -3379,13 +3299,12 @@ mod tests {
false,
observed,
);
- terminal.set_hook_authority_with_custom_status_at(
+ terminal.set_hook_authority_at(
"herdr:claude".into(),
"claude".into(),
AgentState::Working,
None,
None,
- None,
Some(1),
observed + Duration::from_secs(1),
);
@@ -3416,22 +3335,20 @@ mod tests {
false,
observed,
);
- terminal.set_hook_authority_with_custom_status_at(
+ terminal.set_hook_authority_at(
"herdr:codex".into(),
"codex".into(),
AgentState::Working,
None,
None,
- None,
Some(1),
observed,
);
- terminal.set_hook_authority_with_custom_status_at(
+ terminal.set_hook_authority_at(
"herdr:codex".into(),
"codex".into(),
AgentState::Working,
None,
- Some("new turn".into()),
None,
Some(2),
observed + Duration::from_secs(1),
@@ -3448,7 +3365,7 @@ mod tests {
);
let authority = terminal.hook_authority.as_ref().expect("hook authority");
- assert_eq!(authority.custom_status.as_deref(), Some("new turn"));
+ assert_eq!(authority.reported_at, observed + Duration::from_secs(1));
assert_eq!(terminal.state, AgentState::Working);
assert_eq!(terminal.effective_agent_label(), Some("codex"));
}
@@ -3530,7 +3447,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_path.clone()),
Some(20),
)
@@ -3560,7 +3476,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_path.clone()),
Some(20),
);
@@ -3570,7 +3485,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(new_session_path),
Some(19),
);
@@ -3595,7 +3509,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_path),
Some(20),
);
@@ -3607,7 +3520,6 @@ mod tests {
AgentState::Working,
None,
None,
- None,
Some(21),
)
.expect("accepted report");
@@ -3638,7 +3550,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(test_session_path("new.jsonl")),
Some(20),
)
@@ -4019,12 +3930,11 @@ mod tests {
let mut terminal = test_terminal();
let now = std::time::Instant::now();
terminal
- .set_hook_authority_with_custom_status_at(
+ .set_hook_authority_at(
"herdr:opencode".into(),
"opencode".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::id("opencode-session"),
Some(20),
now + Duration::from_millis(1),
@@ -4066,7 +3976,6 @@ mod tests {
"opencode".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::id("opencode-session"),
Some(22),
);
@@ -4078,7 +3987,6 @@ mod tests {
"opencode".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::id("opencode-new-session"),
Some(23),
);
@@ -4102,7 +4010,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path("/tmp/pi-session.jsonl"),
Some(21),
);
@@ -4152,7 +4059,6 @@ mod tests {
"opencode".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::id("opencode-session"),
Some(20),
)
@@ -4164,7 +4070,6 @@ mod tests {
"opencode".into(),
AgentState::Blocked,
Some("needs approval".into()),
- None,
crate::agent_resume::AgentSessionRef::id("nested-session"),
Some(21),
)
@@ -4224,7 +4129,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_path),
Some(20),
);
@@ -4246,7 +4150,6 @@ mod tests {
"pi".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::path(session_path),
Some(20),
);
@@ -4419,7 +4322,6 @@ mod tests {
"claude".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::id("claude-session"),
Some(20),
);
@@ -4448,7 +4350,6 @@ mod tests {
"hermes".into(),
AgentState::Working,
None,
- None,
crate::agent_resume::AgentSessionRef::id("hermes-session"),
Some(20),
);