pub struct TurnPrompt {
pub attachments: Vec<TurnPromptAttachment>,
pub text: String,
pub text_source: TurnPromptTextSource,
}Expand description
Structured prompt payload for one agent turn.
Fields§
§attachments: Vec<TurnPromptAttachment>Ordered local image attachments referenced by text.
text: StringPrompt text payload, including inline placeholders when present.
text_source: TurnPromptTextSourceSource classification that controls prompt-only text rewrites.
Implementations§
Source§impl TurnPrompt
impl TurnPrompt
Sourcepub fn from_text(text: String) -> TurnPrompt
pub fn from_text(text: String) -> TurnPrompt
Creates a text-only prompt payload.
Sourcepub fn from_agent_data(text: String) -> TurnPrompt
pub fn from_agent_data(text: String) -> TurnPrompt
Creates a generated-data prompt payload that is sent to the agent
without user prompt @path lookup rewriting.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns whether the payload contains no text and no attachments.
Sourcepub fn has_attachments(&self) -> bool
pub fn has_attachments(&self) -> bool
Returns whether the payload contains one or more image attachments.
Sourcepub fn local_image_paths(&self) -> impl Iterator<Item = &PathBuf>
pub fn local_image_paths(&self) -> impl Iterator<Item = &PathBuf>
Returns the local image paths referenced by this prompt payload.
Sourcepub fn ends_with(&self, suffix: &str) -> bool
pub fn ends_with(&self, suffix: &str) -> bool
Returns whether the prompt text ends with suffix.
Sourcepub fn agent_text(&self) -> String
pub fn agent_text(&self) -> String
Returns the prompt text as it should be sent to an agent runtime.
User-authored @path lookups are rewritten to quoted path tokens for
transport. Generated agent data is returned unchanged so source content
such as Python decorators keeps its leading @.
Sourcepub fn content_parts(&self) -> Vec<TurnPromptContentPart<'_>>
pub fn content_parts(&self) -> Vec<TurnPromptContentPart<'_>>
Returns prompt text spans and image attachments in transport order.
Attachments are ordered by their placeholder position in text. Any
attachment whose placeholder no longer exists in the text is appended
after the trailing text so transports can still serialize the image
instead of dropping it silently.
Sourcepub fn transcript_text(&self) -> String
pub fn transcript_text(&self) -> String
Returns the prompt text as it should be written into persisted transcripts.
Inline [Image #n] markers are preserved verbatim. If attachment
metadata somehow survives without its placeholder still present in the
text, the missing placeholders are appended in attachment order so the
transcript does not silently become text-only.
Trait Implementations§
Source§impl Clone for TurnPrompt
impl Clone for TurnPrompt
Source§fn clone(&self) -> TurnPrompt
fn clone(&self) -> TurnPrompt
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TurnPrompt
impl Debug for TurnPrompt
Source§impl<'de> Deserialize<'de> for TurnPrompt
impl<'de> Deserialize<'de> for TurnPrompt
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TurnPrompt, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TurnPrompt, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for TurnPrompt
impl Display for TurnPrompt
impl Eq for TurnPrompt
Source§impl From<&TurnPrompt> for TurnPrompt
impl From<&TurnPrompt> for TurnPrompt
Source§fn from(prompt: &TurnPrompt) -> TurnPrompt
fn from(prompt: &TurnPrompt) -> TurnPrompt
Source§impl From<&str> for TurnPrompt
impl From<&str> for TurnPrompt
Source§fn from(text: &str) -> TurnPrompt
fn from(text: &str) -> TurnPrompt
Source§impl From<String> for TurnPrompt
impl From<String> for TurnPrompt
Source§fn from(text: String) -> TurnPrompt
fn from(text: String) -> TurnPrompt
Source§impl PartialEq for TurnPrompt
impl PartialEq for TurnPrompt
Source§fn eq(&self, other: &TurnPrompt) -> bool
fn eq(&self, other: &TurnPrompt) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialEq<&str> for TurnPrompt
impl PartialEq<&str> for TurnPrompt
Source§impl PartialEq<TurnPrompt> for &str
impl PartialEq<TurnPrompt> for &str
Source§fn eq(&self, other: &TurnPrompt) -> bool
fn eq(&self, other: &TurnPrompt) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for TurnPrompt
impl Serialize for TurnPrompt
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for TurnPrompt
Auto Trait Implementations§
impl Freeze for TurnPrompt
impl RefUnwindSafe for TurnPrompt
impl Send for TurnPrompt
impl Sync for TurnPrompt
impl Unpin for TurnPrompt
impl UnsafeUnpin for TurnPrompt
impl UnwindSafe for TurnPrompt
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.