File size: 2,360 Bytes
6111b2b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import type {
  HideableSidebarItemId,
  SidebarItemOrder,
  SidebarPresetId,
  SidebarSectionId,
} from "@/shared/constants/sidebarVisibility";
import type { ResilienceSettings } from "@/lib/resilience/settings";
import type {
  AccountFallbackStrategyValue,
  RoutingStrategyValue,
} from "@/shared/constants/routingStrategies";

/**

 * Application settings stored in SQLite key-value pairs.

 */
export interface Settings {
  requireLogin: boolean;
  hasPassword: boolean;
  fallbackStrategy: AccountFallbackStrategyValue;
  stickyRoundRobinLimit: number;
  requestRetry: number;
  maxRetryIntervalSec: number;
  maxBodySizeMb?: number;
  jwtSecret?: string;
  mcpEnabled?: boolean;
  mcpTransport?: "stdio" | "sse" | "streamable-http";
  a2aEnabled?: boolean;
  hideHealthCheckLogs?: boolean;
  hideEndpointCloudflaredTunnel?: boolean;
  hideEndpointTailscaleFunnel?: boolean;
  hideEndpointNgrokTunnel?: boolean;
  autoRefreshProviderQuota?: boolean;
  autoRefreshProviderQuotaInterval?: number;
  pinProviderQuotaToHome?: boolean;
  showQuickStartOnHome?: boolean;
  showProviderTopologyOnHome?: boolean;
  hiddenSidebarItems?: HideableSidebarItemId[];
  sidebarSectionOrder?: SidebarSectionId[];
  sidebarItemOrder?: SidebarItemOrder;
  sidebarActivePreset?: SidebarPresetId;
  resilienceSettings?: ResilienceSettings;
  // LOCAL_ONLY manage-scope bypass policy (DB-stored, hot-reloaded by
  // `applyRuntimeSettings` → `applyAuthzBypassSection`). The route guard
  // consults `getAuthzBypassSnapshot()` on the hot path; these fields are
  // the persisted source of truth that feeds that snapshot.
  localOnlyManageScopeBypassEnabled?: boolean;
  localOnlyManageScopeBypassPrefixes?: string[];
}

export interface ComboDefaults {
  strategy: RoutingStrategyValue;
  maxRetries: number;
  retryDelayMs: number;
  fallbackDelayMs?: number;
  maxComboDepth: number;
  trackMetrics: boolean;
  concurrencyPerModel?: number;
  queueTimeoutMs?: number;
  handoffThreshold?: number;
  handoffModel?: string;
  handoffProviders?: string[];
  maxMessagesForSummary?: number;
}

export interface ProxyConfig {
  type: "http" | "https" | "socks5";
  host: string;
  port: number;
  username?: string;
  password?: string;
}

export interface KVPair {
  key: string;
  value: string;
}