pub struct IntelClient { /* private fields */ }Expand description
A resolved intelligence client over an ordered endpoint list (RFC 0018 §3).
Implementations§
Source§impl IntelClient
impl IntelClient
Sourcepub fn from_parts(
uri: &str,
default_token: Option<String>,
) -> Result<IntelClient, IntelError>
pub fn from_parts( uri: &str, default_token: Option<String>, ) -> Result<IntelClient, IntelError>
Build from explicit parts (the subagent path — the spawn payload, not CLI
Config). uri is the RFC 0018 endpoint list (a single element is RFC
0006). default_token is endpoint 1’s resolved credential when its env
override is unset; later endpoints resolve their own _<N> token.
Sourcepub fn with_headers(self, headers: Vec<(String, String)>) -> IntelClient
pub fn with_headers(self, headers: Vec<(String, String)>) -> IntelClient
Attach the configured intelligence.headers (RFC 0031), applied to every
endpoint dial. Builder-style; call before use. Empty = the legacy path.
Sourcepub fn with_signer(self, signer: Option<Arc<dyn RequestSigner>>) -> IntelClient
pub fn with_signer(self, signer: Option<Arc<dyn RequestSigner>>) -> IntelClient
Attach a per-request signer (RFC 0031: AWS SigV4), applied to every dial. Builder-style; call before use.
Sourcepub fn with_dialect(self, dialect: Option<&str>) -> IntelClient
pub fn with_dialect(self, dialect: Option<&str>) -> IntelClient
Select the wire dialect (RFC 0031 §8 — intelligence.dialect), applied to
every endpoint. None keeps the OpenAI-compatible default. Builder-style;
call before use.
Sourcepub fn set_health_reporter(&mut self, reporter: Box<dyn Fn(IntelHealthReport)>)
pub fn set_health_reporter(&mut self, reporter: Box<dyn Fn(IntelHealthReport)>)
Install the edge-triggered all-down reachability reporter (RFC 0018 §6): the
child wires this to send an AgentMsg::IntelHealth up to the supervisor on
each all-down ENTER/EXIT transition. Idempotent on the steady state — the
callback fires only on a change of the list’s all-down state, never per call.
Adds NOTHING to the data path; a client without it behaves exactly as before.
Sourcepub fn set_trace_id(&mut self, trace_id: Option<String>)
pub fn set_trace_id(&mut self, trace_id: Option<String>)
Stamp the run’s trace id so each completion carries a traceparent
header (the LLM call joins the run’s distributed trace, RFC 0010).
Sourcepub fn enable_alldown_backoff(&mut self, policy: AllDownPolicy)
pub fn enable_alldown_backoff(&mut self, policy: AllDownPolicy)
Enable the all-endpoints-down backoff (RFC 0018 §6) for a long-lived
loop/reactive daemon: on all-down, re-arm the failover sweep with
bounded jittered backoff instead of surfacing the terminal immediately.
once-mode leaves this unset (a single sweep → exit 4). The run deadline
still bounds the total wait (RFC 0011 §5 — backoff does not extend it).
Sourcepub fn endpoint_count(&self) -> usize
pub fn endpoint_count(&self) -> usize
The number of configured endpoints (1 == RFC 0006).
Sourcepub fn trace_id(&self) -> Option<&str>
pub fn trace_id(&self) -> Option<&str>
The run’s trace id, if stamped (RFC 0010). Read on a hot-swap (RFC 0018 §5.2) to re-stamp the rebuilt client so it keeps joining the run’s trace.
Sourcepub fn alldown_enabled(&self) -> bool
pub fn alldown_enabled(&self) -> bool
Whether the all-endpoints-down backoff is enabled (a long-lived loop/reactive daemon). Read on a hot-swap (RFC 0018 §5.2) so the rebuilt client preserves the daemon’s resilience posture across a repoint.
Sourcepub fn complete(&self, req: &Request) -> Result<Response, IntelError>
pub fn complete(&self, req: &Request) -> Result<Response, IntelError>
One completion round-trip, driven through the failover policy (RFC 0018
§3.3). The call-site signature is unchanged from RFC 0006, so the whole
exit-code path (IntelError → LoopAbort::Intel → exit 4) is intact.
When all endpoints are down (§6) and the all-down backoff is enabled
(loop/reactive daemons), the sweep is re-armed with bounded jittered
backoff so a transient host-model roll recovers without crashing the
daemon; once-mode surfaces the terminal immediately (→ exit 4). A fatal
auth failure (401/403) is NEVER backed off — it is a misconfiguration, not
a transient outage (§6).
Sourcepub fn with_list<R>(&self, f: impl FnOnce(&EndpointList) -> R) -> R
pub fn with_list<R>(&self, f: impl FnOnce(&EndpointList) -> R) -> R
Borrow the endpoint list for the read-only agentd://intelligence
resource body (§4.4). The caller serializes transport/index/health only —
NEVER the URL or any credential (RFC 0012 §3.7).