Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

68.1 KB
Raw Blame
/** @effect-diagnostics layerMergeAllWithDependencies:off */
import {
  isRetryable,
  isThrottlingError,
  isTransientError,
} from "@distilled.cloud/aws/Category";
import {
  capped,
  jittered,
  Retry,
  type Factory as RetryFactory,
} from "@distilled.cloud/aws/Retry";
import * as Duration from "effect/Duration";
import * as Effect from "effect/Effect";
import { pipe } from "effect/Function";
import * as Layer from "effect/Layer";
import * as Ref from "effect/Ref";
import * as Schedule from "effect/Schedule";
import * as HttpClientError from "effect/unstable/http/HttpClientError";
import { CredentialsStoreLive } from "../Auth/Credentials.ts";
import * as Command from "../Command/index.ts";
import { DockerLive } from "../Docker/Docker.ts";
import { KeyPair, KeyPairProvider } from "../KeyPair.ts";
import * as Provider from "../Provider.ts";
import { Random, RandomProvider } from "../Random.ts";
import * as AccessAnalyzer from "./AccessAnalyzer/index.ts";
import * as Account from "./Account/index.ts";
import * as ACM from "./ACM/index.ts";
import * as ACMPCA from "./ACMPCA/index.ts";
import * as AIOps from "./AIOps/index.ts";
import * as AMP from "./AMP/index.ts";
import * as Amplify from "./Amplify/index.ts";
import * as ApiGateway from "./ApiGateway/index.ts";
import * as ApiGatewayV2 from "./ApiGatewayV2/index.ts";
import * as AppConfig from "./AppConfig/index.ts";
import * as AppFlow from "./AppFlow/index.ts";
import * as AppIntegrations from "./AppIntegrations/index.ts";
import * as ApplicationAutoScaling from "./ApplicationAutoScaling/index.ts";
import * as ApplicationSignals from "./ApplicationSignals/index.ts";
import * as AppRegistry from "./AppRegistry/index.ts";
import * as AppRunner from "./AppRunner/index.ts";
import * as AppSync from "./AppSync/index.ts";
import * as Assets from "./Assets.ts";
import * as Athena from "./Athena/index.ts";
import * as AuditManager from "./AuditManager/index.ts";
import { AwsAuth } from "./AuthProvider.ts";
import * as AutoScaling from "./AutoScaling/index.ts";
import * as B2BI from "./B2BI/index.ts";
import * as Backup from "./Backup/index.ts";
import * as BackupSearch from "./BackupSearch/index.ts";
import * as Batch from "./Batch/index.ts";
import * as BCMDataExports from "./BCMDataExports/index.ts";
import * as Bedrock from "./Bedrock/index.ts";
import * as BedrockAgentCore from "./BedrockAgentCore/index.ts";
import * as BedrockDataAutomation from "./BedrockDataAutomation/index.ts";
import * as Budgets from "./Budgets/index.ts";
import * as Chatbot from "./Chatbot/index.ts";
import * as CloudControl from "./CloudControl/index.ts";
import * as CloudFormation from "./CloudFormation/index.ts";
import * as CloudFront from "./CloudFront/index.ts";
import * as CloudHSMV2 from "./CloudHSMV2/index.ts";
import * as CloudMap from "./CloudMap/index.ts";
import * as CloudTrail from "./CloudTrail/index.ts";
import * as CloudWatch from "./CloudWatch/index.ts";
import * as CodeArtifact from "./CodeArtifact/index.ts";
import * as CodeBuild from "./CodeBuild/index.ts";
import * as CodeConnections from "./CodeConnections/index.ts";
import * as CodeDeploy from "./CodeDeploy/index.ts";
import * as CodePipeline from "./CodePipeline/index.ts";
import * as Cognito from "./Cognito/index.ts";
import * as Config from "./Config/index.ts";
import * as ControlTower from "./ControlTower/index.ts";
import * as CostAndUsageReport from "./CostAndUsageReport/index.ts";
import * as CostExplorer from "./CostExplorer/index.ts";
import * as Credentials from "./Credentials.ts";
import * as DataBrew from "./DataBrew/index.ts";
import * as DataExchange from "./DataExchange/index.ts";
import * as DataSync from "./DataSync/index.ts";
import * as DataZone from "./DataZone/index.ts";
import * as DAX from "./DAX/index.ts";
import * as Deadline from "./Deadline/index.ts";
import * as DirectoryService from "./DirectoryService/index.ts";
import * as DLM from "./DLM/index.ts";
import * as DMS from "./DMS/index.ts";
import * as Detective from "./Detective/index.ts";
import * as DevOpsGuru from "./DevOpsGuru/index.ts";
import * as DocDB from "./DocDB/index.ts";
import * as DocDBElastic from "./DocDBElastic/index.ts";
import * as DSQL from "./DSQL/index.ts";
import * as DynamoDB from "./DynamoDB/index.ts";
import * as EC2 from "./EC2/index.ts";
import * as ECR from "./ECR/index.ts";
import * as ECRPublic from "./ECRPublic/index.ts";
import * as ECS from "./ECS/index.ts";
import * as EFS from "./EFS/index.ts";
import * as EKS from "./EKS/index.ts";
import * as ElastiCache from "./ElastiCache/index.ts";
import * as ELBv2 from "./ELBv2/index.ts";
import * as EMR from "./EMR/index.ts";
import * as EMRContainers from "./EMRContainers/index.ts";
import * as EMRServerless from "./EMRServerless/index.ts";
import * as Endpoint from "./Endpoint.ts";
import * as EntityResolution from "./EntityResolution/index.ts";
import { Default as DefaultEnvironment } from "./Environment.ts";
import * as EventBridge from "./EventBridge/index.ts";
import * as FIS from "./FIS/index.ts";
import * as FMS from "./FMS/index.ts";
import * as FinSpace from "./FinSpace/index.ts";
import * as Firehose from "./Firehose/index.ts";
import * as Forecast from "./Forecast/index.ts";
import * as FraudDetector from "./FraudDetector/index.ts";
import * as FSx from "./FSx/index.ts";
import * as Glacier from "./Glacier/index.ts";
import * as GlobalAccelerator from "./GlobalAccelerator/index.ts";
import * as Glue from "./Glue/index.ts";
import * as Grafana from "./Grafana/index.ts";
import * as GreengrassV2 from "./GreengrassV2/index.ts";
import * as GuardDuty from "./GuardDuty/index.ts";
import * as HealthLake from "./HealthLake/index.ts";
import * as IAM from "./IAM/index.ts";
import * as IdentityCenter from "./IdentityCenter/index.ts";
import * as ImageBuilder from "./ImageBuilder/index.ts";
import * as Inspector2 from "./Inspector2/index.ts";
import * as InternetMonitor from "./InternetMonitor/index.ts";
import * as IoT from "./IoT/index.ts";
import * as IoTFleetWise from "./IoTFleetWise/index.ts";
import * as IoTManagedIntegrations from "./IoTManagedIntegrations/index.ts";
import * as IoTSiteWise from "./IoTSiteWise/index.ts";
import * as IoTWireless from "./IoTWireless/index.ts";
import * as IVS from "./IVS/index.ts";
import * as IVSChat from "./IVSChat/index.ts";
import * as IVSRealtime from "./IVSRealtime/index.ts";
import * as Kafka from "./Kafka/index.ts";
import * as Kendra from "./Kendra/index.ts";
import * as Keyspaces from "./Keyspaces/index.ts";
import * as Kinesis from "./Kinesis/index.ts";
import * as KinesisAnalyticsV2 from "./KinesisAnalyticsV2/index.ts";
import * as KinesisVideo from "./KinesisVideo/index.ts";
import * as KMS from "./KMS/index.ts";
import * as LakeFormation from "./LakeFormation/index.ts";
import * as Lambda from "./Lambda/index.ts";
import * as LexV2 from "./LexV2/index.ts";
import * as LicenseManager from "./LicenseManager/index.ts";
import * as Location from "./Location/index.ts";
import * as Logs from "./Logs/index.ts";
import * as MediaConnect from "./MediaConnect/index.ts";
import * as MediaConvert from "./MediaConvert/index.ts";
import * as MediaLive from "./MediaLive/index.ts";
import * as MediaPackageV2 from "./MediaPackageV2/index.ts";
import * as MediaTailor from "./MediaTailor/index.ts";
import * as MedicalImaging from "./MedicalImaging/index.ts";
import * as MQ from "./MQ/index.ts";
import * as MWAA from "./MWAA/index.ts";
import * as MWAAServerless from "./MWAAServerless/index.ts";
import * as Macie2 from "./Macie2/index.ts";
import * as MailManager from "./MailManager/index.ts";
import * as MemoryDB from "./MemoryDB/index.ts";
import * as Neptune from "./Neptune/index.ts";
import * as NeptuneGraph from "./NeptuneGraph/index.ts";
import * as NetworkFirewall from "./NetworkFirewall/index.ts";
import * as Notifications from "./Notifications/index.ts";
import * as NotificationsContacts from "./NotificationsContacts/index.ts";
import * as OAM from "./OAM/index.ts";
import * as ObservabilityAdmin from "./ObservabilityAdmin/index.ts";
import * as Omics from "./Omics/index.ts";
import * as OpenSearch from "./OpenSearch/index.ts";
import * as OpenSearchServerless from "./OpenSearchServerless/index.ts";
import * as OSIS from "./OSIS/index.ts";
import * as Organizations from "./Organizations/index.ts";
import * as PaymentCryptography from "./PaymentCryptography/index.ts";
import * as Personalize from "./Personalize/index.ts";
import * as PinpointSMSVoiceV2 from "./PinpointSMSVoiceV2/index.ts";
import * as Pipes from "./Pipes/index.ts";
import * as Polly from "./Polly/index.ts";
import * as QApps from "./QApps/index.ts";
import * as QBusiness from "./QBusiness/index.ts";
import * as QuickSight from "./QuickSight/index.ts";
import * as RAM from "./RAM/index.ts";
import * as RDS from "./RDS/index.ts";
import * as Rbin from "./Rbin/index.ts";
import * as RePostSpace from "./RePostSpace/index.ts";
import * as Redshift from "./Redshift/index.ts";
import * as RedshiftServerless from "./RedshiftServerless/index.ts";
import * as ResourceExplorer from "./ResourceExplorer/index.ts";
import * as ResourceGroups from "./ResourceGroups/index.ts";
import * as RolesAnywhere from "./RolesAnywhere/index.ts";
import * as Region from "./Region.ts";
import * as Route53 from "./Route53/index.ts";
import * as Route53Profiles from "./Route53Profiles/index.ts";
import * as Route53Resolver from "./Route53Resolver/index.ts";
import * as RUM from "./RUM/index.ts";
import * as S3 from "./S3/index.ts";
import * as S3Control from "./S3Control/index.ts";
import * as S3Files from "./S3Files/index.ts";
import * as S3Tables from "./S3Tables/index.ts";
import * as S3Vectors from "./S3Vectors/index.ts";
import * as SageMaker from "./SageMaker/index.ts";
import * as Scheduler from "./Scheduler/index.ts";
import * as Schemas from "./Schemas/index.ts";
import * as SecretsManager from "./SecretsManager/index.ts";
import * as SecurityHub from "./SecurityHub/index.ts";
import * as SecurityLake from "./SecurityLake/index.ts";
import * as ServiceCatalog from "./ServiceCatalog/index.ts";
import * as ServiceQuotas from "./ServiceQuotas/index.ts";
import * as SES from "./SES/index.ts";
import * as Shield from "./Shield/index.ts";
import * as Signer from "./Signer/index.ts";
import * as SimpleDB from "./SimpleDB/index.ts";
import * as SNS from "./SNS/index.ts";
import * as SocialMessaging from "./SocialMessaging/index.ts";
import * as SQS from "./SQS/index.ts";
import * as SSM from "./SSM/index.ts";
import * as SSMContacts from "./SSMContacts/index.ts";
import * as SSMIncidents from "./SSMIncidents/index.ts";
import * as StepFunctions from "./StepFunctions/index.ts";
import * as Synthetics from "./Synthetics/index.ts";
import * as Textract from "./Textract/index.ts";
import * as Timestream from "./Timestream/index.ts";
import * as Transfer from "./Transfer/index.ts";
import * as Translate from "./Translate/index.ts";
import * as VerifiedPermissions from "./VerifiedPermissions/index.ts";
import * as VpcLattice from "./VpcLattice/index.ts";
import * as WAFv2 from "./WAFv2/index.ts";
import * as Website from "./Website/index.ts";
import * as XRay from "./XRay/index.ts";

