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

@@ -113,10 +113,22 @@ export class MessageTurnController {
}
if (result.phase === 'intermediate') {
// Send as standalone message without touching progress state
if (text) {
this.lastIntermediateText = text;
await this.options.channel.sendMessage(this.options.chatJid, text);
if (this.subagents.size > 0) {
// Subagents active — standalone to not disrupt progress
this.lastIntermediateText = text;
await this.options.channel.sendMessage(this.options.chatJid, text);
} else if (this.progressMessageId) {
// Progress exists — update heading
this.previousProgressText = this.latestProgressText;
this.latestProgressText = text;
this.latestProgressTextForFinal = text;
this.toolActivities = [];
void this.syncTrackedProgressMessage();
} else {
// No progress yet — buffer (creates on next event)
this.bufferProgress(text);
}
}
if (!this.poisonedSessionDetected) {
this.resetIdleTimer();