Skip to main content

ralph_workflow/agents/opencode_api/
boundary.rs

1//! Boundary wiring: connects the `io` HTTP capability to the `opencode_api` domain traits.
2//!
3//! This module lives at a `boundary`-named path so it is exempt from the
4//! `forbid_domain_boundary_dependencies` lint, allowing it to import directly
5//! from `crate::io`. All other `opencode_api` modules interact with HTTP only
6//! through the `fetch::HttpFetcher` trait defined in the domain.
7
8use crate::io::http_fetch::RealHttpFetcher;
9
10use super::fetch;
11use super::RealCatalogLoader;
12
13impl fetch::HttpFetcher for RealHttpFetcher {
14    fn fetch(&self, url: &str) -> Result<String, fetch::HttpFetchError> {
15        crate::io::http_fetch::HttpFetcher::fetch(self, url)
16            .map_err(fetch::HttpFetchError::RequestFailed)
17    }
18}
19
20impl Default for RealCatalogLoader {
21    fn default() -> Self {
22        let fetcher = fetch::RealCatalogFetcher::with_http_fetcher(RealHttpFetcher);
23        RealCatalogLoader::with_fetcher(fetcher)
24    }
25}