Skip to main content

ConversationWatcher

Struct ConversationWatcher 

Source
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

Source

pub fn new(manager: GeminiConvo, project: String, session_uuid: String) -> Self

Source

pub fn project(&self) -> &str

Source

pub fn session_uuid(&self) -> &str

Source

pub fn seen_count(&self) -> usize

Total turns emitted so far across all chat files in this session.

Source

pub fn reset(&mut self)

Reset state so the next poll returns all messages from scratch.

Source

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.

Source

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

Source§

fn poll(&mut self) -> Result<Vec<WatcherEvent>>

Poll for new events since the last poll.
Source§

fn seen_count(&self) -> usize

Number of turns seen so far.
Source§

impl Debug for ConversationWatcher

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.