import { z } from 'zod'; import { type ToolContext, type ToolModule } from './tool.js'; export declare const DRY_RUN_DESCRIPTION = "Defaults to true, and a dry run changes nothing: it reads the current state from Depot, returns a preview, says whether the write would be refused, and echoes the exact arguments to resend. Show the preview to the user and get their confirmation, then call the tool again with the same arguments and dryRun:false to apply."; export interface WritePreview { /** Structured preview, echoed in the dry-run result and as `before` on apply. */ readonly data: TData; /** Human-readable lines describing the current state, shown in both modes. */ readonly lines: string[]; } export interface WriteApplied { readonly data: TData; readonly lines?: readonly string[] | undefined; } export type WriteInput = z.output>; export interface WriteToolSpec { readonly name: string; readonly title: string; readonly description: string; /** The tool's own arguments. `dryRun` is added by the helper and must not be declared here. */ readonly inputSchema: TInput; readonly previewSchema: TPreview; readonly afterSchema: TAfter; /** Cancels and deletes are destructive; retries and reruns create new work but destroy nothing. */ readonly destructive: boolean; /** False for anything that creates a new attempt or run each time it is applied. */ readonly idempotent: boolean; /** Reads the current state with Depot's read RPCs. Runs on every call, dry or not. */ readonly preview: (input: WriteInput, context: ToolContext) => Promise>>>; /** Returns the reason the write must not proceed, or undefined when it may. Never calls Depot. */ readonly refuse: (preview: z.input>, input: WriteInput) => string | undefined; /** The single mutating RPC. Only reached when a fresh preview passed `refuse`. */ readonly apply: (input: WriteInput, context: ToolContext, preview: z.input>) => Promise>>>; /** * Identifiers for the audit line: names and ids, never values. Defaults to every * string-valued argument, which is right for tools whose arguments are ids; a tool that takes * a value (a variable's contents, a project name) names what it touched from the preview * instead. */ readonly auditIds?: ((input: WriteInput, preview: z.input>) => string) | undefined; } /** * The default audit identifiers: every string-valued argument. Only strings qualify: ids are * strings, and the token never appears in tool input. */ export declare function defaultAuditIds(input: Record): string; /** One line per applied write, to stderr, so an operator can see what an agent changed. */ export declare function writeAuditLine(tool: string, ids: string, now?: Date): void; /** * Wraps a mutating tool in the pattern every write here follows: dry-run by default, a preview * read from Depot in both modes, server-side refusals before any mutating RPC, and one audit * line per applied write. Registration, validation and error translation come from `defineTool`. */ export declare function defineWriteTool(spec: WriteToolSpec): ToolModule; //# sourceMappingURL=write.d.ts.map