diff --git a/packages/cli/src/acp/acpClient.ts b/packages/cli/src/acp/acpClient.ts index 5e3f3666b1..9c393ed138 100644 --- a/packages/cli/src/acp/acpClient.ts +++ b/packages/cli/src/acp/acpClient.ts @@ -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) { diff --git a/packages/cli/src/ui/hooks/atCommandProcessor.test.ts b/packages/cli/src/ui/hooks/atCommandProcessor.test.ts index b30e9675cd..770ea831b4 100644 --- a/packages/cli/src/ui/hooks/atCommandProcessor.test.ts +++ b/packages/cli/src/ui/hooks/atCommandProcessor.test.ts @@ -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); }); diff --git a/packages/cli/src/ui/hooks/atCommandProcessor.ts b/packages/cli/src/ui/hooks/atCommandProcessor.ts index 477f9bb02a..2ec40fc252 100644 --- a/packages/cli/src/ui/hooks/atCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/atCommandProcessor.ts @@ -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); diff --git a/packages/cli/src/ui/hooks/atCommandProcessor_agents.test.ts b/packages/cli/src/ui/hooks/atCommandProcessor_agents.test.ts index 90267e64c0..b0f9c627b6 100644 --- a/packages/cli/src/ui/hooks/atCommandProcessor_agents.test.ts +++ b/packages/cli/src/ui/hooks/atCommandProcessor_agents.test.ts @@ -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); }); diff --git a/packages/core/src/tools/activate-skill.ts b/packages/core/src/tools/activate-skill.ts index 97c619d64a..871d713f2d 100644 --- a/packages/core/src/tools/activate-skill.ts +++ b/packages/core/src/tools/activate-skill.ts @@ -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'; diff --git a/packages/sdk/src/session.ts b/packages/sdk/src/session.ts index 001d528817..39281ce443 100644 --- a/packages/sdk/src/session.ts +++ b/packages/sdk/src/session.ts @@ -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 diff --git a/packages/sdk/src/shell.ts b/packages/sdk/src/shell.ts index 770accfea7..96c7538272 100644 --- a/packages/sdk/src/shell.ts +++ b/packages/sdk/src/shell.ts @@ -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,