export class Providers extends Provider.ProviderCollection<Providers>()(
  "AWS",
) {}

export const providers = () =>
  Layer.effect(
    Providers,
    Provider.collection([
      KeyPair,
      Random,
      AccessAnalyzer.Analyzer,
      AccessAnalyzer.ArchiveRule,
      Account.AccountName,
      Account.AlternateContact,
      Account.ContactInformation,
      Account.Region,
      ACM.AccountConfiguration,
      ACM.Certificate,
      ACMPCA.CertificateAuthority,
      ACMPCA.CertificateAuthorityPolicy,
      ACMPCA.Permission,
      AIOps.InvestigationGroup,
      AMP.AlertManagerDefinition,
      AMP.AnomalyDetector,
      AMP.LoggingConfiguration,
      AMP.QueryLoggingConfiguration,
      AMP.ResourcePolicy,
      AMP.RuleGroupsNamespace,
      AMP.Scraper,
      AMP.ScraperLoggingConfiguration,
      AMP.Workspace,
      Amplify.App,
      Amplify.Branch,
      ApiGateway.Account,
      ApiGateway.ApiKey,
      ApiGateway.Authorizer,
      ApiGateway.BasePathMapping,
      ApiGateway.DeploymentResource,
      ApiGateway.DomainName,
      ApiGateway.GatewayResponse,
      ApiGateway.MethodResource,
      ApiGateway.GatewayResource,
      ApiGateway.RestApi,
      ApiGateway.StageResource,
      ApiGateway.UsagePlan,
      ApiGateway.UsagePlanKey,
      ApiGateway.VpcLink,
      ApiGatewayV2.Api,
      ApiGatewayV2.ApiMappingResource,
      ApiGatewayV2.AuthorizerResource,
      ApiGatewayV2.DomainName,
      ApiGatewayV2.IntegrationResource,
      ApiGatewayV2.RouteResource,
      ApiGatewayV2.StageResource,
      ApiGatewayV2.VpcLink,
      AppConfig.Application,
      AppConfig.ConfigurationProfile,
      AppConfig.Deployment,
      AppConfig.DeploymentStrategy,
      AppConfig.Environment,
      AppConfig.Extension,
      AppConfig.ExtensionAssociation,
      AppConfig.HostedConfigurationVersion,
      AppFlow.ConnectorProfile,
      AppFlow.Flow,
      AppIntegrations.Application,
      AppIntegrations.DataIntegration,
      AppIntegrations.EventIntegration,
      ApplicationAutoScaling.ScalableTarget,
      ApplicationAutoScaling.ScalingPolicy,
      ApplicationAutoScaling.ScheduledAction,
      ApplicationSignals.Discovery,
      ApplicationSignals.GroupingConfiguration,
      ApplicationSignals.InstrumentationConfiguration,
      ApplicationSignals.ServiceLevelObjective,
      AppRegistry.Application,
      AppRegistry.AttributeGroup,
      AppRegistry.AttributeGroupAssociation,
      AppRegistry.ResourceAssociation,
      AppRunner.AutoScalingConfiguration,
      AppRunner.ObservabilityConfiguration,
      AppRunner.Service,
      AppRunner.VpcConnector,
      AppSync.ApiAssociationResource,
      AppSync.ApiKeyResource,
      AppSync.DataSourceResource,
      AppSync.DomainName,
      AppSync.FunctionResource,
      AppSync.GraphqlApi,
      AppSync.ResolverResource,
      Athena.DataCatalog,
      Athena.NamedQuery,
      Athena.PreparedStatement,
      Athena.WorkGroup,
      AuditManager.Assessment,
      AuditManager.Control,
      AuditManager.Framework,
      AutoScaling.AutoScalingGroup,
      AutoScaling.LaunchTemplate,
      AutoScaling.LifecycleHook,
      AutoScaling.ScalingPolicy,
      AutoScaling.ScheduledAction,
      B2BI.Capability,
      B2BI.Partnership,
      B2BI.Profile,
      B2BI.Transformer,
      Backup.BackupPlan,
      Backup.BackupSelection,
      Backup.BackupVault,
      BackupSearch.ExportJob,
      BackupSearch.SearchJob,
      Batch.ComputeEnvironment,
      Batch.JobDefinition,
      Batch.JobQueue,
      BCMDataExports.Export,
      Bedrock.Agent,
      Bedrock.AgentAlias,
      Bedrock.DataSource,
      Bedrock.KnowledgeBase,
      BedrockAgentCore.BrowserCustom,
      BedrockAgentCore.CodeInterpreter,
      BedrockAgentCore.Gateway,
      BedrockAgentCore.Memory,
      BedrockAgentCore.Runtime,
      BedrockDataAutomation.Blueprint,
      BedrockDataAutomation.DataAutomationLibrary,
      BedrockDataAutomation.DataAutomationProject,
      Budgets.Budget,
      Budgets.BudgetAction,
      Chatbot.Association,
      Chatbot.CustomAction,
      Chatbot.MicrosoftTeamsChannelConfiguration,
      Chatbot.SlackChannelConfiguration,
      CloudControl.Resource,
      CloudFormation.Stack,
      CloudFront.CachePolicy,
      CloudFront.Distribution,
      CloudFront.Function,
      CloudFront.Invalidation,
      CloudFront.KeyGroup,
      CloudFront.KeyValueStore,
      CloudFront.KvEntries,
      CloudFront.KvRoutesUpdate,
      CloudFront.OriginAccessControl,
      CloudFront.OriginRequestPolicy,
      CloudFront.PublicKey,
      CloudFront.RealtimeLogConfig,
      CloudFront.ResponseHeadersPolicy,
      CloudFront.VpcOrigin,
      CloudHSMV2.Cluster,
      CloudHSMV2.Hsm,
      CloudMap.HttpNamespace,
      CloudMap.InstanceRegistration,
      CloudMap.PrivateDnsNamespace,
      CloudMap.PublicDnsNamespace,
      CloudMap.Service,
      CloudTrail.EventDataStore,
      CloudTrail.Trail,
      CloudWatch.Alarm,
      CloudWatch.AlarmMuteRule,
      CloudWatch.AnomalyDetector,
      CloudWatch.CompositeAlarm,
      CloudWatch.Dashboard,
      CloudWatch.InsightRule,
      CloudWatch.MetricStream,
      CodeArtifact.Domain,
      CodeArtifact.Repository,
      CodeBuild.Project,
      CodeBuild.ReportGroup,
      CodeConnections.Connection,
      CodeConnections.Host,
      CodeConnections.RepositoryLink,
      CodeConnections.SyncConfiguration,
      CodeDeploy.Application,
      CodeDeploy.DeploymentConfig,
      CodeDeploy.DeploymentGroup,
      CodePipeline.Pipeline,
      Cognito.Group,
      Cognito.IdentityPool,
      Cognito.IdentityPoolRoleAttachment,
      Cognito.IdentityProvider,
      Cognito.ResourceServer,
      Cognito.User,
      Cognito.UserPool,
      Cognito.UserPoolClient,
      Cognito.UserPoolDomain,
      Config.AggregationAuthorization,
      Config.ConfigRule,
      Config.ConfigurationRecorder,
      Config.DeliveryChannel,
      Config.RetentionConfiguration,
      ControlTower.EnabledBaseline,
      ControlTower.EnabledControl,
      ControlTower.LandingZone,
      CostAndUsageReport.ReportDefinition,
      CostExplorer.AnomalyMonitor,
      CostExplorer.AnomalySubscription,
      CostExplorer.CostCategory,
      DataBrew.Dataset,
      DataBrew.Job,
      DataBrew.Project,
      DataBrew.Recipe,
      DataBrew.Ruleset,
      DataBrew.Schedule,
      DataExchange.DataSet,
      DataExchange.EventAction,
      DataExchange.Revision,
      DataSync.LocationEfs,
      DataSync.LocationS3,
      DataSync.Task,
      DataZone.Domain,
      DataZone.Environment,
      DataZone.EnvironmentBlueprintConfiguration,
      DataZone.Project,
      DAX.Cluster,
      DAX.ParameterGroup,
      DAX.SubnetGroup,
      Deadline.Budget,
      Deadline.Farm,
      Deadline.Fleet,
      Deadline.Monitor,
      Deadline.Queue,
      Deadline.StorageProfile,
      DirectoryService.ConditionalForwarder,
      DirectoryService.Directory,
      DirectoryService.EventTopic,
      DLM.LifecyclePolicy,
      DocDB.DBCluster,
      DocDB.DBInstance,
      DocDB.DBSubnetGroup,
      DocDBElastic.Cluster,
      DMS.Endpoint,
      DMS.ReplicationInstance,
      DMS.ReplicationSubnetGroup,
      DSQL.Cluster,
      DSQL.ClusterPolicy,
      DSQL.Stream,
      Detective.Graph,
      DevOpsGuru.EventSourcesConfig,
      DevOpsGuru.NotificationChannel,
      DevOpsGuru.ResourceCollection,
      DevOpsGuru.ServiceIntegration,
      DynamoDB.Table,
      EC2.DhcpOptions,
      EC2.EgressOnlyInternetGateway,
      EC2.EIP,
      EC2.FlowLog,
      EC2.Instance,
      EC2.InternetGateway,
      EC2.KeyPair,
      EC2.NatGateway,
      EC2.NetworkAcl,
      EC2.NetworkAclAssociation,
      EC2.NetworkAclEntry,
      EC2.NetworkInterface,
      EC2.NetworkInterfaceAttachment,
      EC2.PrefixList,
      EC2.Route,
      EC2.RouteTable,
      EC2.RouteTableAssociation,
      EC2.SecurityGroup,
      EC2.SecurityGroupRule,
      EC2.Snapshot,
      EC2.Subnet,
      EC2.Volume,
      EC2.VolumeAttachment,
      EC2.Vpc,
      EC2.VpcEndpoint,
      EC2.VpcPeeringConnection,
      ECR.Image,
      ECR.RegistryPolicy,
      ECR.Repository,
      ECRPublic.PublicRepository,
      ECS.CapacityProvider,
      ECS.Cluster,
      ECS.Service,
      ECS.Task,
      ECS.TaskDefinition,
      EFS.AccessPoint,
      EFS.FileSystem,
      EFS.MountTarget,
      EKS.AccessEntry,
      EKS.Addon,
      EKS.Cluster,
      EKS.Deployment,
      EKS.FargateProfile,
      EKS.HelmChart,
      EKS.Job,
      EKS.Manifest,
      EKS.Nodegroup,
      EKS.PodIdentityAssociation,
      ElastiCache.ServerlessCache,
      ELBv2.Listener,
      ELBv2.ListenerCertificate,
      ELBv2.ListenerRule,
      ELBv2.LoadBalancer,
      ELBv2.TargetGroup,
      ELBv2.TargetGroupAttachment,
      ELBv2.TrustStore,
      EMR.Cluster,
      EMR.SecurityConfiguration,
      EMR.Studio,
      EMRContainers.JobTemplate,
      EMRContainers.VirtualCluster,
      EMRServerless.Application,
      EntityResolution.IdMappingWorkflow,
      EntityResolution.IdNamespace,
      EntityResolution.MatchingWorkflow,
      EntityResolution.SchemaMapping,
      EventBridge.ApiDestination,
      EventBridge.Archive,
      EventBridge.Connection,
      EventBridge.EventBus,
      EventBridge.Permission,
      EventBridge.Rule,
      FIS.ExperimentTemplate,
      FIS.TargetAccountConfiguration,
      FMS.AdminAccount,
      FinSpace.Environment,
      FinSpace.KxCluster,
      FinSpace.KxDatabase,
      FinSpace.KxEnvironment,
      Firehose.DeliveryStream,
      FSx.FileSystem,
      Forecast.Dataset,
      Forecast.DatasetGroup,
      FraudDetector.Detector,
      FraudDetector.DetectorVersion,
      FraudDetector.EntityType,
      FraudDetector.EventType,
      FraudDetector.Label,
      FraudDetector.List,
      FraudDetector.Outcome,
      FraudDetector.Variable,
      Glacier.Vault,
      GlobalAccelerator.Accelerator,
      GlobalAccelerator.EndpointGroup,
      GlobalAccelerator.Listener,
      Glue.Connection,
      Glue.Crawler,
      Glue.Database,
      Glue.Job,
      Glue.Table,
      Grafana.Workspace,
      GreengrassV2.ComponentVersion,
      GreengrassV2.Deployment,
      GuardDuty.Detector,
      GuardDuty.Filter,
      GuardDuty.IPSet,
      GuardDuty.ThreatIntelSet,
      HealthLake.FHIRDatastore,
      IAM.AccessKey,
      IAM.AccountAlias,
      IAM.AccountPasswordPolicy,
      IAM.Group,
      IAM.GroupMembership,
      IAM.InstanceProfile,
      IAM.LoginProfile,
      IAM.OpenIDConnectProvider,
      IAM.Policy,
      IAM.Role,
      IAM.SAMLProvider,
      IAM.ServerCertificate,
      IAM.ServiceLinkedRole,
      IAM.ServiceSpecificCredential,
      IAM.SigningCertificate,
      IAM.SSHPublicKey,
      IAM.User,
      IAM.VirtualMFADevice,
      IdentityCenter.AccountAssignment,
      IdentityCenter.Group,
      IdentityCenter.Instance,
      ImageBuilder.Component,
      ImageBuilder.DistributionConfiguration,
      ImageBuilder.ImagePipeline,
      ImageBuilder.ImageRecipe,
      ImageBuilder.InfrastructureConfiguration,
      Inspector2.CisScanConfiguration,
      Inspector2.Enabler,
      Inspector2.Filter,
      InternetMonitor.Monitor,
      IdentityCenter.PermissionSet,
      IoT.Policy,
      IoT.Thing,
      IoT.ThingType,
      IoT.TopicRule,
      IoTFleetWise.Campaign,
      IoTFleetWise.DecoderManifest,
      IoTFleetWise.Fleet,
      IoTFleetWise.ModelManifest,
      IoTFleetWise.SignalCatalog,
      IoTFleetWise.StateTemplate,
      IoTFleetWise.Vehicle,
      IoTManagedIntegrations.CredentialLocker,
      IoTManagedIntegrations.Destination,
      IoTManagedIntegrations.ManagedThing,
      IoTManagedIntegrations.NotificationConfiguration,
      IoTSiteWise.Asset,
      IoTSiteWise.AssetModel,
      IoTSiteWise.Gateway,
      IoTWireless.Destination,
      IoTWireless.DeviceProfile,
      IoTWireless.ServiceProfile,
      IoTWireless.WirelessDevice,
      IoTWireless.WirelessGateway,
      IVS.Channel,
      IVS.PlaybackKeyPair,
      IVS.PlaybackRestrictionPolicy,
      IVS.RecordingConfiguration,
      IVS.StreamKey,
      IVSChat.LoggingConfiguration,
      IVSChat.Room,
      IVSRealtime.Stage,
      Kafka.ServerlessCluster,
      Kendra.DataSource,
      Kendra.Index,
      Keyspaces.Keyspace,
      Keyspaces.Table,
      Keyspaces.Type,
      KMS.Alias,
      KMS.Key,
      Kinesis.Stream,
      Kinesis.StreamConsumer,
      KinesisAnalyticsV2.Application,
      KinesisAnalyticsV2.ApplicationCloudWatchLoggingOption,
      KinesisAnalyticsV2.ApplicationSnapshot,
      KinesisVideo.SignalingChannel,
      KinesisVideo.Stream,
      LakeFormation.DataCellsFilter,
      LakeFormation.DataLakeSettings,
      LakeFormation.LFTag,
      LakeFormation.LFTagAssociation,
      LakeFormation.LFTagExpression,
      LakeFormation.OptIn,
      LakeFormation.Permissions,
      LakeFormation.Resource,
      Lambda.Alias,
      Lambda.EventSourceMapping,
      Lambda.Function,
      Lambda.MicrovmImage,
      Lambda.NetworkConnector,
      Lambda.Permission,
      LexV2.Bot,
      LexV2.BotAlias,
      LexV2.BotLocale,
      LexV2.BotVersion,
      LexV2.Intent,
      LexV2.SlotType,
      LicenseManager.LicenseConfiguration,
      Location.ApiKey,
      Location.GeofenceCollection,
      Location.Map,
      Location.PlaceIndex,
      Location.RouteCalculator,
      Location.Tracker,
      Location.TrackerConsumer,
      Logs.Destination,
      Logs.LogGroup,
      Logs.LogStream,
      Logs.MetricFilter,
      Logs.ResourcePolicy,
      Logs.SubscriptionFilter,
      MediaConnect.Flow,
      MediaConvert.Job,
      MediaConvert.JobTemplate,
      MediaConvert.Preset,
      MediaConvert.Queue,
      MediaLive.Channel,
      MediaLive.Input,
      MediaLive.InputSecurityGroup,
      MediaPackageV2.Channel,
      MediaPackageV2.ChannelGroup,
      MediaPackageV2.OriginEndpoint,
      MediaTailor.PlaybackConfiguration,
      MedicalImaging.Datastore,
      MQ.Broker,
      MQ.Configuration,
      MWAA.Environment,
      MWAAServerless.Workflow,
      Macie2.Session,
      Macie2.ClassificationJob,
      Macie2.AllowList,
      Macie2.CustomDataIdentifier,
      Macie2.FindingsFilter,
      MailManager.AddonInstance,
      MailManager.AddonSubscription,
      MailManager.AddressList,
      MailManager.Archive,
      MailManager.IngressPoint,
      MailManager.Relay,
      MailManager.RuleSet,
      MailManager.TrafficPolicy,
      MemoryDB.ACL,
      MemoryDB.Cluster,
      MemoryDB.ParameterGroup,
      MemoryDB.SubnetGroup,
      MemoryDB.User,
      Neptune.DBCluster,
      Neptune.DBClusterParameterGroup,
      Neptune.DBInstance,
      Neptune.DBParameterGroup,
      Neptune.DBSubnetGroup,
      NeptuneGraph.Graph,
      NetworkFirewall.Firewall,
      NetworkFirewall.FirewallPolicy,
      NetworkFirewall.LoggingConfiguration,
      NetworkFirewall.RuleGroup,
      Notifications.ChannelAssociation,
      Notifications.EventRule,
      Notifications.NotificationConfiguration,
      Notifications.NotificationHub,
      NotificationsContacts.EmailContact,
      OAM.Link,
      OAM.Sink,
      ObservabilityAdmin.TelemetryConfig,
      ObservabilityAdmin.TelemetryRule,
      Omics.AnnotationStore,
      Omics.ReferenceStore,
      Omics.RunGroup,
      Omics.SequenceStore,
      Omics.VariantStore,
      Omics.Workflow,
      OpenSearch.Domain,
      OSIS.Pipeline,
      OSIS.PipelineEndpoint,
      OSIS.ResourcePolicy,
      OpenSearchServerless.AccessPolicy,
      OpenSearchServerless.Collection,
      OpenSearchServerless.CollectionGroup,
      OpenSearchServerless.LifecyclePolicy,
      OpenSearchServerless.SecurityConfig,
      OpenSearchServerless.SecurityPolicy,
      OpenSearchServerless.VpcEndpoint,
      Organizations.Account,
      Organizations.DelegatedAdministrator,
      Organizations.Organization,
      Organizations.OrganizationalUnit,
      Organizations.OrganizationResourcePolicy,
      Organizations.Policy,
      Organizations.PolicyAttachment,
      Organizations.Root,
      Organizations.RootPolicyType,
      Organizations.TrustedServiceAccess,
      PaymentCryptography.Alias,
      PaymentCryptography.Key,
      Personalize.Dataset,
      Personalize.DatasetGroup,
      Personalize.EventTracker,
      Personalize.Schema,
      PinpointSMSVoiceV2.ConfigurationSet,
      PinpointSMSVoiceV2.EventDestination,
      PinpointSMSVoiceV2.OptOutList,
      PinpointSMSVoiceV2.PhoneNumber,
      Pipes.Pipe,
      Polly.Lexicon,
      QApps.QApp,
      QBusiness.Application,
      QBusiness.DataSource,
      QBusiness.Index,
      QBusiness.Retriever,
      QBusiness.WebExperience,
      QuickSight.Analysis,
      QuickSight.Dashboard,
      QuickSight.DataSet,
      QuickSight.DataSource,
      RAM.Permission,
      RAM.ResourceShare,
      RDS.DBCluster,
      RDS.DBClusterEndpoint,
      RDS.DBClusterParameterGroup,
      RDS.DBInstance,
      RDS.DBParameterGroup,
      RDS.DBProxy,
      RDS.DBProxyEndpoint,
      RDS.DBProxyTargetGroup,
      RDS.DBSubnetGroup,
      Rbin.Rule,
      RePostSpace.Space,
      Redshift.Cluster,
      Redshift.ClusterParameterGroup,
      Redshift.ClusterSubnetGroup,
      Redshift.EventSubscription,
      RedshiftServerless.Namespace,
      RedshiftServerless.Workgroup,
      ResourceExplorer.Index,
      ResourceExplorer.View,
      ResourceGroups.Group,
      RolesAnywhere.Crl,
      RolesAnywhere.Profile,
      RolesAnywhere.TrustAnchor,
      Route53.HealthCheck,
      Route53.HostedZone,
      Route53.QueryLoggingConfig,
      Route53.Record,
      Route53.VpcAssociationAuthorization,
      Route53.ZoneVpcAssociation,
      Route53Profiles.Profile,
      Route53Profiles.ProfileAssociation,
      Route53Profiles.ProfileResourceAssociation,
      Route53Resolver.ResolverEndpoint,
      Route53Resolver.ResolverRule,
      Route53Resolver.ResolverRuleAssociation,
      RUM.AppMonitor,
      RUM.MetricsDestination,
      RUM.ResourcePolicy,
      S3.Bucket,
      S3Control.AccessPoint,
      S3Control.AccessPointPolicy,
      S3Control.MultiRegionAccessPoint,
      S3Control.ObjectLambdaAccessPoint,
      S3Control.StorageLensConfiguration,
      S3Files.AccessPoint,
      S3Files.FileSystem,
      S3Tables.TableBucket,
      S3Tables.Namespace,
      S3Tables.Table,
      S3Vectors.VectorBucket,
      S3Vectors.Index,
      SageMaker.Model,
      SageMaker.EndpointConfig,
      SageMaker.Endpoint,
      SageMaker.FeatureGroup,
      SageMaker.Cluster,
      SageMaker.ClusterSchedulerConfig,
      SageMaker.ComputeQuota,
      Scheduler.Schedule,
      Scheduler.ScheduleGroup,
      Schemas.Discoverer,
      Schemas.Registry,
      Schemas.Schema,
      SecurityHub.ActionTarget,
      SecurityHub.AutomationRule,
      SecurityHub.FindingAggregator,
      SecurityHub.Hub,
      SecurityHub.Insight,
      SecurityLake.AwsLogSource,
      SecurityLake.CustomLogSource,
      SecurityLake.DataLake,
      SecurityLake.ExceptionSubscription,
      SecurityLake.Subscriber,
      SecurityLake.SubscriberNotification,
      SecretsManager.RotationSchedule,
      SecretsManager.Secret,
      ServiceCatalog.Portfolio,
      ServiceCatalog.PortfolioProductAssociation,
      ServiceCatalog.PrincipalPortfolioAssociation,
      ServiceCatalog.Product,
      ServiceQuotas.ServiceQuotaIncreaseRequest,
      SES.ConfigurationSet,
      SES.ConfigurationSetEventDestination,
      SES.EmailIdentity,
      SES.EmailTemplate,
      Shield.Protection,
      Shield.ProtectionGroup,
      Shield.Subscription,
      Signer.ProfilePermission,
      Signer.SigningProfile,
      SimpleDB.Domain,
      SNS.PlatformApplication,
      SNS.Subscription,
      SNS.Topic,
      SocialMessaging.LinkedWhatsAppBusinessAccount,
      SQS.Queue,
      SSM.Parameter,
      SSMContacts.Contact,
      SSMContacts.ContactChannel,
      SSMContacts.Plan,
      SSMContacts.Rotation,
      SSMIncidents.ReplicationSet,
      SSMIncidents.ResponsePlan,
      StepFunctions.Activity,
      StepFunctions.StateMachine,
      Synthetics.Canary,
      Synthetics.Group,
      Textract.Adapter,
      Timestream.Database,
      Timestream.DbInstance,
      Timestream.ScheduledQuery,
      Timestream.Table,
      Transfer.Server,
      Transfer.User,
      Translate.ParallelData,
      Translate.Terminology,
      VerifiedPermissions.IdentitySource,
      VerifiedPermissions.Policy,
      VerifiedPermissions.PolicyStore,
      VerifiedPermissions.PolicyStoreAlias,
      VerifiedPermissions.PolicyTemplate,
      VerifiedPermissions.Schema,
      VpcLattice.AccessLogSubscription,
      VpcLattice.AuthPolicy,
      VpcLattice.Listener,
      VpcLattice.ResourcePolicy,
      VpcLattice.Rule,
      VpcLattice.ServiceNetworkServiceAssociation,
      VpcLattice.TargetGroup,
      VpcLattice.Service,
      VpcLattice.ServiceNetwork,
      VpcLattice.ServiceNetworkVpcAssociation,
      WAFv2.IPSet,
      WAFv2.LoggingConfiguration,
      WAFv2.RegexPatternSet,
      WAFv2.RuleGroup,
      WAFv2.WebACL,
      WAFv2.WebACLAssociation,
      Website.AssetDeployment,
      XRay.Group,
      XRay.ResourcePolicy,
      XRay.SamplingRule,
    ]),
  ).pipe(
    Layer.provide(
      Layer.mergeAll(
        Layer.mergeAll(
          ACMPCA.CertificateAuthorityProvider(),
          ACMPCA.CertificateAuthorityPolicyProvider(),
          ACMPCA.PermissionProvider(),
          AppFlow.ConnectorProfileProvider(),
          AppFlow.FlowProvider(),
          AppIntegrations.ApplicationProvider(),
          AppIntegrations.DataIntegrationProvider(),
          AppIntegrations.EventIntegrationProvider(),
          B2BI.CapabilityProvider(),
          B2BI.PartnershipProvider(),
          B2BI.ProfileProvider(),
          B2BI.TransformerProvider(),
          BedrockDataAutomation.BlueprintProvider(),
          BedrockDataAutomation.DataAutomationLibraryProvider(),
          BedrockDataAutomation.DataAutomationProjectProvider(),
          Config.AggregationAuthorizationProvider(),
          Config.ConfigRuleProvider(),
          Config.ConfigurationRecorderProvider(),
          Config.DeliveryChannelProvider(),
          Config.RetentionConfigurationProvider(),
        ),
        Layer.mergeAll(
          ACM.AccountConfigurationProvider(),
          ACM.CertificateProvider(),
          AMP.AlertManagerDefinitionProvider(),
          AMP.AnomalyDetectorProvider(),
          AMP.LoggingConfigurationProvider(),
          AMP.QueryLoggingConfigurationProvider(),
          AMP.ResourcePolicyProvider(),
          AMP.RuleGroupsNamespaceProvider(),
          AMP.ScraperProvider(),
          AMP.ScraperLoggingConfigurationProvider(),
          AMP.WorkspaceProvider(),
          ApiGateway.AccountProvider(),
          ApiGateway.ApiKeyProvider(),
          ApiGateway.AuthorizerProvider(),
          ApiGateway.BasePathMappingProvider(),
          ApiGateway.DeploymentProvider(),
          ApiGateway.DomainNameProvider(),
          ApiGateway.GatewayResponseProvider(),
          ApiGateway.MethodProvider(),
          ApiGateway.ResourceProvider(),
          ApiGateway.RestApiProvider(),
          ApiGateway.StageProvider(),
          ApiGateway.UsagePlanProvider(),
          ApiGateway.UsagePlanKeyProvider(),
          ApiGateway.VpcLinkProvider(),
          ApiGatewayV2.ApiProvider(),
          ApiGatewayV2.ApiMappingProvider(),
          ApiGatewayV2.AuthorizerProvider(),
          ApiGatewayV2.DomainNameProvider(),
          ApiGatewayV2.IntegrationProvider(),
          ApiGatewayV2.RouteProvider(),
          ApiGatewayV2.StageProvider(),
          ApiGatewayV2.VpcLinkProvider(),
          AppConfig.ApplicationProvider(),
          AppConfig.ConfigurationProfileProvider(),
          AppConfig.DeploymentProvider(),
          AppConfig.DeploymentStrategyProvider(),
          AppConfig.EnvironmentProvider(),
          AppConfig.ExtensionProvider(),
          AppConfig.ExtensionAssociationProvider(),
          AppConfig.HostedConfigurationVersionProvider(),
          ApplicationAutoScaling.ScalableTargetProvider(),
          ApplicationAutoScaling.ScalingPolicyProvider(),
          ApplicationAutoScaling.ScheduledActionProvider(),
          AppRunner.AutoScalingConfigurationProvider(),
          AppRunner.ObservabilityConfigurationProvider(),
          AppRunner.ServiceProvider(),
          AppRunner.VpcConnectorProvider(),
          AppSync.ApiAssociationProvider(),
          AppSync.ApiKeyProvider(),
          AppSync.DataSourceProvider(),
          AppSync.DomainNameProvider(),
          AppSync.FunctionProvider(),
          AppSync.GraphqlApiProvider(),
          AppSync.ResolverProvider(),
          Athena.DataCatalogProvider(),
          Athena.NamedQueryProvider(),
          Athena.PreparedStatementProvider(),
          Athena.WorkGroupProvider(),
          AutoScaling.AutoScalingGroupProvider(),
          AutoScaling.LaunchTemplateProvider(),
          AutoScaling.LifecycleHookProvider(),
          AutoScaling.ScalingPolicyProvider(),
          AutoScaling.ScheduledActionProvider(),
          Batch.ComputeEnvironmentProvider(),
          Batch.JobDefinitionProvider(),
          Batch.JobQueueProvider(),
          CloudControl.CloudControlResourceProvider(),
          CloudFormation.StackProvider(),
          CloudFront.CachePolicyProvider(),
          CloudFront.DistributionProvider(),
          CloudFront.FunctionProvider(),
          CloudFront.InvalidationProvider(),
          CloudFront.KeyGroupProvider(),
          CloudFront.KeyValueStoreProvider(),
          CloudFront.KvEntriesProvider(),
          CloudFront.KvRoutesUpdateProvider(),
          CloudFront.OriginAccessControlProvider(),
          CloudFront.OriginRequestPolicyProvider(),
          CloudFront.PublicKeyProvider(),
          CloudFront.RealtimeLogConfigProvider(),
          CloudFront.ResponseHeadersPolicyProvider(),
          CloudFront.VpcOriginProvider(),
          CloudHSMV2.ClusterProvider(),
          CloudHSMV2.HsmProvider(),
          CloudMap.HttpNamespaceProvider(),
          CloudMap.InstanceRegistrationProvider(),
          CloudMap.PrivateDnsNamespaceProvider(),
          CloudMap.PublicDnsNamespaceProvider(),
          CloudMap.ServiceProvider(),
          CloudWatch.AlarmMuteRuleProvider(),
          CloudWatch.AlarmProvider(),
          CloudWatch.AnomalyDetectorProvider(),
          CloudWatch.CompositeAlarmProvider(),
          CloudWatch.DashboardProvider(),
          CloudWatch.InsightRuleProvider(),
          CloudWatch.MetricStreamProvider(),
          CodeArtifact.DomainProvider(),
          CodeArtifact.RepositoryProvider(),
          CodeBuild.ProjectProvider(),
          CodeBuild.ReportGroupProvider(),
          CodeConnections.ConnectionProvider(),
          CodeConnections.HostProvider(),
          CodeConnections.RepositoryLinkProvider(),
          CodeConnections.SyncConfigurationProvider(),
          CodeDeploy.ApplicationProvider(),
          CodeDeploy.DeploymentConfigProvider(),
          CodeDeploy.DeploymentGroupProvider(),
          CodePipeline.PipelineProvider(),
          Cognito.GroupProvider(),
          Cognito.IdentityPoolProvider(),
          Cognito.IdentityPoolRoleAttachmentProvider(),
          Cognito.IdentityProviderProvider(),
          Cognito.ResourceServerProvider(),
          Cognito.UserPoolClientProvider(),
          Cognito.UserProvider(),
          Cognito.UserPoolDomainProvider(),
          Cognito.UserPoolProvider(),
        ),
        Layer.mergeAll(
          DataBrew.DatasetProvider(),
          DataBrew.JobProvider(),
          DataBrew.ProjectProvider(),
          DataBrew.RecipeProvider(),
          DataBrew.RulesetProvider(),
          DataBrew.ScheduleProvider(),
          DataExchange.DataSetProvider(),
          DataExchange.EventActionProvider(),
          DataExchange.RevisionProvider(),
          DataSync.LocationEfsProvider(),
          DataSync.LocationS3Provider(),
          DataSync.TaskProvider(),
          DataZone.DomainProvider(),
          DataZone.EnvironmentProvider(),
          DataZone.EnvironmentBlueprintConfigurationProvider(),
          DataZone.ProjectProvider(),
          DAX.ClusterProvider(),
          DAX.ParameterGroupProvider(),
          DAX.SubnetGroupProvider(),
          Deadline.BudgetProvider(),
          Deadline.FarmProvider(),
          Deadline.FleetProvider(),
          Deadline.MonitorProvider(),
          Deadline.QueueProvider(),
          Deadline.StorageProfileProvider(),
          DirectoryService.ConditionalForwarderProvider(),
          DirectoryService.DirectoryProvider(),
          DirectoryService.EventTopicProvider(),
          DLM.LifecyclePolicyProvider(),
          DocDB.DBClusterProvider(),
          DocDB.DBInstanceProvider(),
          DocDB.DBSubnetGroupProvider(),
          DocDBElastic.ClusterProvider(),
          DMS.EndpointProvider(),
          DMS.ReplicationInstanceProvider(),
          DMS.ReplicationSubnetGroupProvider(),
          DSQL.ClusterProvider(),
          DSQL.ClusterPolicyProvider(),
          DSQL.StreamProvider(),
          DevOpsGuru.EventSourcesConfigProvider(),
          DevOpsGuru.NotificationChannelProvider(),
          DevOpsGuru.ResourceCollectionProvider(),
          DevOpsGuru.ServiceIntegrationProvider(),
          DynamoDB.TableProvider(),
          EC2.DhcpOptionsProvider(),
          EC2.EgressOnlyInternetGatewayProvider(),
          EC2.EIPProvider(),
          EC2.FlowLogProvider(),
          EC2.InstanceProvider(),
          EC2.InternetGatewayProvider(),
          EC2.KeyPairProvider(),
          EC2.NatGatewayProvider(),
          EC2.NetworkAclAssociationProvider(),
          EC2.NetworkAclEntryProvider(),
          EC2.NetworkAclProvider(),
          EC2.NetworkInterfaceProvider(),
          EC2.NetworkInterfaceAttachmentProvider(),
          EC2.PrefixListProvider(),
          EC2.RouteProvider(),
          EC2.RouteTableAssociationProvider(),
          EC2.RouteTableProvider(),
          EC2.SecurityGroupProvider(),
          EC2.SecurityGroupRuleProvider(),
          EC2.SnapshotProvider(),
          EC2.SubnetProvider(),
          EC2.VolumeProvider(),
          EC2.VolumeAttachmentProvider(),
          EC2.VpcEndpointProvider(),
          EC2.VpcPeeringConnectionProvider(),
          EC2.VpcProvider(),
          ECR.ImageProvider(),
          ECR.RegistryPolicyProvider(),
          ECR.RepositoryProvider(),
          ECS.CapacityProviderProvider(),
          ECS.ClusterProvider(),
          ECS.ServiceProvider(),
          ECS.TaskDefinitionProvider(),
          ECS.TaskProvider(),
          EFS.AccessPointProvider(),
          EFS.FileSystemProvider(),
          EFS.MountTargetProvider(),
          EKS.AccessEntryProvider(),
          EKS.AddonProvider(),
          EKS.ClusterProvider(),
          EKS.DeploymentProvider(),
          EKS.FargateProfileProvider(),
          EKS.HelmChartProvider(),
          EKS.JobProvider(),
          EKS.ManifestProvider(),
          EKS.NodegroupProvider(),
          EKS.PodIdentityAssociationProvider(),
          ElastiCache.ServerlessCacheProvider(),
          ELBv2.ListenerProvider(),
          ELBv2.ListenerCertificateProvider(),
          ELBv2.ListenerRuleProvider(),
          ELBv2.LoadBalancerProvider(),
          ELBv2.TargetGroupProvider(),
          ELBv2.TargetGroupAttachmentProvider(),
          ELBv2.TrustStoreProvider(),
          EventBridge.ApiDestinationProvider(),
          EventBridge.ArchiveProvider(),
          EventBridge.ConnectionProvider(),
          EventBridge.EventBusProvider(),
          EventBridge.PermissionProvider(),
          EventBridge.RuleProvider(),
          FIS.ExperimentTemplateProvider(),
          FIS.TargetAccountConfigurationProvider(),
          Firehose.DeliveryStreamProvider(),
          FSx.FileSystemProvider(),
          Glacier.VaultProvider(),
          Glue.ConnectionProvider(),
          Glue.CrawlerProvider(),
          Glue.DatabaseProvider(),
          Glue.JobProvider(),
          Glue.TableProvider(),
          Grafana.WorkspaceProvider(),
          GreengrassV2.ComponentVersionProvider(),
          GreengrassV2.DeploymentProvider(),
          HealthLake.FHIRDatastoreProvider(),
          IAM.AccessKeyProvider(),
          IAM.AccountAliasProvider(),
          IAM.AccountPasswordPolicyProvider(),
          IAM.GroupMembershipProvider(),
          IAM.GroupProvider(),
          IAM.InstanceProfileProvider(),
          IAM.LoginProfileProvider(),
          IAM.OpenIDConnectProviderProvider(),
          IAM.PolicyProvider(),
          IAM.RoleProvider(),
          IAM.SAMLProviderProvider(),
          IAM.ServerCertificateProvider(),
          IAM.ServiceLinkedRoleProvider(),
          IAM.ServiceSpecificCredentialProvider(),
          IAM.SigningCertificateProvider(),
          IAM.SSHPublicKeyProvider(),
          IAM.UserProvider(),
          IAM.VirtualMFADeviceProvider(),
        ),
        Layer.mergeAll(
          IdentityCenter.AccountAssignmentProvider(),
          IdentityCenter.GroupProvider(),
          IdentityCenter.InstanceProvider(),
          IdentityCenter.PermissionSetProvider(),
          Kafka.ServerlessClusterProvider(),
          Kendra.DataSourceProvider(),
          Kendra.IndexProvider(),
          Keyspaces.KeyspaceProvider(),
          Keyspaces.TableProvider(),
          Keyspaces.TypeProvider(),
          KMS.AliasProvider(),
          KMS.KeyProvider(),
          Kinesis.StreamConsumerProvider(),
          Kinesis.StreamProvider(),
          KinesisAnalyticsV2.ApplicationProvider(),
          KinesisAnalyticsV2.ApplicationCloudWatchLoggingOptionProvider(),
          KinesisAnalyticsV2.ApplicationSnapshotProvider(),
          KinesisVideo.SignalingChannelProvider(),
          KinesisVideo.StreamProvider(),
          LakeFormation.DataCellsFilterProvider(),
          LakeFormation.DataLakeSettingsProvider(),
          LakeFormation.LFTagProvider(),
          LakeFormation.LFTagAssociationProvider(),
          LakeFormation.LFTagExpressionProvider(),
          LakeFormation.OptInProvider(),
          LakeFormation.PermissionsProvider(),
          LakeFormation.ResourceProvider(),
          Lambda.AliasProvider(),
          Lambda.EventSourceMappingProvider(),
          Lambda.FunctionProvider(),
          Lambda.MicrovmImageProvider(),
          Lambda.NetworkConnectorProvider(),
          Lambda.PermissionProvider(),
          Logs.DestinationProvider(),
          Logs.LogGroupProvider(),
          Logs.LogStreamProvider(),
          Logs.MetricFilterProvider(),
          Logs.ResourcePolicyProvider(),
          Logs.SubscriptionFilterProvider(),
          MediaConnect.FlowProvider(),
          MediaConvert.JobProvider(),
          MediaConvert.JobTemplateProvider(),
          MediaConvert.PresetProvider(),
          MediaConvert.QueueProvider(),
          MediaLive.ChannelProvider(),
          MediaLive.InputProvider(),
          MediaLive.InputSecurityGroupProvider(),
          MediaPackageV2.ChannelProvider(),
          MediaPackageV2.ChannelGroupProvider(),
          MediaPackageV2.OriginEndpointProvider(),
          MediaTailor.PlaybackConfigurationProvider(),
          MedicalImaging.DatastoreProvider(),
          MQ.BrokerProvider(),
          MQ.ConfigurationProvider(),
          MailManager.AddonInstanceProvider(),
          MailManager.AddonSubscriptionProvider(),
          MailManager.AddressListProvider(),
          MailManager.ArchiveProvider(),
          MailManager.IngressPointProvider(),
          MailManager.RelayProvider(),
          MailManager.RuleSetProvider(),
          MailManager.TrafficPolicyProvider(),
          MemoryDB.ACLProvider(),
          MemoryDB.ClusterProvider(),
          MemoryDB.ParameterGroupProvider(),
          MemoryDB.SubnetGroupProvider(),
          MemoryDB.UserProvider(),
          Neptune.DBClusterProvider(),
          Neptune.DBClusterParameterGroupProvider(),
          Neptune.DBInstanceProvider(),
          Neptune.DBParameterGroupProvider(),
          Neptune.DBSubnetGroupProvider(),
          NeptuneGraph.GraphProvider(),
          OpenSearch.DomainProvider(),
          OpenSearchServerless.AccessPolicyProvider(),
          OSIS.PipelineEndpointProvider(),
          OSIS.PipelineProvider(),
          OSIS.ResourcePolicyProvider(),
          OpenSearchServerless.CollectionProvider(),
          OpenSearchServerless.CollectionGroupProvider(),
          OpenSearchServerless.LifecyclePolicyProvider(),
          OpenSearchServerless.SecurityConfigProvider(),
          OpenSearchServerless.SecurityPolicyProvider(),
          OpenSearchServerless.VpcEndpointProvider(),
          Organizations.AccountProvider(),
          Organizations.DelegatedAdministratorProvider(),
          Organizations.OrganizationalUnitProvider(),
          Organizations.OrganizationProvider(),
          Organizations.OrganizationResourcePolicyProvider(),
          Organizations.PolicyAttachmentProvider(),
          Organizations.PolicyProvider(),
          Organizations.RootPolicyTypeProvider(),
          Organizations.RootProvider(),
          Organizations.TrustedServiceAccessProvider(),
          PaymentCryptography.AliasProvider(),
          PaymentCryptography.KeyProvider(),
          Pipes.PipeProvider(),
          Polly.LexiconProvider(),
          QApps.QAppProvider(),
          QBusiness.ApplicationProvider(),
          QBusiness.DataSourceProvider(),
          QBusiness.IndexProvider(),
          QBusiness.RetrieverProvider(),
          QBusiness.WebExperienceProvider(),
          QuickSight.AnalysisProvider(),
          QuickSight.DashboardProvider(),
          QuickSight.DataSetProvider(),
          QuickSight.DataSourceProvider(),
          RDS.DBClusterEndpointProvider(),
          RDS.DBClusterParameterGroupProvider(),
          RDS.DBClusterProvider(),
          RDS.DBInstanceProvider(),
          RDS.DBParameterGroupProvider(),
          RDS.DBProxyEndpointProvider(),
          RDS.DBProxyProvider(),
          RDS.DBProxyTargetGroupProvider(),
          RDS.DBSubnetGroupProvider(),
          RePostSpace.SpaceProvider(),
          Redshift.ClusterParameterGroupProvider(),
          Redshift.ClusterProvider(),
          Redshift.ClusterSubnetGroupProvider(),
          Redshift.EventSubscriptionProvider(),
          RedshiftServerless.NamespaceProvider(),
          RedshiftServerless.WorkgroupProvider(),
          Route53.HealthCheckProvider(),
          Route53.HostedZoneProvider(),
          Route53.QueryLoggingConfigProvider(),
          Route53.RecordProvider(),
          Route53.VpcAssociationAuthorizationProvider(),
          Route53.ZoneVpcAssociationProvider(),
          S3.BucketProvider(),
          Scheduler.ScheduleGroupProvider(),
          Scheduler.ScheduleProvider(),
          SecretsManager.RotationScheduleProvider(),
          SecretsManager.SecretProvider(),
          SES.ConfigurationSetEventDestinationProvider(),
          SES.ConfigurationSetProvider(),
          SES.EmailIdentityProvider(),
          SES.EmailTemplateProvider(),
          SNS.PlatformApplicationProvider(),
          SNS.SubscriptionProvider(),
          SNS.TopicProvider(),
          SocialMessaging.LinkedWhatsAppBusinessAccountProvider(),
          SQS.QueueProvider(),
          SSM.ParameterProvider(),
          StepFunctions.ActivityProvider(),
          StepFunctions.StateMachineProvider(),
          WAFv2.IPSetProvider(),
          WAFv2.LoggingConfigurationProvider(),
          WAFv2.RegexPatternSetProvider(),
          WAFv2.RuleGroupProvider(),
          WAFv2.WebACLAssociationProvider(),
          WAFv2.WebACLProvider(),
          Website.AssetDeploymentProvider(),
          XRay.GroupProvider(),
          XRay.ResourcePolicyProvider(),
          XRay.SamplingRuleProvider(),
          Bedrock.AgentProvider(),
          Bedrock.AgentAliasProvider(),
          Bedrock.DataSourceProvider(),
          Bedrock.KnowledgeBaseProvider(),
          BedrockAgentCore.BrowserCustomProvider(),
          BedrockAgentCore.CodeInterpreterProvider(),
          BedrockAgentCore.GatewayProvider(),
          BedrockAgentCore.MemoryProvider(),
          BedrockAgentCore.RuntimeProvider(),
          AccessAnalyzer.AnalyzerProvider(),
          AccessAnalyzer.ArchiveRuleProvider(),
          Textract.AdapterProvider(),
          Transfer.ServerProvider(),
          Transfer.UserProvider(),
          Translate.ParallelDataProvider(),
          Translate.TerminologyProvider(),
          VerifiedPermissions.IdentitySourceProvider(),
          VerifiedPermissions.PolicyProvider(),
          VerifiedPermissions.PolicyStoreProvider(),
          VerifiedPermissions.PolicyStoreAliasProvider(),
          VerifiedPermissions.PolicyTemplateProvider(),
          VerifiedPermissions.SchemaProvider(),
          Backup.BackupVaultProvider(),
          Backup.BackupPlanProvider(),
          Backup.BackupSelectionProvider(),
          BackupSearch.SearchJobProvider(),
          BackupSearch.ExportJobProvider(),
          BCMDataExports.ExportProvider(),
          Budgets.BudgetProvider(),
          Budgets.BudgetActionProvider(),
          Chatbot.AssociationProvider(),
          Chatbot.CustomActionProvider(),
          Chatbot.MicrosoftTeamsChannelConfigurationProvider(),
          Chatbot.SlackChannelConfigurationProvider(),
          GuardDuty.DetectorProvider(),
          GuardDuty.FilterProvider(),
          GuardDuty.IPSetProvider(),
          GuardDuty.ThreatIntelSetProvider(),
          ImageBuilder.ComponentProvider(),
          ImageBuilder.DistributionConfigurationProvider(),
          ImageBuilder.ImagePipelineProvider(),
          ImageBuilder.ImageRecipeProvider(),
          ImageBuilder.InfrastructureConfigurationProvider(),
          Inspector2.CisScanConfigurationProvider(),
          Inspector2.EnablerProvider(),
          Inspector2.FilterProvider(),
          InternetMonitor.MonitorProvider(),
          SecurityHub.ActionTargetProvider(),
          SecurityHub.AutomationRuleProvider(),
          SecurityHub.FindingAggregatorProvider(),
          SecurityHub.HubProvider(),
          SecurityHub.InsightProvider(),
          SecurityLake.DataLakeProvider(),
          SecurityLake.AwsLogSourceProvider(),
          SecurityLake.CustomLogSourceProvider(),
          SecurityLake.ExceptionSubscriptionProvider(),
          SecurityLake.SubscriberProvider(),
          SecurityLake.SubscriberNotificationProvider(),
          Detective.GraphProvider(),
          FMS.AdminAccountProvider(),
          Macie2.SessionProvider(),
          Macie2.ClassificationJobProvider(),
          Macie2.AllowListProvider(),
          Macie2.CustomDataIdentifierProvider(),
          Macie2.FindingsFilterProvider(),
          RAM.PermissionProvider(),
          RAM.ResourceShareProvider(),
        ),
        Layer.mergeAll(
          AIOps.InvestigationGroupProvider(),
          AuditManager.AssessmentProvider(),
          AuditManager.ControlProvider(),
          AuditManager.FrameworkProvider(),
          ApplicationSignals.DiscoveryProvider(),
          ApplicationSignals.GroupingConfigurationProvider(),
          ApplicationSignals.InstrumentationConfigurationProvider(),
          ApplicationSignals.ServiceLevelObjectiveProvider(),
          LicenseManager.LicenseConfigurationProvider(),
          LexV2.BotProvider(),
          LexV2.BotAliasProvider(),
          LexV2.BotLocaleProvider(),
          LexV2.BotVersionProvider(),
          LexV2.IntentProvider(),
          LexV2.SlotTypeProvider(),
          S3Files.FileSystemProvider(),
          S3Files.AccessPointProvider(),
          S3Tables.TableBucketProvider(),
          S3Tables.NamespaceProvider(),
          S3Tables.TableProvider(),
          S3Vectors.VectorBucketProvider(),
          S3Vectors.IndexProvider(),
          SageMaker.ModelProvider(),
          SageMaker.EndpointConfigProvider(),
          SageMaker.EndpointProvider(),
          SageMaker.FeatureGroupProvider(),
          SageMaker.ClusterProvider(),
          SageMaker.ClusterSchedulerConfigProvider(),
          SageMaker.ComputeQuotaProvider(),
          Account.AccountNameProvider(),
          Account.AlternateContactProvider(),
          Account.ContactInformationProvider(),
          Account.RegionProvider(),
          Amplify.AppProvider(),
          Amplify.BranchProvider(),
          ECRPublic.PublicRepositoryProvider(),
          VpcLattice.ServiceNetworkProvider(),
          VpcLattice.ServiceProvider(),
          VpcLattice.ServiceNetworkVpcAssociationProvider(),
          VpcLattice.AuthPolicyProvider(),
          VpcLattice.ResourcePolicyProvider(),
          VpcLattice.ServiceNetworkServiceAssociationProvider(),
          VpcLattice.TargetGroupProvider(),
          VpcLattice.ListenerProvider(),
          VpcLattice.RuleProvider(),
          VpcLattice.AccessLogSubscriptionProvider(),
          MWAA.EnvironmentProvider(),
          MWAAServerless.WorkflowProvider(),
          Location.ApiKeyProvider(),
          Location.MapProvider(),
          Location.PlaceIndexProvider(),
          Location.RouteCalculatorProvider(),
          Location.GeofenceCollectionProvider(),
          Location.TrackerProvider(),
          Location.TrackerConsumerProvider(),
          Forecast.DatasetGroupProvider(),
          Forecast.DatasetProvider(),
          FraudDetector.DetectorProvider(),
          FraudDetector.DetectorVersionProvider(),
          FraudDetector.EntityTypeProvider(),
          FraudDetector.EventTypeProvider(),
          FraudDetector.LabelProvider(),
          FraudDetector.ListProvider(),
          FraudDetector.OutcomeProvider(),
          FraudDetector.VariableProvider(),
          Personalize.SchemaProvider(),
          Personalize.DatasetGroupProvider(),
          Personalize.DatasetProvider(),
          Personalize.EventTrackerProvider(),
          PinpointSMSVoiceV2.ConfigurationSetProvider(),
          PinpointSMSVoiceV2.EventDestinationProvider(),
          PinpointSMSVoiceV2.OptOutListProvider(),
          PinpointSMSVoiceV2.PhoneNumberProvider(),
          IoT.ThingProvider(),
          IoT.ThingTypeProvider(),
          IoT.PolicyProvider(),
          IoT.TopicRuleProvider(),
          IoTFleetWise.CampaignProvider(),
          IoTFleetWise.DecoderManifestProvider(),
          IoTFleetWise.FleetProvider(),
          IoTFleetWise.ModelManifestProvider(),
          IoTFleetWise.SignalCatalogProvider(),
          IoTFleetWise.StateTemplateProvider(),
          IoTFleetWise.VehicleProvider(),
          IoTManagedIntegrations.CredentialLockerProvider(),
          IoTManagedIntegrations.DestinationProvider(),
          IoTManagedIntegrations.ManagedThingProvider(),
          IoTManagedIntegrations.NotificationConfigurationProvider(),
          IoTSiteWise.AssetModelProvider(),
          IoTSiteWise.AssetProvider(),
          IoTSiteWise.GatewayProvider(),
          IoTWireless.DestinationProvider(),
          IoTWireless.DeviceProfileProvider(),
          IoTWireless.ServiceProfileProvider(),
          IoTWireless.WirelessDeviceProvider(),
          IoTWireless.WirelessGatewayProvider(),
          ResourceGroups.GroupProvider(),
          RolesAnywhere.CrlProvider(),
          RolesAnywhere.ProfileProvider(),
          RolesAnywhere.TrustAnchorProvider(),
          Synthetics.CanaryProvider(),
          Synthetics.GroupProvider(),
          SSMContacts.ContactProvider(),
          SSMContacts.ContactChannelProvider(),
          SSMContacts.PlanProvider(),
          SSMContacts.RotationProvider(),
          SSMIncidents.ReplicationSetProvider(),
          SSMIncidents.ResponsePlanProvider(),
        ),
        Layer.mergeAll(
          FinSpace.EnvironmentProvider(),
          FinSpace.KxClusterProvider(),
          FinSpace.KxDatabaseProvider(),
          FinSpace.KxEnvironmentProvider(),
          ControlTower.EnabledBaselineProvider(),
          ControlTower.EnabledControlProvider(),
          ControlTower.LandingZoneProvider(),
          CostAndUsageReport.ReportDefinitionProvider(),
          CostExplorer.AnomalyMonitorProvider(),
          CostExplorer.AnomalySubscriptionProvider(),
          CostExplorer.CostCategoryProvider(),
          Rbin.RuleProvider(),
          RUM.AppMonitorProvider(),
          RUM.MetricsDestinationProvider(),
          RUM.ResourcePolicyProvider(),
          EMR.ClusterProvider(),
          EMR.SecurityConfigurationProvider(),
          EMR.StudioProvider(),
          EMRContainers.JobTemplateProvider(),
          EMRContainers.VirtualClusterProvider(),
          EMRServerless.ApplicationProvider(),
          EntityResolution.SchemaMappingProvider(),
          EntityResolution.MatchingWorkflowProvider(),
          EntityResolution.IdNamespaceProvider(),
          EntityResolution.IdMappingWorkflowProvider(),
          Schemas.DiscovererProvider(),
          Schemas.RegistryProvider(),
          Schemas.SchemaProvider(),
          Route53Profiles.ProfileProvider(),
          Route53Profiles.ProfileAssociationProvider(),
          Route53Profiles.ProfileResourceAssociationProvider(),
          Route53Resolver.ResolverEndpointProvider(),
          Route53Resolver.ResolverRuleProvider(),
          Route53Resolver.ResolverRuleAssociationProvider(),
          Shield.ProtectionProvider(),
          Shield.ProtectionGroupProvider(),
          Shield.SubscriptionProvider(),
          Signer.ProfilePermissionProvider(),
          Signer.SigningProfileProvider(),
          SimpleDB.DomainProvider(),
          Timestream.DatabaseProvider(),
          Timestream.DbInstanceProvider(),
          Timestream.ScheduledQueryProvider(),
          Timestream.TableProvider(),
          ResourceExplorer.IndexProvider(),
          ResourceExplorer.ViewProvider(),
          Notifications.ChannelAssociationProvider(),
          Notifications.EventRuleProvider(),
          Notifications.NotificationConfigurationProvider(),
          Notifications.NotificationHubProvider(),
          NotificationsContacts.EmailContactProvider(),
          OAM.LinkProvider(),
          OAM.SinkProvider(),
          ObservabilityAdmin.TelemetryConfigProvider(),
          ObservabilityAdmin.TelemetryRuleProvider(),
          Omics.AnnotationStoreProvider(),
          Omics.ReferenceStoreProvider(),
          Omics.RunGroupProvider(),
          Omics.SequenceStoreProvider(),
          Omics.VariantStoreProvider(),
          Omics.WorkflowProvider(),
          GlobalAccelerator.AcceleratorProvider(),
          GlobalAccelerator.ListenerProvider(),
          GlobalAccelerator.EndpointGroupProvider(),
          AppRegistry.ApplicationProvider(),
          AppRegistry.AttributeGroupProvider(),
          AppRegistry.AttributeGroupAssociationProvider(),
          AppRegistry.ResourceAssociationProvider(),
          ServiceCatalog.PortfolioProvider(),
          ServiceCatalog.PortfolioProductAssociationProvider(),
          ServiceCatalog.PrincipalPortfolioAssociationProvider(),
          ServiceCatalog.ProductProvider(),
          ServiceQuotas.ServiceQuotaIncreaseRequestProvider(),
          S3Control.AccessPointProvider(),
          S3Control.AccessPointPolicyProvider(),
          S3Control.MultiRegionAccessPointProvider(),
          S3Control.ObjectLambdaAccessPointProvider(),
          S3Control.StorageLensConfigurationProvider(),
          NetworkFirewall.RuleGroupProvider(),
          NetworkFirewall.FirewallPolicyProvider(),
          NetworkFirewall.FirewallProvider(),
          NetworkFirewall.LoggingConfigurationProvider(),
          CloudTrail.EventDataStoreProvider(),
          CloudTrail.TrailProvider(),
          IVS.ChannelProvider(),
          IVS.PlaybackKeyPairProvider(),
          IVS.PlaybackRestrictionPolicyProvider(),
          IVS.RecordingConfigurationProvider(),
          IVS.StreamKeyProvider(),
          IVSChat.LoggingConfigurationProvider(),
          IVSChat.RoomProvider(),
          IVSRealtime.StageProvider(),
        ),
      ),
    ),
    Layer.provideMerge(
      Layer.mergeAll(
        Command.providers(),
        KeyPairProvider(),
        RandomProvider(),
        Assets.AssetsLive,
        DockerLive,
      ),
    ),
    Layer.provideMerge(Region.fromEnvironment),
    Layer.provideMerge(Credentials.fromEnvironment),
    Layer.provideMerge(Endpoint.fromEnvironment),
    Layer.provideMerge(DefaultEnvironment),
    Layer.provideMerge(AwsAuth),
    Layer.provideMerge(CredentialsStoreLive),
    // Apply a blanket retry policy to every AWS SDK call. Like distilled's
    // `makeDefault` it retries throttling, 5xx, and Smithy `@retryable`
    // errors with exponential backoff + jitter + `RetryAfter` header
    // awareness, but with a higher attempt cap (10 vs 5) so heavy
    // parallel deploys ride out S3 `SlowDown` bursts that span more than
    // a few seconds. Bounded so real rate-limit pressure still surfaces
    // instead of masking as an indefinite hang.
    Layer.provideMerge(Layer.succeed(Retry, awsRetryFactory)),
    Layer.orDie,
  );

