fix(barrel): migrate open-sse, src/shared, src/sse, src/models, src/domain off the @/lib/localDb barrel import (#11795 Phase 4) (#12053)

Resynced onto the release tip after #12051/#12052 landed. One real conflict in open-sse/services/combo.ts at both LKGP-clear call sites (handleComboChat + round-robin path): the release tip already has #12013's clearStaleLKGP() helper, which this PR's branch predates — kept the current helper call at both sites, discarding the pre-refactor inline pattern. typecheck:core and the open-sse test suite (vitest, 9/9 on volumeDetector) both green after resync. Thanks for the well-scoped Phase 4 migration.
This commit is contained in:
Webman
2026-08-30 00:31:09 -05:00
committed by GitHub
parent 38a29661d3
commit 4e11887085
32 changed files with 75 additions and 171 deletions

View File

@@ -230,11 +230,6 @@
"count": 1
}
},
"open-sse/handlers/chatCore/comboContextCache.ts": {
"no-restricted-imports": {
"count": 1
}
},
"open-sse/handlers/chatCore/executorHelpers.ts": {
"@typescript-eslint/no-unused-vars": {
"count": 1
@@ -465,9 +460,6 @@
"@typescript-eslint/no-explicit-any": {
"count": 17
},
"no-restricted-imports": {
"count": 2
},
"no-restricted-syntax": {
"count": 1
}
@@ -510,21 +502,11 @@
"count": 21
}
},
"open-sse/services/combo/concurrencyCaps.ts": {
"no-restricted-imports": {
"count": 1
}
},
"open-sse/services/combo/providerWildcard.ts": {
"@typescript-eslint/no-unused-vars": {
"count": 1
}
},
"open-sse/services/combo/quotaExhaustionCutoff.ts": {
"no-restricted-imports": {
"count": 1
}
},
"open-sse/services/comboAgentMiddleware.ts": {
"@typescript-eslint/no-unused-vars": {
"count": 1
@@ -621,11 +603,6 @@
"count": 2
}
},
"open-sse/services/keyGroupAuth.ts": {
"no-restricted-imports": {
"count": 1
}
},
"open-sse/services/manifestAdapter.ts": {
"@typescript-eslint/no-unused-vars": {
"count": 3
@@ -689,9 +666,6 @@
"open-sse/services/tokenLimitCounter.ts": {
"@typescript-eslint/no-unused-vars": {
"count": 1
},
"no-restricted-imports": {
"count": 1
}
},
"open-sse/services/tokenRefresh.ts": {
@@ -827,11 +801,6 @@
"count": 1
}
},
"open-sse/utils/proxyFallback.ts": {
"no-restricted-imports": {
"count": 1
}
},
"open-sse/utils/setupPolyfill.ts": {
"@typescript-eslint/no-explicit-any": {
"count": 5
@@ -1516,11 +1485,6 @@
"count": 1
}
},
"src/domain/quotaCache.ts": {
"no-restricted-imports": {
"count": 1
}
},
"src/hooks/useLiveDashboard.ts": {
"@typescript-eslint/no-unused-vars": {
"count": 1
@@ -2035,11 +1999,6 @@
"count": 3
}
},
"src/models/index.ts": {
"no-restricted-imports": {
"count": 1
}
},
"src/server/ws/liveServer.ts": {
"@typescript-eslint/no-unused-vars": {
"count": 5
@@ -2156,11 +2115,6 @@
"count": 1
}
},
"src/shared/services/apiKeyResolver.ts": {
"no-restricted-imports": {
"count": 1
}
},
"src/shared/services/backupService.ts": {
"@typescript-eslint/no-unused-vars": {
"count": 1
@@ -2169,27 +2123,11 @@
"src/shared/services/cloudSyncScheduler.ts": {
"@typescript-eslint/no-unused-vars": {
"count": 1
},
"no-restricted-imports": {
"count": 1
}
},
"src/shared/services/initializeCloudSync.ts": {
"@typescript-eslint/no-unused-vars": {
"count": 1
},
"no-restricted-imports": {
"count": 1
}
},
"src/shared/services/modelSyncScheduler.ts": {
"no-restricted-imports": {
"count": 1
}
},
"src/shared/utils/apiAuth.ts": {
"no-restricted-imports": {
"count": 1
}
},
"src/shared/utils/apiKey.ts": {
@@ -2200,9 +2138,6 @@
"src/shared/utils/apiKeyPolicy.ts": {
"@typescript-eslint/no-unused-vars": {
"count": 2
},
"no-restricted-imports": {
"count": 1
}
},
"src/shared/utils/cloud.ts": {
@@ -2300,11 +2235,6 @@
"count": 11
}
},
"src/sse/handlers/autoRouting.ts": {
"no-restricted-imports": {
"count": 1
}
},
"src/sse/handlers/chat.ts": {
"@typescript-eslint/no-unused-vars": {
"count": 9
@@ -2313,24 +2243,6 @@
"src/sse/handlers/chatHelpers.ts": {
"@typescript-eslint/no-unused-vars": {
"count": 3
},
"no-restricted-imports": {
"count": 1
}
},
"src/sse/services/model.ts": {
"no-restricted-imports": {
"count": 2
}
},
"src/sse/services/noAuthProviderSettings.ts": {
"no-restricted-imports": {
"count": 1
}
},
"src/sse/services/tokenRefresh.ts": {
"no-restricted-imports": {
"count": 1
}
},
"tests/benchmarks/pipeline-accuracy.test.ts": {

View File

@@ -1427,7 +1427,7 @@ export async function handleChatCore({
};
if ((isCombo && comboName) || routingComboId) {
try {
const { getComboByName } = await import("../../src/lib/localDb");
const { getComboByName } = await import("@/lib/db/combos");
let comboConfig = await getComboByName(comboName);
if (!comboConfig && comboName?.startsWith("combo/")) {
comboConfig = await getComboByName(comboName.substring(6));
@@ -1918,7 +1918,7 @@ export async function handleChatCore({
if (isCombo && comboName) {
log?.info?.("CONTEXT", `Attempting to resolve combo limits for comboName=${comboName}`);
try {
const { getComboByName } = await import("../../src/lib/localDb");
const { getComboByName } = await import("@/lib/db/combos");
const { resolveComboTargets } = await import("../services/combo.ts");
let comboConfig = await getComboByName(comboName);
if (!comboConfig && comboName.startsWith("combo/")) {
@@ -4292,13 +4292,14 @@ export async function handleChatCore({
let quotaCooldownMs = kimiRateLimitResetAt
? Math.max(new Date(kimiRateLimitResetAt).getTime() - Date.now(), 0)
: retryAfterMs || COOLDOWN_MS.rateLimit;
const deferAntigravityQuotaStateToCaller =
shouldDeferAntigravityQuotaStateToCaller(
provider,
typeof onStreamFailure === "function"
);
const isAntigravityQuotaFamily =
shouldDeferAntigravityQuotaStateToCaller(provider, true);
const deferAntigravityQuotaStateToCaller = shouldDeferAntigravityQuotaStateToCaller(
provider,
typeof onStreamFailure === "function"
);
const isAntigravityQuotaFamily = shouldDeferAntigravityQuotaStateToCaller(
provider,
true
);
let coreOwnedAntigravityLockout: {
cooldownMs: number;
failureCount: number;

View File

@@ -1,5 +1,4 @@
import { getUpstreamProxyConfig } from "@/lib/localDb";
import type { FallbackBackend } from "@/lib/db/upstreamProxy";
import { FallbackBackend, getUpstreamProxyConfig } from "@/lib/db/upstreamProxy";
/**
* Module-level cache for upstream proxy config (shared across all requests).
@@ -29,7 +28,8 @@ const COMBOS_CACHE_TTL = 10_000;
export async function getCombosCached(): Promise<unknown[]> {
const now = Date.now();
const { getCombos, getCombosCacheVersion } = await import("@/lib/localDb");
const { getCombos } = await import("@/lib/db/combos");
const { getCombosCacheVersion } = await import("@/lib/db/readCache");
const version = getCombosCacheVersion();
// A combo write (create/update/delete/reorder) bumps the shared version via
// invalidateDbCache("combos"); when it no longer matches our snapshot we drop

View File

@@ -3,7 +3,7 @@ import { describe, it, expect, vi } from "vitest";
// Mock the DB so recommendStrategyOverride sees adaptiveVolumeRouting = true.
// Without this the real getSettings() throws (no SQLite in test env), the
// catch block fires, and the function returns noOverride before any rule runs.
vi.mock("@/lib/localDb", () => ({
vi.mock("@/lib/db/settings", () => ({
getSettings: vi.fn().mockResolvedValue({ adaptiveVolumeRouting: true }),
}));

View File

@@ -1,22 +1,20 @@
import { v4 as uuidv4 } from "uuid";
import type { BatchItemCheckpoint, BatchRecord } from "@/lib/localDb";
import {
type BatchItemCheckpoint,
type BatchRecord,
countBatchItemCheckpoints,
createFile,
deleteFile,
ensureBatchItemCheckpoints,
getApiKeyById,
getBatch,
getFileContent,
getPendingBatches,
getTerminalBatches,
listBatchItemCheckpoints,
listFiles,
markBatchItemError,
markBatchItemProcessing,
markBatchItemResult,
updateBatch,
} from "@/lib/localDb";
} from "@/lib/db/batches";
import { createFile, deleteFile, getFileContent, listFiles } from "@/lib/db/files";
import { getApiKeyById } from "@/lib/db/apiKeys";
import { dispatch } from "@/lib/batches/dispatch";
import type { SupportedBatchEndpoint } from "@/shared/constants/batchEndpoints";
import { DEFAULT_BATCH_EXPIRATION_SECONDS } from "@/shared/constants/batch";

View File

@@ -427,7 +427,7 @@ export async function buildAutoCandidates(
// apply, so auto-routing behavior is unchanged.
const quotaCutoffEnabled =
(resilienceSettings ?? resolveResilienceSettings(null))?.quotaPreflight?.enabled === true;
const { getPricingForModel } = await import("../../src/lib/localDb");
const { getPricingForModel } = await import("@/lib/db/settings");
const quotaPromises = new Map<string, Promise<unknown>>();
let historicalLatencyStats: Record<string, HistoricalLatencyStatsEntry> = {};
try {
@@ -1969,7 +1969,7 @@ async function handleComboChatInner({
const connId = effectiveConnectionId || undefined;
void (async () => {
try {
const { setLKGP } = await import("../../src/lib/localDb");
const { setLKGP } = await import("@/lib/db/settings");
await Promise.all([
setLKGP(combo.name, target.executionKey, provider, connId),
setLKGP(combo.name, combo.id || combo.name, provider, connId),
@@ -3566,7 +3566,7 @@ async function handleRoundRobinCombo({
const connId = effectiveConnectionId || undefined;
void (async () => {
try {
const { setLKGP } = await import("../../src/lib/localDb");
const { setLKGP } = await import("@/lib/db/settings");
await Promise.all([
setLKGP(combo.name, target.executionKey, provider, connId),
setLKGP(combo.name, combo.id || combo.name, provider, connId),

View File

@@ -67,7 +67,7 @@ export async function applyStrategyOrdering(
if (strategy === "lkgp") {
try {
const { getLKGP } = await import("../../../src/lib/localDb");
const { getLKGP } = await import("@/lib/db/settings");
const lkgpProvider = await getLKGP(combo.name, combo.id || combo.name);
if (lkgpProvider) {

View File

@@ -19,7 +19,7 @@
* shrinking (Quality Gate / #3501).
*/
import { getCachedProviderConnectionById } from "@/lib/localDb";
import { getCachedProviderConnectionById } from "@/lib/db/readCache";
import { effectiveMaxConcurrency } from "./comboPredicates.ts";
import type { ResolvedComboTarget } from "./types.ts";

View File

@@ -19,7 +19,7 @@ import {
type PreflightQuotaThresholds,
type QuotaInfo,
} from "../quotaPreflight.ts";
import { getCachedProviderConnectionById } from "@/lib/localDb";
import { getCachedProviderConnectionById } from "@/lib/db/readCache";
import {
resolveResilienceSettings,
type ResilienceSettings,
@@ -109,8 +109,7 @@ export async function resolveQuotaExhaustionCutoffForTarget(
let connection: Record<string, unknown> | undefined;
try {
connection = (await getCachedProviderConnectionById(connectionId)) as
| Record<string, unknown>
| undefined;
Record<string, unknown> | undefined;
} catch {
connection = undefined;
}

View File

@@ -245,7 +245,7 @@ export async function resolveAutoStrategyOrder(
let lastKnownGoodProvider: string | undefined;
try {
const { getLKGP } = await import("../../../src/lib/localDb");
const { getLKGP } = await import("@/lib/db/settings");
const lkgp = await getLKGP(combo.name, combo.id || combo.name);
if (lkgp) lastKnownGoodProvider = lkgp.provider;
} catch (err) {

View File

@@ -65,7 +65,7 @@ export function orderTargetsForWeightedFallback<T extends { executionKey: string
*/
export async function sortModelsByCost(models: string[]): Promise<string[]> {
try {
const { getPricingForModel } = await import("../../../src/lib/localDb");
const { getPricingForModel } = await import("@/lib/db/settings");
const withCost = await Promise.all(
models.map(async (modelStr) => {
const parsed = parseModel(modelStr);

View File

@@ -12,7 +12,7 @@
* - Provider-specific rules: "openai/gpt-4"
*/
import { checkKeyModelAccess, getKeyGroupsForApiKey } from "@/lib/localDb";
import { checkKeyModelAccess, getKeyGroupsForApiKey } from "@/lib/db/apiKeyGroups";
export interface KeyGroupAuthResult {
/** Whether the request is authorized */

View File

@@ -332,7 +332,7 @@ function getProviderIdFromConnection(connection: unknown) {
async function getActiveProviderSet() {
try {
const { getCachedProviderConnections } = await import("@/lib/localDb");
const { getCachedProviderConnections } = await import("@/lib/db/readCache");
const conns = (await getCachedProviderConnections()) as unknown[];
const providers = conns
.map(getProviderIdFromConnection)
@@ -345,7 +345,7 @@ async function getActiveProviderSet() {
async function getActiveSyncedProvidersForModel(modelId: string) {
try {
const { getActiveProvidersWithSyncedModel } = await import("@/lib/localDb");
const { getActiveProvidersWithSyncedModel } = await import("@/lib/db/models");
const providers = await getActiveProvidersWithSyncedModel(modelId);
return providers
.map(resolveProviderAlias)
@@ -403,7 +403,7 @@ function isTruthyEnv(value: string | undefined) {
async function getPreferClaudeCodeForUnprefixedClaudeModels() {
try {
const { getCachedSettings } = await import("@/lib/localDb");
const { getCachedSettings } = await import("@/lib/db/readCache");
const settings = (await getCachedSettings()) as Record<string, unknown>;
if (typeof settings.preferClaudeCodeForUnprefixedClaudeModels === "boolean") {
return settings.preferClaudeCodeForUnprefixedClaudeModels;

View File

@@ -223,7 +223,7 @@ export function clearPayloadRulesConfigOverride() {
// silently reverting to the (usually empty) file config.
async function loadPayloadRulesFromSettings(): Promise<PayloadRulesConfig | null> {
try {
const { getCachedSettings } = await import("@/lib/localDb");
const { getCachedSettings } = await import("@/lib/db/readCache");
const settings = (await getCachedSettings()) as { payloadRules?: unknown };
const raw = settings?.payloadRules;
if (raw === null || raw === undefined) return null;

View File

@@ -338,7 +338,8 @@ export async function initializeRateLimits() {
applyBottleneckHeartbeatPatch();
try {
const { getCachedProviderConnections, getSettings } = await import("@/lib/localDb");
const { getCachedProviderConnections } = await import("@/lib/db/readCache");
const { getSettings } = await import("@/lib/db/settings");
const [connections, settings] = await Promise.all([
getCachedProviderConnections(),
getSettings(),
@@ -385,7 +386,7 @@ export async function applyRequestQueueSettings(nextSettings: RequestQueueSettin
currentRequestQueueSettings = { ...nextSettings };
// Global policy changes invalidate snapshots from the previous generation.
preservedReplacementSettings.clear();
const { getCachedProviderConnections } = await import("@/lib/localDb");
const { getCachedProviderConnections } = await import("@/lib/db/readCache");
const connections = await getCachedProviderConnections();
// Also discard any snapshot created while the asynchronous DB read yielded.
preservedReplacementSettings.clear();

View File

@@ -20,7 +20,7 @@ import {
getTokenLimitsForRequest,
logTokenLimitReset,
type TokenLimit,
} from "@/lib/localDb";
} from "@/lib/db/tokenLimits";
interface CacheEntry {
windowStart: string;
@@ -295,8 +295,7 @@ export function recordTokenUsage(
ORDER BY window_start DESC LIMIT 1`
)
.get(limit.id, windowStart) as
| { window_start?: string; tokens_used?: number }
| undefined;
{ window_start?: string; tokens_used?: number } | undefined;
const prevTokens =
priorRow && typeof priorRow.tokens_used === "number" ? priorRow.tokens_used : 0;
if (prevTokens > 0) {

View File

@@ -155,7 +155,7 @@ export async function recommendStrategyOverride(
// Check if adaptive routing is enabled globally
try {
const { getSettings } = await import("@/lib/localDb");
const { getSettings } = await import("@/lib/db/settings");
const settings = await getSettings();
if (!settings.adaptiveVolumeRouting) {
return noOverride;

View File

@@ -20,7 +20,7 @@ async function getConfig() {
if (_cachedConfig && now < _cacheExpiry) return _cachedConfig;
try {
const { getProxyConfig } = await import("../../src/lib/localDb");
const { getProxyConfig } = await import("@/lib/db/settings");
_cachedConfig = await getProxyConfig();
_cacheExpiry = now + 30_000; // Cache for 30s
return _cachedConfig;

View File

@@ -10,7 +10,8 @@
import { fetch as undiciFetch } from "undici";
import { createProxyDispatcher, normalizeProxyUrl } from "./proxyDispatcher.ts";
import { resolveProxyForScopeFromRegistry, listProxies, listOneproxyProxies } from "@/lib/localDb";
import { resolveProxyForScopeFromRegistry, listProxies } from "@/lib/db/proxies";
import { listOneproxyProxies } from "@/lib/db/oneproxy";
import { isFeatureFlagEnabled } from "@/shared/utils/featureFlags";
// ---------------------------------------------------------------------------

View File

@@ -17,7 +17,8 @@
*/
import { getUsageForProvider } from "@omniroute/open-sse/services/usage.ts";
import { getCachedProviderConnectionById, resolveProxyForConnection } from "@/lib/localDb";
import { getCachedProviderConnectionById } from "@/lib/db/readCache";
import { resolveProxyForConnection } from "@/lib/db/settings";
import { runWithProxyContext } from "@omniroute/open-sse/utils/proxyFetch.ts";
import { safePercentage } from "@/shared/utils/formatting";
import {

View File

@@ -1,4 +1,4 @@
// Database Models - Export all from localDb
// Database Models - Export all from the owning db modules
export {
getProviderConnections,
getProviderConnectionsCount,
@@ -15,17 +15,16 @@ export {
updateProviderNode,
deleteProviderNode,
deleteProviderConnectionsByProvider,
} from "@/lib/db/providers";
export {
getModelAliases,
setModelAlias,
deleteModelAlias,
deleteModelAliasesForProvider,
getMitmAlias,
setMitmAliasAll,
getApiKeys,
createApiKey,
deleteApiKey,
validateApiKey,
isCloudEnabled,
resolveProxyForProvider,
getHiddenModelsByProvider,
} from "@/lib/localDb";
} from "@/lib/db/models";
export { getApiKeys, createApiKey, deleteApiKey, validateApiKey } from "@/lib/db/apiKeys";
export { isCloudEnabled } from "@/lib/db/settings";
export { resolveProxyForProvider } from "@/lib/db/proxies";

View File

@@ -1,4 +1,4 @@
import { getApiKeyById, createApiKey } from "@/lib/localDb";
import { getApiKeyById, createApiKey } from "@/lib/db/apiKeys";
import { getConsistentMachineId } from "@/shared/utils/machineId";
export async function resolveApiKey(

View File

@@ -1,5 +1,5 @@
import { getConsistentMachineId } from "@/shared/utils/machineId";
import { isCloudEnabled } from "@/lib/localDb";
import { isCloudEnabled } from "@/lib/db/settings";
import { getRuntimePorts } from "@/lib/runtime/ports";
const { dashboardPort } = getRuntimePorts();

View File

@@ -1,5 +1,6 @@
import { getCloudSyncScheduler } from "@/shared/services/cloudSyncScheduler";
import { isCloudEnabled, cleanupProviderConnections } from "@/lib/localDb";
import { isCloudEnabled } from "@/lib/db/settings";
import { cleanupProviderConnections } from "@/lib/db/providers";
/**
* Initialize cloud sync scheduler

View File

@@ -10,7 +10,7 @@
import { randomUUID } from "node:crypto";
import { Agent, buildConnector, fetch as undiciFetch, type Dispatcher } from "undici";
import { getSettings, updateSettings } from "@/lib/localDb";
import { getSettings, updateSettings } from "@/lib/db/settings";
import { isConnectionUnavailableToAuxiliaryActivity } from "@/lib/exclusiveLeaseIsolation";
import { getRuntimePorts } from "@/lib/runtime/ports";
@@ -151,7 +151,7 @@ async function getAutoSyncConnections(): Promise<
Array<{ id: string; provider: string; name?: string }>
> {
try {
const { getProviderConnections } = await import("@/lib/localDb");
const { getProviderConnections } = await import("@/lib/db/providers");
const connections = await getProviderConnections();
const autoSyncConnections: Array<{ id: string; provider: string; name?: string }> = [];
for (const conn of connections) {

View File

@@ -9,7 +9,7 @@
import { jwtVerify } from "jose";
import { cookies } from "next/headers";
import { getSettings } from "@/lib/localDb";
import { getSettings } from "@/lib/db/settings";
import { isPublicApiRoute } from "@/shared/constants/publicApiRoutes";
import { extractApiKey } from "@/sse/services/auth";

View File

@@ -9,12 +9,8 @@
*/
import { extractApiKey } from "@/sse/services/auth";
import {
getApiKeyMetadata,
getComboByName,
isModelAllowedForKey,
getApiKeyById,
} from "@/lib/localDb";
import { getApiKeyMetadata, isModelAllowedForKey, getApiKeyById } from "@/lib/db/apiKeys";
import { getComboByName } from "@/lib/db/combos";
import { isDashboardSessionAuthenticated } from "./apiAuth";
import { resolveComboForModel } from "@/lib/db/modelComboMappings";
import { checkBudget } from "@/domain/costRules";

View File

@@ -14,7 +14,7 @@ import {
isValidModelFamily,
type ModelFamily,
} from "@omniroute/open-sse/services/autoCombo/modelFamily.ts";
import { getCachedSettings } from "@/lib/localDb";
import { getCachedSettings } from "@/lib/db/readCache";
import * as log from "../utils/logger";
export type AutoRoutingState = {

View File

@@ -1,4 +1,8 @@
import { getModelInfo, getComboForModel, getModelInfoOrRetirementResponse } from "../services/model";
import {
getModelInfo,
getComboForModel,
getModelInfoOrRetirementResponse,
} from "../services/model";
import { clearAccountError, markAccountUnavailable } from "../services/auth";
import { connectionHasExtraKeys } from "@omniroute/open-sse/services/apiKeyRotator.ts";
import { createBuiltinAutoCombo } from "@omniroute/open-sse/services/autoCombo/builtinCatalog.ts";
@@ -26,7 +30,7 @@ import {
isTlsFingerprintActive,
type AppliedProxySink,
} from "@omniroute/open-sse/utils/proxyFetch.ts";
import { resolveProxyForConnection } from "@/lib/localDb";
import { resolveProxyForConnection } from "@/lib/db/settings";
import { hasBlockingProxyAssignment } from "@/lib/db/proxies";
import {
CircuitBreakerOpenError,

View File

@@ -1,15 +1,9 @@
// Re-export from open-sse with localDb integration
import {
getModelAliases,
getComboByName,
getComboById,
getComboByNameInsensitive,
getCachedProviderNodes,
getCustomModels,
} from "@/lib/localDb";
import { getModelAliases, getCustomModels } from "@/lib/db/models";
import { getComboByName, getComboById, getComboByNameInsensitive } from "@/lib/db/combos";
import { getCachedProviderNodes, getCachedSettings } from "@/lib/db/readCache";
import { getSyncedAutoAliases } from "@/lib/providerModels/syncedAutoAliases.ts";
import { getCachedSettings } from "@/lib/localDb";
import { getActiveSyncedCatalog } from "@/lib/db/models/activeSyncedCatalog";
import { getModelCompatOverrides } from "@/lib/db/models/compat";
import { getNoAuthHydrationProviderIds } from "./noAuthProviderSiblings";
@@ -660,7 +654,7 @@ export async function getComboForModel(modelStr) {
// 2. NEW — check model-combo mappings table (pattern match)
try {
const { resolveComboForModel } = await import("@/lib/localDb");
const { resolveComboForModel } = await import("@/lib/db/modelComboMappings");
const mapped = await resolveComboForModel(baseModelStr || modelStr);
if (mapped && (mapped as any).models?.length > 0) {
return mapped;

View File

@@ -1,4 +1,4 @@
import { getSettings } from "@/lib/localDb";
import { getSettings } from "@/lib/db/settings";
import { isProviderBlockedByIdOrAlias } from "@/shared/utils/noAuthProviders";
import * as log from "../utils/logger";

View File

@@ -1,10 +1,8 @@
// Re-export from open-sse with local logger
import * as log from "../utils/logger";
import {
updateProviderConnection,
resolveProxyForConnection,
resolveProxyForProvider,
} from "@/lib/localDb";
import { updateProviderConnection } from "@/lib/db/providers";
import { resolveProxyForConnection } from "@/lib/db/settings";
import { resolveProxyForProvider } from "@/lib/db/proxies";
import {
TOKEN_EXPIRY_BUFFER_MS as BUFFER_MS,
getRefreshLeadMs as _getRefreshLeadMs,