feat(core,cli): enforce mandatory MessageBus injection (Phase 3 Hard Migration) (#15776)

This commit is contained in:
Abhi
2026-01-04 17:11:43 -05:00
committed by GitHub
parent 90be9c3587
commit 12c7c9cc42
57 changed files with 442 additions and 278 deletions
-1
View File
@@ -61,7 +61,6 @@ vi.mock('../tools/tool-registry', () => {
ToolRegistryMock.prototype.sortTools = vi.fn();
ToolRegistryMock.prototype.getAllTools = vi.fn(() => []); // Mock methods if needed
ToolRegistryMock.prototype.getTool = vi.fn();
ToolRegistryMock.prototype.setMessageBus = vi.fn();
ToolRegistryMock.prototype.getFunctionDeclarations = vi.fn(() => []);
return { ToolRegistry: ToolRegistryMock };
});
+2 -7
View File
@@ -1633,10 +1633,7 @@ export class Config {
}
async createToolRegistry(): Promise<ToolRegistry> {
const registry = new ToolRegistry(this);
// Set message bus on tool registry before discovery so MCP tools can access it
registry.setMessageBus(this.messageBus);
const registry = new ToolRegistry(this, this.messageBus);
// helper to create & register core tools that are enabled
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1659,9 +1656,7 @@ export class Config {
}
if (isEnabled) {
// Pass message bus to tools when feature flag is enabled
// This first implementation is only focused on the general case of
// the tool registry.
// Pass message bus to tools (required for policy engine integration)
const toolArgs = [...args, this.getMessageBus()];
registry.registerTool(new ToolClass(...toolArgs));