import type { CodeToolResult } from "../../_shared/baseToolAdapter.js";
export type CodeBenchmarkBoundary = "input" | "contract" | "governance" | "scope" | "resource" | "provider";
export type CodeBenchmarkGate = {
    accepted?: boolean;
    allowed?: boolean;
    reason?: string;
};
export type CodeBenchmarkContext = {
    runtimeId?: string;
    sessionId?: string;
    invocationId?: string;
    dryRun?: boolean;
    guard?: CodeBenchmarkGate;
    requestedScopes?: readonly string[];
    allowedScopes?: readonly string[];
    auditMetadata?: Readonly<Record<string, unknown>>;
};
export type CodeBenchmarkRequest = {
    context?: CodeBenchmarkContext;
    runtimeId?: string;
    invocationId?: string;
    workspaceRoot?: string;
    benchmarkTarget?: string;
    command?: readonly string[];
    metric?: string;
    iterations?: number;
    warmup?: number;
    timeoutMs?: number;
    stdin?: string;
    env?: Readonly<Record<string, string>>;
    requestedScopes?: readonly string[];
    allowedScopes?: readonly string[];
    dryRun?: boolean;
    guard?: CodeBenchmarkGate;
    contract?: CodeBenchmarkGate;
    governance?: CodeBenchmarkGate;
    provider?: CodeBenchmarkProvider;
    metadata?: Readonly<Record<string, unknown>>;
};
export type CodeBenchmarkErrorCode = "MISSING_RUNTIME_ID" | "MISSING_WORKSPACE_ROOT" | "MISSING_BENCHMARK_TARGET" | "MISSING_COMMAND" | "INVALID_COMMAND" | "INVALID_ITERATIONS" | "INVALID_WARMUP" | "INVALID_TIMEOUT" | "INVALID_ENVIRONMENT" | "CONTRACT_REJECTED" | "GOVERNANCE_REJECTED" | "SCOPE_DENIED" | "REAL_SIDE_EFFECT_NOT_ALLOWED" | "PROVIDER_UNAVAILABLE" | "PROVIDER_FAILURE";
export type CodeBenchmarkError = {
    code: CodeBenchmarkErrorCode;
    message: string;
    boundary: CodeBenchmarkBoundary;
    safeForRuntimeInspection: true;
    internalDetailExposed: false;
};
export type CodeBenchmarkRuntimeEntry = {
    owner: "runtime";
    port: "BaseToolExecutorPort.process.run";
    method: "run";
    intent: "benchmark";
};
export type CodeBenchmarkPlan = {
    toolKind: "code.benchmark";
    runtimeId: string;
    invocationId: string;
    workspaceRoot: string;
    benchmarkTarget: string;
    command: readonly string[];
    metric: string;
    iterations: number;
    timeoutMs: number;
    permissions: readonly string[];
    acceptedScopes: readonly string[];
    execution: {
        dryRun: true;
        benchmarkExecuted: false;
        unsafeSideEffects: false;
    };
    audit: {
        capability: "benchmark-code";
        governanceRequired: true;
        tapCanWrap: true;
    };
};
export type CodeBenchmarkSummary = {
    minMs: number;
    maxMs: number;
    meanMs: number;
    p95Ms: number;
};
export type CodeBenchmarkOutput = {
    kind: "agentCore.basicTool.code.benchmark.output";
    runtimeId: string;
    invocationId: string;
    workspaceRoot: string;
    benchmarkTarget: string;
    command: readonly string[];
    commandPreview: readonly string[];
    metric: string;
    iterations: number;
    warmup: number;
    timeoutMs: number;
    runtimeEntry: CodeBenchmarkRuntimeEntry;
    dryRun: boolean;
    providerCalled: boolean;
    runs: readonly {
        iteration: number;
        exitCode?: number;
        durationMs?: number;
        status: "planned" | "passed" | "failed";
    }[];
    summary?: CodeBenchmarkSummary;
    stdoutPreview: string;
    stderrPreview: string;
    truncated: boolean;
    unsafeSideEffects: false;
};
export type CodeBenchmarkResult = {
    ok: true;
    plan: CodeBenchmarkPlan;
    events: readonly string[];
} | {
    ok: false;
    error: CodeBenchmarkError;
    events: readonly string[];
};
export type CodeBenchmarkProviderRequest = {
    command: string;
    args: readonly string[];
    cwd: string;
    timeoutMs: number;
    stdin?: string;
    env?: Readonly<Record<string, string>>;
    benchmarkTarget: string;
    iteration: number;
    metric: string;
};
export type CodeBenchmarkProviderResult = {
    exitCode: number;
    stdout: string;
    stderr: string;
    durationMs?: number;
};
export type CodeBenchmarkProvider = (request: CodeBenchmarkProviderRequest, context: CodeBenchmarkContext) => CodeBenchmarkProviderResult | Promise<CodeBenchmarkProviderResult>;
export declare const codeBenchmarkDescriptor: {
    readonly toolKind: "code.benchmark";
    readonly toolId: "code.benchmark";
    readonly purpose: "run a fixed benchmark target through runtime-owned process execution";
    readonly defaultMetric: "duration-ms";
    readonly defaultIterations: 1;
    readonly maxIterations: 20;
    readonly defaultTimeoutMs: 30000;
    readonly maxTimeoutMs: 600000;
    readonly unsafeSideEffects: false;
    readonly runtimeEntryPort: "BaseToolExecutorPort.process.run";
};
export declare function planCodeBenchmark(request?: CodeBenchmarkRequest): CodeBenchmarkResult;
export declare function executeCodeBenchmark(request?: CodeBenchmarkRequest): Promise<CodeToolResult<CodeBenchmarkOutput, CodeBenchmarkErrorCode>>;
