import { type ExternalCommandEffect, type ExternalCommandEnvelope, type ExternalCommandReceiverRequest, type ExternalControlBoundary, type ExternalControlGate } from "./externalCommandReceiver.js";
import { type ExternalControlGuardDecision, type ExternalControlGuardError } from "./externalControlGuard.js";
import { type ExternalControlAuditEntry, type ExternalControlAuditResult } from "./externalControlAudit.js";
export type ExternalControlPortErrorCode = "COMMAND_REJECTED" | "GUARD_REJECTED" | "AUDIT_REJECTED" | "REAL_CONTROL_BLOCKED";
export type ExternalControlPortRequest = ExternalCommandReceiverRequest & {
    grantedScopes?: readonly string[];
    allowedEffects?: readonly ExternalCommandEffect[];
    previousAuditEntries?: readonly ExternalControlAuditEntry[];
    execute?: boolean;
    portContract?: ExternalControlGate;
    portGovernance?: ExternalControlGate;
};
export type ExternalControlDispatchPlan = {
    mode: "dry-run";
    commandId: string;
    runtimeId: string;
    targetSurface: string;
    route: readonly string[];
    guardStatus: "allow";
    auditCursor: string;
    actualRuntimeMutationStarted: false;
    actualToolOrModelInvocationStarted: false;
    unsafeSideEffects: false;
};
export type ExternalControlPortError = {
    code: ExternalControlPortErrorCode;
    message: string;
    boundary: ExternalControlBoundary;
    safeForInspection: true;
    internalDetailExposed: false;
};
export type ExternalControlPortResult = {
    ok: true;
    command: ExternalCommandEnvelope;
    guard: ExternalControlGuardDecision;
    audit: ExternalControlAuditEntry;
    dispatch: ExternalControlDispatchPlan;
    events: readonly string[];
} | {
    ok: false;
    error: ExternalControlPortError;
    command?: ExternalCommandEnvelope;
    guardError?: ExternalControlGuardError;
    audit?: ExternalControlAuditResult;
    events: readonly string[];
};
export declare const externalControlPortDescriptor: {
    readonly surface: "runtime.externalControl";
    readonly capability: "externalControlPort";
    readonly purpose: "receive, guard, audit, and dry-run route external runtime control commands";
    readonly mode: "dry-run";
    readonly unsafeSideEffects: false;
};
export declare function routeExternalControlCommand(request?: ExternalControlPortRequest): ExternalControlPortResult;
