feat(skills): enable watcher wiring through daemon lifecycle
This commit is contained in:
+26
-4
@@ -19,6 +19,9 @@ import { initAgents } from './agents.js';
|
||||
import { createMessageRouter } from './routing.js';
|
||||
import { registerChannels } from './channels.js';
|
||||
import { initSkills, initMcp, loadSystemPrompt, initPairingManager, createGateway, startServices } from './services.js';
|
||||
import { CommandRegistry, registerBuiltinCommands } from '../commands/index.js';
|
||||
import { ComponentRegistry } from '../intents/index.js';
|
||||
import { RoutingPolicy } from '../routing/index.js';
|
||||
|
||||
// ── Infrastructure ──
|
||||
import type { ModelRouter } from '../models/index.js';
|
||||
@@ -71,7 +74,12 @@ export async function startDaemon(config: Config): Promise<DaemonContext> {
|
||||
});
|
||||
|
||||
const sessionStore = new SessionStore(resolve(dataDir, 'sessions.db'));
|
||||
const sessionManager = new SessionManager(sessionStore);
|
||||
const sessionManager = new SessionManager(sessionStore, {
|
||||
enabled: config.history_index.enabled,
|
||||
maxKeywords: config.history_index.max_keywords,
|
||||
searchLimit: config.history_index.search_limit,
|
||||
minScore: config.history_index.min_score,
|
||||
});
|
||||
|
||||
lifecycle.onShutdown(async () => {
|
||||
sessionStore.close();
|
||||
@@ -96,10 +104,24 @@ export async function startDaemon(config: Config): Promise<DaemonContext> {
|
||||
const { toolRegistry, toolExecutor, browserManager } = initTools({ config, lifecycle, hookEngine });
|
||||
const { memoryStore, memoryDir } = await initMemory({ config, dataDir, lifecycle, toolRegistry });
|
||||
const mcpManager = await initMcp(config, lifecycle, toolRegistry);
|
||||
const { skillRegistry, skillInstaller } = initSkills(config);
|
||||
const { skillRegistry, skillInstaller } = initSkills(config, lifecycle);
|
||||
const { agentConfigRegistry, agentRouter, sandboxManager } = await initAgents({ config, lifecycle });
|
||||
|
||||
const modelRouter = createModelRouter(config);
|
||||
const commandRegistry = new CommandRegistry();
|
||||
registerBuiltinCommands(commandRegistry);
|
||||
const intentRegistry = new ComponentRegistry({
|
||||
matchThreshold: config.intents.match_threshold,
|
||||
});
|
||||
if (config.intents.enabled) {
|
||||
intentRegistry.loadRules(config.intents.rules);
|
||||
}
|
||||
const routingPolicy = new RoutingPolicy({
|
||||
enabled: config.routing_policy.enabled,
|
||||
fastPathThreshold: config.routing_policy.fast_path_threshold,
|
||||
llmThreshold: config.routing_policy.llm_threshold,
|
||||
defaultPath: config.routing_policy.default_path,
|
||||
});
|
||||
|
||||
// Restore persisted model tier
|
||||
const { loadPreferences, savePreference } = await import('../preferences.js');
|
||||
@@ -121,12 +143,12 @@ export async function startDaemon(config: Config): Promise<DaemonContext> {
|
||||
const gateway = createGateway({
|
||||
config, sessionManager, modelRouter, systemPrompt, toolRegistry, toolExecutor,
|
||||
channelRegistry, pairingManager, lifecycle, memoryStore,
|
||||
getChannelAgents: () => channelAgents,
|
||||
getChannelAgents: () => channelAgents, commandRegistry, intentRegistry, routingPolicy,
|
||||
});
|
||||
|
||||
const messageRouter = createMessageRouter({
|
||||
sessionManager, modelRouter, systemPrompt, toolRegistry, toolExecutor,
|
||||
config, memoryStore, agentConfigRegistry, agentRouter, sandboxManager,
|
||||
config, memoryStore, agentConfigRegistry, agentRouter, sandboxManager, commandRegistry, intentRegistry, routingPolicy,
|
||||
});
|
||||
channelRegistry.setMessageHandler(messageRouter.handler);
|
||||
channelAgents = messageRouter.agents;
|
||||
|
||||
Reference in New Issue
Block a user