pub struct UserMessage {
pub kind: String,
pub message: UserMessageBody,
pub parent_tool_use_id: Option<String>,
pub uuid: String,
pub priority: Option<Priority>,
pub should_query: Option<bool>,
pub timestamp: Option<String>,
pub client_composed: Option<bool>,
}Expand description
A user turn. Source: _internal/client.py:126–131
Fields§
§kind: String§message: UserMessageBody§parent_tool_use_id: Option<String>§uuid: StringEchoed back (isReplay: true) when the CLI starts this message’s turn,
because the session runs with --replay-user-messages.
priority: Option<Priority>§should_query: Option<bool>Some(false): append to the conversation without starting a turn.
timestamp: Option<String>ISO 8601 time the message was created. Part of the wire schema, but CLI 2.1.329 records its own receive time in the echo and transcript.
client_composed: Option<bool>Some(true): the host composed this text (the user did not type it).
The CLI delivers it as written: no @path expansion, no slash-command
dispatch, and no turn-start context attachments.
Implementations§
Source§impl UserMessage
impl UserMessage
pub fn text(content: impl Into<String>) -> Self
Sourcepub fn blocks(content: Vec<ContentBlock>) -> Self
pub fn blocks(content: Vec<ContentBlock>) -> Self
A message with several blocks, e.g. text plus images.
Sourcepub fn with_timestamp(self, timestamp: impl Into<String>) -> Self
pub fn with_timestamp(self, timestamp: impl Into<String>) -> Self
Creation time as an ISO 8601 string, e.g. “2026-11-20T07:03:32.670Z”.
Sourcepub fn client_composed(self) -> Self
pub fn client_composed(self) -> Self
Mark the text as host-composed: delivered verbatim, with no @path
expansion, slash-command dispatch or turn-start attachments.
pub fn with_priority(self, priority: Priority) -> Self
Sourcepub fn context_only(self) -> Self
pub fn context_only(self) -> Self
Add the message to the conversation without starting a turn. Its content is seen by the model on the next prompt.