Derive the agent author from the user's identity. Constructs: `{agent_name}+{session_short} <{user_email}>` If the user has no email, uses the agent name with the user's public key reference.
(user: &UserIdentityInfo, options: &AgentAuthorOptions<'_>)
| 296 | /// If the user has no email, uses the agent name with the user's |
| 297 | /// public key reference. |
| 298 | fn derive_agent_author(user: &UserIdentityInfo, options: &AgentAuthorOptions<'_>) -> Author { |
| 299 | let session_short = extract_session_short(options.session_id); |
| 300 | let agent_tag = format!( |
| 301 | "{}+{}", |
| 302 | normalize_agent_name(options.agent_name), |
| 303 | session_short |
| 304 | ); |
| 305 | |
| 306 | match &user.email { |
| 307 | Some(email) => Author::with_identity( |
| 308 | &agent_tag, |
| 309 | Some(email.clone()), |
| 310 | user.public_key_base32.clone(), |
| 311 | ), |
| 312 | None => Author::with_identity(&agent_tag, None::<String>, user.public_key_base32.clone()), |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | /// Fallback author when no user identity is configured. |
| 317 | fn fallback_agent_author(options: &AgentAuthorOptions<'_>) -> Author { |