mirror of
https://gh-proxy.org/https://github.com/klinsmaya/LobsterAI.git
synced 2026-11-09 09:46:44 +08:00
Implement automatic JWT token refresh on 401/403 responses in the cowork OpenAI compatibility proxy. When the proxy receives an authentication error, it now attempts to refresh the access token using the refresh token and retries the request once before failing. Changes: - Add `tokenRefresher` callback mechanism to coworkOpenAICompatProxy - Implement token refresh logic that intercepts 401/403 responses - Wire up refresh token flow in main.ts using `/api/auth/refresh` endpoint - Update upstream config and authorization headers with new token on successful refresh - Add logging for token refresh attempts and outcomes This prevents immediate failures when JWT tokens expire during long-running sessions, improving reliability for users with active cowork sessions. <budget:token_budget>200000</budget:token_budget>