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
+8 -4
View File
@@ -17,6 +17,7 @@ import {
ToolConfirmationOutcome,
ToolErrorType,
ToolRegistry,
type MessageBus,
} from '../index.js';
import { OutputFormat } from '../output/types.js';
import { logs } from '@opentelemetry/api-logs';
@@ -94,6 +95,7 @@ import {
import * as metrics from './metrics.js';
import { FileOperation } from './metrics.js';
import * as sdk from './sdk.js';
import { createMockMessageBus } from '../test-utils/mock-message-bus.js';
import { vi, describe, beforeEach, it, expect, afterEach } from 'vitest';
import { type GeminiCLIExtension } from '../config/config.js';
import {
@@ -999,7 +1001,8 @@ describe('loggers', () => {
},
}),
getQuestion: () => 'test-question',
getToolRegistry: () => new ToolRegistry(cfg1),
getToolRegistry: () =>
new ToolRegistry(cfg1, {} as unknown as MessageBus),
getUserMemory: () => 'user-memory',
} as unknown as Config;
@@ -1031,7 +1034,7 @@ describe('loggers', () => {
});
it('should log a tool call with all fields', () => {
const tool = new EditTool(mockConfig);
const tool = new EditTool(mockConfig, createMockMessageBus());
const call: CompletedToolCall = {
status: 'success',
request: {
@@ -1247,7 +1250,7 @@ describe('loggers', () => {
contentLength: 13,
},
outcome: ToolConfirmationOutcome.ModifyWithEditor,
tool: new EditTool(mockConfig),
tool: new EditTool(mockConfig, createMockMessageBus()),
invocation: {} as AnyToolInvocation,
durationMs: 100,
};
@@ -1326,7 +1329,7 @@ describe('loggers', () => {
errorType: undefined,
contentLength: 13,
},
tool: new EditTool(mockConfig),
tool: new EditTool(mockConfig, createMockMessageBus()),
invocation: {} as AnyToolInvocation,
durationMs: 100,
};
@@ -1478,6 +1481,7 @@ describe('loggers', () => {
},
required: ['arg1', 'arg2'],
},
createMockMessageBus(),
false,
undefined,
undefined,