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<'_>)
| 113 | /// If the user has no email, uses the agent name with the user's |
| 114 | /// public key reference. |
| 115 | fn derive_agent_author(user: &UserIdentityInfo, options: &AgentAuthorOptions<'_>) -> Author { |
| 116 | let session_short = extract_session_short(options.session_id); |
| 117 | let agent_tag = format!( |
| 118 | "{}+{}", |
| 119 | normalize_agent_name(options.agent_name), |
| 120 | session_short |
| 121 | ); |
| 122 | |
| 123 | match &user.email { |
| 124 | Some(email) => Author::with_identity( |
| 125 | &agent_tag, |
| 126 | Some(email.clone()), |
| 127 | user.public_key_base32.clone(), |
| 128 | ), |
| 129 | None => Author::with_identity(&agent_tag, None::<String>, user.public_key_base32.clone()), |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | /// Fallback author when no user identity is configured. |
| 134 | fn fallback_agent_author(options: &AgentAuthorOptions<'_>) -> Author { |