Skip to main content

Executors

Struct Executors 

Source
pub struct Executors {
    pub claude: ClaudeExecutor,
    pub codex: CodexExecutor,
    pub devices: DeviceExecutors,
    pub openai: OpenAIExecutors,
    pub google: GoogleExecutors,
}

Fields§

§claude: ClaudeExecutor§codex: CodexExecutor§devices: DeviceExecutors

Device-login providers (Kimi, Meta, Devin). Default builds production clients.

§openai: OpenAIExecutors

API-key upstreams speaking OpenAI wire formats (OpenAI-compatible providers, xAI).

§google: GoogleExecutors

Google-family providers (Gemini API keys, native Interactions keys).

Implementations§

Source§

impl Executors

Source

pub async fn execute( &self, credential: &Credential, req: ExecRequest, cfg: &Config, ) -> Result<ExecResponse, ExecError>

Source

pub async fn images( &self, credential: &Credential, req: ExecRequest, request_path: &str, cfg: &Config, ) -> Result<ExecResponse, ExecError>

The Images API (/v1/images/generations, /v1/images/edits) for providers that serve it directly. request_path is the inbound route; req.stream asks for the upstream event stream passed through raw.

Source

pub async fn videos( &self, credential: &Credential, req: ExecRequest, request_path: &str, cfg: &Config, ) -> Result<ExecResponse, ExecError>

The Videos API (/v1/videos*, /openai/v1/videos*) for providers that serve it. request_path is the inbound route; a route other than generations, edits or extensions polls the job named by the body’s request_id.

Source

pub async fn speech( &self, credential: &Credential, req: ExecRequest, cfg: &Config, ) -> Result<ExecResponse, ExecError>

The OpenAI speech routes (/v1/audio/speech, /v1/tts): Go’s openai-speech source, which only the xAI executor serves.

Source

pub async fn execute_in_session( &self, credential: &Credential, req: ExecRequest, cfg: &Config, session: &ExecSession, ) -> Result<ExecResponse, ExecError>

One turn of a downstream Responses WebSocket session. Codex and xAI credentials with websockets keep a pooled upstream socket per session; every other credential runs an ordinary execution and cannot continue upstream state, so a continuation turn fails with ExecError::replay_required.

Source

pub fn session_upstream(&self, credential: &Credential) -> bool

Whether credential keeps upstream conversation state on a session socket, so the next turn may be sent as an incremental continuation.

Source

pub fn session_closed( &self, id: &str, ) -> impl Future<Output = ExecError> + Send + 'static

Resolves when an upstream socket held for session id is lost; pending forever when no executor holds one.

Source

pub fn close_session(&self, id: &str)

Releases everything executors hold for session id.

Source

pub fn credential_session_closer(&self) -> impl Fn(&str) + Send + Sync + 'static

Go CloseCodexWebsocketSessionsForAuthID and CloseXAIWebsocketSessionsForAuthID for the credential store: given a removed credential’s id, ends only the upstream WebSocket sessions that credential serves.

Source

pub fn supports(&self, provider: &str) -> bool

Whether an executor serves this provider. Credentials of other providers never enter selection (Go skips auths whose executor is not registered).

Source

pub fn has_refresh_credential(&self, credential: &Credential) -> bool

Go authHasRefreshCredential: whether an upstream 401 on credential should be followed by one forced Self::prepare and a retry (Go tryRefreshAfterUnauthorized). A refresh token qualifies for every provider; Meta re-mints its API key from its device token. Providers that recover from a 401 another way add an arm here.

Source

pub fn readiness(&self, credential: &Credential, cfg: &Config) -> Readiness

Whether credential needs preparation, and whether requests must wait for it. Must be cheap and side-effect free. Providers without request-time preparation report RefreshSoon whenever needs_prepare holds.

Source

pub fn needs_prepare(&self, credential: &Credential, cfg: &Config) -> bool

Whether credential needs any preparation (readiness is not Ready). Must be cheap and side-effect free. Providers implement this; the runtime reads Self::readiness.

Source

pub fn needs_prepare_at( &self, credential: &Credential, cfg: &Config, now: DateTime<Utc>, ) -> bool

Self::needs_prepare as of now. Once true it stays true as time passes until the credential is prepared: every provider compares an expiry or a last refresh with the clock.

Source

pub fn prepare_due( &self, credential: &Credential, cfg: &Config, now: DateTime<Utc>, horizon: Duration, ) -> Option<DateTime<Utc>>

The earliest time within horizon of now at which credential needs preparation (now if it already does), to one second. Bisects Self::needs_prepare_at, so every provider’s own rule decides; about a dozen cheap evaluations for a credential that comes due inside the horizon, one for the rest.

Source

pub fn models_registered(&self, credentials: &[Arc<Credential>], cfg: &Config)

The runtime registered models for credentials (Go registerModelsForAuth): providers that probe capabilities after registration start here. Must not block.

Source

pub async fn prepare_forced( &self, credential: &Credential, cfg: &Config, ) -> Result<MetadataPatch, ExecError>

Self::prepare for a credential whose access token an upstream rejected, or a management refresh: Codex refreshes even when not due (Go marks the token rejected or forces the refresh). Other providers prepare as usual; most of them (Claude once its identity is known, Kimi, Meta, Devin) refresh whenever asked.

Source

pub async fn prepare_management( &self, credential: &Credential, cfg: &Config, ) -> Result<MetadataPatch, ExecError>

Self::prepare_forced for a management refresh (Go IsForceRefreshContext): Codex refreshes every token partition that can refresh.

Source

pub async fn prepare( &self, credential: &Credential, cfg: &Config, ) -> Result<MetadataPatch, ExecError>

Prepares credential and returns the metadata change to commit.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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