import type { DomindsAppInstallJson } from '@longrun-ai/kernel/app-json';
import type { AppsResolutionEntry } from './resolution-file';
export type AssignedPortResolutionReason = 'no_frontend' | 'kept_existing' | 'selected_default' | 'allocated_stable_range' | 'reassigned_from_existing_conflict' | 'reassigned_from_existing_unbindable';
export type AssignedPortResolution = Readonly<{
    assignedPort: number | null;
    reason: AssignedPortResolutionReason;
}>;
/**
 * Resolve a stable non-zero assignedPort for an app frontend.
 *
 * - If the app has no frontend, returns null.
 * - If an existing assignedPort exists, keeps it when still valid/bindable.
 * - If existing assignedPort collides or is not bindable, reassigns deterministically.
 * - Otherwise, tries installJson.frontend.defaultPort when it is bindable.
 * - Falls back to a deterministic stable-range allocator.
 */
export declare function resolveStableAssignedPort(params: {
    appId: string;
    installJson: DomindsAppInstallJson;
    existingApps: ReadonlyArray<AppsResolutionEntry>;
    existingAssignedPort: number | null;
}): Promise<number | null>;
export declare function resolveStableAssignedPortWithReason(params: {
    appId: string;
    installJson: DomindsAppInstallJson;
    existingApps: ReadonlyArray<AppsResolutionEntry>;
    existingAssignedPort: number | null;
}): Promise<AssignedPortResolution>;
