pub struct SessionTranscript { /* private fields */ }Expand description
Ordered transcript view assembled from persisted session messages.
Implementations§
Source§impl SessionTranscript
impl SessionTranscript
Sourcepub fn new(messages: Vec<SessionMessage>) -> Self
pub fn new(messages: Vec<SessionMessage>) -> Self
Creates an ordered transcript from persisted messages.
Sourcepub fn ephemeral(messages: Vec<SessionMessage>) -> Self
pub fn ephemeral(messages: Vec<SessionMessage>) -> Self
Creates an isolated projection for task-owned host effects. Messages appended here must never enter the owning session’s ordinary history.
Sourcepub fn should_persist(&self) -> bool
pub fn should_persist(&self) -> bool
Whether host append operations may persist into ordinary session history.
Sourcepub fn messages(&self) -> &[SessionMessage]
pub fn messages(&self) -> &[SessionMessage]
Returns the ordered transcript messages.
Sourcepub fn content_hash(&self) -> u64
pub fn content_hash(&self) -> u64
Returns the cached content identity for render and projection caches.
Sourcepub fn total_content_len(&self) -> usize
pub fn total_content_len(&self) -> usize
Returns the total byte length of message content in this transcript.
Sourcepub fn append_message(&mut self, kind: SessionMessageKind, content: &str)
pub fn append_message(&mut self, kind: SessionMessageKind, content: &str)
Appends one message after the ordered transcript tail using the same content normalization as durable storage.
Self::new sorts persisted input before this method derives the next
position, so the message slice and its cached content hash retain the
same ordering as a newly reconstructed transcript.
The content hash is extended with only the appended message, so each append costs time proportional to that message rather than the whole transcript.
Sourcepub fn replay_text(&self) -> Option<String>
pub fn replay_text(&self) -> Option<String>
Returns formatted transcript text for replay when content exists.
User and assistant rows store raw content, so replay injects the prompt marker and transcript spacing only for display and provider replay.
Sourcepub fn provider_replay_text(&self) -> Option<String>
pub fn provider_replay_text(&self) -> Option<String>
Returns Self::replay_text for a provider: without the notices that
only tell the user how Agentty ran a turn, such as context compaction
and sandbox
notices, which would mislead a model reading the full history.
Sourcepub fn conversation_replay_text(&self) -> Option<String>
pub fn conversation_replay_text(&self) -> Option<String>
Returns formatted user and assistant transcript text when any conversation messages exist.
Sourcepub fn display_text_for_messages(messages: &[SessionMessage]) -> String
pub fn display_text_for_messages(messages: &[SessionMessage]) -> String
Formats an ordered message slice using canonical transcript display markers and spacing.
Unlike Self::new, this method preserves the caller-provided order.
It is useful when rendering a selected subset of an existing transcript
without constructing another transcript aggregate.
Trait Implementations§
Source§impl Clone for SessionTranscript
impl Clone for SessionTranscript
Source§impl Debug for SessionTranscript
impl Debug for SessionTranscript
Source§impl Default for SessionTranscript
impl Default for SessionTranscript
impl Eq for SessionTranscript
Source§impl PartialEq for SessionTranscript
impl PartialEq for SessionTranscript
impl StructuralPartialEq for SessionTranscript
Auto Trait Implementations§
impl Forget for SessionTranscript
impl Freeze for SessionTranscript
impl Move for SessionTranscript
impl RefUnwindSafe for SessionTranscript
impl Send for SessionTranscript
impl Sync for SessionTranscript
impl Unpin for SessionTranscript
impl UnsafeUnpin for SessionTranscript
impl UnwindSafe for SessionTranscript
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.