Dependency Constraints
resolve_constraints
POST /v1/resolve/constraints. MCP: resolve_constraints. Finite, supplied package universe only; no registry access, installation or file access. Every package is mandatory with exactly one selected version. CandidatePackage has name and versions [{version, dependencies:[{package,range}]}]. requirements [{package,range}] always apply. Dependencies apply only for their exact source version, including its build metadata. Cyclic dependencies are supported. conflicts [{left:{package,range},right:{package,range}}] forbid simultaneous matches; both sides may refer to the same package. Unknown references and duplicate package names/version strings are rejected.
Objective: lexicographically maximize versions in packages array order. Earlier packages have absolute priority over later ones; this is not a maximum sum or componentwise-newest guarantee. Strict SemVer 2.0.0 precedence compares numeric core components and prerelease identifiers; releases outrank prereleases, numeric identifiers compare numerically and rank below nonnumeric identifiers. Build metadata is ignored for precedence and range equality. Equal-precedence versions break ties by descending ASCII version string. Reordering available versions has no effect; reordering packages changes priority.
Range grammar: strict full versions, =, >, >=, <, <=; whitespace conjunction; || disjunction; ^ caret, ~ tilde; bare partials 1 or 1.2 and trailing x, X or * wildcards; whole-branch hyphen intervals such as 1.2 - 2.3. Operators may be followed by whitespace. At most 16 nonempty OR branches and 32 comparator tokens per branch. Empty ranges, tags, URLs, aliases, commas, !=, leading v, loose versions and ecosystem-specific syntax are rejected. Full versions have three nonnegative integer components without leading zeroes; numeric prerelease identifiers also forbid leading zeroes. ASCII alphanumeric/hyphen identifiers only.
Examples: ^1.2.3 is >=1.2.3 <2.0.0-0; ^0.2.3 is >=0.2.3 <0.3.0-0; ^0.0.3 is >=0.0.3 <0.0.4-0; ^0.0 is >=0.0.0 <0.1.0-0. ~1.2.3 is >=1.2.3 <1.3.0-0; 1.2.x is >=1.2.0 <1.3.0-0. Partial comparators: >1.2 is >=1.3.0, <=1.2 is <1.3.0-0, <1.2 is <1.2.0-0. Hyphen endpoints are inclusive when complete; partial upper endpoints advance the last supplied component and are exclusive. A -0 upper bound excludes prereleases of the next core tuple.
A prerelease satisfies a range branch only if that branch contains an explicit prerelease comparator with the same major/minor/patch tuple, and every comparator holds. Thus >=1.2.3-beta.2 <2.0.0 admits 1.2.3-beta.10 but excludes 1.3.0-beta.1. Ordinary * excludes prereleases. Candidate versions without any applicable range are unrestricted, including prereleases. Build metadata never opts a range into prereleases.
optimal: verified=true, assignment maps each supplied package to its original version string. A separate pure finite-domain search over original predicates finds the first lexicographic solution and must agree with the engine proposal. infeasible: verified=true, conflict is a deterministic list of structural paths into requirements, packages[i].versions[j].dependencies[k], or conflicts. Package domains remain fixed background. Independent exhaustion proves the subset infeasible and independently checked feasible witnesses exist for every single deletion. This is subset-minimal, not minimum cardinality. Constraints are deletion-minimized in requirements, dependencies, conflicts order; another minimal explanation may also exist. No raw constraint text is echoed in explanations or errors.
Limits: packages 1..64, versions 1..128 each and <=2048 total, dependencies <=64 per version; requirements, dependencies and conflicts <=512 total. Names 1..64 safe ASCII characters including scoped package separators, version strings <=128 characters, ranges <=512. Optional top-level requirements, conflicts and timeout_ms accept null as omitted. timeout_ms 100..5000, default 3000, covers engine and independent verification. Verification has a 200000-step budget counting search nodes and support checks. timeout or unknown returns verified=false and null assignment/conflict; no partial claims. Worst-case search is exponential. The same isolated child, slots, memory/CPU/output caps, payment boundary and zero-retention policy apply.
The supported subset is specified above; this is not a package-manager lockfile emulator.