Skip to main content

IntelClient

Struct IntelClient 

Source
pub struct IntelClient { /* private fields */ }
Expand description

A resolved intelligence client over an ordered endpoint list (RFC 0018 §3).

Implementations§

Source§

impl IntelClient

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Source

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).

Source

pub fn endpoint_count(&self) -> usize

The number of configured endpoints (1 == RFC 0006).

Source

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.

Source

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.

Source

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 (IntelErrorLoopAbort::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).

Source

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).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more