(
auth: { accessToken: string } | { apiKey: string },
)
| 365 | } |
| 366 | |
| 367 | async function fetchFastModeStatus( |
| 368 | auth: { accessToken: string } | { apiKey: string }, |
| 369 | ): Promise<FastModeResponse> { |
| 370 | const endpoint = `${getOauthConfig().BASE_API_URL}/api/claude_code_penguin_mode` |
| 371 | const headers: Record<string, string> = |
| 372 | 'accessToken' in auth |
| 373 | ? { |
| 374 | Authorization: `Bearer ${auth.accessToken}`, |
| 375 | 'anthropic-beta': OAUTH_BETA_HEADER, |
| 376 | } |
| 377 | : { 'x-api-key': auth.apiKey } |
| 378 | |
| 379 | const response = await axios.get<FastModeResponse>(endpoint, { headers }) |
| 380 | return response.data |
| 381 | } |
| 382 | |
| 383 | const PREFETCH_MIN_INTERVAL_MS = 30_000 |
| 384 | let lastPrefetchAt = 0 |
no test coverage detected