An OpenAI Responses API tool bundle may depend on several versioned Python packages. Given available package versions and minimum-version dependency requirements, select one compatible version for every required package. Prefer the highest available version for each package. Return an empty dictionary if no valid selection exists.
Implement resolve_dependencies(catalog, requirements). catalog is a dictionary mapping package names to dictionaries of version strings and their dependencies. Each dependency is represented as dependency_name: minimum_version, and all version requirements are inclusive. requirements maps root package names to their minimum acceptable versions. Return a dictionary mapping every resolved package to its selected version, or {} when resolution is impossible.
Versions use major.minor.patch format and should be compared numerically, not lexicographically. The dependency graph is acyclic. A package selected while resolving one dependency may be reused if it satisfies a later minimum-version requirement.
def resolve_dependencies(catalog, requirements):