/** * Edit tool: make precise string replacements in existing files. * * Supports exact string matching with a uniqueness constraint * (when replaceAll is false). Enforces read-before-edit via ReadRegistry. * Handles line ending normalization for cross-platform compatibility. * * Reference: docs/cortex/tools/edit.md */ import { Type, type Static } from 'typebox'; import type { EditHistory } from './shared/edit-history.js'; import type { FileMutationLock } from './shared/file-mutation-lock.js'; import type { ReadRegistry } from './shared/read-registry.js'; import type { ToolContentDetails } from '../types.js'; import { type DiffHunk } from './write.js'; import type { CortexToolRuntime } from './runtime.js'; export declare const EditParams: Type.TObject<{ file_path: Type.TString; old_string: Type.TString; new_string: Type.TString; replace_all: Type.TOptional; }>; export type EditParamsType = Static; export interface EditDetails { filePath: string; oldString: string; newString: string; replacementCount: number; replaceAll: boolean; diff: DiffHunk[]; originalContent: string; /** * Which matcher tier resolved the edit. Useful for consumers that want * to surface "we applied a fuzzy match" in the UI. Absent when no edit * was performed (errors, identical strings, etc.). */ matchTier?: 'exact' | 'line-trimmed' | 'indentation-flexible'; } export interface EditToolConfig { runtime?: CortexToolRuntime | undefined; readRegistry?: ReadRegistry | undefined; fileMutationLock?: FileMutationLock | undefined; /** * Undo stack. When provided, every successful edit pushes a * pre-mutation snapshot so `UndoEdit` can restore the prior state. * Optional — tests and embedded consumers that don't expose undo * may omit it; the tool degrades gracefully to current behavior. */ editHistory?: EditHistory | undefined; } export declare function createEditTool(config: EditToolConfig): { name: string; description: string; parameters: typeof EditParams; execute: (params: EditParamsType) => Promise>; }; //# sourceMappingURL=edit.d.ts.map