/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import { type EditorType } from '../utils/editor.js'; import { type AnyDeclarativeTool, DeclarativeTool, type ToolResult } from './tools.js'; /** * A declarative tool that supports a modify operation. */ export interface ModifiableDeclarativeTool extends DeclarativeTool { getModifyContext(abortSignal: AbortSignal): ModifyContext; } export interface ModifyContext { getFilePath: (params: ToolParams) => string; getCurrentContent: (params: ToolParams) => Promise; getProposedContent: (params: ToolParams) => Promise; createUpdatedParams: (oldContent: string, modifiedProposedContent: string, originalParams: ToolParams) => ToolParams; } export interface ModifyResult { updatedParams: ToolParams; updatedDiff: string; } export interface ModifyContentOverrides { currentContent?: string | null; proposedContent?: string; } /** * Type guard to check if a declarative tool is modifiable. */ export declare function isModifiableDeclarativeTool(tool: AnyDeclarativeTool): tool is ModifiableDeclarativeTool; /** * Triggers an external editor for the user to modify the proposed content, * and returns the updated tool parameters and the diff after the user has modified the proposed content. */ export declare function modifyWithEditor(originalParams: ToolParams, modifyContext: ModifyContext, editorType: EditorType, _abortSignal: AbortSignal, onEditorClose: () => void, onEditorOpen?: () => void, overrides?: ModifyContentOverrides): Promise>;