import { type AgentTool } from "@caupulican/pi-agent-core/types"; import { Box } from "@caupulican/pi-tui"; import { type Static, Type } from "typebox"; import type { ToolDefinition } from "../extensions/types.ts"; import { type EditDiffError, type EditDiffResult } from "./edit-diff.ts"; import { type FileFailureRecoveryAuthority } from "./file-failure-recovery.ts"; import { FileMutationIntentController } from "./file-mutation-intent.ts"; type EditPreview = EditDiffResult | EditDiffError; type EditRenderState = { callComponent?: EditCallRenderComponent; }; declare const editSchema: Type.TUnion<[Type.TObject<{ path: Type.TString; edits: Type.TArray>; }>>; }>, Type.TObject<{ path: Type.TString; payloadRef: Type.TString; }>]>; export type EditToolInput = Static; export interface EditToolDetails { phase: "edited"; contentRef?: string; /** Display-oriented diff of the changes made */ diff?: string; /** Standard unified patch of the changes made */ patch?: string; /** Line number of the first change in the new file (for editor navigation) */ firstChangedLine?: number; /** True when execution reused the match plan already validated for the call preview. */ matchPlanReused?: boolean; } /** * Pluggable operations for the edit tool. * Override these to delegate file editing to remote systems (for example SSH). */ export interface EditOperations { /** Read file contents as a Buffer */ readFile: (absolutePath: string) => Promise; /** Write content to a file */ writeFile: (absolutePath: string, content: string) => Promise; } export interface EditToolOptions { /** Custom operations for file editing. Default: local filesystem */ operations?: EditOperations; /** Shared backend identity for exact cross-tool recovery with custom operations. */ failureRecoveryAuthority?: FileFailureRecoveryAuthority; /** Session-owned harness preflight and exact-content-reference authority. */ intentController?: FileMutationIntentController; } type EditCallRenderComponent = Box & { preview?: EditPreview; previewRequestId: number; previewPending?: boolean; settledError?: boolean; }; export declare function createEditToolDefinition(cwd: string, options?: EditToolOptions): ToolDefinition; export declare function createEditTool(cwd: string, options?: EditToolOptions): AgentTool; export {}; //# sourceMappingURL=edit.d.ts.map