import type { AdaptiveRuntimeCaller, AdaptiveRuntimeGate } from "./adaptiveCapabilitySelector.js";
export type AdaptiveModuleKind = "CMP" | "MP" | "TAP" | "multiagent" | "custom" | (string & {});
export type AdaptiveModuleRebalanceBoundary = "input" | "contract" | "governance" | "runtime-state" | "module" | "scope";
export type AdaptiveModuleRebalanceErrorCode = "MISSING_RUNTIME_ID" | "MISSING_CALLER" | "MISSING_MODULES" | "MISSING_MODULE_ID" | "RUNTIME_NOT_READY" | "CONTRACT_REJECTED" | "GOVERNANCE_REJECTED" | "SCOPE_DENIED" | "NO_REBALANCE_TARGETS";
export type AdaptiveModuleRebalanceError = {
    code: AdaptiveModuleRebalanceErrorCode;
    message: string;
    boundary: AdaptiveModuleRebalanceBoundary;
    publicSafe: true;
};
export type AdaptiveModuleLoadInput = {
    moduleId?: string;
    kind?: AdaptiveModuleKind;
    ready?: boolean;
    currentWeight?: number;
    targetWeight?: number;
    loadRatio?: number;
    errorRate?: number;
    scopes?: readonly string[];
    metadata?: Readonly<Record<string, unknown>>;
};
export type AdaptiveModuleRebalanceStrategy = "stabilize" | "shed-load" | "favor-ready" | (string & {});
export type AdaptiveModuleRebalanceRequest = {
    runtimeId?: string;
    caller?: AdaptiveRuntimeCaller;
    modules?: readonly AdaptiveModuleLoadInput[];
    strategy?: AdaptiveModuleRebalanceStrategy;
    allowedScopes?: readonly string[];
    runtimeReady?: boolean;
    contract?: AdaptiveRuntimeGate;
    governance?: AdaptiveRuntimeGate;
};
export type AdaptiveModuleSnapshot = {
    moduleId: string;
    kind?: AdaptiveModuleKind;
    ready: boolean;
    currentWeight: number;
    targetWeight: number;
    loadRatio: number;
    errorRate: number;
    scopes: readonly string[];
    metadata: Readonly<Record<string, unknown>>;
};
export type AdaptiveModuleAdjustment = {
    moduleId: string;
    fromWeight: number;
    toWeight: number;
    delta: number;
    reason: "overloaded" | "underused" | "unready" | "stable";
};
export type AdaptiveModuleRebalancePlan = {
    planId: string;
    runtimeId: string;
    caller: AdaptiveRuntimeCaller;
    route: "runtime.adaptiveRuntime.adaptiveModuleRebalance";
    strategy: AdaptiveModuleRebalanceStrategy;
    modules: readonly AdaptiveModuleSnapshot[];
    adjustments: readonly AdaptiveModuleAdjustment[];
    activeModuleIds: readonly string[];
    isolatedModuleIds: readonly string[];
    contractChecked: true;
    governanceChecked: true;
    dryRun: true;
    unsafeSideEffects: false;
};
export type AdaptiveModuleRebalanceResult = {
    ok: true;
    plan: AdaptiveModuleRebalancePlan;
    events: readonly string[];
} | {
    ok: false;
    error: AdaptiveModuleRebalanceError;
    events: readonly string[];
};
export declare function planAdaptiveModuleRebalance(request?: AdaptiveModuleRebalanceRequest): AdaptiveModuleRebalanceResult;
