feat: Claude OAuth token rotation on rate-limit

- New token-rotation module: stores multiple tokens from
  CLAUDE_CODE_OAUTH_TOKENS env var (comma-separated)
- On rate-limit, rotates to next healthy token before falling
  back to Kimi provider
- Also fixes: intermediate text routes to progress message
  when no subagents active (prevents message flooding)
This commit is contained in:
Eyejoker
2026-03-23 22:01:06 +09:00
parent ee65330e66
commit d378598f2e
6 changed files with 168 additions and 14 deletions

View File

@@ -63,11 +63,15 @@ import { startUnifiedDashboard } from './unified-dashboard.js';
import { Channel, NewMessage, RegisteredGroup } from './types.js';
import { logger } from './logger.js';
import { normalizeStoredSeqCursor } from './message-cursor.js';
import { initTokenRotation } from './token-rotation.js';
// Re-export for backwards compatibility during refactor
export { escapeXml, formatMessages } from './router.js';
export { composeDashboardContent } from './dashboard-render.js';
// Initialize token rotation early (reads CLAUDE_CODE_OAUTH_TOKENS from env)
initTokenRotation();
export async function sendFormattedChannelMessage(
channels: Channel[],
jid: string,