fix: resolve build errors in cli and sdk due to tool constructor changes

This commit is contained in:
mkorwel
2026-03-24 07:49:14 -07:00
parent b842d5526a
commit b5a23e656c
7 changed files with 33 additions and 19 deletions
+1 -4
View File
@@ -1197,10 +1197,7 @@ export class Session {
const ignoredPaths: string[] = [];
const toolRegistry = this.context.toolRegistry;
const readManyFilesTool = new ReadManyFilesTool(
this.context.config,
this.context.messageBus,
);
const readManyFilesTool = new ReadManyFilesTool(this.context);
const globTool = toolRegistry.getTool('glob');
if (!readManyFilesTool) {
@@ -30,6 +30,7 @@ import {
CoreToolCallStatus,
type Config,
type DiscoveredMCPResource,
type AgentLoopContext,
} from '@google/gemini-cli-core';
import * as core from '@google/gemini-cli-core';
import * as os from 'node:os';
@@ -149,8 +150,18 @@ describe('handleAtCommand', () => {
} as unknown as Config;
const registry = new ToolRegistry(mockConfig, mockMessageBus);
registry.registerTool(new ReadManyFilesTool(mockConfig, mockMessageBus));
registry.registerTool(new GlobTool(mockConfig, mockMessageBus));
registry.registerTool(
new ReadManyFilesTool({
config: mockConfig,
messageBus: mockMessageBus,
} as unknown as AgentLoopContext),
);
registry.registerTool(
new GlobTool({
config: mockConfig,
messageBus: mockMessageBus,
} as unknown as AgentLoopContext),
);
getToolRegistry.mockReturnValue(registry);
});
@@ -513,10 +513,7 @@ async function readLocalFiles(
return { parts: [] };
}
const readManyFilesTool = new ReadManyFilesTool(
config,
config.getMessageBus(),
);
const readManyFilesTool = new ReadManyFilesTool(config);
const pathSpecsToRead = resolvedFiles.map((rf) => rf.pathSpec);
const fileLabelsForDisplay = resolvedFiles.map((rf) => rf.displayLabel);
@@ -10,6 +10,7 @@ import type {
Config,
AgentDefinition,
MessageBus,
AgentLoopContext,
} from '@google/gemini-cli-core';
import {
FileDiscoveryService,
@@ -139,8 +140,18 @@ describe('handleAtCommand with Agents', () => {
} as unknown as Config;
const registry = new ToolRegistry(mockConfig, mockMessageBus);
registry.registerTool(new ReadManyFilesTool(mockConfig, mockMessageBus));
registry.registerTool(new GlobTool(mockConfig, mockMessageBus));
registry.registerTool(
new ReadManyFilesTool({
config: mockConfig,
messageBus: mockMessageBus,
} as unknown as AgentLoopContext),
);
registry.registerTool(
new GlobTool({
config: mockConfig,
messageBus: mockMessageBus,
} as unknown as AgentLoopContext),
);
getToolRegistry.mockReturnValue(registry);
});
+3 -3
View File
@@ -6,14 +6,14 @@
import * as path from 'node:path';
import { getFolderStructure } from '../utils/getFolderStructure.js';
import type {
ToolConfirmationOutcome,
import {
BaseDeclarativeTool,
BaseToolInvocation,
Kind,
type ToolInvocation,
type ToolResult,
type ToolCallConfirmationDetails
type ToolCallConfirmationDetails,
type ToolConfirmationOutcome,
} from './tools.js';
import type { MessageBus } from '../confirmation-bus/message-bus.js';
import type { AgentLoopContext } from '../config/agent-loop-context.js';
+1 -3
View File
@@ -131,9 +131,7 @@ export class GeminiCliSession {
if (registry.getTool(toolName)) {
registry.unregisterTool(toolName);
}
registry.registerTool(
new ActivateSkillTool(this.config, loopContext.messageBus),
);
registry.registerTool(new ActivateSkillTool(loopContext));
}
// Register tools
+1 -1
View File
@@ -28,7 +28,7 @@ export class SdkAgentShell implements AgentShell {
// Use ShellTool to check policy
const loopContext: AgentLoopContext = this.config;
const shellTool = new ShellTool(this.config, loopContext.messageBus);
const shellTool = new ShellTool(loopContext);
try {
const invocation = shellTool.build({
command,