feat: Claude auto-ping to warm 5h window after reset

Auto-sends a minimal request right after each Claude OAuth connection's 5h quota window resets, so a fresh window starts immediately without waiting. Per-connection toggle on providers and quota dashboards.

- claudeAutoPing scheduler (server-side, 60s tick) hooked into initializeApp
- per-connection enable map in settings.claudeAutoPing.connections
- toggle + tooltip in ConnectionRow and ProviderLimits (Claude OAuth only)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
decolua
2026-06-17 09:31:46 +07:00
co-authored by Cursor
parent d03f9fb823
commit 740093d852
6 changed files with 204 additions and 2 deletions
+12
View File
@@ -62,6 +62,18 @@ export const CONSOLE_LOG_CONFIG = {
// Client-side store TTL: how long fetched data stays fresh before re-fetching
export const CLIENT_STORE_TTL_MS = 60000;
// Claude auto-ping: keep 5h window warm by sending a tiny request right after reset
export const CLAUDE_AUTOPING_CONFIG = {
settingsKey: "claudeAutoPing", // settings table field
tickIntervalMs: 60000, // scheduler tick
pingLeadMs: 5000, // fire once reset passes (within tolerance)
pingModel: "claude-haiku-4-5-20251001", // cheapest model
pingText: "hi",
pingMaxTokens: 1,
refreshAheadMs: 300000, // refetch usage when within 5min of reset
fiveHourKey: "session (5h)", // quota key returned by usage handler
};
// Re-export from providers.js for backward compatibility
export {
FREE_PROVIDERS,