MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / user

Method user

crates/opencode-types/src/message.rs:91–105  ·  view source on GitHub ↗
(session_id: impl Into<String>, text: impl Into<String>)

Source from the content-addressed store, hash-verified

89
90impl SessionMessage {
91 pub fn user(session_id: impl Into<String>, text: impl Into<String>) -> Self {
92 Self {
93 id: format!("msg_{}", uuid::Uuid::new_v4()),
94 session_id: session_id.into(),
95 role: MessageRole::User,
96 parts: vec![MessagePart {
97 id: format!("prt_{}", uuid::Uuid::new_v4()),
98 part_type: PartType::Text { text: text.into() },
99 created_at: Utc::now(),
100 message_id: None,
101 }],
102 created_at: Utc::now(),
103 metadata: HashMap::new(),
104 }
105 }
106
107 pub fn assistant(session_id: impl Into<String>) -> Self {
108 Self {

Callers

nothing calls this directly

Calls 1

newFunction · 0.85

Tested by

no test coverage detected