/**
 * N8N A2A Protocol - URL Utilities
 * Provides dynamic URL detection for A2A nodes based on n8n instance configuration
 */
export interface UrlConfig {
    protocol: 'http' | 'https';
    hostname: string;
    port?: number;
}
export interface AgentPortConfig {
    port: number;
    name: string;
    id: string;
    available?: boolean;
}
/**
 * Default A2A port configurations
 */
export declare const DEFAULT_A2A_PORTS: {
    REGISTRY: number;
    AGENTS: {
        TRANSLATOR: number;
        CALCULATOR: number;
        CODING: number;
        ORCHESTRATOR: number;
    };
};
/**
 * Predefined A2A agent configurations
 */
export declare const PREDEFINED_AGENTS: AgentPortConfig[];
/**
 * Store an A2A server using UUID-based registry pattern
 * ⚠️ IMPROVED: Following your UUID server registry approach
 */
export declare function storeActiveServer(nodeId: string, server: any, port: number, serviceType: 'registry' | 'agent'): string;
/**
 * Get stored server info for a node (using new registry pattern)
 */
export declare function getActiveServer(nodeId: string): {
    serverId: string;
    port: number;
    serviceType: 'registry' | 'agent';
    startedAt: string;
} | null;
/**
 * Stop previous server instance for a node (using UUID registry pattern)
 * ⚠️ IMPROVED: Uses your server registry approach for safe closure
 */
export declare function stopPreviousServerInstance(nodeId: string): Promise<{
    stopped: boolean;
    message: string;
}>;
/**
 * Clean up stored server reference (using UUID registry pattern)
 * ⚠️ IMPROVED: Uses your server registry approach for safe cleanup
 */
export declare function cleanupActiveServer(nodeId: string): void;
/**
 * List all stored active servers (using new registry pattern)
 */
export declare function listActiveServers(): Array<{
    nodeId: string;
    port: number;
    serviceType: 'registry' | 'agent';
    startedAt: string;
    serverId: string;
}>;
/**
 * Check if a specific port is available (both IPv4 and IPv6)
 */
export declare function isPortAvailable(port: number, host?: string): Promise<boolean>;
/**
 * Find the next available port starting from a given port
 */
export declare function findNextAvailablePort(startPort: number, maxTries?: number): Promise<number | null>;
/**
 * Check if all required A2A ports are available
 */
export declare function checkA2APortsAvailability(): Promise<{
    available: boolean;
    conflicts: {
        port: number;
        service: string;
    }[];
    suggestions: {
        port: number;
        service: string;
    }[];
}>;
/**
 * Generate port availability error message for users
 */
export declare function generatePortErrorMessage(conflicts: {
    port: number;
    service: string;
}[]): string;
/**
 * Gets an available port for A2A registry with fallback
 */
export declare function getAvailableRegistryPort(preferredPort?: number): Promise<number>;
/**
 * Gets an available port for A2A agent with fallback
 */
export declare function getAvailableAgentPort(preferredPort?: number): Promise<number>;
/**
 * Checks availability of predefined A2A agent ports
 */
export declare function checkPredefinedAgentsAvailability(): Promise<AgentPortConfig[]>;
/**
 * Gets placeholder URLs using dynamic configuration
 */
export declare function getRegistryPlaceholder(): string;
export declare function getAgentPlaceholder(): string;
/**
 * Detects the current n8n instance URL configuration
 * Priority order:
 * 1. N8N standard environment variables (WEBHOOK_URL, N8N_EDITOR_BASE_URL, etc.)
 * 2. N8N configuration variables (N8N_HOST, N8N_PROTOCOL, N8N_PORT)
 * 3. Runtime detection from request context (if available)
 * 4. Common deployment environment variables
 * 5. SSL/TLS detection
 * 6. Default to localhost
 */
export declare function detectInstanceUrl(): UrlConfig;
/**
 * Builds a complete URL from configuration and path
 */
export declare function buildUrl(config: UrlConfig, port: number, path?: string): string;
/**
 * Gets the default URL for A2A agent services
 */
export declare function getDefaultAgentUrl(port: number): string;
/**
 * Gets the default callback URL pattern for A2A callbacks
 */
export declare function getDefaultCallbackUrl(port: number): string;
/**
 * Gets the default registry URL
 */
export declare function getDefaultRegistryUrl(port?: number): string;
/**
 * Creates endpoint URLs for an agent
 */
export declare function createAgentEndpoints(port: number): {
    endpoint: string;
    tasks: string;
    health: string;
    capabilities: string;
};
/**
 * Logs the detected URL configuration for debugging
 */
export declare function logUrlConfiguration(port: number): void;
/**
 * Attempts to detect the current n8n instance URL from runtime context
 * This can be called from within node execution to get more accurate detection
 */
export declare function detectRuntimeUrl(): UrlConfig | null;
/**
 * Enhanced URL detection that tries runtime detection first, then falls back to environment
 */
export declare function detectInstanceUrlEnhanced(): UrlConfig;
/**
 * Check if a port is being used by an A2A service and get process info
 */
export declare function getPortProcessInfo(port: number): Promise<{
    inUse: boolean;
    pid?: number;
    isA2AService?: boolean;
    serviceType?: 'registry' | 'agent' | 'other';
    canRestart?: boolean;
}>;
/**
 * Kill a process by PID (Windows-specific)
 */
export declare function killProcess(pid: number): Promise<boolean>;
/**
 * Smart port management - kills A2A services for restart, errors for conflicts
 */
export declare function handlePortConflict(port: number, serviceType: 'registry' | 'agent', serviceName: string): Promise<{
    canProceed: boolean;
    message: string;
    action: 'proceed' | 'killed_and_restart' | 'error';
}>;
/**
 * Validate port availability and show user-friendly errors for workflow validation
 * ⚠️ ENHANCED: Performs comprehensive validation that prevents race conditions
 */
export declare function validateNodePort(port: number, serviceType: 'registry' | 'agent', serviceName: string, nodeId: string): Promise<{
    isValid: boolean;
    errorMessage?: string;
    suggestedPort?: number;
}>;
/**
 * Check for A2A port conflicts across multiple nodes
 */
export declare function validateWorkflowPorts(nodes: Array<{
    nodeId: string;
    port: number;
    serviceType: 'registry' | 'agent';
    serviceName: string;
}>): Promise<{
    isValid: boolean;
    errors: Array<{
        nodeId: string;
        errorMessage: string;
        suggestedPort?: number;
    }>;
}>;
