pub struct RemoteSession {
pub transcript: Transcript,
pub state: SessionState,
pub streaming: bool,
pub ready: bool,
pub last_error: Option<String>,
pub retry_attempt: Option<(u32, u32)>,
/* private fields */
}Expand description
Client-side session state: the transcript plus the latest server state.
Fields§
§transcript: Transcript§state: SessionState§streaming: boolTrue between agent_start and agent_end.
ready: boolSet once the server sent its ready line.
last_error: Option<String>Most recent error surfaced locally or by the server.
retry_attempt: Option<(u32, u32)>Number of retries currently being waited on (0 when not retrying).
Implementations§
Source§impl RemoteSession
impl RemoteSession
pub fn new() -> Self
Sourcepub fn on_user_prompt(&mut self, text: impl Into<String>)
pub fn on_user_prompt(&mut self, text: impl Into<String>)
Record a locally-submitted prompt so it renders immediately.
pub fn push_notice(&mut self, text: impl Into<String>)
Sourcepub fn apply_line(&mut self, line: &Value)
pub fn apply_line(&mut self, line: &Value)
Apply a raw child line (ready / event / response) as forwarded by the
server’s event notifications.
Sourcepub fn apply_response(&mut self, response: &RemoteResponse)
pub fn apply_response(&mut self, response: &RemoteResponse)
Apply a decoded response (e.g. to a get_state command).
Sourcepub fn apply_event(&mut self, event: &RemoteEvent)
pub fn apply_event(&mut self, event: &RemoteEvent)
Fold one lifecycle event into the transcript.
Trait Implementations§
Source§impl Clone for RemoteSession
impl Clone for RemoteSession
Source§impl Debug for RemoteSession
impl Debug for RemoteSession
Auto Trait Implementations§
impl Freeze for RemoteSession
impl RefUnwindSafe for RemoteSession
impl Send for RemoteSession
impl Sync for RemoteSession
impl Unpin for RemoteSession
impl UnsafeUnpin for RemoteSession
impl UnwindSafe for RemoteSession
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().