diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/aggregator/uri_resolver_aggregator.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/aggregator/uri_resolver_aggregator.py index 2dee37f4..a49e9c49 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/aggregator/uri_resolver_aggregator.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/aggregator/uri_resolver_aggregator.py @@ -1,12 +1,14 @@ """This module contains the UriResolverAggregator Resolver.""" -from typing import List, Optional +from typing import List, Optional, cast from polywrap_core import ( InvokerClient, IUriResolutionContext, Uri, + UriPackage, UriPackageOrWrapper, UriResolver, + UriWrapper, ) from ...types import UriResolutionStep @@ -68,15 +70,17 @@ async def try_resolve_uri( uri_package_or_wrapper = await resolver.try_resolve_uri( uri, client, sub_context ) - if uri_package_or_wrapper != uri: + if uri_package_or_wrapper != uri or isinstance( + uri_package_or_wrapper, (UriPackage, UriWrapper) + ): step = UriResolutionStep( source_uri=uri, - result=uri_package_or_wrapper, + result=cast(UriPackageOrWrapper, uri_package_or_wrapper), sub_history=sub_context.get_history(), description=self.step_description, ) resolution_context.track_step(step) - return uri_package_or_wrapper + return cast(UriPackageOrWrapper, uri_package_or_wrapper) step = UriResolutionStep( source_uri=uri,