import type { CodeToolResult } from "../../_shared/baseToolAdapter.js";
import { type CodeEditContext, type CodeEditGate, type CodeEditProvider } from "../_shared/editCore.js";
export type CodeModifyBoundary = "input" | "contract" | "governance" | "scope" | "provider";
export type CodeModifyGate = CodeEditGate & {
    accepted: boolean;
    reason?: string;
};
export type CodeModifyOccurrence = "first" | "all";
export type CodeModifyRequest = {
    workspaceRoot?: string;
    targetPath?: string;
    searchText?: string;
    replacementText?: string;
    occurrence?: CodeModifyOccurrence;
    maxReplacements?: number;
    requestedScopes?: readonly string[];
    allowedScopes?: readonly string[];
    dryRun?: boolean;
    contract?: CodeModifyGate;
    governance?: CodeModifyGate;
    guard?: CodeEditGate;
    context?: CodeEditContext;
    provider?: CodeModifyProvider;
    modifier?: CodeModifyProvider;
    metadata?: Readonly<Record<string, unknown>>;
};
export type CodeModifyProvider = Pick<CodeEditProvider, "readText" | "writeText">;
export type CodeModifyErrorCode = "MISSING_WORKSPACE_ROOT" | "MISSING_TARGET_PATH" | "TARGET_OUT_OF_SCOPE" | "MISSING_SEARCH_TEXT" | "MISSING_REPLACEMENT_TEXT" | "INVALID_REPLACEMENT_LIMIT" | "CONTRACT_REJECTED" | "GOVERNANCE_REJECTED" | "SCOPE_DENIED" | "REAL_SIDE_EFFECT_NOT_ALLOWED" | "APPROVAL_REQUIRED" | "PROVIDER_UNAVAILABLE" | "SEARCH_TEXT_NOT_FOUND" | "PROVIDER_FAILURE";
export type CodeModifyError = {
    code: CodeModifyErrorCode;
    message: string;
    boundary: CodeModifyBoundary;
    safeForRuntimeInspection: true;
    internalDetailExposed: false;
};
export type CodeModifyPlan = {
    tool: "code.modify";
    capability: "modify-existing-code-snippet";
    workspaceRoot: string;
    targetPath: string;
    occurrence: CodeModifyOccurrence;
    maxReplacements: number;
    searchTextBytes: number;
    replacementTextBytes: number;
    requiredPermission: "filesystem:patch";
    requiresTapApproval: true;
    dispatch: "dry-run";
    dryRun: true;
    wouldModify: true;
    unsafeSideEffects: false;
    acceptedScopes: readonly string[];
    audit: {
        guard: "target-scope-and-bounded-replacement";
        event: "basicTool.code.modify.planned";
        metadata: Readonly<Record<string, unknown>>;
    };
};
export type CodeModifyOutput = {
    kind: "agentCore.basicTool.code.modify.output";
    targetPath: string;
    occurrence: CodeModifyOccurrence;
    maxReplacements: number;
    replacements: number;
    searchTextBytes: number;
    replacementTextBytes: number;
    beforeBytes: number;
    afterBytes: number;
    bytesWritten: number;
    firstMatchedLine?: number;
    applied: boolean;
    dryRun: boolean;
    unsafeSideEffects: false;
};
export type CodeModifyResult = {
    ok: true;
    plan: CodeModifyPlan;
    events: readonly string[];
} | {
    ok: false;
    error: CodeModifyError;
    events: readonly string[];
};
export declare const codeModifyDescriptor: {
    readonly tool: "code.modify";
    readonly capability: "modify-existing-code-snippet";
    readonly layer: "agent_executionEngine.basic_toolLayer.baseTools.codeBase.edit";
    readonly defaultDispatch: "dry-run";
    readonly requiresTapApproval: true;
    readonly unsafeSideEffects: false;
};
export declare function planCodeModify(request?: CodeModifyRequest): CodeModifyResult;
export declare function executeCodeModify(request?: CodeModifyRequest): Promise<CodeToolResult<CodeModifyOutput, CodeModifyErrorCode>>;
