openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
49 lines • 1.88 kB
TypeScript
//#region src/agents/failover/signal.d.ts
/** Persisted and wire-visible failover reason codes. Spellings are frozen. */
declare const FAILOVER_REASONS: readonly ["auth", "auth_permanent", "format", "rate_limit", "overloaded", "billing", "server_error", "timeout", "tls_certificate", "context_overflow", "model_not_found", "session_expired", "empty_response", "no_error_details", "unclassified", "unknown"];
type FailoverReason = (typeof FAILOVER_REASONS)[number];
//#endregion
//#region packages/model-catalog-core/src/model-catalog-refs.d.ts
type ModelCatalogRef = {
provider: string;
modelId: string;
};
type ProviderModelRef = {
provider: string;
model: string;
};
//#endregion
//#region src/agents/model-fallback.types.d.ts
type ModelCandidate = ProviderModelRef;
type ModelFallbackAvailability = {
kind: "active";
models: string[];
source: "explicit" | "inherited";
} | {
kind: "none_configured";
source: "explicit" | "inherited";
} | {
kind: "disabled_by_model_override";
} | {
kind: "disabled_by_model_selection_lock";
};
type ModelFallbackRouteResolution = "raw" | "resolved";
type FallbackAttempt = ModelCandidate & {
error: string;
rateLimitRetriesExhausted?: number;
reason?: FailoverReason;
authMode?: string;
status?: number;
code?: string;
};
/** Original route plus the outer fallback stage that admitted one real attempt. */
type ModelFallbackAttemptProvenance = {
requestedProvider: string;
requestedModel: string;
stage: "initial" | "fallback";
/** A user switch invalidates automatic routing for the original selection for this cycle. */
selectionChanged?: boolean;
fallbackReason?: FailoverReason;
};
//#endregion
export { ModelCatalogRef as a, ModelFallbackRouteResolution as i, ModelFallbackAttemptProvenance as n, ProviderModelRef as o, ModelFallbackAvailability as r, FailoverReason as s, FallbackAttempt as t };