Resolve the agent author for a turn change. Looks up the user's default identity and derives an agent author with a `+tag` email. Falls back to a plain agent name if no user identity is configured. # Format With user identity `Alice ` and agent `claude-code` with session `60f5cbd2-...`: ```text Author { name: "claude+60f5", email: Some("alice@example.com") } ``` The `+tag`
(options: &AgentAuthorOptions<'_>)
| 119 | /// Author { name: "Claude Code", email: None } |
| 120 | /// ``` |
| 121 | pub fn resolve_agent_author(options: &AgentAuthorOptions<'_>) -> Author { |
| 122 | // A delegated identity is the only path where the key in the change |
| 123 | // header actually belongs to the agent, so it is tried first. |
| 124 | if let Some(author) = delegated_agent_author(options) { |
| 125 | return author; |
| 126 | } |
| 127 | |
| 128 | // Otherwise: plus-tag the human's identity. Legible, not provable. |
| 129 | match load_default_user_identity(options.identity_dir.as_deref()) { |
| 130 | Some(user) => derive_agent_author(&user, options), |
| 131 | None => fallback_agent_author(options), |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | /// The delegation certificate currently authorizing this agent, as a URN. |
| 136 | /// |