axios+telemetry cleanup

This commit is contained in:
2026-04-02 15:19:11 +03:00
parent a3cbca1e11
commit 7e1eac8002
100 changed files with 3048 additions and 4491 deletions

View File

@@ -1,4 +1,3 @@
import axios from 'axios'
import { getOauthConfig, OAUTH_BETA_HEADER } from 'src/constants/oauth.js'
import { getFeatureValue_CACHED_MAY_BE_STALE } from 'src/services/analytics/growthbook.js'
import {
@@ -20,6 +19,7 @@ import { isInBundledMode } from './bundledMode.js'
import { getGlobalConfig, saveGlobalConfig } from './config.js'
import { logForDebugging } from './debug.js'
import { isEnvTruthy } from './envUtils.js'
import { isHttpError, nativeRequest } from './http.js'
import {
getDefaultMainLoopModelSetting,
isOpus1mMergeEnabled,
@@ -376,7 +376,10 @@ async function fetchFastModeStatus(
}
: { 'x-api-key': auth.apiKey }
const response = await axios.get<FastModeResponse>(endpoint, { headers })
const response = await nativeRequest<FastModeResponse>(endpoint, {
method: 'GET',
headers,
})
return response.data
}
@@ -465,11 +468,11 @@ export async function prefetchFastModeStatus(): Promise<void> {
status = await fetchWithCurrentAuth()
} catch (err) {
const isAuthError =
axios.isAxiosError(err) &&
(err.response?.status === 401 ||
(err.response?.status === 403 &&
typeof err.response?.data === 'string' &&
err.response.data.includes('OAuth token has been revoked')))
isHttpError(err) &&
(err.status === 401 ||
(err.status === 403 &&
typeof err.data === 'string' &&
(err.data as string).includes('OAuth token has been revoked')))
if (isAuthError) {
const failedAccessToken = getClaudeAIOAuthTokens()?.accessToken
if (failedAccessToken) {