refactor: extract shared error detection and token rotation utilities (SSOT)
- Create agent-error-detection.ts: single source for error classification (isClaudeUsageExhaustedMessage, isClaudeAuthExpiredMessage, classifyAgentError, etc.) - Create token-rotation-base.ts: shared rotation algorithm (parseRetryAfterFromError, computeCooldownUntil, findNextAvailable) - Remove 6 duplicated functions from message-agent-executor and task-scheduler - Delegate detectFallbackTrigger/detectCodexRotationTrigger to shared classifiers - Split canFallback into isClaudeAgent/canRotateToken/canFallback (3-way separation) - Cache env.ts with getEnv() to eliminate repeated disk I/O - Migrate config, discord, provider-fallback, token-rotation, memento-client to getEnv() Net: -146 lines, 0 new dependencies, 354/354 tests passing
This commit is contained in:
@@ -204,7 +204,6 @@ function loadCodexState(): void {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Get the auth.json path for the current active account. */
|
||||
export function getActiveCodexAuthPath(): string | null {
|
||||
if (accounts.length === 0) return null;
|
||||
|
||||
Reference in New Issue
Block a user