// Node socket-level error codes that indicate a transient network failure.
const TRANSIENT_NETWORK_CODES = new Set([
  "ETIMEDOUT",
  "ECONNRESET",
  "ECONNREFUSED",
  "EPIPE",
  "ENETUNREACH",
  "ENETDOWN",
  "EHOSTUNREACH",
  "EAI_AGAIN",
]);
// Transport-termination signatures that undici/node surface as plain messages
// (e.g. a `fetch` whose socket dies mid-body throws `TypeError: terminated`).
const TRANSIENT_NETWORK_PATTERN =
  /terminated|socket hang up|other side closed|fetch failed|read ETIMEDOUT|ECONNRESET|ETIMEDOUT/i;

// Walk an error's cause chain looking for a transient transport failure. Used
// to tell a Decode/EmptyBody error caused by a dropped connection (retryable)
// apart from one caused by a genuinely malformed body (permanent).
const hasTransientNetworkCause = (cause: unknown, depth = 0): boolean => {
  if (cause == null || depth > 8) return false;
  if (typeof cause === "string") return TRANSIENT_NETWORK_PATTERN.test(cause);
  if (typeof cause !== "object") return false;
  const code = (cause as { code?: unknown }).code;
  if (typeof code === "string" && TRANSIENT_NETWORK_CODES.has(code)) {
    return true;
  }
  const message = (cause as { message?: unknown }).message;
  if (typeof message === "string" && TRANSIENT_NETWORK_PATTERN.test(message)) {
    return true;
  }
  const nested = (cause as { cause?: unknown }).cause;
  return nested !== undefined && nested !== cause
    ? hasTransientNetworkCause(nested, depth + 1)
    : false;
};

