Build an author from a delegated agent identity, if one is configured and resolvable. Returns `None` — rather than failing — whenever the identity is missing or unreadable. Recording a turn must not break because an agent identity was mistyped; falling back to the plus-tag author keeps the work attributed to someone* and leaves a debug log explaining why it is not keyed.
(options: &AgentAuthorOptions<'_>)
| 270 | /// mistyped; falling back to the plus-tag author keeps the work attributed to |
| 271 | /// *someone* and leaves a debug log explaining why it is not keyed. |
| 272 | fn delegated_agent_author(options: &AgentAuthorOptions<'_>) -> Option<Author> { |
| 273 | let (_, identity) = load_selected_agent_identity( |
| 274 | options.agent_identity.as_deref(), |
| 275 | options.identity_dir.as_deref(), |
| 276 | )?; |
| 277 | |
| 278 | let session_short = extract_session_short(options.session_id); |
| 279 | let tag = format!( |
| 280 | "{}+{}", |
| 281 | normalize_agent_name(options.agent_name), |
| 282 | session_short |
| 283 | ); |
| 284 | |
| 285 | Some(Author::with_identity( |
| 286 | &tag, |
| 287 | identity.email.clone(), |
| 288 | identity.public_key_base32(), |
| 289 | )) |
| 290 | } |
| 291 | |
| 292 | /// Derive the agent author from the user's identity. |
| 293 | /// |
no test coverage detected