refactor(01-01): extract tool registration into src/daemon/tools.ts

- Create initTools() factory encapsulating ToolRegistry, allBuiltinTools, web search tools, ProcessManager, BrowserManager, ToolExecutor, and ToolPolicy
- Replace ~70 lines of inline tool setup in startDaemon() with single initTools() call
- Clean up tool-specific imports from daemon/index.ts (ToolPolicy, allBuiltinTools, createWebSearchTools, createProcessTools, ProcessManager, createBrowserTools)
- Tier 1 agent tools (session, agents list, message send, cron) remain in daemon/index.ts as intended
- daemon/index.ts reduced to 457 lines (from 1088 baseline)
This commit is contained in:
William Valentin
2026-02-09 20:12:46 -08:00
parent efceb38cb6
commit fb1199a1da
2 changed files with 93 additions and 1 deletions
+4 -1
View File
@@ -3,6 +3,8 @@ import { createModelRouter } from './models.js';
import { initMemory } from './memory.js';
import { createMessageRouter } from './routing.js';
import { initAgents } from './agents.js';
import { initTools } from './tools.js';
import { registerChannels } from './channels.js';
import type { Config } from '../config/index.js';
import type { AudioTranscriptionConfig } from '../models/media.js';
import { ModelRouter } from '../models/index.js';
@@ -10,7 +12,8 @@ import { AgentOrchestrator } from '../backends/index.js';
import { OutboundAttachmentCollector } from '../backends/native/attachments.js';
import { SessionStore, SessionManager, parseDuration } from '../session/index.js';
import { HookEngine } from '../hooks/index.js';
import { ToolRegistry, ToolExecutor, ToolPolicy, allBuiltinTools, createWebSearchTools, createProcessTools, ProcessManager, BrowserManager, createBrowserTools, createSessionTools, createAgentsListTool, createMessageSendTool, createCronTools } from '../tools/index.js';
import type { ToolRegistry, ToolExecutor, BrowserManager } from '../tools/index.js';
import { createSessionTools, createAgentsListTool, createMessageSendTool, createCronTools } from '../tools/index.js';
import { GatewayServer } from '../gateway/index.js';
import { ChannelRegistry, TelegramAdapter, WebChatAdapter, DiscordAdapter, SlackAdapter, WhatsAppAdapter, PairingManager } from '../channels/index.js';
import { CronScheduler, WebhookHandler, HeartbeatMonitor, GmailWatcher } from '../automation/index.js';