pub struct StreamTracker { /* private fields */ }Expand description
The authoritative session-state machine over one wrapped claude process.
Feed it every line of both stdio directions; it returns an ObserveRequest
exactly when the session’s effective state changes, so a long turn costs one
report at its start and one at its end rather than one per streamed token.
Implementations§
Source§impl StreamTracker
impl StreamTracker
Sourcepub fn session_id(&self) -> Option<&str>
pub fn session_id(&self) -> Option<&str>
The session id, once a line has carried one.
Sourcepub fn observe_line(
&mut self,
direction: Direction,
line: &str,
) -> Option<ObserveRequest>
pub fn observe_line( &mut self, direction: Direction, line: &str, ) -> Option<ObserveRequest>
Feeds one stdio line and returns a sighting when the effective state changed as a result.
Returns None for every line that is unparseable, unrecognized, seen
before the session id is known, or that leaves the state unchanged.
Sourcepub fn keepalive(&self) -> Option<ObserveRequest>
pub fn keepalive(&self) -> Option<ObserveRequest>
Re-reports the current state, so a session that has been silent for a while does not age out of the registry on its TTL.
The wrapper lives exactly as long as the claude process does, so this
is real liveness rather than the activity-based approximation the hook and
transcript feeds are limited to.