// Error codes raised while failing to even open a connection. bun's fetch
// reports an unresolvable hostname (NXDOMAIN — e.g. an AWS service with no
// endpoint in the ambient region, like IoT Managed Integrations outside its
// launch regions) as `ConnectionRefused`/`FailedToOpenSocket`, which is
// indistinguishable from a live-but-refusing host. These failures are almost
// always permanent (wrong region, wrong endpoint), so they get a small retry
// budget instead of the full 16-attempt transport budget — enough to ride out
// a momentary blip, but a nonexistent endpoint fails in ~1.5s, not ~60s.
const CONNECT_FAILURE_CODES = new Set([
  "ConnectionRefused", // bun: connect failed (includes NXDOMAIN)
  "FailedToOpenSocket", // bun: socket open failed (includes NXDOMAIN)
  "ENOTFOUND", // node: DNS name not found
  "EAI_NONAME", // node: DNS name not found
  "ECONNREFUSED", // node: TCP connect refused
]);

const hasConnectFailureCause = (cause: unknown, depth = 0): boolean => {
  if (cause == null || typeof cause !== "object" || depth > 8) return false;
  const code = (cause as { code?: unknown }).code;
  if (typeof code === "string" && CONNECT_FAILURE_CODES.has(code)) return true;
  const nested = (cause as { cause?: unknown }).cause;
  return nested !== undefined && nested !== cause
    ? hasConnectFailureCause(nested, depth + 1)
    : false;
};

