import type { ExternalCommandEffect, ExternalCommandEnvelope, ExternalControlBoundary, ExternalControlGate } from "./externalCommandReceiver.js";
export type ExternalControlPermission = "runtime.read" | "runtime.write" | "tool.invoke" | "model.invoke" | "mode.switch" | "runtime.manage" | "runtime.inspect";
export type ExternalControlGuardErrorCode = "MISSING_COMMAND" | "MISSING_COMMAND_EFFECT" | "RUNTIME_NOT_READY" | "CONTRACT_REJECTED" | "GOVERNANCE_REJECTED" | "EFFECT_NOT_ALLOWED" | "SCOPE_DENIED";
export type ExternalControlGuardRequest = {
    command?: ExternalCommandEnvelope;
    grantedScopes?: readonly string[];
    allowedEffects?: readonly ExternalCommandEffect[];
    runtimeReady?: boolean;
    contract?: ExternalControlGate;
    governance?: ExternalControlGate;
};
export type ExternalControlGuardDecision = {
    status: "allow";
    runtimeId: string;
    commandId: string;
    commandName: string;
    targetSurface: string;
    allowedEffects: readonly ExternalCommandEffect[];
    requiredScopes: readonly ExternalControlPermission[];
    grantedScopes: readonly string[];
    missingScopes: readonly string[];
    canReadRuntime: boolean;
    canMutateRuntime: boolean;
    canInvokeTool: boolean;
    canInvokeModel: boolean;
    canSwitchMode: boolean;
    canManageRuntime: boolean;
    canInspectRuntime: boolean;
    dryRun: true;
    unsafeSideEffects: false;
};
export type ExternalControlGuardError = {
    code: ExternalControlGuardErrorCode;
    message: string;
    boundary: ExternalControlBoundary;
    safeForInspection: true;
    internalDetailExposed: false;
};
export type ExternalControlGuardResult = {
    ok: true;
    decision: ExternalControlGuardDecision;
    events: readonly string[];
} | {
    ok: false;
    error: ExternalControlGuardError;
    events: readonly string[];
};
export declare const externalControlPermissionByEffect: Record<ExternalCommandEffect, ExternalControlPermission>;
export declare const externalControlGuardDescriptor: {
    readonly surface: "runtime.externalControl";
    readonly capability: "externalControlGuard";
    readonly purpose: "check external control effects against runtime scope before dispatch";
    readonly mode: "dry-run";
    readonly unsafeSideEffects: false;
};
export declare function guardExternalControl(request?: ExternalControlGuardRequest): ExternalControlGuardResult;
