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