( resetTimestamp: number, reason: CooldownReason, )
| 212 | } |
| 213 | |
| 214 | export function triggerFastModeCooldown( |
| 215 | resetTimestamp: number, |
| 216 | reason: CooldownReason, |
| 217 | ): void { |
| 218 | if (!isFastModeEnabled()) { |
| 219 | return |
| 220 | } |
| 221 | runtimeState = { status: 'cooldown', resetAt: resetTimestamp, reason } |
| 222 | hasLoggedCooldownExpiry = false |
| 223 | const cooldownDurationMs = resetTimestamp - Date.now() |
| 224 | logForDebugging( |
| 225 | `Fast mode cooldown triggered (${reason}), duration ${Math.round(cooldownDurationMs / 1000)}s`, |
| 226 | ) |
| 227 | logEvent('tengu_fast_mode_fallback_triggered', { |
| 228 | cooldown_duration_ms: cooldownDurationMs, |
| 229 | cooldown_reason: |
| 230 | reason as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 231 | }) |
| 232 | cooldownTriggered.emit(resetTimestamp, reason) |
| 233 | } |
| 234 | |
| 235 | export function clearFastModeCooldown(): void { |
| 236 | runtimeState = { status: 'active' } |
no test coverage detected