    */
   public struct DistributionStateMetadata: Codable {
     var latestVersion: String?
+    var downloadURL: URL?
+
     var timestampForLastQuery: TimeInterval?
 
     var distributionMethod: DistributionMethod

      if let entry = queryResult as? Queries.PackageVersion.ResultEntry {
        self.latestVersion = entry.version
        self.distributionMethod = .cloud
      } else /* if queryResult is Queries.PackageVersion.ResultError */ {
        self.latestVersion = nil
        // The package-version query knows nothing about it - must be custom.
        self.distributionMethod = .custom
      }

      self.timestampForLastQuery = NSDate().timeIntervalSince1970
    }

    init(fromQuery: Bool = true) {
      latestVersion = nil
      timestampForLastQuery = nil

      // Assumption: we cannot install a cloud-deprecated resource from
      // in-app cloud-backed searches.
      distributionMethod = fromQuery ? .cloud : .unknown
    }
  }



  internal var versionQueryCache: DistributionStateMetadata {
    get {
      return Storage.active.userDefaults.cachedPackageQueryMetadata[self.key] ?? DistributionStateMetadata(downloadURL: nil)
    }

    set(value) {
