import type { CodeToolResult } from "../../_shared/baseToolAdapter.js";
import { type CodeEditContext, type CodeEditGate, type CodeEditProvider } from "../_shared/editCore.js";
export type CodeOverwriteBoundary = "input" | "contract" | "governance" | "scope" | "resource" | "provider";
export type CodeOverwriteGate = CodeEditGate & {
    accepted: boolean;
    reason?: string;
};
export type CodeOverwriteRequest = {
    workspaceRoot?: string;
    targetPath?: string;
    content?: string;
    expectedExistingHash?: string;
    maxBytes?: number;
    requestedScopes?: readonly string[];
    allowedScopes?: readonly string[];
    dryRun?: boolean;
    contract?: CodeOverwriteGate;
    governance?: CodeOverwriteGate;
    guard?: CodeEditGate;
    context?: CodeEditContext;
    provider?: CodeOverwriteProvider;
    writer?: CodeOverwriteProvider;
    metadata?: Readonly<Record<string, unknown>>;
};
export type CodeOverwriteProvider = Pick<CodeEditProvider, "readText" | "writeText">;
export type CodeOverwriteErrorCode = "MISSING_WORKSPACE_ROOT" | "MISSING_TARGET_PATH" | "TARGET_OUT_OF_SCOPE" | "MISSING_CONTENT" | "CONTENT_TOO_LARGE" | "CONTRACT_REJECTED" | "GOVERNANCE_REJECTED" | "SCOPE_DENIED" | "REAL_SIDE_EFFECT_NOT_ALLOWED" | "APPROVAL_REQUIRED" | "PROVIDER_UNAVAILABLE" | "HASH_MISMATCH" | "PROVIDER_FAILURE";
export type CodeOverwriteError = {
    code: CodeOverwriteErrorCode;
    message: string;
    boundary: CodeOverwriteBoundary;
    safeForRuntimeInspection: true;
    internalDetailExposed: false;
};
export type CodeOverwritePlan = {
    tool: "code.overwrite";
    capability: "overwrite-file-content";
    workspaceRoot: string;
    targetPath: string;
    contentBytes: number;
    expectedExistingHash?: string;
    maxBytes: number;
    requiredPermission: "filesystem:overwrite";
    requiresTapApproval: true;
    dispatch: "dry-run";
    dryRun: true;
    wouldOverwrite: true;
    unsafeSideEffects: false;
    acceptedScopes: readonly string[];
    audit: {
        guard: "target-scope-size-and-approval";
        event: "basicTool.code.overwrite.planned";
        metadata: Readonly<Record<string, unknown>>;
    };
};
export type CodeOverwriteOutput = {
    kind: "agentCore.basicTool.code.overwrite.output";
    targetPath: string;
    contentBytes: number;
    expectedExistingHash?: string;
    actualExistingHash?: string;
    maxBytes: number;
    bytesWritten: number;
    applied: boolean;
    dryRun: boolean;
    unsafeSideEffects: false;
};
export type CodeOverwriteResult = {
    ok: true;
    plan: CodeOverwritePlan;
    events: readonly string[];
} | {
    ok: false;
    error: CodeOverwriteError;
    events: readonly string[];
};
export declare const codeOverwriteDescriptor: {
    readonly tool: "code.overwrite";
    readonly capability: "overwrite-file-content";
    readonly layer: "agent_executionEngine.basic_toolLayer.baseTools.codeBase.edit";
    readonly defaultDispatch: "dry-run";
    readonly requiresTapApproval: true;
    readonly unsafeSideEffects: false;
};
export declare function planCodeOverwrite(request?: CodeOverwriteRequest): CodeOverwriteResult;
export declare function executeCodeOverwrite(request?: CodeOverwriteRequest): Promise<CodeToolResult<CodeOverwriteOutput, CodeOverwriteErrorCode>>;
