pub struct EndpointList { /* private fields */ }Expand description
The ordered endpoint list with the sticky-primary active cursor (§3.3).
Implementations§
Source§impl EndpointList
impl EndpointList
Sourcepub fn parse(
uri: &str,
default_token: Option<String>,
) -> Result<EndpointList, IntelError>
pub fn parse( uri: &str, default_token: Option<String>, ) -> Result<EndpointList, IntelError>
Parse the comma-list uri into an ordered EndpointList, resolving each
endpoint’s credential. The single default_token is endpoint 1’s value
when the env override is unset (it is the already-resolved
--intelligence-token/_FILE, RFC 0006). Per-endpoint env overrides
(AGENTD_INTELLIGENCE_TOKEN_<N> / _FILE) win when present.
Sourcepub fn parse_with_env(
uri: &str,
default_token: Option<String>,
env: &dyn Fn(&str) -> Option<String>,
) -> Result<EndpointList, IntelError>
pub fn parse_with_env( uri: &str, default_token: Option<String>, env: &dyn Fn(&str) -> Option<String>, ) -> Result<EndpointList, IntelError>
parse with an injectable env reader (for tests).
Sourcepub fn set_extra_headers(&mut self, headers: Vec<(String, String)>)
pub fn set_extra_headers(&mut self, headers: Vec<(String, String)>)
Apply extra request headers (RFC 0031 intelligence.headers) to every
endpoint. Cheap; called once after construction.
Sourcepub fn set_signer(&mut self, signer: Arc<dyn RequestSigner>)
pub fn set_signer(&mut self, signer: Arc<dyn RequestSigner>)
Attach a per-request signer (RFC 0031: AWS SigV4) to every endpoint.
Sourcepub fn set_provider(&mut self, provider: Provider)
pub fn set_provider(&mut self, provider: Provider)
Select the wire dialect for every endpoint (RFC 0031 §8 —
intelligence.dialect). A host-only endpoint resolved its path with the
OpenAI default, so re-point a still-defaulted path to the new dialect’s
default (Bedrock overrides the path per-request regardless; an explicit
non-default path is left untouched).
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn active(&self) -> usize
pub fn breaker_config(&self) -> &BreakerConfig
pub fn ep(&self, idx: usize) -> &Endpoint
pub fn iter(&self) -> impl Iterator<Item = &Endpoint>
Sourcepub fn attempt_order(&self) -> Vec<usize>
pub fn attempt_order(&self) -> Vec<usize>
The failover attempt order (§3.3): the active index first, then the
remaining endpoints in ascending list order, skipping any whose breaker is
OPEN-and-cooling (available promotes an elapsed-cooldown endpoint to
HALF-OPEN so it is probed). An empty result == all endpoints down (§6).
Sourcepub fn prefer_lowest_healthy(&mut self) -> Option<usize>
pub fn prefer_lowest_healthy(&mut self) -> Option<usize>
Snap active back to the lowest-index endpoint whose breaker is not OPEN
(sticky-primary, §3.3) — so once the primary re-closes, the next call
returns to it and a fallback is temporary by construction. Returns the new
active index if it changed.
Sourcepub fn set_active(&mut self, idx: usize) -> Option<usize>
pub fn set_active(&mut self, idx: usize) -> Option<usize>
Mark idx as the active endpoint (it just succeeded). Returns the new
active index if it changed.
Sourcepub fn all_down(&self) -> bool
pub fn all_down(&self) -> bool
True when no endpoint is available — every breaker OPEN-and-cooling (§6).
Sourcepub fn active_identity(&self) -> (usize, &'static str)
pub fn active_identity(&self) -> (usize, &'static str)
The active endpoint’s bounded structural identity (index, transport-scheme)
for the child→supervisor crate::subagent::protocol::AgentMsg::IntelHealth
report — transport + index ONLY, NEVER the URL/cid/host or credential (RFC
0012 §3.7, mirroring the §4.4 resource-body redaction).
Sourcepub fn body(&self, model: Option<&str>) -> Value
pub fn body(&self, model: Option<&str>) -> Value
The agentd://intelligence resource body (RFC 0018 §4.4): the endpoint
list (transport + index, NEVER the URL/creds), which is active, and each
one’s health (state/latency/error-rate). No secret, no URL (RFC 0012
§3.7) — only the bounded structural transport+addr (cid:port / host,
no scheme-borne secret) and the live atomics.