pub struct Executors {
pub claude: ClaudeExecutor,
pub codex: CodexExecutor,
pub devices: DeviceExecutors,
pub openai: OpenAIExecutors,
pub google: GoogleExecutors,
}Fields§
§claude: ClaudeExecutor§codex: CodexExecutor§devices: DeviceExecutorsDevice-login providers (Kimi, Meta, Devin). Default builds production clients.
openai: OpenAIExecutorsAPI-key upstreams speaking OpenAI wire formats (OpenAI-compatible providers, xAI).
google: GoogleExecutorsGoogle-family providers (Gemini API keys, native Interactions keys).
Implementations§
Source§impl Executors
impl Executors
pub async fn execute( &self, credential: &Credential, req: ExecRequest, cfg: &Config, ) -> Result<ExecResponse, ExecError>
Sourcepub async fn images(
&self,
credential: &Credential,
req: ExecRequest,
request_path: &str,
cfg: &Config,
) -> Result<ExecResponse, ExecError>
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.
Sourcepub async fn videos(
&self,
credential: &Credential,
req: ExecRequest,
request_path: &str,
cfg: &Config,
) -> Result<ExecResponse, ExecError>
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.
Sourcepub async fn speech(
&self,
credential: &Credential,
req: ExecRequest,
cfg: &Config,
) -> Result<ExecResponse, ExecError>
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.
Sourcepub async fn execute_in_session(
&self,
credential: &Credential,
req: ExecRequest,
cfg: &Config,
session: &ExecSession,
) -> Result<ExecResponse, ExecError>
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.
Sourcepub fn session_upstream(&self, credential: &Credential) -> bool
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.
Sourcepub fn session_closed(
&self,
id: &str,
) -> impl Future<Output = ExecError> + Send + 'static
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.
Sourcepub fn close_session(&self, id: &str)
pub fn close_session(&self, id: &str)
Releases everything executors hold for session id.
Sourcepub fn credential_session_closer(&self) -> impl Fn(&str) + Send + Sync + 'static
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.
Sourcepub fn supports(&self, provider: &str) -> bool
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).
Sourcepub fn has_refresh_credential(&self, credential: &Credential) -> bool
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.
Sourcepub fn readiness(&self, credential: &Credential, cfg: &Config) -> Readiness
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.
Sourcepub fn needs_prepare(&self, credential: &Credential, cfg: &Config) -> bool
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.
Sourcepub fn needs_prepare_at(
&self,
credential: &Credential,
cfg: &Config,
now: DateTime<Utc>,
) -> bool
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.
Sourcepub fn prepare_due(
&self,
credential: &Credential,
cfg: &Config,
now: DateTime<Utc>,
horizon: Duration,
) -> Option<DateTime<Utc>>
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.
Sourcepub fn models_registered(&self, credentials: &[Arc<Credential>], cfg: &Config)
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.
Sourcepub async fn prepare_forced(
&self,
credential: &Credential,
cfg: &Config,
) -> Result<MetadataPatch, ExecError>
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.
Sourcepub async fn prepare_management(
&self,
credential: &Credential,
cfg: &Config,
) -> Result<MetadataPatch, ExecError>
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.
Sourcepub async fn prepare(
&self,
credential: &Credential,
cfg: &Config,
) -> Result<MetadataPatch, ExecError>
pub async fn prepare( &self, credential: &Credential, cfg: &Config, ) -> Result<MetadataPatch, ExecError>
Prepares credential and returns the metadata change to commit.
Auto Trait Implementations§
impl !Freeze for Executors
impl !RefUnwindSafe for Executors
impl !UnwindSafe for Executors
impl Forget for Executors
impl Move for Executors
impl Send for Executors
impl Sync for Executors
impl Unpin for Executors
impl UnsafeUnpin for Executors
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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