mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-25 04:24:51 -07:00
feat(core,cli): enforce mandatory MessageBus injection (Phase 3 Hard Migration) (#15776)
This commit is contained in:
@@ -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 };
|
||||
});
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user