feat(tools): surface browser tool activation and policy diagnostics
This commit is contained in:
@@ -66,6 +66,7 @@ export function initTools(deps: ToolsDeps): ToolsResult {
|
||||
}
|
||||
|
||||
// Initialize browser manager and register browser tools (if enabled)
|
||||
const browserToolNames = ['browser.navigate', 'browser.screenshot', 'browser.click', 'browser.type', 'browser.content', 'browser.eval'];
|
||||
let browserManager: BrowserManager | undefined;
|
||||
if (config.browser?.enabled) {
|
||||
const manager = new BrowserManager({
|
||||
@@ -86,6 +87,8 @@ export function initTools(deps: ToolsDeps): ToolsResult {
|
||||
await manager.shutdown();
|
||||
console.log('Browser manager stopped');
|
||||
});
|
||||
} else {
|
||||
console.log('Browser tools disabled (set browser.enabled=true to register browser.* tools)');
|
||||
}
|
||||
|
||||
const toolExecutor = new ToolExecutor(toolRegistry, hookEngine);
|
||||
@@ -99,5 +102,14 @@ export function initTools(deps: ToolsDeps): ToolsResult {
|
||||
console.log(`Tool policy: profile=${effectiveProfile}, deny=[${config.tools.deny.join(', ')}]`);
|
||||
}
|
||||
|
||||
if (config.browser?.enabled) {
|
||||
const allNames = toolRegistry.list().map((tool) => tool.name);
|
||||
const allowed = toolPolicy.resolveAllowedNames(allNames);
|
||||
const availableBrowserTools = browserToolNames.filter((name) => allowed.has(name));
|
||||
if (availableBrowserTools.length === 0) {
|
||||
console.log('Browser tools are registered but blocked by tool policy (use tools.profile=coding/full or tools.allow).');
|
||||
}
|
||||
}
|
||||
|
||||
return { toolRegistry, toolExecutor, browserManager };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user