import type { CodeToolResult } from "../../_shared/baseToolAdapter.js";
import { type CodeEditContext, type CodeEditGate, type CodeEditProvider } from "../_shared/editCore.js";
export type CodeReplaceFileBoundary = "input" | "contract" | "governance" | "scope" | "approval" | "provider";
export type CodeReplaceFileGate = CodeEditGate & {
    accepted: boolean;
};
export type CodeReplaceFileRequest = {
    toolCallId?: string;
    workspaceRoot?: string;
    targetPath?: string;
    newContent?: string;
    expectedCurrentHash?: string;
    requestedScopes?: readonly string[];
    allowedScopes?: readonly string[];
    approval?: CodeReplaceFileGate;
    governance?: CodeReplaceFileGate;
    guard?: CodeEditGate;
    context?: CodeEditContext;
    dryRun?: boolean;
    provider?: CodeReplaceFileProvider;
    writer?: CodeReplaceFileProvider;
    metadata?: Readonly<Record<string, unknown>>;
};
export type CodeReplaceFileProvider = Pick<CodeEditProvider, "readText" | "writeText">;
export type CodeReplaceFileErrorCode = "MISSING_TARGET_PATH" | "MISSING_NEW_CONTENT" | "ABSOLUTE_TARGET_PATH" | "TARGET_PATH_OUTSIDE_SCOPE" | "NUL_BYTE_IN_PATH" | "SCOPE_DENIED" | "GOVERNANCE_REJECTED" | "APPROVAL_REQUIRED" | "PROVIDER_UNAVAILABLE" | "HASH_MISMATCH" | "PROVIDER_FAILURE";
export type CodeReplaceFileError = {
    code: CodeReplaceFileErrorCode;
    message: string;
    boundary: CodeReplaceFileBoundary;
    safeForRuntimeInspection: true;
    internalDetailExposed?: false;
};
export type CodeReplaceFileAudit = {
    tool: "code.replaceFile";
    toolCallId: string;
    targetPath: string;
    workspaceRoot?: string;
    requestedScopes: readonly string[];
    acceptedScopes: readonly string[];
    dryRun: boolean;
    approvalRequired: true;
    unsafeSideEffects: false;
    metadata: Readonly<Record<string, unknown>>;
};
export type CodeReplaceFilePlan = {
    kind: "agentCore.basicTool.code.replaceFile.plan";
    operation: "replace-file-content";
    targetPath: string;
    contentBytes: number;
    expectedCurrentHash?: string;
    dispatch: "dry-run";
    guard: "path-scope-and-approval";
    writesFileSystem: false;
};
export type CodeReplaceFileOutput = {
    kind: "agentCore.basicTool.code.replaceFile.output";
    targetPath: string;
    contentBytes: number;
    expectedCurrentHash?: string;
    actualCurrentHash?: string;
    bytesWritten: number;
    changed: boolean;
    applied: boolean;
    dryRun: boolean;
    unsafeSideEffects: false;
};
export type CodeReplaceFileResult = {
    ok: true;
    plan: CodeReplaceFilePlan;
    audit: CodeReplaceFileAudit;
    events: readonly string[];
} | {
    ok: false;
    error: CodeReplaceFileError;
    events: readonly string[];
};
export declare const codeReplaceFileDescriptor: {
    readonly tool: "code.replaceFile";
    readonly route: "agent_executionEngine.basic_toolLayer.baseTools.codeBase.edit";
    readonly purpose: "replace a whole file through governed storage-owned edit semantics and runtime filesystem support";
    readonly defaultDispatch: "dry-run";
    readonly approvalRequired: true;
    readonly unsafeSideEffects: false;
};
export declare function planCodeReplaceFile(request?: CodeReplaceFileRequest): CodeReplaceFileResult;
export declare function executeCodeReplaceFile(request?: CodeReplaceFileRequest): Promise<CodeToolResult<CodeReplaceFileOutput, CodeReplaceFileErrorCode>>;
