/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import { BaseDeclarativeTool, type ToolInvocation, type ToolResult } from './tools.js'; import type { MessageBus } from '../confirmation-bus/message-bus.js'; import { Config } from '../config/config.js'; import { type ModifiableDeclarativeTool, type ModifyContext } from './modifiable-tool.js'; export declare function applyReplacement(currentContent: string | null, oldString: string, newString: string, isNewFile: boolean, expectedReplacements?: number): string; /** * Parameters for the Edit tool */ export interface EditToolParams { /** * The absolute path to the file to modify */ absolute_path?: string; /** * Alternative parameter name for absolute_path (for compatibility) * Not shown in schema - internal use only */ file_path?: string; /** * The text to replace */ old_string: string; /** * The text to replace it with */ new_string: string; /** * Number of replacements expected. Defaults to 1 if not specified. * Use when you want to replace multiple occurrences. */ expected_replacements?: number; /** * Optional 1-based line number where the replacement should begin. * Strongly recommended to always set this to guard against misinterpreting * the file structure, especially when similar text appears multiple times. */ replaceBeginLineNumber?: number; /** * Whether the edit was modified manually by the user. */ modified_by_user?: boolean; /** * Initially proposed content. */ ai_proposed_content?: string; } /** * Implementation of the Edit tool logic */ export declare class EditTool extends BaseDeclarativeTool implements ModifiableDeclarativeTool { private readonly config; static readonly Name = "replace"; constructor(config: Config, messageBus?: MessageBus); /** * Validates the parameters for the Edit tool * @param params Parameters to validate * @returns Error message string or null if valid */ protected validateToolParamValues(params: EditToolParams): string | null; protected createInvocation(params: EditToolParams, messageBus?: MessageBus, toolName?: string, displayName?: string): ToolInvocation; getModifyContext(_: AbortSignal): ModifyContext; }