const isConnectFailure = (error: unknown): boolean =>
  HttpClientError.isHttpClientError(error) &&
  error.reason._tag === "TransportError" &&
  hasConnectFailureCause(error.reason);

// TODO(sam): remove this once it's upstreamed to distilled
const isHttpTransportError = (error: unknown): boolean => {
  if (!HttpClientError.isHttpClientError(error)) return false;
  const reason = error.reason;
  const tag = reason._tag;
  if (tag === "TransportError") return true;
  // A Decode/EmptyBody error is only transient when its underlying cause is a
  // terminated/reset connection (e.g. a `read ETIMEDOUT` while streaming the
  // body surfaces as a `DecodeError`). A genuine malformed-body decode is
  // permanent — retrying it would only waste the budget and mask the bug — so
  // gate on the cause chain rather than the tag.
  if (tag === "DecodeError" || tag === "EmptyBodyError") {
    return hasTransientNetworkCause(reason);
  }
  if (
    tag === "StatusCodeError" &&
    "response" in error.reason &&
    error.reason.response.status >= 500
  ) {
    return true;
  }
  return false;
};

const awsRetryFactory: RetryFactory = (lastError) => {
  // The factory runs once per API call, so this counter is call-scoped. It
  // caps connect-phase failures (see CONNECT_FAILURE_CODES) at 3 retries
  // within the overall schedule below.
  let connectFailures = 0;
  return {
    while: (error) => {
      if (isConnectFailure(error)) return ++connectFailures <= 3;
      return (
        isTransientError(error) ||
        isThrottlingError(error) ||
        isRetryable(error) ||
        isHttpTransportError(error)
      );
    },
    // Transient transport failures (e.g. a sustained `read ETIMEDOUT` blip
    // against a control-plane endpoint) can outlast a 10-attempt budget. With
    // the 5s cap below, the extra attempts add bounded backoff while making
    // the network-flake recovery materially more robust.
    schedule: Schedule.max([
      pipe(
        Schedule.exponential(Duration.millis(200), 2),
        Schedule.modifyDelay(
          Effect.fn(function* ({ duration }) {
            const error = yield* Ref.get(lastError);
            if (isThrottlingError(error)) {
              // Throttling: floor at 500ms (matches distilled default).
              if (Duration.toMillis(duration) < 500) {
                return Duration.toMillis(Duration.millis(500));
              }
            }
            return Duration.toMillis(duration);
          }),
        ),
        capped(Duration.seconds(5)),
        jittered,
      ),
      Schedule.recurs(15),
    ]),
  };
};