pub struct StreamingSession { /* private fields */ }Expand description
A live streaming session connected to an agent subprocess.
stdin is piped for sending NDJSON messages, stdout is piped for reading NDJSON events. The session owns the child process.
Implementations§
Source§impl StreamingSession
impl StreamingSession
Sourcepub async fn send(&mut self, message: &str) -> Result<()>
pub async fn send(&mut self, message: &str) -> Result<()>
Send a raw NDJSON line to the agent’s stdin.
The message should be a single JSON object (no trailing newline needed).
Sourcepub async fn send_user_message(&mut self, content: &str) -> Result<()>
pub async fn send_user_message(&mut self, content: &str) -> Result<()>
Send a user message to the agent.
Formats the content as a {"type":"user_message","content":"..."} NDJSON line.
Sourcepub async fn next_event(&mut self) -> Result<Option<Event>>
pub async fn next_event(&mut self) -> Result<Option<Event>>
Read the next event from the agent’s stdout.
Returns None when stdout is closed (agent exited).
Skips lines that fail to parse as JSON events.
Sourcepub fn close_input(&mut self)
pub fn close_input(&mut self)
Close the stdin pipe, signaling no more input to the agent.
Auto Trait Implementations§
impl Freeze for StreamingSession
impl !RefUnwindSafe for StreamingSession
impl Send for StreamingSession
impl Sync for StreamingSession
impl Unpin for StreamingSession
impl UnsafeUnpin for StreamingSession
impl !UnwindSafe for StreamingSession
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