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