feat(gateway): global tier provider/model defaults with catalog-backed options

This commit is contained in:
William Valentin
2026-02-19 10:17:16 -08:00
parent 5883e046ac
commit 708683297a
7 changed files with 495 additions and 5 deletions
+6
View File
@@ -33,6 +33,7 @@ import {
createNodeHandlers,
} from './handlers/index.js';
import { discoverServices } from './handlers/services.js';
import { createModelCatalogFetcher } from './modelCatalog.js';
import type { TokenUsageEntry, ContextUsageEntry } from './handlers/system.js';
import type { NodeConnectionState } from './handlers/node.js';
import type { SessionManager } from '../session/manager.js';
@@ -206,6 +207,7 @@ export class GatewayServer {
private registerHandlers(): void {
const channelRegistry = this.config.channelRegistry;
const runtimeConfig = this.config.config;
const modelCatalogFetcher = runtimeConfig ? createModelCatalogFetcher(runtimeConfig) : undefined;
const systemHandlers = createSystemHandlers({
startTime: this.startTime,
version: this.config.version ?? '0.1.0',
@@ -225,6 +227,9 @@ export class GatewayServer {
getServices: runtimeConfig && channelRegistry
? () => discoverServices(runtimeConfig, channelRegistry)
: undefined,
getModelCatalog: modelCatalogFetcher
? (opts) => modelCatalogFetcher(opts)
: undefined,
getPresence: channelRegistry
? (opts) => channelRegistry.getPresence(opts)
: undefined,
@@ -478,6 +483,7 @@ export class GatewayServer {
const configHandlers = createConfigHandlers({
config: this.config.config,
persistConfig: this.config.persistConfig,
modelRouter: 'setClient' in this.config.modelClient ? this.config.modelClient : undefined,
});
for (const [method, handler] of Object.entries(configHandlers)) {
this.router.register(method, handler);