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:
@@ -78,7 +78,6 @@ export {
|
||||
shouldUseTaskScopedSession,
|
||||
} from './task-watch-status.js';
|
||||
|
||||
|
||||
/**
|
||||
* Compute the next run time for a recurring task, anchored to the
|
||||
* task's scheduled time rather than Date.now() to prevent cumulative
|
||||
|
||||
Reference in New Issue
Block a user