atomr_agents_coding_cli_harness/
registry.rs1use std::collections::HashMap;
4use std::sync::Arc;
5
6use atomr_agents_coding_cli_core::{CliVendor, CliVendorKind};
7
8#[derive(Default, Clone)]
9pub struct VendorRegistry {
10 inner: HashMap<CliVendorKind, Arc<dyn CliVendor>>,
11}
12
13impl VendorRegistry {
14 pub fn new() -> Self {
15 Self::default()
16 }
17
18 pub fn with(mut self, vendor: Arc<dyn CliVendor>) -> Self {
19 self.inner.insert(vendor.kind(), vendor);
20 self
21 }
22
23 pub fn insert(&mut self, vendor: Arc<dyn CliVendor>) {
24 self.inner.insert(vendor.kind(), vendor);
25 }
26
27 pub fn get(&self, kind: &CliVendorKind) -> Option<Arc<dyn CliVendor>> {
28 self.inner.get(kind).cloned()
29 }
30
31 pub fn kinds(&self) -> impl Iterator<Item = &CliVendorKind> {
32 self.inner.keys()
33 }
34
35 pub fn iter(&self) -> impl Iterator<Item = (&CliVendorKind, &Arc<dyn CliVendor>)> {
36 self.inner.iter()
37 }
38
39 pub fn default_vendors() -> Self {
43 let mut r = Self::new();
44 #[cfg(feature = "vendor-claude")]
45 {
46 r.insert(Arc::new(
47 atomr_agents_coding_cli_vendor_claude::ClaudeVendor::new(),
48 ));
49 }
50 #[cfg(feature = "vendor-codex")]
51 {
52 r.insert(Arc::new(
53 atomr_agents_coding_cli_vendor_codex::CodexVendor::new(),
54 ));
55 }
56 #[cfg(feature = "vendor-antigravity")]
57 {
58 r.insert(Arc::new(
59 atomr_agents_coding_cli_vendor_antigravity::AntigravityVendor::new(),
60 ));
61 }
62 r
63 }
64}