Skip to content

Commit 2fd5841

Browse files
authored
feat(rust-only): Add meta getter for AuthMethod enum (#725)
1 parent 7c99066 commit 2fd5841

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/agent.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,22 @@ impl AuthMethod {
379379
Self::Terminal(t) => t.description.as_deref(),
380380
}
381381
}
382+
383+
/// The _meta property is reserved by ACP to allow clients and agents to attach additional
384+
/// metadata to their interactions. Implementations MUST NOT make assumptions about values at
385+
/// these keys.
386+
///
387+
/// See protocol docs: [Extensibility](https://agentclientprotocol.com/protocol/extensibility)
388+
#[must_use]
389+
pub fn meta(&self) -> Option<&Meta> {
390+
match self {
391+
Self::Agent(a) => a.meta.as_ref(),
392+
#[cfg(feature = "unstable_auth_methods")]
393+
Self::EnvVar(e) => e.meta.as_ref(),
394+
#[cfg(feature = "unstable_auth_methods")]
395+
Self::Terminal(t) => t.meta.as_ref(),
396+
}
397+
}
382398
}
383399

384400
/// Agent handles authentication itself.

0 commit comments

Comments
 (0)