chore: checkpoint browser tooling and routing updates

This commit is contained in:
William Valentin
2026-02-17 15:18:37 -08:00
parent 0a4cfda787
commit 9a2f1e2bb2
15 changed files with 499 additions and 67 deletions
+11 -39
View File
@@ -103,13 +103,6 @@ export function registerTuiCommand(program: Command): void {
const { MinimalTui, startFullscreenTui } = await import('../frontends/tui/index.js');
const { NativeAgent } = await import('../backends/index.js');
const {
ToolRegistry,
ToolExecutor,
ToolPolicy,
allBuiltinTools,
createWebSearchTools,
createProcessTools,
ProcessManager,
createGmailTools,
createGcalTools,
createGdocsTools,
@@ -119,6 +112,8 @@ export function registerTuiCommand(program: Command): void {
createAgentDelegateTool,
} = await import('../tools/index.js');
const { HookEngine } = await import('../hooks/index.js');
const { Lifecycle } = await import('../daemon/lifecycle.js');
const { initTools } = await import('../daemon/tools.js');
const { createModelRouter } = await import('../daemon/index.js');
const { AgentConfigRegistry } = await import('../agents/index.js');
@@ -147,33 +142,8 @@ export function registerTuiCommand(program: Command): void {
const systemPrompt = loadSystemPrompt();
const hookEngine = new HookEngine(config.hooks);
const toolRegistry = new ToolRegistry();
for (const tool of allBuiltinTools) {
toolRegistry.register(tool);
}
// Register web search tools if configured with credentials
if (config.web_search.api_key || config.web_search.endpoint) {
for (const tool of createWebSearchTools({
provider: config.web_search.provider,
apiKey: config.web_search.api_key,
endpoint: config.web_search.endpoint,
maxResults: config.web_search.max_results,
})) {
toolRegistry.register(tool);
}
}
// Initialize process manager and register process tools
const processManager = new ProcessManager({
maxConcurrent: config.process.max_concurrent,
maxRuntimeMinutes: config.process.max_runtime_minutes,
bufferSize: config.process.buffer_size,
});
for (const tool of createProcessTools(processManager)) {
toolRegistry.register(tool);
}
const lifecycle = new Lifecycle();
const { toolRegistry, toolExecutor } = initTools({ config, lifecycle, hookEngine });
// Register Gmail tools if configured
if (config.automation.gmail?.enabled) {
@@ -233,10 +203,6 @@ export function registerTuiCommand(program: Command): void {
}));
}
toolRegistry.setPolicy(new ToolPolicy(config.tools));
const toolExecutor = new ToolExecutor(toolRegistry, hookEngine);
const session = sessionManager.getSession('tui', 'local');
const modelProviderConfigs = buildProviderConfigMap(config);
@@ -262,7 +228,7 @@ export function registerTuiCommand(program: Command): void {
});
const cleanup = () => {
processManager.shutdown();
void lifecycle.shutdown();
sessionStore.close();
};
@@ -292,6 +258,9 @@ export function registerTuiCommand(program: Command): void {
model: config.models.default.model,
agent,
hookEngine,
pairingManager,
localProviders: config.models.local_providers,
currentLocalProvider: config.models.local?.provider,
modelProviderConfigs,
contextThresholdPct: config.compaction.threshold_pct,
onTransfer: transferSessionToTarget,
@@ -331,6 +300,9 @@ export function registerTuiCommand(program: Command): void {
model: config.models.default.model,
agent,
hookEngine,
pairingManager,
localProviders: config.models.local_providers,
currentLocalProvider: config.models.local?.provider,
modelProviderConfigs,
contextThresholdPct: config.compaction.threshold_pct,
onTransfer: transferSessionToTarget,