pub struct ConversationWatcher { /* private fields */ }Expand description
Watches a Gemini conversation for new turns and tool-call updates.
§Example
use toolpath_gemini::{GeminiConvo, ConversationWatcher};
use toolpath_convo::WatcherEvent;
let manager = GeminiConvo::new();
let mut watcher = ConversationWatcher::new(
manager,
"/path/to/project".to_string(),
"session-uuid".to_string(),
);
let events = watcher.poll().unwrap();
for event in events {
match event {
WatcherEvent::Turn(t) => println!("new: {}", t.text),
WatcherEvent::TurnUpdated(t) => println!("updated: {}", t.id),
WatcherEvent::Progress { kind, data } => println!("{}: {}", kind, data),
}
}Implementations§
Source§impl ConversationWatcher
impl ConversationWatcher
pub fn new(manager: GeminiConvo, project: String, session_uuid: String) -> Self
pub fn project(&self) -> &str
pub fn session_uuid(&self) -> &str
Sourcepub fn seen_count(&self) -> usize
pub fn seen_count(&self) -> usize
Total turns emitted so far across all chat files in this session.
Sourcepub fn poll(&mut self) -> Result<Vec<WatcherEvent>>
pub fn poll(&mut self) -> Result<Vec<WatcherEvent>>
Poll for new events.
On the first call, emits one Turn event per existing message,
plus one subagent_started/subagent_complete per pre-existing
sub-agent file. Subsequent calls emit only new messages, status
updates, and new sub-agent files.
Sourcepub fn poll_with_view(
&mut self,
) -> Result<(ConversationView, Vec<WatcherEvent>)>
pub fn poll_with_view( &mut self, ) -> Result<(ConversationView, Vec<WatcherEvent>)>
Re-read the full session and return a fresh ConversationView
along with the new events emitted since the last poll.
Useful when consumers need both the delta and the full state.
Trait Implementations§
Source§impl ConversationWatcher for ConversationWatcher
impl ConversationWatcher for ConversationWatcher
Source§fn seen_count(&self) -> usize
fn seen_count(&self) -> usize
Number of turns seen so far.
Auto Trait Implementations§
impl Freeze for ConversationWatcher
impl RefUnwindSafe for ConversationWatcher
impl Send for ConversationWatcher
impl Sync for ConversationWatcher
impl Unpin for ConversationWatcher
impl UnsafeUnpin for ConversationWatcher
impl UnwindSafe for ConversationWatcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more