-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.ts
More file actions
32 lines (29 loc) · 828 Bytes
/
constants.ts
File metadata and controls
32 lines (29 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import type { FallbackPluginConfig } from "./types"
export const PLUGIN_NAME = "opencode-fallback"
export const DEFAULT_CONFIG: Required<FallbackPluginConfig> = {
enabled: true,
retry_on_errors: [401, 402, 429, 500, 502, 503, 504],
retryable_error_patterns: [],
max_fallback_attempts: 10,
cooldown_seconds: 60,
timeout_seconds: 30,
notify_on_fallback: true,
fallback_models: [],
}
export const RETRYABLE_ERROR_PATTERNS = [
/rate.?limit/i,
/too.?many.?requests/i,
/quota.?exceeded/i,
/quota.?protection/i,
/key.?limit.?exceeded/i,
/usage\s+limit\s+has\s+been\s+reached/i,
/service.?unavailable/i,
/overloaded/i,
/temporarily.?unavailable/i,
/try.?again/i,
/credit.*balance.*too.*low/i,
/insufficient.?(?:credits?|funds?|balance)/i,
/(?:^|\s)429(?:\s|$)/,
/(?:^|\s)503(?:\s|$)/,
/(?:^|\s)529(?:\s|$)/,
]