feat(config): persist config.patch updates atomically
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { Config } from '../config/index.js';
|
||||
import { persistConfig } from '../config/index.js';
|
||||
import type { Lifecycle } from './lifecycle.js';
|
||||
import type { ToolRegistry, ToolExecutor } from '../tools/index.js';
|
||||
import type { AgentOrchestrator } from '../backends/index.js';
|
||||
@@ -279,6 +280,7 @@ export function initPairingManager(config: Config, store?: PairingStore): Pairin
|
||||
|
||||
export interface GatewayDeps {
|
||||
config: Config;
|
||||
configPath?: string;
|
||||
sessionManager: SessionManager;
|
||||
modelRouter: ModelRouter;
|
||||
systemPrompt: string;
|
||||
@@ -295,7 +297,7 @@ export interface GatewayDeps {
|
||||
}
|
||||
|
||||
export function createGateway(deps: GatewayDeps): GatewayServer {
|
||||
const { config, sessionManager, modelRouter, systemPrompt, toolRegistry, toolExecutor, channelRegistry, pairingManager, lifecycle, getChannelAgents } = deps;
|
||||
const { config, configPath, sessionManager, modelRouter, systemPrompt, toolRegistry, toolExecutor, channelRegistry, pairingManager, lifecycle, getChannelAgents } = deps;
|
||||
|
||||
const gateway = new GatewayServer({
|
||||
port: config.server.port,
|
||||
@@ -324,6 +326,11 @@ export function createGateway(deps: GatewayDeps): GatewayServer {
|
||||
routingPolicy: deps.routingPolicy,
|
||||
uiDir: resolve(import.meta.dirname, '../gateway/ui'),
|
||||
config,
|
||||
persistConfig: configPath
|
||||
? async (nextConfig) => {
|
||||
persistConfig(configPath, nextConfig);
|
||||
}
|
||||
: undefined,
|
||||
channelRegistry,
|
||||
pairingManager,
|
||||
memoryStore: deps.memoryStore,
|
||||
|
||||
Reference in New Issue
Block a user