alchemy 2.0.0-beta.74 → 2.0.0-beta.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/bin/exec.js +330 -121
- package/bin/exec.js.map +1 -1
- package/lib/AWS/ACM/Certificate.d.ts +6 -2
- package/lib/AWS/ACM/Certificate.d.ts.map +1 -1
- package/lib/AWS/ACM/Certificate.js +23 -11
- package/lib/AWS/ACM/Certificate.js.map +1 -1
- package/lib/AWS/AppRunner/Service.d.ts +16 -0
- package/lib/AWS/AppRunner/Service.d.ts.map +1 -1
- package/lib/AWS/AppRunner/Service.js +83 -63
- package/lib/AWS/AppRunner/Service.js.map +1 -1
- package/lib/AWS/ApplicationAutoScaling/ScalingPolicy.d.ts.map +1 -1
- package/lib/AWS/ApplicationAutoScaling/ScalingPolicy.js +39 -15
- package/lib/AWS/ApplicationAutoScaling/ScalingPolicy.js.map +1 -1
- package/lib/AWS/AuthProvider.d.ts.map +1 -1
- package/lib/AWS/AuthProvider.js +8 -2
- package/lib/AWS/AuthProvider.js.map +1 -1
- package/lib/AWS/Batch/JobDefinition.d.ts.map +1 -1
- package/lib/AWS/Batch/JobDefinition.js +14 -68
- package/lib/AWS/Batch/JobDefinition.js.map +1 -1
- package/lib/AWS/CloudFront/KvEntries.d.ts.map +1 -1
- package/lib/AWS/CloudFront/KvEntries.js +15 -7
- package/lib/AWS/CloudFront/KvEntries.js.map +1 -1
- package/lib/AWS/CloudFront/KvRoutesUpdate.d.ts.map +1 -1
- package/lib/AWS/CloudFront/KvRoutesUpdate.js +3 -9
- package/lib/AWS/CloudFront/KvRoutesUpdate.js.map +1 -1
- package/lib/AWS/CloudFront/common.d.ts +11 -0
- package/lib/AWS/CloudFront/common.d.ts.map +1 -1
- package/lib/AWS/CloudFront/common.js +9 -1
- package/lib/AWS/CloudFront/common.js.map +1 -1
- package/lib/AWS/Cognito/ManagedLoginBranding.d.ts +108 -0
- package/lib/AWS/Cognito/ManagedLoginBranding.d.ts.map +1 -0
- package/lib/AWS/Cognito/ManagedLoginBranding.js +200 -0
- package/lib/AWS/Cognito/ManagedLoginBranding.js.map +1 -0
- package/lib/AWS/Cognito/UserPool.d.ts +176 -3
- package/lib/AWS/Cognito/UserPool.d.ts.map +1 -1
- package/lib/AWS/Cognito/UserPool.js +223 -33
- package/lib/AWS/Cognito/UserPool.js.map +1 -1
- package/lib/AWS/Cognito/index.d.ts +1 -0
- package/lib/AWS/Cognito/index.d.ts.map +1 -1
- package/lib/AWS/Cognito/index.js +1 -0
- package/lib/AWS/Cognito/index.js.map +1 -1
- package/lib/AWS/EC2/Instance.d.ts.map +1 -1
- package/lib/AWS/EC2/Instance.js +32 -14
- package/lib/AWS/EC2/Instance.js.map +1 -1
- package/lib/AWS/EC2/NetworkAcl.d.ts.map +1 -1
- package/lib/AWS/EC2/NetworkAcl.js +9 -4
- package/lib/AWS/EC2/NetworkAcl.js.map +1 -1
- package/lib/AWS/EC2/hosted.d.ts.map +1 -1
- package/lib/AWS/EC2/hosted.js +5 -74
- package/lib/AWS/EC2/hosted.js.map +1 -1
- package/lib/AWS/ECR/Image.d.ts +4 -3
- package/lib/AWS/ECR/Image.d.ts.map +1 -1
- package/lib/AWS/ECR/Image.js +17 -47
- package/lib/AWS/ECR/Image.js.map +1 -1
- package/lib/AWS/ECR/ImageSource.d.ts +7 -4
- package/lib/AWS/ECR/ImageSource.d.ts.map +1 -1
- package/lib/AWS/ECR/ImageSource.js +10 -97
- package/lib/AWS/ECR/ImageSource.js.map +1 -1
- package/lib/AWS/ECS/EcsDevWatch.d.ts +1 -21
- package/lib/AWS/ECS/EcsDevWatch.d.ts.map +1 -1
- package/lib/AWS/ECS/EcsDevWatch.js +1 -56
- package/lib/AWS/ECS/EcsDevWatch.js.map +1 -1
- package/lib/AWS/ECS/FlociServiceProvider.d.ts.map +1 -1
- package/lib/AWS/ECS/FlociServiceProvider.js +34 -22
- package/lib/AWS/ECS/FlociServiceProvider.js.map +1 -1
- package/lib/AWS/ECS/FlociTaskProvider.d.ts.map +1 -1
- package/lib/AWS/ECS/FlociTaskProvider.js +25 -15
- package/lib/AWS/ECS/FlociTaskProvider.js.map +1 -1
- package/lib/AWS/ECS/Service.d.ts.map +1 -1
- package/lib/AWS/ECS/Service.js +2 -27
- package/lib/AWS/ECS/Service.js.map +1 -1
- package/lib/AWS/ECS/Task.d.ts +1 -1
- package/lib/AWS/Endpoint.d.ts +11 -0
- package/lib/AWS/Endpoint.d.ts.map +1 -1
- package/lib/AWS/Endpoint.js +11 -0
- package/lib/AWS/Endpoint.js.map +1 -1
- package/lib/AWS/IAM/SAMLProvider.d.ts +3 -3
- package/lib/AWS/IAM/SAMLProvider.d.ts.map +1 -1
- package/lib/AWS/IAM/SAMLProvider.js +36 -22
- package/lib/AWS/IAM/SAMLProvider.js.map +1 -1
- package/lib/AWS/Lambda/DurableFunction.d.ts +22 -1
- package/lib/AWS/Lambda/DurableFunction.d.ts.map +1 -1
- package/lib/AWS/Lambda/DurableFunction.js.map +1 -1
- package/lib/AWS/Lambda/FlociFunctionProvider.d.ts.map +1 -1
- package/lib/AWS/Lambda/FlociFunctionProvider.js +73 -30
- package/lib/AWS/Lambda/FlociFunctionProvider.js.map +1 -1
- package/lib/AWS/Lambda/FlociMicrovmImageProvider.d.ts +6 -0
- package/lib/AWS/Lambda/FlociMicrovmImageProvider.d.ts.map +1 -0
- package/lib/AWS/Lambda/FlociMicrovmImageProvider.js +197 -0
- package/lib/AWS/Lambda/FlociMicrovmImageProvider.js.map +1 -0
- package/lib/AWS/Lambda/Function.d.ts +155 -51
- package/lib/AWS/Lambda/Function.d.ts.map +1 -1
- package/lib/AWS/Lambda/Function.js +368 -70
- package/lib/AWS/Lambda/Function.js.map +1 -1
- package/lib/AWS/Lambda/FunctionBundle.d.ts +3 -3
- package/lib/AWS/Lambda/FunctionBundle.d.ts.map +1 -1
- package/lib/AWS/Lambda/FunctionBundle.js +9 -120
- package/lib/AWS/Lambda/FunctionBundle.js.map +1 -1
- package/lib/AWS/Lambda/FunctionImage.d.ts +154 -0
- package/lib/AWS/Lambda/FunctionImage.d.ts.map +1 -0
- package/lib/AWS/Lambda/FunctionImage.js +359 -0
- package/lib/AWS/Lambda/FunctionImage.js.map +1 -0
- package/lib/AWS/Lambda/MicrovmBundle.d.ts.map +1 -1
- package/lib/AWS/Lambda/MicrovmBundle.js +10 -64
- package/lib/AWS/Lambda/MicrovmBundle.js.map +1 -1
- package/lib/AWS/Lambda/MicrovmImage.d.ts +6 -1
- package/lib/AWS/Lambda/MicrovmImage.d.ts.map +1 -1
- package/lib/AWS/Lambda/MicrovmImage.js.map +1 -1
- package/lib/AWS/Lambda/MicrovmProvider.d.ts +1 -4
- package/lib/AWS/Lambda/MicrovmProvider.d.ts.map +1 -1
- package/lib/AWS/Lambda/MicrovmProvider.js +104 -24
- package/lib/AWS/Lambda/MicrovmProvider.js.map +1 -1
- package/lib/AWS/Lambda/index.d.ts +1 -0
- package/lib/AWS/Lambda/index.d.ts.map +1 -1
- package/lib/AWS/Lambda/index.js +1 -0
- package/lib/AWS/Lambda/index.js.map +1 -1
- package/lib/AWS/Local/DevWatchProvider.d.ts +37 -1
- package/lib/AWS/Local/DevWatchProvider.d.ts.map +1 -1
- package/lib/AWS/Local/DevWatchProvider.js +62 -3
- package/lib/AWS/Local/DevWatchProvider.js.map +1 -1
- package/lib/AWS/Local/FlociServices.d.ts.map +1 -1
- package/lib/AWS/Local/FlociServices.js +4 -0
- package/lib/AWS/Local/FlociServices.js.map +1 -1
- package/lib/AWS/Local/ImageSourceTrigger.d.ts +32 -0
- package/lib/AWS/Local/ImageSourceTrigger.d.ts.map +1 -0
- package/lib/AWS/Local/ImageSourceTrigger.js +67 -0
- package/lib/AWS/Local/ImageSourceTrigger.js.map +1 -0
- package/lib/AWS/Local/Local.js +2 -1
- package/lib/AWS/Local/Local.js.map +1 -1
- package/lib/AWS/Local/ProviderContext.d.ts +25 -0
- package/lib/AWS/Local/ProviderContext.d.ts.map +1 -1
- package/lib/AWS/Local/ProviderContext.js +72 -0
- package/lib/AWS/Local/ProviderContext.js.map +1 -1
- package/lib/AWS/Providers.d.ts.map +1 -1
- package/lib/AWS/Providers.js +49 -7
- package/lib/AWS/Providers.js.map +1 -1
- package/lib/AWS/Route53/HostedZoneLookup.d.ts +22 -0
- package/lib/AWS/Route53/HostedZoneLookup.d.ts.map +1 -0
- package/lib/AWS/Route53/HostedZoneLookup.js +51 -0
- package/lib/AWS/Route53/HostedZoneLookup.js.map +1 -0
- package/lib/AWS/Route53/Record.d.ts +6 -2
- package/lib/AWS/Route53/Record.d.ts.map +1 -1
- package/lib/AWS/Route53/Record.js +17 -7
- package/lib/AWS/Route53/Record.js.map +1 -1
- package/lib/AWS/Route53/Records.d.ts +10 -4
- package/lib/AWS/Route53/Records.d.ts.map +1 -1
- package/lib/AWS/Route53/Records.js +37 -6
- package/lib/AWS/Route53/Records.js.map +1 -1
- package/lib/AWS/Website/AssetDeployment.d.ts +3 -1
- package/lib/AWS/Website/AssetDeployment.d.ts.map +1 -1
- package/lib/AWS/Website/AssetDeployment.js +80 -82
- package/lib/AWS/Website/AssetDeployment.js.map +1 -1
- package/lib/AWS/Website/Astro.d.ts +47 -26
- package/lib/AWS/Website/Astro.d.ts.map +1 -1
- package/lib/AWS/Website/Astro.js +21 -10
- package/lib/AWS/Website/Astro.js.map +1 -1
- package/lib/AWS/Website/Foldkit.d.ts +136 -0
- package/lib/AWS/Website/Foldkit.d.ts.map +1 -0
- package/lib/AWS/Website/Foldkit.js +113 -0
- package/lib/AWS/Website/Foldkit.js.map +1 -0
- package/lib/AWS/Website/FrameworkSite.d.ts +25 -33
- package/lib/AWS/Website/FrameworkSite.d.ts.map +1 -1
- package/lib/AWS/Website/FrameworkSite.js +15 -8
- package/lib/AWS/Website/FrameworkSite.js.map +1 -1
- package/lib/AWS/Website/Nextjs.d.ts +29 -32
- package/lib/AWS/Website/Nextjs.d.ts.map +1 -1
- package/lib/AWS/Website/Nextjs.js +12 -13
- package/lib/AWS/Website/Nextjs.js.map +1 -1
- package/lib/AWS/Website/Nuxt.d.ts +38 -11
- package/lib/AWS/Website/Nuxt.d.ts.map +1 -1
- package/lib/AWS/Website/Nuxt.js +32 -10
- package/lib/AWS/Website/Nuxt.js.map +1 -1
- package/lib/AWS/Website/Octane.d.ts +9 -10
- package/lib/AWS/Website/Octane.d.ts.map +1 -1
- package/lib/AWS/Website/Octane.js +3 -5
- package/lib/AWS/Website/Octane.js.map +1 -1
- package/lib/AWS/Website/ReactRouter.d.ts +118 -0
- package/lib/AWS/Website/ReactRouter.d.ts.map +1 -0
- package/lib/AWS/Website/ReactRouter.js +87 -0
- package/lib/AWS/Website/ReactRouter.js.map +1 -0
- package/lib/AWS/Website/Router.d.ts.map +1 -1
- package/lib/AWS/Website/Router.js +6 -2
- package/lib/AWS/Website/Router.js.map +1 -1
- package/lib/AWS/Website/ServerLocal.js +1 -1
- package/lib/AWS/Website/ServerLocal.js.map +1 -1
- package/lib/AWS/Website/SolidStart.d.ts +118 -0
- package/lib/AWS/Website/SolidStart.d.ts.map +1 -0
- package/lib/AWS/Website/SolidStart.js +78 -0
- package/lib/AWS/Website/SolidStart.js.map +1 -0
- package/lib/AWS/Website/SsrSite.d.ts.map +1 -1
- package/lib/AWS/Website/SsrSite.js +3 -1
- package/lib/AWS/Website/SsrSite.js.map +1 -1
- package/lib/AWS/Website/StaticSite.d.ts +3 -7
- package/lib/AWS/Website/StaticSite.d.ts.map +1 -1
- package/lib/AWS/Website/StaticSite.js +15 -9
- package/lib/AWS/Website/StaticSite.js.map +1 -1
- package/lib/AWS/Website/SvelteKit.d.ts +31 -15
- package/lib/AWS/Website/SvelteKit.d.ts.map +1 -1
- package/lib/AWS/Website/SvelteKit.js +28 -11
- package/lib/AWS/Website/SvelteKit.js.map +1 -1
- package/lib/AWS/Website/TanStackStart.d.ts +112 -0
- package/lib/AWS/Website/TanStackStart.d.ts.map +1 -0
- package/lib/AWS/Website/TanStackStart.js +81 -0
- package/lib/AWS/Website/TanStackStart.js.map +1 -0
- package/lib/AWS/Website/Vite.d.ts +65 -22
- package/lib/AWS/Website/Vite.d.ts.map +1 -1
- package/lib/AWS/Website/Vite.js +49 -19
- package/lib/AWS/Website/Vite.js.map +1 -1
- package/lib/AWS/Website/Waku.d.ts +46 -14
- package/lib/AWS/Website/Waku.d.ts.map +1 -1
- package/lib/AWS/Website/Waku.js +28 -11
- package/lib/AWS/Website/Waku.js.map +1 -1
- package/lib/AWS/Website/index.d.ts +4 -1
- package/lib/AWS/Website/index.d.ts.map +1 -1
- package/lib/AWS/Website/index.js +4 -1
- package/lib/AWS/Website/index.js.map +1 -1
- package/lib/AWS/Website/shared.d.ts +11 -2
- package/lib/AWS/Website/shared.d.ts.map +1 -1
- package/lib/AWS/Website/shared.js.map +1 -1
- package/lib/Auth/AuthProvider.d.ts.map +1 -1
- package/lib/Auth/AuthProvider.js +7 -1
- package/lib/Auth/AuthProvider.js.map +1 -1
- package/lib/Auth/Lock.d.ts +21 -0
- package/lib/Auth/Lock.d.ts.map +1 -1
- package/lib/Auth/Lock.js +34 -1
- package/lib/Auth/Lock.js.map +1 -1
- package/lib/Axiom/Dataset.d.ts +18 -6
- package/lib/Axiom/Dataset.d.ts.map +1 -1
- package/lib/Axiom/Dataset.js +40 -29
- package/lib/Axiom/Dataset.js.map +1 -1
- package/lib/Binding.d.ts +1 -1
- package/lib/Binding.d.ts.map +1 -1
- package/lib/Binding.js +130 -1
- package/lib/Binding.js.map +1 -1
- package/lib/Bundle/Bundle.d.ts +19 -2
- package/lib/Bundle/Bundle.d.ts.map +1 -1
- package/lib/Bundle/Bundle.js +57 -3
- package/lib/Bundle/Bundle.js.map +1 -1
- package/lib/Cli/commands/deploy.d.ts.map +1 -1
- package/lib/Cli/commands/deploy.js +17 -1
- package/lib/Cli/commands/deploy.js.map +1 -1
- package/lib/Cli/commands/dev.d.ts +13 -1
- package/lib/Cli/commands/dev.d.ts.map +1 -1
- package/lib/Cli/commands/dev.js +12 -5
- package/lib/Cli/commands/dev.js.map +1 -1
- package/lib/Cloudflare/AI/SecuritySettings.d.ts.map +1 -1
- package/lib/Cloudflare/AI/SecuritySettings.js +1 -0
- package/lib/Cloudflare/AI/SecuritySettings.js.map +1 -1
- package/lib/Cloudflare/Containers/ContainerApplication.d.ts +4 -2
- package/lib/Cloudflare/Containers/ContainerApplication.d.ts.map +1 -1
- package/lib/Cloudflare/Containers/ContainerApplication.js.map +1 -1
- package/lib/Cloudflare/Containers/ContainerBundle.d.ts.map +1 -1
- package/lib/Cloudflare/Containers/ContainerBundle.js +9 -97
- package/lib/Cloudflare/Containers/ContainerBundle.js.map +1 -1
- package/lib/Cloudflare/Containers/ContainerPlatform.d.ts.map +1 -1
- package/lib/Cloudflare/Containers/ContainerPlatform.js +24 -2
- package/lib/Cloudflare/Containers/ContainerPlatform.js.map +1 -1
- package/lib/Cloudflare/Containers/ContainerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Containers/ContainerProvider.js +211 -31
- package/lib/Cloudflare/Containers/ContainerProvider.js.map +1 -1
- package/lib/Cloudflare/Containers/LocalContainerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Containers/LocalContainerProvider.js +55 -7
- package/lib/Cloudflare/Containers/LocalContainerProvider.js.map +1 -1
- package/lib/Cloudflare/Email/AllowPolicy.d.ts.map +1 -1
- package/lib/Cloudflare/Email/AllowPolicy.js +9 -3
- package/lib/Cloudflare/Email/AllowPolicy.js.map +1 -1
- package/lib/Cloudflare/Email/CatchAll.d.ts.map +1 -1
- package/lib/Cloudflare/Email/CatchAll.js +12 -6
- package/lib/Cloudflare/Email/CatchAll.js.map +1 -1
- package/lib/Cloudflare/Email/ImpersonationRegistryEntry.d.ts.map +1 -1
- package/lib/Cloudflare/Email/ImpersonationRegistryEntry.js +10 -1
- package/lib/Cloudflare/Email/ImpersonationRegistryEntry.js.map +1 -1
- package/lib/Cloudflare/Email/Rule.d.ts.map +1 -1
- package/lib/Cloudflare/Email/Rule.js +6 -3
- package/lib/Cloudflare/Email/Rule.js.map +1 -1
- package/lib/Cloudflare/Email/TrustedDomain.d.ts.map +1 -1
- package/lib/Cloudflare/Email/TrustedDomain.js +10 -1
- package/lib/Cloudflare/Email/TrustedDomain.js.map +1 -1
- package/lib/Cloudflare/Email/retry.d.ts +21 -0
- package/lib/Cloudflare/Email/retry.d.ts.map +1 -0
- package/lib/Cloudflare/Email/retry.js +24 -0
- package/lib/Cloudflare/Email/retry.js.map +1 -0
- package/lib/Cloudflare/R2/Bucket.d.ts +43 -2
- package/lib/Cloudflare/R2/Bucket.d.ts.map +1 -1
- package/lib/Cloudflare/R2/Bucket.js +86 -6
- package/lib/Cloudflare/R2/Bucket.js.map +1 -1
- package/lib/Cloudflare/R2/DataCatalog.d.ts.map +1 -1
- package/lib/Cloudflare/R2/DataCatalog.js +18 -16
- package/lib/Cloudflare/R2/DataCatalog.js.map +1 -1
- package/lib/Cloudflare/StateStore/Api.d.ts +3 -0
- package/lib/Cloudflare/Website/Astro.d.ts +42 -34
- package/lib/Cloudflare/Website/Astro.d.ts.map +1 -1
- package/lib/Cloudflare/Website/Astro.js +32 -28
- package/lib/Cloudflare/Website/Astro.js.map +1 -1
- package/lib/Cloudflare/Website/Foldkit.d.ts +3 -4
- package/lib/Cloudflare/Website/Foldkit.d.ts.map +1 -1
- package/lib/Cloudflare/Website/Foldkit.js +4 -4
- package/lib/Cloudflare/Website/Foldkit.js.map +1 -1
- package/lib/Cloudflare/Website/Nextjs.d.ts +26 -60
- package/lib/Cloudflare/Website/Nextjs.d.ts.map +1 -1
- package/lib/Cloudflare/Website/Nextjs.js +13 -21
- package/lib/Cloudflare/Website/Nextjs.js.map +1 -1
- package/lib/Cloudflare/Website/Nuxt.d.ts +37 -14
- package/lib/Cloudflare/Website/Nuxt.d.ts.map +1 -1
- package/lib/Cloudflare/Website/Nuxt.js +24 -4
- package/lib/Cloudflare/Website/Nuxt.js.map +1 -1
- package/lib/Cloudflare/Website/SvelteKit.d.ts +27 -41
- package/lib/Cloudflare/Website/SvelteKit.d.ts.map +1 -1
- package/lib/Cloudflare/Website/SvelteKit.js +38 -25
- package/lib/Cloudflare/Website/SvelteKit.js.map +1 -1
- package/lib/Cloudflare/Website/Vite.d.ts +2 -3
- package/lib/Cloudflare/Website/Vite.d.ts.map +1 -1
- package/lib/Cloudflare/Website/Vite.js +2 -3
- package/lib/Cloudflare/Website/Vite.js.map +1 -1
- package/lib/Cloudflare/Website/Vocs.d.ts +131 -0
- package/lib/Cloudflare/Website/Vocs.d.ts.map +1 -0
- package/lib/Cloudflare/Website/Vocs.js +116 -0
- package/lib/Cloudflare/Website/Vocs.js.map +1 -0
- package/lib/Cloudflare/Website/Waku.d.ts +42 -24
- package/lib/Cloudflare/Website/Waku.d.ts.map +1 -1
- package/lib/Cloudflare/Website/Waku.js +22 -5
- package/lib/Cloudflare/Website/Waku.js.map +1 -1
- package/lib/Cloudflare/Website/index.d.ts +1 -0
- package/lib/Cloudflare/Website/index.d.ts.map +1 -1
- package/lib/Cloudflare/Website/index.js +1 -0
- package/lib/Cloudflare/Website/index.js.map +1 -1
- package/lib/Cloudflare/Workers/Assets.d.ts +1 -1
- package/lib/Cloudflare/Workers/Assets.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Assets.js +14 -7
- package/lib/Cloudflare/Workers/Assets.js.map +1 -1
- package/lib/Cloudflare/Workers/EmailEventSource.d.ts +196 -0
- package/lib/Cloudflare/Workers/EmailEventSource.d.ts.map +1 -0
- package/lib/Cloudflare/Workers/EmailEventSource.js +198 -0
- package/lib/Cloudflare/Workers/EmailEventSource.js.map +1 -0
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js +134 -0
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts +7 -0
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.js +14 -3
- package/lib/Cloudflare/Workers/WorkerAsyncBindings.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBinding.d.ts +6 -0
- package/lib/Cloudflare/Workers/WorkerBinding.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerProvider.js +1 -1
- package/lib/Cloudflare/Workers/WorkerProvider.js.map +1 -1
- package/lib/Cloudflare/Workers/index.d.ts +1 -0
- package/lib/Cloudflare/Workers/index.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/index.js +1 -0
- package/lib/Cloudflare/Workers/index.js.map +1 -1
- package/lib/Cloudflare/Zone/lookup.d.ts +2 -2
- package/lib/Cloudflare/Zone/lookup.d.ts.map +1 -1
- package/lib/Cloudflare/Zone/lookup.js +16 -20
- package/lib/Cloudflare/Zone/lookup.js.map +1 -1
- package/lib/Command/Build.d.ts.map +1 -1
- package/lib/Command/Build.js +5 -2
- package/lib/Command/Build.js.map +1 -1
- package/lib/Command/Command.d.ts +4 -1
- package/lib/Command/Command.d.ts.map +1 -1
- package/lib/Command/Command.js +3 -1
- package/lib/Command/Command.js.map +1 -1
- package/lib/Command/Dev.d.ts.map +1 -1
- package/lib/Command/Dev.js +6 -1
- package/lib/Command/Dev.js.map +1 -1
- package/lib/Docker/BuildHash.d.ts +34 -0
- package/lib/Docker/BuildHash.d.ts.map +1 -0
- package/lib/Docker/BuildHash.js +220 -0
- package/lib/Docker/BuildHash.js.map +1 -0
- package/lib/Docker/Container.d.ts +61 -0
- package/lib/Docker/Container.d.ts.map +1 -1
- package/lib/Docker/Container.js +110 -19
- package/lib/Docker/Container.js.map +1 -1
- package/lib/Docker/Docker.d.ts +3 -0
- package/lib/Docker/Docker.d.ts.map +1 -1
- package/lib/Docker/Docker.js.map +1 -1
- package/lib/Docker/ServiceImage.d.ts +3 -5
- package/lib/Docker/ServiceImage.d.ts.map +1 -1
- package/lib/Docker/ServiceImage.js +6 -74
- package/lib/Docker/ServiceImage.js.map +1 -1
- package/lib/Fly/Bucket.d.ts.map +1 -1
- package/lib/Fly/Bucket.js +24 -18
- package/lib/Fly/Bucket.js.map +1 -1
- package/lib/Fly/BucketBinding.d.ts.map +1 -1
- package/lib/Fly/BucketBinding.js +3 -2
- package/lib/Fly/BucketBinding.js.map +1 -1
- package/lib/Fly/ConnectPostgres.d.ts +0 -2
- package/lib/Fly/ConnectPostgres.d.ts.map +1 -1
- package/lib/Fly/ConnectPostgres.js.map +1 -1
- package/lib/Fly/Decrypt.d.ts +1 -2
- package/lib/Fly/Decrypt.d.ts.map +1 -1
- package/lib/Fly/Decrypt.js.map +1 -1
- package/lib/Fly/DecryptHttp.d.ts.map +1 -1
- package/lib/Fly/DecryptHttp.js +3 -13
- package/lib/Fly/DecryptHttp.js.map +1 -1
- package/lib/Fly/Encrypt.d.ts +1 -2
- package/lib/Fly/Encrypt.d.ts.map +1 -1
- package/lib/Fly/Encrypt.js.map +1 -1
- package/lib/Fly/EncryptHttp.d.ts.map +1 -1
- package/lib/Fly/EncryptHttp.js +1 -12
- package/lib/Fly/EncryptHttp.js.map +1 -1
- package/lib/Fly/Environment.d.ts.map +1 -1
- package/lib/Fly/Environment.js +1 -1
- package/lib/Fly/Environment.js.map +1 -1
- package/lib/Fly/Errors.d.ts +0 -22
- package/lib/Fly/Errors.d.ts.map +1 -1
- package/lib/Fly/Errors.js +0 -11
- package/lib/Fly/Errors.js.map +1 -1
- package/lib/Fly/Postgres.d.ts +1 -1
- package/lib/Fly/Postgres.d.ts.map +1 -1
- package/lib/Fly/Postgres.js +18 -14
- package/lib/Fly/Postgres.js.map +1 -1
- package/lib/Fly/PostgresMigrations.d.ts.map +1 -1
- package/lib/Fly/PostgresMigrations.js +37 -1
- package/lib/Fly/PostgresMigrations.js.map +1 -1
- package/lib/Fly/Providers.d.ts +2 -1
- package/lib/Fly/Providers.d.ts.map +1 -1
- package/lib/Fly/Providers.js +7 -2
- package/lib/Fly/Providers.js.map +1 -1
- package/lib/Fly/ReadRedis.d.ts +3 -6
- package/lib/Fly/ReadRedis.d.ts.map +1 -1
- package/lib/Fly/Redis.d.ts +1 -16
- package/lib/Fly/Redis.d.ts.map +1 -1
- package/lib/Fly/Redis.js +1 -4
- package/lib/Fly/Redis.js.map +1 -1
- package/lib/Fly/RedisBinding.d.ts +3 -4
- package/lib/Fly/RedisBinding.d.ts.map +1 -1
- package/lib/Fly/RedisBinding.js +4 -111
- package/lib/Fly/RedisBinding.js.map +1 -1
- package/lib/Fly/RedisHttp.d.ts +7 -9
- package/lib/Fly/RedisHttp.d.ts.map +1 -1
- package/lib/Fly/RedisHttp.js +4 -32
- package/lib/Fly/RedisHttp.js.map +1 -1
- package/lib/Fly/SecretHttp.d.ts +3 -1
- package/lib/Fly/SecretHttp.d.ts.map +1 -1
- package/lib/Fly/SecretHttp.js +16 -21
- package/lib/Fly/SecretHttp.js.map +1 -1
- package/lib/Fly/SecretKeyHttp.d.ts +1 -8
- package/lib/Fly/SecretKeyHttp.d.ts.map +1 -1
- package/lib/Fly/SecretKeyHttp.js +0 -33
- package/lib/Fly/SecretKeyHttp.js.map +1 -1
- package/lib/Fly/Service.d.ts +33 -6
- package/lib/Fly/Service.d.ts.map +1 -1
- package/lib/Fly/Service.js +64 -24
- package/lib/Fly/Service.js.map +1 -1
- package/lib/Fly/Sign.d.ts +1 -2
- package/lib/Fly/Sign.d.ts.map +1 -1
- package/lib/Fly/Sign.js.map +1 -1
- package/lib/Fly/SignHttp.d.ts.map +1 -1
- package/lib/Fly/SignHttp.js +1 -7
- package/lib/Fly/SignHttp.js.map +1 -1
- package/lib/Fly/Sprite.d.ts.map +1 -1
- package/lib/Fly/Sprite.js +24 -15
- package/lib/Fly/Sprite.js.map +1 -1
- package/lib/Fly/SpriteHttp.d.ts.map +1 -1
- package/lib/Fly/SpriteHttp.js +2 -1
- package/lib/Fly/SpriteHttp.js.map +1 -1
- package/lib/Fly/Verify.d.ts +1 -2
- package/lib/Fly/Verify.d.ts.map +1 -1
- package/lib/Fly/Verify.js.map +1 -1
- package/lib/Fly/VerifyHttp.d.ts.map +1 -1
- package/lib/Fly/VerifyHttp.js +2 -10
- package/lib/Fly/VerifyHttp.js.map +1 -1
- package/lib/Fly/Website/AssetDeployment.d.ts +43 -0
- package/lib/Fly/Website/AssetDeployment.d.ts.map +1 -0
- package/lib/Fly/Website/AssetDeployment.js +162 -0
- package/lib/Fly/Website/AssetDeployment.js.map +1 -0
- package/lib/Fly/Website/Astro.d.ts +87 -0
- package/lib/Fly/Website/Astro.d.ts.map +1 -0
- package/lib/Fly/Website/Astro.js +55 -0
- package/lib/Fly/Website/Astro.js.map +1 -0
- package/lib/Fly/Website/Foldkit.d.ts +47 -0
- package/lib/Fly/Website/Foldkit.d.ts.map +1 -0
- package/lib/Fly/Website/Foldkit.js +39 -0
- package/lib/Fly/Website/Foldkit.js.map +1 -0
- package/lib/Fly/Website/FrameworkSite.d.ts +167 -0
- package/lib/Fly/Website/FrameworkSite.d.ts.map +1 -0
- package/lib/Fly/Website/FrameworkSite.js +160 -0
- package/lib/Fly/Website/FrameworkSite.js.map +1 -0
- package/lib/Fly/Website/Nextjs.d.ts +54 -0
- package/lib/Fly/Website/Nextjs.d.ts.map +1 -0
- package/lib/Fly/Website/Nextjs.js +46 -0
- package/lib/Fly/Website/Nextjs.js.map +1 -0
- package/lib/Fly/Website/Nuxt.d.ts +51 -0
- package/lib/Fly/Website/Nuxt.d.ts.map +1 -0
- package/lib/Fly/Website/Nuxt.js +36 -0
- package/lib/Fly/Website/Nuxt.js.map +1 -0
- package/lib/Fly/Website/Octane.d.ts +57 -0
- package/lib/Fly/Website/Octane.d.ts.map +1 -0
- package/lib/Fly/Website/Octane.js +47 -0
- package/lib/Fly/Website/Octane.js.map +1 -0
- package/lib/Fly/Website/ReactRouter.d.ts +80 -0
- package/lib/Fly/Website/ReactRouter.d.ts.map +1 -0
- package/lib/Fly/Website/ReactRouter.js +70 -0
- package/lib/Fly/Website/ReactRouter.js.map +1 -0
- package/lib/Fly/Website/SolidStart.d.ts +93 -0
- package/lib/Fly/Website/SolidStart.d.ts.map +1 -0
- package/lib/Fly/Website/SolidStart.js +71 -0
- package/lib/Fly/Website/SolidStart.js.map +1 -0
- package/lib/Fly/Website/StaticSite.d.ts +148 -0
- package/lib/Fly/Website/StaticSite.d.ts.map +1 -0
- package/lib/Fly/Website/StaticSite.js +173 -0
- package/lib/Fly/Website/StaticSite.js.map +1 -0
- package/lib/Fly/Website/SvelteKit.d.ts +52 -0
- package/lib/Fly/Website/SvelteKit.d.ts.map +1 -0
- package/lib/Fly/Website/SvelteKit.js +37 -0
- package/lib/Fly/Website/SvelteKit.js.map +1 -0
- package/lib/Fly/Website/TanStackStart.d.ts +76 -0
- package/lib/Fly/Website/TanStackStart.d.ts.map +1 -0
- package/lib/Fly/Website/TanStackStart.js +66 -0
- package/lib/Fly/Website/TanStackStart.js.map +1 -0
- package/lib/Fly/Website/Vite.d.ts +103 -0
- package/lib/Fly/Website/Vite.d.ts.map +1 -0
- package/lib/Fly/Website/Vite.js +92 -0
- package/lib/Fly/Website/Vite.js.map +1 -0
- package/lib/Fly/Website/Vocs.d.ts +52 -0
- package/lib/Fly/Website/Vocs.d.ts.map +1 -0
- package/lib/Fly/Website/Vocs.js +38 -0
- package/lib/Fly/Website/Vocs.js.map +1 -0
- package/lib/Fly/Website/Waku.d.ts +64 -0
- package/lib/Fly/Website/Waku.d.ts.map +1 -0
- package/lib/Fly/Website/Waku.js +39 -0
- package/lib/Fly/Website/Waku.js.map +1 -0
- package/lib/Fly/Website/index.d.ts +16 -0
- package/lib/Fly/Website/index.d.ts.map +1 -0
- package/lib/Fly/Website/index.js +16 -0
- package/lib/Fly/Website/index.js.map +1 -0
- package/lib/Fly/WriteRedis.d.ts +3 -6
- package/lib/Fly/WriteRedis.d.ts.map +1 -1
- package/lib/Fly/hosted.d.ts +23 -10
- package/lib/Fly/hosted.d.ts.map +1 -1
- package/lib/Fly/hosted.js +115 -83
- package/lib/Fly/hosted.js.map +1 -1
- package/lib/Fly/index.d.ts +1 -0
- package/lib/Fly/index.d.ts.map +1 -1
- package/lib/Fly/index.js +1 -0
- package/lib/Fly/index.js.map +1 -1
- package/lib/Hetzner/MountVolume.d.ts +1 -1
- package/lib/Hetzner/Providers.d.ts +2 -1
- package/lib/Hetzner/Providers.d.ts.map +1 -1
- package/lib/Hetzner/Providers.js +4 -1
- package/lib/Hetzner/Providers.js.map +1 -1
- package/lib/Hetzner/Server.d.ts +1 -1
- package/lib/Hetzner/Server.d.ts.map +1 -1
- package/lib/Hetzner/Server.js +26 -14
- package/lib/Hetzner/Server.js.map +1 -1
- package/lib/Hetzner/Service.d.ts +14 -4
- package/lib/Hetzner/Service.d.ts.map +1 -1
- package/lib/Hetzner/Service.js +3 -2
- package/lib/Hetzner/Service.js.map +1 -1
- package/lib/Hetzner/Website/Astro.d.ts +85 -0
- package/lib/Hetzner/Website/Astro.d.ts.map +1 -0
- package/lib/Hetzner/Website/Astro.js +59 -0
- package/lib/Hetzner/Website/Astro.js.map +1 -0
- package/lib/Hetzner/Website/Foldkit.d.ts +45 -0
- package/lib/Hetzner/Website/Foldkit.d.ts.map +1 -0
- package/lib/Hetzner/Website/Foldkit.js +41 -0
- package/lib/Hetzner/Website/Foldkit.js.map +1 -0
- package/lib/Hetzner/Website/FrameworkSite.d.ts +161 -0
- package/lib/Hetzner/Website/FrameworkSite.d.ts.map +1 -0
- package/lib/Hetzner/Website/FrameworkSite.js +162 -0
- package/lib/Hetzner/Website/FrameworkSite.js.map +1 -0
- package/lib/Hetzner/Website/Nextjs.d.ts +52 -0
- package/lib/Hetzner/Website/Nextjs.d.ts.map +1 -0
- package/lib/Hetzner/Website/Nextjs.js +49 -0
- package/lib/Hetzner/Website/Nextjs.js.map +1 -0
- package/lib/Hetzner/Website/Nuxt.d.ts +53 -0
- package/lib/Hetzner/Website/Nuxt.d.ts.map +1 -0
- package/lib/Hetzner/Website/Nuxt.js +43 -0
- package/lib/Hetzner/Website/Nuxt.js.map +1 -0
- package/lib/Hetzner/Website/Octane.d.ts +54 -0
- package/lib/Hetzner/Website/Octane.d.ts.map +1 -0
- package/lib/Hetzner/Website/Octane.js +49 -0
- package/lib/Hetzner/Website/Octane.js.map +1 -0
- package/lib/Hetzner/Website/ReactRouter.d.ts +78 -0
- package/lib/Hetzner/Website/ReactRouter.d.ts.map +1 -0
- package/lib/Hetzner/Website/ReactRouter.js +73 -0
- package/lib/Hetzner/Website/ReactRouter.js.map +1 -0
- package/lib/Hetzner/Website/SolidStart.d.ts +90 -0
- package/lib/Hetzner/Website/SolidStart.d.ts.map +1 -0
- package/lib/Hetzner/Website/SolidStart.js +73 -0
- package/lib/Hetzner/Website/SolidStart.js.map +1 -0
- package/lib/Hetzner/Website/StaticSite.d.ts +134 -0
- package/lib/Hetzner/Website/StaticSite.d.ts.map +1 -0
- package/lib/Hetzner/Website/StaticSite.js +176 -0
- package/lib/Hetzner/Website/StaticSite.js.map +1 -0
- package/lib/Hetzner/Website/SvelteKit.d.ts +52 -0
- package/lib/Hetzner/Website/SvelteKit.d.ts.map +1 -0
- package/lib/Hetzner/Website/SvelteKit.js +42 -0
- package/lib/Hetzner/Website/SvelteKit.js.map +1 -0
- package/lib/Hetzner/Website/TanStackStart.d.ts +73 -0
- package/lib/Hetzner/Website/TanStackStart.d.ts.map +1 -0
- package/lib/Hetzner/Website/TanStackStart.js +68 -0
- package/lib/Hetzner/Website/TanStackStart.js.map +1 -0
- package/lib/Hetzner/Website/Vite.d.ts +97 -0
- package/lib/Hetzner/Website/Vite.d.ts.map +1 -0
- package/lib/Hetzner/Website/Vite.js +97 -0
- package/lib/Hetzner/Website/Vite.js.map +1 -0
- package/lib/Hetzner/Website/Vocs.d.ts +49 -0
- package/lib/Hetzner/Website/Vocs.d.ts.map +1 -0
- package/lib/Hetzner/Website/Vocs.js +39 -0
- package/lib/Hetzner/Website/Vocs.js.map +1 -0
- package/lib/Hetzner/Website/Waku.d.ts +53 -0
- package/lib/Hetzner/Website/Waku.d.ts.map +1 -0
- package/lib/Hetzner/Website/Waku.js +42 -0
- package/lib/Hetzner/Website/Waku.js.map +1 -0
- package/lib/Hetzner/Website/index.d.ts +15 -0
- package/lib/Hetzner/Website/index.d.ts.map +1 -0
- package/lib/Hetzner/Website/index.js +15 -0
- package/lib/Hetzner/Website/index.js.map +1 -0
- package/lib/Hetzner/actions.d.ts +2 -3
- package/lib/Hetzner/actions.d.ts.map +1 -1
- package/lib/Hetzner/actions.js +6 -13
- package/lib/Hetzner/actions.js.map +1 -1
- package/lib/Hetzner/hosted.d.ts +29 -4
- package/lib/Hetzner/hosted.d.ts.map +1 -1
- package/lib/Hetzner/hosted.js +230 -93
- package/lib/Hetzner/hosted.js.map +1 -1
- package/lib/Hetzner/index.d.ts +1 -0
- package/lib/Hetzner/index.d.ts.map +1 -1
- package/lib/Hetzner/index.js +1 -0
- package/lib/Hetzner/index.js.map +1 -1
- package/lib/Http.d.ts +9 -1
- package/lib/Http.d.ts.map +1 -1
- package/lib/Http.js +5 -2
- package/lib/Http.js.map +1 -1
- package/lib/Kubernetes/HelmChart.d.ts +5 -3
- package/lib/Kubernetes/HelmChart.d.ts.map +1 -1
- package/lib/Kubernetes/HelmChart.js +5 -3
- package/lib/Kubernetes/HelmChart.js.map +1 -1
- package/lib/Kubernetes/internal/helm.d.ts +19 -5
- package/lib/Kubernetes/internal/helm.d.ts.map +1 -1
- package/lib/Kubernetes/internal/helm.js +28 -6
- package/lib/Kubernetes/internal/helm.js.map +1 -1
- package/lib/Local/DockerHostGateway.d.ts +13 -0
- package/lib/Local/DockerHostGateway.d.ts.map +1 -0
- package/lib/Local/DockerHostGateway.js +18 -0
- package/lib/Local/DockerHostGateway.js.map +1 -0
- package/lib/Local/ProviderLayer.d.ts +20 -0
- package/lib/Local/ProviderLayer.d.ts.map +1 -1
- package/lib/Local/ProviderLayer.js +2 -0
- package/lib/Local/ProviderLayer.js.map +1 -1
- package/lib/Local/RpcProvider.d.ts +1 -1
- package/lib/Local/RpcProvider.d.ts.map +1 -1
- package/lib/Local/RpcProvider.js.map +1 -1
- package/lib/Local/RpcProviderProxy.d.ts.map +1 -1
- package/lib/Local/RpcProviderProxy.js +14 -1
- package/lib/Local/RpcProviderProxy.js.map +1 -1
- package/lib/Planetscale/Postgres/PostgresBranch.d.ts +2 -1
- package/lib/Planetscale/Postgres/PostgresBranch.d.ts.map +1 -1
- package/lib/Planetscale/Postgres/PostgresBranch.js.map +1 -1
- package/lib/Planetscale/Postgres/PostgresClusterSize.d.ts +40 -9
- package/lib/Planetscale/Postgres/PostgresClusterSize.d.ts.map +1 -1
- package/lib/Planetscale/Postgres/PostgresClusterSize.js +9 -5
- package/lib/Planetscale/Postgres/PostgresClusterSize.js.map +1 -1
- package/lib/Planetscale/Postgres/PostgresDatabase.d.ts +15 -1
- package/lib/Planetscale/Postgres/PostgresDatabase.d.ts.map +1 -1
- package/lib/Planetscale/Postgres/PostgresDatabase.js.map +1 -1
- package/lib/Planetscale/Postgres/PostgresDefaultRole.d.ts +8 -0
- package/lib/Planetscale/Postgres/PostgresDefaultRole.d.ts.map +1 -1
- package/lib/Planetscale/Postgres/PostgresDefaultRole.js +17 -5
- package/lib/Planetscale/Postgres/PostgresDefaultRole.js.map +1 -1
- package/lib/Planetscale/Postgres/PostgresRole.d.ts +8 -0
- package/lib/Planetscale/Postgres/PostgresRole.d.ts.map +1 -1
- package/lib/Planetscale/Postgres/PostgresRole.js +2 -0
- package/lib/Planetscale/Postgres/PostgresRole.js.map +1 -1
- package/lib/Platform.d.ts +5 -5
- package/lib/Platform.d.ts.map +1 -1
- package/lib/Platform.js.map +1 -1
- package/lib/Prisma/Compute.d.ts.map +1 -1
- package/lib/Prisma/Compute.js +10 -68
- package/lib/Prisma/Compute.js.map +1 -1
- package/lib/Prisma/PrismaDevDatabase.d.ts.map +1 -1
- package/lib/Prisma/PrismaDevDatabase.js +9 -1
- package/lib/Prisma/PrismaDevDatabase.js.map +1 -1
- package/lib/Provider.d.ts +84 -5
- package/lib/Provider.d.ts.map +1 -1
- package/lib/Provider.js +33 -0
- package/lib/Provider.js.map +1 -1
- package/lib/Railway/AuditLog.d.ts +141 -0
- package/lib/Railway/AuditLog.d.ts.map +1 -0
- package/lib/Railway/AuditLog.js +136 -0
- package/lib/Railway/AuditLog.js.map +1 -0
- package/lib/Railway/AuthProvider.d.ts +45 -0
- package/lib/Railway/AuthProvider.d.ts.map +1 -0
- package/lib/Railway/AuthProvider.js +224 -0
- package/lib/Railway/AuthProvider.js.map +1 -0
- package/lib/Railway/Bind.d.ts +50 -0
- package/lib/Railway/Bind.d.ts.map +1 -0
- package/lib/Railway/Bind.js +125 -0
- package/lib/Railway/Bind.js.map +1 -0
- package/lib/Railway/Bucket.d.ts +225 -0
- package/lib/Railway/Bucket.d.ts.map +1 -0
- package/lib/Railway/Bucket.js +460 -0
- package/lib/Railway/Bucket.js.map +1 -0
- package/lib/Railway/BucketBinding.d.ts +40 -0
- package/lib/Railway/BucketBinding.d.ts.map +1 -0
- package/lib/Railway/BucketBinding.js +111 -0
- package/lib/Railway/BucketBinding.js.map +1 -0
- package/lib/Railway/Catalog.d.ts +37 -0
- package/lib/Railway/Catalog.d.ts.map +1 -0
- package/lib/Railway/Catalog.js +38 -0
- package/lib/Railway/Catalog.js.map +1 -0
- package/lib/Railway/CloudAgent.d.ts +179 -0
- package/lib/Railway/CloudAgent.d.ts.map +1 -0
- package/lib/Railway/CloudAgent.js +283 -0
- package/lib/Railway/CloudAgent.js.map +1 -0
- package/lib/Railway/ConnectMongo.d.ts +73 -0
- package/lib/Railway/ConnectMongo.d.ts.map +1 -0
- package/lib/Railway/ConnectMongo.js +13 -0
- package/lib/Railway/ConnectMongo.js.map +1 -0
- package/lib/Railway/ConnectMongoHttp.d.ts +25 -0
- package/lib/Railway/ConnectMongoHttp.d.ts.map +1 -0
- package/lib/Railway/ConnectMongoHttp.js +114 -0
- package/lib/Railway/ConnectMongoHttp.js.map +1 -0
- package/lib/Railway/ConnectMySQL.d.ts +74 -0
- package/lib/Railway/ConnectMySQL.d.ts.map +1 -0
- package/lib/Railway/ConnectMySQL.js +13 -0
- package/lib/Railway/ConnectMySQL.js.map +1 -0
- package/lib/Railway/ConnectMySQLHttp.d.ts +25 -0
- package/lib/Railway/ConnectMySQLHttp.d.ts.map +1 -0
- package/lib/Railway/ConnectMySQLHttp.js +114 -0
- package/lib/Railway/ConnectMySQLHttp.js.map +1 -0
- package/lib/Railway/ConnectPostgres.d.ts +84 -0
- package/lib/Railway/ConnectPostgres.d.ts.map +1 -0
- package/lib/Railway/ConnectPostgres.js +15 -0
- package/lib/Railway/ConnectPostgres.js.map +1 -0
- package/lib/Railway/ConnectPostgresHttp.d.ts +25 -0
- package/lib/Railway/ConnectPostgresHttp.d.ts.map +1 -0
- package/lib/Railway/ConnectPostgresHttp.js +113 -0
- package/lib/Railway/ConnectPostgresHttp.js.map +1 -0
- package/lib/Railway/Credentials.d.ts +18 -0
- package/lib/Railway/Credentials.d.ts.map +1 -0
- package/lib/Railway/Credentials.js +35 -0
- package/lib/Railway/Credentials.js.map +1 -0
- package/lib/Railway/CustomDomain.d.ts +163 -0
- package/lib/Railway/CustomDomain.d.ts.map +1 -0
- package/lib/Railway/CustomDomain.js +312 -0
- package/lib/Railway/CustomDomain.js.map +1 -0
- package/lib/Railway/DeleteObject.d.ts +29 -0
- package/lib/Railway/DeleteObject.d.ts.map +1 -0
- package/lib/Railway/DeleteObject.js +3 -0
- package/lib/Railway/DeleteObject.js.map +1 -0
- package/lib/Railway/DeleteObjectHttp.d.ts +11 -0
- package/lib/Railway/DeleteObjectHttp.d.ts.map +1 -0
- package/lib/Railway/DeleteObjectHttp.js +16 -0
- package/lib/Railway/DeleteObjectHttp.js.map +1 -0
- package/lib/Railway/Environment.d.ts +64 -0
- package/lib/Railway/Environment.d.ts.map +1 -0
- package/lib/Railway/Environment.js +63 -0
- package/lib/Railway/Environment.js.map +1 -0
- package/lib/Railway/Function.d.ts +434 -0
- package/lib/Railway/Function.d.ts.map +1 -0
- package/lib/Railway/Function.js +850 -0
- package/lib/Railway/Function.js.map +1 -0
- package/lib/Railway/GetObject.d.ts +34 -0
- package/lib/Railway/GetObject.d.ts.map +1 -0
- package/lib/Railway/GetObject.js +3 -0
- package/lib/Railway/GetObject.js.map +1 -0
- package/lib/Railway/GetObjectHttp.d.ts +11 -0
- package/lib/Railway/GetObjectHttp.d.ts.map +1 -0
- package/lib/Railway/GetObjectHttp.js +16 -0
- package/lib/Railway/GetObjectHttp.js.map +1 -0
- package/lib/Railway/Group.d.ts +201 -0
- package/lib/Railway/Group.d.ts.map +1 -0
- package/lib/Railway/Group.js +794 -0
- package/lib/Railway/Group.js.map +1 -0
- package/lib/Railway/HeadObject.d.ts +29 -0
- package/lib/Railway/HeadObject.d.ts.map +1 -0
- package/lib/Railway/HeadObject.js +3 -0
- package/lib/Railway/HeadObject.js.map +1 -0
- package/lib/Railway/HeadObjectHttp.d.ts +11 -0
- package/lib/Railway/HeadObjectHttp.d.ts.map +1 -0
- package/lib/Railway/HeadObjectHttp.js +16 -0
- package/lib/Railway/HeadObjectHttp.js.map +1 -0
- package/lib/Railway/InferEnv.d.ts +31 -0
- package/lib/Railway/InferEnv.d.ts.map +1 -0
- package/lib/Railway/InferEnv.js +1 -0
- package/lib/Railway/InferEnv.js.map +1 -0
- package/lib/Railway/ListObjectsV2.d.ts +29 -0
- package/lib/Railway/ListObjectsV2.d.ts.map +1 -0
- package/lib/Railway/ListObjectsV2.js +3 -0
- package/lib/Railway/ListObjectsV2.js.map +1 -0
- package/lib/Railway/ListObjectsV2Http.d.ts +11 -0
- package/lib/Railway/ListObjectsV2Http.d.ts.map +1 -0
- package/lib/Railway/ListObjectsV2Http.js +16 -0
- package/lib/Railway/ListObjectsV2Http.js.map +1 -0
- package/lib/Railway/LoginSession.d.ts +33 -0
- package/lib/Railway/LoginSession.d.ts.map +1 -0
- package/lib/Railway/LoginSession.js +70 -0
- package/lib/Railway/LoginSession.js.map +1 -0
- package/lib/Railway/Metadata.d.ts +37 -0
- package/lib/Railway/Metadata.d.ts.map +1 -0
- package/lib/Railway/Metadata.js +89 -0
- package/lib/Railway/Metadata.js.map +1 -0
- package/lib/Railway/Mongo.d.ts +278 -0
- package/lib/Railway/Mongo.d.ts.map +1 -0
- package/lib/Railway/Mongo.js +817 -0
- package/lib/Railway/Mongo.js.map +1 -0
- package/lib/Railway/MountVolume.d.ts +108 -0
- package/lib/Railway/MountVolume.d.ts.map +1 -0
- package/lib/Railway/MountVolume.js +63 -0
- package/lib/Railway/MountVolume.js.map +1 -0
- package/lib/Railway/MySQL.d.ts +263 -0
- package/lib/Railway/MySQL.d.ts.map +1 -0
- package/lib/Railway/MySQL.js +817 -0
- package/lib/Railway/MySQL.js.map +1 -0
- package/lib/Railway/Postgres.d.ts +269 -0
- package/lib/Railway/Postgres.d.ts.map +1 -0
- package/lib/Railway/Postgres.js +776 -0
- package/lib/Railway/Postgres.js.map +1 -0
- package/lib/Railway/PrivateNetwork.d.ts +265 -0
- package/lib/Railway/PrivateNetwork.d.ts.map +1 -0
- package/lib/Railway/PrivateNetwork.js +567 -0
- package/lib/Railway/PrivateNetwork.js.map +1 -0
- package/lib/Railway/Project.d.ts +192 -0
- package/lib/Railway/Project.d.ts.map +1 -0
- package/lib/Railway/Project.js +272 -0
- package/lib/Railway/Project.js.map +1 -0
- package/lib/Railway/ProjectEnvironment.d.ts +127 -0
- package/lib/Railway/ProjectEnvironment.d.ts.map +1 -0
- package/lib/Railway/ProjectEnvironment.js +227 -0
- package/lib/Railway/ProjectEnvironment.js.map +1 -0
- package/lib/Railway/Providers.d.ts +38 -0
- package/lib/Railway/Providers.d.ts.map +1 -0
- package/lib/Railway/Providers.js +102 -0
- package/lib/Railway/Providers.js.map +1 -0
- package/lib/Railway/PutObject.d.ts +35 -0
- package/lib/Railway/PutObject.d.ts.map +1 -0
- package/lib/Railway/PutObject.js +3 -0
- package/lib/Railway/PutObject.js.map +1 -0
- package/lib/Railway/PutObjectHttp.d.ts +11 -0
- package/lib/Railway/PutObjectHttp.d.ts.map +1 -0
- package/lib/Railway/PutObjectHttp.js +16 -0
- package/lib/Railway/PutObjectHttp.js.map +1 -0
- package/lib/Railway/ReadRedis.d.ts +25 -0
- package/lib/Railway/ReadRedis.d.ts.map +1 -0
- package/lib/Railway/ReadRedis.js +3 -0
- package/lib/Railway/ReadRedis.js.map +1 -0
- package/lib/Railway/ReadRedisHttp.d.ts +10 -0
- package/lib/Railway/ReadRedisHttp.d.ts.map +1 -0
- package/lib/Railway/ReadRedisHttp.js +14 -0
- package/lib/Railway/ReadRedisHttp.js.map +1 -0
- package/lib/Railway/ReadWriteRedis.d.ts +28 -0
- package/lib/Railway/ReadWriteRedis.d.ts.map +1 -0
- package/lib/Railway/ReadWriteRedis.js +3 -0
- package/lib/Railway/ReadWriteRedis.js.map +1 -0
- package/lib/Railway/ReadWriteRedisHttp.d.ts +10 -0
- package/lib/Railway/ReadWriteRedisHttp.d.ts.map +1 -0
- package/lib/Railway/ReadWriteRedisHttp.js +14 -0
- package/lib/Railway/ReadWriteRedisHttp.js.map +1 -0
- package/lib/Railway/Redis.d.ts +220 -0
- package/lib/Railway/Redis.d.ts.map +1 -0
- package/lib/Railway/Redis.js +512 -0
- package/lib/Railway/Redis.js.map +1 -0
- package/lib/Railway/RedisBinding.d.ts +8 -0
- package/lib/Railway/RedisBinding.d.ts.map +1 -0
- package/lib/Railway/RedisBinding.js +63 -0
- package/lib/Railway/RedisBinding.js.map +1 -0
- package/lib/Railway/RedisHttp.d.ts +8 -0
- package/lib/Railway/RedisHttp.d.ts.map +1 -0
- package/lib/Railway/RedisHttp.js +8 -0
- package/lib/Railway/RedisHttp.js.map +1 -0
- package/lib/Railway/RetryPolicy.d.ts +22 -0
- package/lib/Railway/RetryPolicy.d.ts.map +1 -0
- package/lib/Railway/RetryPolicy.js +43 -0
- package/lib/Railway/RetryPolicy.js.map +1 -0
- package/lib/Railway/Sandbox.d.ts +323 -0
- package/lib/Railway/Sandbox.d.ts.map +1 -0
- package/lib/Railway/Sandbox.js +452 -0
- package/lib/Railway/Sandbox.js.map +1 -0
- package/lib/Railway/Service.d.ts +444 -0
- package/lib/Railway/Service.d.ts.map +1 -0
- package/lib/Railway/Service.js +229 -0
- package/lib/Railway/Service.js.map +1 -0
- package/lib/Railway/ServiceDomain.d.ts +48 -0
- package/lib/Railway/ServiceDomain.d.ts.map +1 -0
- package/lib/Railway/ServiceDomain.js +190 -0
- package/lib/Railway/ServiceDomain.js.map +1 -0
- package/lib/Railway/ServiceProvider.d.ts +42 -0
- package/lib/Railway/ServiceProvider.d.ts.map +1 -0
- package/lib/Railway/ServiceProvider.js +821 -0
- package/lib/Railway/ServiceProvider.js.map +1 -0
- package/lib/Railway/TcpProxy.d.ts +172 -0
- package/lib/Railway/TcpProxy.d.ts.map +1 -0
- package/lib/Railway/TcpProxy.js +267 -0
- package/lib/Railway/TcpProxy.js.map +1 -0
- package/lib/Railway/Template.d.ts +200 -0
- package/lib/Railway/Template.d.ts.map +1 -0
- package/lib/Railway/Template.js +565 -0
- package/lib/Railway/Template.js.map +1 -0
- package/lib/Railway/Up.d.ts +30 -0
- package/lib/Railway/Up.d.ts.map +1 -0
- package/lib/Railway/Up.js +77 -0
- package/lib/Railway/Up.js.map +1 -0
- package/lib/Railway/Usage.d.ts +248 -0
- package/lib/Railway/Usage.d.ts.map +1 -0
- package/lib/Railway/Usage.js +337 -0
- package/lib/Railway/Usage.js.map +1 -0
- package/lib/Railway/Variable.d.ts +252 -0
- package/lib/Railway/Variable.d.ts.map +1 -0
- package/lib/Railway/Variable.js +434 -0
- package/lib/Railway/Variable.js.map +1 -0
- package/lib/Railway/Volume.d.ts +265 -0
- package/lib/Railway/Volume.d.ts.map +1 -0
- package/lib/Railway/Volume.js +526 -0
- package/lib/Railway/Volume.js.map +1 -0
- package/lib/Railway/VolumeBackup.d.ts +247 -0
- package/lib/Railway/VolumeBackup.d.ts.map +1 -0
- package/lib/Railway/VolumeBackup.js +572 -0
- package/lib/Railway/VolumeBackup.js.map +1 -0
- package/lib/Railway/Website/Astro.d.ts +97 -0
- package/lib/Railway/Website/Astro.d.ts.map +1 -0
- package/lib/Railway/Website/Astro.js +66 -0
- package/lib/Railway/Website/Astro.js.map +1 -0
- package/lib/Railway/Website/Cdn.d.ts +65 -0
- package/lib/Railway/Website/Cdn.d.ts.map +1 -0
- package/lib/Railway/Website/Cdn.js +117 -0
- package/lib/Railway/Website/Cdn.js.map +1 -0
- package/lib/Railway/Website/Foldkit.d.ts +53 -0
- package/lib/Railway/Website/Foldkit.d.ts.map +1 -0
- package/lib/Railway/Website/Foldkit.js +45 -0
- package/lib/Railway/Website/Foldkit.js.map +1 -0
- package/lib/Railway/Website/FrameworkSite.d.ts +178 -0
- package/lib/Railway/Website/FrameworkSite.d.ts.map +1 -0
- package/lib/Railway/Website/FrameworkSite.js +142 -0
- package/lib/Railway/Website/FrameworkSite.js.map +1 -0
- package/lib/Railway/Website/Nextjs.d.ts +60 -0
- package/lib/Railway/Website/Nextjs.d.ts.map +1 -0
- package/lib/Railway/Website/Nextjs.js +53 -0
- package/lib/Railway/Website/Nextjs.js.map +1 -0
- package/lib/Railway/Website/Nuxt.d.ts +58 -0
- package/lib/Railway/Website/Nuxt.d.ts.map +1 -0
- package/lib/Railway/Website/Nuxt.js +44 -0
- package/lib/Railway/Website/Nuxt.js.map +1 -0
- package/lib/Railway/Website/Octane.d.ts +63 -0
- package/lib/Railway/Website/Octane.d.ts.map +1 -0
- package/lib/Railway/Website/Octane.js +54 -0
- package/lib/Railway/Website/Octane.js.map +1 -0
- package/lib/Railway/Website/ReactRouter.d.ts +82 -0
- package/lib/Railway/Website/ReactRouter.d.ts.map +1 -0
- package/lib/Railway/Website/ReactRouter.js +73 -0
- package/lib/Railway/Website/ReactRouter.js.map +1 -0
- package/lib/Railway/Website/SolidStart.d.ts +96 -0
- package/lib/Railway/Website/SolidStart.d.ts.map +1 -0
- package/lib/Railway/Website/SolidStart.js +75 -0
- package/lib/Railway/Website/SolidStart.js.map +1 -0
- package/lib/Railway/Website/StaticSite.d.ts +124 -0
- package/lib/Railway/Website/StaticSite.d.ts.map +1 -0
- package/lib/Railway/Website/StaticSite.js +183 -0
- package/lib/Railway/Website/StaticSite.js.map +1 -0
- package/lib/Railway/Website/SvelteKit.d.ts +60 -0
- package/lib/Railway/Website/SvelteKit.d.ts.map +1 -0
- package/lib/Railway/Website/SvelteKit.js +44 -0
- package/lib/Railway/Website/SvelteKit.js.map +1 -0
- package/lib/Railway/Website/TanStackStart.d.ts +78 -0
- package/lib/Railway/Website/TanStackStart.d.ts.map +1 -0
- package/lib/Railway/Website/TanStackStart.js +69 -0
- package/lib/Railway/Website/TanStackStart.js.map +1 -0
- package/lib/Railway/Website/Vite.d.ts +97 -0
- package/lib/Railway/Website/Vite.d.ts.map +1 -0
- package/lib/Railway/Website/Vite.js +93 -0
- package/lib/Railway/Website/Vite.js.map +1 -0
- package/lib/Railway/Website/Vocs.d.ts +61 -0
- package/lib/Railway/Website/Vocs.d.ts.map +1 -0
- package/lib/Railway/Website/Vocs.js +46 -0
- package/lib/Railway/Website/Vocs.js.map +1 -0
- package/lib/Railway/Website/Waku.d.ts +62 -0
- package/lib/Railway/Website/Waku.d.ts.map +1 -0
- package/lib/Railway/Website/Waku.js +46 -0
- package/lib/Railway/Website/Waku.js.map +1 -0
- package/lib/Railway/Website/index.d.ts +16 -0
- package/lib/Railway/Website/index.d.ts.map +1 -0
- package/lib/Railway/Website/index.js +16 -0
- package/lib/Railway/Website/index.js.map +1 -0
- package/lib/Railway/WriteRedis.d.ts +25 -0
- package/lib/Railway/WriteRedis.d.ts.map +1 -0
- package/lib/Railway/WriteRedis.js +3 -0
- package/lib/Railway/WriteRedis.js.map +1 -0
- package/lib/Railway/WriteRedisHttp.d.ts +10 -0
- package/lib/Railway/WriteRedisHttp.d.ts.map +1 -0
- package/lib/Railway/WriteRedisHttp.js +14 -0
- package/lib/Railway/WriteRedisHttp.js.map +1 -0
- package/lib/Railway/hosted.d.ts +159 -0
- package/lib/Railway/hosted.d.ts.map +1 -0
- package/lib/Railway/hosted.js +613 -0
- package/lib/Railway/hosted.js.map +1 -0
- package/lib/Railway/index.d.ts +58 -0
- package/lib/Railway/index.d.ts.map +1 -0
- package/lib/Railway/index.js +57 -0
- package/lib/Railway/index.js.map +1 -0
- package/lib/Railway/ref.d.ts +65 -0
- package/lib/Railway/ref.d.ts.map +1 -0
- package/lib/Railway/ref.js +59 -0
- package/lib/Railway/ref.js.map +1 -0
- package/lib/Railway/rpc-server.d.ts +17 -0
- package/lib/Railway/rpc-server.d.ts.map +1 -0
- package/lib/Railway/rpc-server.js +109 -0
- package/lib/Railway/rpc-server.js.map +1 -0
- package/lib/Railway/rpc-token.d.ts +22 -0
- package/lib/Railway/rpc-token.d.ts.map +1 -0
- package/lib/Railway/rpc-token.js +24 -0
- package/lib/Railway/rpc-token.js.map +1 -0
- package/lib/Railway/transient.d.ts +24 -0
- package/lib/Railway/transient.d.ts.map +1 -0
- package/lib/Railway/transient.js +56 -0
- package/lib/Railway/transient.js.map +1 -0
- package/lib/Redis/Client.d.ts +114 -0
- package/lib/Redis/Client.d.ts.map +1 -0
- package/lib/Redis/Client.js +165 -0
- package/lib/Redis/Client.js.map +1 -0
- package/lib/Redis/Errors.d.ts +37 -0
- package/lib/Redis/Errors.d.ts.map +1 -0
- package/lib/Redis/Errors.js +17 -0
- package/lib/Redis/Errors.js.map +1 -0
- package/lib/Redis/Protocol.d.ts +47 -0
- package/lib/Redis/Protocol.d.ts.map +1 -0
- package/lib/Redis/Protocol.js +276 -0
- package/lib/Redis/Protocol.js.map +1 -0
- package/lib/Redis/Resp.d.ts +65 -0
- package/lib/Redis/Resp.d.ts.map +1 -0
- package/lib/Redis/Resp.js +569 -0
- package/lib/Redis/Resp.js.map +1 -0
- package/lib/Redis/index.d.ts +28 -0
- package/lib/Redis/index.d.ts.map +1 -0
- package/lib/Redis/index.js +28 -0
- package/lib/Redis/index.js.map +1 -0
- package/lib/Runtime/Bootstrap/AppRunner.d.ts +3 -0
- package/lib/Runtime/Bootstrap/AppRunner.d.ts.map +1 -0
- package/lib/Runtime/Bootstrap/AppRunner.js +22 -0
- package/lib/Runtime/Bootstrap/AppRunner.js.map +1 -0
- package/lib/Runtime/Bootstrap/Batch.d.ts +6 -0
- package/lib/Runtime/Bootstrap/Batch.d.ts.map +1 -0
- package/lib/Runtime/Bootstrap/Batch.js +24 -0
- package/lib/Runtime/Bootstrap/Batch.js.map +1 -0
- package/lib/Runtime/Bootstrap/CloudflareContainer.d.ts +17 -0
- package/lib/Runtime/Bootstrap/CloudflareContainer.d.ts.map +1 -0
- package/lib/Runtime/Bootstrap/CloudflareContainer.js +40 -0
- package/lib/Runtime/Bootstrap/CloudflareContainer.js.map +1 -0
- package/lib/Runtime/Bootstrap/CloudflareContainerBun.d.ts +3 -0
- package/lib/Runtime/Bootstrap/CloudflareContainerBun.d.ts.map +1 -0
- package/lib/Runtime/Bootstrap/CloudflareContainerBun.js +6 -0
- package/lib/Runtime/Bootstrap/CloudflareContainerBun.js.map +1 -0
- package/lib/Runtime/Bootstrap/CloudflareContainerNode.d.ts +3 -0
- package/lib/Runtime/Bootstrap/CloudflareContainerNode.d.ts.map +1 -0
- package/lib/Runtime/Bootstrap/CloudflareContainerNode.js +6 -0
- package/lib/Runtime/Bootstrap/CloudflareContainerNode.js.map +1 -0
- package/lib/Runtime/Bootstrap/Docker.d.ts +7 -0
- package/lib/Runtime/Bootstrap/Docker.d.ts.map +1 -0
- package/lib/Runtime/Bootstrap/Docker.js +25 -0
- package/lib/Runtime/Bootstrap/Docker.js.map +1 -0
- package/lib/Runtime/Bootstrap/Ec2.d.ts +3 -0
- package/lib/Runtime/Bootstrap/Ec2.d.ts.map +1 -0
- package/lib/Runtime/Bootstrap/Ec2.js +25 -0
- package/lib/Runtime/Bootstrap/Ec2.js.map +1 -0
- package/lib/Runtime/Bootstrap/Ecs.d.ts +8 -0
- package/lib/Runtime/Bootstrap/Ecs.d.ts.map +1 -0
- package/lib/Runtime/Bootstrap/Ecs.js +39 -0
- package/lib/Runtime/Bootstrap/Ecs.js.map +1 -0
- package/lib/Runtime/Bootstrap/Fly.d.ts +8 -0
- package/lib/Runtime/Bootstrap/Fly.d.ts.map +1 -0
- package/lib/Runtime/Bootstrap/Fly.js +26 -0
- package/lib/Runtime/Bootstrap/Fly.js.map +1 -0
- package/lib/Runtime/Bootstrap/Hetzner.d.ts +8 -0
- package/lib/Runtime/Bootstrap/Hetzner.d.ts.map +1 -0
- package/lib/Runtime/Bootstrap/Hetzner.js +26 -0
- package/lib/Runtime/Bootstrap/Hetzner.js.map +1 -0
- package/lib/Runtime/Bootstrap/Lambda.d.ts +14 -0
- package/lib/Runtime/Bootstrap/Lambda.d.ts.map +1 -0
- package/lib/Runtime/Bootstrap/Lambda.js +63 -0
- package/lib/Runtime/Bootstrap/Lambda.js.map +1 -0
- package/lib/Runtime/Bootstrap/Microvm.d.ts +19 -0
- package/lib/Runtime/Bootstrap/Microvm.d.ts.map +1 -0
- package/lib/Runtime/Bootstrap/Microvm.js +24 -0
- package/lib/Runtime/Bootstrap/Microvm.js.map +1 -0
- package/lib/Runtime/Bootstrap/MicrovmBun.d.ts +3 -0
- package/lib/Runtime/Bootstrap/MicrovmBun.d.ts.map +1 -0
- package/lib/Runtime/Bootstrap/MicrovmBun.js +6 -0
- package/lib/Runtime/Bootstrap/MicrovmBun.js.map +1 -0
- package/lib/Runtime/Bootstrap/MicrovmNode.d.ts +3 -0
- package/lib/Runtime/Bootstrap/MicrovmNode.d.ts.map +1 -0
- package/lib/Runtime/Bootstrap/MicrovmNode.js +6 -0
- package/lib/Runtime/Bootstrap/MicrovmNode.js.map +1 -0
- package/lib/Runtime/Bootstrap/Prisma.d.ts +12 -0
- package/lib/Runtime/Bootstrap/Prisma.d.ts.map +1 -0
- package/lib/Runtime/Bootstrap/Prisma.js +24 -0
- package/lib/Runtime/Bootstrap/Prisma.js.map +1 -0
- package/lib/Runtime/Bootstrap/Process.d.ts +62 -0
- package/lib/Runtime/Bootstrap/Process.d.ts.map +1 -0
- package/lib/Runtime/Bootstrap/Process.js +99 -0
- package/lib/Runtime/Bootstrap/Process.js.map +1 -0
- package/lib/Runtime/Bootstrap/Railway.d.ts +8 -0
- package/lib/Runtime/Bootstrap/Railway.d.ts.map +1 -0
- package/lib/Runtime/Bootstrap/Railway.js +29 -0
- package/lib/Runtime/Bootstrap/Railway.js.map +1 -0
- package/lib/Telemetry/Metrics.d.ts.map +1 -1
- package/lib/Telemetry/Metrics.js +7 -1
- package/lib/Telemetry/Metrics.js.map +1 -1
- package/lib/Test/Alchemy.d.ts.map +1 -1
- package/lib/Test/Alchemy.js +3 -0
- package/lib/Test/Alchemy.js.map +1 -1
- package/lib/Test/Bun.d.ts.map +1 -1
- package/lib/Test/Bun.js +13 -2
- package/lib/Test/Bun.js.map +1 -1
- package/lib/Test/Core.d.ts +3 -3
- package/lib/Test/Core.d.ts.map +1 -1
- package/lib/Test/Core.js +18 -15
- package/lib/Test/Core.js.map +1 -1
- package/lib/Util/ConfigProvider.js +1 -1
- package/lib/Util/ConfigProvider.js.map +1 -1
- package/lib/Util/extraFiles.d.ts +77 -0
- package/lib/Util/extraFiles.d.ts.map +1 -0
- package/lib/Util/extraFiles.js +174 -0
- package/lib/Util/extraFiles.js.map +1 -0
- package/lib/Util/index.d.ts +1 -0
- package/lib/Util/index.d.ts.map +1 -1
- package/lib/Util/index.js +1 -0
- package/lib/Util/index.js.map +1 -1
- package/lib/Util/tarGzip.d.ts +13 -0
- package/lib/Util/tarGzip.d.ts.map +1 -0
- package/lib/Util/tarGzip.js +138 -0
- package/lib/Util/tarGzip.js.map +1 -0
- package/lib/Util/types.d.ts +10 -0
- package/lib/Util/types.d.ts.map +1 -1
- package/lib/{AWS/Website → Website}/Server.d.ts +15 -10
- package/lib/Website/Server.d.ts.map +1 -0
- package/lib/{AWS/Website → Website}/Server.js +31 -14
- package/lib/Website/Server.js.map +1 -0
- package/lib/Website/ServerLocal.d.ts +2 -0
- package/lib/Website/ServerLocal.d.ts.map +1 -0
- package/lib/Website/ServerLocal.js +4 -0
- package/lib/Website/ServerLocal.js.map +1 -0
- package/lib/Website/assets.d.ts +56 -0
- package/lib/Website/assets.d.ts.map +1 -0
- package/lib/Website/assets.js +95 -0
- package/lib/Website/assets.js.map +1 -0
- package/lib/Website/packExtraFiles.d.ts +13 -0
- package/lib/Website/packExtraFiles.d.ts.map +1 -0
- package/lib/Website/packExtraFiles.js +49 -0
- package/lib/Website/packExtraFiles.js.map +1 -0
- package/package.json +75 -39
- package/src/AWS/ACM/Certificate.ts +32 -14
- package/src/AWS/AppRunner/Service.ts +131 -64
- package/src/AWS/ApplicationAutoScaling/ScalingPolicy.ts +42 -17
- package/src/AWS/AuthProvider.ts +8 -2
- package/src/AWS/Batch/JobDefinition.ts +15 -69
- package/src/AWS/CloudFront/KvEntries.ts +20 -11
- package/src/AWS/CloudFront/KvRoutesUpdate.ts +3 -8
- package/src/AWS/CloudFront/common.ts +9 -1
- package/src/AWS/Cognito/ManagedLoginBranding.ts +339 -0
- package/src/AWS/Cognito/UserPool.ts +413 -39
- package/src/AWS/Cognito/index.ts +1 -0
- package/src/AWS/EC2/Instance.ts +38 -14
- package/src/AWS/EC2/NetworkAcl.ts +17 -12
- package/src/AWS/EC2/hosted.ts +6 -75
- package/src/AWS/ECR/Image.ts +25 -56
- package/src/AWS/ECR/ImageSource.ts +10 -97
- package/src/AWS/ECS/EcsDevWatch.ts +1 -89
- package/src/AWS/ECS/FlociServiceProvider.ts +45 -26
- package/src/AWS/ECS/FlociTaskProvider.ts +33 -16
- package/src/AWS/ECS/Service.ts +2 -30
- package/src/AWS/Endpoint.ts +12 -0
- package/src/AWS/IAM/SAMLProvider.ts +48 -26
- package/src/AWS/Lambda/DurableFunction.ts +25 -4
- package/src/AWS/Lambda/FlociFunctionProvider.ts +82 -30
- package/src/AWS/Lambda/FlociMicrovmImageProvider.ts +255 -0
- package/src/AWS/Lambda/Function.ts +624 -136
- package/src/AWS/Lambda/FunctionBundle.ts +14 -127
- package/src/AWS/Lambda/FunctionImage.ts +705 -0
- package/src/AWS/Lambda/MicrovmBundle.ts +12 -66
- package/src/AWS/Lambda/MicrovmImage.ts +6 -2
- package/src/AWS/Lambda/MicrovmProvider.ts +189 -63
- package/src/AWS/Lambda/index.ts +1 -0
- package/src/AWS/Local/DevWatchProvider.ts +104 -4
- package/src/AWS/Local/FlociServices.ts +4 -0
- package/src/AWS/Local/ImageSourceTrigger.ts +102 -0
- package/src/AWS/Local/Local.ts +2 -0
- package/src/AWS/Local/ProviderContext.ts +93 -0
- package/src/AWS/Providers.ts +777 -719
- package/src/AWS/Route53/HostedZoneLookup.ts +63 -0
- package/src/AWS/Route53/Record.ts +28 -8
- package/src/AWS/Route53/Records.ts +48 -9
- package/src/AWS/Website/AssetDeployment.ts +116 -109
- package/src/AWS/Website/Astro.ts +51 -27
- package/src/AWS/Website/Foldkit.ts +126 -0
- package/src/AWS/Website/FrameworkSite.ts +38 -40
- package/src/AWS/Website/Nextjs.ts +39 -39
- package/src/AWS/Website/Nuxt.ts +38 -9
- package/src/AWS/Website/Octane.ts +5 -6
- package/src/AWS/Website/ReactRouter.ts +98 -0
- package/src/AWS/Website/Router.ts +7 -3
- package/src/AWS/Website/ServerLocal.ts +1 -1
- package/src/AWS/Website/SolidStart.ts +102 -0
- package/src/AWS/Website/SsrSite.ts +4 -2
- package/src/AWS/Website/StaticSite.ts +16 -14
- package/src/AWS/Website/SvelteKit.ts +34 -13
- package/src/AWS/Website/TanStackStart.ts +92 -0
- package/src/AWS/Website/Vite.ts +83 -22
- package/src/AWS/Website/Waku.ts +48 -12
- package/src/AWS/Website/index.ts +4 -1
- package/src/AWS/Website/shared.ts +11 -2
- package/src/Auth/AuthProvider.ts +7 -1
- package/src/Auth/Lock.ts +80 -2
- package/src/Axiom/Dataset.ts +59 -31
- package/src/Binding.ts +155 -2
- package/src/Bundle/Bundle.ts +62 -3
- package/src/Cli/commands/deploy.ts +21 -1
- package/src/Cli/commands/dev.ts +13 -6
- package/src/Cloudflare/AI/SecuritySettings.ts +1 -0
- package/src/Cloudflare/Containers/ContainerApplication.ts +4 -2
- package/src/Cloudflare/Containers/ContainerBundle.ts +11 -99
- package/src/Cloudflare/Containers/ContainerPlatform.ts +38 -2
- package/src/Cloudflare/Containers/ContainerProvider.ts +333 -37
- package/src/Cloudflare/Containers/LocalContainerProvider.ts +58 -7
- package/src/Cloudflare/Email/AllowPolicy.ts +9 -3
- package/src/Cloudflare/Email/CatchAll.ts +32 -24
- package/src/Cloudflare/Email/ImpersonationRegistryEntry.ts +9 -1
- package/src/Cloudflare/Email/Rule.ts +6 -2
- package/src/Cloudflare/Email/TrustedDomain.ts +9 -1
- package/src/Cloudflare/Email/retry.ts +29 -0
- package/src/Cloudflare/R2/Bucket.ts +169 -39
- package/src/Cloudflare/R2/DataCatalog.ts +22 -20
- package/src/Cloudflare/Website/Astro.ts +52 -41
- package/src/Cloudflare/Website/Foldkit.ts +5 -5
- package/src/Cloudflare/Website/Nextjs.ts +38 -68
- package/src/Cloudflare/Website/Nuxt.ts +37 -14
- package/src/Cloudflare/Website/SvelteKit.ts +43 -58
- package/src/Cloudflare/Website/Vite.ts +2 -3
- package/src/Cloudflare/Website/Vocs.ts +195 -0
- package/src/Cloudflare/Website/Waku.ts +47 -27
- package/src/Cloudflare/Website/index.ts +1 -0
- package/src/Cloudflare/Workers/Assets.ts +14 -6
- package/src/Cloudflare/Workers/EmailEventSource.ts +348 -0
- package/src/Cloudflare/Workers/LocalWorkerProvider.ts +183 -1
- package/src/Cloudflare/Workers/Worker.ts +11 -1
- package/src/Cloudflare/Workers/WorkerAsyncBindings.ts +14 -3
- package/src/Cloudflare/Workers/WorkerProvider.ts +1 -0
- package/src/Cloudflare/Workers/index.ts +1 -0
- package/src/Cloudflare/Zone/lookup.ts +20 -37
- package/src/Command/Build.ts +11 -5
- package/src/Command/Command.ts +17 -5
- package/src/Command/Dev.ts +9 -1
- package/src/Docker/BuildHash.ts +308 -0
- package/src/Docker/Container.ts +130 -21
- package/src/Docker/Docker.ts +3 -0
- package/src/Docker/ServiceImage.ts +6 -74
- package/src/Fly/Bucket.ts +28 -26
- package/src/Fly/BucketBinding.ts +11 -8
- package/src/Fly/ConnectPostgres.ts +0 -2
- package/src/Fly/Decrypt.ts +1 -6
- package/src/Fly/DecryptHttp.ts +4 -23
- package/src/Fly/Encrypt.ts +1 -6
- package/src/Fly/EncryptHttp.ts +0 -20
- package/src/Fly/Environment.ts +6 -2
- package/src/Fly/Errors.ts +0 -19
- package/src/Fly/Postgres.ts +15 -16
- package/src/Fly/PostgresMigrations.ts +44 -1
- package/src/Fly/Providers.ts +14 -0
- package/src/Fly/ReadRedis.ts +3 -16
- package/src/Fly/Redis.ts +4 -10
- package/src/Fly/RedisBinding.ts +6 -145
- package/src/Fly/RedisHttp.ts +8 -48
- package/src/Fly/SecretHttp.ts +36 -32
- package/src/Fly/SecretKeyHttp.ts +1 -39
- package/src/Fly/Service.ts +120 -27
- package/src/Fly/Sign.ts +1 -6
- package/src/Fly/SignHttp.ts +0 -14
- package/src/Fly/Sprite.ts +25 -15
- package/src/Fly/SpriteHttp.ts +4 -2
- package/src/Fly/Verify.ts +1 -6
- package/src/Fly/VerifyHttp.ts +2 -14
- package/src/Fly/Website/AssetDeployment.ts +294 -0
- package/src/Fly/Website/Astro.ts +94 -0
- package/src/Fly/Website/Foldkit.ts +42 -0
- package/src/Fly/Website/FrameworkSite.ts +370 -0
- package/src/Fly/Website/Nextjs.ts +51 -0
- package/src/Fly/Website/Nuxt.ts +49 -0
- package/src/Fly/Website/Octane.ts +54 -0
- package/src/Fly/Website/ReactRouter.ts +77 -0
- package/src/Fly/Website/SolidStart.ts +92 -0
- package/src/Fly/Website/StaticSite.ts +278 -0
- package/src/Fly/Website/SvelteKit.ts +51 -0
- package/src/Fly/Website/TanStackStart.ts +73 -0
- package/src/Fly/Website/Vite.ts +118 -0
- package/src/Fly/Website/Vocs.ts +52 -0
- package/src/Fly/Website/Waku.ts +66 -0
- package/src/Fly/Website/index.ts +15 -0
- package/src/Fly/WriteRedis.ts +3 -11
- package/src/Fly/hosted.ts +151 -82
- package/src/Fly/index.ts +1 -0
- package/src/Hetzner/MountVolume.ts +1 -1
- package/src/Hetzner/Providers.ts +8 -0
- package/src/Hetzner/Server.ts +39 -15
- package/src/Hetzner/Service.ts +20 -4
- package/src/Hetzner/Website/Astro.ts +97 -0
- package/src/Hetzner/Website/Foldkit.ts +44 -0
- package/src/Hetzner/Website/FrameworkSite.ts +370 -0
- package/src/Hetzner/Website/Nextjs.ts +54 -0
- package/src/Hetzner/Website/Nuxt.ts +56 -0
- package/src/Hetzner/Website/Octane.ts +56 -0
- package/src/Hetzner/Website/ReactRouter.ts +80 -0
- package/src/Hetzner/Website/SolidStart.ts +94 -0
- package/src/Hetzner/Website/StaticSite.ts +271 -0
- package/src/Hetzner/Website/SvelteKit.ts +56 -0
- package/src/Hetzner/Website/TanStackStart.ts +75 -0
- package/src/Hetzner/Website/Vite.ts +117 -0
- package/src/Hetzner/Website/Vocs.ts +54 -0
- package/src/Hetzner/Website/Waku.ts +60 -0
- package/src/Hetzner/Website/index.ts +14 -0
- package/src/Hetzner/actions.ts +6 -13
- package/src/Hetzner/hosted.ts +314 -95
- package/src/Hetzner/index.ts +1 -0
- package/src/Http.ts +14 -2
- package/src/Kubernetes/HelmChart.ts +5 -3
- package/src/Kubernetes/internal/helm.ts +29 -6
- package/src/Local/DockerHostGateway.ts +18 -0
- package/src/Local/ProviderLayer.ts +22 -0
- package/src/Local/RpcProvider.ts +1 -1
- package/src/Local/RpcProviderProxy.ts +25 -1
- package/src/Planetscale/Postgres/PostgresBranch.ts +2 -1
- package/src/Planetscale/Postgres/PostgresClusterSize.ts +134 -9
- package/src/Planetscale/Postgres/PostgresDatabase.ts +15 -1
- package/src/Planetscale/Postgres/PostgresDefaultRole.ts +27 -5
- package/src/Planetscale/Postgres/PostgresRole.ts +12 -0
- package/src/Platform.ts +9 -8
- package/src/Prisma/Compute.ts +10 -68
- package/src/Prisma/PrismaDevDatabase.ts +9 -1
- package/src/Provider.ts +103 -6
- package/src/Railway/AuditLog.ts +240 -0
- package/src/Railway/AuthProvider.ts +412 -0
- package/src/Railway/Bind.ts +175 -0
- package/src/Railway/Bucket.ts +786 -0
- package/src/Railway/BucketBinding.ts +174 -0
- package/src/Railway/Catalog.ts +68 -0
- package/src/Railway/CloudAgent.ts +467 -0
- package/src/Railway/ConnectMongo.ts +91 -0
- package/src/Railway/ConnectMongoHttp.ts +156 -0
- package/src/Railway/ConnectMySQL.ts +92 -0
- package/src/Railway/ConnectMySQLHttp.ts +156 -0
- package/src/Railway/ConnectPostgres.ts +103 -0
- package/src/Railway/ConnectPostgresHttp.ts +154 -0
- package/src/Railway/Credentials.ts +68 -0
- package/src/Railway/CustomDomain.ts +527 -0
- package/src/Railway/DeleteObject.ts +48 -0
- package/src/Railway/DeleteObjectHttp.ts +19 -0
- package/src/Railway/Environment.ts +121 -0
- package/src/Railway/Function.ts +1342 -0
- package/src/Railway/GetObject.ts +48 -0
- package/src/Railway/GetObjectHttp.ts +19 -0
- package/src/Railway/Group.ts +1202 -0
- package/src/Railway/HeadObject.ts +46 -0
- package/src/Railway/HeadObjectHttp.ts +19 -0
- package/src/Railway/InferEnv.ts +32 -0
- package/src/Railway/ListObjectsV2.ts +48 -0
- package/src/Railway/ListObjectsV2Http.ts +19 -0
- package/src/Railway/LoginSession.ts +105 -0
- package/src/Railway/Metadata.ts +105 -0
- package/src/Railway/Mongo.ts +1335 -0
- package/src/Railway/MountVolume.ts +169 -0
- package/src/Railway/MySQL.ts +1336 -0
- package/src/Railway/Postgres.ts +1287 -0
- package/src/Railway/PrivateNetwork.ts +989 -0
- package/src/Railway/Project.ts +436 -0
- package/src/Railway/ProjectEnvironment.ts +374 -0
- package/src/Railway/Providers.ts +173 -0
- package/src/Railway/PutObject.ts +49 -0
- package/src/Railway/PutObjectHttp.ts +19 -0
- package/src/Railway/ReadRedis.ts +30 -0
- package/src/Railway/ReadRedisHttp.ts +17 -0
- package/src/Railway/ReadWriteRedis.ts +35 -0
- package/src/Railway/ReadWriteRedisHttp.ts +17 -0
- package/src/Railway/Redis.ts +812 -0
- package/src/Railway/RedisBinding.ts +84 -0
- package/src/Railway/RedisHttp.ts +11 -0
- package/src/Railway/RetryPolicy.ts +53 -0
- package/src/Railway/Sandbox.ts +772 -0
- package/src/Railway/Service.ts +518 -0
- package/src/Railway/ServiceDomain.ts +313 -0
- package/src/Railway/ServiceProvider.ts +1226 -0
- package/src/Railway/TODO.md +95 -0
- package/src/Railway/TcpProxy.ts +442 -0
- package/src/Railway/Template.ts +892 -0
- package/src/Railway/Up.ts +108 -0
- package/src/Railway/Usage.ts +569 -0
- package/src/Railway/Variable.ts +665 -0
- package/src/Railway/Volume.ts +874 -0
- package/src/Railway/VolumeBackup.ts +925 -0
- package/src/Railway/Website/Astro.ts +105 -0
- package/src/Railway/Website/Cdn.ts +198 -0
- package/src/Railway/Website/Foldkit.ts +48 -0
- package/src/Railway/Website/FrameworkSite.ts +344 -0
- package/src/Railway/Website/Nextjs.ts +60 -0
- package/src/Railway/Website/Nuxt.ts +57 -0
- package/src/Railway/Website/Octane.ts +61 -0
- package/src/Railway/Website/ReactRouter.ts +80 -0
- package/src/Railway/Website/SolidStart.ts +96 -0
- package/src/Railway/Website/StaticSite.ts +264 -0
- package/src/Railway/Website/SvelteKit.ts +60 -0
- package/src/Railway/Website/TanStackStart.ts +76 -0
- package/src/Railway/Website/Vite.ts +113 -0
- package/src/Railway/Website/Vocs.ts +61 -0
- package/src/Railway/Website/Waku.ts +64 -0
- package/src/Railway/Website/index.ts +15 -0
- package/src/Railway/WriteRedis.ts +30 -0
- package/src/Railway/WriteRedisHttp.ts +17 -0
- package/src/Railway/hosted.ts +895 -0
- package/src/Railway/index.ts +69 -0
- package/src/Railway/ref.ts +81 -0
- package/src/Railway/rpc-server.ts +135 -0
- package/src/Railway/rpc-token.ts +35 -0
- package/src/Railway/transient.ts +89 -0
- package/src/Redis/Client.ts +360 -0
- package/src/Redis/Errors.ts +27 -0
- package/src/Redis/Protocol.ts +451 -0
- package/src/Redis/Resp.ts +650 -0
- package/src/Redis/index.ts +27 -0
- package/src/Runtime/Bootstrap/AppRunner.ts +50 -0
- package/src/Runtime/Bootstrap/Batch.ts +51 -0
- package/src/Runtime/Bootstrap/CloudflareContainer.ts +90 -0
- package/src/Runtime/Bootstrap/CloudflareContainerBun.ts +17 -0
- package/src/Runtime/Bootstrap/CloudflareContainerNode.ts +17 -0
- package/src/Runtime/Bootstrap/Docker.ts +51 -0
- package/src/Runtime/Bootstrap/Ec2.ts +52 -0
- package/src/Runtime/Bootstrap/Ecs.ts +66 -0
- package/src/Runtime/Bootstrap/Fly.ts +52 -0
- package/src/Runtime/Bootstrap/Hetzner.ts +52 -0
- package/src/Runtime/Bootstrap/Lambda.ts +100 -0
- package/src/Runtime/Bootstrap/Microvm.ts +68 -0
- package/src/Runtime/Bootstrap/MicrovmBun.ts +14 -0
- package/src/Runtime/Bootstrap/MicrovmNode.ts +14 -0
- package/src/Runtime/Bootstrap/Prisma.ts +71 -0
- package/src/Runtime/Bootstrap/Process.ts +131 -0
- package/src/Runtime/Bootstrap/Railway.ts +55 -0
- package/src/Telemetry/Metrics.ts +7 -1
- package/src/Test/Alchemy.ts +3 -0
- package/src/Test/Bun.ts +15 -2
- package/src/Test/Core.ts +27 -20
- package/src/Util/ConfigProvider.ts +1 -1
- package/src/Util/extraFiles.ts +246 -0
- package/src/Util/index.ts +1 -0
- package/src/Util/tarGzip.ts +180 -0
- package/src/Util/types.ts +13 -0
- package/src/{AWS/Website → Website}/Server.ts +50 -16
- package/src/Website/ServerLocal.ts +4 -0
- package/src/Website/assets.ts +116 -0
- package/src/Website/packExtraFiles.ts +62 -0
- package/lib/AWS/Website/Server.d.ts.map +0 -1
- package/lib/AWS/Website/Server.js.map +0 -1
package/bin/exec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.js","names":["Path","Path","Context","Context","Context","Context","Context","Context","Context","Context","Context","Context","Context","of","State.State","Context","Output.stackRef","make","Output.isOutput","Context","Output.NamedExpr","Output.EffectExpr","Output.VoidExpr","Context","make","Context","make","ChildProcessSpawner","ChildProcess","Output.isExpr","Output.hasOutputs","Context","Output.ResourceExpr","Output.isExpr","Output.of","Output.isResourceExpr","Output.isPropExpr","Output.isApplyExpr","Output.hasOutputs","Output.isEffectExpr","Output.isFlatMapExpr","Output.asOutput","Output.isAllExpr","Output.isLiteralExpr","Output.isRefExpr","Output.InvalidReferenceError","Output.isStackRefExpr","Output.isNamedExpr","Output.upstreamAny","Output.evaluate","Output.resolveUpstream","Output.upstreamAny","Clank.PromptCancelled","Context","of","fromEnvironment","options","Region.of","Endpoint.of","Clank.text","Clank.password","Clank.success","Clank.select","Clank.info","Clank.warn","Path","STORAGE_KEY","options","Clank.text","Clank.select","Clank.password","Clank.success","generateState","crypto","extractCredentials","authorize","OAUTH_ENDPOINTS","OAUTH_CLIENT_ID","OAUTH_REDIRECT_URI","callbackPromise","OAUTH_LOCAL_CALLBACK_URI","OAuthError","exchange","tokenRequest","refresh","exchangeCallbackInput","callback","options","withOAuthCredentials","Clank.info","Clank.select","Clank.text","Clank.confirm","Clank.multiselect","OAuthClient.authorize","Clank.openUrl","Clank.warn","OAuthClient.callback","OAuthClient.exchangeCallbackInput","Clank.success","Clank.password","STATE_STORE_CREDENTIALS_FILE","OAuthClient.refresh","OAuthClient.revoke","OAUTH_CLIENT_ID","OAUTH_REDIRECT_URI","OAUTH_LOCAL_CALLBACK_URI","OAUTH_ENDPOINTS","options","ChildProcess","Clank.password","Clank.success","Clank.text","Clank.select","options","DEFAULT_API_BASE_URL","Clank.password","Clank.text","Clank.success","Clank.select","options","Clank.password","Clank.success","Clank.select","crypto","Clank.info","Clank.select","options","OAuthClient.authorize","Clank.openUrl","Clank.warn","OAuthClient.callback","Clank.text","OAuthClient.exchangeCallbackInput","Clank.success","Clank.password","OAuthClient.refresh","Clank.password","Clank.success","Clank.select","S","Path","Stack.Stack","CLI.Cli","destroy","Plan.destroy","Plan.make","dryRunFlag","actionColor","statusColor","_jsx","_jsxs","_jsxs","_jsx","_jsx","_jsxs","_jsx","PlanComponent","RpcProviderProxy.fromEnv"],"sources":["../lib/AlchemyContext.js","../lib/Util/interactive.js","../lib/Auth/Lock.js","../lib/Auth/AuthProvider.js","../lib/Auth/Profile.js","../lib/Auth/Credentials.js","../lib/Artifacts.js","../lib/Cli/Cli.js","../lib/Ref.js","../lib/AdoptPolicy.js","../lib/FQN.js","../lib/Provider.js","../lib/ProviderMode.js","../lib/Resource.js","../lib/RuntimeContext.js","../lib/Stage.js","../lib/State/State.js","../lib/Util/data.js","../lib/Output.js","../lib/Util/ConfigProvider.js","../lib/Util/effect.js","../lib/Util/FileLogger.js","../lib/Util/Node.js","../lib/Util/PlatformServices.js","../lib/Stack.js","../lib/State/StateEncoding.js","../lib/Local/RpcSerialization.js","../lib/Local/RpcServerEnvironment.js","../lib/Local/RpcProviderProxy.js","../lib/Local/RpcSpawner.js","../lib/ActionRuntimeContext.js","../lib/Auth/Demand.js","../lib/Diff.js","../lib/InstanceId.js","../lib/Util/types.js","../lib/Action.js","../lib/Telemetry/Metrics.js","../lib/Util/scc.js","../lib/Util/sha256.js","../lib/Plan.js","../lib/Apply.js","../lib/Util/Clank.js","../lib/Auth/Env.js","../lib/AWS/Environment.js","../lib/AWS/Endpoint.js","../lib/AWS/Region.js","../lib/AWS/AuthProvider.js","../lib/Axiom/AuthProvider.js","../lib/Cloudflare/StateStore/CredentialsFile.js","../lib/Cloudflare/Auth/OAuthClient.js","../lib/Cloudflare/Auth/AuthProvider.js","../lib/GitHub/BaseUrl.js","../lib/GitHub/AuthProvider.js","../lib/Hetzner/AuthProvider.js","../lib/Neon/AuthProvider.js","../lib/Planetscale/OAuthClient.js","../lib/Planetscale/AuthProvider.js","../lib/Prisma/AuthProvider.js","../lib/Cli/commands/_shared.js","../lib/Cli/commands/deploy.js","../lib/Cli/ModeTag.js","../lib/Cli/LoggingCli.js","../lib/Cli/NamespaceTree.js","../lib/Cli/tui/components/Plan.js","../lib/Cli/tui/components/ApprovePlan.js","../lib/Cli/tui/components/PlanProgress.js","../lib/Cli/tui/InkCLI.js","../lib/Cli/selectCli.js","../lib/Cli/exec.js","exec.ts"],"sourcesContent":["import * as EffectContext from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport * as Path from \"effect/Path\";\nexport class AlchemyContext extends EffectContext.Service()(\"alchemy/Context\") {\n}\nexport const AlchemyContextLive = Layer.effect(AlchemyContext, Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const dir = path.join(process.cwd(), \".alchemy\");\n yield* fs.makeDirectory(dir, { recursive: true });\n return {\n dotAlchemy: dir,\n updateStateStore: false,\n dev: false,\n adopt: false,\n };\n}));\n//# sourceMappingURL=AlchemyContext.js.map","/**\n * Returns true when the current process looks like it's being driven by a\n * coding agent, CI runner, test runner, or anything else that won't render an\n * interactive TUI / prompt well.\n *\n * Two callers rely on this:\n * - `Cli/selectCli.ts` uses it to pick `LoggingCli` over the Ink TUI.\n * - `Auth/Profile.ts` uses it to refuse to launch an interactive credential\n * configure flow (and thus avoid acquiring an auth lockfile) when there's\n * no TTY to drive the prompts.\n *\n * Kept in `Util` (rather than `Cli`) so `Auth` can depend on it without\n * pulling in the CLI layer.\n */\nexport const isNonInteractive = () => {\n const env = process.env;\n if (env.ALCHEMY_PLAIN === \"1\" || env.ALCHEMY_NO_TUI === \"1\")\n return true;\n if (env.ALCHEMY_TUI === \"1\")\n return false;\n if (!process.stdout.isTTY)\n return true;\n if (env.CI)\n return true;\n // Known coding-agent env vars. These are best-effort — the isTTY check\n // above already catches most cases since agents typically pipe stdout.\n if (env.CLAUDECODE ||\n env.CLAUDE_CODE_ENTRYPOINT ||\n env.CURSOR_AGENT ||\n env.AIDER_MODEL ||\n env.CODEX_CLI)\n return true;\n return false;\n};\n//# sourceMappingURL=interactive.js.map","import * as Clock from \"effect/Clock\";\nimport * as Data from \"effect/Data\";\nimport * as Duration from \"effect/Duration\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Option from \"effect/Option\";\nimport * as Path from \"effect/Path\";\nimport * as Schedule from \"effect/Schedule\";\nimport * as Semaphore from \"effect/Semaphore\";\nimport { rootDir } from \"./Profile.js\";\nconst semaphores = new Map();\n// Keep STALE well above REFRESH — a saturated machine can starve the\n// heartbeat fiber for seconds.\nconst STALE = Duration.seconds(30);\nconst REFRESH = Duration.seconds(10);\nconst RETRY_INTERVAL = Duration.millis(50);\nconst DEFAULT_TIMEOUT = Duration.minutes(2);\nclass LockHeld extends Data.TaggedError(\"LockHeld\") {\n}\nclass LockTimeout extends Data.TaggedError(\"LockTimeout\") {\n}\n/**\n * Make a lock key safe to use as a file name on every platform.\n *\n * Keys are derived from user-controlled values (profile names), which\n * have shown up in production containing shell placeholders like\n * `${ALCHEMY_PROFILE:-default}` — `:`/`{`/`$` are invalid in Windows\n * file names and mkdir fails with EINVAL. Collapse anything outside a\n * conservative allow-list to `_`.\n *\n * @internal exported for unit testing.\n */\nexport const sanitizeLockKey = (key) => key.replace(/[^A-Za-z0-9._-]/g, \"_\");\n/**\n * Take the cross-process lock. On success the ambient scope owns it: a\n * finalizer removes it and a forked heartbeat keeps its mtime fresh.\n */\nconst acquireFileLock = Effect.fn(function* (lockPath, timeout) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const ownerPath = path.join(lockPath, \"owner\");\n const owner = yield* Effect.sync(() => crypto.randomUUID());\n yield* fs.makeDirectory(path.dirname(lockPath), { recursive: true });\n // Reap a lock whose crashed holder stopped refreshing its mtime.\n const reapStale = Effect.gen(function* () {\n const info = yield* fs.stat(lockPath);\n const now = yield* Clock.currentTimeMillis;\n const isStale = Option.exists(info.mtime, (mtime) => mtime.getTime() < now - Duration.toMillis(STALE));\n if (isStale) {\n yield* fs.remove(lockPath, { recursive: true, force: true });\n }\n }).pipe(Effect.catchReason(\"PlatformError\", \"NotFound\", () => Effect.void));\n // A non-recursive mkdir is the atomic test-and-set; the owner marker lets\n // release and refresh verify the lock wasn't reaped and re-taken.\n yield* fs.makeDirectory(lockPath).pipe(Effect.andThen(fs\n .writeFileString(ownerPath, owner)\n .pipe(Effect.onError(() => fs\n .remove(lockPath, { recursive: true, force: true })\n .pipe(Effect.ignore)))), Effect.catchReason(\"PlatformError\", \"AlreadyExists\", () => reapStale.pipe(Effect.andThen(Effect.fail(new LockHeld())))), Effect.retry({\n while: (error) => error._tag === \"LockHeld\",\n schedule: Schedule.spaced(RETRY_INTERVAL).pipe(Schedule.upTo({ duration: timeout })),\n }), Effect.catchTag(\"LockHeld\", () => Effect.die(new LockTimeout({\n lockPath,\n timeout,\n message: `Timed out waiting for the alchemy auth lock '${lockPath}' — another alchemy ` +\n `process has held it for over ${Duration.toSeconds(timeout)}s. If no other ` +\n `alchemy process is running, delete the lock directory and retry.`,\n }))));\n yield* Effect.addFinalizer(() => fs.readFileString(ownerPath).pipe(Effect.filterOrFail((current) => current === owner), Effect.andThen(fs.remove(lockPath, { recursive: true, force: true })), Effect.ignore));\n yield* fs.readFileString(ownerPath).pipe(Effect.filterOrFail((current) => current === owner), Effect.andThen(Clock.currentTimeMillis.pipe(Effect.map((now) => new Date(now)))), \n // NB: utimes interprets a bare number as *seconds* since epoch.\n Effect.flatMap((now) => fs.utimes(lockPath, now, now)), Effect.repeat(Schedule.spaced(REFRESH)), Effect.catch(() => Effect.logWarning(`auth lock compromised (continuing): '${lockPath}' is no longer owned by this process`)), \n // Acquisition returns while this fiber refreshes until the lock scope ends.\n Effect.forkScoped);\n});\n/**\n * Serialise execution of `effect` for the same `key`, both within this\n * process (a semaphore) and across processes on the same machine (an atomic\n * lock directory whose mtime is refreshed while held so another process can\n * recover it after a crash).\n *\n * Failure to create or acquire the lock is fatal. Authentication writes its\n * profile state beneath the same root, so continuing without a writable lock\n * cannot produce a valid deployment and would permit concurrent corruption.\n */\nexport const withLock = (key, effect, options) => {\n const safeKey = sanitizeLockKey(key);\n let semaphore = semaphores.get(safeKey);\n if (semaphore === undefined) {\n semaphore = Semaphore.makeUnsafe(1);\n semaphores.set(safeKey, semaphore);\n }\n return semaphore.withPermit(Effect.gen(function* () {\n const path = yield* Path.Path;\n // Read `rootDir` here, not at module eval, so the\n // `Profile -> AuthProvider -> Lock -> Profile` import cycle never\n // sees it uninitialised.\n const lockPath = path.join(rootDir, \"lock\", `${safeKey}.lock`);\n yield* acquireFileLock(lockPath, options?.timeout ?? DEFAULT_TIMEOUT).pipe(Effect.orDie);\n return yield* effect;\n }).pipe(Effect.scoped));\n};\n//# sourceMappingURL=Lock.js.map","import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Schema from \"effect/Schema\";\nimport * as Semaphore from \"effect/Semaphore\";\nimport { withLock } from \"./Lock.js\";\n/**\n * Canonical web host for OAuth provider-agnostic landing pages\n * (`/auth/success`, `/auth/error`). The CLI's loopback server 302s the\n * browser to one of these after handling the OAuth callback. Centralized\n * here so the redirect target lives in exactly one place across all\n * provider OAuth clients.\n */\nexport const AUTH_LANDING_HOST = \"https://alchemy.run\";\nexport const AUTH_SUCCESS_URL = `${AUTH_LANDING_HOST}/auth/success`;\nexport const AUTH_ERROR_URL = `${AUTH_LANDING_HOST}/auth/error`;\n/**\n * Methods on an {@link AuthProviderImpl} that mutate (or could trigger\n * mutation of) on-disk credentials. The factory wraps these in a\n * cross-process file lock keyed by `(profileName, providerName)` so that\n * concurrent processes never refresh / write credentials simultaneously.\n *\n * `prettyPrint` is intentionally excluded: it's read-only display.\n */\nconst LOCKED_METHODS = new Set([\"read\", \"login\", \"logout\", \"configure\"]);\n/**\n * Methods that may drive an interactive flow (prompts, browser-based\n * OAuth, etc.). A process-wide mutex serializes these across providers\n * so that, e.g., Cloudflare's `configure` finishes its prompt sequence\n * before Planetscale's begins — even when the two auth provider Layers\n * are built in parallel as part of a single `providers()` Layer.\n *\n * The clack prompt wrapper in `Util/Clank.ts` enforces per-prompt\n * serialization; this mutex enforces per-flow serialization so the user\n * sees one provider's prompts grouped together rather than interleaved.\n */\nconst INTERACTIVE_METHODS = new Set([\"login\", \"configure\"]);\nconst interactiveMutex = Semaphore.makeUnsafe(1);\nexport class AuthError extends Schema.TaggedError()(\"AuthError\", {\n message: Schema.String,\n cause: Schema.optional(Schema.Defect()),\n}) {\n}\nexport class AuthProviders extends Context.Service()(\"AuthProviders\") {\n}\nexport const AuthProvider = () => (name, impl) => Effect.gen(function* () {\n const ctx = yield* Effect.context();\n const providers = yield* AuthProviders;\n const service = yield* Effect.isEffect(impl)\n ? impl\n : Effect.succeed(impl);\n return yield* Effect.sync(() => (providers[name] = {\n kind: \"AuthProvider\",\n name,\n ...Object.fromEntries(Object.entries(service).map(([methodName, fn]) => [\n methodName,\n (...args) => {\n let eff = fn(...args).pipe(Effect.provideContext(ctx));\n if (LOCKED_METHODS.has(methodName)) {\n // First positional arg is always `profileName`.\n const profileName = args[0];\n eff = withLock(`${profileName}-${name}`, eff);\n }\n if (INTERACTIVE_METHODS.has(methodName)) {\n eff = Semaphore.withPermits(interactiveMutex, 1)(eff);\n }\n return eff;\n },\n ])),\n }));\n});\n/**\n * Build a Layer that registers an AuthProvider into the {@link AuthProviders}\n * registry when its parent layer is built. Use this from a provider's\n * top-level `providers()` Layer so that `alchemy login` can discover the\n * provider via the registry without forcing credential resolution.\n */\nexport const AuthProviderLayer = () => (name, impl) => Layer.effectDiscard(AuthProvider()(name, impl));\n/**\n * Look up a registered {@link AuthProvider} by name. Fails with\n * {@link AuthError} if the provider hasn't been registered (typically because\n * its layer hasn't been built).\n */\nexport const getAuthProvider = (name) => AuthProviders.use((registry) => registry[name] == null\n ? Effect.fail(new AuthError({\n message: `AuthProvider '${name}' is not registered. Make sure its layer has been provided.`,\n }))\n : Effect.succeed(registry[name]));\n//# sourceMappingURL=AuthProvider.js.map","import * as Config from \"effect/Config\";\nimport * as ConfigProvider from \"effect/ConfigProvider\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport os from \"node:os\";\nimport path from \"pathe\";\nimport { isNonInteractive } from \"../Util/interactive.js\";\nimport { AuthError } from \"./AuthProvider.js\";\nexport const rootDir = path.join(os.homedir(), \".alchemy\");\nexport const configFilePath = path.join(rootDir, \"profiles.json\");\n/**\n * Config key consulted by the various `fromAuthProvider` /\n * `fromEnvironment` layers to pick which named profile in\n * `~/.alchemy/profiles.json` to use. Defaults to `\"default\"`.\n */\nexport const ALCHEMY_PROFILE = Config.string(\"ALCHEMY_PROFILE\").pipe(Config.withDefault(\"default\"));\nexport const CONFIG_VERSION = 0;\nexport class AlchemyConfig extends Context.Service()(\"Alchemy::Profiles\") {\n}\nconst emptyConfig = () => ({\n version: CONFIG_VERSION,\n profiles: {},\n});\nexport class AlchemyProfile extends Context.Service()(\"Alchemy::Profile\") {\n}\n/**\n * Layer that builds the {@link AlchemyProfile} service. Captures the\n * {@link FileSystem.FileSystem} dependency at layer-build time, so any\n * Effect that yields {@link AlchemyProfile} ends up with `R = Profile` (no\n * `FileSystem` leak). Provide this once at the top of your runtime\n * (alongside `PlatformServices` / `NodeContext`).\n */\nexport const ProfileLive = Layer.effect(AlchemyProfile, Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const readConfig = fs\n .readFileString(configFilePath)\n .pipe(Effect.flatMap((data) => Effect.try({\n try: () => {\n const parsed = JSON.parse(data);\n if (parsed?.version !== CONFIG_VERSION) {\n // TODO(sam): this is destructive, should we maintain a chain of migrations from 0 to current?\n return emptyConfig();\n }\n return parsed;\n },\n catch: emptyConfig,\n })), Effect.orElseSucceed(emptyConfig));\n const writeConfig = (config) => fs\n .makeDirectory(path.dirname(configFilePath), { recursive: true })\n .pipe(Effect.flatMap(() => fs.writeFileString(configFilePath, JSON.stringify(config, null, 2))));\n const getProfile = (name) => readConfig.pipe(Effect.map((config) => config.profiles[name]));\n const setProfile = (name, profile) => readConfig.pipe(Effect.tap((config) => Effect.sync(() => (config.profiles[name] = profile))), Effect.flatMap(writeConfig));\n const deleteProfile = (name) => readConfig.pipe(Effect.flatMap((config) => {\n if (!(name in config.profiles)) {\n return Effect.succeed(false);\n }\n delete config.profiles[name];\n return writeConfig(config).pipe(Effect.as(true));\n }));\n const loadOrConfigure = (auth, profileName, ctx) => Effect.flatMap(getProfile(profileName), (existing) => {\n const stored = existing?.[auth.name];\n if (stored) {\n return Effect.succeed(stored);\n }\n // No credentials are configured for this provider+profile. Driving\n // `auth.configure` requires an interactive terminal (clack prompts,\n // browser-based OAuth, ...). In a non-interactive, non-CI context\n // (e.g. a `vitest` run or piped stdout) there is no TTY to drive\n // those prompts, so bail *before* calling `auth.configure`.\n //\n // This matters beyond just avoiding a hang: `configure` is a locked\n // method, so entering it acquires a cross-process auth lockfile. We\n // must avoid creating that lock when we can't actually configure —\n // for OAuth providers a refresh token is typically single-use, so a\n // stray lock left by a doomed configure can wedge concurrent refreshes.\n if (!ctx.ci && isNonInteractive()) {\n return Effect.fail(new AuthError({\n message: `No credentials configured for '${auth.name}' in profile '${profileName}', ` +\n `and this process is non-interactive so it can't be configured interactively. ` +\n `Run \\`alchemy login --profile ${profileName}\\` to configure it, ` +\n `or set CI=1 to use environment-variable credentials.`,\n }));\n }\n return Effect.tap(auth.configure(profileName, ctx), (config) => setProfile(profileName, { ...existing, [auth.name]: config }));\n });\n return {\n readConfig,\n writeConfig,\n getProfile,\n setProfile,\n deleteProfile,\n loadOrConfigure,\n };\n}));\n/**\n * Returns a `ConfigProvider` that overrides `ALCHEMY_PROFILE` with the\n * given `profile` (when explicitly passed via the CLI `--profile` flag),\n * falling through to `base` for everything else.\n *\n * Use this to let the CLI's `--profile <name>` win over `$ALCHEMY_PROFILE`\n * without disturbing other config lookups.\n */\nexport const withProfileOverride = (base, profile) => {\n if (profile === undefined)\n return base;\n const overrides = { ALCHEMY_PROFILE: profile };\n const overrideProvider = ConfigProvider.make((path) => Effect.succeed(path.length === 1 && typeof path[0] === \"string\" && path[0] in overrides\n ? ConfigProvider.makeValue(overrides[path[0]])\n : undefined));\n return ConfigProvider.orElse(base)(overrideProvider);\n};\n//# sourceMappingURL=Profile.js.map","import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport * as Redacted from \"effect/Redacted\";\nimport path from \"pathe\";\nimport { rootDir } from \"./Profile.js\";\nconst credentialsDirPath = path.join(rootDir, \"credentials\");\nexport const profileCredentialsDirPath = (profile) => path.join(credentialsDirPath, profile);\nexport const credentialsFilePath = (profile, provider) => path.join(profileCredentialsDirPath(profile), `${provider}.json`);\nexport class CredentialsStore extends Context.Service()(\"Alchemy::CredentialsStore\") {\n}\nexport const CredentialsStoreLive = Layer.effect(CredentialsStore, Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const read = (profile, provider) => fs.readFileString(credentialsFilePath(profile, provider)).pipe(Effect.catch(() => Effect.succeed(undefined)), Effect.map((data) => {\n if (data === undefined)\n return undefined;\n try {\n return JSON.parse(data);\n }\n catch {\n return undefined;\n }\n }));\n const write = (profile, provider, credentials) => {\n const filePath = credentialsFilePath(profile, provider);\n return fs.makeDirectory(path.dirname(filePath), { recursive: true }).pipe(Effect.flatMap(() => {\n return fs.writeFileString(filePath, JSON.stringify(credentials, null, 2));\n }));\n };\n const remove_ = (profile, provider) => fs\n .remove(credentialsFilePath(profile, provider))\n .pipe(Effect.catch(() => Effect.void));\n const deleteProfile = (profile) => fs\n .remove(profileCredentialsDirPath(profile), { recursive: true })\n .pipe(Effect.catch(() => Effect.void));\n return {\n read,\n write,\n delete: remove_,\n deleteProfile,\n };\n}));\nexport function displayRedacted(r, visibleChars = 4) {\n const raw = Redacted.value(r);\n if (raw.length <= visibleChars)\n return \"****\";\n return `${raw.slice(0, visibleChars)}****`;\n}\n//# sourceMappingURL=Credentials.js.map","import * as Context from \"effect/Context\";\nimport * as Deferred from \"effect/Deferred\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\n/**\n * Per-resource in-memory artifacts shared across a single `Plan.make -> apply`\n * execution.\n *\n * The engine scopes this service by resource `FQN` before invoking lifecycle\n * handlers, so providers should treat it as a resource-local bag for expensive,\n * deterministic intermediate results that can be reused across phases.\n *\n * Expected usage:\n *\n * - `diff` computes an expensive artifact once and stores it\n * - `create` / `update` reads the same artifact and skips recomputing it\n * - artifacts are ephemeral and must never be required for correctness on a\n * later deploy because the bag is reset between runs\n *\n * Example:\n *\n * ```ts\n * const artifacts = yield* Artifacts;\n * const cached = yield* artifacts.get<PreparedBundle>(\"bundle\");\n * if (cached) return cached;\n *\n * const bundle = yield* prepareBundle();\n * yield* artifacts.set(\"bundle\", bundle);\n * return bundle;\n * ```\n */\nexport class Artifacts extends Context.Service()(\"Artifacts\") {\n}\nexport class ArtifactStore extends Context.Service()(\"Artifacts/Store\") {\n}\n/**\n * Create a fresh root store for one deploy/test run.\n */\nexport const createArtifactStore = () => new Map();\nconst getOrCreateBag = (store, fqn) => {\n const existing = store.get(fqn);\n if (existing) {\n return existing;\n }\n const bag = new Map();\n store.set(fqn, bag);\n return bag;\n};\nexport const makeScopedArtifacts = (store, fqn) => {\n const bag = getOrCreateBag(store, fqn);\n return {\n get: (key) => Effect.sync(() => bag.get(key)),\n set: (key, value) => Effect.sync(() => {\n bag.set(key, value);\n }),\n delete: (key) => Effect.sync(() => {\n bag.delete(key);\n }),\n };\n};\nexport const scopedArtifacts = (fqn) => Layer.effect(Artifacts, ArtifactStore.useSync((store) => makeScopedArtifacts(store, fqn)));\n/**\n * Run an effect with a fresh artifact root, replacing any existing store.\n * Use this at top-level entrypoints that intentionally define a new deploy run.\n */\nexport const provideFreshArtifactStore = (effect) => effect.pipe(Effect.provideServiceEffect(ArtifactStore, Effect.sync(createArtifactStore)));\n/**\n * Ensure an artifact root exists, reusing the ambient store when one is already\n * present. This lets nested helpers participate in the same run-scoped cache.\n */\nexport const ensureArtifactStore = (effect) => Effect.serviceOption(ArtifactStore).pipe(Effect.map(Option.getOrUndefined), Effect.flatMap((existing) => effect.pipe(Effect.provideService(ArtifactStore, existing ?? createArtifactStore()))));\nexport const cached = (id) => (eff) => Effect.gen(function* () {\n const artifacts = yield* Artifacts;\n const deferred = yield* Deferred.make();\n const cached = yield* artifacts.get(id);\n if (cached) {\n if (Effect.isEffect(cached)) {\n return yield* cached;\n }\n return cached;\n }\n yield* artifacts.set(id, Deferred.await(deferred));\n const result = yield* eff;\n yield* Deferred.succeed(deferred, result);\n yield* artifacts.set(id, result);\n return result;\n});\n//# sourceMappingURL=Artifacts.js.map","import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nexport class Cli extends Context.Service()(\"CLI\") {\n}\n//# sourceMappingURL=Cli.js.map","import * as Output from \"./Output.js\";\n// special runtime-only symbol for probing the Ref proxy for its metadata\nconst RefMetadata = Symbol.for(\"alchemy/RefMetadata\");\nexport const isRef = (s) => s && s[RefMetadata] !== undefined;\nexport const getRefMetadata = (ref) => ref[RefMetadata];\nexport const ref = (id, { stack, stage, } = {}, type) => {\n const ref = new Proxy({}, {\n get: (_, prop) => {\n if (prop === RefMetadata) {\n return {\n stack,\n stage,\n id,\n type,\n };\n }\n return Output.of(ref)[prop];\n },\n });\n return ref;\n};\n//# sourceMappingURL=Ref.js.map","import * as Context from \"effect/Context\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\n/**\n * AdoptPolicy controls whether the engine should \"adopt\" pre-existing cloud\n * resources that conflict with this stack instead of failing.\n *\n * The engine always calls a provider's `read` lifecycle operation when there\n * is no prior state and `read` is implemented. The provider's job is to\n * report two things:\n *\n * 1. Whether the resource exists (returns attributes vs. `undefined`).\n * 2. Whether *we* own it (plain attributes vs. {@link Unowned}-branded).\n *\n * The engine then routes:\n *\n * | `read` outcome | `adopt: false` | `adopt: true` |\n * | ------------------- | -------------- | ----------------- |\n * | undefined | create | create |\n * | owned (plain attrs) | silent adopt | silent adopt |\n * | {@link Unowned} | fail | takeover (adopt) |\n *\n * \"Owned\" means a provider has affirmatively determined the resource was\n * created by this stack/stage/logical-id (typically by inspecting tags or\n * naming conventions). Resources without ownership semantics simply always\n * return plain attrs — they are treated as owned by default, so silent\n * adoption is the norm and `--adopt` is unnecessary.\n *\n * The policy can be overridden per-effect via {@link adopt} — most commonly\n * applied at the resource or stack scope.\n */\nexport class AdoptPolicy extends Context.Service()(\"AdoptPolicy\") {\n}\n/**\n * Engine-raised failure produced when `read` reports an existing resource\n * marked as {@link Unowned} and `adopt` is `false`. Surface this to the user\n * to indicate they should either re-tag the cloud resource, pick a different\n * physical name, or re-run with `--adopt` (or `adopt(true)`) to force a\n * takeover.\n */\nexport class OwnedBySomeoneElse extends Data.TaggedError(\"OwnedBySomeoneElse\") {\n}\n/**\n * Private symbol used to brand attribute objects returned by `read` as\n * \"exists in cloud, but not owned by this stack/stage/logical-id\".\n *\n * Deliberately *not* registered via `Symbol.for` — the brand is an\n * engine-internal routing hint and must not be observable or\n * forgeable from outside this module. The engine strips it before any\n * state persistence (see {@link stripUnowned}) so it never leaks into\n * the state store, JSON serialization, or downstream `Output`s.\n */\nconst UnownedTag = Symbol(\"alchemy/Unowned\");\n/**\n * Brand a `read` return value as belonging to a different owner.\n *\n * Use this in a provider's `read` implementation when the resource exists in\n * the cloud but a positive ownership check (e.g. tag inspection) shows it\n * was *not* created by this stack/stage/logical-id:\n *\n * ```ts\n * read: Effect.fn(function* ({ id, output, olds }) {\n * const settings = yield* getScriptSettings({ ... }).pipe(\n * Effect.catchTag(\"WorkerNotFound\", () => Effect.succeed(undefined)),\n * );\n * if (!settings) return undefined;\n *\n * const attrs = { workerName, ...buildAttrs(settings) };\n * return hasAlchemyWorkerTags(id, settings.tags) ? attrs : Unowned(attrs);\n * }),\n * ```\n *\n * The returned value is structurally still `T` — there is no wrapper to\n * unwrap. The brand is a non-enumerable symbol that the engine inspects\n * during planning to decide whether to take over (`adopt: true`) or fail\n * loudly (`adopt: false`).\n *\n * Resources without ownership semantics should simply return plain attrs —\n * the engine treats them as owned and silent adoption is the default.\n */\nexport const Unowned = Object.assign((attrs) => {\n const cloned = { ...attrs };\n Object.defineProperty(cloned, UnownedTag, {\n value: true,\n enumerable: false,\n writable: false,\n configurable: false,\n });\n return cloned;\n}, {\n is: (value) => typeof value === \"object\" &&\n value !== null &&\n value[UnownedTag] === true,\n});\n/**\n * Strip the {@link Unowned} brand from an attributes object before persisting\n * it — state should not carry per-deploy ownership-routing metadata.\n *\n * The brand is intentionally non-enumerable, so a plain spread already\n * drops it; the additional `delete` is defense-in-depth in case a future\n * change makes the descriptor enumerable. Always returns a fresh object\n * (never mutates the input).\n */\nexport const stripUnowned = (attrs) => {\n const out = { ...attrs };\n if (UnownedTag in out)\n delete out[UnownedTag];\n return out;\n};\nexport const adopt = ((enabled = true) => (eff) => eff.pipe(typeof enabled === \"boolean\"\n ? Effect.provideService(AdoptPolicy, enabled ?? true)\n : Effect.provideServiceEffect(AdoptPolicy, enabled)));\n//# sourceMappingURL=AdoptPolicy.js.map","/**\n * Separator used in FQN strings.\n */\nexport const FQN_SEPARATOR = \"/\";\n/**\n * Encode an FQN for safe filesystem storage.\n * Replaces `/` (FQN separator) with `__` to avoid subdirectory creation.\n */\nexport const encodeFqn = (fqn) => fqn.replaceAll(FQN_SEPARATOR, \"__\");\n/**\n * Decode a filename back to FQN.\n */\nexport const decodeFqn = (filename) => filename.replaceAll(\"__\", FQN_SEPARATOR);\n/**\n * Convert a NamespaceNode chain to an array of namespace IDs, from root to leaf.\n *\n * @example\n * ```ts\n * const ns = { Id: \"Child\", Parent: { Id: \"Parent\", Parent: { Id: \"Root\" } } };\n * toPath(ns); // [\"Root\", \"Parent\", \"Child\"]\n * ```\n */\nexport const toPath = (ns) => {\n if (!ns)\n return [];\n const path = [];\n let current = ns;\n while (current) {\n path.unshift(current.Id);\n current = current.Parent;\n }\n return path;\n};\n/**\n * Create a fully-qualified name (FQN) from a namespace and logical ID.\n * The FQN is a flat key suitable for state storage.\n *\n * @example\n * ```ts\n * const ns = { Id: \"Child\", Parent: { Id: \"Parent\" } };\n * toFqn(ns, \"MyResource\"); // \"Parent/Child/MyResource\"\n * toFqn(undefined, \"MyResource\"); // \"MyResource\"\n * ```\n */\nexport const toFqn = (ns, logicalId) => {\n const path = toPath(ns);\n path.push(logicalId);\n return path.join(FQN_SEPARATOR);\n};\n/**\n * Parse an FQN back into namespace path segments and the logical ID.\n *\n * @example\n * ```ts\n * parseFqn(\"Parent/Child/MyResource\"); // { path: [\"Parent\", \"Child\"], logicalId: \"MyResource\" }\n * parseFqn(\"MyResource\"); // { path: [], logicalId: \"MyResource\" }\n * ```\n */\nexport const parseFqn = (fqn) => {\n const parts = fqn.split(FQN_SEPARATOR);\n const logicalId = parts.pop();\n return { path: parts, logicalId };\n};\n/**\n * Reconstruct a NamespaceNode chain from a path array.\n *\n * @example\n * ```ts\n * fromPath([\"Parent\", \"Child\"]);\n * // { Id: \"Child\", Parent: { Id: \"Parent\" } }\n * ```\n */\nexport const fromPath = (path) => {\n if (path.length === 0)\n return undefined;\n let node;\n for (const id of path) {\n node = { Id: id, Parent: node };\n }\n return node;\n};\n//# sourceMappingURL=FQN.js.map","import * as Context from \"effect/Context\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nexport const Provider = (type) => Context.Service()(type);\nconst withDefaultList = (service) => service.list ? service : { ...service, list: () => Effect.succeed([]) };\nexport const effect = (cls, eff) => Layer.effect(\n// @ts-expect-error\nProvider(cls.Type), Effect.map(eff, (service) => ({\n aliases: \"Aliases\" in cls ? cls.Aliases : undefined,\n ...withDefaultList(service),\n})));\nexport const succeed = (cls, service) => \n// @ts-expect-error\nLayer.succeed(Provider(cls.Type), {\n aliases: \"Aliases\" in cls ? cls.Aliases : undefined,\n ...withDefaultList(service),\n});\nexport const ProviderCollection = () => (id) => Context.Service()(id);\nexport const collection = (resources) => Effect.gen(function* () {\n const context = yield* Effect.context();\n const providers = Object.fromEntries(yield* Effect.all(resources.map((resource) => \"Provider\" in resource\n ? resource.Provider.pipe(Effect.map((provider) => [resource.Type, provider]))\n : Effect.succeed([\n resource.key,\n context.mapUnsafe.get(resource.key),\n ])), { concurrency: \"unbounded\" }));\n return {\n kind: \"ProviderCollection\",\n get: (service) => providers[service],\n providers,\n };\n});\nconst isProviderCollectionService = (value) => {\n return (typeof value === \"object\" &&\n value !== null &&\n \"kind\" in value &&\n value.kind === \"ProviderCollection\");\n};\n/**\n * Structural check for a {@link ProviderService} living in the Effect\n * context. Providers are keyed by their canonical resource type; when\n * searching for a legacy alias, the tag key won't match, so lookup has to\n * recognize provider services by shape.\n */\nconst isProviderService = (value) => typeof value === \"object\" &&\n value !== null &&\n \"reconcile\" in value &&\n typeof value.reconcile === \"function\" &&\n \"delete\" in value &&\n typeof value.delete === \"function\";\n/**\n * Resolve the concrete service for `mode` from a provider found in context.\n *\n * - `mode === undefined` → the service as registered (for dual\n * registrations that is the delegating service for the run's default\n * mode).\n * - `mode` given and the provider carries {@link ProviderService.modes} →\n * the (lazily built, memoized) variant for that mode.\n * - `mode` given but the provider is mode-agnostic → the service itself:\n * a single implementation satisfies every mode (hybrid), which is what\n * lets live-only resources (e.g. R2 buckets) participate in dev runs.\n */\nexport const providerForMode = (service, mode) => mode !== undefined && service.modes !== undefined\n ? service.modes[mode]\n : Effect.succeed(service);\nexport const findProviderByType = ((type, mode) => tryFindProviderByType(type, mode).pipe(Effect.flatMap(Option.match({\n onNone: () => Effect.die(`Provider not found for ${type}`),\n onSome: (provider) => Effect.succeed(provider),\n}))));\n/**\n * Typed provider lookup by resource class (or {@link Platform}) value. Infers\n * `R` from the class so `provider.list()` / `provider.read(...)` return the\n * resource's `Attributes` shape — prefer this over {@link findProviderByType},\n * which only takes the type string.\n */\nexport const findProvider = (resource, mode) => findProviderByType((resource.Type ?? resource.key), mode);\n/**\n * A persisted state row references a resource type with no registered\n * provider — the type was removed from the program (or renamed without an\n * alias) while its state row still exists (\"zombie\" row).\n *\n * This is FATAL at plan time: the program and state fundamentally disagree,\n * and without the provider the row's physical resource cannot be deleted\n * anyway, so proceeding would only strand it silently. The plan dies with\n * this error; nothing is deployed or destroyed until the provider is\n * re-registered (or aliased), or the state row is cleared manually.\n */\nexport class MissingProviderError extends Data.TaggedError(\"MissingProviderError\") {\n}\n/** Build the fatal plan-time error for a zombie state row. */\nexport const missingProviderError = (resourceType, fqn) => new MissingProviderError({\n message: `No provider is registered for resource type '${resourceType}' ` +\n `(state row '${fqn}'). The type was removed from the program or ` +\n \"renamed without an alias. Re-register the provider (or add the \" +\n \"old name to the resource's `aliases`) so this row can be \" +\n \"destroyed, or clear the state row manually if the physical \" +\n \"resource is already gone.\",\n resourceType,\n fqn,\n});\nexport const tryFindProviderByType = Effect.fn(function* (resourceType, mode) {\n // When a mode is requested, resolve the found service to that mode's\n // variant (building it lazily if needed) before returning.\n const found = yield* Effect.gen(function* () {\n const Tag = Provider(resourceType);\n const direct = yield* Effect.serviceOption(Tag);\n if (Option.isSome(direct)) {\n return direct;\n }\n const context = yield* Effect.context();\n for (const value of context.mapUnsafe.values()) {\n if (isProviderCollectionService(value)) {\n const provider = value.get(resourceType);\n if (provider) {\n return Option.some(provider);\n }\n }\n }\n // State persisted before a type rename carries the legacy name, so no\n // provider is keyed under it. Fall back to a provider that declares the\n // name in its `aliases` — scanning both bare Provider layers and the\n // members of every ProviderCollection.\n for (const value of context.mapUnsafe.values()) {\n if (isProviderCollectionService(value)) {\n for (const provider of Object.values(value.providers)) {\n if (provider.aliases?.includes(resourceType)) {\n return Option.some(provider);\n }\n }\n }\n else if (isProviderService(value) &&\n value.aliases?.includes(resourceType)) {\n return Option.some(value);\n }\n }\n return Option.none();\n });\n if (Option.isNone(found)) {\n return found;\n }\n return Option.some(yield* providerForMode(found.value, mode));\n});\n//# sourceMappingURL=Provider.js.map","import * as Context from \"effect/Context\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as Option from \"effect/Option\";\nimport { AlchemyContext } from \"./AlchemyContext.js\";\n/**\n * ProviderModePolicy opts resources OUT of local emulation: when `true`,\n * resources registered while it is in context resolve the **live**\n * provider even during `alchemy dev`.\n *\n * Apply it with the {@link remote} combinator. During `alchemy deploy`\n * everything is live anyway, so the policy only has an effect in dev.\n *\n * Tri-state `Context.Reference`: `undefined` (the default — no explicit\n * decoration, inherit/run default), `true` (`remote()`), `false`\n * (`remote(false)` — explicitly follow the run default again). The unset vs\n * explicit distinction is load-bearing for conflict detection at\n * registration (see `Resource.ts`).\n */\nexport const ProviderModePolicy = Context.Reference(\"ProviderModePolicy\", { defaultValue: () => undefined });\n/**\n * The same resource (identified by FQN) was registered (`yield*`ed) from two\n * places whose ambient {@link ProviderModePolicy} disagree — e.g. once inside\n * `remote()` and once without it. Context-based decoration cannot decide which\n * one wins, so the engine fails loudly instead of silently picking one.\n *\n * Fix: register the resource once and close over the returned value, or make\n * both registration sites agree.\n */\nexport class ConflictingProviderModeError extends Data.TaggedError(\"ConflictingProviderModeError\") {\n}\n/**\n * Prefix marking a locally-emulated resource's physical identity. Local\n * providers fabricate ids/names with this prefix (`dev:<uuid>` queue and\n * namespace ids, `dev:`-prefixed bucket names, ...) so a resource's\n * persisted attributes reveal which runtime hosts it even without the\n * `providerMode` stamp.\n */\nexport const LOCAL_ID_PREFIX = \"dev:\";\n/**\n * Does a persisted attributes value carry a local identity marker — any\n * string value (at any depth) with the {@link LOCAL_ID_PREFIX}? Persisted\n * attrs are plain JSON (state commits strip unresolved values), so a\n * structural scan is safe.\n */\nexport const hasLocalIdentity = (value) => {\n if (typeof value === \"string\")\n return value.startsWith(LOCAL_ID_PREFIX);\n if (Array.isArray(value))\n return value.some(hasLocalIdentity);\n if (typeof value === \"object\" && value !== null) {\n return Object.values(value).some(hasLocalIdentity);\n }\n return false;\n};\n/**\n * The mode a persisted state row was actually reconciled with: its stamped\n * `providerMode`, or — for legacy rows written before stamping existed —\n * `\"local\"` when the persisted attributes carry a {@link LOCAL_ID_PREFIX}\n * identity marker, `\"live\"` otherwise.\n *\n * An unstamped row without a marker predates provider modes or was written\n * by a mode-agnostic provider — in both cases the write acted on the REAL\n * cloud, so the row's physical resource is `\"live\"`. Assuming the current\n * run's mode instead silently adopts a deployed cloud resource as a local\n * instance during `alchemy dev`: the row noops (or restarts locally over\n * the live attrs), gets re-stamped `\"local\"`, and the live resource becomes\n * untracked — it is never deleted by a later destroy or replacement, and\n * its deployed URL keeps serving.\n *\n * An unstamped row WITH a marker (e.g. a queue with a `dev:<uuid>` id\n * written by `alchemy dev` on a pre-stamping version) is the mirror case:\n * assuming `\"live\"` hands the `dev:` identity to the live provider, which\n * sends it to the real cloud API (Cloudflare rejects it as a malformed\n * parameter, permanently wedging the destroy). The marker proves the row\n * was reconciled locally, so it is handled as `\"local\"`.\n *\n * For mode-agnostic providers the returned mode is harmless either way:\n * `providerForMode` ignores the mode when the provider has a single\n * implementation.\n */\nexport const stampedMode = (row) => row.providerMode ?? (hasLocalIdentity(row.attr) ? \"local\" : \"live\");\n/**\n * Run the wrapped resources **remotely (against the real cloud) even during\n * `alchemy dev`** — the opt-out from local emulation. During `alchemy deploy`\n * this is a no-op (everything is remote).\n *\n * Captured at registration time like `adopt()` / `retain()`, so it can be\n * applied to a single resource or a whole scope:\n *\n * ```ts\n * // This queue talks to real Cloudflare even in dev\n * const queue = yield* Queue(\"Jobs\", {}).pipe(Alchemy.remote());\n *\n * // Everything in this scope runs live in dev\n * yield* Effect.gen(function* () {\n * const queue = yield* Queue(\"Jobs\", {});\n * const consumer = yield* Consumer(\"JobsConsumer\", { queue });\n * }).pipe(Alchemy.remote());\n * ```\n *\n * `remote(false)` (or an `Effect<boolean>` resolving to false) removes the\n * pin — the resource follows the run default again.\n *\n * Providers with a single implementation are mode-agnostic and already run\n * live in dev; `remote()` on them is a no-op.\n */\nexport const remote = ((enabled = true) => (eff) => eff.pipe(typeof enabled === \"boolean\"\n ? Effect.provideService(ProviderModePolicy, enabled)\n : Effect.provideServiceEffect(ProviderModePolicy, enabled)));\n/**\n * Resolve the run-level default provider mode:\n *\n * 1. An ambient {@link ProviderModePolicy} of `true` (e.g. `remote()` wrapped\n * around a whole program) forces `\"live\"`.\n * 2. Otherwise `AlchemyContext.dev` decides: `dev: true` → `\"local\"`.\n * 3. Without an AlchemyContext (bare engine tests), default to `\"live\"`.\n */\nexport const defaultProviderMode = Effect.gen(function* () {\n if (yield* ProviderModePolicy)\n return \"live\";\n const ctx = yield* Effect.serviceOption(AlchemyContext);\n return Option.match(ctx, {\n onNone: () => \"live\",\n onSome: (c) => (c.dev ? \"local\" : \"live\"),\n });\n});\n//# sourceMappingURL=ProviderMode.js.map","import * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as Effectable from \"effect/Effectable\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport { AdoptPolicy } from \"./AdoptPolicy.js\";\nimport { toFqn } from \"./FQN.js\";\nimport { CurrentNamespace } from \"./Namespace.js\";\nimport * as Output from \"./Output.js\";\nimport { Provider } from \"./Provider.js\";\nimport { ConflictingProviderModeError, ProviderModePolicy, } from \"./ProviderMode.js\";\nimport { ref as makeRef } from \"./Ref.js\";\nimport { RemovalPolicy } from \"./RemovalPolicy.js\";\nimport { RenamePolicy } from \"./Rename.js\";\nimport { Self } from \"./Self.js\";\nimport { Stack } from \"./Stack.js\";\nexport const isResource = (value) => {\n // Require the full resource identity (Type AND FQN), not just `Type`:\n // user-authored prop objects legitimately carry a `Type` field (e.g.\n // Amazon States Language states like `{ Type: \"Pass\", End: true }` in a\n // Step Functions definition) and must not be mistaken for resources.\n // Locally-declared resources always expose both as own keys; refs\n // (`Resource.ref(...)`) deliberately report neither via `in` so they keep\n // routing through Output resolution.\n return (typeof value === \"object\" &&\n value !== null &&\n \"Type\" in value &&\n \"FQN\" in value);\n};\n/**\n * Does `value` reference an instance of the resource type `type` —\n * either a locally-declared resource or a `Resource.ref(...)` to one?\n *\n * Two constraints that ad-hoc guards get wrong for refs, which resolve\n * to Output-expression proxies:\n *\n * - Read `.Type` via property access (never `in`): the proxy answers\n * property reads with statically-known values but deliberately does\n * not report key existence (so {@link isResource} keeps routing refs\n * through Output resolution instead of the upstream-node lookup).\n * - Accept `typeof value === \"function\"`: the proxy's target is\n * callable (it needs an `apply` trap), so refs are not `\"object\"`.\n *\n * Either mistake silently rejects refs — in a Worker `env` that\n * degrades the binding to a plain JSON var.\n */\nexport const isResourceOfType = (value, type) => (typeof value === \"object\" || typeof value === \"function\") &&\n value !== null &&\n value.Type === type;\n/**\n * A tagged platform resource declared with neither props nor an inline\n * implementation was `yield*`ed, but its `.make(props, impl)` Layer never\n * built.\n *\n * Such a tag carries no configuration on its own — props AND impl both live\n * on the Layer — so its registration is a forward reference with `undefined`\n * props that the Layer's build repairs (in either order; see the #874\n * circular env-tag pattern). Props still `undefined` once the whole program\n * has evaluated means the Layer was never provided; `Plan.make` fails fast\n * with this error instead of letting the failure surface deep inside\n * whichever provider first reads a prop (e.g. `TypeError: undefined is not\n * an object (evaluating 'news.name')` in the Cloudflare Worker pre-create).\n */\nexport class MissingImplementationError extends Data.TaggedError(\"MissingImplementationError\") {\n}\nexport const missingImplementation = (type, id) => new MissingImplementationError({\n type,\n id,\n message: [\n `${type}<${id}> was yielded without its implementation.`,\n \"\",\n `\\`${id}\\` is declared as a bare tag — no props, no inline implementation — so both come from its \\`.make(...)\\` Layer:`,\n \"\",\n ` export class ${id} extends ${type}<${id}>()(\"${id}\") {}`,\n ` export const ${id}Live = ${id}.make({ /* props */ }, Effect.gen(function* () { /* ... */ }));`,\n \"\",\n `That Layer is not in scope where \\`${id}\\` is yielded. Provide it to the Stack's program:`,\n \"\",\n \" Alchemy.Stack(\",\n ` \"my-stack\",`,\n \" { providers, state },\",\n \" Effect.gen(function* () {\",\n ` const instance = yield* ${id};`,\n ` }).pipe(Effect.provide([${id}Live])),`,\n \" )\",\n \"\",\n `If \\`${id}\\` is not Effect-native, declare it with props instead: \\`()(\"${id}\", { /* props */ })\\`.`,\n ].join(\"\\n\"),\n});\n/**\n * Creates a resource constructor for a concrete resource type.\n *\n * The returned constructor registers the resource on the current stack,\n * resolves input props, exposes output attributes as `Output` expressions, and\n * records bindings contributed by policies and event sources. Resource\n * providers are attached separately through `.provider`.\n */\nexport function Resource(type, options) {\n const defaultRemovalPolicy = options?.defaultRemovalPolicy ?? \"destroy\";\n const self = Self(type);\n const constructor = (id, props) => Effect.gen(function* () {\n const stack = yield* Stack;\n const namespace = yield* CurrentNamespace;\n const fqn = toFqn(namespace, id);\n // `remote()` opts resources out of local emulation during dev. The\n // captured Mode is either \"live\" (pinned) or undefined (run default).\n // The Reference default is `undefined` — \"no explicit decoration\" —\n // which is distinct from an explicit `remote(false)`.\n const ambientPolicy = yield* ProviderModePolicy;\n const ambientMode = ambientPolicy\n ? \"live\"\n : undefined;\n const existing = stack.resources[fqn];\n if (existing) {\n // A resource may be `yield*`ed from several places (idempotent\n // registration). If a later site carries an *explicit* ambient\n // ProviderModePolicy that disagrees with what the resource was\n // registered with, the decorations are conflicting — fail loudly\n // instead of silently picking one. A later site with NO ambient\n // policy simply inherits the registered resource (the common\n // \"reference it from elsewhere\" pattern).\n if (ambientPolicy !== undefined && existing.Mode !== ambientMode) {\n return yield* Effect.die(new ConflictingProviderModeError({\n message: `Resource '${fqn}' was registered with provider mode ` +\n `'${existing.Mode ?? \"default\"}' but is now being registered ` +\n `with conflicting mode '${ambientMode ?? \"default\"}'. A ` +\n \"resource must resolve to a single provider mode: register \" +\n \"it once and close over the returned value, or make both \" +\n \"registration sites agree (e.g. wrap both in the same \" +\n \"`remote()` scope).\",\n fqn,\n existingMode: existing.Mode,\n conflictingMode: ambientMode,\n }));\n }\n // // TODO(sam): check if props are different and die\n return existing;\n }\n const bind = (...args) => typeof args[0] === \"string\"\n ? Effect.gen(function* () {\n const [sid, data] = args;\n (stack.bindings[fqn] ??= []).push({\n sid,\n data,\n });\n return undefined;\n })\n : (data) => {\n const stringifyBindArg = (arg) => {\n if (arg === undefined) {\n return undefined;\n }\n if (Array.isArray(arg)) {\n return arg\n .flatMap((item) => {\n const stringified = stringifyBindArg(item);\n return stringified === undefined ? [] : [stringified];\n })\n .join(\", \");\n }\n if (arg &&\n (typeof arg === \"object\" || typeof arg === \"function\")) {\n if (\"LogicalId\" in arg && typeof arg.LogicalId === \"string\") {\n return arg.LogicalId;\n }\n if (\"id\" in arg && typeof arg.id === \"string\") {\n return arg.id;\n }\n }\n return String(arg);\n };\n return bind(`${args[0]\n .flatMap((text, i) => {\n const stringified = stringifyBindArg(args[i + 1]);\n return stringified !== undefined\n ? [text, stringified]\n : [text];\n })\n .join(\"\")}`, data);\n };\n const target = {\n Type: type,\n Namespace: namespace,\n FQN: fqn,\n LogicalId: id,\n Props: props,\n Provider: ProviderTag,\n RemovalPolicy: yield* Effect.serviceOption(RemovalPolicy).pipe(Effect.map(Option.getOrElse(() => defaultRemovalPolicy))),\n Adopt: yield* Effect.serviceOption(AdoptPolicy).pipe(Effect.map(Option.getOrUndefined)),\n Mode: ambientMode,\n RequiresImplementation: options?.requiresImplementation || undefined,\n // Bare-string former ids resolve against the SAME namespace as the\n // resource's own id, so `renamedFrom(\"Site/Worker\")` declared at the\n // caller's level claims `<callerNs>/Site/Worker`; the `{ fqn }` form\n // is absolute (cross-namespace moves).\n FormerFqns: yield* Effect.serviceOption(RenamePolicy).pipe(Effect.map(Option.match({\n onNone: () => undefined,\n onSome: (formerIds) => formerIds.map((formerId) => typeof formerId === \"string\"\n ? toFqn(namespace, formerId)\n : formerId.fqn),\n }))),\n bind,\n toString() {\n return `Resource<${this.Type}>(${this.LogicalId})`;\n },\n [Symbol.toPrimitive](hint) {\n return hint === \"number\" ? NaN : this.toString();\n },\n };\n const Resource = (stack.resources[fqn] = new Proxy(target, {\n set: (t, prop, value) => {\n t[prop] = value;\n return true;\n },\n get: (t, prop) => typeof prop === \"symbol\" || prop in t\n ? t[prop]\n : new Output.PropExpr(Output.of(Resource), prop),\n }));\n Resource.Props = Effect.isEffect(props)\n ? // @effect-diagnostics-next-line anyUnknownInErrorContext:off\n yield* props.pipe(Effect.provide(Layer.mergeAll(Layer.succeed(Self, Resource), Layer.succeed(Self(type), Resource))))\n : props;\n return Resource;\n });\n const ProviderTag = Provider(type);\n const Service = {\n /**\n * Build a typed reference to a deployed instance of this resource\n * — in the current stack/stage by default, or in another via\n * `options`. Resolves to the same shape as `yield*\n * MyResource(\"id\", props)` so downstream code can read attributes\n * (`ref.someAttr`) exactly the way it would for a locally-declared\n * resource.\n */\n ref: (id, options) => Effect.succeed(Output.of(makeRef(id, options, type))),\n Type: type,\n Provider: ProviderTag,\n Self: self,\n Aliases: options?.aliases,\n };\n const ResourceClass = Object.assign((...args) => typeof args[0] === \"object\"\n ? Object.assign(ResourceClass, args[0])\n : constructor(...args), Service, \n // Make the constructor itself a real Effect: `yield* MyResource` resolves\n // to the constructor function (same as the old `asEffect()`), and\n // `Effect.isEffect(MyResource)` is now true so `Effect.all`/`forEach` work.\n Effectable.Prototype({\n label: `Resource<${type}>`,\n evaluate: () => Effect.succeed((id, props) => constructor(id, props)),\n }));\n return ResourceClass;\n}\n//# sourceMappingURL=Resource.js.map","import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport * as Redacted from \"effect/Redacted\";\n/**\n * Canonicalize a logical key into a key that is safe to use as the name of an\n * environment variable / binding (`[a-zA-Z][a-zA-Z0-9_]*`).\n *\n * `RuntimeContext.set`/`get` are dumb key/value stores: they read and write the\n * key **verbatim**. It is the *caller's* responsibility to hand them a\n * canonical key, since the caller is the one that knows the logical key may\n * contain `.`/`-` (e.g. a dotted config name from `Platform`, or an\n * `Output.toString()` like `\"QueueSinkQueue.queueUrl\"`). Callers run the key\n * through this before calling `set`/`get` so both sides agree.\n */\nexport const sanitizeKey = (key) => key.replaceAll(/[^a-zA-Z0-9]/g, \"_\");\n/**\n * Detect the (already JSON-parsed) {@link RedactedMarker} shape. After\n * `JSON.parse` the marker is a plain object — `Redacted.isRedacted` is\n * always `false` on it — so detection is structural.\n */\nexport const isRedactedMarker = (value) => typeof value === \"object\" &&\n value !== null &&\n value._tag === \"Redacted\" &&\n \"value\" in value;\n/**\n * Returns true when {@link unpackEnvValue}'s `JSON.parse` would reinterpret\n * the raw string as something other than itself — a number (`\"123\"`), a\n * boolean, `null`, or a JSON document. Such strings must stay\n * `JSON.stringify`-packed; everything else round-trips verbatim through the\n * parse-failure fallback.\n */\nconst parsesAsJson = (value) => {\n try {\n JSON.parse(value);\n return true;\n }\n catch {\n return false;\n }\n};\n/**\n * Serialize a binding value for an env var: `Redacted` values are packed as\n * a {@link RedactedMarker}, non-string values as JSON.\n *\n * A plain string is stored **verbatim** whenever `JSON.parse` would reject\n * it — which is almost every real-world string (names, URLs, ids). Packing\n * those too would put `\"my-queue\"` (quote characters included) on the wire,\n * where anything that consumes the raw binding without going through\n * {@link unpackEnvValue} — the Cloudflare dashboard, a hand-written env\n * read, a queue-name comparison against `MessageBatch.queue` — sees the\n * quoted form and mismatches (#1243). Only ambiguous strings (`\"123\"`,\n * `\"null\"`, JSON documents) keep the pack so the read side can't\n * reinterpret them.\n */\nexport const packEnvValue = (value) => Redacted.isRedacted(value)\n ? JSON.stringify({\n _tag: \"Redacted\",\n value: Redacted.value(value),\n })\n : typeof value === \"string\" && !parsesAsJson(value)\n ? value\n : JSON.stringify(value);\n/**\n * Like {@link packEnvValue}, but a `Redacted` input keeps its `Redacted`\n * wrapper on the *outside* of the packed string, so deploy-time code can\n * route secrets through a dedicated channel (Cloudflare `secret_text`,\n * Secrets Store) instead of leaking them as plain env vars. The inner\n * payload still carries the marker for the runtime `get` accessor.\n */\nexport const packEnvValueKeepRedacted = (value) => Redacted.isRedacted(value)\n ? Redacted.make(packEnvValue(value))\n : packEnvValue(value);\n/**\n * Parse an env-var string produced by {@link packEnvValue} back into its\n * value: rebuild `Redacted` from the marker, return other JSON values\n * as-is, and fall back to the raw string for non-JSON input (a verbatim\n * string from `packEnvValue`, or an env var the user set directly).\n * `undefined` passes through.\n *\n * Runtime `get` accessors MUST feed this from the raw environment\n * (`process.env[key]` / the platform env object) — never through\n * `Config.string`: the ambient runtime `ConfigProvider` reifies bound\n * values (unwrapping the marker before it could be detected here), and\n * during init the ambient provider is the interceptor installed in\n * `Platform.ts`, whose runtime branch calls back into `ctx.get(key)` —\n * resolving through `Config` would re-enter it for the same key and\n * recurse forever.\n */\nexport const unpackEnvValue = (raw) => {\n if (raw === undefined) {\n return undefined;\n }\n try {\n const parsed = JSON.parse(raw);\n if (isRedactedMarker(parsed)) {\n return Redacted.make(parsed.value);\n }\n return parsed;\n }\n catch {\n return raw; // assume it's just a string\n }\n};\n/**\n * Context of the runtime environment.\n *\n * E.g. the context of a running Worker, Task, Process, Function\n */\nexport class RuntimeContext extends Context.Service()(\"RuntimeContext\") {\n static phantom = Layer.empty;\n}\nexport const CurrentRuntimeContext = Effect.serviceOption(RuntimeContext).pipe(Effect.map(Option.getOrUndefined));\n//# sourceMappingURL=RuntimeContext.js.map","import * as Context from \"effect/Context\";\nexport class Stage extends Context.Service()(\"Stage\") {\n}\n//# sourceMappingURL=Stage.js.map","import * as Context from \"effect/Context\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nexport const isActionState = (s) => !!s && s.kind === \"action\";\nexport const isResourceState = (s) => !!s && s.kind !== \"task\";\nexport class StateStoreError extends Data.TaggedError(\"StateStoreError\") {\n}\nexport class State extends Context.Service()(\"alchemy/State\") {\n}\n//# sourceMappingURL=State.js.map","import * as Predicate from \"effect/Predicate\";\nimport * as EffectRecord from \"effect/Record\";\nimport * as Redacted from \"effect/Redacted\";\nexport const isPrimitive = (value) => value === undefined ||\n value === null ||\n typeof value === \"boolean\" ||\n typeof value === \"number\" ||\n typeof value === \"string\" ||\n typeof value === \"symbol\" ||\n typeof value === \"bigint\";\nexport const isPlainObject = (value) => {\n if (!Predicate.isObject(value))\n return false;\n return Object.getPrototypeOf(value) === Object.prototype;\n};\n/**\n * Is `value` plain data the engine's deep walkers may traverse — an array,\n * or an object whose prototype is `Object.prototype`/`null`?\n *\n * Everything else (class instances: effect's Effect/Layer/Context, Dates,\n * SDK config objects, functions, ...) is a LEAF for every deep walker in\n * the engine. The engine cannot meaningfully evaluate, diff, or persist\n * *through* a foreign class instance — rebuilding one entry-by-entry strips\n * its prototype — and walking one is not safe: effect ≥4.0.0-beta.103's\n * Context is self-referential (`cacheRoot` points back at itself), which\n * sent the naive walk-everything traversal into unbounded recursion\n * (#1082). Resources and Outputs are detected structurally *before* this\n * gate, so dependencies declared in plain props are unaffected.\n */\nexport const isPlainData = (value) => {\n if (Array.isArray(value))\n return true;\n if (typeof value !== \"object\" || value === null)\n return false;\n const proto = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n};\n/**\n * Rebuild a plain-data value by mapping each child through `walk`,\n * preserving the shape (array → array, object → object).\n *\n * Cycle-guarded by ancestor path: a value that appears on its own ancestor\n * chain is a true cycle and becomes `undefined` (it could never serialize\n * or persist anyway). The guard is scoped to the current path — NOT a\n * visited-set — so a diamond (the same object legitimately referenced from\n * two places) is rebuilt in both places. Sync DFS only: add/delete around\n * the recursion is race-free. (#1082)\n */\nexport const mapPlainData = (value, ancestors, walk) => {\n if (ancestors.has(value))\n return undefined;\n ancestors.add(value);\n try {\n return Array.isArray(value)\n ? value.map(walk)\n : Object.fromEntries(Object.entries(value).map(([key, child]) => [key, walk(child)]));\n }\n finally {\n ancestors.delete(value);\n }\n};\nexport const stripFields = (value, empty) => {\n if (Array.isArray(value)) {\n return value.map((item) => stripFields(item, empty));\n }\n if (!isPlainObject(value))\n return value;\n return EffectRecord.map(EffectRecord.filter(value, (entry) => entry !== empty), (entry) => stripFields(entry, empty));\n};\nexport const stripNullFields = (value) => stripFields(value, null);\nexport const stripUndefinedFields = (value) => stripFields(value, undefined);\nexport const unwrapRedacted = (value) => {\n if (Redacted.isRedacted(value)) {\n return Redacted.value(value);\n }\n if (Array.isArray(value)) {\n return value.map(unwrapRedacted);\n }\n if (!isPlainObject(value))\n return value;\n return EffectRecord.map(value, unwrapRedacted);\n};\n//# sourceMappingURL=data.js.map","import * as Config from \"effect/Config\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport { pipe } from \"effect/Function\";\nimport { SingleShotGen } from \"effect/Utils\";\nimport { getRefMetadata, isRef } from \"./Ref.js\";\nimport { isResource } from \"./Resource.js\";\nimport { RuntimeContext, sanitizeKey } from \"./RuntimeContext.js\";\nimport { Stack } from \"./Stack.js\";\nimport { Stage } from \"./Stage.js\";\nimport * as State from \"./State/State.js\";\nimport { isPlainData, isPrimitive } from \"./Util/data.js\";\nconst inspect = Symbol.for(\"nodejs.util.inspect.custom\");\nexport const of = (resource) => {\n if (isRef(resource)) {\n const metadata = getRefMetadata(resource);\n return new RefExpr(metadata.stack, metadata.stage, metadata.id, \n // Surface the target's resource type and logical id as\n // statically-known properties so duck-typing classifiers (Worker\n // env bindings) and label/bind templates (`${resource.LogicalId}`,\n // `host.bind\\`...\\``) identify the ref exactly like a\n // locally-declared resource.\n {\n LogicalId: metadata.id,\n ...(metadata.type !== undefined ? { Type: metadata.type } : {}),\n });\n }\n return new ResourceExpr(resource);\n};\nexport const asOutput = (t) => isOutput(t)\n ? t\n : Effect.isEffect(t)\n ? new EffectExpr(VoidExpr, () => t)\n : new LiteralExpr(t);\n/**\n * Lift a plan-time Effect into an {@link Output}.\n *\n * The effect runs when the stack resolves the Output during plan/deploy —\n * with the stack's services (cloud credentials, region, ...) provided — and\n * never inside a deployed runtime: constructing the Output is inert, so\n * helpers built on `fromEffect` (e.g. AMI lookups) are safe to call from\n * composition code that is re-executed inside a Function/Worker/Instance\n * bundle.\n *\n * The effect must not fail (`E = never`) — die with a descriptive error for\n * unresolvable lookups.\n */\nexport const fromEffect = (effect) => new EffectExpr(VoidExpr, () => effect);\nexport const isOutput = (value) => value &&\n (typeof value === \"object\" || typeof value === \"function\") &&\n ExprSymbol in value;\nexport const ExprSymbol = Symbol.for(\"alchemy/Expr\");\nconst exprKind = (node) => node?.[ExprSymbol]?.kind ?? node?.kind;\nexport const isExpr = (value) => value &&\n (typeof value === \"object\" || typeof value === \"function\") &&\n ExprSymbol in value;\nexport class BaseExpr {\n // we use a kind tag instead of instanceof to protect ourselves from duplicate alchemy module imports\n constructor() { }\n as() {\n return this;\n }\n [Symbol.iterator]() {\n // @ts-expect-error - TODO(sam): fix this (works at runtime, but maybe indicates a bad assumption)\n return new SingleShotGen(this.asEffect());\n }\n asEffect() {\n return this.bind(this.toString());\n }\n bind(id) {\n // `set`/`get` store keys verbatim, so canonicalize here (the caller's job).\n const key = sanitizeKey(id);\n return RuntimeContext.pipe(Effect.flatMap((ctx) => Effect.map(ctx.set(key, this), (k) => ctx.get(k))));\n }\n pipe(...fns) {\n // @ts-expect-error\n return pipe(this, ...fns);\n }\n toString() {\n return this[inspect]();\n }\n}\nexport const isResourceExpr = (node) => exprKind(node) === \"ResourceExpr\";\nexport class ResourceExpr extends BaseExpr {\n src;\n stables;\n kind = \"ResourceExpr\";\n constructor(src, stables) {\n super();\n this.src = src;\n this.stables = stables;\n return proxy(this);\n }\n [inspect]() {\n return this.src.LogicalId;\n }\n}\nexport const isPropExpr = (node) => exprKind(node) === \"PropExpr\";\nexport class PropExpr extends BaseExpr {\n expr;\n identifier;\n kind = \"PropExpr\";\n constructor(expr, identifier) {\n super();\n this.expr = expr;\n this.identifier = identifier;\n return proxy(this);\n }\n [inspect]() {\n return `${this.expr[inspect]()}.${this.identifier.toString()}`;\n }\n}\nexport const literal = (value) => new LiteralExpr(value);\nexport const isLiteralExpr = (node) => exprKind(node) === \"LiteralExpr\";\nexport class LiteralExpr extends BaseExpr {\n value;\n kind = \"LiteralExpr\";\n constructor(value) {\n super();\n this.value = value;\n return proxy(this);\n }\n [inspect]() {\n return String(this.value);\n }\n}\nexport const VoidExpr = new LiteralExpr(void 0);\nexport const map = ((...args) => args.length === 1\n ? (output) => new ApplyExpr(output, args[0])\n : new ApplyExpr(args[0], args[1]));\n//Output.ApplyExpr<any, any, ResourceLike, any>\nexport const isApplyExpr = (node) => exprKind(node) === \"ApplyExpr\";\nexport class ApplyExpr extends BaseExpr {\n expr;\n f;\n kind = \"ApplyExpr\";\n constructor(expr, f) {\n super();\n this.expr = expr;\n this.f = f;\n return proxy(this);\n }\n [inspect]() {\n return `${this.expr[inspect]()}.map(${this.f.toString()})`;\n }\n}\nexport const mapEffect = (fn) => (output) => new EffectExpr(output, fn);\nexport const flatMap = ((...args) => args.length === 1\n ? (output) => new FlatMapExpr(output, args[0])\n : new FlatMapExpr(args[0], args[1]));\nexport const isFlatMapExpr = (node) => exprKind(node) === \"FlatMapExpr\";\nexport class FlatMapExpr extends BaseExpr {\n expr;\n f;\n kind = \"FlatMapExpr\";\n constructor(expr, f) {\n super();\n this.expr = expr;\n this.f = f;\n return proxy(this);\n }\n [inspect]() {\n return `${this.expr[inspect]()}.flatMap(${this.f.toString()})`;\n }\n}\nexport const isEffectExpr = (node) => exprKind(node) === \"EffectExpr\";\nexport class EffectExpr extends BaseExpr {\n expr;\n f;\n kind = \"EffectExpr\";\n constructor(expr, f) {\n super();\n this.expr = expr;\n this.f = f;\n return proxy(this);\n }\n [inspect]() {\n return `${this.expr[inspect]()}.mapEffect(${this.f.toString()})`;\n }\n}\nexport const isNamedExpr = (node) => exprKind(node) === \"NamedExpr\";\n/**\n * Wraps another `Expr` and overrides its `toString()` / inspect output.\n *\n * `BaseExpr` derives the binding id from `this.toString()`, so\n * wrapping an expression in `NamedExpr` makes that derived id stable and\n * caller-controlled (e.g. an env var name like `\"API_KEY\"`).\n */\nexport class NamedExpr extends BaseExpr {\n expr;\n bindingName;\n kind = \"NamedExpr\";\n constructor(expr, bindingName) {\n super();\n this.expr = expr;\n this.bindingName = bindingName;\n return proxy(this);\n }\n [inspect]() {\n return this.bindingName;\n }\n}\nexport const named = (expr, name) => new NamedExpr(expr, name);\nexport const all = (...outs) => new AllExpr(outs);\nexport const isAllExpr = (node) => exprKind(node) === \"AllExpr\";\nexport class AllExpr extends BaseExpr {\n outs;\n kind = \"AllExpr\";\n constructor(outs) {\n super();\n this.outs = outs;\n return proxy(this);\n }\n [inspect]() {\n return `all(${this.outs.map((out) => out[inspect]()).join(\", \")})`;\n }\n}\nexport const isRefExpr = (node) => exprKind(node) === \"RefExpr\";\nexport class RefExpr extends BaseExpr {\n stack;\n stage;\n resourceId;\n stables;\n kind = \"RefExpr\";\n constructor(stack, stage, resourceId, \n /**\n * Statically-known properties of the ref's target (currently its\n * resource `Type`), served as literals by the proxy instead of\n * `PropExpr`s — mirrors {@link ResourceExpr}'s `stables`.\n */\n stables) {\n super();\n this.stack = stack;\n this.stage = stage;\n this.resourceId = resourceId;\n this.stables = stables;\n return proxy(this);\n }\n [inspect]() {\n return `ref(${this.resourceId}, { stack: ${this.stack}, stage: ${this.stage} })`;\n }\n}\nexport const isStackRefExpr = (node) => exprKind(node) === \"StackRefExpr\";\n/**\n * A reference to the persisted output of a Stack at `(stack, stage)`.\n *\n * Resolved at evaluation time by reading `state.getOutput({ stack,\n * stage })`. Distinct from {@link RefExpr}, which references a\n * single resource's attributes within a stack/stage. `stage` may be\n * `undefined`, in which case it falls back to the current stage.\n */\nexport class StackRefExpr extends BaseExpr {\n stack;\n stage;\n kind = \"StackRefExpr\";\n constructor(stack, stage) {\n super();\n this.stack = stack;\n this.stage = stage;\n return proxy(this);\n }\n [inspect]() {\n return `stackRef(${this.stack}${this.stage ? `, { stage: ${this.stage} }` : \"\"})`;\n }\n}\n/**\n * Build an `Output<A>` referencing the persisted output of another\n * Stack. The returned Effect resolves to a lazy `Output<A>` whose\n * value is read from the state store at plan/apply time.\n *\n * Returns `Effect<Output<A>>` (not `Output<A>` directly) so that\n * `yield* Output.stackRef(...)` reads ergonomically inside an Effect\n * generator and lines up with `Resource.ref` and `Stack.stage.<name>`.\n */\nexport const stackRef = (stack, options = {}) => Effect.succeed(new StackRefExpr(stack, options.stage));\nexport const filter = (...outs) => outs.filter(isOutput);\nexport const interpolate = (template, ...args) => all(...args.map((arg) => (isOutput(arg) ? arg : literal(arg)))).pipe(map((args) => template\n .map((str, i) => str + (args[i] == null ? \"\" : String(args[i])))\n .join(\"\")));\nfunction proxy(self) {\n const target = Object.assign(() => { }, self);\n if (inspect in self) {\n Object.defineProperty(target, inspect, {\n value: self[inspect].bind(self),\n configurable: true,\n });\n }\n const proxy = new Proxy(target, {\n has: (_, prop) => prop === ExprSymbol || prop === inspect\n ? true\n : // Statically-known literal props (`Type`, `LogicalId` on\n // resource/ref exprs) are visible to `in` checks so duck-typing\n // code paths (e.g. `\"LogicalId\" in arg`) treat them like real\n // properties, matching what `get` serves.\n ((isResourceExpr(self) || isRefExpr(self)) &&\n self.stables !== undefined &&\n prop in self.stables) ||\n prop in self,\n get: (target, prop) => prop === Symbol.toPrimitive\n ? (hint) => {\n // Any JS-level coercion of an unresolved Output produces a\n // placeholder that *looks* like a real value but isn't:\n //\n // - `string` / `default` hints (`${output}`, `output + \"\"`,\n // `==` against a primitive) previously fell through to\n // `self.toString()` and returned the inspect form\n // (e.g. \"tunnel.tunnelId\"). The bogus string flowed\n // into resource props and into the cloud — only\n // surfacing as an opaque downstream error (see PR\n // description for a real Cloudflare DNS landing).\n //\n // - `number` hint (`+output`, `output * 2`,\n // `Math.max(0, output)`) previously returned NaN, which\n // propagates silently through arithmetic and lands as\n // \"the API rejected a NaN field\" much later.\n //\n // All three hints fail loud at the coercion site with a\n // pointer to the right composition API.\n throw new Error(`Cannot coerce Output<${self[inspect]()}> to a ` +\n `${hint === \"number\" ? \"number\" : \"string\"} via JS coercion. ` +\n `Use Output.interpolate\\`...\\` or Output.map(output, fn) ` +\n `to compose Outputs — the value isn't known until deploy time.`);\n }\n : prop === ExprSymbol\n ? self\n : prop === inspect\n ? target[inspect]\n : (isResourceExpr(self) || isRefExpr(self)) &&\n self.stables &&\n prop in self.stables\n ? self.stables[prop]\n : prop in self\n ? typeof self[prop] === \"function\" &&\n !(\"kind\" in self)\n ? new PropExpr(proxy, prop)\n : self[prop]\n : new PropExpr(proxy, prop),\n apply: (_, thisArg, args) => {\n if (isPropExpr(self)) {\n // Method-style combinators on an Output proxy. `map`/`apply` and\n // `mapEffect`/`effect` are aliases that mirror the standalone\n // `Output.map` / `Output.mapEffect` / `Output.flatMap` functions.\n if (self.identifier === \"map\" || self.identifier === \"apply\") {\n return new ApplyExpr(self.expr, args[0]);\n }\n else if (self.identifier === \"mapEffect\" ||\n self.identifier === \"effect\") {\n return new EffectExpr(self.expr, args[0]);\n }\n else if (self.identifier === \"flatMap\") {\n return new FlatMapExpr(self.expr, args[0]);\n }\n }\n return undefined;\n },\n });\n return proxy;\n}\n/// Evaluation\nexport class MissingSourceError extends Data.TaggedError(\"MissingSourceError\") {\n}\nexport class InvalidReferenceError extends Data.TaggedError(\"InvalidReferenceError\") {\n}\nexport const evaluate = (expr, upstream, ancestors = new Set()) => Effect.gen(function* () {\n if (isResource(expr)) {\n const srcId = expr.FQN;\n const src = upstream[srcId];\n if (!src) {\n // type-safety should prevent this but let the caller decide how to handle it\n return yield* new MissingSourceError({\n message: `Source ${srcId} not found`,\n srcId,\n });\n }\n return src;\n }\n else if (isOutput(expr)) {\n if (isResourceExpr(expr)) {\n const srcId = expr.src.FQN;\n const src = upstream[srcId];\n if (!src) {\n // type-safety should prevent this but let the caller decide how to handle it\n return yield* new MissingSourceError({\n message: `Source ${srcId} not found`,\n srcId,\n });\n }\n return src;\n }\n else if (isLiteralExpr(expr)) {\n return expr.value;\n }\n else if (isApplyExpr(expr)) {\n return expr.f(yield* evaluate(expr.expr, upstream));\n }\n else if (isEffectExpr(expr)) {\n // TODO(sam): the same effect shoudl be memoized so that it's not run multiple times\n return yield* expr.f(yield* evaluate(expr.expr, upstream));\n }\n else if (isFlatMapExpr(expr)) {\n // Resolve the source, hand it to `f` to produce a new Output, then\n // recursively evaluate that Output (flattening one level).\n const value = yield* evaluate(expr.expr, upstream);\n return yield* evaluate(expr.f(value), upstream);\n }\n else if (isAllExpr(expr)) {\n return yield* Effect.all(expr.outs.map((out) => evaluate(out, upstream)));\n }\n else if (isPropExpr(expr)) {\n return (yield* evaluate(expr.expr, upstream))?.[expr.identifier];\n }\n else if (isNamedExpr(expr)) {\n return yield* evaluate(expr.expr, upstream);\n }\n else if (isRefExpr(expr)) {\n const state = yield* yield* State.State;\n const stack = expr.stack ?? (yield* Stack).name;\n const stage = expr.stage ?? (yield* Stage);\n const resource = yield* state.get({\n stack,\n stage,\n fqn: expr.resourceId,\n });\n if (!resource) {\n return yield* Effect.fail(new InvalidReferenceError({\n message: `Reference to '${expr.resourceId}' in stack '${stack}' and stage '${stage}' not found. Have you deployed '${stage}' or '${stack}'?`,\n stack,\n stage,\n resourceId: expr.resourceId,\n }));\n }\n // RefExpr targets persisted resources; tasks aren't cross-stack\n // referenceable. Return the resource's output attrs, otherwise the\n // task's output value, otherwise undefined.\n return resource.attr ?? resource.output;\n }\n else if (isStackRefExpr(expr)) {\n const state = yield* yield* State.State;\n const stack = expr.stack;\n const stage = expr.stage ?? (yield* Stage);\n const output = yield* state.getOutput({ stack, stage });\n if (output == null) {\n return yield* Effect.fail(new InvalidReferenceError({\n message: `Reference to stack '${stack}' at stage '${stage}' not found. Have you deployed stage '${stage}' of '${stack}'?`,\n stack,\n stage,\n resourceId: stack,\n }));\n }\n return output;\n }\n }\n if (Config.isConfig(expr)) {\n // Resolve Config against the deploy environment — see resolveInput in\n // Plan.ts for rationale. `Config.redacted` resolves to a `Redacted`,\n // which stays opaque via the leaf fallthrough below.\n return yield* evaluate(yield* expr, upstream, ancestors);\n }\n else if (isPlainData(expr)) {\n if (ancestors.has(expr)) {\n return undefined;\n }\n const nested = new Set(ancestors).add(expr);\n if (Array.isArray(expr)) {\n return yield* Effect.all(expr.map((item) => evaluate(item, upstream, nested)));\n }\n return Object.fromEntries(yield* Effect.all(Object.entries(expr).map(([key, value]) => evaluate(value, upstream, nested).pipe(Effect.map((value) => [key, value])))));\n }\n // Everything else is a leaf returned by identity: Duration, Redacted,\n // Date, and effect runtime values (a Worker's `exports` carries each\n // DO's `constructor` Effect and captured `services` Context). Rebuilding\n // a class instance entry-by-entry strips its prototype, and effect\n // ≥4.0.0-beta.103's Context is cyclic (#1082). This sits after\n // `Config.isConfig` on purpose — Configs are Effects but must resolve.\n return expr;\n});\nexport const hasOutputs = (value) => Object.keys(upstreamAny(value)).length > 0;\n/**\n * Cycle guard shared by the upstream walkers. Marks `value` as visited in\n * `seen`; returns true when it was already visited (the caller returns `{}`\n * — the first visit already contributed the subtree's resources to the\n * FQN-keyed union, so skipping repeats is lossless).\n */\nconst alreadySeen = (value, seen) => {\n if (seen.has(value)) {\n return true;\n }\n seen.add(value);\n return false;\n};\n// The dependency rule (#1082): a Resource or Output IS a dependency; plain\n// data (arrays, plain objects) is traversed to find them; every other value\n// — class instances like effect's Effect/Layer/Context, Dates, SDK objects,\n// functions — is a leaf. See `isPlainData` in Util/data.ts for why leaves\n// must never be walked.\nexport const upstreamAny = (value, seen = new WeakSet()) => {\n if (isResource(value)) {\n return { [value.FQN]: value };\n }\n else if (isExpr(value)) {\n return upstream(value, seen);\n }\n else if (isPlainData(value)) {\n if (alreadySeen(value, seen)) {\n return {};\n }\n return Object.assign({}, ...Object.values(value).map((value) => resolveUpstream(value, seen)));\n }\n return {};\n};\n// TODO(sam): add a type\nexport const upstream = (expr, seen = new WeakSet()) => {\n if (isResource(expr)) {\n return {\n [expr.FQN]: expr,\n };\n }\n else if (isResourceExpr(expr)) {\n return {\n [expr.src.FQN]: expr.src,\n };\n }\n else if (isPropExpr(expr)) {\n return upstream(expr.expr, seen);\n }\n else if (isAllExpr(expr)) {\n return Object.assign({}, ...expr.outs.map((out) => upstream(out, seen)));\n }\n else if (isEffectExpr(expr) ||\n isApplyExpr(expr) ||\n isFlatMapExpr(expr) ||\n isNamedExpr(expr)) {\n return upstream(expr.expr, seen);\n }\n else if (isPlainData(expr)) {\n if (alreadySeen(expr, seen)) {\n return {};\n }\n return Object.values(expr)\n .map((v) => upstream(v, seen))\n .reduce(toObject, {});\n }\n return {};\n};\n// TODO(sam): add a type\nexport const resolveUpstream = (value, seen = new WeakSet()) => {\n if (isPrimitive(value)) {\n return {};\n }\n else if (isResource(value)) {\n return { [value.FQN]: value };\n }\n else if (isOutput(value)) {\n return upstream(value, seen);\n }\n else if (isPlainData(value)) {\n if (alreadySeen(value, seen)) {\n return {};\n }\n return Object.fromEntries(Object.values(value)\n .map((v) => resolveUpstream(v, seen))\n .flatMap(Object.entries));\n }\n return {};\n};\nconst toObject = (acc, v) => ({\n ...acc,\n ...v,\n});\nexport const log = (_value) => Effect.gen(function* () {\n // TODO(sam): implement a log effect\n});\nexport const toEnvKey = (id, suffix) => `${replace(toUpper(id))}_${replace(toUpper(suffix))}`;\nexport const toUpper = (str) => str.toUpperCase();\nconst replace = (str) => str.replace(/-/g, \"_\");\n//# sourceMappingURL=Output.js.map","import * as ConfigProvider from \"effect/ConfigProvider\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Option from \"effect/Option\";\nexport const loadConfigProvider = (envFile) => {\n if (Option.isSome(envFile)) {\n return ConfigProvider.fromDotEnv({ path: envFile.value }).pipe(Effect.map((dotEnv) => ConfigProvider.orElse(dotEnv, ConfigProvider.fromEnv())));\n }\n return Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const exists = yield* fs.exists(\".env\");\n if (!exists) {\n return ConfigProvider.fromEnv();\n }\n return ConfigProvider.orElse(yield* ConfigProvider.fromDotEnv({ path: \".env\" }), ConfigProvider.fromEnv());\n });\n};\n//# sourceMappingURL=ConfigProvider.js.map","import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Effectable from \"effect/Effectable\";\nexport const effectClass = ((impl) => impl === undefined\n ? (innerImpl) => effectClass(innerImpl)\n : Object.assign(class {\n }, \n // Spreading the Effect prototype onto the class (static side) makes the\n // class itself a real Effect — `Effect.isEffect(X)` is true, so\n // `Effect.all([X])` / `Effect.forEach` work — and subclasses\n // (`class Y extends effectClass(impl)`) inherit the protocol statically.\n Effectable.Prototype({\n label: \"alchemy/EffectClass\",\n evaluate: () => impl,\n })));\nexport const taggedFunction = (tag, fn) => {\n // The Proxy below forwards every Effect-protocol key to `tag` (already an\n // Effect), so `asEffect`/`[Symbol.iterator]`/`pipe` need no explicit\n // override — only `toString` diverges.\n const overrides = {\n toString: () => `${tag.toString()}.${fn.name}`,\n };\n return new Proxy(fn, {\n get: (target, prop, receiver) => Reflect.has(overrides, prop)\n ? Reflect.get(overrides, prop, receiver)\n : Reflect.has(target, prop)\n ? Reflect.get(target, prop, receiver)\n : Reflect.get(tag, prop, tag),\n has: (target, prop) => Reflect.has(overrides, prop) ||\n Reflect.has(target, prop) ||\n Reflect.has(tag, prop),\n });\n};\nexport const isYieldableEffect = (value) => Effect.isEffect(value) &&\n typeof value[Symbol.iterator] ===\n \"function\";\nexport const isEffectClassLike = (value) => typeof value === \"function\" &&\n typeof value.asEffect === \"function\";\nexport const isYieldableEffectLike = (value) => (isYieldableEffect(value) || isEffectClassLike(value)) &&\n !(\"~alchemy/Kind\" in value);\nexport const toEffectInterface = (raw) => ({\n raw,\n ...Object.fromEntries(Object.entries(raw).map(([key, value]) => [\n key,\n typeof value === \"function\"\n ? (...args) => Effect.tryPromise(async () => value(...args))\n : value,\n ])),\n});\n//# sourceMappingURL=effect.js.map","import * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Logger from \"effect/Logger\";\nimport { Path } from \"effect/Path\";\nimport { AlchemyContext } from \"../AlchemyContext.js\";\nexport const fileLogger = Effect.fn(function* (...segments) {\n const { dotAlchemy } = yield* AlchemyContext;\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path;\n const logFile = path.join(dotAlchemy, \"log\", ...segments);\n yield* fs.makeDirectory(path.dirname(logFile), { recursive: true });\n return yield* Logger.formatLogFmt.pipe(Logger.toFile(logFile, {\n flag: \"a\",\n }));\n});\n//# sourceMappingURL=FileLogger.js.map","import * as Effect from \"effect/Effect\";\nimport * as NodeNet from \"node:net\";\n/**\n * The process's working directory, captured ONCE at module load.\n *\n * Relative user paths (Vite roots, asset directories) must resolve against\n * this instead of a live `process.cwd()` read: third-party code sharing the\n * process can change the working directory transiently — most notably\n * cross-spawn, which `process.chdir`s into a spawn's `cwd` to resolve its\n * binary on PATH and then chdirs back. A live read racing that window\n * resolves against an unrelated directory. (`State/LocalState.ts` anchors\n * the state tree the same way, for the same reason.)\n */\nexport const initialCwd = process.cwd();\n/**\n * Opt out of cross-spawn's temporary `process.chdir` dance.\n *\n * cross-spawn (bundled inside vite, wrangler, next, tinyexec, playwright,\n * tsx, prisma, …) resolves a spawn's binary by `process.chdir`ing the\n * WHOLE parent process into the spawn's `cwd`, calling `which.sync`, and\n * chdiring back. In an alchemy process — which runs many resource builds\n * and hashers concurrently on one event loop — every fiber that touches a\n * relative path can race that window and resolve against an unrelated\n * directory.\n *\n * `process.chdir.disabled = true` is NODE'S OWN convention: Node sets it\n * on `process.chdir` inside worker threads (where chdir is forbidden),\n * and cross-spawn checks it to skip the dance. Setting it on the main\n * thread opts us into the exact mode every cross-spawn copy already runs\n * in inside jest/vitest/playwright workers daily — not an untested path.\n * The flag is purely advisory: `process.chdir` itself keeps working, and\n * an audit of the dependency tree shows the only readers are bundled\n * cross-spawn copies; nothing else writes or consults it.\n *\n * Behavior delta: a spawn combining a custom `cwd` with a command that is\n * neither absolute nor on PATH (e.g. `./scripts/build.sh`). POSIX still\n * works (cross-spawn falls back to the raw command; the OS resolves it in\n * the child's cwd). On Windows that shape can fail to resolve — the same\n * limitation those tools already have inside worker threads. Everything\n * alchemy and its toolchains spawn is absolute or on PATH, and `Command`\n * resources use effect's ChildProcess (plain spawn, no cross-spawn).\n */\nexport const disableCrossSpawnChdir = () => {\n process.chdir.disabled = true;\n};\nexport const isTransformTypesSupported = (version = process.versions.node) => {\n const [major, minor] = version.split(\".\").map(Number);\n return (major === 22 && minor >= 7) || (major >= 23 && major < 26);\n};\n/**\n * Node CLI flags that transparently transform TypeScript types so `.ts`\n * entry points work the same way they do under Bun. Empty when the running\n * Node doesn't support (or no longer needs) the experimental flag.\n */\nexport const transformTypesFlags = (version = process.versions.node) => isTransformTypesSupported(version)\n ? [\"--experimental-transform-types\", \"--no-warnings=ExperimentalWarning\"]\n : [];\n/**\n * Ask the OS for an unused TCP port, release it, and return its number.\n *\n * The port is only available, not reserved: another process can claim it\n * before the caller binds. Callers should keep the gap short and still handle\n * `EADDRINUSE`.\n */\nexport const findAvailablePort = (host = \"127.0.0.1\") => Effect.callback((resume) => {\n const server = NodeNet.createServer();\n server.unref();\n server.once(\"error\", (error) => resume(Effect.fail(error)));\n server.listen(0, host, () => {\n const address = server.address();\n const port = typeof address === \"object\" && address !== null\n ? address.port\n : undefined;\n server.close((error) => {\n if (error) {\n resume(Effect.fail(error));\n }\n else if (port !== undefined) {\n resume(Effect.succeed(port));\n }\n else {\n resume(Effect.fail(new Error(\"Failed to allocate an available port\")));\n }\n });\n });\n});\n//# sourceMappingURL=Node.js.map","import * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { defaultTeardown } from \"effect/Runtime\";\nimport { disableCrossSpawnChdir } from \"./Node.js\";\nconst isBun = typeof Bun !== \"undefined\";\nconst importPlatformPeer = (peerDependency, load) => load().catch(() => {\n console.error([\n `Alchemy could not load the required peer dependency \"${peerDependency}\".`,\n `Install a compatible version of \"${peerDependency}\" in the same project as \"alchemy\".`,\n \"If it is already installed, you may be running a globally installed Alchemy CLI; run the project-local CLI instead.\",\n ].join(\"\\n\"));\n process.exit(1);\n});\n/**\n * Constructs a layer with different implementations for Bun and Node.\n */\nexport const platformLayer = (constructors) => Layer.unwrap(Effect.promise(async () => {\n if (isBun) {\n return await constructors.bun();\n }\n else {\n return await constructors.node();\n }\n}));\nexport const PlatformServices = platformLayer({\n bun: async () => {\n const [BunServices, BunSocket] = await Promise.all([\n importPlatformPeer(\"@effect/platform-bun\", () => import(\"@effect/platform-bun/BunServices\")),\n importPlatformPeer(\"@effect/platform-bun\", () => import(\"@effect/platform-bun/BunSocket\")),\n ]);\n return Layer.merge(BunServices.layer, BunSocket.layerWebSocketConstructor);\n },\n node: async () => {\n const [NodeServices, NodeSocket] = await Promise.all([\n importPlatformPeer(\"@effect/platform-node\", () => import(\"@effect/platform-node/NodeServices\")),\n importPlatformPeer(\"@effect/platform-node\", () => import(\"@effect/platform-node/NodeSocket\")),\n ]);\n return Layer.merge(NodeServices.layer, NodeSocket.layerWebSocketConstructor);\n },\n});\n/**\n * ALWAYS exit once the main effect completes. The platform `runMain` default\n * only force-exits on failure or signal interruption — a *successful*\n * `alchemy deploy`/`destroy` otherwise lingers for ~100 seconds after \"Done\"\n * while keep-alive sockets (Cloudflare API agents, provider sidecar handles)\n * pin the event loop until the remote side closes them. All Effect finalizers\n * have already run by the time teardown is invoked; the macrotask hop lets\n * any buffered stdout drain before the process exits.\n */\nconst exitingTeardown = (exit, onExit) => {\n defaultTeardown(exit, (code) => {\n const finalCode = code !== 0 ? code : Number(process.exitCode ?? 0) || 0;\n setTimeout(() => process.exit(finalCode), 0);\n onExit(finalCode);\n });\n};\nexport const runMain = (effect, options) => {\n // Every alchemy process (CLI, exec child, sidecar, build/dev runners)\n // runs concurrent effects that depend on a stable working directory —\n // forbid cross-spawn's transient process-wide chdir (see Util/Node.ts).\n disableCrossSpawnChdir();\n const opts = {\n ...options,\n teardown: options?.teardown ?? exitingTeardown,\n };\n if (isBun) {\n void importPlatformPeer(\"@effect/platform-bun\", () => import(\"@effect/platform-bun/BunRuntime\")).then((BunRuntime) => BunRuntime.runMain(effect, opts));\n }\n else {\n void importPlatformPeer(\"@effect/platform-node\", () => import(\"@effect/platform-node/NodeRuntime\")).then((NodeRuntime) => NodeRuntime.runMain(effect, opts));\n }\n};\nexport const httpServer = (port = 0, host = \"127.0.0.1\") => platformLayer({\n bun: async () => {\n const BunHttpServer = await importPlatformPeer(\"@effect/platform-bun\", () => import(\"@effect/platform-bun/BunHttpServer\"));\n // `idleTimeout: 0` disables Bun's default 10s request idle timeout.\n // The RPC spawner serves a long-lived `/logs` stream (sidecar output\n // forwarded to the exec child's renderer) that can legitimately sit\n // idle between lines; Bun would otherwise sever it mid-session.\n return BunHttpServer.layer({ hostname: host, port, idleTimeout: 0 });\n },\n node: async () => {\n const [NodeHttpServer, Http] = await Promise.all([\n importPlatformPeer(\"@effect/platform-node\", () => import(\"@effect/platform-node/NodeHttpServer\")),\n import(\"node:http\"),\n ]);\n return NodeHttpServer.layerServer(Http.createServer, { host, port });\n },\n});\n//# sourceMappingURL=PlatformServices.js.map","import { ConfigProvider } from \"effect/ConfigProvider\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport { FileSystem } from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport * as Logger from \"effect/Logger\";\nimport * as Option from \"effect/Option\";\nimport { Path } from \"effect/Path\";\nimport * as Scope from \"effect/Scope\";\nimport * as FetchHttpClient from \"effect/unstable/http/FetchHttpClient\";\nimport { AlchemyContext, AlchemyContextLive } from \"./AlchemyContext.js\";\nimport { provideFreshArtifactStore } from \"./Artifacts.js\";\nimport { AuthProviders } from \"./Auth/AuthProvider.js\";\nimport { CredentialsStore, CredentialsStoreLive } from \"./Auth/Credentials.js\";\nimport { AlchemyProfile, ProfileLive } from \"./Auth/Profile.js\";\nimport { Cli } from \"./Cli/Cli.js\";\nimport * as Output from \"./Output.js\";\nimport { Stage } from \"./Stage.js\";\nimport { loadConfigProvider } from \"./Util/ConfigProvider.js\";\nimport { effectClass, taggedFunction } from \"./Util/effect.js\";\nimport { fileLogger } from \"./Util/FileLogger.js\";\nimport { PlatformServices } from \"./Util/PlatformServices.js\";\nexport const Stack = Object.assign(taggedFunction(Context.Service()(\"Stack\"), (stackName, options, eff) => {\n if (!stackName) {\n return (stackName) => Object.assign(\n // by default, reference the stack at the \"current\" stage of the importer\n Output.stackRef(stackName).pipe(effectClass), {\n stackName,\n stage: createStageProxy(stackName),\n state: options?.state,\n providers: options?.providers,\n make: (options, eff) => \n // @ts-expect-error\n Stack(stackName, options, eff),\n });\n }\n return eff.pipe(\n // @ts-expect-error\n make({\n name: stackName,\n ...options,\n }), (eff) => Object.assign(eff, {\n stackName,\n stage: createStageProxy(stackName),\n state: options?.state,\n providers: options?.providers,\n }));\n}));\nconst createStageProxy = (stackName) => new Proxy({}, {\n get: (_, stage) => Output.stackRef(stackName, { stage }),\n});\nexport const StackName = Stack.use((stack) => Effect.succeed(stack.name));\nexport const make = (options) => (effect) => Effect.scope.pipe(Effect.flatMap((scope) => {\n if (options.state == null) {\n return Effect.die(new Error(`Stack \"${options.name}\" is missing a state store. ` +\n `Add a \\`state\\` layer to the stack options, e.g.:\\n` +\n ` Alchemy.Stack(\"${options.name}\", {\\n` +\n ` providers: Cloudflare.providers(),\\n` +\n ` state: Cloudflare.state(), // <-- required\\n` +\n ` }, ...)\\n` +\n `See https://alchemy.run/state-store for available state stores.`));\n }\n if (options.providers == null) {\n return Effect.die(new Error(`Stack \"${options.name}\" is missing a providers layer. ` +\n `Add a \\`providers\\` layer to the stack options, e.g.:\\n` +\n ` Alchemy.Stack(\"${options.name}\", {\\n` +\n ` providers: Cloudflare.providers(), // <-- required\\n` +\n ` state: Cloudflare.state(),\\n` +\n ` }, ...)`));\n }\n return options.providers.pipe(Layer.provideMerge(options.state), Layer.provideMerge(Layer.effect(Stack, Stage.pipe(Effect.map((stage) => options.stack ?? {\n name: options.name,\n stage,\n resources: {},\n bindings: {},\n actions: {},\n })))), Layer.buildWithScope(scope));\n}), Effect.flatMap((context) => Effect.all([\n effect,\n Stack,\n Effect.context(),\n]).pipe(Effect.map(([output, stack, services]) => ({\n ...stack,\n output,\n services: Context.merge(services, context),\n})), Effect.provideContext(context))));\nexport const CurrentStack = Effect.serviceOption(Stack)\n .pipe(Effect.map(Option.getOrUndefined));\nconst platform = Layer.mergeAll(PlatformServices, FetchHttpClient.layer, Logger.layer([fileLogger(\"out\")], { mergeWithExisting: true }), Layer.provide(ProfileLive, PlatformServices), Layer.provide(CredentialsStoreLive, PlatformServices));\n// override alchemy state store, CLI/reporting, state, and Config\nconst alchemy = (overrides) => Layer.mergeAll(\n// CLI.inkCLI(),\n// optional\noverrides?.dev\n ? Layer.provide(Layer.effect(AlchemyContext, AlchemyContext.useSync((ctx) => ({ ...ctx, dev: overrides.dev }))), AlchemyContextLive)\n : AlchemyContextLive);\nexport const evalStack = (effect, fn, options) => {\n const body = Effect.gen(function* () {\n const stack = yield* effect;\n const configProvider = yield* loadConfigProvider(Option.none());\n return yield* fn(stack).pipe(provideFreshArtifactStore, Effect.provide(Layer.succeedContext(stack.services).pipe(Layer.provideMerge(Layer.succeed(ConfigProvider, configProvider)))));\n }).pipe(Effect.provide(Layer.effect(AuthProviders, Effect.serviceOption(AuthProviders).pipe(Effect.map(Option.getOrElse(() => ({}))))).pipe(Layer.provideMerge(Layer.succeed(Stage, options.stage)), Layer.provideMerge(Layer.provideMerge(alchemy({ dev: options.dev }), platform)))));\n return options.scope === undefined\n ? Effect.scoped(body)\n : Scope.provide(body, options.scope);\n};\n//# sourceMappingURL=Stack.js.map","import * as Duration from \"effect/Duration\";\nimport * as Redacted from \"effect/Redacted\";\nimport { isResource } from \"../Resource.js\";\n/**\n * JSON marker used to tag a `Redacted<T>` value when writing state.\n * The reviver recognises objects with exactly this key and rebuilds\n * the `Redacted` wrapper on read.\n */\nexport const REDACTED_MARKER = \"__redacted__\";\n/**\n * JSON marker used to tag a `Duration` value when writing state.\n * The reviver recognises objects with exactly this key and rebuilds\n * a real `Duration` instance on read so that downstream code can call\n * `Duration.toSeconds`, `Duration.toMillis`, etc. without first\n * decoding `Duration.toJSON`'s `{_id,_tag,...}` shape.\n */\nexport const DURATION_MARKER = \"__duration__\";\n/**\n * JSON marker used to tag a `Date` value when writing state. The reviver\n * recognises objects with exactly this key and rebuilds a real `Date`\n * instance on read, so a Date-typed prop read back out of persisted state\n * (`olds` in provider `diff`/`delete`/`read`) is a `Date` again — not the\n * bare ISO string `JSON.stringify` would otherwise leave behind.\n */\nexport const DATE_MARKER = \"__date__\";\nconst decodeDate = (encoded) => {\n if (typeof encoded !== \"string\")\n return undefined;\n const date = new Date(encoded);\n return Number.isNaN(date.getTime()) ? undefined : date;\n};\n/**\n * Rebuild a {@link Duration.Duration} from `Duration.toJSON`'s\n * `{_id,_tag,millis?,nanos?}` shape. Shared by state persistence and the\n * RPC sidecar — that JSON is not a valid `Duration.Input`.\n */\nexport const decodeDuration = (encoded) => {\n if (encoded === null || typeof encoded !== \"object\")\n return undefined;\n const json = encoded;\n switch (json._tag) {\n case \"Millis\":\n return json.millis !== undefined\n ? Duration.millis(json.millis)\n : undefined;\n case \"Nanos\":\n return json.nanos !== undefined\n ? Duration.nanos(BigInt(json.nanos))\n : undefined;\n case \"Infinity\":\n return Duration.infinity;\n case \"NegativeInfinity\":\n return Duration.negativeInfinity;\n default:\n return undefined;\n }\n};\n/**\n * Recursively encode a state value for JSON serialisation.\n *\n * - `Redacted<T>` values are wrapped as `{ [REDACTED_MARKER]: <inner> }`\n * so the actual string is persisted rather than the `<redacted>`\n * placeholder produced by the default `toJSON`.\n * - `Resource` instances are flattened to `{ id, type, props, attr }`\n * so persisted state matches the schema used by the loader.\n * - Plain objects and arrays are walked structurally.\n */\nexport const encodeState = (value) => {\n if (value === null ||\n value === undefined ||\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\")\n return value;\n if (Redacted.isRedacted(value)) {\n return {\n [REDACTED_MARKER]: encodeState(Redacted.value(value)),\n };\n }\n if (Duration.isDuration(value)) {\n // `JSON.stringify(Duration.seconds(N))` already invokes Duration.toJSON,\n // but encodeState is also called for code paths that don't go through\n // `JSON.stringify` (e.g. the HTTP state-store). Tag with our marker so\n // the reviver can unambiguously rebuild a real Duration instance —\n // Duration.toJSON's `{_id,_tag,...}` shape is NOT a valid Duration.Input.\n return {\n [DURATION_MARKER]: value.toJSON(),\n };\n }\n // Dates are serializable leaves and must round-trip: walking one\n // structurally would persist `{}` (`Object.entries(new Date())` is empty)\n // — and every later plan would then diff the empty object against the\n // program's Date and churn a phantom update forever. Tag with our marker\n // so the reviver rebuilds a real Date instance; rows written before the\n // marker carry a bare ISO string, which `canonicalize` in Diff.ts still\n // compares as equal to a live Date, so legacy rows never churn either.\n if (value instanceof Date) {\n return { [DATE_MARKER]: value.toJSON() };\n }\n if (isResource(value)) {\n return {\n id: value.LogicalId,\n type: value.Type,\n props: encodeState(value.Props),\n attr: encodeState(value.Attributes),\n };\n }\n if (Array.isArray(value))\n return value.map(encodeState);\n if (typeof value === \"object\") {\n const result = {};\n for (const [k, v] of Object.entries(value)) {\n result[k] = encodeState(v);\n }\n return result;\n }\n return value;\n};\n/**\n * JSON reviver that rebuilds `Redacted<T>` values that were written\n * through {@link encodeState}. Intended for use with `JSON.parse`.\n */\nexport const reviveState = (_key, value) => {\n if (value !== null && typeof value === \"object\" && !Array.isArray(value)) {\n const obj = value;\n if (REDACTED_MARKER in obj) {\n return Redacted.make(obj[REDACTED_MARKER]);\n }\n if (DURATION_MARKER in obj) {\n const decoded = decodeDuration(obj[DURATION_MARKER]);\n if (decoded !== undefined)\n return decoded;\n }\n // Exact single-key match only — unlike the legacy REDACTED/DURATION\n // markers there is no pre-marker data to tolerate, so a user object\n // that merely CONTAINS the key alongside other fields is never\n // collapsed into a Date (mirrors reviveStateRecursive's strictness).\n if (DATE_MARKER in obj && Object.keys(obj).length === 1) {\n const decoded = decodeDate(obj[DATE_MARKER]);\n if (decoded !== undefined)\n return decoded;\n }\n }\n return value;\n};\n/**\n * Recursively walk an already-decoded value and rebuild `Redacted<T>`\n * instances from `{ [REDACTED_MARKER]: <inner> }` envelopes. Mirror\n * image of {@link encodeState} for callers that hold a parsed JS\n * value rather than a JSON string (e.g. the HTTP state-store client,\n * which receives values pre-parsed by `HttpApiClient`).\n */\nexport const reviveStateRecursive = (value) => {\n if (value === null || typeof value !== \"object\")\n return value;\n if (Array.isArray(value))\n return value.map(reviveStateRecursive);\n const obj = value;\n const keys = Object.keys(obj);\n if (keys.length === 1 && keys[0] === REDACTED_MARKER) {\n return Redacted.make(reviveStateRecursive(obj[REDACTED_MARKER]));\n }\n if (keys.length === 1 && keys[0] === DURATION_MARKER) {\n const decoded = decodeDuration(obj[DURATION_MARKER]);\n if (decoded !== undefined)\n return decoded;\n }\n if (keys.length === 1 && keys[0] === DATE_MARKER) {\n const decoded = decodeDate(obj[DATE_MARKER]);\n if (decoded !== undefined)\n return decoded;\n }\n const result = {};\n for (const [k, v] of Object.entries(obj)) {\n result[k] = reviveStateRecursive(v);\n }\n return result;\n};\n//# sourceMappingURL=StateEncoding.js.map","import * as Cause from \"effect/Cause\";\nimport * as Context from \"effect/Context\";\nimport * as Duration from \"effect/Duration\";\nimport * as Effect from \"effect/Effect\";\nimport * as Exit from \"effect/Exit\";\nimport { flow } from \"effect/Function\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as Schema from \"effect/Schema\";\nimport * as Stream from \"effect/Stream\";\nimport * as NodeUtil from \"node:util\";\nimport * as Output from \"../Output.js\";\nimport { isRedactedMarker } from \"../RuntimeContext.js\";\nimport { decodeDuration, DURATION_MARKER, encodeState, } from \"../State/StateEncoding.js\";\nexport const wrapRpcHandlers = (handlers, streamKeys) => {\n return Object.fromEntries(Object.entries(handlers).map(([key, value]) => [\n key,\n typeof value === \"function\"\n ? streamKeys?.includes(key)\n ? wrapRpcStreamHandler(value)\n : wrapRpcEffectHandler(value)\n : typeof value === \"object\" && value !== null && !Array.isArray(value)\n ? wrapRpcHandlers(value)\n : value,\n ]));\n};\nexport const unwrapRpcHandlers = (handlers, streamKeys) => {\n return Object.fromEntries(Object.entries(handlers).map(([key, value]) => [\n key,\n typeof value === \"function\"\n ? streamKeys?.includes(key)\n ? unwrapRpcStreamHandler(value)\n : unwrapRpcEffectHandler(value)\n : typeof value === \"object\" && value !== null && !Array.isArray(value)\n ? unwrapRpcHandlers(value)\n : value,\n ]));\n};\nconst serializeError = Schema.encodeSync(Schema.Defect());\nconst wrapRpcEffectHandler = (handler) => flow((args) => deserializeRpcArgs(args), (args) => handler(...args), Effect.exit, Effect.map((exit) => {\n if (exit._tag === \"Success\") {\n // Success values need the same marker treatment as args: provider\n // attributes can legitimately carry `Redacted` secrets (e.g. a local\n // container's bound env), and a raw Redacted reaching capnweb dies\n // with `TypeError: Cannot serialize value: <redacted>`.\n return {\n _tag: \"Success\",\n value: serializeRpcArgs(exit.value),\n };\n }\n return {\n _tag: \"Failure\",\n cause: exit.cause.reasons.map((reason) => {\n switch (reason._tag) {\n case \"Fail\":\n return {\n _tag: \"Fail\",\n error: serializeError(reason.error),\n };\n case \"Die\":\n return { _tag: \"Die\", defect: serializeError(reason.defect) };\n case \"Interrupt\":\n return { _tag: \"Interrupt\", fiberId: reason.fiberId };\n }\n }),\n };\n}), Effect.runPromise);\nconst wrapRpcStreamHandler = (handler) => flow((args) => deserializeRpcArgs(args), (args) => handler(...args), (stream) => Stream.toReadableStream(stream));\nconst unwrapRpcEffectHandler = (handler) => flow((...args) => serializeRpcArgs(args), (args) => Effect.promise(() => handler(args)), Effect.flatMap((exit) => {\n if (exit._tag === \"Success\") {\n // Mirror of the wrap side: rebuild `Redacted` wrappers from their\n // wire markers so callers get the same shape an in-process provider\n // returns.\n return Exit.succeed(deserializeRpcArgs(exit.value));\n }\n return Exit.failCause(Cause.fromReasons(exit.cause.map((reason) => {\n switch (reason._tag) {\n case \"Fail\":\n return Cause.makeFailReason(reason.error);\n case \"Die\":\n return Cause.makeDieReason(reason.defect);\n case \"Interrupt\":\n return Cause.makeInterruptReason(reason.fiberId);\n }\n })));\n}));\nconst unwrapRpcStreamHandler = (handler) => flow((...args) => serializeRpcArgs(args), (args) => handler(args), (stream) => Stream.fromReadableStream({\n evaluate: () => stream,\n onError: (error) => error,\n}));\nconst serializeRpcArgs = (value) => {\n if (Redacted.isRedacted(value)) {\n return {\n _tag: \"Redacted\",\n value: Redacted.value(value),\n };\n }\n // Output must be tested BEFORE Effect.isEffect — Output exprs are yieldable\n // and would otherwise be misclassified as plain Effects.\n if (Output.isOutput(value)) {\n return {\n _tag: \"Output\",\n description: NodeUtil.inspect(value),\n };\n }\n // Runtime-only effect values riding in props (e.g. a Worker's `exports`\n // carries each DO's `constructor` Effect and captured `services` Context —\n // passed through prop resolution by identity since #1094). They cannot\n // cross the wire (function-valued internals kill capnweb) and the sidecar\n // never runs them (`stripEffects` drops them from `news` provider-side), so\n // ship a marker that deserializes back into an equivalent leaf: an Effect\n // that dies loudly if it IS ever run, keeping `isResolved`/`stripEffects`\n // semantics identical on both sides of the boundary.\n if (Effect.isEffect(value)) {\n return {\n _tag: \"~alchemy/Rpc/Effect\",\n description: NodeUtil.inspect(value),\n };\n }\n if (Context.isContext(value)) {\n return {\n _tag: \"~alchemy/Rpc/Context\",\n description: NodeUtil.inspect(value),\n };\n }\n // Duration has `toJSON` (so the structural walk below skips it) but\n // capnweb cannot serialize the live Effect Duration object — it dies\n // with `TypeError: Cannot serialize value: 15000 millis`. Use the same\n // `{ __duration__: toJSON() }` envelope as persisted state.\n if (Duration.isDuration(value)) {\n return encodeState(value);\n }\n if (typeof value === \"function\") {\n return null;\n }\n if (Array.isArray(value)) {\n return value.map(serializeRpcArgs);\n }\n if (value && typeof value === \"object\" && !(\"toJSON\" in value)) {\n return Object.fromEntries(Object.entries(value).map(([key, child]) => [\n key,\n serializeRpcArgs(child),\n ]));\n }\n return value;\n};\nconst isEffectMarker = (value) => \"_tag\" in value &&\n value._tag === \"~alchemy/Rpc/Effect\" &&\n \"description\" in value &&\n typeof value.description === \"string\";\nconst isContextMarker = (value) => \"_tag\" in value &&\n value._tag === \"~alchemy/Rpc/Context\" &&\n \"description\" in value &&\n typeof value.description === \"string\";\nconst isDurationEnvelope = (value) => DURATION_MARKER in value && Object.keys(value).length === 1;\nconst deserializeRpcArgs = (value) => {\n if (Array.isArray(value)) {\n return value.map(deserializeRpcArgs);\n }\n else if (typeof value === \"object\" && value !== null) {\n // These values are serialized as `{_tag: \"Redacted\", value: ...}` and `{_tag: \"Output\", description: ...}`,\n // so we need to detect them manually - Redacted.isRedacted and Output.isOutput do not work.\n if (isRedactedMarker(value)) {\n return Redacted.make(value.value);\n }\n else if (\"_tag\" in value &&\n value._tag === \"Output\" &&\n \"description\" in value &&\n typeof value.description === \"string\") {\n return new Output.NamedExpr(new Output.EffectExpr(Output.VoidExpr, () => Effect.never), value.description);\n }\n else if (isEffectMarker(value)) {\n // Rebuild an Effect-typed leaf so `isResolved`/`stripEffects` classify\n // it exactly like the original; dies loudly if anything ever runs it.\n const description = value.description;\n return Effect.suspend(() => Effect.die(new Error(`An Effect from the resource's props cannot cross the RPC provider boundary and was replaced by a placeholder: ${description}`)));\n }\n else if (isContextMarker(value)) {\n return Context.empty();\n }\n else if (isDurationEnvelope(value)) {\n return decodeDuration(value[DURATION_MARKER]) ?? value;\n }\n return Object.fromEntries(Object.entries(value).map(([key, child]) => [\n key,\n deserializeRpcArgs(child),\n ]));\n }\n return value;\n};\n//# sourceMappingURL=RpcSerialization.js.map","import * as Config from \"effect/Config\";\nimport * as ConfigProvider from \"effect/ConfigProvider\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport { AlchemyContext } from \"../AlchemyContext.js\";\nimport { AuthProviders } from \"../Auth/AuthProvider.js\";\nimport { CredentialsStoreLive } from \"../Auth/Credentials.js\";\nimport { ProfileLive, withProfileOverride } from \"../Auth/Profile.js\";\nimport { Stack } from \"../Stack.js\";\nimport { Stage } from \"../Stage.js\";\nimport { loadConfigProvider } from \"../Util/ConfigProvider.js\";\n/** Query parameter carrying the JSON {@link SessionEnvironment} on session websockets. */\nexport const SESSION_ENV_PARAM = \"alchemy-session-env\";\nexport const encodeSessionEnvironment = (env) => JSON.stringify(env);\nexport const decodeSessionEnvironment = (raw) => JSON.parse(raw);\nexport const layer = (environment) => Layer.mergeAll(ProfileLive, CredentialsStoreLive, Layer.succeed(AuthProviders, {}), ConfigProvider.layer(loadConfigProvider(Option.fromNullishOr(environment.envFile)).pipe(Effect.map((base) => withProfileOverride(base, environment.profile)))), Layer.succeed(AlchemyContext, environment.alchemyContext), Layer.succeed(Stack, {\n name: environment.stack.name,\n stage: environment.stack.stage,\n resources: {},\n bindings: {},\n actions: {},\n}), Layer.succeed(Stage, environment.stack.stage));\nexport const RPC_SERVER_ENVIRONMENT_KEY = \"ALCHEMY_RPC_SERVER_ENVIRONMENT\";\n/** The spawn-time environment the parent baked into the child's process env. */\nexport const fromProcessEnv = Config.string(RPC_SERVER_ENVIRONMENT_KEY).pipe(Config.map((raw) => JSON.parse(raw)));\n/**\n * Legacy single-stack boot: the full environment (including the stack) baked\n * into the process env at spawn time. Used by children that serve exactly one\n * stack for their whole lifetime (e.g. the Vite dev-server child, which gets\n * an explicit environment from `startViteChild`). RPC sidecars do NOT use\n * this — their sessions each carry a {@link SessionEnvironment}.\n */\nexport const fromEnv = () => Layer.unwrap(fromProcessEnv.pipe(Effect.flatMap((environment) => environment.stack === undefined ||\n environment.alchemyContext === undefined\n ? Effect.die(new Error(`${RPC_SERVER_ENVIRONMENT_KEY} carries no stack/alchemyContext — this child requires the legacy single-stack environment`))\n : Effect.succeed(layer({\n profile: environment.profile,\n envFile: environment.envFile,\n stack: environment.stack,\n alchemyContext: environment.alchemyContext,\n })))));\n//# sourceMappingURL=RpcServerEnvironment.js.map","import { newWebSocketRpcSession } from \"capnweb\";\nimport * as Cache from \"effect/Cache\";\nimport * as Config from \"effect/Config\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as HttpBody from \"effect/unstable/http/HttpBody\";\nimport * as HttpClient from \"effect/unstable/http/HttpClient\";\nimport { AlchemyContext } from \"../AlchemyContext.js\";\nimport { Stack } from \"../Stack.js\";\nimport { unwrapRpcHandlers } from \"./RpcSerialization.js\";\nimport { encodeSessionEnvironment, SESSION_ENV_PARAM, } from \"./RpcServerEnvironment.js\";\nexport class RpcProviderProxy extends Context.Service()(\"alchemy/Local/RpcProviderProxy\") {\n}\nexport const SPAWNER_URL_ENV_KEY = \"ALCHEMY_RPC_SPAWNER_URL\";\n/**\n * Separator for the session-cache key. `\\u0000` cannot appear in either half:\n * JSON.stringify escapes control characters and URLs cannot carry raw NULs.\n */\nconst SESSION_KEY_SEPARATOR = \"\\u0000\";\nconst make = Effect.fn(function* (spawnerUrl) {\n const client = yield* HttpClient.HttpClient;\n const getSession = Effect.fn(function* (serverEntryUrl, sessionEnv) {\n const payload = { serverEntryUrl };\n const response = yield* client.post(spawnerUrl, {\n body: yield* HttpBody.json(payload),\n });\n // The spawner returns one shared child per entry URL; the stack-specific\n // environment rides the session websocket so the child can build (and\n // memoize) a provider context per stack.\n const websocketUrl = new URL(yield* response.text);\n websocketUrl.searchParams.set(SESSION_ENV_PARAM, sessionEnv);\n return newWebSocketRpcSession(websocketUrl.toString());\n }, (effect, serverEntryUrl) => Effect.catch(effect, (error) => Effect.die(new Error(`Failed to create provider RPC session for \"${serverEntryUrl}\"`, {\n cause: error,\n }))));\n // A websocket that drops (sidecar crash/restart, abnormal 1006 close)\n // permanently breaks the capnweb session, and a cached broken session would\n // poison every subsequent call — including test-runner retries.\n // `onRpcBroken` fires on disconnect and evicts the entry, so the next `get`\n // re-registers with the spawner (which respawns the sidecar child if it\n // died). Assigned after the cache exists; the callback only fires on live\n // sessions, which the cache must already contain.\n let evictBrokenSession = () => { };\n const cache = yield* Cache.make({\n lookup: (key) => {\n const separator = key.indexOf(SESSION_KEY_SEPARATOR);\n return getSession(key.slice(0, separator), key.slice(separator + 1)).pipe(Effect.tap((session) => Effect.sync(() => session.onRpcBroken(() => evictBrokenSession(key)))));\n },\n capacity: Infinity,\n });\n evictBrokenSession = (key) => Effect.runFork(Cache.invalidate(cache, key));\n return RpcProviderProxy.of({\n get: Effect.fn(function* (mainUrl, providerName) {\n const alchemyContext = yield* AlchemyContext;\n const stack = yield* Stack;\n const sessionEnv = encodeSessionEnvironment({\n alchemyContext,\n stack: { name: stack.name, stage: stack.stage },\n });\n const key = mainUrl + SESSION_KEY_SEPARATOR + sessionEnv;\n const fetchProvider = Effect.gen(function* () {\n const session = yield* Cache.get(cache, key);\n return yield* Effect.tryPromise(() => session.getProvider(providerName));\n });\n // One in-place reconnect: if the session broke mid-call (the broken\n // callback may not have evicted it yet), drop it and re-register once\n // before giving up.\n const provider = yield* fetchProvider.pipe(Effect.catch(() => Cache.invalidate(cache, key).pipe(Effect.andThen(fetchProvider))), Effect.orDie);\n // The served shape omits the process-local `mode`/`modes` variant\n // machinery (see RpcProviderService); the unwrapped stub is a plain\n // (mode-agnostic) ProviderService.\n return unwrapRpcHandlers(provider, [\"tail\"]);\n }),\n });\n});\nexport const layer = (url) => Layer.effect(RpcProviderProxy, make(url));\nexport const fromEnv = () => Layer.effect(RpcProviderProxy, Config.string(SPAWNER_URL_ENV_KEY).pipe(Effect.flatMap(make)));\n//# sourceMappingURL=RpcProviderProxy.js.map","import * as Cache from \"effect/Cache\";\nimport * as Config from \"effect/Config\";\nimport * as Console from \"effect/Console\";\nimport * as Context from \"effect/Context\";\nimport * as Deferred from \"effect/Deferred\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Queue from \"effect/Queue\";\nimport * as Scope from \"effect/Scope\";\nimport * as Stream from \"effect/Stream\";\nimport * as HttpClient from \"effect/unstable/http/HttpClient\";\nimport * as HttpServer from \"effect/unstable/http/HttpServer\";\nimport { HttpServerRequest } from \"effect/unstable/http/HttpServerRequest\";\nimport * as HttpServerResponse from \"effect/unstable/http/HttpServerResponse\";\nimport * as ChildProcess from \"effect/unstable/process/ChildProcess\";\nimport * as ChildProcessSpawner from \"effect/unstable/process/ChildProcessSpawner\";\nimport { fileURLToPath } from \"node:url\";\nimport { transformTypesFlags } from \"../Util/Node.js\";\nimport { httpServer } from \"../Util/PlatformServices.js\";\nimport { SPAWNER_URL_ENV_KEY } from \"./RpcProviderProxy.js\";\nimport { RPC_SERVER_ENVIRONMENT_KEY, } from \"./RpcServerEnvironment.js\";\nexport class RpcSpawner extends Context.Service()(\"alchemy/Local/RpcSpawner\") {\n}\n/**\n * Path on the spawner's HTTP server that streams sidecar output as NDJSON\n * ({@link SidecarLogLine} per line). Consumed by {@link forwardSidecarLogs}\n * from the exec child, which owns the terminal renderer.\n */\nexport const LOGS_PATH = \"/logs\";\nexport const make = Effect.fn(function* ({ profile, envFile, }) {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const scope = yield* Effect.scope;\n const cache = yield* Cache.make({\n lookup: (serverEntryUrl) => spawn(serverEntryUrl).pipe(Scope.provide(scope)),\n capacity: Infinity,\n });\n // Sidecar output hub. During `alchemy dev` this process (the outer dev\n // command) shares the tty with the exec child, and the exec child owns the\n // repainting progress renderer (Ink patches its `console`). Printing\n // sidecar lines RAW from here interleaves with the renderer's repaints and\n // corrupts the region (stacked/duplicated frames). So: when an exec child\n // is subscribed via the /logs endpoint, hand lines to it and let it print\n // through its (patched) console; only print from this process as a\n // fallback when no subscriber is connected (e.g. during a --watch restart\n // gap, when no renderer is alive either).\n const subscribers = new Set();\n const publish = (line) => Effect.suspend(() => {\n if (subscribers.size > 0) {\n for (const notify of subscribers)\n notify(line);\n return Effect.void;\n }\n // Through the Console SERVICE so runners that override it (e.g.\n // alchemy-test's per-test buffer) capture the sidecar's output.\n return line.channel === \"stderr\"\n ? Console.error(line.line)\n : Console.log(line.line);\n });\n const spawn = Effect.fn(function* (serverEntryUrl) {\n const bin = typeof globalThis.Bun !== \"undefined\" ? \"bun\" : \"node\";\n const main = fileURLToPath(serverEntryUrl);\n // Stack-specific context is deliberately absent: sessions carry their\n // own SessionEnvironment, so one child serves every stack.\n const environment = {\n profile,\n envFile,\n };\n const command = ChildProcess.make(bin, {\n bun: [\"run\", main],\n // Under Node, transparently strip TypeScript types so that `.ts`\n // entry points work the same way they do under Bun. Mirrors what\n // `dev.ts` already does for the outer process, so the dev experience\n // is symmetric on both runtimes whether the entry came from `src/`\n // (dev/tests) or `lib/` (published packages).\n node: main.endsWith(\".ts\") ? [...transformTypesFlags(), main] : [main],\n }[bin], {\n stdout: \"pipe\",\n // Piped (NOT inherited) so the child's output routes through the\n // Effect Console service: raw writes to the parent's fd corrupt the\n // test runner's reporter/TUI. The drain below is mandatory — an\n // unread pipe eventually fills and blocks the child.\n stderr: \"pipe\",\n detached: false,\n env: {\n [RPC_SERVER_ENVIRONMENT_KEY]: JSON.stringify(environment),\n },\n extendEnv: true,\n });\n const handle = yield* spawner.spawn(command);\n yield* handle.stderr.pipe(Stream.decodeText, Stream.splitLines, Stream.runForEach((line) => publish({ channel: \"stderr\", line })), Effect.ignore, Effect.forkScoped);\n // This scope is the child handle's sole owner. Graceful shutdown runs this\n // finalizer; abrupt parent loss closes the RPC parent connection and the\n // child self-terminates (both paths are covered by RpcSpawnerCleanup).\n const kill = handle.kill({ forceKillAfter: \"500 millis\" });\n yield* Effect.addFinalizer(() => kill.pipe(Effect.ignore));\n const url = yield* getRpcAddress(handle.stdout, (line) => publish({ channel: \"stdout\", line }));\n const ws = yield* Effect.acquireRelease(Effect.sync(() => new WebSocket(new URL(\"/parent\", url))), (ws) => Effect.sync(() => ws.close()));\n return {\n url,\n isRunning: Effect.zipWith(handle.isRunning, Effect.sync(() => ws.readyState === WebSocket.CONNECTING ||\n ws.readyState === WebSocket.OPEN), (a, b) => a && b, { concurrent: true }),\n kill,\n };\n });\n const register = Effect.fn(function* (serverEntryUrl, attempt = 0) {\n const child = yield* Cache.get(cache, serverEntryUrl);\n if (yield* child.isRunning) {\n return child.url;\n }\n if (attempt > 3) {\n return yield* Effect.die(new Error(`Failed to spawn RPC server for \"${serverEntryUrl}\" after ${attempt} attempts.`));\n }\n yield* child.kill;\n yield* Cache.invalidate(cache, serverEntryUrl);\n return yield* register(serverEntryUrl, attempt + 1);\n });\n const server = yield* HttpServer.HttpServer;\n const encoder = new TextEncoder();\n yield* server.serve(Effect.gen(function* () {\n const request = yield* HttpServerRequest;\n if (request.url.startsWith(LOGS_PATH)) {\n // Long-lived NDJSON stream of sidecar output. The subscriber (exec\n // child) prints these lines through its own console, which the Ink\n // renderer patches — inserting them above the progress region\n // instead of tearing it. Client disconnect interrupts the stream\n // and unregisters the subscriber.\n const queue = yield* Queue.make();\n const notify = (line) => {\n Queue.offerUnsafe(queue, encoder.encode(`${JSON.stringify(line)}\\n`));\n };\n subscribers.add(notify);\n return HttpServerResponse.stream(Stream.fromQueue(queue).pipe(Stream.ensuring(Effect.sync(() => subscribers.delete(notify)))), { contentType: \"application/x-ndjson\" });\n }\n const payload = (yield* request.json);\n const url = yield* register(payload.serverEntryUrl);\n return HttpServerResponse.text(url);\n }));\n return RpcSpawner.of({\n url: HttpServer.formatAddress(server.address),\n });\n});\nexport const layerServer = (environment) => Layer.effect(RpcSpawner, make(environment)).pipe(Layer.provide(httpServer()));\nconst RPC_ADDRESS_REGEX = /(<ALCHEMY_RPC_ADDRESS>)(.+)(<\\/ALCHEMY_RPC_ADDRESS>)/;\nconst getRpcAddress = (stdout, publish) => Effect.gen(function* () {\n const address = yield* Deferred.make();\n let done = false;\n yield* stdout.pipe(Stream.decodeText, Stream.splitLines, Stream.runForEach((line) => {\n if (done) {\n return publish(line);\n }\n const match = line.match(RPC_ADDRESS_REGEX);\n if (match) {\n done = true;\n return Deferred.succeed(address, match[2]);\n }\n return Effect.void;\n }), Effect.forkScoped);\n return yield* Deferred.await(address);\n});\nconst parseSidecarLogLine = (raw) => {\n try {\n const parsed = JSON.parse(raw);\n return typeof parsed?.line === \"string\" ? parsed : undefined;\n }\n catch {\n return undefined;\n }\n};\n/**\n * Pull sidecar output from the spawner (the outer `alchemy dev` process)\n * into THIS process's Console. The exec child owns the terminal renderer —\n * Ink patches its `console`, so lines printed here are inserted cleanly\n * above the repainting progress region instead of racing it on the shared\n * tty. Forks in the ambient scope and never fails: when no spawner is\n * configured (`ALCHEMY_RPC_SPAWNER_URL` absent — plain deploy/destroy) it is\n * a no-op, and if the connection drops the spawner's own fallback printing\n * takes over.\n */\nexport const forwardSidecarLogs = Config.string(SPAWNER_URL_ENV_KEY).pipe(Effect.flatMap((spawnerUrl) => {\n const streamOnce = Effect.gen(function* () {\n const client = yield* HttpClient.HttpClient;\n const response = yield* client.get(new URL(LOGS_PATH, spawnerUrl).toString());\n yield* response.stream.pipe(Stream.decodeText, Stream.splitLines, Stream.runForEach((raw) => Effect.suspend(() => {\n const parsed = parseSidecarLogLine(raw);\n if (parsed === undefined)\n return Effect.void;\n return parsed.channel === \"stderr\"\n ? Console.error(parsed.line)\n : Console.log(parsed.line);\n })));\n });\n // Keep the subscription alive for the whole dev session: reconnect\n // (paced) if the stream ends or errors. While disconnected the spawner's\n // fallback printing covers the gap; the loop dies with the ambient scope.\n return streamOnce.pipe(Effect.ignore, Effect.andThen(Effect.sleep(\"1 second\")), Effect.forever);\n}), Effect.ignore, Effect.forkScoped, Effect.asVoid);\n//# sourceMappingURL=RpcSpawner.js.map","import * as Effect from \"effect/Effect\";\nimport { RuntimeContext } from \"./RuntimeContext.js\";\n/**\n * Runtime context bridge that lets an {@link Action} read Resource Outputs.\n *\n * Actions are peculiar: their init Effect runs at plan/stack-eval time (before\n * any resource exists) while their body runs at apply time (after upstreams are\n * materialized). To make `yield* db.databaseId` work inside an Action we split\n * the {@link RuntimeContext} into two cooperating halves that share nothing but\n * a sanitized key:\n *\n * - {@link makeCaptureContext} is provided while the init Effect runs. Its\n * `set(key, output)` records the referenced {@link Output} (so the engine can\n * add a dependency edge and later resolve it) and its `get(key)` hands back a\n * *deferred* accessor — an Effect that re-reads whatever `RuntimeContext` is\n * ambient when it actually runs.\n * - {@link makeResolveContext} is provided around the Action body at apply\n * time. Its `get(key)` returns the already-resolved value for that key.\n *\n * Because the accessor produced at init re-reads `RuntimeContext`, yielding it\n * inside the body resolves against the apply-time context — no shared mutable\n * state, no infinite recursion (the resolve context's `get` is terminal).\n */\nconst base = (id) => ({\n Type: \"Action\",\n id,\n env: {},\n});\n/**\n * Capture context — provided while an Action's init Effect runs. Records every\n * Output referenced via `yield* output` into `captures`, keyed by the Output's\n * sanitized key, and returns deferred accessors.\n */\nexport const makeCaptureContext = (captures) => ({\n ...base(\"capture\"),\n set: (key, output) => Effect.sync(() => {\n captures[key] = output;\n return key;\n }),\n // Deferred: re-read the ambient RuntimeContext at run time. At apply this is\n // the resolve context below; its `get` returns the materialized value. The\n // `RuntimeContext` requirement is erased at the Action boundary (`Run` is\n // typed `Effect<Out, any, any>`) and satisfied by the resolve context, so\n // the accessor presents as `Effect<T | undefined>`.\n get: ((key) => Effect.flatMap(RuntimeContext, (ctx) => ctx.get(key))),\n});\n/**\n * Resolve context — provided around an Action body at apply time. `resolved`\n * maps each captured key to its value (already evaluated against the tracker).\n */\nexport const makeResolveContext = (resolved) => ({\n ...base(\"resolve\"),\n set: (key) => Effect.succeed(key),\n get: (key) => Effect.succeed(resolved[key]),\n});\n//# sourceMappingURL=ActionRuntimeContext.js.map","/**\n * The credential-demand seam for credential-free `alchemy dev`.\n *\n * A dev run whose plan is entirely local must never touch (or prompt for)\n * cloud credentials. When the plan DOES need the cloud — a resource opted\n * out of local emulation via `Alchemy.remote()`, a local Worker binding\n * that proxies to a remote resource (`dev: { remote: true }`), or the\n * deletion of a row that was last reconciled live — credentials are\n * demanded exactly once, up front, in the exec process (which owns the\n * tty), BEFORE apply begins:\n *\n * - interactive: the provider's existing `configure` flow runs, prefixed\n * with a human-readable reason naming the demanding resources\n * (threaded via {@link ConfigureContext}'s `reason`).\n * - non-interactive: fail with the typed {@link CredentialsRequired}\n * error naming the demanding resources and pointing at `alchemy login`.\n *\n * The RPC sidecar never prompts — its stdio is piped and it only ever\n * reads credentials persisted by this seam (or a prior `alchemy login`).\n *\n * Non-dev runs (`alchemy deploy` / `destroy`) never enter this seam:\n * state-store init and live providers drive the pre-existing lazy\n * credential-resolution flow unchanged.\n */\nimport * as Config from \"effect/Config\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as Option from \"effect/Option\";\nimport { isNonInteractive } from \"../Util/interactive.js\";\nimport { AuthProviders } from \"./AuthProvider.js\";\nimport { ALCHEMY_PROFILE, AlchemyProfile } from \"./Profile.js\";\n/**\n * A dev-mode plan needs cloud credentials, none are configured for the\n * active profile, and the process is non-interactive so the configure flow\n * cannot run. The message names the demanding resources and the fix.\n */\nexport class CredentialsRequired extends Data.TaggedError(\"CredentialsRequired\") {\n}\nconst describeReason = (reason) => {\n switch (reason) {\n case \"remote\":\n return \"runs against the real cloud via Alchemy.remote()\";\n case \"remote-binding\":\n return \"has a binding that proxies to a remote resource (dev: { remote: true })\";\n case \"live-delete\":\n return \"deletes an instance that was deployed to the real cloud\";\n }\n};\n/** `\"AWS.S3.Bucket\"` → `\"AWS\"` (the auth-provider name). */\nconst cloudOf = (type) => type.split(\".\")[0] ?? type;\nconst resourceLines = (demand) => demand.resources\n .map((r) => ` - ${r.fqn} (${describeReason(r.reason)})`)\n .join(\"\\n\");\n/**\n * Build the typed {@link CredentialsRequired} failure for a demand.\n * Exported so tests can pin the message format.\n */\nexport const credentialsRequired = (demand, profileName) => new CredentialsRequired({\n provider: demand.provider,\n resources: demand.resources.map((r) => r.fqn),\n reason: [...new Set(demand.resources.map((r) => r.reason))].join(\", \"),\n message: `${demand.provider} credentials are required, but none are configured ` +\n `for profile '${profileName}' and this process is non-interactive so ` +\n \"they can't be configured now.\\n\" +\n `These resources require ${demand.provider} credentials:\\n` +\n `${resourceLines(demand)}\\n` +\n `Run \\`alchemy login --profile ${profileName}\\` to configure ` +\n \"credentials, or set CI=1 to use environment-variable credentials.\",\n});\n/**\n * The human-readable reason shown at the top of an interactive configure\n * flow triggered by this seam (threaded via {@link ConfigureContext}).\n */\nconst demandBanner = (demand) => `This dev session requires ${demand.provider} credentials:\\n` +\n resourceLines(demand);\nconst bindingDemandsRemote = (bindings) => (bindings ?? []).some((binding) => {\n // A binding being REMOVED needs no runtime proxy — the restarted\n // local instance simply no longer carries it.\n if (binding.action === \"delete\")\n return false;\n const data = binding.data;\n return (data != null &&\n typeof data === \"object\" &&\n data.devRemote != null &&\n typeof data.devRemote === \"object\" &&\n Object.values(data.devRemote).some((remote) => remote === true));\n});\n/**\n * Scan a plan for rows that need live (cloud) credentials during a dev\n * run, grouped by cloud provider:\n *\n * 1. resources whose resolved provider mode is `\"live\"` (`Alchemy.remote()`)\n * 2. resources whose binding data carries a truthy `devRemote` entry\n * (the local runtime proxies that binding to the real cloud)\n * 3. planned deletions of rows stamped `providerMode: \"live\"`\n *\n * Pure and side-effect-free — callers gate on the run being a dev run\n * (in a live run every dual-provider row resolves `\"live\"` and the\n * pre-existing lazy credential flow applies instead).\n *\n * Mode-agnostic rows (`mode === undefined`, single-implementation\n * providers that run live even in dev) are deliberately NOT collected:\n * they resolve credentials lazily exactly as they do today.\n */\nexport const collectCredentialDemands = (plan) => {\n const byProvider = new Map();\n const add = (type, fqn, reason) => {\n const provider = cloudOf(type);\n const resources = byProvider.get(provider) ?? new Map();\n if (!resources.has(fqn))\n resources.set(fqn, reason);\n byProvider.set(provider, resources);\n };\n for (const [fqn, node] of Object.entries(plan.resources)) {\n if (node.mode === \"live\") {\n add(node.resource.Type, fqn, \"remote\");\n }\n else if (bindingDemandsRemote(node.bindings)) {\n add(node.resource.Type, fqn, \"remote-binding\");\n }\n }\n for (const [fqn, node] of Object.entries(plan.deletions)) {\n if (node !== undefined && node.mode === \"live\") {\n add(node.resource.Type, fqn, \"live-delete\");\n }\n }\n return [...byProvider.entries()].map(([provider, resources]) => ({\n provider,\n resources: [...resources.entries()].map(([fqn, reason]) => ({\n fqn,\n reason,\n })),\n }));\n};\n/**\n * Ensure credentials exist for every demand, prompting at most once per\n * provider and only when nothing is configured yet:\n *\n * - already configured for the active profile → no-op (never re-prompts)\n * - missing + interactive → the provider's `configure` flow runs (via\n * `AlchemyProfile.loadOrConfigure`), prefixed with a reason naming the\n * demanding resources\n * - missing + non-interactive (and not CI) → typed\n * {@link CredentialsRequired} failure\n * - CI → `loadOrConfigure` picks the provider's non-interactive default\n * (env-var credentials), matching every other CI path\n *\n * Demands whose cloud has no registered auth provider are skipped (bare\n * engine runs with test providers demand nothing). All context is\n * resolved optionally, so the effect is safe to run in any environment.\n */\nexport const demandCredentials = Effect.fn(\"Alchemy.demandCredentials\")(function* (demands, options) {\n if (demands.length === 0)\n return;\n const registry = Option.getOrUndefined(yield* Effect.serviceOption(AuthProviders));\n const profile = Option.getOrUndefined(yield* Effect.serviceOption(AlchemyProfile));\n if (registry === undefined || profile === undefined)\n return;\n const profileName = yield* ALCHEMY_PROFILE;\n const ci = yield* Config.boolean(\"CI\").pipe(Config.withDefault(false));\n const nonInteractive = options?.nonInteractive ?? isNonInteractive();\n for (const demand of demands) {\n const auth = registry[demand.provider];\n if (auth == null)\n continue;\n const existing = yield* profile.getProfile(profileName);\n if (existing?.[auth.name] != null)\n continue;\n if (!ci && nonInteractive) {\n return yield* credentialsRequired(demand, profileName);\n }\n const ctx = { ci, reason: demandBanner(demand) };\n yield* profile.loadOrConfigure(auth, profileName, ctx);\n }\n});\n/**\n * The one-call seam wired into the dev path: scan the plan for live\n * demand and, if any, run {@link demandCredentials} BEFORE apply begins.\n */\nexport const demandPlanCredentials = (plan, options) => demandCredentials(collectCredentialDemands(plan), options);\n//# sourceMappingURL=Demand.js.map","import * as Duration from \"effect/Duration\";\nimport * as Effect from \"effect/Effect\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as Output from \"./Output.js\";\nimport { isPlainData, isPrimitive, mapPlainData } from \"./Util/data.js\";\n/**\n * Returns true when `value` (or any nested leaf) is still an unresolved\n * plan-time expression — i.e. an `Output`/`Expr` or an `Effect` that was\n * not fully evaluated by `resolveInput` in Plan.ts.\n *\n * Use at the top of a provider `diff` to short-circuit before field access:\n *\n * ```ts\n * if (!isResolved(news)) return undefined;\n * const resolved = news as MyProps;\n * ```\n */\nexport const hasUnresolvedInputs = (value) => _hasUnresolved(value);\nexport const isResolved = (value) => !_hasUnresolved(value);\nconst _hasUnresolved = (value, seen = new WeakSet()) => {\n if (value == null || isPrimitive(value))\n return false;\n if (Output.isExpr(value) || Effect.isEffect(value))\n return true;\n // Only plain data is traversed; any other class instance (Layer, Context,\n // Date, SDK objects) is a resolved leaf — see isPlainData (#1082).\n if (isPlainData(value)) {\n if (seen.has(value))\n return false;\n seen.add(value);\n return Object.values(value).some((v) => _hasUnresolved(v, seen));\n }\n return false;\n};\n/**\n * Deeply replace every unresolved plan-time expression (an `Output`/`Expr`\n * or an un-evaluated `Effect`) with `undefined`, leaving resolved values\n * (including opaque `Redacted`/`Duration` instances) intact.\n *\n * Persisted resource state must only ever hold plain data. Durable (JSON)\n * state stores already enforce this implicitly — Output proxies are\n * function-typed, so `JSON.stringify` silently drops them — but the\n * in-memory store used by tests retains live proxies, which would later be\n * fed back into provider lifecycle operations as `olds` after an\n * interrupted apply (e.g. `read` during a destroy plan) and blow up on\n * first string coercion. Sanitizing at the commit boundary keeps both\n * store kinds consistent with the provider contract that `olds` is\n * resolved `Props`.\n */\nexport const stripUnresolved = (value) => _stripUnresolved(value);\nconst _stripUnresolved = (value, \n// Ancestor-path cycle guard: a value on its own ancestor chain is cut to\n// `undefined` (a cycle can never persist). Sync DFS, so add/delete around\n// the recursion is race-free and keeps shared diamond references intact\n// (#1082).\nancestors = new WeakSet()) => {\n if (value == null || isPrimitive(value))\n return value;\n if (Output.isExpr(value) || Effect.isEffect(value))\n return undefined;\n // Serializable leaves — the only class instances persisted state may\n // carry (StateEncoding knows Redacted/Duration; Date JSON-encodes).\n // Rebuilding them structurally would strip their prototype.\n if (Redacted.isRedacted(value) ||\n Duration.isDuration(value) ||\n value instanceof Date) {\n return value;\n }\n if (isPlainData(value)) {\n return mapPlainData(value, ancestors, (child) => _stripUnresolved(child, ancestors));\n }\n // Any other class instance (Layer, Context, SDK objects) is runtime-only\n // wiring that can't round-trip through JSON — a beta.103 Context is even\n // cyclic (#1082). Persisted state holds plain data only.\n return undefined;\n};\n/**\n * Deeply replace Effect-valued entries with `undefined`, leaving resolved\n * values AND unresolved `Output`/`Expr`s intact.\n *\n * Effect-valued props — e.g. a tagged Worker class in `env` (the\n * circular-bindings pattern) — can never be evaluated inside lifecycle\n * operations, and {@link stripUnresolved} drops them from persisted state at\n * the commit boundary. A provider `diff` that wants its structural change\n * detection to still run despite them strips them first, so `isResolved`\n * gates only on genuinely-unresolved Outputs (#874). The Effects' deploy-time\n * identity is carried by the resolved binding data instead.\n */\nexport const stripEffects = (value) => _stripEffects(value);\nconst _stripEffects = (value, \n// Ancestor-path cycle guard — see _stripUnresolved (#1082).\nancestors = new WeakSet()) => {\n if (value == null || isPrimitive(value))\n return value;\n // Output proxies are left intact (so `isResolved` still sees them); they\n // must be tested BEFORE `Effect.isEffect` because Output exprs are\n // yieldable and would otherwise be misclassified as plain Effects.\n if (Output.isExpr(value))\n return value;\n if (Effect.isEffect(value))\n return undefined;\n if (Redacted.isRedacted(value) ||\n Duration.isDuration(value) ||\n value instanceof Date) {\n return value;\n }\n if (isPlainData(value)) {\n return mapPlainData(value, ancestors, (child) => _stripEffects(child, ancestors));\n }\n // Non-plain instances (Layer, Context, SDK objects) are dropped with\n // Effects — same runtime-only rationale, and their internals may be\n // cyclic (effect ≥4.0.0-beta.103's Context — #1082).\n return undefined;\n};\nexport const somePropsAreDifferent = (olds, news, props) => {\n for (const prop of props) {\n if (olds[prop] !== news[prop]) {\n return true;\n }\n }\n return false;\n};\nexport const anyPropsAreDifferent = (olds, news) => {\n for (const prop in olds) {\n if (olds[prop] !== news[prop]) {\n return true;\n }\n }\n for (const prop in news) {\n if (!(prop in olds)) {\n return true;\n }\n }\n return false;\n};\nexport const havePropsChanged = (oldProps, newProps) => Output.hasOutputs(newProps) ||\n // Compare both sides through `stripUnresolved` so the comparison is\n // symmetric with the commit boundary: persisted props can never hold an\n // Effect or Output expr (stripped at commit / silently dropped by JSON\n // serialization), while desired props may still carry them — e.g. a tagged\n // Worker class in `env` serializes via its `toJSON` to\n // `{\"_id\":\"Effect\",...}` and would otherwise report a phantom change on\n // every plan, forever (#874). Unresolved Outputs in `newProps` are already\n // caught by the `hasOutputs` guard above, so stripping here never hides a\n // real difference.\n JSON.stringify(canonicalize(stripUnresolved(oldProps ?? {}), false)) !==\n JSON.stringify(canonicalize(stripUnresolved(newProps ?? {}), false));\n/**\n * Sort-keys deep equality for plain data (objects, arrays, primitives).\n * Use in provider `diff` handlers instead of ad-hoc `JSON.stringify` comparisons.\n *\n * By default, `null` and `undefined` are treated as distinct. Pass\n * `{ stripNullish: true }` to opt into treating them as equivalent.\n */\nexport const deepEqual = (a, b, options) => JSON.stringify(canonicalize(a, options?.stripNullish ?? false)) ===\n JSON.stringify(canonicalize(b, options?.stripNullish ?? false));\nconst canonicalize = (value, stripNullish, \n// Ancestor-path cycle guard — see _stripUnresolved (#1082).\nancestors = new WeakSet()) => {\n if (stripNullish && value == null)\n return undefined;\n if (Redacted.isRedacted(value)) {\n return {\n _tag: \"Redacted\",\n value: Redacted.value(value),\n };\n }\n // JSON-safe leaves compare by their serialized form (Duration/Date have\n // toJSON).\n if (Duration.isDuration(value) || value instanceof Date)\n return value;\n if (isPlainData(value)) {\n const rebuilt = mapPlainData(value, ancestors, (child) => canonicalize(child, stripNullish, ancestors));\n if (rebuilt === undefined || Array.isArray(rebuilt))\n return rebuilt;\n // Deterministic key order for the JSON.stringify comparison. Filtering\n // after the walk is JSON-equivalent to filtering before it —\n // undefined-valued keys are dropped by JSON.stringify either way.\n return Object.fromEntries(Object.entries(rebuilt)\n .filter(([, nested]) => !stripNullish || nested != null)\n .sort(([a], [b]) => a.localeCompare(b)));\n }\n if (value && typeof value === \"object\") {\n // Non-plain instances (Effect, Layer, Context, SDK objects) never\n // canonicalize — walking them is unsafe (cyclic on effect\n // ≥4.0.0-beta.103 — #1082) and comparing them is meaningless.\n return undefined;\n }\n return value;\n};\n/**\n * Deterministic ordering for binding rows.\n *\n * Bindings are registered by concurrently-built layers (a Function/Worker's\n * capability layers run real IO — bundling, fs — before calling `host.bind`),\n * so the registration order of `stack.bindings[fqn]` is not stable across\n * deploys. `diffBindings` itself is sid-keyed and order-insensitive, but the\n * row order flows into provider `diff`/`reconcile` inputs and persisted\n * state — any consumer that hashes or deep-compares the binding array (e.g.\n * a metadata hash over bindings) would churn on registration-order flips.\n * Sorting by `sid` at every boundary makes binding rows stable.\n */\nconst bySid = (a, b) => a.sid < b.sid ? -1 : a.sid > b.sid ? 1 : 0;\nexport const sortBindings = (bindings) => [...bindings].sort(bySid);\n/**\n * Collapse bindings that share the same `sid`, keeping the last occurrence,\n * and return them in deterministic (sid-sorted) order.\n *\n * The same binding can be recorded more than once on a target resource — e.g.\n * a KV namespace bound to both a Worker and a Workflow ends up pushed twice to\n * `stack.bindings[fqn]`. `diffBindings` already collapses these implicitly via\n * its `Map` keyed by `sid`, so the `reconcile` path never observes duplicates.\n * Use this helper to give a provider's `diff` handler the same de-duplicated\n * binding set, keeping plan-time hashing consistent with deploy-time.\n */\nexport const dedupeBindings = (bindings) => sortBindings(Array.from(new Map(bindings.map((b) => [b.sid, b])).values()));\nexport const diffBindings = (oldBindings, newBindings) => {\n const oldMap = new Map(oldBindings.map((b) => [b.sid, b]));\n const newMap = new Map(newBindings.map((b) => [b.sid, b]));\n return sortBindings([\n ...Array.from(oldMap)\n .filter(([sid]) => !newMap.has(sid))\n .map(([sid, old]) => ({\n sid,\n action: \"delete\",\n data: old.data,\n })),\n ...Array.from(newMap).map(([sid, binding]) => {\n const old = oldMap.get(sid);\n return {\n sid,\n action: (!old\n ? \"create\"\n : havePropsChanged(old.data, binding.data)\n ? \"update\"\n : \"noop\"),\n data: binding.data,\n };\n }),\n ]);\n};\n//# sourceMappingURL=Diff.js.map","import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\n/** A 16-byte (128-bit) random hex-encoded string representing an physical instance of a logical resource */\nexport class InstanceId extends Context.Service()(\"instance-id\") {\n}\n/**\n * @returns Hex-encoded instance ID (16 random bytes)\n */\nexport const generateInstanceId = () => Effect.sync(() => {\n const bytes = new Uint8Array(16);\n crypto.getRandomValues(bytes);\n return Array.from(bytes)\n .map((b) => b.toString(16).padStart(2, \"0\"))\n .join(\"\");\n});\n//# sourceMappingURL=InstanceId.js.map","import * as Effect from \"effect/Effect\";\nexport const assertDefined = (value, message) => {\n if (!value) {\n throw new Error(message);\n }\n return value;\n};\nexport const asEffect = (effect) => typeof effect?.asEffect === \"function\"\n ? effect.asEffect()\n : Effect.isEffect(effect)\n ? effect\n : Effect.succeed(effect);\n//# sourceMappingURL=types.js.map","import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { makeCaptureContext } from \"./ActionRuntimeContext.js\";\nimport { toFqn } from \"./FQN.js\";\nimport { CurrentNamespace } from \"./Namespace.js\";\nimport * as Output from \"./Output.js\";\nimport { RuntimeContext } from \"./RuntimeContext.js\";\nimport { Stack } from \"./Stack.js\";\nexport const isAction = (value) => typeof value === \"object\" && value !== null && value?.Kind === \"action\";\nexport function Action(...args) {\n if (args.length === 0) {\n // Tagged form: Action<Self, In, Out>()(type)\n return (type) => makeActionClass(type, undefined);\n }\n // Inline form: Action(type, runnerOrInit)\n const [type, initOrRun] = args;\n return makeActionClass(type, initOrRun);\n}\nconst isRunnerEffect = (v) => Effect.isEffect(v);\nconst makeActionClass = (type, baked) => {\n // Pre-resolve baked init/runner into a single Effect<Runner, _, Req>. Use\n // Effect.cached so the init's body runs at most once per process — every\n // action instance after the first reuses the resolved runner without paying\n // the init cost (or re-yielding its dependencies).\n let resolveRunner;\n if (baked !== undefined) {\n resolveRunner = isRunnerEffect(baked)\n ? Effect.runSync(Effect.cached(baked))\n : Effect.succeed(baked);\n }\n // Tagged form needs a Context tag so the user can supply the runner\n // through a Layer. Inline form bakes the runner in and skips the tag.\n const SelfTag = baked\n ? undefined\n : Context.Service(`alchemy/Action<${type}>`);\n // Outputs referenced via `yield* output` inside the init Effect land here,\n // recorded by the capture RuntimeContext. Shared per definition — the init\n // runs at most once (Effect.cached), so captures are inherently\n // per-definition, matching how the init's `Req` bubbles per definition.\n const captures = {};\n const captureContext = makeCaptureContext(captures);\n const constructor = (...args) => {\n const [id, input] = args.length === 1 ? [type, args[0]] : args;\n return Effect.gen(function* () {\n const run = resolveRunner\n ? yield* resolveRunner.pipe(Effect.provideService(RuntimeContext, captureContext))\n : (yield* SelfTag);\n return yield* registerAction(type, id, input, run, captures);\n });\n };\n const extra = { Type: type };\n if (SelfTag) {\n extra.Self = SelfTag;\n // `.make(initOrRun)` — accepts either a direct runner or an init Effect.\n // For init form we use `Layer.effect` so the init's Req surfaces on the\n // Layer, and run it under the capture RuntimeContext so `yield* output`\n // accessors are recorded just like the inline form; for runners we use\n // `Layer.succeed` (nothing to capture).\n extra.make = (initOrRun) => isRunnerEffect(initOrRun)\n ? Layer.effect(SelfTag, initOrRun.pipe(Effect.provideService(RuntimeContext, captureContext)))\n : Layer.succeed(SelfTag, initOrRun);\n }\n return Object.assign(constructor, extra);\n};\nconst registerAction = (type, id, input, run, captures) => Effect.gen(function* () {\n const stack = yield* Stack;\n const namespace = yield* CurrentNamespace;\n const fqn = toFqn(namespace, id);\n const actions = (stack.actions ??= {});\n const existing = actions[fqn];\n if (existing)\n return Output.of(existing);\n // FQN collision check: actions share the same FQN namespace as resources\n // so the dependency graph stays unified. Rejecting overlaps here makes\n // the constraint obvious at registration time.\n if (stack.resources[fqn]) {\n return yield* Effect.die(new Error(`Action '${fqn}' collides with a Resource of the same logical id`));\n }\n const target = {\n Kind: \"action\",\n Type: type,\n Namespace: namespace,\n FQN: fqn,\n LogicalId: id,\n Input: input,\n Captures: captures,\n Run: run,\n Output: undefined,\n };\n target.toString = () => `Action<${type}>(${id})`;\n actions[fqn] = target;\n // `yield* Sync({...})` returns `Output<Out>`. The engine writes the\n // materialized value into `tracker[fqn]` during apply; `Output.of(action)`\n // resolves a ResourceExpr by looking up `outputs[fqn]` — which is\n // precisely that materialized value. Property access into the returned\n // Output chains through the standard PropExpr proxy.\n return Output.of(target);\n});\n//# sourceMappingURL=Action.js.map","import * as Duration from \"effect/Duration\";\nimport * as Effect from \"effect/Effect\";\nimport * as Exit from \"effect/Exit\";\nimport * as Metric from \"effect/Metric\";\n/**\n * Counter for resource lifecycle operations. Tagged per call with\n * `resource_type`, `op` (`precreate`/`create`/`update`/`delete`/`read`),\n * and `status` (`success`/`error`).\n */\nexport const resourceCounter = Metric.counter(\"alchemy.resource.operations\", {\n description: \"Number of resource lifecycle operations dispatched by alchemy apply.\",\n incremental: true,\n});\n/**\n * Histogram of how long each lifecycle operation takes.\n */\nexport const resourceDuration = Metric.timer(\"alchemy.resource.duration\", {\n description: \"Wall-clock duration of resource lifecycle operations dispatched by alchemy apply.\",\n});\n/**\n * Counter for CLI command invocations.\n */\nexport const cliCounter = Metric.counter(\"alchemy.cli.invocations\", {\n description: \"Number of alchemy CLI command invocations.\",\n incremental: true,\n});\n/**\n * Counter for Cloudflare State Store bootstrap/deploy operations.\n * Tagged per call with `op` (e.g. `deploy`) and `status`\n * (`success`/`error`) so that the deploy success rate of the\n * state store itself can be tracked separately from regular\n * resource lifecycle ops.\n */\nexport const stateStoreCounter = Metric.counter(\"alchemy.state_store.operations\", {\n description: \"Number of Cloudflare State Store deploy/bootstrap operations dispatched by alchemy.\",\n incremental: true,\n});\n/**\n * Counter for State store layer construction. Tagged with `id` (the\n * `StateService.id` slug) so we can answer \"how many distinct projects\n * are using each backend\" from the corresponding `state_store.init`\n * spans. Open-ended on purpose: third-party state stores get counted\n * automatically by setting their `StateService.id`.\n */\nexport const stateStoreInitCounter = Metric.counter(\"alchemy.state_store.inits\", {\n description: \"Number of times a State store layer is constructed.\",\n incremental: true,\n});\n/**\n * Wraps a resource lifecycle Effect to record a counter + timer entry,\n * tagged with `resource_type`, `op`, and `status` (`success`/`error`).\n *\n * Usage:\n * ```ts\n * provider.reconcile(input).pipe(recordResourceOp(node.resource.Type, \"create\"))\n * ```\n */\nexport const recordResourceOp = (resourceType, op) => (self) => Effect.suspend(() => {\n const startNs = process.hrtime.bigint();\n const baseAttrs = { resource_type: resourceType, op };\n return self.pipe(Effect.onExit((exit) => recordOutcome(baseAttrs, Exit.isSuccess(exit) ? \"success\" : \"error\", elapsed(startNs))));\n});\n/**\n * Wraps a CLI command Effect to bump {@link cliCounter} with the\n * outcome (`success`/`error`).\n */\nexport const recordCli = (command) => (self) => self.pipe(Effect.onExit((exit) => Metric.update(Metric.withAttributes(cliCounter, {\n command,\n status: Exit.isSuccess(exit) ? \"success\" : \"error\",\n}), 1)));\n/**\n * Wraps a Cloudflare State Store deploy/bootstrap Effect to bump\n * {@link stateStoreCounter} with the outcome (`success`/`error`),\n * tagged with the given `op`.\n */\nexport const recordStateStoreOp = (op) => (self) => self.pipe(Effect.onExit((exit) => Metric.update(Metric.withAttributes(stateStoreCounter, {\n op,\n status: Exit.isSuccess(exit) ? \"success\" : \"error\",\n}), 1)));\n/**\n * Wraps a State store construction Effect to:\n *\n * 1. Bump {@link stateStoreInitCounter} tagged with `id`.\n * 2. Open a `state_store.init` span carrying\n * `alchemy.state_store.id` so Axiom (which can't query metric\n * datasets via APL) can group projects by backend.\n *\n * The `id` is read off the constructed `StateService.id` field, so any\n * third-party state-store implementation gets tracked just by setting\n * a stable slug there. Apply at every `Layer.effect(State, …)` site\n * exactly once.\n */\nexport const recordStateStoreInit = (self) => self.pipe(Effect.tap((service) => Effect.all([\n Metric.update(Metric.withAttributes(stateStoreInitCounter, { id: service.id }), 1),\n Effect.annotateCurrentSpan(\"alchemy.state_store.id\", service.id),\n], { discard: true })), Effect.withSpan(\"state_store.init\"));\nconst elapsed = (startNs) => Duration.nanos(process.hrtime.bigint() - startNs);\nconst recordOutcome = (baseAttrs, status, duration) => {\n const attrs = { ...baseAttrs, status };\n return Effect.all([\n Metric.update(Metric.withAttributes(resourceCounter, attrs), 1),\n Metric.update(Metric.withAttributes(resourceDuration, attrs), duration),\n ], { discard: true });\n};\n//# sourceMappingURL=Metrics.js.map","/**\n * Compute the set of graph nodes that participate in a dependency cycle.\n *\n * A node is considered \"in a cycle\" iff it sits in a strongly-connected\n * component (SCC) of size > 1, or has a self-edge (size-1 SCC that loops\n * back to itself).\n *\n * Implementation is iterative Tarjan's algorithm to avoid blowing the JS\n * call stack on very wide graphs.\n */\nexport const findCycleMembers = (edges) => {\n const cycleMembers = new Set();\n let index = 0;\n const indexOf = new Map();\n const lowlink = new Map();\n const onStack = new Set();\n const stack = [];\n const callStack = [];\n const startNode = (node) => {\n indexOf.set(node, index);\n lowlink.set(node, index);\n index += 1;\n stack.push(node);\n onStack.add(node);\n callStack.push({ node, childIdx: 0 });\n };\n for (const root of Object.keys(edges)) {\n if (indexOf.has(root))\n continue;\n startNode(root);\n while (callStack.length > 0) {\n const frame = callStack[callStack.length - 1];\n const children = edges[frame.node] ?? [];\n if (frame.childIdx < children.length) {\n const child = children[frame.childIdx];\n frame.childIdx += 1;\n if (!indexOf.has(child)) {\n startNode(child);\n continue;\n }\n if (onStack.has(child)) {\n lowlink.set(frame.node, Math.min(lowlink.get(frame.node), indexOf.get(child)));\n }\n continue;\n }\n // All children processed: maybe close an SCC.\n if (lowlink.get(frame.node) === indexOf.get(frame.node)) {\n const scc = [];\n for (;;) {\n const w = stack.pop();\n onStack.delete(w);\n scc.push(w);\n if (w === frame.node)\n break;\n }\n if (scc.length > 1) {\n for (const fqn of scc)\n cycleMembers.add(fqn);\n }\n else {\n // Size-1 SCC: only counts as a cycle if it has a self-edge.\n const only = scc[0];\n if ((edges[only] ?? []).includes(only)) {\n cycleMembers.add(only);\n }\n }\n }\n // Pop frame and propagate lowlink up to the parent.\n callStack.pop();\n const parent = callStack[callStack.length - 1];\n if (parent) {\n const cur = lowlink.get(parent.node);\n const childLow = lowlink.get(frame.node);\n if (childLow < cur)\n lowlink.set(parent.node, childLow);\n }\n }\n }\n return cycleMembers;\n};\n//# sourceMappingURL=scc.js.map","import * as Effect from \"effect/Effect\";\nimport { stableValue } from \"./stable.js\";\nexport const sha256 = (input) => Effect.promise(async () => {\n const digest = await crypto.subtle.digest(\"SHA-256\", toArrayBuffer(input));\n const hashArray = Array.from(new Uint8Array(digest));\n return hashArray.map((b) => b.toString(16).padStart(2, \"0\")).join(\"\");\n});\nexport const sha256Object = (input) => sha256(JSON.stringify(stableValue(input)));\n/**\n * Stable sha256 hex digest of a resolved Task input. Unlike\n * {@link sha256Object} this does not stabilize key ordering — it hashes the\n * raw `JSON.stringify(input ?? null)` so identical inputs map to identical\n * hashes for caching/equality checks.\n */\nexport const hashInput = (input) => sha256(JSON.stringify(input ?? null));\nconst toArrayBuffer = (input) => {\n if (input instanceof ArrayBuffer) {\n return input;\n }\n if (typeof input === \"string\") {\n return new TextEncoder().encode(input);\n }\n return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);\n};\n//# sourceMappingURL=sha256.js.map","/** @effect-diagnostics anyUnknownInErrorContext:off */\n/** @effect-diagnostics missingEffectError:off */\nimport * as Config from \"effect/Config\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as Option from \"effect/Option\";\nimport { asEffect } from \".//Util/types.js\";\nimport { isAction } from \"./Action.js\";\nimport { AdoptPolicy, OwnedBySomeoneElse, stripUnowned, Unowned, } from \"./AdoptPolicy.js\";\nimport { AlchemyContext } from \"./AlchemyContext.js\";\nimport { Artifacts, ArtifactStore, createArtifactStore, ensureArtifactStore, makeScopedArtifacts, } from \"./Artifacts.js\";\nimport { dedupeBindings, diffBindings, havePropsChanged, isResolved, } from \"./Diff.js\";\nimport { parseFqn } from \"./FQN.js\";\nimport { generateInstanceId, InstanceId } from \"./InstanceId.js\";\nimport * as Output from \"./Output.js\";\nimport { findProviderByType, missingProviderError, Provider, providerForMode, tryFindProviderByType, } from \"./Provider.js\";\nimport { defaultProviderMode, stampedMode, } from \"./ProviderMode.js\";\nimport { isResource, missingImplementation, } from \"./Resource.js\";\nimport {} from \"./Stack.js\";\nimport { isActionState, State, } from \"./State/index.js\";\nimport { isPlainData, mapPlainData } from \"./Util/data.js\";\nimport { findCycleMembers } from \"./Util/scc.js\";\nimport { hashInput } from \"./Util/sha256.js\";\nexport const isCRUD = (node) => {\n return (node &&\n typeof node === \"object\" &&\n (node.action === \"create\" ||\n node.action === \"update\" ||\n node.action === \"replace\" ||\n node.action === \"noop\"));\n};\nexport const make = (stack, options = {}) => \n// @ts-expect-error\nEffect.gen(function* () {\n const state = yield* yield* State;\n const resources = Object.values(stack.resources);\n const actions = Object.values(stack.actions ?? {});\n // A bare platform tag yields a forward reference registered with\n // `undefined` props (and `RequiresImplementation`); its `.make(props,\n // impl)` Layer repairs the props when it builds (in either order — the\n // #874 circular env-tag pattern). Props still `undefined` after the\n // whole program evaluated means the tag was yielded but its Layer was\n // never provided — fail fast naming the class and its Layer instead of\n // letting a provider read `undefined` props (#1054). Plain resources\n // may legitimately be yielded without props (a reference to\n // already-deployed state), so the check is scoped to platform tags.\n for (const resource of resources) {\n if (resource.RequiresImplementation && resource.Props === undefined) {\n yield* Effect.die(missingImplementation(resource.Type, resource.LogicalId));\n }\n }\n // TODO(sam): rename terminology to Stack\n const stackName = stack.name;\n const stage = stack.stage;\n // Resolve the effective adoption setting for this plan. AdoptPolicy\n // (provided by the CLI or scoped via `adopt(...)`) takes precedence; if\n // unset, fall back to the AlchemyContext's `adopt` default; otherwise\n // adoption is disabled.\n const shouldAdopt = Effect.gen(function* () {\n const fromService = yield* Effect.serviceOption(AdoptPolicy);\n if (Option.isSome(fromService))\n return fromService.value;\n const ctx = yield* Effect.serviceOption(AlchemyContext);\n return Option.match(ctx, {\n onNone: () => false,\n onSome: (c) => c.adopt,\n });\n });\n // The run-level default provider mode (`alchemy dev` → \"local\",\n // `alchemy deploy` → \"live\"). A resource-scoped `remote()` (captured on\n // the resource at registration as `Mode`) opts out of local emulation.\n const runDefaultMode = yield* defaultProviderMode;\n /**\n * Resolve the effective provider mode and the concrete provider\n * service for a resource.\n *\n * The mode only \"sticks\" when the provider actually distinguishes\n * modes (registered via `ProviderLayer.dual`). Mode-agnostic providers\n * satisfy any requested mode with their single implementation — in a\n * dev run, a construct that mixes emulatable resources with live-only\n * ones (e.g. R2 buckets) just works.\n */\n const resolveProviderAndMode = Effect.fn(function* (resource) {\n const base = yield* findProviderByType(resource.Type);\n const mode = base.modes !== undefined\n ? (resource.Mode ?? runDefaultMode)\n : undefined;\n const provider = yield* providerForMode(base, mode);\n return { provider, mode };\n });\n /**\n * Has this resource switched provider modes since it was last\n * reconciled? Rows without a persisted mode were written by a\n * pre-provider-mode engine (or a provider that only became dual-mode\n * later) — their physical resource is LIVE unless its attrs carry a\n * `dev:` identity marker proving it was reconciled locally (see\n * {@link stampedMode}). A dev run replaces unstamped live rows exactly\n * like stamped live rows; live runs replace unstamped marker rows.\n */\n const hasModeSwitched = (mode, oldState) => mode !== undefined &&\n oldState !== undefined &&\n stampedMode(oldState) !== mode;\n const resourceFqns = yield* state.list({\n stack: stackName,\n stage: stage,\n });\n const oldResources = yield* Effect.all(resourceFqns.map((fqn) => state.get({ stack: stackName, stage: stage, fqn })), { concurrency: \"unbounded\" });\n // Snapshot of every persisted row, keyed by FQN. The rename resolution\n // below reads from this map instead of issuing per-FQN `state.get`s —\n // every renamedFrom-decorated resource (each StaticSite carries one\n // forever) would otherwise add two round-trips per resource to every\n // plan against a remote state store. Plan is read-only, so the\n // snapshot cannot go stale within this run.\n const persistedRows = new Map(resourceFqns.map((fqn, i) => [fqn, oldResources[i]]));\n // ── FQN renames ──────────────────────────────────────────────────────\n // Map every former FQN claimed via `renamedFrom(...)` to its claimant's\n // current FQN. Two resources claiming the same former FQN is ambiguous\n // and fatal. A former FQN MAY still be actively declared — that is the\n // \"old id reused by a new resource\" case: the rename claim wins the\n // row (it is an explicit user statement that the row was theirs), and\n // the reusing resource plans a fresh create.\n const formerFqnClaims = new Map();\n for (const resource of resources) {\n for (const formerFqn of resource.FormerFqns ?? []) {\n if (formerFqn === resource.FQN)\n continue;\n const claimant = formerFqnClaims.get(formerFqn);\n if (claimant !== undefined && claimant !== resource.FQN) {\n return yield* Effect.die(new Error(`Resources '${claimant}' and '${resource.FQN}' both claim ` +\n `former FQN '${formerFqn}' via renamedFrom(...). A former ` +\n \"FQN can migrate to exactly one resource — remove the \" +\n \"decoration from one of them.\"));\n }\n formerFqnClaims.set(formerFqn, resource.FQN);\n }\n }\n // Resolve every rename migration up-front against the state snapshot,\n // BEFORE any node is built — other resources' planning depends on the\n // outcome (a resource declared at a former FQN whose row is migrating\n // away must start from scratch).\n //\n // For each renamer, in former-id declaration order (most recent\n // first):\n //\n // - `source` is the row that defines the resource's physical identity:\n // the row at its own FQN when present AND type-matching, otherwise\n // the first type-matching former row (→ `moved`).\n // - every OTHER type-matching former row sharing `source.instanceId`\n // is a leftover from an interrupted migration (only migration copies\n // instanceIds) — collected for state-only cleanup.\n // - former rows with a different instanceId belong to someone else and\n // are left to normal orphan handling; former rows with a different\n // resourceType (modulo registered type-aliases) can never be this\n // resource's row and are skipped entirely.\n // - a FOREIGN-typed row at the renamer's own FQN blocks the migration\n // fatally: landing the migrated row there would silently abandon\n // that row's cloud resource.\n const renameMigrations = new Map();\n const migratedRowFqns = new Set();\n const resolveRenamer = Effect.fn(function* (resource) {\n const provider = Option.getOrUndefined(yield* tryFindProviderByType(resource.Type));\n const allowedTypes = new Set([\n resource.Type,\n ...(provider?.aliases ?? []),\n ]);\n const persisted = persistedRows.get(resource.FQN);\n const persistedRow = isActionState(persisted)\n ? undefined\n : persisted;\n // A row at this resource's own FQN that a PREVIOUSLY RESOLVED\n // renamer claimed (a same-deploy shift: A→B while B→C — C took the\n // row at B) is moving away: it is not ours to keep and it does not\n // block the migration landing here.\n const rowTaken = migratedRowFqns.has(resource.FQN);\n const ownRow = !rowTaken &&\n persistedRow !== undefined &&\n allowedTypes.has(persistedRow.resourceType)\n ? persistedRow\n : undefined;\n let source = ownRow;\n let adopted = ownRow;\n const renamedFrom = [];\n for (const formerFqn of resource.FormerFqns) {\n if (formerFqnClaims.get(formerFqn) !== resource.FQN)\n continue;\n // The same former id may be listed twice (or resolve identically);\n // collect each former row once.\n if (renamedFrom.includes(formerFqn))\n continue;\n const formerPersisted = persistedRows.get(formerFqn);\n if (formerPersisted === undefined || isActionState(formerPersisted)) {\n continue;\n }\n const formerRow = formerPersisted;\n if (!allowedTypes.has(formerRow.resourceType))\n continue;\n if (source === undefined) {\n source = formerRow;\n adopted = {\n ...formerRow,\n fqn: resource.FQN,\n logicalId: resource.LogicalId,\n namespace: resource.Namespace,\n };\n renamedFrom.push(formerFqn);\n }\n else if (source.instanceId === formerRow.instanceId) {\n renamedFrom.push(formerFqn);\n }\n }\n if (renamedFrom.length === 0)\n return;\n if (persistedRow !== undefined && ownRow === undefined && !rowTaken) {\n return yield* Effect.die(new Error(`Cannot migrate '${renamedFrom[0]}' to '${resource.FQN}': a ` +\n `state row of a different type ('${persistedRow.resourceType}') ` +\n `already occupies '${resource.FQN}'. Migrating over it would ` +\n \"silently abandon that row's cloud resource. Delete or \" +\n \"rename the conflicting resource first, then re-deploy.\"));\n }\n renameMigrations.set(resource.FQN, {\n row: adopted,\n renamedFrom,\n moved: adopted !== ownRow,\n });\n for (const formerFqn of renamedFrom)\n migratedRowFqns.add(formerFqn);\n });\n // Resolve renamers in claim-dependency order: when resource R's OWN\n // FQN is claimed as a former id by resource S (a same-deploy shift:\n // A→B while B→C), S must resolve first — whether S takes R's row\n // decides whether R still owns it, or falls back to ITS former rows.\n // Iterate to fixpoint; anything left is a claim CYCLE (a swap: A⇄B),\n // which cannot be persisted safely — the migrations would overwrite\n // and delete each other's rows — and dies loudly.\n let pendingRenamers = resources.filter((r) => r.FormerFqns?.length);\n const resolvedRenamers = new Set();\n while (pendingRenamers.length > 0) {\n const ready = pendingRenamers.filter((resource) => {\n const claimant = formerFqnClaims.get(resource.FQN);\n return claimant === undefined || resolvedRenamers.has(claimant);\n });\n if (ready.length === 0) {\n return yield* Effect.die(new Error(`Rename cycle detected among [${pendingRenamers\n .map((r) => `'${r.FQN}'`)\n .join(\", \")}]: their renamedFrom(...) declarations claim each other's ` +\n \"FQNs. Swapping ids in one deploy is not supported — rename \" +\n \"through a temporary id across two deploys instead.\"));\n }\n for (const resource of ready) {\n yield* resolveRenamer(resource);\n resolvedRenamers.add(resource.FQN);\n }\n pendingRenamers = pendingRenamers.filter((r) => !resolvedRenamers.has(r.FQN));\n }\n /**\n * Fetch the persisted row for a declared resource, resolving renames\n * (see the pre-computed `renameMigrations` above):\n *\n * - a renamer plans from its migrated row (`renamedFrom` rides onto\n * the plan node; apply persists the move before any lifecycle op)\n * - a resource declared at a former FQN whose row is migrating away\n * starts from scratch — the row is NOT its state, whatever the FQN\n * says\n */\n const getPersistedRow = Effect.fn(function* (resource) {\n const migration = renameMigrations.get(resource.FQN);\n if (migration !== undefined) {\n return {\n row: migration.row,\n renamedFrom: migration.renamedFrom,\n renameMoved: migration.moved,\n };\n }\n const persisted = yield* state.get({\n stack: stackName,\n stage: stage,\n fqn: resource.FQN,\n });\n const row = isActionState(persisted)\n ? undefined\n : persisted;\n if (row !== undefined && migratedRowFqns.has(resource.FQN)) {\n return { row: undefined, renamedFrom: undefined, renameMoved: false };\n }\n return { row, renamedFrom: undefined, renameMoved: false };\n });\n const resolvedResources = {};\n const resolveResource = (resourceExpr) => Effect.gen(function* () {\n // Tasks share the ResourceExpr machinery but have no provider /\n // stable-properties story at plan time. Leave the expression\n // unsubstituted — Apply resolves it from the tracker at run time.\n if (isAction(resourceExpr.src)) {\n return resourceExpr;\n }\n // @ts-expect-error\n return yield* (resolvedResources[resourceExpr.src.FQN] ??=\n yield* Effect.cached(Effect.gen(function* () {\n const resource = resourceExpr.src;\n const { provider, mode } = yield* resolveProviderAndMode(resource);\n const props = materializeStableRefs(yield* resolveInput(resource.Props));\n // Falls back to the row at a former FQN (`renamedFrom`) so a\n // renamed resource's stable attributes keep flowing to\n // downstream diffs across the migration.\n const { row: oldState } = yield* getPersistedRow(resource);\n if (!oldState || oldState.status === \"creating\") {\n return resourceExpr;\n }\n // The resource is switching provider modes (local ⇄ live):\n // it will be replaced, so nothing about the persisted attrs\n // is stable for downstream consumers.\n if (hasModeSwitched(mode, oldState)) {\n return resourceExpr;\n }\n const oldProps = oldState.status === \"updating\"\n ? oldState.old.props\n : oldState.props;\n // Normalize both sides through `dedupeBindings` so the binding\n // sets handed to `diff` are deduped AND sid-sorted — provider\n // diffs that hash/compare the arrays never churn on\n // registration-order flips (or on legacy unsorted state).\n const oldBindings = dedupeBindings(oldState.bindings ?? []);\n const newBindings = dedupeBindings(stack.bindings[resource.FQN] ?? []);\n const diff = yield* provider.diff\n ? provider\n .diff({\n id: resource.LogicalId,\n fqn: resource.FQN,\n olds: oldProps,\n instanceId: oldState.instanceId,\n news: props,\n output: oldState.attr,\n oldBindings,\n newBindings,\n })\n .pipe(providePlanScope(resource.FQN, oldState.instanceId))\n : Effect.succeed(undefined);\n // A present `diff.stables` is authoritative for this update and\n // overrides `provider.stables`. We only fall back to the\n // provider-level \"always stable\" list when the diff does not\n // return one (e.g. no diff fn, or a diff that omits `stables`).\n const stables = diff?.stables ?? provider.stables ?? [];\n const withStables = (output) => stables.length > 0\n ? new Output.ResourceExpr(resourceExpr.src, Object.fromEntries(stables.map((stable) => [stable, output?.[stable]])))\n : // if there are no stable properties, treat every property as changed\n resourceExpr;\n if (diff == null) {\n if (havePropsChanged(oldProps, props)) {\n // the props have changed but the provider did not provide any hints as to what is stable\n // so we must assume everything has changed\n return withStables(oldState?.attr);\n }\n }\n else if (diff.action === \"update\") {\n return withStables(oldState?.attr);\n }\n else if (diff.action === \"replace\") {\n return resourceExpr;\n }\n // `--force` upgrades this resource's noop to an update (see the\n // diff mapping in the resource-graph pass below), so its\n // `reconcile` WILL re-run and may produce fresh attributes —\n // that is the point of --force. Returning the persisted attr\n // snapshot here would bake potentially-stale values into every\n // consumer's plan props and binding data, so consumers would\n // keep the stale attrs even though the upstream just\n // re-reconciled. Expose only the stable attributes and let\n // apply re-evaluate the rest against the forced reconcile's\n // fresh output.\n if (options.force) {\n return withStables(oldState?.attr);\n }\n if (oldState.status === \"created\" ||\n oldState.status === \"updated\" ||\n oldState.status === \"replaced\") {\n // we can safely return the attributes if we know they have stabilized\n return oldState?.attr;\n }\n else {\n // we must assume the resource doesn't exist if it hasn't stabilized\n return resourceExpr;\n }\n })));\n });\n /**\n * Resolve an input value as far as *truth* permits, keeping everything\n * else evaluable. A whole-resource reference to an updating upstream\n * stays a `ResourceExpr` (its stable attributes riding along): the\n * non-stable attributes are unknown at plan time and MUST be\n * re-evaluated — Apply runs `Output.evaluate(node.props, outputs)`\n * against the upstream's fresh post-reconcile attributes right before\n * `reconcile`. This is the value plan nodes carry; the diff-facing view\n * is derived from it by {@link materializeStableRefs}.\n */\n const resolveInput = (input, \n // Ancestor chain of the current walk. A value that appears on its own\n // ancestor path is a true cycle and is cut to `undefined` (a cycle can\n // never persist or serialize anyway); an immutable per-level set (not\n // a shared visited-set) keeps legitimately-shared diamond references\n // intact and is race-free under `concurrency: \"unbounded\"` (#1082).\n ancestors = new Set()) => Effect.gen(function* () {\n if (!input) {\n return input;\n }\n else if (Output.isExpr(input)) {\n return yield* resolveOutput(input);\n }\n else if (Config.isConfig(input)) {\n // Config is a lazy reference to the deploy environment. Resolve it\n // here so the concrete value flows into diffing/hashing (an opaque\n // Config hashes the same regardless of the underlying value) and so\n // providers receive a resolved value instead of a Config object.\n // `Config.redacted` resolves to a `Redacted`, which stays opaque via\n // the branch below.\n return yield* resolveInput(yield* input, ancestors);\n }\n else if (isResource(input)) {\n // Resource objects have dynamic properties (path, hash, etc.) that are\n // created on-demand by a Proxy getter and aren't enumerable via Object.entries.\n // Resolve the ResourceExpr to get the actual resource output, then continue\n // resolving any nested outputs in the result.\n const resourceExpr = Output.of(input);\n const resolved = yield* resolveOutput(resourceExpr);\n if (Output.isResourceExpr(resolved)) {\n // Still-unresolved reference (creating, replacing, or updating\n // upstream) — keep it evaluable for Apply.\n return resolved;\n }\n return yield* resolveInput(resolved, ancestors);\n }\n else if (isPlainData(input)) {\n if (ancestors.has(input)) {\n return undefined;\n }\n const nested = new Set(ancestors).add(input);\n if (Array.isArray(input)) {\n return yield* Effect.all(input.map((item) => resolveInput(item, nested)), { concurrency: \"unbounded\" });\n }\n return Object.fromEntries(yield* Effect.all(Object.entries(input).map(([key, value]) => resolveInput(value, nested).pipe(Effect.map((value) => [key, value]))), { concurrency: \"unbounded\" }));\n }\n // Everything else is an opaque leaf returned by identity: Duration,\n // Redacted, Date, and effect runtime values (a Worker's `exports`\n // carries each DO's `constructor` Effect and captured `services`\n // Context). Rebuilding a class instance entry-by-entry would strip\n // its prototype, and effect ≥4.0.0-beta.103's Context is cyclic\n // (#1082). Redacted additionally stays wrapped to preserve the\n // secrecy boundary. This sits after `Config.isConfig` on purpose —\n // Configs are Effects but must still resolve.\n return input;\n });\n /**\n * Project a {@link resolveInput} resolution into the DIFF-facing view:\n * replace each whole-resource `ResourceExpr` that carries stable\n * attributes (an upstream being *updated* in place — see `withStables` in\n * `resolveResource`) with a plain object of those stables, so the known\n * values flow into the consumer's `diff` and `havePropsChanged` instead\n * of the whole reference looking unresolved and `isResolved`\n * short-circuiting (#670 — this forced the Neon `Branch` to hand-extract\n * `project.projectId`).\n *\n * The projection is deliberately lossy — diffs compare VALUES. Plan nodes\n * never carry it: they keep the evaluable resolution so `reconcile` sees\n * the upstream's fresh non-stable attributes (e.g. a Lambda Version's\n * `version` number — #993's alias promotion bug).\n */\n const materializeStableRefs = (input, \n // Ancestor-path cycle guard — see resolveInput (#1082). Sync DFS, so\n // add/delete around the recursion is race-free.\n ancestors = new WeakSet()) => {\n // Expr checks come first: Output proxies are callable, so a plain\n // `typeof input === \"object\"` guard would let them slip through.\n if (Output.isResourceExpr(input) && input.stables) {\n return materializeStableRefs(input.stables, ancestors);\n }\n else if (Output.isExpr(input)) {\n // Genuinely unknown (e.g. a creating upstream) — nothing to show diff.\n return input;\n }\n else if (!input || !isPlainData(input)) {\n // Primitives and non-plain instances (Duration, Redacted, Date,\n // Effect/Layer/Context) are leaves — see isPlainData (#1082).\n return input;\n }\n return mapPlainData(input, ancestors, (child) => materializeStableRefs(child, ancestors));\n };\n const resolveOutput = (expr) => Effect.gen(function* () {\n if (Output.isResourceExpr(expr)) {\n return yield* resolveResource(expr);\n }\n else if (Output.isPropExpr(expr)) {\n const upstream = yield* resolveOutput(expr.expr);\n return upstream?.[expr.identifier];\n }\n else if (Output.isApplyExpr(expr)) {\n const upstream = yield* resolveOutput(expr.expr);\n return Output.hasOutputs(upstream) ? expr : expr.f(upstream);\n }\n else if (Output.isEffectExpr(expr)) {\n const upstream = yield* resolveOutput(expr.expr);\n return Output.hasOutputs(upstream) ? expr : yield* expr.f(upstream);\n }\n else if (Output.isFlatMapExpr(expr)) {\n const upstream = yield* resolveOutput(expr.expr);\n // Source still unresolved -> keep the flatMap intact for a later pass.\n // Otherwise run `f` to produce the next Output and resolve into it.\n return Output.hasOutputs(upstream)\n ? expr\n : yield* resolveOutput(Output.asOutput(expr.f(upstream)));\n }\n else if (Output.isAllExpr(expr)) {\n return yield* Effect.all(expr.outs.map(resolveOutput), {\n concurrency: \"unbounded\",\n });\n }\n else if (Output.isLiteralExpr(expr)) {\n return expr.value;\n }\n else if (Output.isRefExpr(expr)) {\n const refStack = expr.stack ?? stackName;\n const refStage = expr.stage ?? stage;\n const refState = yield* state\n .get({\n stack: refStack,\n stage: refStage,\n fqn: expr.resourceId,\n })\n .pipe(Effect.orDie);\n if (!refState) {\n return yield* Effect.die(new Output.InvalidReferenceError({\n message: `Reference to '${expr.resourceId}' in stack '${refStack}' and stage '${refStage}' not found. Have you deployed '${refStage}' of '${refStack}'?`,\n stack: refStack,\n stage: refStage,\n resourceId: expr.resourceId,\n }));\n }\n return refState.attr ?? refState.output;\n }\n else if (Output.isStackRefExpr(expr)) {\n const refStack = expr.stack;\n const refStage = expr.stage ?? stage;\n const output = yield* state\n .getOutput({\n stack: refStack,\n stage: refStage,\n })\n .pipe(Effect.orDie);\n if (output == null) {\n return yield* Effect.die(new Output.InvalidReferenceError({\n message: `Reference to stack '${refStack}' at stage '${refStage}' not found. Have you deployed stage '${refStage}' of '${refStack}'?`,\n stack: refStack,\n stage: refStage,\n resourceId: refStack,\n }));\n }\n return output;\n }\n else if (Output.isNamedExpr(expr)) {\n return yield* resolveOutput(expr.expr);\n }\n return yield* Effect.die(new Error(\"Not implemented yet\" + expr.kind));\n });\n // map of resource FQN -> its downstream dependencies (resources that depend on it)\n const oldDownstreamDependencies = Object.fromEntries(oldResources\n .filter((resource) => !!resource)\n .map((resource) => [resource.fqn, resource.downstream]));\n // Build a set of FQNs for the new resources to detect orphans\n const newResourceFqns = new Set(resources.map((r) => r.FQN));\n const newActionFqns = new Set(actions.map((t) => t.FQN));\n // Unified set used wherever the DAG must include both kinds.\n const newNodeFqns = new Set([...newResourceFqns, ...newActionFqns]);\n // Map FQN -> list of upstream FQNs (resources this one depends on via props).\n // Tasks contribute upstream edges through their `Input` expression.\n const newUpstreamDependencies = Object.fromEntries([\n ...resources.map((resource) => [\n resource.FQN,\n Object.values(Output.upstreamAny(resource.Props)).map((r) => r.FQN),\n ]),\n ...actions.map((action) => [\n action.FQN,\n // An Action depends on the resources referenced by its Input *and*\n // any Output captured via `yield* output` inside its init Effect.\n Array.from(new Set([\n ...Object.values(Output.upstreamAny(action.Input)).map((r) => r.FQN),\n ...Object.values(Output.upstreamAny(action.Captures)).map((r) => r.FQN),\n ])),\n ]),\n ]);\n // Map FQN -> list of upstream FQNs from bindings\n const bindingUpstreamDependencies = Object.fromEntries(resources.map((resource) => [\n resource.FQN,\n Object.values(Output.upstreamAny(stack.bindings[resource.FQN] ?? [])).map((r) => r.FQN),\n ]));\n // Combined prop + binding upstream for the desired graph, including\n // references to resources outside the current graph so delete validation can\n // tell whether any surviving resource still points at an orphan.\n const rawUpstreamDependencies = Object.fromEntries([\n ...resources.map((resource) => {\n const fqn = resource.FQN;\n const propDeps = newUpstreamDependencies[fqn] ?? [];\n const bindDeps = bindingUpstreamDependencies[fqn] ?? [];\n return [fqn, [...new Set([...propDeps, ...bindDeps])]];\n }),\n // Actions have no bindings — their upstream is input + init captures,\n // both already folded into newUpstreamDependencies above.\n ...actions.map((action) => {\n const fqn = action.FQN;\n return [fqn, newUpstreamDependencies[fqn] ?? []];\n }),\n ]);\n // Combined prop + binding upstream, filtered to resources/tasks in this\n // graph for scheduling and cycle detection.\n const allUpstreamDependencies = Object.fromEntries([\n ...resources.map((resource) => {\n const fqn = resource.FQN;\n const deps = rawUpstreamDependencies[fqn] ?? [];\n return [fqn, deps.filter((dep) => newNodeFqns.has(dep))];\n }),\n ...actions.map((action) => {\n const fqn = action.FQN;\n const deps = newUpstreamDependencies[fqn] ?? [];\n return [fqn, deps.filter((dep) => newNodeFqns.has(dep))];\n }),\n ]);\n // Resources that participate in a cycle when both prop and binding\n // edges are considered. Used below to decide whether an acyclic\n // binding edge should also become a downstream edge.\n const combinedCycleMembers = findCycleMembers(allUpstreamDependencies);\n // Map FQN -> list of downstream FQNs (resources/actions that depend on\n // this one).\n //\n // Prop edges always become downstream edges — they can't form cycles\n // (the resource graph is a DAG by construction once props are fully\n // resolved). Binding edges become downstream edges too, except when\n // they participate in a cycle in the combined graph: mutual bindings\n // (A binds to B's data, B binds to A's data) intentionally do not\n // create downstream edges, so deletion does not deadlock waiting on\n // each other (see the \"binding-only cycles inside a construct\" test\n // in `plan.test.ts`).\n //\n // Including acyclic binding edges is required for cloud APIs that\n // enforce the binding at the provider level — e.g. a Cloudflare\n // Worker with a `service` binding to another Worker cannot delete\n // the upstream worker until the downstream worker's binding has been\n // removed. Without the binding edge in `downstream`, the two delete\n // concurrently and the upstream delete fails with\n // `ServiceBindingConflict`.\n //\n // Actions don't have bindings, so for action upstreams we use only\n // prop edges (which collapse to `newUpstreamDependencies` lookups).\n const computeDownstream = (upFqn) => {\n const downstream = [];\n for (const [downFqn, upstreams] of Object.entries(rawUpstreamDependencies)) {\n if (downFqn === upFqn)\n continue;\n if (!upstreams.includes(upFqn))\n continue;\n const isPropEdge = (newUpstreamDependencies[downFqn] ?? []).includes(upFqn);\n if (isPropEdge) {\n downstream.push(downFqn);\n continue;\n }\n // Binding-only edge — exclude when both endpoints sit inside\n // the same SCC of the combined graph.\n if (combinedCycleMembers.has(upFqn) &&\n combinedCycleMembers.has(downFqn)) {\n continue;\n }\n downstream.push(downFqn);\n }\n return downstream;\n };\n const newDownstreamDependencies = Object.fromEntries([\n ...resources.map((resource) => [resource.FQN, computeDownstream(resource.FQN)]),\n ...actions.map((action) => [action.FQN, computeDownstream(action.FQN)]),\n ]);\n const resourceGraph = Object.fromEntries((yield* Effect.all(resources.map(Effect.fn(\"plan.diff.resource\")(function* (resource) {\n const { provider, mode } = yield* resolveProviderAndMode(resource);\n const id = resource.LogicalId;\n const fqn = resource.FQN;\n // Apply-facing props (stored on the plan node): whole-resource\n // references to updating upstreams stay evaluable `ResourceExpr`s.\n // Apply runs `Output.evaluate(node.props, outputs)` right before\n // `reconcile`, so these references resolve to the upstream's\n // fresh post-reconcile attributes.\n const applyProps = yield* resolveInput(resource.Props);\n // Diff-facing view of the same resolution: stable attributes\n // materialized so their known values flow into `diff` /\n // `havePropsChanged`.\n const news = materializeStableRefs(applyProps);\n const downstream = newDownstreamDependencies[fqn] ?? [];\n // Apply-facing binding rows, mirroring `applyProps`: payloads\n // whose data embeds a whole-resource reference to an updating\n // upstream keep it as an evaluable `ResourceExpr`. Apply runs\n // `Output.evaluate(node.bindings, outputs)` right before\n // `reconcile`, so the host receives the upstream's fresh\n // post-reconcile attributes. Collapse duplicates by sid so the\n // binding set handed to `diff` matches what `reconcile` receives\n // (see `dedupeBindings`).\n const applyBindings = dedupeBindings(yield* resolveInput(stack.bindings[fqn] ?? []));\n // Diff-facing view of the same rows: stable attributes\n // materialized so `diffBindings` / `provider.diff` compare known\n // values. Terminal commits still persist the payload the provider\n // actually reconciled with (#874) — Apply commits the evaluated\n // `bindingOutputs`, not these plan-time shapes.\n const newBindings = materializeStableRefs(applyBindings);\n // The row is looked up at the resource's FQN with a fallback to\n // its former FQNs (`renamedFrom`); a row found under a former\n // FQN arrives here already remapped to the new identity, and\n // `renamedFrom` rides onto the plan node so apply persists the\n // move. (A Task previously holding this FQN is treated as no\n // prior state — its row is reaped by `actionDeletions` below.)\n const { row: persistedRow, renamedFrom, renameMoved, } = yield* getPersistedRow(resource);\n let oldState = persistedRow;\n // Engine-level adoption. When there is no prior state, always\n // consult `provider.read` (if implemented) so the engine — not\n // each lifecycle method — owns the existence/ownership decision.\n //\n // The provider returns one of:\n // - `undefined` → resource doesn't exist; create it\n // - plain attrs → exists and is owned by us; silent adopt\n // - `Unowned(attrs)` → exists but is *not* ours\n //\n // Routing:\n // - owned → adopt the `created` state\n // from attrs and continue\n // through the normal diff\n // path (so subsequent props\n // drift produces an update).\n // - unowned + adopt enabled → take over: adopt the\n // `created` state and let the\n // next update overwrite tags.\n // - unowned + adopt disabled → fail with\n // `OwnedBySomeoneElse`.\n //\n // Plan construction is side-effect-free: the adopted `created`\n // state is only held in-memory here (to drive the diff) and rides\n // onto the plan node as `node.state`. Persisting it to the state\n // store happens exclusively during APPLY of that node (the update\n // lifecycle commits `updating` / `updated` carrying this state).\n // If planning persisted here, a mere `alchemy plan` / `--dry-run`\n // would claim ownership of an unowned cloud resource, arming a\n // later unrelated deploy to orphan-delete it. See\n // https://github.com/alchemy-run/alchemy/issues/793.\n //\n // After a cold-start adoption (engine just discovered an\n // existing cloud resource via `read`), force the engine's\n // normal `update` path so the provider can re-sync ownership\n // tags, configuration, etc. against the desired props.\n // Adoption carries state with `props: news`, so the default\n // diff sees no drift and would noop — which would leave any\n // foreign-owned tags / divergent config in place. Forcing\n // update keeps the deploy idempotent: if cloud state already\n // matches news, the provider's update is a no-op write.\n //\n // Skip the adoption probe entirely when `news` still contains\n // unresolved upstream Outputs (e.g. a `streamArn` referencing\n // a stream being created in the same plan). Calling `read` with\n // an unresolved value would surface as `ParseError` from the\n // SDK protocol layer. Resources whose props depend on\n // not-yet-created upstreams cannot themselves be pre-existing\n // — there's nothing to adopt.\n // A resource declared at a former FQN whose row just migrated\n // away is genuinely NEW by declaration — skip the probe. Its\n // predecessor's physical resource still carries tags branded\n // with THIS logical id (the migrated row's reconcile hasn't\n // re-branded them yet), so a tag-based `read` would find it\n // and silently adopt the very resource that was renamed away.\n const reusesMigratedFqn = migratedRowFqns.has(fqn);\n let forceUpdateAfterAdoption = false;\n if (oldState === undefined &&\n provider.read &&\n isResolved(news) &&\n !reusesMigratedFqn) {\n const adoptInstanceId = yield* generateInstanceId();\n const readResult = yield* provider\n .read({\n id,\n fqn,\n instanceId: adoptInstanceId,\n olds: news,\n output: undefined,\n })\n .pipe(providePlanScope(fqn, adoptInstanceId));\n if (readResult !== undefined) {\n const isUnowned = Unowned.is(readResult);\n // A resource-scoped `adopt(...)` (captured on the resource at\n // registration) overrides the stack/CLI default.\n const adoptThis = resource.Adopt ?? (yield* shouldAdopt);\n if (isUnowned && !adoptThis) {\n return yield* new OwnedBySomeoneElse({\n message: `Cannot adopt resource '${fqn}' (${resource.Type}): ` +\n \"it exists in the cloud but is not owned by this \" +\n \"stack/stage/logical-id. Re-run with `--adopt` (or \" +\n \"wrap the effect in `adopt(true)`) to take it over.\",\n resourceType: resource.Type,\n logicalId: id,\n });\n }\n const adoptedState = {\n status: \"created\",\n fqn,\n logicalId: id,\n instanceId: adoptInstanceId,\n namespace: resource.Namespace,\n resourceType: resource.Type,\n props: news,\n attr: stripUnowned(readResult),\n providerVersion: provider.version ?? 0,\n bindings: [],\n downstream,\n removalPolicy: resource.RemovalPolicy,\n providerMode: mode,\n };\n // In-memory only — do NOT persist here. Plan.make runs for\n // `alchemy plan` / `deploy --dry-run` too, so a `state.set`\n // would mutate persistent state during a read-only preview.\n // The adopted state rides onto the plan node via `oldState`\n // (→ `node.state`) and is persisted at APPLY time by the\n // update lifecycle's `updating` / `updated` commits. See\n // https://github.com/alchemy-run/alchemy/issues/793.\n oldState = adoptedState;\n forceUpdateAfterAdoption = true;\n }\n }\n // Sid-sorted like `newBindings` (see the resolveResource note).\n const oldBindings = dedupeBindings(oldState?.bindings ?? []);\n // Actions come from the materialized comparison (`newBindings`);\n // the payloads the node carries into Apply come from the\n // apply-faithful rows, joined by sid — both are views of the same\n // deduped `stack.bindings[fqn]` rows, so action and payload can\n // never drift. `delete` rows keep the persisted old data.\n const applyBindingData = new Map(applyBindings.map((b) => [b.sid, b.data]));\n const bindingDiffs = diffBindings(oldBindings, newBindings).map((b) => b.action === \"delete\" || !applyBindingData.has(b.sid)\n ? b\n : { ...b, data: applyBindingData.get(b.sid) });\n // Local ⇄ live switch: the persisted row was reconciled by a\n // different provider mode than the one resolved for this run.\n // The two runtimes host distinct physical instances, so this is\n // always a replacement — the new instance is created with the\n // new mode's provider, and Apply deletes the old generation\n // with the provider of the mode that created it (see\n // `deleteOldGenerations` / `collectGarbage`).\n const modeSwitched = hasModeSwitched(mode, oldState);\n const Node = (node) => ({\n ...node,\n provider,\n resource,\n bindings: bindingDiffs,\n downstream,\n mode,\n renamedFrom,\n });\n // Plan against the persisted state we have, not the ideal final state we\n // hoped to reach last time. Recovery is expressed by mapping each\n // intermediate state back onto a fresh CRUD action.\n if (oldState === undefined) {\n return Node({\n action: \"create\",\n props: applyProps,\n state: oldState,\n });\n }\n else if (!modeSwitched &&\n oldState.status === \"creating\" &&\n oldState.attr === undefined) {\n // A create may have succeeded before state persistence failed. If the\n // provider can recover an attribute snapshot, keep driving the same\n // create instead of starting over blindly.\n //\n // `creating` state persists the RAW plan-time props, which may\n // still contain unresolved Output expressions (e.g. a name\n // referencing an upstream created in the same failed deploy).\n // `read` implementations derive identity from `olds` when\n // `output` is undefined (as it is here), so handing them\n // unresolved exprs crashes. Skip the probe — same behavior as\n // a read that found nothing — and re-drive the create.\n if (provider.read && isResolved(oldState.props)) {\n const attr = yield* provider\n .read({\n id,\n fqn,\n instanceId: oldState.instanceId,\n olds: oldState.props,\n output: oldState.attr,\n })\n .pipe(providePlanScope(fqn, oldState.instanceId), \n // `creating` props pass `isResolved` yet can still carry\n // holes where unresolved Outputs were stripped at commit\n // time (see stripUnresolved) — e.g. a parent reference\n // persisted as `{}`. A provider that dereferences one\n // crashes deep inside its SDK client (a SchemaError\n // defect), which would brick every subsequent plan on\n // the stage. Recovery is best-effort: degrade the defect\n // to \"nothing recovered\" and re-drive the create (#995).\n Effect.catchDefect((defect) => Effect.logWarning(`Recovery read for '${fqn}' crashed; treating the ` +\n \"interrupted create as not recoverable and \" +\n \"re-driving it.\", defect).pipe(Effect.as(undefined))));\n if (attr !== undefined) {\n // The recovered resource may be foreign: our interrupted\n // create could have lost a name race, or died before\n // stamping ownership. Route `Unowned` through the same\n // adoption table as the cold-start probe above — never\n // silently take over (and later mutate/delete) a resource\n // we cannot prove we created.\n if (Unowned.is(attr)) {\n const adoptThis = resource.Adopt ?? (yield* shouldAdopt);\n if (!adoptThis) {\n return yield* new OwnedBySomeoneElse({\n message: `Cannot resume creating resource '${fqn}' ` +\n `(${resource.Type}): a resource with its physical ` +\n \"identity exists in the cloud but is not owned by \" +\n \"this stack/stage/logical-id. Re-run with `--adopt` \" +\n \"(or wrap the effect in `adopt(true)`) to take it \" +\n \"over.\",\n resourceType: resource.Type,\n logicalId: id,\n });\n }\n }\n // Continue through the normal diff below with the recovered\n // live snapshot. Desired props may have changed while the\n // previous create was interrupted; bypassing diff here can\n // drive an immutable change through reconcile and falsely\n // persist the old physical resource as converged.\n oldState = { ...oldState, attr: stripUnowned(attr) };\n }\n }\n }\n // Diff against whatever props represent the best-known current attempt.\n // For replacement recovery that means the top-level replacement props,\n // not the older generations stored under `old`.\n const oldProps = oldState.props;\n // On a mode switch the provider diff is skipped entirely:\n // comparing props across runtimes is meaningless (and the new\n // mode's provider has never seen the old mode's state). The\n // action is a replacement by definition.\n const diff = modeSwitched\n ? {\n action: \"replace\",\n deleteFirst: false,\n }\n : yield* asEffect(provider\n ?.diff?.({\n id,\n fqn,\n olds: oldProps,\n instanceId: oldState.instanceId,\n output: oldState.attr,\n news,\n oldBindings,\n newBindings,\n })\n .pipe(providePlanScope(fqn, oldState.instanceId))).pipe(Effect.map((diff) => diff ??\n {\n action: havePropsChanged(oldProps, news) ||\n bindingDiffs.some((b) => b.action !== \"noop\")\n ? \"update\"\n : \"noop\",\n }), Effect.map((diff) => options.force && diff.action === \"noop\"\n ? {\n action: \"update\",\n }\n : diff), \n // After a cold-start adoption (silent or takeover), force at\n // least an update so the provider re-syncs ownership tags /\n // config against the desired props (otherwise the engine\n // would noop and any drift between the existing cloud\n // resource and `news` — including foreign-owned tags after a\n // takeover — would persist).\n //\n // A row that just migrated from a former FQN (`renameMoved`)\n // gets the same treatment: its cloud resource is still\n // branded with the OLD logical id's tags, and if the old id\n // is being reused by a new resource, leaving them stale\n // would let the reuser's future adoption probes match the\n // wrong physical resource.\n Effect.map((diff) => (forceUpdateAfterAdoption || renameMoved) &&\n diff.action === \"noop\"\n ? { action: \"update\" }\n : diff));\n if (oldState.status === \"creating\") {\n if (diff.action === \"noop\") {\n // we're in the creating state and props are un-changed\n // let's just continue where we left off\n return Node({\n action: \"create\",\n props: applyProps,\n state: oldState,\n });\n }\n else if (diff.action === \"update\") {\n // props have changed in a way that is updatable\n // again, just continue with the create\n // TODO(sam): should we maybe try an update instead?\n return Node({\n action: \"create\",\n props: applyProps,\n state: oldState,\n });\n }\n else {\n // props have changed in an incompatible way\n // because it's possible that an un-updatable resource has already been created\n // we must use a replace step to create a new one and delete the potential old one\n return Node({\n action: \"replace\",\n props: applyProps,\n deleteFirst: diff.deleteFirst ?? false,\n state: oldState,\n });\n }\n }\n else if (oldState.status === \"updating\") {\n // Updating already targets the live resource, so noop/update both mean\n // \"finish the interrupted update\". Only a replace diff escalates it\n // into a fresh replacement.\n if (diff.action === \"update\" || diff.action === \"noop\") {\n // we can continue where we left off\n return Node({\n action: \"update\",\n props: applyProps,\n state: oldState,\n });\n }\n else {\n // we started to update a resource but now believe we should replace it\n return Node({\n action: \"replace\",\n deleteFirst: diff.deleteFirst ?? false,\n props: applyProps,\n // TODO(sam): can Apply handle replacements when the oldState is UpdatingResourceState?\n // -> or should we do a provider.read to try and reconcile back to UpdatedResourceState?\n state: oldState,\n });\n }\n }\n else if (oldState.status === \"replacing\") {\n // The replacement candidate is still being created. Noop/update keep\n // driving the same generation; replace means that candidate itself is\n // now obsolete and must be wrapped in a new outer generation.\n if (diff.action === \"noop\") {\n // this is the stable case - noop means just continue with the replacement\n return Node({\n action: \"replace\",\n deleteFirst: oldState.deleteFirst,\n props: applyProps,\n state: oldState,\n });\n }\n else if (diff.action === \"update\") {\n // potential problem here - the props have changed since we tried to replace,\n // but not enough to trigger another replacement. the resource provider should\n // be designed as idempotent to converge to the right state when creating the new resource\n // the newly generated instanceId is intended to assist with this\n return Node({\n action: \"replace\",\n deleteFirst: oldState.deleteFirst,\n props: applyProps,\n state: oldState,\n });\n }\n else {\n // The in-flight replacement candidate itself now needs replacement.\n // Mark this as a restart so Apply creates a fresh generation instead\n // of resuming the old replacement instance.\n return Node({\n restart: true,\n action: \"replace\",\n deleteFirst: diff.deleteFirst ?? oldState.deleteFirst,\n props: applyProps,\n state: oldState,\n });\n }\n }\n else if (oldState.status === \"replaced\") {\n // The new resource already exists. Noop means \"just let GC finish\",\n // update means \"mutate the current replacement before GC finishes\",\n // and replace means \"the current replacement also became obsolete\".\n if (diff.action === \"noop\") {\n // this is the stable case - noop means just continue cleaning up the replacement\n return Node({\n action: \"replace\",\n deleteFirst: oldState.deleteFirst,\n props: applyProps,\n state: oldState,\n });\n }\n else if (diff.action === \"update\") {\n // the replacement has been created but now also needs to be updated\n // the resource provider should:\n // 1. Update the newly created replacement resource\n // 2. Then proceed as normal to delete the replaced resources (after all downstream references are updated)\n return Node({\n action: \"update\",\n props: applyProps,\n state: oldState,\n });\n }\n else {\n // Cleanup is still pending, but the current \"new\" resource has already\n // become obsolete. Start another replacement generation and preserve\n // the existing replaced node as part of the recursive old chain.\n return Node({\n restart: true,\n action: \"replace\",\n deleteFirst: diff.deleteFirst ?? oldState.deleteFirst,\n props: applyProps,\n state: oldState,\n });\n }\n }\n else if (oldState.status === \"deleting\") {\n // we're in a partially deleted state, it is unclear whether it was or was not deleted\n // so continue by re-creating it with the same instanceId and desired props\n return Node({\n action: \"create\",\n props: applyProps,\n state: {\n ...oldState,\n status: \"creating\",\n props: news,\n },\n });\n }\n else if (diff.action === \"update\") {\n // Stable created/updated resources follow the normal CRUD mapping.\n return Node({\n action: \"update\",\n adopting: forceUpdateAfterAdoption,\n props: applyProps,\n state: oldState,\n });\n }\n else if (diff.action === \"replace\") {\n return Node({\n action: \"replace\",\n props: applyProps,\n state: oldState,\n deleteFirst: diff?.deleteFirst ?? false,\n });\n }\n else {\n return Node({\n action: \"noop\",\n state: oldState,\n });\n }\n })), { concurrency: \"unbounded\" })).map((update) => [update.resource.FQN, update]));\n // ── Action plan nodes ────────────────────────────────────────────────\n const actionGraph = Object.fromEntries((yield* Effect.all(actions.map(Effect.fn(\"plan.diff.action\")(function* (action) {\n const fqn = action.FQN;\n const downstream = newDownstreamDependencies[fqn] ?? [];\n // The node carries the RAW input expression (evaluated at apply);\n // the drift hash uses the diff-facing view so stable upstream\n // attributes hash as their known values.\n const resolvedInput = materializeStableRefs(yield* resolveInput(action.Input));\n const inputHash = yield* hashInput(resolvedInput);\n const oldState = yield* state.get({\n stack: stackName,\n stage,\n fqn,\n });\n if (oldState && !isActionState(oldState)) {\n // FQN collision with a resource — surface as a fatal error so\n // the user resolves it before we touch anything.\n return [\n fqn,\n {\n kind: \"action\",\n action: \"run\",\n def: action,\n input: action.Input,\n state: undefined,\n downstream,\n forced: false,\n },\n ];\n }\n const prior = oldState;\n const sameInput = prior?.status === \"ran\" && prior.inputHash === inputHash;\n if (sameInput && !options.force) {\n return [\n fqn,\n {\n kind: \"action\",\n action: \"noop\",\n def: action,\n state: prior,\n downstream,\n },\n ];\n }\n return [\n fqn,\n {\n kind: \"action\",\n action: \"run\",\n def: action,\n input: action.Input,\n state: prior,\n downstream,\n forced: !!options.force,\n },\n ];\n })), { concurrency: \"unbounded\" })));\n // SCC membership of the combined upstream graph. Apply uses it to\n // decide whether an update node must publish its prior attr early to\n // break a cycle, or can simply wait for upstreams like a DAG node\n // (the common case). Computed once, above, for the downstream graph.\n const cycleMembers = combinedCycleMembers;\n // Detect unsatisfiable dependency cycles among create/replace nodes.\n // Update/noop nodes signal their Deferred before waitForDeps when in a\n // cycle so they cannot deadlock. Create/replace nodes only signal\n // early when they have a precreate handler. Simulate the concurrent\n // execution: precreate nodes are immediately \"resolved\", then\n // iteratively resolve any node whose deps are all resolved. Remaining\n // nodes would deadlock.\n {\n const createReplaceNodes = new Set(Object.entries(resourceGraph)\n .filter(([_, node]) => node.action === \"create\" || node.action === \"replace\")\n .map(([fqn]) => fqn));\n if (createReplaceNodes.size > 0) {\n const hasPrecreate = new Set([...createReplaceNodes].filter((fqn) => !!resourceGraph[fqn]?.provider?.precreate));\n const resolved = new Set(hasPrecreate);\n let changed = true;\n while (changed) {\n changed = false;\n for (const fqn of createReplaceNodes) {\n if (resolved.has(fqn))\n continue;\n const deps = (allUpstreamDependencies[fqn] ?? []).filter((dep) => createReplaceNodes.has(dep));\n if (deps.every((dep) => resolved.has(dep))) {\n resolved.add(fqn);\n changed = true;\n }\n }\n }\n const deadlocked = [...createReplaceNodes].filter((fqn) => !resolved.has(fqn));\n if (deadlocked.length > 0) {\n const missingPrecreate = deadlocked.filter((fqn) => !hasPrecreate.has(fqn));\n return yield* Effect.die(new UnsatisfiedResourceCycle({\n message: `Circular dependency detected that cannot be resolved: [${deadlocked.join(\", \")}]. ` +\n `Resources lacking a precreate handler: [${missingPrecreate.join(\", \")}]. ` +\n `All resources in a dependency cycle must implement precreate to allow early signaling.`,\n cycle: deadlocked,\n missingPrecreate,\n }));\n }\n }\n }\n // Task deletions: state rows previously written by tasks that no\n // longer appear in the stack. The body is NOT invoked — we just drop\n // the row.\n const actionDeletions = Object.fromEntries((yield* Effect.all((yield* state.list({ stack: stackName, stage })).map(Effect.fn(\"plan.diff.actionDeletion\")(function* (fqn) {\n if (newActionFqns.has(fqn) || newResourceFqns.has(fqn))\n return;\n const persisted = yield* state.get({\n stack: stackName,\n stage,\n fqn,\n });\n if (!isActionState(persisted))\n return;\n const { logicalId } = parseFqn(fqn);\n return [\n fqn,\n {\n kind: \"action\",\n action: \"delete\",\n state: persisted,\n downstream: persisted.downstream ?? [],\n def: {\n Kind: \"action\",\n Namespace: persisted.namespace,\n FQN: fqn,\n LogicalId: logicalId,\n Type: persisted.actionType,\n Input: persisted.input,\n Captures: {},\n Run: () => undefined,\n Output: undefined,\n },\n },\n ];\n })), { concurrency: \"unbounded\" })).filter((v) => !!v));\n const deletions = Object.fromEntries((yield* Effect.all((yield* state.list({ stack: stackName, stage: stage })).map(Effect.fn(\"plan.diff.deletion\")(function* (fqn) {\n if (newResourceFqns.has(fqn) || newActionFqns.has(fqn)) {\n return;\n }\n const persisted = yield* state.get({\n stack: stackName,\n stage: stage,\n fqn,\n });\n // Tasks are routed through `actionDeletions` above.\n if (isActionState(persisted))\n return;\n const oldState = persisted;\n if (oldState) {\n // A row being migrated by a rename (`renameMigrations`) is\n // moving, not orphaned — apply drops it state-only after\n // committing the migrated row at its new FQN. Rows at former\n // FQNs that did NOT migrate (foreign type, different\n // instanceId, unclaimed) are absent from this set and fall\n // through to normal orphan deletion.\n if (migratedRowFqns.has(fqn)) {\n return;\n }\n const { logicalId } = parseFqn(fqn);\n const resourceType = oldState.resourceType;\n // A \"zombie\" row references a type with no registered provider\n // (removed from the program, or renamed without an alias).\n // That is fatal: the program and state disagree, and without\n // the provider the row's physical resource cannot be deleted\n // anyway. Die at plan time with a typed error naming the row\n // and the remediation instead of limping into a partial apply.\n //\n // Orphan deletes resolve the provider variant for the mode\n // that created the row (`providerMode`, or the `dev:` marker\n // inference for legacy unstamped rows), so e.g. a local dev\n // worker's row is deleted by the local provider even during a\n // live deploy — and vice versa. Unstamped rows are physically\n // live unless their attrs carry the marker (see stampedMode),\n // never the run default.\n const rowMode = stampedMode(oldState);\n const providerOption = yield* tryFindProviderByType(resourceType, rowMode);\n if (Option.isNone(providerOption)) {\n return yield* Effect.die(missingProviderError(resourceType, fqn));\n }\n const provider = providerOption.value;\n // NOTE: an attr-less row (interrupted create) is NOT recovered\n // here. Apply's `deleteResource` performs the authoritative\n // read-then-delete recovery — it also covers replaced-chain\n // old generations that never pass through plan, and routes\n // `Unowned` results away from `provider.delete`.\n return [\n fqn,\n {\n action: \"delete\",\n state: oldState,\n provider: provider,\n mode: oldState.providerMode,\n resource: {\n Namespace: oldState.namespace,\n FQN: fqn,\n LogicalId: logicalId,\n Type: oldState.resourceType,\n Attributes: oldState.attr,\n Props: oldState.props,\n Binding: undefined,\n Provider: Provider(resourceType),\n RemovalPolicy: oldState.removalPolicy,\n Adopt: undefined,\n RequiresImplementation: undefined,\n Mode: oldState.providerMode,\n FormerFqns: undefined,\n RuntimeContext: undefined,\n Providers: undefined,\n },\n downstream: oldDownstreamDependencies[fqn] ?? [],\n bindings: oldState.bindings.map((binding) => ({\n sid: binding.sid,\n action: \"delete\",\n data: binding.data,\n })),\n },\n ];\n }\n })), { concurrency: \"unbounded\" })).filter((v) => !!v));\n for (const resourceFqn of Object.keys(deletions)) {\n const dependencies = Object.entries(rawUpstreamDependencies)\n .filter(([survivorFqn, upstream]) => survivorFqn in resourceGraph && upstream.includes(resourceFqn))\n .map(([survivorFqn]) => survivorFqn);\n if (dependencies.length > 0) {\n return yield* new DeleteResourceHasDownstreamDependencies({\n message: `Resource ${resourceFqn} has downstream dependencies`,\n resourceId: resourceFqn,\n dependencies,\n });\n }\n }\n return {\n resources: resourceGraph,\n actions: actionGraph,\n deletions,\n actionDeletions,\n output: stack.output,\n cycleMembers,\n defaultMode: runDefaultMode,\n };\n}).pipe(ensureArtifactStore, Effect.withSpan(\"plan.make\", {\n attributes: {\n \"alchemy.stack\": stack.name,\n \"alchemy.stage\": stack.stage,\n \"alchemy.resources.count\": Object.keys(stack.resources).length,\n \"alchemy.force\": !!options.force,\n },\n}));\n/**\n * Build the plan that destroys every resource of `(stack.name, stack.stage)`.\n *\n * The spec is emptied out so every persisted resource becomes an orphan\n * deletion, and `output` is left undefined so `apply` does not overwrite the\n * last deploy's persisted stack output with an empty husk. `apply` recognizes\n * the `destroy` marker and deletes the stage's remaining persisted state (the\n * stack output record) once the destroy has converged, so `state.getOutput`\n * and `state.listStages` agree the stage is gone.\n *\n * @see https://github.com/alchemy-run/alchemy/issues/961\n */\nexport const destroy = (stack) => make({\n name: stack.name,\n stage: stack.stage,\n resources: {},\n bindings: {},\n actions: {},\n output: undefined,\n}).pipe(Effect.map((plan) => ({ ...plan, destroy: true })));\nconst providePlanScope = (fqn, instanceId) => (effect) => Effect.serviceOption(ArtifactStore).pipe(Effect.map(Option.getOrElse(createArtifactStore)), Effect.flatMap((store) => effect.pipe(Effect.provideService(Artifacts, makeScopedArtifacts(store, fqn)), Effect.provideService(InstanceId, instanceId))));\nexport class DeleteResourceHasDownstreamDependencies extends Data.TaggedError(\"DeleteResourceHasDownstreamDependencies\") {\n}\nexport class UnsatisfiedResourceCycle extends Data.TaggedError(\"UnsatisfiedResourceCycle\") {\n}\n// TODO(sam): compare props\n// oldBinding.props !== newBinding.props;\n/**\n * Print a plan in a human-readable format that shows the graph topology.\n */\nexport const printPlan = (plan) => {\n const lines = [];\n const allNodes = { ...plan.resources, ...plan.deletions };\n // Build reverse mapping: upstream -> downstream\n const upstreamMap = {};\n for (const [id] of Object.entries(allNodes)) {\n upstreamMap[id] = [];\n }\n for (const [id, node] of Object.entries(allNodes)) {\n if (!node)\n continue;\n for (const downstreamId of node.state?.downstream ?? []) {\n if (upstreamMap[downstreamId]) {\n upstreamMap[downstreamId].push(id);\n }\n }\n }\n // Action symbols\n const actionSymbol = (action) => {\n switch (action) {\n case \"create\":\n return \"+\";\n case \"update\":\n return \"~\";\n case \"delete\":\n return \"-\";\n case \"replace\":\n return \"±\";\n case \"noop\":\n return \"=\";\n default:\n return \"?\";\n }\n };\n // Print header\n lines.push(\"╔════════════════════════════════════════════════════════════════╗\");\n lines.push(\"║ PLAN ║\");\n lines.push(\"╠════════════════════════════════════════════════════════════════╣\");\n lines.push(\"║ Legend: + create, ~ update, - delete, ± replace, = noop, ║\");\n lines.push(\"║ λ run task, · skip task ║\");\n lines.push(\"╚════════════════════════════════════════════════════════════════╝\");\n lines.push(\"\");\n // Print resources section\n lines.push(\"┌─ Resources ────────────────────────────────────────────────────┐\");\n const resourceIds = Object.keys(plan.resources).sort();\n for (const id of resourceIds) {\n const node = plan.resources[id];\n const symbol = actionSymbol(node.action);\n const type = node.resource?.type ?? \"unknown\";\n const downstream = node.state?.downstream?.length\n ? ` → [${node.state?.downstream.join(\", \")}]`\n : \"\";\n const renamed = node.renamedFrom?.length\n ? ` (renamed from ${node.renamedFrom.join(\", \")})`\n : \"\";\n lines.push(`│ [${symbol}] ${id} (${type})${downstream}${renamed}`);\n }\n if (resourceIds.length === 0) {\n lines.push(\"│ (none)\");\n }\n lines.push(\"└────────────────────────────────────────────────────────────────┘\");\n lines.push(\"\");\n // Print tasks section\n lines.push(\"┌─ Tasks ────────────────────────────────────────────────────────┐\");\n const taskIds = Object.keys(plan.actions ?? {}).sort();\n for (const id of taskIds) {\n const node = plan.actions[id];\n const symbol = node.action === \"run\" ? \"λ\" : \"·\";\n const type = node.def.Type;\n const downstream = node.downstream.length\n ? ` → [${node.downstream.join(\", \")}]`\n : \"\";\n lines.push(`│ [${symbol}] ${id} (${type})${downstream}`);\n }\n if (taskIds.length === 0) {\n lines.push(\"│ (none)\");\n }\n lines.push(\"└────────────────────────────────────────────────────────────────┘\");\n lines.push(\"\");\n // Print deletions section\n lines.push(\"┌─ Deletions ────────────────────────────────────────────────────┐\");\n const deletionIds = Object.keys(plan.deletions).sort();\n for (const id of deletionIds) {\n const node = plan.deletions[id];\n const type = node.resource?.Type ?? \"unknown\";\n const downstream = node.state.downstream?.length\n ? ` → [${node.state.downstream.join(\", \")}]`\n : \"\";\n lines.push(`│ [-] ${id} (${type})${downstream}`);\n }\n const taskDeletionIds = Object.keys(plan.actionDeletions ?? {}).sort();\n for (const id of taskDeletionIds) {\n const node = plan.actionDeletions[id];\n lines.push(`│ [-] ${id} (${node.def.Type}) [action]`);\n }\n if (deletionIds.length === 0 && taskDeletionIds.length === 0) {\n lines.push(\"│ (none)\");\n }\n lines.push(\"└────────────────────────────────────────────────────────────────┘\");\n lines.push(\"\");\n return lines.join(\"\\n\");\n};\n//# sourceMappingURL=Plan.js.map","import * as Cause from \"effect/Cause\";\nimport * as Data from \"effect/Data\";\nimport * as Deferred from \"effect/Deferred\";\nimport * as Effect from \"effect/Effect\";\nimport * as Option from \"effect/Option\";\nimport { makeResolveContext } from \"./ActionRuntimeContext.js\";\nimport { stripUnowned, Unowned } from \"./AdoptPolicy.js\";\nimport { AlchemyContext } from \"./AlchemyContext.js\";\nimport { demandPlanCredentials, } from \"./Auth/Demand.js\";\nimport { RuntimeContext } from \"./RuntimeContext.js\";\nimport { Artifacts, ArtifactStore, createArtifactStore, ensureArtifactStore, makeScopedArtifacts, } from \"./Artifacts.js\";\nimport { Cli, } from \"./Cli/Cli.js\";\nimport { havePropsChanged, stripUnresolved } from \"./Diff.js\";\nimport { generateInstanceId, InstanceId } from \"./InstanceId.js\";\nimport * as Output from \"./Output.js\";\nimport {} from \"./Plan.js\";\nimport { findProviderByType, missingProviderError, tryFindProviderByType, } from \"./Provider.js\";\nimport { stampedMode } from \"./ProviderMode.js\";\nimport { Stack } from \"./Stack.js\";\nimport { Stage } from \"./Stage.js\";\nimport { State, StateStoreError, } from \"./State/index.js\";\nimport { recordResourceOp } from \"./Telemetry/Metrics.js\";\nimport { hashInput } from \"./Util/sha256.js\";\nconst provideLifecycleScope = (fqn, instanceId) => (effect) => Effect.serviceOption(ArtifactStore).pipe(Effect.map(Option.getOrElse(createArtifactStore)), Effect.flatMap((store) => effect.pipe(Effect.provideService(Artifacts, makeScopedArtifacts(store, fqn)), Effect.provideService(InstanceId, instanceId))));\n/**\n * Instruments a single provider lifecycle call with an OTel span\n * (`provider.<op>`), the resource counter / duration histogram, and the\n * scoped artifacts/instance services normally supplied by\n * {@link provideLifecycleScope}.\n *\n * This is the only call site through which provider lifecycle methods\n * are dispatched, so wrapping it here gives us a fully-instrumented\n * toolchain without touching any individual provider implementation.\n */\nconst instrumentLifecycle = (op, fqn, resourceType, logicalId, instanceId) => (effect) => effect.pipe(provideLifecycleScope(fqn, instanceId), recordResourceOp(resourceType, op), Effect.withSpan(`provider.${op}`, {\n attributes: {\n \"alchemy.resource.fqn\": fqn,\n \"alchemy.resource.type\": resourceType,\n \"alchemy.resource.logical_id\": logicalId,\n \"alchemy.resource.instance_id\": instanceId,\n \"alchemy.resource.op\": op,\n },\n}));\nexport const apply = (plan) => Effect.gen(function* () {\n // Credential-free dev: a dev-mode plan that needs the real cloud\n // (`Alchemy.remote()` rows, remote-proxied bindings, deletions of rows\n // stamped `providerMode: \"live\"`) demands cloud credentials exactly\n // once, up front, BEFORE any lifecycle operation runs — a fully-local\n // dev plan demands nothing. Non-dev runs never enter the seam: live\n // providers keep the pre-existing lazy credential flow. Wired here (not\n // in Deploy/Destroy) because `apply` is the single choke point every\n // path shares — CLI deploy/destroy, `Test.make` deploys, and\n // `test.provider` scratch stacks. See `Auth/Demand.ts`.\n const alchemy = yield* Effect.serviceOption(AlchemyContext);\n if (Option.isSome(alchemy) && alchemy.value.dev) {\n yield* demandPlanCredentials(plan);\n }\n const cli = yield* Cli;\n const session = yield* cli.startApplySession(plan);\n const state = yield* yield* State;\n const stack = yield* Stack;\n const stage = yield* Stage;\n const stackName = stack.name;\n const tracker = {};\n const terminalStatuses = new Map();\n // ── FQN migrations (renamedFrom) ──\n // Persist renames before any lifecycle operation runs: a node whose row\n // was found under a former FQN carries that row pre-remapped in\n // `node.state` (see Plan's rename resolution). Commit it at the current\n // FQN FIRST, then drop the former row — in that order, so an\n // interruption leaves rows at both FQNs with the same instanceId, which\n // the next plan recognizes as an in-flight migration (and never as an\n // orphan to delete).\n //\n // In a same-deploy shift (A→B while B→C), C's former FQN `B` is\n // simultaneously B's migration TARGET. C must NOT delete it: B's own\n // `state.set` supersedes the stale copy, and the migrations run\n // concurrently — the delete could land after B's write and destroy the\n // freshly migrated row.\n const migrationTargets = new Set(Object.values(plan.resources)\n .filter((node) => node.renamedFrom?.length && node.state !== undefined)\n .map((node) => node.resource.FQN));\n yield* Effect.forEach(Object.values(plan.resources), (node) => {\n const { renamedFrom, state: row } = node;\n return renamedFrom === undefined ||\n renamedFrom.length === 0 ||\n row === undefined\n ? Effect.void\n : Effect.gen(function* () {\n yield* state.set({\n stack: stackName,\n stage,\n fqn: node.resource.FQN,\n value: row,\n });\n yield* Effect.forEach(renamedFrom.filter((formerFqn) => !migrationTargets.has(formerFqn)), (formerFqn) => state.delete({ stack: stackName, stage, fqn: formerFqn }), { concurrency: \"unbounded\" });\n });\n }, { concurrency: \"unbounded\" });\n yield* executePlan(plan, tracker, terminalStatuses, session, state, stackName, stage);\n // TODO(sam): support roll back to previous state if errors occur during expansion\n // -> RISK: some UPDATEs may not be reversible (i.e. trigger replacements)\n // TODO(sam): should pivot be done separately? E.g shift traffic?\n yield* collectGarbage(plan, session);\n yield* converge(plan, tracker, terminalStatuses, session, state, stackName, stage);\n yield* Effect.forEach(Array.from(terminalStatuses.values()), ({ id, type, status, providerMode }) => session.emit({ kind: \"status-change\", id, type, status, providerMode }), { concurrency: \"unbounded\" });\n yield* session.done();\n if (plan.destroy) {\n // The destroy converged: every resource row was deleted above. Drop\n // the rest of the stage's persisted state — notably the stack output\n // record written by the last deploy — so `getOutput` returns\n // undefined and `listStages` no longer reports the stage.\n // https://github.com/alchemy-run/alchemy/issues/961\n yield* state.deleteStack({ stack: stackName, stage });\n // Invariant: a successful destroy leaves the stage EMPTY. If rows\n // survive, this destroy session could not actually see (or delete)\n // the stack's state — e.g. its plan listed an empty store while\n // committed rows existed — and reporting success here would silently\n // leak every cloud resource those rows track. Fail loudly instead so\n // the leak surfaces in the run that caused it.\n const remaining = yield* state.list({ stack: stackName, stage });\n if (remaining.length > 0) {\n return yield* Effect.fail(new StateStoreError({\n message: `destroy of ${stackName}/${stage} reported success but ${remaining.length} ` +\n `state row(s) remain (${remaining.join(\", \")}) — the destroy session could ` +\n `not see the stack's persisted state, so its cloud resources were NOT deleted`,\n }));\n }\n return undefined;\n }\n if (!plan.output) {\n return undefined;\n }\n const outputs = Object.fromEntries(Object.entries(tracker).map(([fqn, t]) => [fqn, t.output]));\n const resolved = yield* Output.evaluate(plan.output, outputs);\n // Persist the stack's evaluated outputs so cross-stack references\n // (`yield* OtherStack` / `OtherStack.stage.<name>` / `Output.stackRef`)\n // can read them back out of the state store.\n yield* state.setOutput({ stack: stackName, stage, value: resolved });\n return resolved;\n}).pipe(ensureArtifactStore, Effect.withSpan(\"apply\", {\n attributes: {\n \"alchemy.resources.count\": Object.keys(plan.resources).length,\n \"alchemy.deletions.count\": Object.keys(plan.deletions).length,\n },\n}));\n// ── Phase 1: concurrent initial execution ──────────────────────────────────\n//\n// Each resource gets a Deferred<void> that signals \"I have some output\n// available in `tracker`.\" Resources with `precreate` signal early so that\n// downstream resources can resolve stable identifiers without deadlocking.\n// The actual output lives in the mutable `tracker` map, not in the Deferred.\nconst executePlan = Effect.fn(function* (plan, tracker, terminalStatuses, session, state, stackName, stage) {\n // Resources and tasks share the same FQN namespace and DAG, so the\n // scheduler tracks them together. Each entry gets a single Deferred that\n // signals \"my output is available in `tracker`.\"\n const allNodes = {\n ...plan.resources,\n ...plan.actions,\n };\n const ready = Object.fromEntries(yield* Effect.all(Object.keys(allNodes).map((fqn) => Effect.map(Deferred.make(), (d) => [fqn, d]))));\n // `readyStable` fires only when a node has reached its TERMINAL output —\n // resources after `reconcile`, tasks after the body completes. Resource\n // precreate stubs do NOT signal `readyStable`, so any consumer that\n // requires stable inputs (e.g. Tasks) waits past the precreate phase.\n const readyStable = Object.fromEntries(yield* Effect.all(Object.keys(allNodes).map((fqn) => Effect.map(Deferred.make(), (d) => [fqn, d]))));\n const getOutputs = () => Object.fromEntries(Object.entries(tracker).map(([fqn, t]) => [fqn, t.output]));\n const waitForDeps = (fqns) => Effect.all(fqns\n .filter((fqn) => fqn in ready)\n .map((fqn) => \n // Non-cycle upstreams must be observed at their TERMINAL output\n // (`readyStable`), not their early precreate signal (`ready`). This\n // is what makes a failed upstream actually interrupt its downstream:\n // a resource with `precreate` resolves `ready` before its real\n // `reconcile` runs, so a downstream waiting on `ready` would proceed\n // (and even finish) even though the upstream's reconcile later\n // failed. Waiting on `readyStable` means the downstream's\n // `waitForDeps` short-circuits with the upstream's failure cause.\n //\n // Cycle members are the exception: peers in an SCC depend on each\n // other, so they must rendezvous on the early `ready`/precreate\n // signal to break the deadlock. Phase 3 (`converge`) re-runs them\n // against final outputs once the cycle settles.\n plan.cycleMembers.has(fqn)\n ? Deferred.await(ready[fqn])\n : Deferred.await(readyStable[fqn])), { concurrency: \"unbounded\" });\n const waitForStableDeps = (fqns) => Effect.all(fqns\n .filter((fqn) => fqn in readyStable)\n .map((fqn) => Deferred.await(readyStable[fqn])), { concurrency: \"unbounded\" });\n const failures = [];\n yield* Effect.all(Object.entries(allNodes).map(([fqn, node]) => node.kind === \"action\"\n ? executeActionNode(fqn, node, tracker, ready, readyStable, terminalStatuses, session, state, stackName, stage, getOutputs, waitForStableDeps, failures)\n : executeNode(fqn, node, tracker, ready, readyStable, terminalStatuses, session, state, stackName, stage, getOutputs, waitForDeps, failures, plan.cycleMembers.has(fqn))), { concurrency: \"unbounded\" });\n if (failures.length > 0) {\n // Aggregate every collected lifecycle failure into a single parallel Cause\n // so the apply ends with one combined error containing every distinct\n // failure / defect that occurred across the concurrent fibers.\n return yield* Effect.failCause(failures.map((f) => f.cause).reduce(Cause.combine));\n }\n});\nconst executeNode = (fqn, node, tracker, ready, readyStable, terminalStatuses, session, state, stackName, stage, getOutputs, waitForDeps, failures, inCycle) => Effect.gen(function* () {\n const logicalId = node.resource.LogicalId;\n const namespace = node.resource.Namespace;\n const commit = (value) => state.set({\n stack: stackName,\n stage,\n fqn,\n // Early commits (`creating`/`replacing`) persist plan props that may\n // still hold unresolved Output exprs; strip them so state stores only\n // plain data (see stripUnresolved in Diff.ts).\n //\n // Binding rows follow the same rule. Even the RESOLVED binding\n // payload can carry Effect leaves — a tagged Worker/Function class in\n // `env` (the circular-bindings pattern) is a function-typed Effect\n // that `Output.evaluate` passes through untouched. A JSON state store\n // would persist it via its `toJSON` as an `{\"_id\":\"Effect\",...}`\n // relic, which the next plan's `diffBindings` compares against the\n // live class stripped to `undefined` — a phantom binding \"update\" on\n // every deploy, forever. Stripping at the commit boundary keeps both\n // store kinds consistent with the comparison in `havePropsChanged`.\n value: {\n ...value,\n props: stripUnresolved(value.props),\n bindings: stripUnresolved(value.bindings),\n namespace,\n },\n });\n const scopedSession = {\n ...session,\n note: (note) => session.emit({ id: logicalId, kind: \"annotate\", message: note }),\n };\n // On a mode-switch replacement (local ⇄ live) surface the transition:\n // the old generation's stamped mode → the mode resolved for this run.\n const fromProviderMode = node.action === \"replace\" &&\n node.mode !== undefined &&\n node.state.providerMode !== undefined &&\n node.state.providerMode !== node.mode\n ? node.state.providerMode\n : undefined;\n const report = (status) => session.emit({\n kind: \"status-change\",\n id: logicalId,\n type: node.resource.Type,\n status,\n providerMode: node.mode,\n fromProviderMode,\n });\n const markTerminal = (status) => Effect.gen(function* () {\n terminalStatuses.set(fqn, {\n id: logicalId,\n type: node.resource.Type,\n status,\n providerMode: node.mode,\n });\n // A local dev instance announces where it's serving: any\n // local-mode row whose fresh Attributes carry a string `url`\n // (Workers expose their dev-proxy URL this way) gets a\n // `[id] ready at http://localhost:1337` line.\n if (node.mode === \"local\") {\n const url = tracker[fqn]?.output?.url;\n if (typeof url === \"string\" && url.length > 0) {\n yield* scopedSession.note(`ready at ${url}`);\n }\n }\n // Emit immediately so the CLI surfaces the terminal status as soon\n // as the resource is actually done — instead of batching every\n // resource's \"created\"/\"updated\" event to the end of apply(), which\n // makes long-running siblings appear stuck in \"creating\" until the\n // entire deploy finishes.\n //\n // Cycle members are exempt: their initial pass produces an\n // intermediate result that Phase 3 (`converge`) will overwrite once\n // the SCC reaches a fixed point. Emitting \"created\"/\"updated\" here\n // would surface that intermediate state to the CLI before the real\n // terminal status is known. Their final status is flushed from\n // `terminalStatuses` after `converge` completes.\n if (inCycle)\n return;\n yield* session.emit({\n kind: \"status-change\",\n id: logicalId,\n type: node.resource.Type,\n status,\n providerMode: node.mode,\n });\n });\n const signalReady = Deferred.succeed(ready[fqn], void 0);\n // Signal only after reconcile completes — never during precreate. Tasks\n // (and any other consumer that calls `waitForStableDeps`) block on this\n // so they observe the resource's final attrs rather than a stub.\n const signalReadyStable = Deferred.succeed(readyStable[fqn], void 0);\n const storeAndSignal = (t) => Effect.gen(function* () {\n tracker[fqn] = t;\n yield* signalReady;\n });\n // ── noop ──\n if (node.action === \"noop\") {\n // No work to do on the cloud resource — the persisted attr is already\n // stable. Two pieces of row METADATA can still have drifted from the\n // declaration, and this is the only pass that will ever see them:\n //\n // 1. `resourceType` — the row was persisted under a legacy type name\n // (the type was since renamed and carries the old name as an\n // alias); migrate it so the state stops depending on the alias.\n // 2. `removalPolicy` — `RemovalPolicy.retain()` / `.destroy()` is a\n // decoration on the declaration, not a prop, so changing it never\n // produces a diff. Without this commit the new policy would never\n // reach state, and the orphan delete (which reads the policy from\n // the persisted row, see `Plan.ts`'s delete node) would act on the\n // stale one — destroying a resource the user had marked `retain`.\n // See https://github.com/alchemy-run/alchemy/issues/1248.\n const policyChanged = node.state.removalPolicy !== node.resource.RemovalPolicy;\n if (node.state.resourceType !== node.resource.Type || policyChanged) {\n yield* commit({\n ...node.state,\n resourceType: node.resource.Type,\n removalPolicy: node.resource.RemovalPolicy,\n });\n }\n // A policy flip is otherwise invisible (the row is a noop), and it is\n // exactly the change a user wants confirmation of. Legacy rows with no\n // persisted policy normalize silently — there is nothing to report.\n if (policyChanged && node.state.removalPolicy !== undefined) {\n yield* scopedSession.note(`removal policy ${node.state.removalPolicy} → ${node.resource.RemovalPolicy}`);\n }\n yield* signalReadyStable;\n yield* storeAndSignal({\n output: node.state.attr,\n props: node.state.props,\n bindings: node.state.bindings ?? [],\n instanceId: node.state.instanceId,\n });\n return;\n }\n const allUpstreamFqns = () => {\n const propDeps = Object.keys(Output.resolveUpstream(node.props));\n const bindingDeps = Object.keys(Output.resolveUpstream(node.bindings));\n return [...new Set([...propDeps, ...bindingDeps])];\n };\n // ── instance ID ──\n const instanceId = yield* Effect.gen(function* () {\n if (node.action === \"create\" && !node.state?.instanceId) {\n const id = yield* generateInstanceId();\n yield* commit({\n status: \"creating\",\n fqn,\n logicalId,\n instanceId: id,\n downstream: node.downstream,\n props: node.props,\n providerVersion: node.provider.version ?? 0,\n resourceType: node.resource.Type,\n bindings: excludeDeletedBindings(node.bindings),\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n return id;\n }\n else if (node.action === \"replace\") {\n if ((node.state.status === \"replaced\" ||\n node.state.status === \"replacing\") &&\n !node.restart) {\n // Ordinary replacement recovery keeps using the same replacement\n // generation. Only `restart` is allowed to mint a new instance id.\n return node.state.instanceId;\n }\n const id = yield* generateInstanceId();\n yield* commit({\n status: \"replacing\",\n fqn,\n logicalId,\n instanceId: id,\n downstream: node.downstream,\n props: node.props,\n providerVersion: node.provider.version ?? 0,\n resourceType: node.resource.Type,\n bindings: excludeDeletedBindings(node.bindings),\n old: node.state,\n deleteFirst: node.deleteFirst,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n return id;\n }\n else if (node.state?.instanceId) {\n return node.state.instanceId;\n }\n return yield* Effect.die(`Instance ID not found for resource '${logicalId}' and action is '${node.action}'`);\n });\n // ── lifecycle ──\n yield* Effect.gen(function* () {\n // ── create ──\n if (node.action === \"create\") {\n if (!node.state) {\n // First persistence point for a brand new logical resource. Once this is\n // written, retries know they should resume creation instead of planning\n // another fresh create from scratch.\n yield* commit({\n status: \"creating\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: node.props,\n attr: undefined,\n providerVersion: node.provider.version ?? 0,\n bindings: excludeDeletedBindings(node.bindings),\n downstream: node.downstream,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n }\n let attr = node.state?.attr;\n if (attr !== undefined) {\n // Precreate/read may already have produced a usable output snapshot. Publish\n // it early so downstream resources can start resolving against it.\n yield* storeAndSignal({\n output: attr,\n props: {},\n bindings: [],\n instanceId,\n });\n }\n if (node.provider.precreate && attr === undefined) {\n // Some resources need a placeholder physical resource before their real\n // create can finish. Persist that stub so downstream evaluation can proceed.\n yield* report(\"pre-creating\");\n attr = yield* node.provider\n .precreate({\n id: logicalId,\n fqn,\n news: node.props,\n session: scopedSession,\n instanceId,\n bindings: excludeDeletedBindings(node.bindings),\n })\n .pipe(instrumentLifecycle(\"precreate\", fqn, node.resource.Type, logicalId, instanceId));\n yield* commit({\n status: \"creating\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: node.props,\n attr,\n providerVersion: node.provider.version ?? 0,\n bindings: excludeDeletedBindings(node.bindings),\n downstream: node.downstream,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n yield* storeAndSignal({\n output: attr,\n props: {},\n bindings: [],\n instanceId,\n });\n }\n // While we're waiting on upstream outputs the resource isn't actually\n // creating anything yet — surface that as \"pending\" so the CLI doesn't\n // look stuck in \"creating\" for slow-upstream deploys.\n yield* report(\"pending\");\n // Create runs against fully resolved upstream outputs and bindings, not the\n // raw Output expressions stored in the plan.\n yield* waitForDeps(allUpstreamFqns());\n yield* report(\"creating\");\n const outputs = getOutputs();\n const news = (yield* Output.evaluate(node.props, outputs));\n const bindingOutputs = excludeDeletedBindings(yield* Output.evaluate(node.bindings, outputs));\n attr = yield* node.provider\n .reconcile({\n id: logicalId,\n fqn,\n news,\n instanceId,\n bindings: bindingOutputs,\n session: scopedSession,\n olds: undefined,\n output: attr,\n })\n .pipe(instrumentLifecycle(\"create\", fqn, node.resource.Type, logicalId, instanceId));\n yield* commit({\n status: \"created\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: news,\n attr,\n // Terminal commits persist the RESOLVED binding payload the\n // provider actually reconciled with, not the raw plan-time\n // expressions. Raw `node.bindings` may hold unresolved Outputs\n // (silently dropped by JSON state stores), so persisting them\n // makes the next plan's `diffBindings` compare a lossy stored\n // shape against fully-resolved data — a phantom binding update\n // on every plan (#874).\n bindings: bindingOutputs,\n providerVersion: node.provider.version ?? 0,\n downstream: node.downstream,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n tracker[fqn] = {\n output: attr,\n props: news,\n bindings: bindingOutputs,\n instanceId,\n };\n yield* signalReady;\n yield* signalReadyStable;\n yield* markTerminal(\"created\");\n return;\n }\n // ── update ──\n if (node.action === \"update\") {\n // Cycle members publish their previous live attr *before* waiting on\n // upstreams so the SCC can converge — peers in the cycle would\n // otherwise deadlock waiting on each other. Phase 3 (`converge`)\n // re-runs each peer's update against fresh outputs once everyone\n // has settled.\n //\n // Linear (DAG) update nodes skip this entirely and simply wait for\n // fresh upstream outputs, mirroring the create flow. This is the\n // important property: a downstream of a non-cycle update never\n // observes the upstream's stale attr, which prevents wasted/\n // destructive intermediate updates (e.g. a Worker deploying with\n // stale Build assets).\n if (inCycle) {\n yield* storeAndSignal({\n output: node.state.attr,\n props: node.state.props,\n bindings: node.state.bindings ?? [],\n instanceId,\n });\n }\n // See create-flow note: while we're waiting on upstream outputs\n // this resource isn't actually updating yet.\n yield* report(\"pending\");\n yield* waitForDeps(allUpstreamFqns());\n const outputs = getOutputs();\n const news = (yield* Output.evaluate(node.props, outputs));\n const adopting = node.adopting === true ||\n (node.state.status === \"updating\" && node.state.adopting === true);\n yield* node.state.status === \"replaced\"\n ? commit({\n // Keep the replacement wrapper intact while changing the live\n // replacement props; GC still has older generations to delete.\n ...node.state,\n attr: node.state.attr,\n props: news,\n providerMode: node.mode,\n })\n : commit({\n // For ordinary updates we snapshot the previously stable props/attrs\n // once, so retries can continue from the same baseline.\n status: \"updating\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: news,\n attr: node.state.attr,\n providerVersion: node.provider.version ?? 0,\n bindings: excludeDeletedBindings(node.bindings),\n downstream: node.downstream,\n old: node.state.status === \"updating\" ? node.state.old : node.state,\n adopting: adopting ? true : undefined,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n yield* report(\"updating\");\n const previousProps = adopting\n ? undefined\n : node.state.status === \"created\" ||\n node.state.status === \"updated\" ||\n node.state.status === \"replaced\"\n ? node.state.props\n : node.state.old.props;\n // Providers receive the resolved binding payload for this exact pass, while\n // `previousProps` tells them what state the live resource is being updated from.\n const bindingOutputs = excludeDeletedBindings(yield* Output.evaluate(node.bindings, outputs));\n const attr = yield* node.provider\n .reconcile({\n id: logicalId,\n fqn,\n news,\n instanceId,\n bindings: bindingOutputs,\n session: scopedSession,\n olds: previousProps,\n output: node.state.attr,\n })\n .pipe(instrumentLifecycle(\"update\", fqn, node.resource.Type, logicalId, instanceId));\n if (node.state.status === \"replaced\") {\n yield* commit({\n // The live replacement changed, but cleanup of older generations still\n // has to continue afterwards.\n ...node.state,\n attr,\n props: news,\n // Resolved payload, not raw `node.bindings` — see create commit.\n bindings: bindingOutputs,\n providerMode: node.mode,\n });\n }\n else {\n yield* commit({\n status: \"updated\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: news,\n attr,\n // Resolved payload, not raw `node.bindings` — see create commit.\n bindings: bindingOutputs,\n providerVersion: node.provider.version ?? 0,\n downstream: node.downstream,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n }\n tracker[fqn] = {\n output: attr,\n props: news,\n bindings: bindingOutputs,\n instanceId,\n };\n // Signal here for the linear (non-cycle) path. For in-cycle updates\n // the deferred has already been resolved by the early `storeAndSignal`\n // above and `signalReady` is a no-op the second time.\n yield* signalReady;\n yield* signalReadyStable;\n yield* markTerminal(\"updated\");\n return;\n }\n // ── replace ──\n if (node.action === \"replace\") {\n if (node.state.status === \"replaced\" && !node.restart) {\n // The replacement already exists; this pass only needs GC to clean up\n // older generations, so expose the current replacement and stop here.\n tracker[fqn] = {\n output: node.state.attr,\n props: node.state.props,\n bindings: node.state.bindings ?? [],\n instanceId,\n };\n yield* signalReady;\n yield* signalReadyStable;\n yield* markTerminal(\"created\");\n return;\n }\n let replState;\n if (node.state.status !== \"replacing\" || node.restart) {\n // `restart` deliberately nests the previous top-level replacement state\n // into `old`, creating a new outer generation to replace it.\n replState = yield* commit({\n status: \"replacing\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: node.props,\n bindings: excludeDeletedBindings(node.bindings),\n attr: undefined,\n providerVersion: node.provider.version ?? 0,\n deleteFirst: node.deleteFirst,\n old: node.state,\n downstream: node.downstream,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n }\n else {\n // Resume the same replacement generation after an interrupted apply.\n replState = node.state;\n }\n // ── delete-first replacements ──\n //\n // By default a replacement is create-first: the new generation is\n // created here and the old generation(s) are reclaimed afterwards by\n // `collectGarbage` (Phase 2). That ordering keeps the old resource\n // alive if the create fails, but it is wrong for resources whose\n // replacement cannot coexist with the original — a fixed physical\n // name, a singleton, etc. Those providers return\n // `{ action: \"replace\", deleteFirst: true }`.\n //\n // When `deleteFirst` is set we tear the previous generation(s) down\n // BEFORE creating the new one, and commit the result as a terminal\n // `created` state (rather than `replaced`) so Phase 2 has no old chain\n // left to drain. `delete` is required to be idempotent, so a re-run\n // after an interrupted apply simply re-converges.\n const deleteOldGenerations = (old) => Effect.gen(function* () {\n const retain = node.resource.RemovalPolicy === \"retain\";\n if (old.attr !== undefined && !retain) {\n // Delete each old generation with the provider variant of the\n // mode that created it — after a local ⇄ live switch,\n // `node.provider` (the new mode) cannot tear down the other\n // runtime's instance. Unstamped rows (legacy or written by a\n // mode-agnostic provider) are physically live, unless their\n // attrs carry the `dev:` identity marker — see stampedMode.\n const oldProvider = yield* findProviderByType(node.resource.Type, stampedMode(old));\n yield* oldProvider\n .delete({\n id: logicalId,\n fqn,\n instanceId: old.instanceId,\n olds: old.props,\n output: old.attr,\n session: scopedSession,\n bindings: [],\n })\n .pipe(instrumentLifecycle(\"delete\", fqn, node.resource.Type, logicalId, old.instanceId));\n }\n if (old.status === \"replacing\" || old.status === \"replaced\") {\n yield* deleteOldGenerations(old.old);\n }\n });\n if (node.deleteFirst) {\n yield* scopedSession.note(\"Deleting previous resource before creating its replacement (deleteFirst)...\");\n yield* deleteOldGenerations(replState.old);\n }\n let attr = replState.attr;\n if (attr !== undefined) {\n // If precreate already ran, expose that intermediate output immediately so\n // downstream resources can resolve against the same in-flight replacement.\n yield* storeAndSignal({\n output: attr,\n props: {},\n bindings: [],\n instanceId,\n });\n }\n if (node.provider.precreate && attr === undefined) {\n yield* report(\"pre-creating\");\n attr = yield* node.provider\n .precreate({\n id: logicalId,\n fqn,\n news: node.props,\n session: scopedSession,\n instanceId,\n bindings: excludeDeletedBindings(node.bindings),\n })\n .pipe(instrumentLifecycle(\"precreate\", fqn, node.resource.Type, logicalId, instanceId));\n yield* commit({\n status: \"replacing\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: node.props,\n attr,\n providerVersion: node.provider.version ?? 0,\n bindings: excludeDeletedBindings(node.bindings),\n downstream: node.downstream,\n old: replState.old,\n deleteFirst: node.deleteFirst,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n yield* storeAndSignal({\n output: attr,\n props: {},\n bindings: [],\n instanceId,\n });\n }\n // See create-flow note: while we're waiting on upstream outputs\n // the replacement isn't actually being created yet.\n yield* report(\"pending\");\n // Replacement create is evaluated exactly like create, but against the new\n // generation's instance id and with the previous generations preserved in `old`.\n yield* waitForDeps(allUpstreamFqns());\n yield* report(\"creating replacement\");\n const outputs = getOutputs();\n const news = (yield* Output.evaluate(node.props, outputs));\n const bindingOutputs = excludeDeletedBindings(yield* Output.evaluate(node.bindings, outputs));\n attr = yield* node.provider\n .reconcile({\n id: logicalId,\n fqn,\n news,\n instanceId,\n bindings: bindingOutputs,\n session: scopedSession,\n olds: undefined,\n output: attr,\n })\n .pipe(instrumentLifecycle(\"create\", fqn, node.resource.Type, logicalId, instanceId));\n if (node.deleteFirst) {\n // The old generation(s) were already torn down above, so there is\n // nothing left for `collectGarbage` to drain — collapse straight to\n // the terminal `created` state.\n yield* commit({\n status: \"created\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: news,\n attr,\n providerVersion: node.provider.version ?? 0,\n // Resolved payload, not raw `node.bindings` — see create commit.\n bindings: bindingOutputs,\n downstream: node.downstream,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n }\n else {\n yield* commit({\n // Creation of the new generation succeeded; from here on the only remaining\n // work is draining the old chain via garbage collection.\n status: \"replaced\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: news,\n attr,\n providerVersion: node.provider.version ?? 0,\n // Resolved payload, not raw `node.bindings` — see create commit.\n bindings: bindingOutputs,\n downstream: node.downstream,\n // Preserve the remaining backlog exactly as-is. GC is responsible for\n // popping one generation at a time until the chain is exhausted.\n old: replState.old,\n deleteFirst: node.deleteFirst,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n }\n tracker[fqn] = {\n output: attr,\n props: news,\n bindings: bindingOutputs,\n instanceId,\n };\n yield* signalReady;\n yield* signalReadyStable;\n // Keep progress anchored to the live replacement while GC drains the\n // previous generation(s) in the background.\n yield* markTerminal(\"created\");\n return;\n }\n // @ts-expect-error - node is never, this should be unreachable\n return yield* Effect.die(`Unknown action: ${node.action}`);\n });\n}).pipe(Effect.catchCause((cause) => \n// Record the failure, propagate it to any downstream resources waiting on\n// our Deferred (so their waitForDeps short-circuits instead of deadlocking),\n// emit a \"fail\" status to the session, and resolve to void so Effect.all\n// does not interrupt sibling fibers. The aggregated cause is raised at\n// the end of executePlan.\nEffect.gen(function* () {\n failures.push({\n fqn,\n logicalId: node.resource.LogicalId,\n type: node.resource.Type,\n cause,\n });\n yield* Deferred.failCause(ready[fqn], cause);\n yield* Deferred.failCause(readyStable[fqn], cause);\n yield* session.emit({\n kind: \"status-change\",\n id: node.resource.LogicalId,\n type: node.resource.Type,\n status: \"fail\",\n providerMode: node.mode,\n });\n})), Effect.withSpan(\"apply.resource\", {\n attributes: {\n \"alchemy.resource.fqn\": fqn,\n \"alchemy.resource.type\": node.resource.Type,\n \"alchemy.resource.logical_id\": node.resource.LogicalId,\n \"alchemy.resource.action\": node.action,\n },\n}));\n// ── Task execution ─────────────────────────────────────────────────────────\n//\n// Tasks slot into the same scheduler as resources. They have no provider\n// lifecycle — just a single Effect that runs when inputs change (or when\n// `--force` is set). The output value is written to `tracker[fqn].output`\n// so downstream Output evaluation works identically to resource attrs.\n/**\n * Run an Action body, resolving any Outputs it captured via `yield* output`\n * during init against the current tracker and exposing them to the body through\n * the resolve {@link RuntimeContext}. See {@link makeCaptureContext}.\n */\nconst runAction = Effect.fn(\"apply.runAction\")(function* (task, input, outputs) {\n const resolved = {};\n for (const [key, output] of Object.entries(task.Captures)) {\n resolved[key] = yield* Output.evaluate(output, outputs);\n }\n return yield* task\n .Run(input)\n .pipe(Effect.provideService(RuntimeContext, makeResolveContext(resolved)));\n});\nconst executeActionNode = (fqn, node, tracker, ready, readyStable, terminalStatuses, session, state, stackName, stage, getOutputs, waitForDeps, failures) => Effect.gen(function* () {\n const task = node.def;\n const logicalId = task.LogicalId;\n const namespace = task.Namespace;\n const commit = (value) => state.set({\n stack: stackName,\n stage,\n fqn,\n value: { ...value, namespace },\n });\n const report = (status) => session.emit({\n kind: \"status-change\",\n id: logicalId,\n type: task.Type,\n status,\n });\n const signalReady = Deferred.succeed(ready[fqn], void 0);\n const signalReadyStable = Deferred.succeed(readyStable[fqn], void 0);\n if (node.action === \"noop\") {\n tracker[fqn] = {\n output: node.state.output,\n props: { __input: node.state.input },\n bindings: [],\n instanceId: fqn,\n };\n yield* signalReady;\n yield* signalReadyStable;\n terminalStatuses.set(fqn, {\n id: logicalId,\n type: task.Type,\n status: \"skipped\",\n });\n yield* report(\"skipped\");\n return;\n }\n // ── run ──\n // Tasks wait on `waitForStableDeps` (post-reconcile attrs) for their\n // upstreams, which is often the slowest dep chain in the deploy.\n // Surface that as \"pending\" instead of having the task show no status\n // until its run actually starts.\n yield* report(\"pending\");\n yield* waitForDeps([\n ...new Set([\n ...Object.keys(Output.resolveUpstream(node.input)),\n ...Object.keys(Output.upstreamAny(task.Captures)),\n ]),\n ].filter((f) => f in readyStable));\n const outputs = getOutputs();\n const resolvedInput = (yield* Output.evaluate(node.input, outputs));\n const inputHashValue = yield* hashInput(resolvedInput);\n yield* commit({\n kind: \"action\",\n status: \"running\",\n fqn,\n logicalId,\n actionType: task.Type,\n inputHash: inputHashValue,\n input: resolvedInput,\n downstream: node.downstream,\n });\n yield* report(\"running\");\n const result = yield* runAction(task, resolvedInput, outputs);\n yield* commit({\n kind: \"action\",\n status: \"ran\",\n fqn,\n logicalId,\n actionType: task.Type,\n inputHash: inputHashValue,\n input: resolvedInput,\n output: result,\n downstream: node.downstream,\n });\n tracker[fqn] = {\n output: result,\n props: { __input: resolvedInput },\n bindings: [],\n instanceId: fqn,\n };\n yield* signalReady;\n yield* signalReadyStable;\n terminalStatuses.set(fqn, {\n id: logicalId,\n type: task.Type,\n status: \"ran\",\n });\n yield* report(\"ran\");\n}).pipe(Effect.catchCause((cause) => Effect.gen(function* () {\n failures.push({\n fqn,\n logicalId: node.def.LogicalId,\n type: node.def.Type,\n cause,\n });\n yield* Deferred.failCause(ready[fqn], cause);\n yield* Deferred.failCause(readyStable[fqn], cause);\n yield* session.emit({\n kind: \"status-change\",\n id: node.def.LogicalId,\n type: node.def.Type,\n status: \"fail\",\n });\n})), Effect.withSpan(\"apply.action\", {\n attributes: {\n \"alchemy.action.fqn\": fqn,\n \"alchemy.action.type\": node.def.Type,\n \"alchemy.action.logical_id\": node.def.LogicalId,\n \"alchemy.action.verb\": node.action,\n },\n}));\n// ── Phase 3: imperative convergence loop ───────────────────────────────────\n//\n// After the initial concurrent pass, some resources may have been created\n// with stale upstream values (e.g. a precreate stub instead of the final\n// output). Walk the plan and re-evaluate each resource's props/bindings\n// against the current tracker outputs. Call provider.reconcile for any\n// resource whose resolved inputs differ from what it was last applied with.\n// Repeat until no resource needs updating.\nconst converge = Effect.fn(function* (plan, tracker, terminalStatuses, session, state, stackName, stage) {\n for (;;) {\n let anyUpdated = false;\n for (const [fqn, node] of Object.entries(plan.resources)) {\n if (node.action === \"noop\")\n continue;\n if (!tracker[fqn])\n continue;\n const outputs = Object.fromEntries(Object.entries(tracker).map(([k, t]) => [k, t.output]));\n const newProps = (yield* Output.evaluate(node.props, outputs));\n const newBindings = excludeDeletedBindings(yield* Output.evaluate(node.bindings, outputs));\n const oldProps = tracker[fqn].props;\n const oldBindings = tracker[fqn].bindings;\n const propsChanged = havePropsChanged(oldProps, newProps);\n const bindingsChanged = JSON.stringify(oldBindings) !== JSON.stringify(newBindings);\n if (!propsChanged && !bindingsChanged)\n continue;\n anyUpdated = true;\n const logicalId = node.resource.LogicalId;\n const namespace = node.resource.Namespace;\n const instanceId = tracker[fqn].instanceId;\n const scopedSession = {\n ...session,\n note: (note) => session.emit({ id: logicalId, kind: \"annotate\", message: note }),\n };\n const attr = yield* node.provider\n .reconcile({\n id: logicalId,\n fqn,\n news: newProps,\n instanceId,\n bindings: newBindings,\n session: scopedSession,\n olds: oldProps,\n output: tracker[fqn].output,\n })\n .pipe(instrumentLifecycle(\"update\", fqn, node.resource.Type, logicalId, instanceId));\n tracker[fqn] = {\n output: attr,\n props: newProps,\n bindings: newBindings,\n instanceId,\n };\n yield* state.set({\n stack: stackName,\n stage,\n fqn,\n value: {\n status: \"updated\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n // This site bypasses the `commit` helper, so strip unresolved\n // leaves (Effect-valued env entries survive `Output.evaluate`)\n // the same way `commit` does — state only ever holds plain data.\n props: stripUnresolved(newProps),\n attr,\n providerVersion: node.provider.version ?? 0,\n // Resolved payload, not raw `node.bindings` — see the create\n // commit in applyResource. Stripped like the commit helper so\n // Effect leaves (e.g. tagged Worker classes in `env`) never reach\n // the state store.\n bindings: stripUnresolved(newBindings),\n downstream: node.downstream,\n namespace,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n },\n });\n terminalStatuses.set(fqn, {\n id: logicalId,\n type: node.resource.Type,\n status: \"updated\",\n providerMode: node.mode,\n });\n }\n // Tasks: re-run when their resolved input drifts vs. the value they\n // last applied with (e.g. an upstream resource produced new attrs in\n // this pass). Skipped (noop) tasks are not re-checked here — their\n // recorded inputHash is authoritative until the next plan.\n for (const [fqn, node] of Object.entries(plan.actions)) {\n if (node.action !== \"run\")\n continue;\n if (!tracker[fqn])\n continue;\n const outputs = Object.fromEntries(Object.entries(tracker).map(([k, t]) => [k, t.output]));\n const newInput = (yield* Output.evaluate(node.input, outputs));\n const newHash = yield* hashInput(newInput);\n const oldInput = tracker[fqn].props?.__input;\n const oldHash = yield* hashInput(oldInput);\n if (newHash === oldHash)\n continue;\n anyUpdated = true;\n yield* state.set({\n stack: stackName,\n stage,\n fqn,\n value: {\n kind: \"action\",\n status: \"running\",\n fqn,\n logicalId: node.def.LogicalId,\n namespace: node.def.Namespace,\n actionType: node.def.Type,\n inputHash: newHash,\n input: newInput,\n downstream: node.downstream,\n },\n });\n const result = yield* runAction(node.def, newInput, outputs);\n yield* state.set({\n stack: stackName,\n stage,\n fqn,\n value: {\n kind: \"action\",\n status: \"ran\",\n fqn,\n logicalId: node.def.LogicalId,\n namespace: node.def.Namespace,\n actionType: node.def.Type,\n inputHash: newHash,\n input: newInput,\n output: result,\n downstream: node.downstream,\n },\n });\n tracker[fqn] = {\n output: result,\n props: { __input: newInput },\n bindings: [],\n instanceId: fqn,\n };\n terminalStatuses.set(fqn, {\n id: node.def.LogicalId,\n type: node.def.Type,\n status: \"ran\",\n });\n }\n if (!anyUpdated)\n break;\n }\n});\n/**\n * Aggregate raised at the end of the deletion phase when one or more\n * resource deletes failed. Every resource whose delete did not depend on a\n * failed one was still attempted — a single failure no longer strands\n * unrelated siblings.\n */\nexport class DestroyError extends Data.TaggedError(\"DestroyError\") {\n get message() {\n return [\n `Failed to delete ${this.failures.length} resource(s)` +\n (this.blocked.length > 0\n ? ` (${this.blocked.length} more skipped because a dependent's delete failed)`\n : \"\") +\n \":\",\n ...this.failures.map((f) => ` ✗ ${f.fqn} (${f.resourceType}): ${Cause.pretty(f.cause)}`),\n ...this.blocked.map((b) => ` ⊘ ${b.fqn} (${b.resourceType}): skipped — blocked by failed delete of ${b.blockedBy.join(\", \")}`),\n ].join(\"\\n\");\n }\n}\nconst collectGarbage = Effect.fn(function* (plan, session) {\n const state = yield* yield* State;\n const stack = yield* Stack;\n const stackName = stack.name;\n const stage = yield* Stage;\n // Task deletions are pure state drops — no body is invoked. Run them in\n // parallel before resource GC; tasks never have provider-side dependencies\n // to wait on.\n yield* Effect.all(Object.entries(plan.actionDeletions ?? {}).map(([fqn, node]) => node === undefined\n ? Effect.void\n : Effect.gen(function* () {\n yield* session.emit({\n kind: \"status-change\",\n id: node.def.LogicalId,\n type: node.def.Type,\n status: \"deleting\",\n });\n yield* state.delete({ stack: stackName, stage, fqn });\n yield* session.emit({\n kind: \"status-change\",\n id: node.def.LogicalId,\n type: node.def.Type,\n status: \"deleted\",\n });\n })), { concurrency: \"unbounded\" });\n // Failures are collected — not propagated — so one bad delete never\n // strands unrelated siblings. `unresolved` tracks every FQN whose delete\n // failed or was blocked this run: later passes must not retry them (a\n // still-`replaced` row would otherwise spin the drain loop forever) and\n // dependencies scheduled in later passes must observe them as blocking.\n const failures = [];\n const blockedDeletes = [];\n const unresolved = new Set();\n const deleteGraph = Effect.fn(function* (deletionGraph) {\n const deletions = {};\n const deleteResource = (node, ancestors = new Set()) => Effect.gen(function* () {\n const isDeleteNode = (node) => \"action\" in node;\n const { fqn, logicalId, namespace, resourceType, instanceId, downstream, props, attr: persistedAttr, provider, providerMode, } = isDeleteNode(node)\n ? {\n // Use the persisted FQN verbatim — never recompute it from\n // `toFqn(namespace, logicalId)`. A logical ID may legitimately\n // contain the FQN separator (`/`), in which case `parseFqn`\n // truncated it and a recomputed key would miss the real state\n // row (the row would then resurface as an orphan on every\n // subsequent destroy, never getting deleted).\n fqn: node.resource.FQN,\n logicalId: node.resource.LogicalId,\n namespace: node.resource.Namespace,\n resourceType: node.resource.Type,\n instanceId: node.state.instanceId,\n downstream: node.downstream,\n props: node.state.props,\n attr: node.state.attr,\n // Plan resolved this provider for the row's persisted (or\n // marker-inferred) `providerMode` (see the deletions builder\n // in Plan.ts).\n provider: node.provider,\n providerMode: node.state.providerMode,\n }\n : {\n fqn: node.fqn,\n logicalId: node.logicalId,\n namespace: node.namespace,\n resourceType: node.old.resourceType,\n instanceId: node.old.instanceId,\n downstream: node.old.downstream,\n props: node.old.props,\n attr: node.old.attr,\n // A missing provider is fatal — plan already dies on zombie\n // rows (see the deletions builder in Plan.ts); this guards\n // the replaced-chain generations that bypass plan. The old\n // generation is torn down with the provider variant of the\n // mode that created it (local ⇄ live replacements);\n // unstamped rows are physically live unless their attrs\n // carry the `dev:` identity marker (see stampedMode).\n provider: yield* tryFindProviderByType(node.old.resourceType, stampedMode(node.old)).pipe(Effect.flatMap(Option.match({\n onNone: () => Effect.die(missingProviderError(node.old.resourceType, node.fqn)),\n onSome: Effect.succeed,\n }))),\n providerMode: node.old.providerMode,\n };\n // Mutable: an attr-less row (interrupted create) may recover its\n // attributes from `provider.read` below, right before deletion.\n let attr = persistedAttr;\n const nextAncestors = new Set(ancestors).add(fqn);\n const commit = (value) => state.set({\n stack: stackName,\n stage,\n fqn,\n // Same rule as the lifecycle commit above: state only stores\n // plain data, never unresolved Output exprs or Effect leaves.\n value: {\n ...value,\n props: stripUnresolved(value.props),\n bindings: stripUnresolved(value.bindings),\n namespace,\n },\n });\n const report = (status) => session.emit({\n kind: \"status-change\",\n id: logicalId,\n type: resourceType,\n status,\n providerMode,\n });\n const scopedSession = {\n ...session,\n note: (note) => session.emit({\n id: logicalId,\n kind: \"annotate\",\n message: note,\n }),\n };\n return yield* (deletions[fqn] ??= yield* Effect.cached(Effect.gen(function* () {\n // Dependents (`downstream`) are deleted before this resource. A\n // dependent whose delete failed (or was itself blocked) may make\n // this resource legitimately undeletable (dependency violation),\n // so it is skipped with a \"blocked by\" note instead of surfacing\n // a spurious second error.\n const dependents = yield* Effect.all(downstream.map((dep) => dep !== fqn && !ancestors.has(dep)\n ? dep in deletionGraph\n ? deleteResource(deletionGraph[dep], nextAncestors).pipe(Effect.map((outcome) => ({ dep, outcome })))\n : // Not in this pass's graph — but it may have failed in\n // an earlier drain pass of the same destroy.\n Effect.sync(() => ({\n dep,\n outcome: unresolved.has(dep)\n ? \"failed\"\n : \"deleted\",\n }))\n : Effect.succeed({ dep, outcome: \"deleted\" })), { concurrency: \"unbounded\" });\n const blockedBy = dependents\n .filter(({ outcome }) => outcome !== \"deleted\")\n .map(({ dep }) => dep);\n if (blockedBy.length > 0) {\n unresolved.add(fqn);\n blockedDeletes.push({\n fqn,\n logicalId,\n resourceType,\n blockedBy,\n });\n yield* scopedSession.note(`Skipping delete — blocked by failed delete of ${blockedBy.join(\", \")}.`);\n yield* report(\"skipped\");\n return \"blocked\";\n }\n return yield* deleteResourceBody().pipe(Effect.catchCause((cause) => Effect.gen(function* () {\n unresolved.add(fqn);\n failures.push({ fqn, logicalId, resourceType, cause });\n yield* report(\"fail\");\n return \"failed\";\n })));\n })));\n function deleteResourceBody() {\n return Effect.gen(function* () {\n if (isDeleteNode(node)) {\n yield* report(\"deleting\");\n if (node.resource.RemovalPolicy === \"retain\") {\n yield* state.delete({\n stack: stackName,\n stage,\n fqn,\n });\n yield* report(\"retained\");\n // Retention is intentional — it never blocks dependencies.\n return \"deleted\";\n }\n }\n // Honor `retain` for the old generation of a replacement, mirroring\n // the orphan-delete path above. Delete-node retain is already\n // handled with an early return; this guards the replaced\n // old-generation physical delete.\n const retainOldGeneration = !isDeleteNode(node) && node.removalPolicy === \"retain\";\n if (retainOldGeneration) {\n yield* scopedSession.note(\"Retaining replaced resource (removal policy: retain)...\");\n }\n // A row can reach deletion with `attr === undefined` when a create\n // was interrupted after the cloud-side call succeeded but before\n // `reconcile` returned Attributes (a `creating` row — or the old\n // generation of a replacement chain in the same predicament).\n // Skipping the provider's delete outright would silently orphan\n // the physical resource, so ask `read` to look it up from the\n // persisted props (providers derive the deterministic physical\n // name from id/props):\n // - plain attrs → exists and is ours; proceed to delete\n // - Unowned(attrs) → exists but is NOT ours (e.g. our create\n // actually lost a name race, or died before\n // stamping ownership) — never delete a\n // foreign resource; drop our state and say so\n // - undefined → nothing exists; dropping state is safe\n if (attr === undefined && !retainOldGeneration) {\n if (provider.read) {\n const recovered = yield* provider\n .read({\n id: logicalId,\n fqn,\n instanceId,\n olds: props,\n output: undefined,\n })\n .pipe(instrumentLifecycle(\"read\", fqn, resourceType, logicalId, instanceId), \n // The persisted props of an interrupted create can carry\n // holes where unresolved Outputs were stripped at commit\n // time (see stripUnresolved) — e.g. a parent reference\n // persisted as `{}`. A provider that dereferences one\n // crashes deep inside its SDK client (a SchemaError\n // defect), which would make the stage impossible to\n // destroy. Recovery is best-effort: degrade the defect\n // to \"nothing recovered\", surface a note, and let the\n // row be dropped (#995).\n Effect.catchDefect((defect) => scopedSession\n .note(\"Recovery read crashed while looking up this \" +\n \"resource's interrupted create \" +\n `(${String(defect)}) — if a physical resource ` +\n \"was created, it must be cleaned up manually.\")\n .pipe(Effect.as(undefined))));\n if (recovered !== undefined) {\n if (Unowned.is(recovered)) {\n yield* scopedSession.note(\"Resource exists in the cloud but is not owned by this \" +\n \"stack — leaving it in place (re-deploy with --adopt \" +\n \"to take ownership, then destroy).\");\n }\n else {\n attr = stripUnowned(recovered);\n }\n }\n }\n else {\n yield* scopedSession.note(\"No attributes were recorded for this resource (its create \" +\n \"was interrupted) and the provider does not implement \" +\n \"`read` — if a physical resource was created, it must be \" +\n \"cleaned up manually.\");\n }\n }\n if (isDeleteNode(node)) {\n yield* commit({\n status: \"deleting\",\n fqn,\n logicalId,\n instanceId,\n resourceType,\n props,\n attr,\n downstream,\n providerVersion: provider.version ?? 0,\n bindings: excludeDeletedBindings(node.bindings),\n removalPolicy: node.resource.RemovalPolicy,\n providerMode,\n });\n }\n if (attr !== undefined && !retainOldGeneration) {\n yield* provider\n .delete({\n id: logicalId,\n fqn,\n instanceId,\n olds: props,\n output: attr,\n session: scopedSession,\n bindings: [],\n })\n .pipe(instrumentLifecycle(\"delete\", fqn, resourceType, logicalId, instanceId));\n }\n if (isDeleteNode(node)) {\n yield* state.delete({\n stack: stackName,\n stage,\n fqn,\n });\n yield* report(\"deleted\");\n }\n else {\n if (!retainOldGeneration) {\n yield* scopedSession.note(\"Cleaning up replaced resource...\");\n }\n if (node.old.status === \"replacing\" ||\n node.old.status === \"replaced\") {\n // We only deleted the outermost old generation. A nested replacement\n // chain still exists, so stay in `replaced` and pop the chain forward\n // one level. The outer loop will pick this resource up again.\n yield* commit({\n status: \"replaced\",\n fqn,\n logicalId: node.logicalId,\n instanceId: node.instanceId,\n resourceType: node.resourceType,\n props: node.props,\n attr: node.attr,\n providerVersion: node.providerVersion,\n downstream: node.downstream,\n bindings: excludeDeletedBindings(node.bindings),\n old: node.old.old,\n deleteFirst: node.deleteFirst,\n removalPolicy: node.removalPolicy,\n providerMode: node.providerMode,\n });\n }\n else {\n // The old chain is fully drained, so the current replacement is now\n // the stable resource and we can collapse back to a terminal state.\n yield* commit({\n status: \"created\",\n fqn,\n logicalId: node.logicalId,\n instanceId: node.instanceId,\n resourceType: node.resourceType,\n props: node.props,\n attr: node.attr,\n providerVersion: node.providerVersion,\n downstream: node.downstream,\n bindings: excludeDeletedBindings(node.bindings),\n removalPolicy: node.removalPolicy,\n providerMode: node.providerMode,\n });\n }\n yield* scopedSession.note(retainOldGeneration\n ? \"Replaced resource retained.\"\n : \"Replaced resource cleanup complete.\");\n }\n return \"deleted\";\n });\n }\n });\n // Attempt every root. Per-node failures were recorded (and their state\n // retained) inside each node's delete effect — the effects resolve to\n // outcomes and never fail, so one bad resource never interrupts sibling\n // deletions mid-flight.\n yield* Effect.all(Object.values(deletionGraph)\n .filter((node) => node !== undefined)\n .map((node) => deleteResource(node)), { concurrency: \"unbounded\" });\n });\n // The first pass handles both planned deletions and any top-level replaced\n // resources already present in state. Later passes only drain replacement\n // chains that were re-committed as `replaced` while deleting older generations.\n let first = true;\n while (true) {\n const remainingReplacedResources = (yield* state.getReplacedResources({\n stack: stackName,\n stage,\n }))\n // A row whose drain already failed (or was blocked) this run stays\n // `replaced` in state — retrying it in a later pass would loop forever.\n // It stays behind for the next destroy; the aggregate error below\n // reports it.\n .filter((replaced) => !unresolved.has(replaced.fqn));\n if (!first && remainingReplacedResources.length === 0) {\n break;\n }\n yield* deleteGraph({\n // Orphan/resource deletions from the current plan should only run once.\n ...(first ? plan.deletions : {}),\n ...Object.fromEntries(remainingReplacedResources.map((replaced) => [\n // Key by the persisted FQN (not a recomputed one) so logical IDs\n // containing the FQN separator round-trip correctly.\n replaced.fqn,\n replaced,\n ])),\n });\n first = false;\n }\n if (failures.length > 0) {\n // Every independent delete was still attempted; now surface everything\n // that went wrong (and everything skipped as a consequence) as one\n // typed aggregate. The destroy as a whole still fails.\n return yield* Effect.fail(new DestroyError({ failures, blocked: blockedDeletes }));\n }\n});\nconst excludeDeletedBindings = (bindings) => bindings.flatMap(({ action, sid, data }) => action === \"delete\" ? [] : [{ sid, data }]);\n//# sourceMappingURL=Apply.js.map","import * as p from \"@clack/prompts\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport { ChildProcess } from \"effect/unstable/process\";\nexport class PromptCancelled extends Data.TaggedError(\"PromptCancelled\") {\n}\nexport const retryIfCancelled = Effect.retry({\n while: (e) => e instanceof PromptCancelled,\n});\n/**\n * Wraps a clack prompt (which returns a `Promise<T | symbol>` where the\n * symbol indicates user cancellation) in an Effect.\n *\n * Returns `undefined` if the user cancels (Ctrl+C / Escape).\n *\n * Uses `Effect.callback` so fiber interruption propagates to the clack\n * prompt through its abort signal, releasing stdin and restoring the cursor.\n */\nexport const prompt = (fn) => Effect.callback((resume, signal) => {\n let settled = false;\n fn(signal).then((result) => {\n if (settled || signal.aborted)\n return;\n settled = true;\n if (p.isCancel(result)) {\n resume(Effect.fail(new PromptCancelled()));\n }\n else {\n resume(Effect.succeed(result));\n }\n }, (err) => {\n if (settled || signal.aborted)\n return;\n settled = true;\n resume(Effect.die(err));\n });\n});\nexport const success = (str) => Effect.sync(() => p.log.success(str));\nexport const warn = (str) => Effect.sync(() => p.log.warn(str));\nexport const error = (str) => Effect.sync(() => p.log.error(str));\nexport const info = (str) => Effect.sync(() => p.log.info(str));\nexport const text = (opts) => {\n const validate = opts.validate;\n return prompt((signal) => p.text({\n ...opts,\n signal,\n validate: validate === undefined ? undefined : (value) => validate(value ?? \"\"),\n }));\n};\nexport const password = (opts) => {\n const validate = opts.validate;\n return prompt((signal) => p.password({\n ...opts,\n signal,\n validate: validate === undefined ? undefined : (value) => validate(value ?? \"\"),\n }));\n};\nexport const select = (opts) => prompt((signal) => p.select({ ...opts, signal }));\nexport const confirm = (opts) => prompt((signal) => p.confirm({ ...opts, signal }));\nexport const multiselect = (opts) => prompt((signal) => p.multiselect({ ...opts, signal }));\n/**\n * Open a URL in the user's default browser.\n *\n * On Windows, uses rundll32's FileProtocolHandler — a built-in shim that\n * opens URLs in the default browser. It accepts the URL as a direct\n * argument (no shell, no quoting of `&`). cmd.exe `start` would treat\n * `&` in OAuth URLs as a command separator, and `explorer.exe` treats\n * its arg as a path.\n */\nexport const openUrl = (url) => Effect.gen(function* () {\n const [cmd, args] = process.platform === \"win32\"\n ? [\"rundll32.exe\", [\"url.dll,FileProtocolHandler\", url]]\n : process.platform === \"darwin\"\n ? [\"open\", [url]]\n : [\"xdg-open\", [url]];\n const handle = yield* ChildProcess.make(cmd, [...args], { shell: false });\n yield* handle.exitCode;\n}).pipe(Effect.scoped);\n//# sourceMappingURL=Clank.js.map","import * as Config from \"effect/Config\";\nimport * as Effect from \"effect/Effect\";\nimport * as Clank from \"../Util/Clank.js\";\nimport { AuthError } from \"./AuthProvider.js\";\nexport const getEnv = (key) => Config.string(key).pipe(Effect.orElseSucceed(() => undefined));\nexport const getEnvRequired = (key) => Config.string(key).pipe(Effect.catch(() => Effect.fail(new AuthError({ message: `Missing required env: ${key}` }))));\nexport const getEnvRedacted = (key) => Config.redacted(key).pipe(Effect.orElseSucceed(() => undefined));\nexport const getEnvRedactedRequired = (key) => Config.redacted(key).pipe(Effect.catch(() => Effect.fail(new AuthError({ message: `Missing required env: ${key}` }))));\nexport const retryOnce = (self) => self.pipe(Effect.retry({\n times: 1,\n while: (e) => e instanceof Clank.PromptCancelled,\n}), Effect.mapError((e) => new AuthError({ message: \"User cancelled prompt\", cause: e })));\n//# sourceMappingURL=Env.js.map","import * as Config from \"effect/Config\";\nimport * as Context from \"effect/Context\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport * as Result from \"effect/Result\";\nimport { AlchemyContext } from \"../AlchemyContext.js\";\nimport { getAuthProvider } from \"../Auth/AuthProvider.js\";\nimport { ALCHEMY_PROFILE, AlchemyProfile } from \"../Auth/Profile.js\";\nimport { AWS_AUTH_PROVIDER_NAME, LOCAL_ACCOUNT_ID, } from \"./AuthProvider.js\";\nexport const AWS_PROFILE = Config.string(\"AWS_PROFILE\").pipe(Config.withDefault(\"default\"));\nexport const AWS_REGION = Config.string(\"AWS_REGION\");\nexport const AWS_ACCOUNT_ID = Config.string(\"AWS_ACCOUNT_ID\");\nexport const AWS_ACCESS_KEY_ID = Config.string(\"AWS_ACCESS_KEY_ID\");\nexport const AWS_SECRET_ACCESS_KEY = Config.redacted(\"AWS_SECRET_ACCESS_KEY\");\nexport const AWS_SESSION_TOKEN = Config.redacted(\"AWS_SESSION_TOKEN\");\nexport class FailedToGetAccount extends Data.TaggedError(\"AWS::Environment::FailedToGetAccount\") {\n}\nexport class AWSEnvironment extends Context.Service()(\"AWS::Environment\") {\n static current = AWSEnvironment.use((env) => env);\n /**\n * Whether this environment is the floci / `{ method: \"local\" }` emulator\n * (dummy account {@link LOCAL_ACCOUNT_ID}). A set `endpoint` is not\n * enough: `AWS_ENDPOINT_URL` and explicit endpoint overrides also\n * populate it on real-account credentials.\n */\n static isLocalEmulator = Effect.map(AWSEnvironment.current, (env) => env.accountId === LOCAL_ACCOUNT_ID);\n kind = \"Environment\";\n}\n/** @see {@link AWSEnvironment.isLocalEmulator} */\nexport const isLocalEmulator = AWSEnvironment.isLocalEmulator;\nexport const Default = Layer.effect(AWSEnvironment, Effect.gen(function* () {\n const profile = yield* AlchemyProfile;\n const auth = yield* getAuthProvider(AWS_AUTH_PROVIDER_NAME);\n const profileName = yield* ALCHEMY_PROFILE;\n const ci = yield* Config.boolean(\"CI\").pipe(Config.withDefault(false));\n const dev = Option.match(yield* Effect.serviceOption(AlchemyContext), {\n onNone: () => false,\n onSome: (ctx) => ctx.dev,\n });\n // The pre-existing resolution path: stored profile config (or, when\n // nothing is stored, the interactive configure flow / non-interactive\n // AuthError) → resolved credentials. Deploy-mode behavior is unchanged.\n const resolveConfigured = profile\n .loadOrConfigure(auth, profileName, { ci })\n .pipe(Effect.flatMap((config) => auth.read(profileName, config)));\n // Credential-free dev: an `alchemy dev` run must work with zero AWS\n // credentials. When nothing is configured for the active profile, try\n // ambient env-var credentials first (a developer who exported AWS_*\n // wants the real cloud), then fall back to the local emulator — the\n // same environment `{ method: \"local\" }` produces (dummy creds,\n // account 000000000000, endpoint localhost:4566, ensureFloci).\n // A profile that IS configured keeps its normal resolution (and its\n // normal failures) even in dev.\n const resolveDev = Effect.gen(function* () {\n const stored = yield* profile.getProfile(profileName);\n if (stored?.[AWS_AUTH_PROVIDER_NAME] != null) {\n return yield* resolveConfigured;\n }\n const fromEnv = yield* Effect.result(auth.read(profileName, { method: \"env\" }));\n if (Result.isSuccess(fromEnv)) {\n return fromEnv.success;\n }\n yield* Effect.logInfo(\"no AWS credentials — using the local emulator\");\n return yield* auth.read(profileName, { method: \"local\" });\n });\n return yield* (dev ? resolveDev : resolveConfigured).pipe(Effect.orDie, Effect.cached);\n})).pipe(Layer.orDie);\n//# sourceMappingURL=Environment.js.map","import { Endpoint } from \"@distilled.cloud/aws\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { AWSEnvironment } from \"./Environment.js\";\nexport const of = (endpoint) => Layer.succeed(Endpoint.Endpoint, Effect.succeed(endpoint));\n/**\n * Derive a custom endpoint (if any) from the surrounding\n * {@link AWSEnvironment}. If the environment has no `endpoint` set, this\n * Layer is empty (the SDK uses its default endpoint resolver).\n */\nexport const fromEnvironment = Layer.effect(Endpoint.Endpoint, Effect.gen(function* () {\n return Effect.map(yield* AWSEnvironment, (env) => env.endpoint ?? undefined);\n}));\n//# sourceMappingURL=Endpoint.js.map","import * as Region from \"@distilled.cloud/aws/Region\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { AWSEnvironment } from \"./Environment.js\";\nexport { AWS_REGION } from \"./Environment.js\";\nexport { Region } from \"@distilled.cloud/aws/Region\";\nexport const of = (region) => Layer.succeed(Region.Region, Effect.succeed(region));\nexport const fromEnvOrElse = (region) => Layer.succeed(Region.Region, Effect.succeed(process.env.AWS_REGION ?? region));\n// Deferred with `Effect.suspend` so it does not dereference `AWSEnvironment`\n// during module evaluation. `Region.ts` and `Environment.ts` are part of an\n// import cycle (AuthProvider → Region → Environment → AuthProvider); touching\n// `AWSEnvironment` eagerly at top level hits a temporal-dead-zone error when\n// this module is evaluated mid-cycle.\nexport const CurrentRegion = Effect.suspend(() => AWSEnvironment.use((env) => Effect.flatMap(env, ({ region }) => Effect.succeed(region))));\n/**\n * Derive the AWS region from the surrounding {@link AWSEnvironment}.\n */\nexport const fromEnvironment = Layer.effect(Region.Region, Effect.gen(function* () {\n const env = yield* AWSEnvironment;\n return Effect.map(env, (env) => env.region);\n}));\n//# sourceMappingURL=Region.js.map","import * as Floci from \"@alchemy.run/floci\";\nimport * as DistilledAuth from \"@distilled.cloud/aws/Auth\";\nimport { Credentials } from \"@distilled.cloud/aws/Credentials\";\nimport * as STS from \"@distilled.cloud/aws/sts\";\nimport * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport * as Match from \"effect/Match\";\nimport * as Path from \"effect/Path\";\nimport * as Redacted from \"effect/Redacted\";\nimport { ChildProcess } from \"effect/unstable/process\";\nimport * as NodeCrypto from \"node:crypto\";\nimport * as NodeOs from \"node:os\";\nimport { AuthError, AuthProviderLayer, } from \"../Auth/AuthProvider.js\";\nimport { CredentialsStore, displayRedacted } from \"../Auth/Credentials.js\";\nimport { getEnv, getEnvRedacted, getEnvRedactedRequired, getEnvRequired, retryOnce, } from \"../Auth/Env.js\";\nimport * as Clank from \"../Util/Clank.js\";\nimport * as Endpoint from \"./Endpoint.js\";\nimport * as Region from \"./Region.js\";\nexport const AWS_AUTH_PROVIDER_NAME = \"AWS\";\n/** Default endpoint of a local AWS emulator (floci / LocalStack). */\nexport const DEFAULT_LOCAL_ENDPOINT = `http://localhost:${Floci.DEFAULT_FLOCI_PORT}`;\n/**\n * Dummy account stamped on every floci / `{ method: \"local\" }` environment.\n * A custom `AWS_ENDPOINT_URL` on env/sso credentials does NOT use this —\n * those keep the real account from STS / `AWS_ACCOUNT_ID`.\n */\nexport const LOCAL_ACCOUNT_ID = \"000000000000\";\nconst options = [\n {\n value: \"sso\",\n label: \"SSO\",\n hint: \"aws sso login — credentials loaded from AWS SSO cache\",\n },\n {\n value: \"env\",\n label: \"Environment Variables\",\n hint: \"AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY\",\n },\n {\n value: \"stored\",\n label: \"Stored\",\n hint: \"stored in ~/.alchemy/credentials\",\n },\n {\n value: \"local\",\n label: \"Local emulator\",\n hint: \"floci / LocalStack on localhost:4566 — no AWS account\",\n },\n];\n/**\n * An explicitly-set `AWS_REGION` env var wins over the region recorded in an\n * SSO profile (`~/.aws/config`) or in stored credentials. `AWS_DEFAULT_REGION`\n * deliberately does NOT override — it is a *default* for when no region is\n * configured anywhere, and the profile's region is explicit configuration.\n */\nexport const applyEnvRegionOverride = (creds) => getEnv(\"AWS_REGION\").pipe(Effect.map((envRegion) => envRegion ? { ...creds, region: envRegion } : creds));\n/**\n * Layer that registers the AWS {@link AuthProvider} into the\n * {@link AuthProviders} registry when built. Include this in the AWS\n * `providers()` layer so `alchemy login` can discover it.\n */\nexport const AwsAuth = AuthProviderLayer()(AWS_AUTH_PROVIDER_NAME, Effect.gen(function* () {\n const store = yield* CredentialsStore;\n const getAccountId = ({ accessKeyId, secretAccessKey, sessionToken, region, endpoint, }) => STS.getCallerIdentity({}).pipe(Effect.provide(Layer.mergeAll(Layer.succeed(Credentials, Effect.succeed({\n accessKeyId,\n secretAccessKey,\n sessionToken,\n region,\n })), \n // Provide Region directly from the resolved inputs. Relying on the\n // ambient Region provider (Region.fromEnvironment) here would\n // deadlock: it derives the region from AWSEnvironment, which is the\n // very service still being constructed by this STS call.\n Region.of(region), \n // A custom endpoint (local emulator) must apply to this STS call\n // too — the default resolver would call real AWS.\n endpoint ? Endpoint.of(endpoint) : Layer.empty)), Effect.flatMap((self) => self.Account\n ? Effect.succeed(self.Account)\n : Effect.die(new Error(\"No account ID found\"))));\n const loginStored = Effect.fn(function* (profileName) {\n const accessKeyId = yield* Clank.text({\n message: \"AWS Access Key ID\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const secretAccessKey = yield* Clank.password({\n message: \"AWS Secret Access Key\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const sessionToken = yield* Clank.text({\n message: \"AWS Session Token (optional — press Enter or Esc to skip)\",\n placeholder: \"(none)\",\n }).pipe(Effect.catch(() => Effect.succeed(\"\")));\n const region = yield* Clank.text({\n message: \"AWS Region\",\n placeholder: \"us-east-1\",\n defaultValue: \"us-east-1\",\n }).pipe(retryOnce);\n const accountId = yield* getAccountId({\n accessKeyId: Redacted.make(accessKeyId),\n secretAccessKey: Redacted.make(secretAccessKey),\n sessionToken: sessionToken ? Redacted.make(sessionToken) : undefined,\n region,\n });\n yield* store.write(profileName, \"aws\", {\n accountId,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n region,\n });\n yield* Clank.success(\"AWS credentials saved.\");\n return { method: \"stored\" };\n });\n const configureInteractive = (profileName) => Clank.select({\n message: \"AWS authentication method\",\n options,\n }).pipe(Effect.flatMap((method) => Match.value(method).pipe(Match.when(\"env\", () => Effect.succeed({ method: \"env\" })), Match.when(\"sso\", () => Effect.gen(function* () {\n const ssoProfile = yield* Clank.text({\n message: \"AWS profile name (from ~/.aws/config)\",\n placeholder: \"default\",\n defaultValue: \"default\",\n });\n const config = {\n method: \"sso\",\n ssoProfile: ssoProfile ?? \"default\",\n };\n yield* loginSSO(config);\n return config;\n })), Match.when(\"stored\", () => loginStored(profileName)), Match.when(\"local\", () => Effect.gen(function* () {\n const endpoint = yield* Clank.text({\n message: \"Emulator endpoint\",\n placeholder: DEFAULT_LOCAL_ENDPOINT,\n defaultValue: DEFAULT_LOCAL_ENDPOINT,\n });\n const region = yield* Clank.text({\n message: \"Region\",\n placeholder: \"us-east-1\",\n defaultValue: \"us-east-1\",\n });\n return {\n method: \"local\",\n endpoint: endpoint || DEFAULT_LOCAL_ENDPOINT,\n region: region || \"us-east-1\",\n };\n })), Match.exhaustive)));\n const configureCredentials = (profileName, ctx) => Effect.gen(function* () {\n if (ctx.ci) {\n return { method: \"env\" };\n }\n if (ctx.reason) {\n // e.g. the credential-demand seam (`Auth/Demand.ts`) explaining\n // which dev-plan resources require real AWS credentials.\n yield* Clank.info(ctx.reason);\n }\n return yield* configureInteractive(profileName);\n }).pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to configure credentials\",\n cause: e,\n })));\n const resolveCredentials = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, Effect.fn(function* () {\n const accessKeyId = yield* getEnvRedactedRequired(\"AWS_ACCESS_KEY_ID\");\n const secretAccessKey = yield* getEnvRedactedRequired(\"AWS_SECRET_ACCESS_KEY\");\n const sessionToken = yield* getEnvRedacted(\"AWS_SESSION_TOKEN\");\n const region = yield* getEnv(\"AWS_REGION\").pipe(Effect.flatMap((region) => region\n ? Effect.succeed(region)\n : getEnv(\"AWS_DEFAULT_REGION\")));\n if (!region) {\n return yield* Effect.fail(new AuthError({\n message: \"AWS region not found. Set AWS_REGION or AWS_DEFAULT_REGION.\",\n }));\n }\n // LocalStack-standard endpoint override: with\n // AWS_ENDPOINT_URL set, every AWS call (including the STS\n // account lookup below) targets the emulator.\n const endpoint = yield* getEnv(\"AWS_ENDPOINT_URL\");\n const accountId = yield* getEnvRequired(\"AWS_ACCOUNT_ID\").pipe(Effect.catch(() => getAccountId({\n accessKeyId,\n secretAccessKey,\n sessionToken,\n region,\n endpoint,\n })));\n return {\n accountId,\n credentials: Effect.succeed({\n accessKeyId,\n secretAccessKey,\n sessionToken,\n region,\n }),\n region,\n endpoint,\n source: { type: \"env\" },\n };\n })), Match.when({ method: \"local\" }, Effect.fn(function* (config) {\n const endpoint = config.endpoint ?? DEFAULT_LOCAL_ENDPOINT;\n const autoStart = config.autoStart ?? endpoint === DEFAULT_LOCAL_ENDPOINT;\n if (autoStart) {\n const port = yield* Effect.try({\n try: () => Number.parseInt(new URL(endpoint).port, 10) ||\n Floci.DEFAULT_FLOCI_PORT,\n catch: () => new AuthError({\n message: `invalid local emulator endpoint: ${endpoint}`,\n }),\n });\n // Reuses anything already serving on the endpoint (dev-mode\n // JVM, hand-run container, previous session's container);\n // otherwise starts the managed floci container and waits for\n // health.\n yield* Floci.ensureFloci({ port }).pipe(Effect.mapError((e) => new AuthError({ message: e.message, cause: e })));\n }\n else {\n const serving = yield* Floci.isServing(endpoint);\n if (!serving) {\n return yield* Effect.fail(new AuthError({\n message: `no local AWS emulator is listening at ${endpoint} — start one, or omit \\`endpoint\\` to auto-start floci on ${DEFAULT_LOCAL_ENDPOINT}`,\n }));\n }\n }\n const region = config.region ?? \"us-east-1\";\n return {\n // Fixed dummy account — emulators accept any non-empty\n // credentials, and calling STS here would be pure overhead.\n accountId: config.accountId ?? LOCAL_ACCOUNT_ID,\n credentials: Effect.succeed({\n accessKeyId: Redacted.make(\"test\"),\n secretAccessKey: Redacted.make(\"test\"),\n sessionToken: undefined,\n region,\n }),\n region,\n endpoint,\n source: { type: \"local\", details: endpoint },\n };\n })), Match.when({ method: \"stored\" }, () => store.read(profileName, \"aws\").pipe(Effect.flatMap((creds) => creds == null\n ? Effect.fail(new AuthError({\n message: \"AWS stored credentials not found. Run: alchemy login --configure\",\n }))\n : Effect.succeed({\n accountId: creds.accountId,\n credentials: Effect.succeed({\n accessKeyId: Redacted.make(creds.accessKeyId),\n secretAccessKey: Redacted.make(creds.secretAccessKey),\n sessionToken: creds.sessionToken\n ? Redacted.make(creds.sessionToken)\n : undefined,\n region: creds.region,\n }),\n region: creds.region,\n source: { type: \"stored\" },\n })), \n // an older verson of the stored credentials didn't include the account ID, so we patch it hre\n Effect.flatMap((creds) => creds.accountId\n ? Effect.succeed(creds)\n : creds.credentials.pipe(Effect.flatMap((resolved) => getAccountId({\n accessKeyId: resolved.accessKeyId,\n secretAccessKey: resolved.secretAccessKey,\n sessionToken: resolved.sessionToken,\n region: creds.region,\n })), Effect.map((accountId) => ({\n ...creds,\n accountId,\n })), \n // re-write the stored credentials\n Effect.tap((creds) => creds.credentials.pipe(Effect.tap(({ accessKeyId, secretAccessKey, sessionToken }) => store.write(profileName, \"aws\", {\n accessKeyId: Redacted.value(accessKeyId),\n secretAccessKey: Redacted.value(secretAccessKey),\n sessionToken: sessionToken\n ? Redacted.value(sessionToken)\n : undefined,\n region: creds.region,\n accountId: creds.accountId,\n })))))))), Match.when({ method: \"sso\" }, (config) => Effect.gen(function* () {\n const auth = yield* DistilledAuth.Default;\n const profile = yield* auth\n .loadProfile(config.ssoProfile)\n .pipe(Effect.catch(() => Effect.succeed(undefined)));\n return {\n accountId: profile?.sso_account_id,\n credentials: auth\n .loadProfileCredentials(config.ssoProfile)\n .pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to load credentials\",\n cause: e,\n })), Effect.orDie),\n region: profile?.region,\n source: { type: \"sso\", details: config.ssoProfile },\n };\n })), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })), Effect.flatMap(applyEnvRegionOverride));\n const prettyPrint = (profileName, config) => resolveCredentials(profileName, config).pipe(Effect.tap(Effect.fn(function* (creds) {\n const { accessKeyId, secretAccessKey, sessionToken } = yield* creds.credentials;\n yield* Console.log(` accessKeyId: ${displayRedacted(accessKeyId)}`);\n yield* Console.log(` secretAccessKey: ${displayRedacted(secretAccessKey)}`);\n if (sessionToken) {\n yield* Console.log(` sessionToken: ${displayRedacted(sessionToken)}`);\n }\n if (creds.region) {\n yield* Console.log(` region: ${creds.region}`);\n }\n yield* Console.log(\n //@ts-expect-error\n ` source: ${creds.source.details ? `${creds.source.type} - ${creds.source.details}` : creds.source.type}`);\n })));\n const logout = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"local\" }, () => Effect.void), Match.when({ method: \"sso\" }, (config) => Clank.info(`AWS: running 'aws sso logout --profile ${config.ssoProfile}'...`).pipe(Effect.zip(runSsoCommand(\"logout\", config.ssoProfile)), Effect.zip(clearDistilledSsoCache(config.ssoProfile)), Effect.match({\n onSuccess: () => Clank.success(\"AWS: SSO logout complete\"),\n onFailure: (e) => Clank.warn(`AWS: SSO logout failed: \\`${e.message}\\``),\n }))), Match.when({ method: \"stored\" }, () => store\n .delete(profileName, \"aws\")\n .pipe(Effect.andThen(Clank.success(\"AWS: stored credentials removed\")))), Match.exhaustive);\n const login = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"local\" }, () => Effect.void), Match.when({ method: \"sso\" }, loginSSO), Match.when({ method: \"stored\" }, () => store\n .read(profileName, \"aws\")\n .pipe(Effect.flatMap((creds) => creds == null ? loginStored(profileName) : Effect.void))), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })));\n return {\n configure: configureCredentials,\n login,\n logout,\n prettyPrint,\n read: resolveCredentials,\n };\n}));\nconst runSsoCommand = (command, ssoProfile) => Effect.gen(function* () {\n const handle = yield* ChildProcess.make(\"aws\", [\"sso\", command, \"--profile\", ssoProfile], {\n shell: false,\n stdin: \"inherit\",\n stdout: \"inherit\",\n stderr: \"inherit\",\n });\n const exit = yield* handle.exitCode;\n if (exit !== 0) {\n return yield* new AuthError({\n message: `aws sso ${command} exited with code ${exit}`,\n });\n }\n}).pipe(Effect.scoped);\nconst loginSSO = (config) => Clank.info(`AWS SSO: running 'aws sso login --profile ${config.ssoProfile}'...`).pipe(Effect.andThen(runSsoCommand(\"login\", config.ssoProfile)), Effect.matchEffect({\n onSuccess: () => Clank.success(\"AWS SSO: login complete\"),\n onFailure: (e) => Clank.warn(`AWS SSO: login faield: \\`${e.message}\\``),\n}));\n/**\n * `aws sso logout` only clears AWS CLI's own caches — it does not know about the\n * `<sha1(sso_session)>.credentials.json` file that `@distilled.cloud/aws`\n * writes alongside the SSO token. Without this cleanup, `loadProfileCredentials`\n * short-circuits on the stale distilled cache file after logout and appears to\n * stay logged in until the role creds hit their TTL.\n */\nconst clearDistilledSsoCache = (ssoProfile) => Effect.gen(function* () {\n const auth = yield* DistilledAuth.Default;\n const profile = yield* auth.loadProfile(ssoProfile);\n const ssoSession = profile.sso_session;\n if (!ssoSession)\n return;\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const hash = NodeCrypto.createHash(\"sha1\").update(ssoSession).digest(\"hex\");\n const cacheFile = path.join(NodeOs.homedir(), \".aws\", \"sso\", \"cache\", `${hash}.credentials.json`);\n yield* fs.remove(cacheFile).pipe(Effect.catch(() => Effect.void));\n}).pipe(Effect.catch(() => Effect.void));\n//# sourceMappingURL=AuthProvider.js.map","import { DEFAULT_API_BASE_URL } from \"@distilled.cloud/axiom/Credentials\";\nimport * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as Match from \"effect/Match\";\nimport * as Redacted from \"effect/Redacted\";\nimport { AuthError, AuthProviderLayer, } from \"../Auth/AuthProvider.js\";\nimport { CredentialsStore, displayRedacted } from \"../Auth/Credentials.js\";\nimport { getEnv, getEnvRedacted, retryOnce } from \"../Auth/Env.js\";\nimport * as Clank from \"../Util/Clank.js\";\nconst STORAGE_KEY = \"axiom-stored\";\nconst options = [\n {\n value: \"env\",\n label: \"Environment Variables\",\n hint: \"AXIOM_TOKEN (or AXIOM_API_KEY) + optional AXIOM_ORG_ID, AXIOM_URL\",\n },\n {\n value: \"stored\",\n label: \"API Token or Personal Access Token\",\n hint: \"enter credentials interactively, stored in ~/.alchemy/credentials\",\n },\n];\nexport const AXIOM_AUTH_PROVIDER_NAME = \"Axiom\";\nconst promptOrgId = (required) => getEnv(\"AXIOM_ORG_ID\").pipe(Effect.flatMap((envOrgId) => Clank.text({\n message: required\n ? \"Axiom Org ID (required for PAT)\"\n : \"Axiom Org ID (Enter to skip)\",\n placeholder: envOrgId ?? \"\",\n defaultValue: envOrgId ?? \"\",\n validate: required\n ? (v) => (v.length === 0 ? \"Required\" : undefined)\n : undefined,\n}).pipe(retryOnce)));\n/**\n * Layer that registers the Axiom {@link AuthProvider} into the\n * {@link AuthProviders} registry when built. Include this in the Axiom\n * `providers()` layer so `alchemy login` can discover it.\n */\nexport const AxiomAuth = AuthProviderLayer()(AXIOM_AUTH_PROVIDER_NAME, Effect.gen(function* () {\n const store = yield* CredentialsStore;\n const loginStored = Effect.fn(function* (profileName) {\n const credentialType = yield* Clank.select({\n message: \"Axiom credential type\",\n options: [\n {\n value: \"apiToken\",\n label: \"API Token\",\n hint: \"recommended — scoped to specific datasets/actions\",\n },\n {\n value: \"pat\",\n label: \"Personal Access Token\",\n hint: \"full account control, requires Org ID\",\n },\n ],\n }).pipe(retryOnce);\n const apiBaseUrlPrompt = yield* Clank.text({\n message: \"Axiom API Base URL (Enter for default)\",\n placeholder: DEFAULT_API_BASE_URL,\n defaultValue: DEFAULT_API_BASE_URL,\n }).pipe(retryOnce);\n const apiBaseUrl = apiBaseUrlPrompt && apiBaseUrlPrompt.length > 0\n ? apiBaseUrlPrompt\n : undefined;\n return yield* Match.value(credentialType).pipe(Match.when(\"apiToken\", () => Effect.gen(function* () {\n const apiToken = yield* Clank.password({\n message: \"Axiom API Token\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const orgId = yield* promptOrgId(false);\n yield* store.write(profileName, STORAGE_KEY, {\n type: \"apiToken\",\n apiToken,\n apiBaseUrl,\n orgId: orgId && orgId.length > 0 ? orgId : undefined,\n });\n yield* Clank.success(\"Axiom: credentials saved.\");\n return {\n method: \"stored\",\n credentialType: \"apiToken\",\n };\n })), Match.when(\"pat\", () => Effect.gen(function* () {\n const apiToken = yield* Clank.password({\n message: \"Axiom Personal Access Token\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const orgId = yield* promptOrgId(true);\n yield* store.write(profileName, STORAGE_KEY, { type: \"pat\", apiToken, apiBaseUrl, orgId });\n yield* Clank.success(\"Axiom: credentials saved.\");\n return {\n method: \"stored\",\n credentialType: \"pat\",\n };\n })), Match.exhaustive);\n });\n const configureInteractive = (profileName) => Clank.select({\n message: \"Axiom authentication method\",\n options,\n }).pipe(Effect.flatMap((method) => Match.value(method).pipe(Match.when(\"env\", () => Effect.succeed({ method: \"env\" })), Match.when(\"stored\", () => loginStored(profileName)), Match.exhaustive)));\n const configureCredentials = (profileName, ctx) => Effect.gen(function* () {\n if (ctx.ci) {\n return { method: \"env\" };\n }\n return yield* configureInteractive(profileName);\n }).pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to configure credentials\",\n cause: e,\n })));\n const resolveCredentials = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, Effect.fn(function* () {\n const apiToken = (yield* getEnvRedacted(\"AXIOM_TOKEN\")) ??\n (yield* getEnvRedacted(\"AXIOM_API_KEY\"));\n if (!apiToken) {\n return yield* new AuthError({\n message: \"Axiom env credentials not found. Set AXIOM_TOKEN (or AXIOM_API_KEY).\",\n });\n }\n const apiBaseUrl = (yield* getEnv(\"AXIOM_URL\")) ?? DEFAULT_API_BASE_URL;\n const orgId = yield* getEnv(\"AXIOM_ORG_ID\");\n if (orgId) {\n return {\n type: \"pat\",\n apiToken,\n apiBaseUrl,\n orgId,\n source: { type: \"env\" },\n };\n }\n return {\n type: \"apiToken\",\n apiToken,\n apiBaseUrl,\n source: { type: \"env\" },\n };\n })), Match.when({ method: \"stored\" }, () => store.read(profileName, STORAGE_KEY).pipe(Effect.flatMap((creds) => creds == null\n ? Effect.fail(new AuthError({\n message: \"Axiom stored credentials not found. Run: alchemy login --configure\",\n }))\n : Effect.succeed(Match.value(creds).pipe(Match.when({ type: \"apiToken\" }, (c) => ({\n type: \"apiToken\",\n apiToken: Redacted.make(c.apiToken),\n apiBaseUrl: c.apiBaseUrl ?? DEFAULT_API_BASE_URL,\n orgId: c.orgId,\n source: { type: \"stored\" },\n })), Match.when({ type: \"pat\" }, (c) => ({\n type: \"pat\",\n apiToken: Redacted.make(c.apiToken),\n apiBaseUrl: c.apiBaseUrl ?? DEFAULT_API_BASE_URL,\n orgId: c.orgId,\n source: { type: \"stored\" },\n })), Match.exhaustive))))), Match.exhaustive);\n const logout = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .delete(profileName, STORAGE_KEY)\n .pipe(Effect.andThen(Clank.success(\"Axiom: stored credentials removed\")))), Match.exhaustive);\n const login = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .read(profileName, STORAGE_KEY)\n .pipe(Effect.flatMap((creds) => creds == null ? loginStored(profileName) : Effect.void))), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })));\n const prettyPrint = (profileName, config) => resolveCredentials(profileName, config).pipe(Effect.tap((creds) => {\n const sourceStr = creds.source.details\n ? `${creds.source.type} - ${creds.source.details}`\n : creds.source.type;\n return Match.value(creds).pipe(Match.when({ type: \"apiToken\" }, (c) => Effect.all([\n Console.log(` apiToken: ${displayRedacted(c.apiToken, 9)}`),\n Console.log(` apiBaseUrl: ${c.apiBaseUrl}`),\n Console.log(` orgId: ${c.orgId ?? \"(none)\"}`),\n Console.log(` source: ${sourceStr}`),\n ])), Match.when({ type: \"pat\" }, (c) => Effect.all([\n Console.log(` apiToken: ${displayRedacted(c.apiToken, 9)}`),\n Console.log(` apiBaseUrl: ${c.apiBaseUrl}`),\n Console.log(` orgId: ${c.orgId}`),\n Console.log(` source: ${sourceStr}`),\n ])), Match.exhaustive);\n }));\n return {\n configure: configureCredentials,\n logout,\n login,\n prettyPrint,\n read: resolveCredentials,\n };\n}));\n//# sourceMappingURL=AuthProvider.js.map","/**\n * Filename (under `~/.alchemy/credentials/{profile}/`) used to cache the\n * Cloudflare-deployed HTTP state store's endpoint + bearer token.\n *\n * Kept in this leaf module (rather than `StateStore/State.ts`) so the\n * Cloudflare auth provider can invalidate the cache on\n * `login --configure` / `logout` without importing the heavy state-store\n * module and creating an import cycle\n * (`StateStore/State.ts` -> `Providers.ts` -> `Auth/AuthProvider.ts`).\n */\nexport const CREDENTIALS_FILE = \"cloudflare-state-store\";\n/**\n * `true` when cached state-store credentials must not be trusted for the\n * current account:\n *\n * - the file predates the `accountId` field (legacy cache — exactly the\n * artifact that caused deploys to silently target the wrong account), or\n * - it was minted against a different account than the one now in use.\n *\n * A stale cache is discarded and re-derived from the current account.\n */\nexport const isStateStoreCredentialsStale = (credentials, currentAccountId) => credentials.accountId == null || credentials.accountId !== currentAccountId;\n//# sourceMappingURL=CredentialsFile.js.map","import * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport crypto from \"node:crypto\";\nimport http from \"node:http\";\nimport { AUTH_ERROR_URL, AUTH_SUCCESS_URL } from \"../../Auth/AuthProvider.js\";\nimport { OAUTH_CLIENT_ID, OAUTH_ENDPOINTS, OAUTH_LOCAL_CALLBACK_URI, OAUTH_REDIRECT_URI, } from \"./AuthProvider.js\";\nexport class OAuthError extends Data.TaggedError(\"OAuthError\") {\n}\nfunction generateState(length = 32) {\n return Buffer.from(crypto.randomBytes(length)).toString(\"base64url\");\n}\nfunction generatePKCE(length = 96) {\n const verifier = Buffer.from(crypto.randomBytes(length)).toString(\"base64url\");\n const challenge = crypto\n .createHash(\"sha256\")\n .update(verifier)\n .digest(\"base64url\");\n return { verifier, challenge };\n}\nfunction extractCredentials(json) {\n return {\n type: \"oauth\",\n access: json.access_token,\n refresh: json.refresh_token,\n expires: Date.now() + json.expires_in * 1000,\n scopes: json.scope.split(\" \"),\n };\n}\nconst tokenRequest = (body) => Effect.gen(function* () {\n const res = yield* Effect.tryPromise({\n try: () => fetch(OAUTH_ENDPOINTS.token, {\n method: \"POST\",\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n body: new URLSearchParams(body).toString(),\n }),\n catch: (err) => new OAuthError({\n error: \"network_error\",\n errorDescription: `Token request failed: ${err}`,\n }),\n });\n if (!res.ok) {\n const json = yield* Effect.tryPromise({\n try: () => res.json(),\n catch: () => new OAuthError({\n error: \"parse_error\",\n errorDescription: `Token endpoint returned ${res.status}`,\n }),\n });\n return yield* new OAuthError({\n error: json.error,\n errorDescription: json.error_description,\n });\n }\n const json = yield* Effect.tryPromise({\n try: () => res.json(),\n catch: () => new OAuthError({\n error: \"parse_error\",\n errorDescription: \"Failed to parse token response\",\n }),\n });\n return extractCredentials(json);\n});\n/**\n * Generate an authorization URL with PKCE for the given scopes.\n */\nexport function authorize(scopes) {\n const state = generateState();\n const pkce = generatePKCE();\n const url = new URL(OAUTH_ENDPOINTS.authorize);\n url.searchParams.set(\"client_id\", OAUTH_CLIENT_ID);\n url.searchParams.set(\"redirect_uri\", OAUTH_REDIRECT_URI);\n url.searchParams.set(\"response_type\", \"code\");\n url.searchParams.set(\"scope\", scopes.join(\" \"));\n url.searchParams.set(\"state\", state);\n url.searchParams.set(\"code_challenge\", pkce.challenge);\n url.searchParams.set(\"code_challenge_method\", \"S256\");\n return { url: url.toString(), state, verifier: pkce.verifier };\n}\n/**\n * Exchange an authorization code for OAuth credentials.\n */\nexport const exchange = (code, verifier) => tokenRequest({\n grant_type: \"authorization_code\",\n code,\n code_verifier: verifier,\n client_id: OAUTH_CLIENT_ID,\n redirect_uri: OAUTH_REDIRECT_URI,\n});\n/**\n * Refresh expired OAuth credentials.\n */\nexport const refresh = (credentials) => tokenRequest({\n grant_type: \"refresh_token\",\n refresh_token: credentials.refresh,\n client_id: OAUTH_CLIENT_ID,\n redirect_uri: OAUTH_REDIRECT_URI,\n});\n/**\n * Revoke OAuth credentials.\n */\nexport const revoke = (credentials) => Effect.gen(function* () {\n yield* Effect.tryPromise({\n try: () => fetch(OAUTH_ENDPOINTS.revoke, {\n method: \"POST\",\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n body: new URLSearchParams({\n refresh_token: credentials.refresh,\n client_id: OAUTH_CLIENT_ID,\n redirect_uri: OAUTH_REDIRECT_URI,\n }).toString(),\n }),\n catch: (err) => new OAuthError({\n error: \"network_error\",\n errorDescription: `Revoke request failed: ${err}`,\n }),\n });\n});\n/**\n * Exchange a code copied from the hosted relay page, or extract the code from\n * either the hosted or loopback callback URL.\n */\nexport const exchangeCallbackInput = (input, authorization) => Effect.gen(function* () {\n const value = input.trim();\n let code = value;\n let state = null;\n try {\n const url = new URL(value);\n code = url.searchParams.get(\"code\") ?? \"\";\n state = url.searchParams.get(\"state\");\n }\n catch {\n const separator = value.lastIndexOf(\"#\");\n if (separator >= 0) {\n code = value.slice(0, separator);\n state = value.slice(separator + 1);\n }\n }\n if (!code) {\n return yield* new OAuthError({\n error: \"invalid_request\",\n errorDescription: \"The authorization code is missing.\",\n });\n }\n if (state !== null && state !== authorization.state) {\n return yield* new OAuthError({\n error: \"invalid_request\",\n errorDescription: \"The authorization state does not match.\",\n });\n }\n return yield* exchange(code, authorization.verifier);\n});\n/**\n * Start a local HTTP server to listen for the OAuth callback, exchange\n * the authorization code, and return the credentials.\n *\n * Times out after 5 minutes.\n */\nexport const callback = (authorization) => Effect.tryPromise({\n try: (signal) => callbackPromise(authorization, signal),\n catch: (err) => {\n if (err instanceof OAuthError)\n return err;\n return new OAuthError({\n error: \"callback_error\",\n errorDescription: `OAuth callback failed: ${err}`,\n });\n },\n});\nfunction callbackPromise(authorization, signal) {\n const { pathname, port } = new URL(OAUTH_LOCAL_CALLBACK_URI);\n return new Promise((resolve, reject) => {\n const server = http.createServer(async (req, res) => {\n const url = new URL(req.url ?? \"/\", `http://${req.headers.host}`);\n if (url.pathname === \"/auth/ping\") {\n res.writeHead(req.method === \"OPTIONS\" ? 204 : 200, {\n \"Access-Control-Allow-Origin\": new URL(OAUTH_REDIRECT_URI).origin,\n \"Access-Control-Allow-Methods\": \"GET, OPTIONS\",\n \"Access-Control-Allow-Private-Network\": \"true\",\n \"Cache-Control\": \"no-store\",\n });\n res.end();\n return;\n }\n if (url.pathname !== pathname) {\n res.statusCode = 404;\n res.end(\"Not Found\");\n return;\n }\n const error = url.searchParams.get(\"error\");\n const errorDescription = url.searchParams.get(\"error_description\");\n if (error) {\n res.writeHead(302, { Location: AUTH_ERROR_URL });\n res.end();\n cleanup();\n reject(new OAuthError({\n error,\n errorDescription: errorDescription ?? \"An unknown error occurred.\",\n }));\n return;\n }\n const code = url.searchParams.get(\"code\");\n const state = url.searchParams.get(\"state\");\n if (!code || !state) {\n res.writeHead(302, { Location: AUTH_ERROR_URL });\n res.end();\n cleanup();\n reject(new OAuthError({\n error: \"invalid_request\",\n errorDescription: \"Missing code or state\",\n }));\n return;\n }\n if (state !== authorization.state) {\n res.writeHead(302, { Location: AUTH_ERROR_URL });\n res.end();\n cleanup();\n reject(new OAuthError({\n error: \"invalid_request\",\n errorDescription: \"Invalid state\",\n }));\n return;\n }\n try {\n const credentials = await Effect.runPromise(exchange(code, authorization.verifier));\n res.writeHead(302, { Location: AUTH_SUCCESS_URL });\n res.end();\n cleanup();\n resolve(credentials);\n }\n catch (err) {\n res.writeHead(302, { Location: AUTH_ERROR_URL });\n res.end();\n cleanup();\n reject(err);\n }\n });\n const timeout = setTimeout(() => {\n cleanup();\n reject(new OAuthError({\n error: \"timeout\",\n errorDescription: \"The authorization process timed out.\",\n }));\n }, 5 * 60 * 1000);\n function cleanup() {\n clearTimeout(timeout);\n signal.removeEventListener(\"abort\", cleanup);\n server.close();\n }\n signal.addEventListener(\"abort\", cleanup, { once: true });\n server.on(\"error\", (err) => {\n cleanup();\n reject(new OAuthError({\n error: \"server_error\",\n errorDescription: `Failed to start callback server: ${err.message}`,\n }));\n });\n server.listen(Number(port));\n });\n}\n//# sourceMappingURL=OAuthClient.js.map","import * as cfAccounts from \"@distilled.cloud/cloudflare/accounts\";\nimport * as CfCredentialsModule from \"@distilled.cloud/cloudflare/Credentials\";\nimport * as Console from \"effect/Console\";\nimport * as Duration from \"effect/Duration\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Match from \"effect/Match\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as FetchHttpClient from \"effect/unstable/http/FetchHttpClient\";\nimport * as HttpClient from \"effect/unstable/http/HttpClient\";\nimport { AuthError, AuthProviderLayer, } from \"../../Auth/AuthProvider.js\";\nimport { CredentialsStore, displayRedacted } from \"../../Auth/Credentials.js\";\nimport { getEnv, getEnvRedacted, getEnvRequired, retryOnce, } from \"../../Auth/Env.js\";\nimport * as Clank from \"../../Util/Clank.js\";\nimport { CREDENTIALS_FILE as STATE_STORE_CREDENTIALS_FILE } from \"../StateStore/CredentialsFile.js\";\nimport * as OAuthClient from \"./OAuthClient.js\";\nconst options = [\n {\n value: \"oauth\",\n label: \"OAuth\",\n hint: \"recommended — browser-based login with automatic token refresh\",\n },\n {\n value: \"env\",\n label: \"Environment Variables\",\n hint: \"CLOUDFLARE_API_TOKEN or CLOUDFLARE_API_KEY + CLOUDFLARE_EMAIL\",\n },\n {\n value: \"stored\",\n label: \"API Token or API Key\",\n hint: \"enter credentials interactively, stored in ~/.alchemy/credentials\",\n },\n];\nexport const CLOUDFLARE_AUTH_PROVIDER_NAME = \"Cloudflare\";\nconst withOAuthCredentials = (accessToken, effect) => Effect.provide(effect, Layer.mergeAll(CfCredentialsModule.fromOAuth({\n load: Effect.succeed({ accessToken }),\n refresh: () => Effect.die(\"refresh not expected during account selection\"),\n}), FetchHttpClient.layer));\nconst selectAccount = (accessToken) => Effect.gen(function* () {\n const list = yield* cfAccounts.listAccounts;\n const response = yield* list({});\n const accounts = response.result;\n if (accounts.length === 0) {\n return yield* new AuthError({\n message: \"Cloudflare: no accounts found for this credential.\",\n });\n }\n if (accounts.length === 1) {\n const account = accounts[0];\n yield* Clank.info(`Cloudflare: using account: ${account.name} (${account.id})`);\n return account.id;\n }\n return yield* Clank.select({\n message: \"Select a Cloudflare account\",\n options: accounts.map((a) => ({\n value: a.id,\n label: a.name,\n hint: a.id,\n })),\n }).pipe(retryOnce);\n}).pipe((e) => withOAuthCredentials(accessToken, e));\n/**\n * Cloudflare account IDs are 32 lowercase hex characters. Placeholder\n * values (\"\", \"-\", \"dummy\", …) end up interpolated into API paths and\n * surface as baffling `InvalidRoute: Could not route to\n * /accounts/<value>/...` errors, so reject them up front with an\n * actionable message instead.\n */\nconst ACCOUNT_ID_PATTERN = /^[0-9a-f]{32}$/i;\nexport const validateAccountId = (accountId, source) => {\n const trimmed = accountId?.trim() ?? \"\";\n if (trimmed.length === 0) {\n return Effect.fail(new AuthError({\n message: `Cloudflare account ID is missing (${source}). ` +\n \"Set CLOUDFLARE_ACCOUNT_ID or re-run 'alchemy login' and provide your account ID \" +\n \"(found in the Cloudflare dashboard under Workers & Pages → Account details).\",\n }));\n }\n if (!ACCOUNT_ID_PATTERN.test(trimmed)) {\n return Effect.fail(new AuthError({\n message: `'${trimmed}' is not a valid Cloudflare account ID (${source}) — expected 32 hex characters. ` +\n \"Copy the account ID from the Cloudflare dashboard (Workers & Pages → Account details) \" +\n \"into CLOUDFLARE_ACCOUNT_ID or re-run 'alchemy login'.\",\n }));\n }\n return Effect.succeed(trimmed.toLowerCase());\n};\nconst promptAccountId = () => getEnv(\"CLOUDFLARE_ACCOUNT_ID\").pipe(Effect.flatMap((envAccountId) => Clank.text({\n message: \"Cloudflare Account ID (Enter to skip)\",\n placeholder: envAccountId ?? \"\",\n defaultValue: envAccountId ?? \"\",\n validate: (v) => v.trim().length === 0 || ACCOUNT_ID_PATTERN.test(v.trim())\n ? undefined\n : \"Expected a 32-character hex account ID (Workers & Pages → Account details)\",\n}).pipe(retryOnce)));\nconst promptOAuthScopes = () => Clank.confirm({\n message: \"Customize OAuth scopes? (default covers typical use cases)\",\n initialValue: false,\n}).pipe(retryOnce, Effect.flatMap((customize) => {\n if (!customize)\n return Effect.succeed([...DEFAULT_SCOPES]);\n return Clank.multiselect({\n message: \"Select OAuth scopes\",\n initialValues: DEFAULT_SCOPES,\n options: Object.entries(ALL_SCOPES).map(([value, hint]) => ({\n value: value,\n label: value,\n hint,\n })),\n required: true,\n }).pipe(Effect.map((s) => s), retryOnce);\n}));\n/**\n * Layer that registers the Cloudflare {@link AuthProvider} into the\n * {@link AuthProviders} registry when built. Include this in the Cloudflare\n * `providers()` layer so `alchemy login` can discover it.\n */\nexport const CloudflareAuth = AuthProviderLayer()(CLOUDFLARE_AUTH_PROVIDER_NAME, Effect.gen(function* () {\n const store = yield* CredentialsStore;\n const oauthLogin = (profileName, scopes) => Effect.gen(function* () {\n const authorization = OAuthClient.authorize([\n ...scopes,\n \"offline_access\",\n ]);\n yield* Clank.info(\"Cloudflare: opening browser for OAuth login...\");\n yield* Clank.info(authorization.url);\n yield* Clank.openUrl(authorization.url).pipe(Effect.catch(() => Clank.warn(\"Cloudflare: could not open browser automatically. Please open the URL above manually.\")));\n yield* Clank.info(\"Cloudflare: waiting for authorization (up to 5 minutes).\");\n const credentials = yield* Effect.raceFirst(OAuthClient.callback(authorization), Clank.text({\n message: \"Paste the authorization code or callback URL\",\n placeholder: \"The browser will complete this automatically when local\",\n validate: (value) => value.trim().length > 0 ? undefined : \"Paste a code or URL\",\n }).pipe(Effect.flatMap((input) => OAuthClient.exchangeCallbackInput(input, authorization))));\n yield* store.write(profileName, \"cf-oauth\", credentials);\n yield* Clank.success(\"Cloudflare: OAuth credentials saved.\");\n return credentials;\n });\n const loginStored = Effect.fn(function* (profileName) {\n const credentialType = yield* Clank.select({\n message: \"Cloudflare credential type\",\n options: [\n {\n value: \"apiToken\",\n label: \"API Token\",\n hint: \"recommended\",\n },\n { value: \"apiKey\", label: \"API Key + Email\" },\n ],\n }).pipe(retryOnce);\n return yield* Match.value(credentialType).pipe(Match.when(\"apiToken\", () => Effect.gen(function* () {\n const apiToken = yield* Clank.password({\n message: \"Cloudflare API Token\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const accountId = yield* promptAccountId();\n yield* store.write(profileName, \"cf-stored\", { type: \"apiToken\", apiToken, accountId });\n yield* Clank.success(\"Cloudflare: credentials saved.\");\n return {\n method: \"stored\",\n credentialType: \"apiToken\",\n };\n })), Match.when(\"apiKey\", () => Effect.gen(function* () {\n const apiKey = yield* Clank.text({\n message: \"Cloudflare API Key\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const email = yield* Clank.text({\n message: \"Cloudflare Email\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const accountId = yield* promptAccountId();\n yield* store.write(profileName, \"cf-stored\", { type: \"apiKey\", apiKey, email, accountId });\n yield* Clank.success(\"Cloudflare: credentials saved.\");\n return {\n method: \"stored\",\n credentialType: \"apiKey\",\n };\n })), Match.exhaustive);\n });\n const configureOAuth = Effect.fn(function* (profileName) {\n const scopes = yield* promptOAuthScopes();\n const oauthCreds = yield* oauthLogin(profileName, scopes);\n const accountId = yield* selectAccount(oauthCreds.access).pipe(Effect.mapError((e) => new AuthError({\n message: \"Cloudflare: could not list accounts\",\n cause: e,\n })));\n return {\n method: \"oauth\",\n scopes,\n accountId,\n };\n });\n const configureInteractive = (profileName) => Clank.select({\n message: \"Cloudflare authentication method\",\n options,\n }).pipe(Effect.flatMap((method) => Match.value(method).pipe(Match.when(\"env\", () => Effect.succeed({ method: \"env\" })), Match.when(\"oauth\", () => configureOAuth(profileName)), Match.when(\"stored\", () => loginStored(profileName)), Match.exhaustive)));\n const configureCredentials = (profileName, ctx) => Effect.gen(function* () {\n const config = ctx.ci\n ? { method: \"env\" }\n : yield* configureInteractive(profileName);\n // Re-configuring auth may point this profile at a different\n // Cloudflare account. The cached state-store credentials\n // (`~/.alchemy/credentials/{profile}/cloudflare-state-store.json`)\n // are minted per-account, so drop them here; the next deploy\n // re-derives them against the freshly-configured account.\n yield* store\n .delete(profileName, STATE_STORE_CREDENTIALS_FILE)\n .pipe(Effect.ignore);\n return config;\n }).pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to configure credentials\",\n cause: e,\n })));\n const resolveCredentials = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, Effect.fn(function* () {\n const accountId = yield* getEnvRequired(\"CLOUDFLARE_ACCOUNT_ID\").pipe(Effect.flatMap((id) => validateAccountId(id, \"from the CLOUDFLARE_ACCOUNT_ID env var\")));\n const apiToken = yield* getEnvRedacted(\"CLOUDFLARE_API_TOKEN\");\n if (apiToken) {\n return {\n type: \"apiToken\",\n apiToken,\n accountId,\n source: { type: \"env\" },\n };\n }\n const apiKey = yield* getEnvRedacted(\"CLOUDFLARE_API_KEY\");\n const email = yield* getEnvRedacted(\"CLOUDFLARE_EMAIL\");\n if (apiKey && email) {\n return {\n type: \"apiKey\",\n apiKey,\n email,\n accountId,\n source: { type: \"env\" },\n };\n }\n return yield* new AuthError({\n message: \"Cloudflare env credentials not found. Set CLOUDFLARE_API_TOKEN or CLOUDFLARE_API_KEY + CLOUDFLARE_EMAIL.\",\n });\n })), Match.when({ method: \"stored\" }, () => store\n .read(profileName, \"cf-stored\")\n .pipe(Effect.flatMap((creds) => creds == null\n ? Effect.fail(new AuthError({\n message: \"Cloudflare stored credentials not found. Run: alchemy login --configure\",\n }))\n : Effect.gen(function* () {\n // The account ID prompt is skippable, so stored\n // credentials may carry an empty accountId; fall\n // back to the env var before validating.\n const envAccountId = yield* getEnv(\"CLOUDFLARE_ACCOUNT_ID\");\n const accountId = yield* validateAccountId(creds.accountId?.trim() || envAccountId, `stored for profile '${profileName}'`);\n return Match.value(creds).pipe(Match.when({ type: \"apiToken\" }, (c) => ({\n type: \"apiToken\",\n apiToken: Redacted.make(c.apiToken),\n accountId,\n source: { type: \"stored\" },\n })), Match.when({ type: \"apiKey\" }, (c) => ({\n type: \"apiKey\",\n apiKey: Redacted.make(c.apiKey),\n email: Redacted.make(c.email),\n accountId,\n source: { type: \"stored\" },\n })), Match.exhaustive);\n })))), Match.when({ method: \"oauth\" }, (cfg) => Effect.gen(function* () {\n const accountId = yield* validateAccountId(cfg.accountId, `configured for profile '${profileName}'`);\n const creds = yield* store.read(profileName, \"cf-oauth\");\n if (creds == null || creds.type !== \"oauth\") {\n return yield* Effect.fail(new AuthError({\n message: \"Cloudflare OAuth credentials not found. Run: alchemy login\",\n }));\n }\n // Refresh proactively if the token has expired (or is within\n // 10s of expiring). Persist the refreshed creds so subsequent\n // resolves don't repeat the round-trip.\n const fresh = creds.expires > Date.now() + 10_000\n ? creds\n : yield* OAuthClient.refresh(creds).pipe(Effect.tap((refreshed) => store.write(profileName, \"cf-oauth\", refreshed)), Effect.mapError((e) => new AuthError({\n message: \"Cloudflare OAuth refresh failed. Run: alchemy login\",\n cause: e,\n })));\n return {\n type: \"oauth\",\n accessToken: Redacted.make(fresh.access),\n expires: fresh.expires,\n accountId,\n source: { type: \"oauth\" },\n };\n })), Match.exhaustive);\n const logout = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .delete(profileName, \"cf-stored\")\n .pipe(Effect.andThen(Clank.success(\"Cloudflare: stored credentials removed\")))), Match.when({ method: \"oauth\" }, () => store\n .read(profileName, \"cf-oauth\")\n .pipe(Effect.tap((creds) => creds?.type === \"oauth\"\n ? OAuthClient.revoke(creds).pipe(Effect.catchTag(\"OAuthError\", (err) => Clank.warn(`Cloudflare: could not revoke OAuth token: ${err.errorDescription}`)))\n : Effect.void), Effect.andThen(store.delete(profileName, \"cf-oauth\")), Effect.andThen(Clank.success(\"Cloudflare: OAuth credentials removed.\")))), Match.exhaustive)\n // The cached state-store credentials are derived from the account we\n // just logged out of, so drop them regardless of auth method.\n .pipe(Effect.andThen(store\n .delete(profileName, STATE_STORE_CREDENTIALS_FILE)\n .pipe(Effect.ignore)));\n const login = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .read(profileName, \"cf-stored\")\n .pipe(Effect.flatMap((creds) => creds == null ? loginStored(profileName) : Effect.void))), Match.when({ method: \"oauth\" }, (c) => Effect.gen(function* () {\n const creds = yield* store.read(profileName, \"cf-oauth\");\n if (creds?.type === \"oauth\") {\n yield* Clank.info(\"Cloudflare: refreshing OAuth credentials...\");\n yield* OAuthClient.refresh(creds).pipe(Effect.flatMap((refreshed) => store\n .write(profileName, \"cf-oauth\", refreshed)\n .pipe(Effect.andThen(Clank.success(\"Cloudflare: OAuth credentials refreshed.\")))), Effect.catchTag(\"OAuthError\", () => oauthLogin(profileName, c.scopes).pipe(Effect.asVoid)));\n return;\n }\n yield* oauthLogin(profileName, c.scopes);\n })), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })));\n const prettyPrint = (profileName, config) => resolveCredentials(profileName, config).pipe(Effect.tap((creds) => {\n const sourceStr = creds.source.details\n ? `${creds.source.type} - ${creds.source.details}`\n : creds.source.type;\n return Match.value(creds).pipe(Match.when({ type: \"apiToken\" }, (c) => Effect.all([\n Console.log(` apiToken: ${displayRedacted(c.apiToken, 9)}`),\n Console.log(` accountId: ${c.accountId}`),\n Console.log(` source: ${sourceStr}`),\n ])), Match.when({ type: \"apiKey\" }, (c) => Effect.all([\n Console.log(` apiKey: ${displayRedacted(c.apiKey)}`),\n Console.log(` email: ${displayRedacted(c.email)}`),\n Console.log(` accountId: ${c.accountId}`),\n Console.log(` source: ${sourceStr}`),\n ])), Match.when({ type: \"oauth\" }, (c) => {\n const remainingMs = c.expires - Date.now();\n const expiresAt = new Date(c.expires).toISOString();\n const expiresStr = remainingMs <= 0\n ? `expired (${expiresAt})`\n : `in ${Duration.format(Duration.millis(remainingMs))} (${expiresAt})`;\n return Effect.all([\n Console.log(` accessToken: ${displayRedacted(c.accessToken)}`),\n Console.log(` expires: ${expiresStr}`),\n Console.log(` accountId: ${c.accountId}`),\n Console.log(` source: ${sourceStr}`),\n ]);\n }), Match.exhaustive);\n }));\n return {\n configure: configureCredentials,\n logout,\n login,\n prettyPrint,\n read: resolveCredentials,\n };\n}));\nexport const ALL_SCOPES = {\n \"access:read\": \"See Cloudflare Access data such as zones, applications, certificates, device postures, groups, identity providers, login counts, organizations, policies, service tokens, and users\",\n \"access:write\": \"See and change Cloudflare Access data such as zones, applications, certificates, device postures, groups, identity providers, login counts, organizations, policies, service tokens, and users\",\n \"account:read\": \"See your account info such as account details, analytics, and memberships\",\n \"agw:read\": \"Grants read level access to Agents Gateway\",\n \"agw:run\": \"Grants run level access to Agents Gateway\",\n \"agw:write\": \"Grants read and write level access to Agents Gateway\",\n \"ai:read\": \"Grants read level access to Workers AI\",\n \"ai:write\": \"Grants write level access to Workers AI\",\n \"aiaudit:read\": \"Grants read level access to AI Audit\",\n \"aiaudit:write\": \"Grants write level access to AI Audit\",\n \"aig:read\": \"Grants read level access to AI Gateway\",\n \"aig:write\": \"Grants write level access to AI Gateway\",\n \"auditlogs:read\": \"View Cloudflare Account Audit Logs\",\n \"browser:read\": \"Grants read level access to Browser Rendering\",\n \"browser:write\": \"Grants write level access to Browser Rendering\",\n \"cfone:read\": \"Grants read level access to Cloudforce One data\",\n \"cfone:write\": \"Grants write level access to Cloudforce One data\",\n \"cloudchamber:write\": \"See and make changes to Cloudchamber\",\n \"connectivity:admin\": \"See, change, and bind to Connectivity Directory services, including creating services targeting Cloudflare Tunnel\",\n \"connectivity:bind\": \"read, list, and bind to Connectivity Directory services, as well as read and list Cloudflare Tunnels\",\n \"connectivity:read\": \"See Connectivity Directory services and Cloudflare Tunnels\",\n \"constellation:write\": \"Grants write access to Constellation configuration and models\",\n \"containers:write\": \"See and make changes to Workers Containers\",\n \"d1:write\": \"See and make changes to D1\",\n \"dex:read\": \"Grants read level access to Cloudflare DEX\",\n \"dex:write\": \"Grants write level access to Cloudflare DEX\",\n \"dns_analytics:read\": \"Grants read level access to Cloudflare DNS Analytics\",\n \"dns_records:edit\": \"Grants edit level access to dns records\",\n \"dns_records:read\": \"Grants read level access to dns records\",\n \"dns_settings:read\": \"Grants read level access to Cloudflare DNS Settings\",\n \"firstpartytags:write\": \"Can see, edit and publish Google tag gateway configuration.\",\n \"lb:edit\": \"Grants edit level access to lb and lb pools\",\n \"lb:read\": \"Grants read level access to lb and lb pools\",\n \"logpush:read\": \"See Cloudflare Logpush data\",\n \"logpush:write\": \"See and change Cloudflare Logpush data\",\n \"notification:read\": \"View Cloudflare Notifications\",\n \"notification:write\": \"View and Modify Cloudflare Notifications\",\n \"pages:read\": \"See Cloudflare Pages projects, settings and deployments\",\n \"pages:write\": \"See and change Cloudflare Pages projects, settings and deployments\",\n \"pipelines:read\": \"Grants read level access to Cloudflare Pipelines\",\n \"pipelines:setup\": \"Grants permission to generate R2 tokens for Workers Pipelines\",\n \"pipelines:write\": \"Grants write level access to Cloudflare Pipelines\",\n \"query_cache:write\": \"See and make changes to Hyperdrive\",\n \"queues:write\": \"See and change Cloudflare Queues settings and data\",\n \"r2_catalog:write\": \"Grants write level access to R2 Data Catalog\",\n \"radar:read\": \"Grants access to read Cloudflare Radar data\",\n \"ai-search:read\": \"Grants read level access to AI Search\",\n \"ai-search:write\": \"Grants write level access to AI Search\",\n \"ai-search:run\": \"Grants run level access to AI Search\",\n \"secrets_store:read\": \"Grants read level access to Secrets Store\",\n \"secrets_store:write\": \"Grants write level access to Secrets Store\",\n \"ssl_certs:write\": \"Grants read and write access to SSL MTLS certificates or Certificate Store\",\n \"sso-connector:read\": \"See Cloudflare SSO connectors\",\n \"sso-connector:write\": \"See Cloudflare SSO connectors to toggle activation and deactivation of SSO\",\n \"teams:pii\": \"See personally identifiable Cloudflare Teams data\",\n \"teams:read\": \"See Cloudflare Teams data such as zones, gateway, and argo tunnel details\",\n \"teams:secure_location\": \"See all DNS Location data but can only change secure DNS Locations\",\n \"teams:write\": \"See and change Cloudflare Teams data such as zones, gateway, and argo tunnel details\",\n \"url_scanner:read\": \"Grants read level access to URL Scanner\",\n \"url_scanner:write\": \"Grants write level access to URL Scanner\",\n \"user:read\": \"See your user info such as name, email address, and account memberships\",\n \"vectorize:write\": \"See and make changes to Vectorize\",\n \"workers:read\": \"See Cloudflare Workers data such as zones, KV storage, R2 storage, scripts, and routes\",\n \"workers:write\": \"See and change Cloudflare Workers data such as zones, KV storage, R2 storage, scripts, and routes\",\n \"workers_builds:read\": \"See Cloudflare Workers Builds data such as builds, build configuration, and build logs\",\n \"workers_builds:write\": \"See and change Cloudflare Workers Builds data such as builds, build configuration, and build logs\",\n \"workers_kv:write\": \"See and change Cloudflare Workers KV Storage data such as keys and namespaces\",\n \"workers_observability:read\": \"Grants read access to Cloudflare Workers Observability\",\n \"workers_observability:write\": \"Grants read and write access to Cloudflare Workers Observability\",\n \"workers_observability_telemetry:write\": \"Grants write access to Cloudflare Workers Observability Telemetry API\",\n \"workers_routes:write\": \"See and change Cloudflare Workers data such as filters and routes\",\n \"workers_scripts:write\": \"See and change Cloudflare Workers scripts, durable objects, subdomains, triggers, and tail data\",\n \"workers_tail:read\": \"See Cloudflare Workers tail and script data\",\n \"zone:read\": \"Grants read level access to account zone\",\n};\nexport const DEFAULT_SCOPES = [\n \"account:read\",\n \"ai-search:write\",\n \"ai-search:run\",\n \"ai:write\",\n \"aig:read\",\n \"aig:write\",\n \"cloudchamber:write\",\n \"connectivity:admin\",\n \"containers:write\",\n \"d1:write\",\n \"pages:write\",\n \"pipelines:write\",\n \"queues:write\",\n \"secrets_store:write\",\n \"ssl_certs:write\",\n \"user:read\",\n \"vectorize:write\",\n \"workers_kv:write\",\n \"workers_observability:read\",\n \"workers_observability:write\",\n \"workers_observability_telemetry:write\",\n \"workers_routes:write\",\n \"workers_scripts:write\",\n \"workers_tail:read\",\n \"workers:write\",\n \"zone:read\",\n];\nexport const OAUTH_CLIENT_ID = \"6d8c2255-0773-45f6-b376-2914632e6f91\";\nexport const OAUTH_REDIRECT_URI = \"https://alchemy.run/auth/callback\";\nexport const OAUTH_LOCAL_CALLBACK_URI = \"http://localhost:9976/auth/callback\";\nexport const OAUTH_ENDPOINTS = {\n authorize: \"https://dash.cloudflare.com/oauth2/authorize\",\n token: \"https://dash.cloudflare.com/oauth2/token\",\n revoke: \"https://dash.cloudflare.com/oauth2/revoke\",\n};\n//# sourceMappingURL=AuthProvider.js.map","import * as Effect from \"effect/Effect\";\nimport { AuthError } from \"../Auth/AuthProvider.js\";\nimport { getEnv } from \"../Auth/Env.js\";\n/**\n * Normalize a user-supplied GitHub host or URL into the REST API base URL\n * Octokit expects, following the same conventions as the `gh` CLI and the\n * Terraform GitHub provider:\n *\n * - `github.com` / `api.github.com` → `undefined` (Octokit's default)\n * - GitHub Enterprise Cloud with data residency (`acme.ghe.com` or\n * `api.acme.ghe.com`) → `https://api.acme.ghe.com`\n * - GitHub Enterprise Server (`github.example.com`) → `https://github.example.com/api/v3`;\n * an explicit path (e.g. an already-complete `/api/v3` URL) is honored as-is.\n *\n * Accepts a bare hostname or a full URL.\n */\nexport const normalizeGitHubBaseUrl = (input) => Effect.try({\n try: () => {\n const trimmed = input.trim();\n const url = new URL(trimmed.includes(\"://\") ? trimmed : `https://${trimmed}`);\n const host = url.hostname.toLowerCase();\n if (host === \"github.com\" ||\n host === \"www.github.com\" ||\n host === \"api.github.com\") {\n return undefined;\n }\n if (host.endsWith(\".ghe.com\")) {\n return `https://${host.startsWith(\"api.\") ? host : `api.${host}`}`;\n }\n const path = url.pathname.replace(/\\/+$/, \"\");\n return `${url.protocol}//${url.host}${path === \"\" ? \"/api/v3\" : path}`;\n },\n catch: () => new AuthError({\n message: `Invalid GitHub base URL: '${input}'. Provide a hostname (github.example.com) or URL (https://github.example.com/api/v3).`,\n }),\n});\n/**\n * The hostname `gh auth token --hostname` expects for a normalized API base\n * URL — the plain host for GitHub Enterprise Server, and the `api.`-less\n * host for GitHub Enterprise Cloud with data residency.\n */\nexport const githubHostname = (baseUrl) => {\n const host = new URL(baseUrl).hostname;\n return host.startsWith(\"api.\") && host.endsWith(\".ghe.com\")\n ? host.slice(\"api.\".length)\n : host;\n};\n/**\n * Resolve the GitHub API base URL from the environment:\n * `GITHUB_BASE_URL` (Terraform convention), then `GITHUB_API_URL` (set by\n * GitHub Actions runners), then `GH_HOST` (gh CLI convention, a bare\n * hostname). Returns `undefined` when unset or when the value points at\n * github.com.\n */\nexport const resolveGitHubBaseUrlFromEnv = Effect.gen(function* () {\n for (const key of [\"GITHUB_BASE_URL\", \"GITHUB_API_URL\", \"GH_HOST\"]) {\n const value = yield* getEnv(key);\n if (value !== undefined && value.trim() !== \"\") {\n return yield* normalizeGitHubBaseUrl(value);\n }\n }\n return undefined;\n});\n//# sourceMappingURL=BaseUrl.js.map","import * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as Match from \"effect/Match\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as Stream from \"effect/Stream\";\nimport * as ChildProcess from \"effect/unstable/process/ChildProcess\";\nimport { ChildProcessSpawner } from \"effect/unstable/process/ChildProcessSpawner\";\nimport { AuthError, AuthProviderLayer, } from \"../Auth/AuthProvider.js\";\nimport { CredentialsStore, displayRedacted } from \"../Auth/Credentials.js\";\nimport { getEnvRedacted, retryOnce } from \"../Auth/Env.js\";\nimport * as Clank from \"../Util/Clank.js\";\nimport { githubHostname, normalizeGitHubBaseUrl, resolveGitHubBaseUrlFromEnv, } from \"./BaseUrl.js\";\nconst options = [\n {\n value: \"gh-cli\",\n label: \"GitHub CLI\",\n hint: \"delegate to `gh auth token` (run `gh auth login` first)\",\n },\n {\n value: \"env\",\n label: \"Environment Variables\",\n hint: \"GITHUB_ACCESS_TOKEN or GITHUB_TOKEN\",\n },\n {\n value: \"stored\",\n label: \"Personal Access Token\",\n hint: \"enter PAT interactively, stored in ~/.alchemy/credentials\",\n },\n];\nexport const GITHUB_AUTH_PROVIDER_NAME = \"GitHub\";\nclass GhCliError extends Error {\n _tag = \"GhCliError\";\n}\n/**\n * Read a token from the environment for the given (already-resolved) base\n * URL. On a GitHub Enterprise host, the gh CLI's enterprise token variables\n * (`GH_ENTERPRISE_TOKEN`, `GITHUB_ENTERPRISE_TOKEN`) are checked before the\n * standard `GITHUB_ACCESS_TOKEN` / `GITHUB_TOKEN`.\n */\nconst readEnvTokenFor = (baseUrl) => Effect.gen(function* () {\n const candidates = baseUrl !== undefined\n ? [\n \"GH_ENTERPRISE_TOKEN\",\n \"GITHUB_ENTERPRISE_TOKEN\",\n \"GITHUB_ACCESS_TOKEN\",\n \"GITHUB_TOKEN\",\n ]\n : [\"GITHUB_ACCESS_TOKEN\", \"GITHUB_TOKEN\"];\n for (const key of candidates) {\n const token = yield* getEnvRedacted(key);\n if (token) {\n return {\n type: \"token\",\n token,\n baseUrl,\n source: { type: \"env\", details: key },\n };\n }\n }\n return yield* new AuthError({\n message: `GitHub env credentials not found. Set ${candidates.join(\", \")}.`,\n });\n});\n/**\n * Read GitHub credentials from the environment. The base URL comes from the\n * stored config when set, otherwise from `GITHUB_BASE_URL`, `GITHUB_API_URL`,\n * or `GH_HOST`.\n */\nexport const readEnvCredentials = (configBaseUrl) => Effect.gen(function* () {\n const baseUrl = configBaseUrl ?? (yield* resolveGitHubBaseUrlFromEnv);\n return yield* readEnvTokenFor(baseUrl);\n});\nexport const makeGitHubAuth = (authOptions) => AuthProviderLayer()(GITHUB_AUTH_PROVIDER_NAME, Effect.gen(function* () {\n const store = yield* CredentialsStore;\n const cp = yield* ChildProcessSpawner;\n // Hard-coded host from `providers({ baseUrl })`, resolved once at layer\n // build. Kept as an object so \"no option\" (undefined) is distinct from\n // \"option normalized to the github.com default\" ({ baseUrl: undefined })\n // — both matter: the latter still pins the host and mutes the prompt.\n const fixed = authOptions?.baseUrl !== undefined\n ? {\n baseUrl: yield* normalizeGitHubBaseUrl(authOptions.baseUrl).pipe(Effect.orDie),\n }\n : undefined;\n // The host every method authenticates against: the hard-coded value\n // wins, then the profile's configured host, then the environment.\n const effectiveBaseUrl = (config) => fixed !== undefined\n ? Effect.succeed(fixed.baseUrl)\n : config.baseUrl !== undefined\n ? Effect.succeed(config.baseUrl)\n : resolveGitHubBaseUrlFromEnv;\n const ghCliToken = (hostname) => Effect.gen(function* () {\n const handle = yield* cp.spawn(ChildProcess.make(\"gh\", [\n \"auth\",\n \"token\",\n ...(hostname !== undefined ? [\"--hostname\", hostname] : []),\n ], { shell: false }));\n const [exitCode, stdout, stderr] = yield* Effect.all([\n handle.exitCode,\n Stream.mkString(Stream.decodeText(handle.stdout)),\n Stream.mkString(Stream.decodeText(handle.stderr)),\n ], { concurrency: 3 });\n if (exitCode !== 0) {\n return yield* Effect.fail(new GhCliError(`gh auth token exited with ${exitCode}: ${stderr.trim() || stdout.trim()}`));\n }\n const token = stdout.trim();\n if (!token) {\n return yield* Effect.fail(new GhCliError(\"gh auth token returned empty output\"));\n }\n return token;\n }).pipe(Effect.scoped, Effect.mapError((e) => e instanceof GhCliError\n ? new AuthError({ message: e.message, cause: e })\n : new AuthError({\n message: \"Could not invoke `gh`. Install GitHub CLI from https://cli.github.com/ and run `gh auth login`.\",\n cause: e,\n })));\n const loginStored = Effect.fn(function* (profileName, baseUrl) {\n const token = yield* Clank.password({\n message: \"GitHub Personal Access Token (needs `repo` scope; `workflow` for Actions)\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n yield* store.write(profileName, \"gh-stored\", {\n type: \"pat\",\n token,\n });\n yield* Clank.success(\"GitHub: credentials saved.\");\n return { method: \"stored\", baseUrl };\n });\n // Optional GitHub Enterprise host. Blank means github.com; anything else\n // is normalized into the REST API base URL (GHES gets `/api/v3`\n // appended, data-residency hosts get the `api.` prefix).\n const promptBaseUrl = Clank.text({\n message: \"GitHub host (leave blank for github.com; e.g. github.example.com for GitHub Enterprise)\",\n placeholder: \"github.com\",\n defaultValue: \"\",\n }).pipe(retryOnce, Effect.flatMap((input) => {\n const trimmed = (input ?? \"\").trim();\n return trimmed === \"\"\n ? Effect.succeed(undefined)\n : normalizeGitHubBaseUrl(trimmed);\n }));\n const configureInteractive = (profileName) => Effect.gen(function* () {\n const method = yield* Clank.select({\n message: \"GitHub authentication method\",\n options,\n });\n // The host prompt is skipped when providers({ baseUrl }) pinned it —\n // nothing is stored in the profile config; `read` re-applies the\n // pinned value from code on every resolution.\n const baseUrl = fixed !== undefined ? undefined : yield* promptBaseUrl;\n const verifyHost = fixed !== undefined ? fixed.baseUrl : baseUrl;\n return yield* Match.value(method).pipe(Match.when(\"env\", () => Effect.succeed({ method: \"env\", baseUrl })), Match.when(\"gh-cli\", () => ghCliToken(verifyHost !== undefined\n ? githubHostname(verifyHost)\n : undefined).pipe(Effect.as({ method: \"gh-cli\", baseUrl }), Effect.mapError((e) => new AuthError({\n message: `gh CLI not available: ${e.message}`,\n cause: e,\n })))), Match.when(\"stored\", () => loginStored(profileName, baseUrl)), Match.exhaustive);\n });\n const configureCredentials = (profileName, ctx) => Effect.gen(function* () {\n if (ctx.ci) {\n return { method: \"env\" };\n }\n return yield* configureInteractive(profileName);\n }).pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to configure credentials\",\n cause: e,\n })));\n const resolveCredentials = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, (c) => effectiveBaseUrl(c).pipe(Effect.flatMap(readEnvTokenFor))), Match.when({ method: \"stored\" }, Effect.fn(function* (c) {\n const baseUrl = yield* effectiveBaseUrl(c);\n const creds = yield* store.read(profileName, \"gh-stored\");\n if (creds == null) {\n return yield* new AuthError({\n message: \"GitHub stored credentials not found. Run: alchemy login --configure\",\n });\n }\n return {\n type: \"token\",\n token: Redacted.make(creds.token),\n baseUrl,\n source: { type: \"stored\" },\n };\n })), Match.when({ method: \"gh-cli\" }, Effect.fn(function* (c) {\n const baseUrl = yield* effectiveBaseUrl(c);\n const token = yield* ghCliToken(baseUrl !== undefined ? githubHostname(baseUrl) : undefined);\n return {\n type: \"token\",\n token: Redacted.make(token),\n baseUrl,\n source: { type: \"gh-cli\" },\n };\n })), Match.exhaustive);\n const logout = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"gh-cli\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .delete(profileName, \"gh-stored\")\n .pipe(Effect.andThen(Clank.success(\"GitHub: stored credentials removed\")))), Match.exhaustive);\n const login = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"gh-cli\" }, (c) => effectiveBaseUrl(c).pipe(Effect.flatMap((baseUrl) => ghCliToken(baseUrl !== undefined ? githubHostname(baseUrl) : undefined)), Effect.tap(() => Clank.success(\"GitHub: gh CLI authentication available.\")), Effect.asVoid)), Match.when({ method: \"stored\" }, (c) => store\n .read(profileName, \"gh-stored\")\n .pipe(Effect.flatMap((creds) => creds == null\n ? loginStored(profileName, c.baseUrl)\n : Effect.void))), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })));\n const prettyPrint = (profileName, config) => resolveCredentials(profileName, config).pipe(Effect.tap((creds) => {\n const sourceStr = creds.source.details\n ? `${creds.source.type} - ${creds.source.details}`\n : creds.source.type;\n return Effect.all([\n Console.log(` token: ${displayRedacted(creds.token, 6)}`),\n Console.log(` source: ${sourceStr}`),\n ...(creds.baseUrl !== undefined\n ? [Console.log(` baseUrl: ${creds.baseUrl}`)]\n : []),\n ]);\n }));\n return {\n configure: configureCredentials,\n logout,\n login,\n prettyPrint,\n read: resolveCredentials,\n };\n}));\n/**\n * The default GitHub AuthProvider layer — {@link makeGitHubAuth} with no\n * hard-coded host. Use `GitHub.providers({ baseUrl })` (or\n * `makeGitHubAuth({ baseUrl })` directly) to pin a GitHub Enterprise host.\n */\nexport const GitHubAuth = makeGitHubAuth();\n//# sourceMappingURL=AuthProvider.js.map","import { DEFAULT_API_BASE_URL } from \"@distilled.cloud/hetzner\";\nimport * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as Match from \"effect/Match\";\nimport * as Redacted from \"effect/Redacted\";\nimport { AuthError, AuthProviderLayer, } from \"../Auth/AuthProvider.js\";\nimport { CredentialsStore, displayRedacted } from \"../Auth/Credentials.js\";\nimport { getEnv, getEnvRedacted, retryOnce } from \"../Auth/Env.js\";\nimport { AlchemyProfile } from \"../Auth/Profile.js\";\nimport * as Clank from \"../Util/Clank.js\";\nexport const HETZNER_AUTH_PROVIDER_NAME = \"Hetzner\";\nexport const HCLOUD_TOKEN_ENV = \"HCLOUD_TOKEN\";\nexport const HCLOUD_ENDPOINT_ENV = \"HCLOUD_ENDPOINT\";\nconst STORAGE_KEY = \"hetzner-stored\";\nconst options = [\n {\n value: \"env\",\n label: \"Environment Variables\",\n hint: `${HCLOUD_TOKEN_ENV} + optional ${HCLOUD_ENDPOINT_ENV}`,\n },\n {\n value: \"stored\",\n label: \"API Token\",\n hint: \"enter interactively, stored in ~/.alchemy/credentials\",\n },\n];\nconst resolveApiBaseUrl = (explicit) => getEnv(HCLOUD_ENDPOINT_ENV).pipe(Effect.map((fromEnv) => explicit ?? fromEnv ?? DEFAULT_API_BASE_URL));\n/**\n * Layer that registers the Hetzner {@link AuthProvider} into the\n * {@link AuthProviders} registry. Include this in the Hetzner\n * `providers()` layer so `alchemy login` can discover it.\n *\n * Auth is a Hetzner Cloud API token (`HCLOUD_TOKEN`). The token is\n * issued per project in the Cloud Console — there is no account-wide\n * token. An optional `HCLOUD_ENDPOINT` overrides the API root\n * (default `https://api.hetzner.cloud/v1`).\n */\nexport const HetznerAuth = AuthProviderLayer()(HETZNER_AUTH_PROVIDER_NAME, Effect.gen(function* () {\n const profiles = yield* AlchemyProfile;\n const store = yield* CredentialsStore;\n const loginStored = Effect.fn(function* (profileName) {\n const token = yield* Clank.password({\n message: \"Hetzner Cloud API Token\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const envEndpoint = yield* getEnv(HCLOUD_ENDPOINT_ENV);\n const endpointPrompt = yield* Clank.text({\n message: \"Hetzner API endpoint (Enter for default)\",\n placeholder: DEFAULT_API_BASE_URL,\n defaultValue: envEndpoint ?? DEFAULT_API_BASE_URL,\n }).pipe(retryOnce);\n const trimmed = (endpointPrompt ?? \"\").trim();\n const apiBaseUrl = trimmed.length > 0 && trimmed !== DEFAULT_API_BASE_URL\n ? trimmed\n : undefined;\n yield* store.write(profileName, STORAGE_KEY, {\n type: \"token\",\n token,\n apiBaseUrl,\n });\n yield* Clank.success(\"Hetzner: credentials saved.\");\n return { method: \"stored\" };\n });\n const configureInteractive = (profileName) => Clank.select({\n message: \"Hetzner authentication method\",\n options,\n }).pipe(Effect.flatMap((method) => Match.value(method).pipe(Match.when(\"env\", () => Effect.succeed({ method: \"env\" })), Match.when(\"stored\", () => loginStored(profileName)), Match.exhaustive)));\n const configureCredentials = (profileName, ctx) => Effect.gen(function* () {\n if (ctx.ci) {\n return { method: \"env\" };\n }\n return yield* configureInteractive(profileName);\n }).pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to configure credentials\",\n cause: e,\n })));\n const resolveCredentials = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, Effect.fn(function* () {\n const token = yield* getEnvRedacted(HCLOUD_TOKEN_ENV);\n if (!token) {\n return yield* new AuthError({\n message: `Hetzner env credentials not found. Set ${HCLOUD_TOKEN_ENV}.`,\n });\n }\n const apiBaseUrl = yield* resolveApiBaseUrl();\n return {\n type: \"token\",\n token,\n apiBaseUrl,\n source: { type: \"env\", details: HCLOUD_TOKEN_ENV },\n };\n })), Match.when({ method: \"stored\" }, () => store.read(profileName, STORAGE_KEY).pipe(Effect.flatMap((creds) => creds == null\n ? Effect.fail(new AuthError({\n message: \"Hetzner stored credentials not found. Run: alchemy login --configure\",\n }))\n : resolveApiBaseUrl(creds.apiBaseUrl).pipe(Effect.map((apiBaseUrl) => ({\n type: \"token\",\n token: Redacted.make(creds.token),\n apiBaseUrl,\n source: { type: \"stored\" },\n })))))), Match.exhaustive);\n const logout = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .delete(profileName, STORAGE_KEY)\n .pipe(Effect.andThen(Clank.success(\"Hetzner: stored credentials removed\")))), Match.exhaustive);\n const login = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => \n // If HCLOUD_TOKEN isn't set, fall through to the interactive picker\n // so the user can switch to `stored` (or be told to set the env var)\n // instead of silently failing later in `read`. The new selection is\n // persisted to the profile so subsequent logins don't re-prompt.\n getEnvRedacted(HCLOUD_TOKEN_ENV).pipe(Effect.flatMap((token) => token\n ? Effect.void\n : Effect.gen(function* () {\n const next = yield* configureInteractive(profileName);\n const existing = yield* profiles.getProfile(profileName);\n yield* profiles.setProfile(profileName, {\n ...existing,\n [HETZNER_AUTH_PROVIDER_NAME]: next,\n });\n })))), Match.when({ method: \"stored\" }, () => store\n .read(profileName, STORAGE_KEY)\n .pipe(Effect.flatMap((creds) => creds == null ? loginStored(profileName) : Effect.void))), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })));\n const prettyPrint = (profileName, config) => resolveCredentials(profileName, config).pipe(Effect.tap((creds) => {\n const sourceStr = creds.source.details\n ? `${creds.source.type} - ${creds.source.details}`\n : creds.source.type;\n return Effect.all([\n Console.log(` token: ${displayRedacted(creds.token, 6)}`),\n Console.log(` apiBaseUrl: ${creds.apiBaseUrl}`),\n Console.log(` source: ${sourceStr}`),\n ]);\n }));\n return {\n configure: configureCredentials,\n logout,\n login,\n prettyPrint,\n read: resolveCredentials,\n };\n}));\n//# sourceMappingURL=AuthProvider.js.map","import * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as Match from \"effect/Match\";\nimport * as Redacted from \"effect/Redacted\";\nimport { AuthError, AuthProviderLayer, } from \"../Auth/AuthProvider.js\";\nimport { CredentialsStore, displayRedacted } from \"../Auth/Credentials.js\";\nimport { getEnvRedacted, retryOnce } from \"../Auth/Env.js\";\nimport { AlchemyProfile } from \"../Auth/Profile.js\";\nimport * as Clank from \"../Util/Clank.js\";\nexport const NEON_AUTH_PROVIDER_NAME = \"Neon\";\nconst options = [\n {\n value: \"env\",\n label: \"Environment Variable\",\n hint: \"NEON_API_KEY\",\n },\n {\n value: \"stored\",\n label: \"API Key\",\n hint: \"enter interactively, stored in ~/.alchemy/credentials\",\n },\n];\n/**\n * Layer that registers the Neon {@link AuthProvider} into the\n * {@link AuthProviders} registry.\n */\nexport const NeonAuth = AuthProviderLayer()(NEON_AUTH_PROVIDER_NAME, Effect.gen(function* () {\n const profiles = yield* AlchemyProfile;\n const store = yield* CredentialsStore;\n const loginStored = Effect.fn(function* (profileName) {\n const apiKey = yield* Clank.password({\n message: \"Neon API Key\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n yield* store.write(profileName, \"neon-stored\", {\n type: \"apiKey\",\n apiKey,\n });\n yield* Clank.success(\"Neon: credentials saved.\");\n return { method: \"stored\" };\n });\n const configureInteractive = (profileName) => Clank.select({\n message: \"Neon authentication method\",\n options,\n }).pipe(Effect.flatMap((method) => Match.value(method).pipe(Match.when(\"env\", () => Effect.succeed({ method: \"env\" })), Match.when(\"stored\", () => loginStored(profileName)), Match.exhaustive)));\n const configureCredentials = (profileName, ctx) => Effect.gen(function* () {\n if (ctx.ci) {\n return { method: \"env\" };\n }\n return yield* configureInteractive(profileName);\n }).pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to configure credentials\",\n cause: e,\n })));\n const resolveCredentials = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, Effect.fn(function* () {\n const apiKey = yield* getEnvRedacted(\"NEON_API_KEY\");\n if (!apiKey) {\n return yield* new AuthError({\n message: \"Neon env credentials not found. Set NEON_API_KEY.\",\n });\n }\n return {\n type: \"apiKey\",\n apiKey,\n source: { type: \"env\" },\n };\n })), Match.when({ method: \"stored\" }, () => store.read(profileName, \"neon-stored\").pipe(Effect.flatMap((creds) => creds == null\n ? Effect.fail(new AuthError({\n message: \"Neon stored credentials not found. Run: alchemy login --configure\",\n }))\n : Effect.succeed({\n type: \"apiKey\",\n apiKey: Redacted.make(creds.apiKey),\n source: { type: \"stored\" },\n })))), Match.exhaustive);\n const logout = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .delete(profileName, \"neon-stored\")\n .pipe(Effect.andThen(Clank.success(\"Neon: stored credentials removed\")))), Match.exhaustive);\n const login = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => \n // If NEON_API_KEY isn't set, fall through to the interactive picker\n // so the user can switch to `stored` (or be told to set the env var)\n // instead of silently failing later in `read`. The new selection is\n // persisted to the profile so subsequent logins don't re-prompt.\n getEnvRedacted(\"NEON_API_KEY\").pipe(Effect.flatMap((apiKey) => apiKey\n ? Effect.void\n : Effect.gen(function* () {\n const next = yield* configureInteractive(profileName);\n const existing = yield* profiles.getProfile(profileName);\n yield* profiles.setProfile(profileName, {\n ...existing,\n [NEON_AUTH_PROVIDER_NAME]: next,\n });\n })))), Match.when({ method: \"stored\" }, () => store\n .read(profileName, \"neon-stored\")\n .pipe(Effect.flatMap((creds) => creds == null ? loginStored(profileName) : Effect.void))), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })));\n const prettyPrint = (profileName, config) => resolveCredentials(profileName, config).pipe(Effect.tap((creds) => {\n const sourceStr = creds.source.details\n ? `${creds.source.type} - ${creds.source.details}`\n : creds.source.type;\n return Effect.all([\n Console.log(` apiKey: ${displayRedacted(creds.apiKey, 9)}`),\n Console.log(` source: ${sourceStr}`),\n ]);\n }));\n return {\n configure: configureCredentials,\n logout,\n login,\n prettyPrint,\n read: resolveCredentials,\n };\n}));\n//# sourceMappingURL=AuthProvider.js.map","import * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport crypto from \"node:crypto\";\nimport http from \"node:http\";\nimport { AUTH_ERROR_URL, AUTH_SUCCESS_URL } from \"../Auth/AuthProvider.js\";\nexport class OAuthError extends Data.TaggedError(\"OAuthError\") {\n}\n/**\n * Registered PlanetScale OAuth application credentials.\n *\n * Unlike Cloudflare, PlanetScale OAuth has **no public-client flow** — the\n * token endpoint requires client authentication for every grant (PKCE is\n * advertised in their discovery doc but does not lift that requirement), so\n * exchanging the authorization code (and refreshing the token) requires the\n * application's `client_secret`. There is no way to keep that secret out of\n * a distributed CLI, so it ships here: the exposure is the same posture as a\n * public `client_id` (a stolen refresh token is usable, exactly like\n * Cloudflare's secret-less refresh), and it can be rotated by cutting a new\n * release. PlanetScale's own CLI ships its OAuth `client_secret` in source\n * the same way:\n * https://github.com/planetscale/cli/blob/main/internal/auth/authenticator.go\n *\n * Registered at https://app.planetscale.com with redirect URI\n * {@link OAUTH_REDIRECT_URI}. Scopes are configured on the application\n * itself, not requested per-authorization. Rotate by registering a new\n * secret and cutting a release.\n */\nexport const OAUTH_CLIENT_ID = \"pscale_app_aa12e3938baebb788aac443f66e422da\";\nexport const OAUTH_CLIENT_SECRET = \"pscale_app_secret_yyZ3Q8oe99GP9_yA5wrA5er6RuN6Lz9dC66Bj1OJzpg\";\nexport const OAUTH_REDIRECT_URI = \"https://alchemy.run/auth/callback\";\nexport const OAUTH_LOCAL_CALLBACK_URI = \"http://localhost:9976/auth/callback\";\nexport const OAUTH_ENDPOINTS = {\n // PlanetScale's own .well-known OAuth discovery doc declares this as\n // the authorization_endpoint — NOT auth.planetscale.com/oauth/authorize\n // (which their public docs cite). The auth.planetscale.com alias does\n // render a consent screen but emits codes whose resulting tokens lack\n // a `sub` claim, so the resource API at api.planetscale.com rejects\n // them as invalid. Use the canonical endpoint.\n authorize: \"https://app.planetscale.com/oauth/authorize\",\n token: \"https://auth.planetscale.com/oauth/token\",\n};\nfunction generateState(length = 32) {\n return Buffer.from(crypto.randomBytes(length)).toString(\"base64url\");\n}\nfunction extractCredentials(json) {\n return {\n type: \"oauth\",\n access: json.access_token,\n refresh: json.refresh_token,\n expires: Date.now() + json.expires_in * 1000,\n scopes: json.scope ? json.scope.split(\" \") : [],\n };\n}\nconst tokenRequest = (params) => Effect.gen(function* () {\n // PlanetScale's docs show the token endpoint with all parameters in\n // the query string (https://planetscale.com/docs/api/reference/oauth).\n // Their .well-known discovery doc advertises client_secret_basic /\n // client_secret_post instead, but both behave identically to the\n // query-string form in practice, so we follow the public docs\n // literally.\n const url = new URL(OAUTH_ENDPOINTS.token);\n for (const [k, v] of Object.entries(params)) {\n url.searchParams.set(k, v);\n }\n const res = yield* Effect.tryPromise({\n try: () => fetch(url.toString(), {\n method: \"POST\",\n headers: { Accept: \"application/json\" },\n }),\n catch: (err) => new OAuthError({\n error: \"network_error\",\n errorDescription: `Token request failed: ${err}`,\n }),\n });\n if (!res.ok) {\n const json = yield* Effect.tryPromise({\n try: () => res.json(),\n catch: () => new OAuthError({\n error: \"parse_error\",\n errorDescription: `Token endpoint returned ${res.status}`,\n }),\n });\n return yield* new OAuthError({\n error: json.error,\n errorDescription: json.error_description,\n });\n }\n const json = yield* Effect.tryPromise({\n try: () => res.json(),\n catch: () => new OAuthError({\n error: \"parse_error\",\n errorDescription: \"Failed to parse token response\",\n }),\n });\n return extractCredentials(json);\n});\n/**\n * Generate a PlanetScale authorization URL.\n *\n * No `scope` parameter is sent: PlanetScale scopes are configured on the\n * OAuth application itself, not requested per-authorization, so the\n * consent screen shows whatever the app is registered with.\n */\nexport function authorize() {\n const state = generateState();\n const url = new URL(OAUTH_ENDPOINTS.authorize);\n url.searchParams.set(\"client_id\", OAUTH_CLIENT_ID);\n url.searchParams.set(\"redirect_uri\", OAUTH_REDIRECT_URI);\n url.searchParams.set(\"response_type\", \"code\");\n url.searchParams.set(\"state\", state);\n return { url: url.toString(), state };\n}\n/**\n * Exchange an authorization code for OAuth credentials.\n */\nexport const exchange = (code) => tokenRequest({\n grant_type: \"authorization_code\",\n code,\n client_id: OAUTH_CLIENT_ID,\n client_secret: OAUTH_CLIENT_SECRET,\n redirect_uri: OAUTH_REDIRECT_URI,\n});\n/**\n * Refresh expired OAuth credentials.\n */\nexport const refresh = (credentials) => tokenRequest({\n grant_type: \"refresh_token\",\n refresh_token: credentials.refresh,\n client_id: OAUTH_CLIENT_ID,\n client_secret: OAUTH_CLIENT_SECRET,\n});\n/**\n * Exchange a code copied from the hosted relay page, or extract the code from\n * either the hosted or loopback callback URL.\n */\nexport const exchangeCallbackInput = (input, authorization) => Effect.gen(function* () {\n const value = input.trim();\n let code = value;\n let state = null;\n try {\n const url = new URL(value);\n code = url.searchParams.get(\"code\") ?? \"\";\n state = url.searchParams.get(\"state\");\n }\n catch {\n const separator = value.lastIndexOf(\"#\");\n if (separator >= 0) {\n code = value.slice(0, separator);\n state = value.slice(separator + 1);\n }\n }\n if (!code) {\n return yield* new OAuthError({\n error: \"invalid_request\",\n errorDescription: \"The authorization code is missing.\",\n });\n }\n if (state !== null && state !== authorization.state) {\n return yield* new OAuthError({\n error: \"invalid_request\",\n errorDescription: \"The authorization state does not match.\",\n });\n }\n return yield* exchange(code);\n});\n/**\n * Start a local HTTP server to listen for the OAuth callback, exchange\n * the authorization code, and return the credentials.\n *\n * Times out after 5 minutes.\n */\nexport const callback = (authorization) => Effect.tryPromise({\n try: (signal) => callbackPromise(authorization, signal),\n catch: (err) => {\n if (err instanceof OAuthError)\n return err;\n return new OAuthError({\n error: \"callback_error\",\n errorDescription: `OAuth callback failed: ${err}`,\n });\n },\n});\nfunction callbackPromise(authorization, signal) {\n const { pathname, port } = new URL(OAUTH_LOCAL_CALLBACK_URI);\n return new Promise((resolve, reject) => {\n const server = http.createServer(async (req, res) => {\n const url = new URL(req.url ?? \"/\", `http://${req.headers.host}`);\n if (url.pathname === \"/auth/ping\") {\n res.writeHead(req.method === \"OPTIONS\" ? 204 : 200, {\n \"Access-Control-Allow-Origin\": new URL(OAUTH_REDIRECT_URI).origin,\n \"Access-Control-Allow-Methods\": \"GET, OPTIONS\",\n \"Access-Control-Allow-Private-Network\": \"true\",\n \"Cache-Control\": \"no-store\",\n });\n res.end();\n return;\n }\n if (url.pathname !== pathname) {\n res.statusCode = 404;\n res.end(\"Not Found\");\n return;\n }\n const error = url.searchParams.get(\"error\");\n const errorDescription = url.searchParams.get(\"error_description\");\n if (error) {\n res.writeHead(302, { Location: AUTH_ERROR_URL });\n res.end();\n cleanup();\n reject(new OAuthError({\n error,\n errorDescription: errorDescription ?? \"An unknown error occurred.\",\n }));\n return;\n }\n const code = url.searchParams.get(\"code\");\n const state = url.searchParams.get(\"state\");\n if (!code || !state) {\n res.writeHead(302, { Location: AUTH_ERROR_URL });\n res.end();\n cleanup();\n reject(new OAuthError({\n error: \"invalid_request\",\n errorDescription: \"Missing code or state\",\n }));\n return;\n }\n if (state !== authorization.state) {\n res.writeHead(302, { Location: AUTH_ERROR_URL });\n res.end();\n cleanup();\n reject(new OAuthError({\n error: \"invalid_request\",\n errorDescription: \"Invalid state\",\n }));\n return;\n }\n try {\n const credentials = await Effect.runPromise(exchange(code));\n res.writeHead(302, { Location: AUTH_SUCCESS_URL });\n res.end();\n cleanup();\n resolve(credentials);\n }\n catch (err) {\n res.writeHead(302, { Location: AUTH_ERROR_URL });\n res.end();\n cleanup();\n reject(err);\n }\n });\n const timeout = setTimeout(() => {\n cleanup();\n reject(new OAuthError({\n error: \"timeout\",\n errorDescription: \"The authorization process timed out.\",\n }));\n }, 5 * 60 * 1000);\n function cleanup() {\n clearTimeout(timeout);\n signal.removeEventListener(\"abort\", cleanup);\n server.close();\n }\n signal.addEventListener(\"abort\", cleanup, { once: true });\n server.on(\"error\", (err) => {\n cleanup();\n reject(new OAuthError({\n error: \"server_error\",\n errorDescription: `Failed to start callback server: ${err.message}`,\n }));\n });\n server.listen(Number(port));\n });\n}\n//# sourceMappingURL=OAuthClient.js.map","import { listOrganizations } from \"@distilled.cloud/planetscale\";\nimport * as PsCredentialsModule from \"@distilled.cloud/planetscale/Credentials\";\nimport * as Console from \"effect/Console\";\nimport * as Duration from \"effect/Duration\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Match from \"effect/Match\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as FetchHttpClient from \"effect/unstable/http/FetchHttpClient\";\nimport * as HttpClient from \"effect/unstable/http/HttpClient\";\nimport { AuthError, AuthProviderLayer, } from \"../Auth/AuthProvider.js\";\nimport { CredentialsStore, displayRedacted } from \"../Auth/Credentials.js\";\nimport { getEnvRedactedRequired, getEnvRequired, retryOnce, } from \"../Auth/Env.js\";\nimport * as Clank from \"../Util/Clank.js\";\nimport * as OAuthClient from \"./OAuthClient.js\";\n/**\n * Canonical name registered in {@link AuthProviders}. Use this key to look\n * up the PlanetScale {@link AuthProvider} from inside provider Layers.\n */\nexport const PLANETSCALE_AUTH_PROVIDER_NAME = \"Planetscale\";\n/**\n * Provide PlanetScale `Credentials` + `HttpClient` to an Effect using a\n * just-obtained OAuth access token. Used during configure to call\n * org-discovery endpoints before the user has chosen an org.\n *\n * `organization` is required by the credential type but isn't consulted by\n * `listOrganizations` (it's a user-scoped endpoint), so an empty string is\n * fine here.\n */\nconst withOAuthCredentials = (accessToken, effect) => Effect.provide(effect, Layer.mergeAll(PsCredentialsModule.fromOAuth({\n accessToken,\n organization: \"\",\n}), FetchHttpClient.layer));\n/**\n * List the organizations the OAuth user belongs to and either auto-pick\n * (one org) or prompt the user to choose. Returns the org's URL slug\n * (`name` field, used as `{organization}` in API paths).\n */\nconst selectOrganization = (accessToken) => Effect.gen(function* () {\n const list = yield* listOrganizations;\n const response = yield* list({});\n const orgs = response.data;\n if (orgs.length === 0) {\n return yield* new AuthError({\n message: \"Planetscale: no organizations found for this credential.\",\n });\n }\n if (orgs.length === 1) {\n const org = orgs[0];\n yield* Clank.info(`Planetscale: using organization: ${org.name} (${org.id})`);\n return org.name;\n }\n return yield* Clank.select({\n message: \"Select a Planetscale organization\",\n options: orgs.map((o) => ({\n value: o.name,\n label: o.name,\n hint: o.id,\n })),\n }).pipe(retryOnce);\n}).pipe((e) => withOAuthCredentials(accessToken, e));\nconst options = [\n {\n value: \"env\",\n label: \"Environment Variables\",\n hint: \"PLANETSCALE_API_TOKEN_ID + PLANETSCALE_API_TOKEN + PLANETSCALE_ORGANIZATION\",\n },\n {\n value: \"oauth\",\n label: \"OAuth\",\n hint: \"recommended — browser-based login with automatic token refresh\",\n },\n {\n value: \"stored\",\n label: \"Service Token\",\n hint: \"enter service token interactively, stored in ~/.alchemy/credentials\",\n },\n];\n/**\n * Layer that registers the PlanetScale {@link AuthProvider} into the\n * {@link AuthProviders} registry when built. Include this in the\n * PlanetScale `providers()` layer so `alchemy login` can discover it.\n *\n * Supported methods:\n * - `env`: reads `PLANETSCALE_API_TOKEN_ID`/`PLANETSCALE_API_TOKEN`/`PLANETSCALE_ORGANIZATION`.\n * - `stored`: prompts for a service token interactively and writes it to\n * `~/.alchemy/credentials/<profile>/planetscale-stored.json`.\n * - `oauth`: browser-based login storing access/refresh tokens at\n * `~/.alchemy/credentials/<profile>/planetscale-oauth.json`.\n */\nexport const PlanetscaleAuth = AuthProviderLayer()(PLANETSCALE_AUTH_PROVIDER_NAME, Effect.gen(function* () {\n const store = yield* CredentialsStore;\n const oauthLogin = (profileName) => Effect.gen(function* () {\n const authorization = OAuthClient.authorize();\n yield* Clank.info(\"Planetscale: opening browser for OAuth login...\");\n yield* Clank.info(authorization.url);\n yield* Clank.openUrl(authorization.url).pipe(Effect.catch(() => Clank.warn(\"Planetscale: could not open browser automatically. Please open the URL above manually.\")));\n yield* Clank.info(\"Planetscale: waiting for authorization (up to 5 minutes).\");\n const credentials = yield* Effect.raceFirst(OAuthClient.callback(authorization), Clank.text({\n message: \"Paste the authorization code or callback URL\",\n placeholder: \"The browser will complete this automatically when local\",\n validate: (value) => value.trim().length > 0 ? undefined : \"Paste a code or URL\",\n }).pipe(Effect.flatMap((input) => OAuthClient.exchangeCallbackInput(input, authorization))));\n yield* store.write(profileName, \"planetscale-oauth\", credentials);\n yield* Clank.success(\"Planetscale: OAuth credentials saved.\");\n return credentials;\n });\n const configureOAuth = Effect.fn(function* (profileName) {\n const oauthCreds = yield* oauthLogin(profileName);\n // Use the just-issued access token to list the user's orgs and let\n // them pick (mirrors Cloudflare's selectAccount). Requires the\n // `user:read_organizations` scope. If the call fails for any\n // reason — missing scope, network, off-spec response — fall back\n // to a manual prompt so login still completes.\n const organization = yield* selectOrganization(oauthCreds.access).pipe(Effect.catch((e) => Effect.gen(function* () {\n yield* Clank.warn(`Planetscale: could not auto-list organizations (${String(e)}). Falling back to manual entry.`);\n return yield* Clank.text({\n message: \"Planetscale Organization (URL slug)\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n })));\n return { method: \"oauth\", organization };\n });\n const loginStored = Effect.fn(function* (profileName) {\n const tokenId = yield* Clank.text({\n message: \"Planetscale Service Token ID\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const token = yield* Clank.password({\n message: \"Planetscale Service Token\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const organization = yield* Clank.text({\n message: \"Planetscale Organization (URL slug)\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n yield* store.write(profileName, \"planetscale-stored\", {\n type: \"apiToken\",\n tokenId,\n token,\n organization,\n });\n yield* Clank.success(\"Planetscale: credentials saved.\");\n return { method: \"stored\" };\n });\n const configureInteractive = (profileName) => Clank.select({\n message: \"Planetscale authentication method\",\n options,\n }).pipe(Effect.flatMap((method) => Match.value(method).pipe(Match.when(\"env\", () => Effect.succeed({ method: \"env\" })), Match.when(\"oauth\", () => configureOAuth(profileName)), Match.when(\"stored\", () => loginStored(profileName)), Match.exhaustive)));\n const configureCredentials = (profileName, ctx) => Effect.gen(function* () {\n if (ctx.ci) {\n return { method: \"env\" };\n }\n return yield* configureInteractive(profileName);\n }).pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to configure credentials\",\n cause: e,\n })));\n const resolveCredentials = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, Effect.fn(function* () {\n const tokenId = yield* getEnvRedactedRequired(\"PLANETSCALE_API_TOKEN_ID\");\n const token = yield* getEnvRedactedRequired(\"PLANETSCALE_API_TOKEN\");\n const organization = yield* getEnvRequired(\"PLANETSCALE_ORGANIZATION\");\n return {\n type: \"apiToken\",\n tokenId,\n token,\n organization,\n source: {\n type: \"env\",\n details: \"PLANETSCALE_API_TOKEN_ID/PLANETSCALE_API_TOKEN\",\n },\n };\n })), Match.when({ method: \"stored\" }, () => store\n .read(profileName, \"planetscale-stored\")\n .pipe(Effect.flatMap((creds) => creds == null\n ? Effect.fail(new AuthError({\n message: \"Planetscale stored credentials not found. Run: alchemy login --configure\",\n }))\n : Effect.succeed({\n type: \"apiToken\",\n tokenId: Redacted.make(creds.tokenId),\n token: Redacted.make(creds.token),\n organization: creds.organization,\n source: {\n type: \"stored\",\n details: undefined,\n },\n })))), Match.when({ method: \"oauth\" }, (cfg) => Effect.gen(function* () {\n const creds = yield* store.read(profileName, \"planetscale-oauth\");\n if (creds == null || creds.type !== \"oauth\") {\n return yield* Effect.fail(new AuthError({\n message: \"Planetscale OAuth credentials not found. Run: alchemy login\",\n }));\n }\n // Refresh proactively if the token has expired (or is within\n // 10s of expiring). Persist the refreshed creds so subsequent\n // resolves don't repeat the round-trip.\n const fresh = creds.expires > Date.now() + 10_000\n ? creds\n : yield* OAuthClient.refresh(creds).pipe(Effect.tap((refreshed) => store.write(profileName, \"planetscale-oauth\", refreshed)), Effect.mapError((e) => new AuthError({\n message: \"Planetscale OAuth refresh failed. Run: alchemy login\",\n cause: e,\n })));\n return {\n type: \"oauth\",\n accessToken: Redacted.make(fresh.access),\n expires: fresh.expires,\n organization: cfg.organization,\n source: { type: \"oauth\" },\n };\n })), Match.exhaustive);\n const logout = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .delete(profileName, \"planetscale-stored\")\n .pipe(Effect.andThen(Clank.success(\"Planetscale: stored credentials removed\")))), \n // PlanetScale publishes no token-revocation endpoint, so logout just\n // drops the locally stored tokens.\n Match.when({ method: \"oauth\" }, () => store\n .delete(profileName, \"planetscale-oauth\")\n .pipe(Effect.andThen(Clank.success(\"Planetscale: OAuth credentials removed.\")))), Match.exhaustive);\n const login = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .read(profileName, \"planetscale-stored\")\n .pipe(Effect.flatMap((creds) => creds == null ? loginStored(profileName) : Effect.void))), Match.when({ method: \"oauth\" }, (c) => Effect.gen(function* () {\n const creds = yield* store.read(profileName, \"planetscale-oauth\");\n if (creds?.type === \"oauth\") {\n yield* Clank.info(\"Planetscale: refreshing OAuth credentials...\");\n yield* OAuthClient.refresh(creds).pipe(Effect.flatMap((refreshed) => store\n .write(profileName, \"planetscale-oauth\", refreshed)\n .pipe(Effect.andThen(Clank.success(\"Planetscale: OAuth credentials refreshed.\")))), Effect.catchTag(\"OAuthError\", () => oauthLogin(profileName).pipe(Effect.asVoid)));\n return;\n }\n yield* oauthLogin(profileName);\n })), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })));\n const prettyPrint = (profileName, config) => resolveCredentials(profileName, config).pipe(Effect.tap((creds) => {\n const sourceStr = creds.source.details\n ? `${creds.source.type} - ${creds.source.details}`\n : creds.source.type;\n return Match.value(creds).pipe(Match.when({ type: \"apiToken\" }, (c) => Effect.all([\n Console.log(` tokenId: ${displayRedacted(c.tokenId, 3)}`),\n Console.log(` token: ${displayRedacted(c.token, 6)}`),\n Console.log(` organization: ${c.organization}`),\n Console.log(` source: ${sourceStr}`),\n ])), Match.when({ type: \"oauth\" }, (c) => {\n const remainingMs = c.expires - Date.now();\n const expiresAt = new Date(c.expires).toISOString();\n const expiresStr = remainingMs <= 0\n ? `expired (${expiresAt})`\n : `in ${Duration.format(Duration.millis(remainingMs))} (${expiresAt})`;\n return Effect.all([\n Console.log(` accessToken: ${displayRedacted(c.accessToken)}`),\n Console.log(` expires: ${expiresStr}`),\n Console.log(` organization: ${c.organization}`),\n Console.log(` source: ${sourceStr}`),\n ]);\n }), Match.exhaustive);\n }));\n return {\n configure: configureCredentials,\n logout,\n login,\n prettyPrint,\n read: resolveCredentials,\n };\n}));\n//# sourceMappingURL=AuthProvider.js.map","import * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as Match from \"effect/Match\";\nimport * as Redacted from \"effect/Redacted\";\nimport { AuthError, AuthProviderLayer, } from \"../Auth/AuthProvider.js\";\nimport { CredentialsStore, displayRedacted } from \"../Auth/Credentials.js\";\nimport { getEnvRedacted, retryOnce } from \"../Auth/Env.js\";\nimport { AlchemyProfile } from \"../Auth/Profile.js\";\nimport * as Clank from \"../Util/Clank.js\";\nexport const PRISMA_AUTH_PROVIDER_NAME = \"Prisma\";\nexport const PRISMA_SERVICE_TOKEN_ENV = \"PRISMA_SERVICE_TOKEN\";\nexport const PRISMA_API_TOKEN_ENV = \"PRISMA_API_TOKEN\";\nconst options = [\n {\n value: \"env\",\n label: \"Environment Variable\",\n hint: `${PRISMA_SERVICE_TOKEN_ENV} or ${PRISMA_API_TOKEN_ENV}`,\n },\n {\n value: \"stored\",\n label: \"Service Token\",\n hint: \"enter interactively, stored in ~/.alchemy/credentials\",\n },\n];\nconst nonEmptyToken = (token) => token !== undefined && Redacted.value(token).trim().length > 0;\nconst validStoredCredentials = (credentials) => credentials?.type === \"serviceToken\" &&\n credentials.serviceToken.trim().length > 0;\nconst trimToken = (token) => Redacted.make(Redacted.value(token).trim());\nconst readEnvServiceToken = Effect.fnUntraced(function* () {\n const serviceToken = yield* getEnvRedacted(PRISMA_SERVICE_TOKEN_ENV);\n if (nonEmptyToken(serviceToken)) {\n return {\n serviceToken: trimToken(serviceToken),\n envName: PRISMA_SERVICE_TOKEN_ENV,\n };\n }\n const apiToken = yield* getEnvRedacted(PRISMA_API_TOKEN_ENV);\n if (nonEmptyToken(apiToken)) {\n return {\n serviceToken: trimToken(apiToken),\n envName: PRISMA_API_TOKEN_ENV,\n };\n }\n return undefined;\n});\n/**\n * Layer that registers the Prisma Management API auth provider.\n */\nexport const PrismaAuth = AuthProviderLayer()(PRISMA_AUTH_PROVIDER_NAME, Effect.gen(function* () {\n const profiles = yield* AlchemyProfile;\n const store = yield* CredentialsStore;\n const loginStored = Effect.fnUntraced(function* (profileName) {\n const serviceToken = yield* Clank.password({\n message: \"Prisma Service Token\",\n validate: (v) => (v.trim().length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n yield* store.write(profileName, \"prisma-stored\", {\n type: \"serviceToken\",\n serviceToken: serviceToken.trim(),\n });\n yield* Clank.success(\"Prisma: credentials saved.\");\n return { method: \"stored\" };\n });\n const configureInteractive = (profileName) => Clank.select({\n message: \"Prisma authentication method\",\n options,\n }).pipe(Effect.flatMap((method) => Match.value(method).pipe(Match.when(\"env\", () => Effect.succeed({ method: \"env\" })), Match.when(\"stored\", () => loginStored(profileName)), Match.exhaustive)));\n const configure = (profileName, ctx) => Effect.gen(function* () {\n if (ctx.ci)\n return { method: \"env\" };\n return yield* configureInteractive(profileName);\n }).pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to configure credentials\",\n cause: e,\n })));\n const read = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, Effect.fnUntraced(function* () {\n const envToken = yield* readEnvServiceToken();\n if (!envToken) {\n return yield* new AuthError({\n message: `Prisma env credentials not found. Set ${PRISMA_SERVICE_TOKEN_ENV} or ${PRISMA_API_TOKEN_ENV}.`,\n });\n }\n return {\n type: \"serviceToken\",\n serviceToken: envToken.serviceToken,\n source: { type: \"env\", details: envToken.envName },\n };\n })), Match.when({ method: \"stored\" }, () => store\n .read(profileName, \"prisma-stored\")\n .pipe(Effect.flatMap((creds) => !validStoredCredentials(creds)\n ? Effect.fail(new AuthError({\n message: creds == null\n ? \"Prisma stored credentials not found. Run: alchemy login --configure\"\n : \"Prisma stored credentials are invalid. Run: alchemy login --configure\",\n }))\n : Effect.succeed({\n type: \"serviceToken\",\n serviceToken: Redacted.make(creds.serviceToken.trim()),\n source: { type: \"stored\" },\n })))), Match.exhaustive);\n const login = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => readEnvServiceToken().pipe(Effect.flatMap((envToken) => envToken\n ? Effect.void\n : Effect.gen(function* () {\n const next = yield* configureInteractive(profileName);\n const existing = yield* profiles.getProfile(profileName);\n yield* profiles.setProfile(profileName, {\n ...existing,\n [PRISMA_AUTH_PROVIDER_NAME]: next,\n });\n })))), Match.when({ method: \"stored\" }, () => store\n .read(profileName, \"prisma-stored\")\n .pipe(Effect.flatMap((creds) => validStoredCredentials(creds)\n ? Effect.void\n : loginStored(profileName)))), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })));\n const logout = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .delete(profileName, \"prisma-stored\")\n .pipe(Effect.andThen(Clank.success(\"Prisma: stored credentials removed\")))), Match.exhaustive);\n const prettyPrint = (profileName, config) => read(profileName, config).pipe(Effect.tap((creds) => {\n const source = creds.source.details\n ? `${creds.source.type} - ${creds.source.details}`\n : creds.source.type;\n return Effect.all([\n Console.log(` serviceToken: ${displayRedacted(creds.serviceToken, 9)}`),\n Console.log(` source: ${source}`),\n ]);\n }), Effect.catch((e) => Console.error(` Failed to retrieve credentials: ${e}`)));\n return { configure, login, logout, prettyPrint, read };\n}));\n//# sourceMappingURL=AuthProvider.js.map","var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\n });\n }\n return path;\n};\nimport * as Cause from \"effect/Cause\";\nimport * as Config from \"effect/Config\";\nimport * as ConfigProvider from \"effect/ConfigProvider\";\nimport * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Logger from \"effect/Logger\";\nimport * as Option from \"effect/Option\";\nimport * as Path from \"effect/Path\";\nimport * as S from \"effect/Schema\";\nimport * as Argument from \"effect/unstable/cli/Argument\";\nimport * as CliError from \"effect/unstable/cli/CliError\";\nimport * as Flag from \"effect/unstable/cli/Flag\";\nimport { pathToFileURL } from \"node:url\";\nimport { AuthError, AuthProviders, } from \"../../Auth/AuthProvider.js\";\nimport { ALCHEMY_PROFILE, withProfileOverride, } from \"../../Auth/Profile.js\";\nimport { AwsAuth } from \"../../AWS/AuthProvider.js\";\nimport { AxiomAuth } from \"../../Axiom/AuthProvider.js\";\nimport { CloudflareAuth } from \"../../Cloudflare/Auth/AuthProvider.js\";\nimport { GitHubAuth } from \"../../GitHub/AuthProvider.js\";\nimport { HetznerAuth } from \"../../Hetzner/AuthProvider.js\";\nimport { NeonAuth } from \"../../Neon/AuthProvider.js\";\nimport { PlanetscaleAuth } from \"../../Planetscale/AuthProvider.js\";\nimport { PrismaAuth } from \"../../Prisma/AuthProvider.js\";\nimport * as Stack from \"../../Stack.js\";\nimport { Stage } from \"../../Stage.js\";\nimport { recordCli } from \"../../Telemetry/Metrics.js\";\nimport { PromptCancelled } from \"../../Util/Clank.js\";\nimport { loadConfigProvider } from \"../../Util/ConfigProvider.js\";\nimport { fileLogger } from \"../../Util/FileLogger.js\";\nexport const USER = Config.string(\"USER\").pipe(Config.orElse(() => Config.string(\"USERNAME\")), Config.withDefault(\"unknown\"));\nexport const STAGE = Config.string(\"STAGE\").pipe(Config.option, (a) => a, Effect.map(Option.getOrUndefined));\n/**\n * `true` if `e` is a {@link PromptCancelled}, or an {@link AuthError} whose\n * `cause` chain bottoms out in one. Schema-tagged errors don't always\n * survive `instanceof` across module boundaries, so we also accept any\n * object whose `_tag` matches.\n */\nconst isPromptCancellation = (e) => {\n for (let cur = e, i = 0; cur != null && i < 16; i++) {\n if (cur instanceof PromptCancelled)\n return true;\n if (typeof cur === \"object\" &&\n cur._tag === \"PromptCancelled\") {\n return true;\n }\n if (cur instanceof AuthError ||\n (typeof cur === \"object\" &&\n cur._tag === \"AuthError\")) {\n cur = cur.cause;\n continue;\n }\n return false;\n }\n return false;\n};\n/**\n * Catches user cancellations (Ctrl+C inside a prompt, surfaced as\n * {@link PromptCancelled} or wrapped in an {@link AuthError}) and exits\n * the CLI cleanly with a friendly message instead of dumping a stack\n * trace.\n */\nexport const handleCancellation = (self) => self.pipe(Effect.catchCause((cause) => {\n const cancelled = cause.reasons.some((r) => {\n if (Cause.isFailReason(r))\n return isPromptCancellation(r.error);\n if (Cause.isDieReason(r))\n return isPromptCancellation(r.defect);\n return false;\n });\n return cancelled\n ? Console.log(\"\\nCancelled.\")\n : Effect.failCause(cause);\n}), \n// A bare fiber interrupt (Ctrl+C while not inside a prompt) shouldn't\n// dump a stack trace either.\nEffect.onInterrupt(() => Console.log(\"\\nInterrupted.\")));\nexport const stage = Flag.string(\"stage\").pipe(Flag.withSchema(S.String.check(S.isPattern(/^[a-z0-9]+([-_a-z0-9]+)*$/gi))), Flag.withDescription(\"Stage to deploy to, defaults to dev_${USER}\"), Flag.optional, Flag.map(Option.getOrUndefined), Flag.mapEffect(Effect.fn(function* (stage) {\n if (stage) {\n return stage;\n }\n return yield* STAGE.pipe(Effect.catch(() => Effect.fail(new CliError.MissingOption({\n option: \"stage\",\n }))), Effect.flatMap((s) => s === undefined\n ? USER.pipe(Effect.map((user) => `dev_${user}`), Effect.catch(() => Effect.succeed(\"unknown\")))\n : Effect.succeed(s)));\n})));\nexport const envFile = Flag.file(\"env-file\").pipe(Flag.optional, Flag.withDescription(\"File to load environment variables from, defaults to .env\"));\nexport const dryRun = Flag.boolean(\"dry-run\").pipe(Flag.withDescription(\"Dry run the deployment, do not actually deploy\"), Flag.withDefault(false));\nexport const yes = Flag.boolean(\"yes\").pipe(Flag.withDescription(\"Yes to all prompts\"), Flag.withDefault(false));\nexport const force = Flag.boolean(\"force\").pipe(Flag.withDescription(\"Force updates for resources that would otherwise no-op\"), Flag.withDefault(false));\nexport const script = Argument.file(\"main\", {\n mustExist: true,\n}).pipe(Argument.withDescription(\"Main file to deploy, defaults to alchemy.run.ts\"), Argument.withDefault(\"alchemy.run.ts\"));\nexport const profile = Flag.string(\"profile\").pipe(Flag.withDescription(\"Auth profile to use (~/.alchemy/profiles.json). Defaults to $ALCHEMY_PROFILE or 'default'.\"), Flag.optional, Flag.mapEffect(Effect.fn(function* (profile) {\n // --profile wins; otherwise fall back to $ALCHEMY_PROFILE (which\n // itself defaults to \"default\"). Without this, the flag's default\n // would shadow the env var via withProfileOverride.\n if (Option.isSome(profile)) {\n return profile.value;\n }\n return yield* ALCHEMY_PROFILE.pipe(Effect.catch(() => Effect.succeed(\"default\")));\n})));\nexport const resourceFilter = Flag.string(\"filter\").pipe(Flag.withDescription(\"Comma-separated logical resource IDs (e.g. Api,Sandbox). Only those resources are included.\"), Flag.optional, Flag.map(Option.getOrUndefined));\nexport const TAIL_COLORS = [\n \"\\x1b[36m\", // cyan\n \"\\x1b[35m\", // magenta\n \"\\x1b[33m\", // yellow\n \"\\x1b[32m\", // green\n \"\\x1b[34m\", // blue\n \"\\x1b[91m\", // bright red\n \"\\x1b[96m\", // bright cyan\n \"\\x1b[95m\", // bright magenta\n \"\\x1b[93m\", // bright yellow\n \"\\x1b[92m\", // bright green\n];\nexport const TAIL_RESET = \"\\x1b[0m\";\nexport const formatLocalTimestamp = (date) => {\n const y = date.getFullYear();\n const mo = String(date.getMonth() + 1).padStart(2, \"0\");\n const d = String(date.getDate()).padStart(2, \"0\");\n const h = String(date.getHours()).padStart(2, \"0\");\n const mi = String(date.getMinutes()).padStart(2, \"0\");\n const s = String(date.getSeconds()).padStart(2, \"0\");\n const ms = String(date.getMilliseconds()).padStart(3, \"0\");\n const tz = new Intl.DateTimeFormat(\"en-US\", { timeZoneName: \"short\" })\n .formatToParts(date)\n .find((p) => p.type === \"timeZoneName\")?.value ?? \"\";\n return `${y}-${mo}-${d} ${h}:${mi}:${s}.${ms} ${tz}`;\n};\nexport const parseResourceFilter = (filter) => {\n if (filter === undefined)\n return undefined;\n const ids = filter\n .split(\",\")\n .map((s) => s.trim())\n .filter((s) => s.length > 0);\n if (ids.length === 0)\n return undefined;\n return new Set(ids);\n};\nexport const parseSince = (value) => {\n const match = value.match(/^(\\d+)([smhd])$/);\n if (match) {\n const num = parseInt(match[1], 10);\n const unit = match[2];\n const ms = unit === \"s\"\n ? num * 1000\n : unit === \"m\"\n ? num * 60_000\n : unit === \"h\"\n ? num * 3_600_000\n : num * 86_400_000;\n return new Date(Date.now() - ms);\n }\n const parsed = new Date(value);\n if (isNaN(parsed.getTime())) {\n throw new Error(`Invalid --since value: '${value}'. Use a duration (e.g. '1h', '30m') or ISO date.`);\n }\n return parsed;\n};\n/**\n * Wraps a CLI command handler with a top-level OpenTelemetry span\n * (`cli.<command>`) and bumps the `alchemy.cli.invocations` counter.\n *\n * `attrs` runs against the parsed command args and contributes\n * additional attributes to the span (e.g. stage, profile, dry-run flag).\n *\n * Usage:\n * ```ts\n * Command.make(\n * \"deploy\",\n * { ...flags },\n * instrumentCommand(\"deploy\", (a) => ({\n * \"alchemy.stage\": a.stage,\n * \"alchemy.profile\": a.profile,\n * }))(execStack),\n * );\n * ```\n */\nexport const instrumentCommand = (command, attrs) => (handler) => (args) => handler(args).pipe(Effect.withSpan(`cli.${command}`, {\n attributes: attrs ? attrs(args) : {},\n}), recordCli(command));\n/**\n * Render a profile's stored credential entries the same way across\n * `alchemy login` and `alchemy profile show`: one `── Provider ──`\n * header per entry, then either the provider's own `prettyPrint` block\n * (preferred) or a JSON-style fallback when the provider isn't\n * registered in the supplied {@link AuthProviders} registry.\n */\nexport const printProfile = Effect.fn(function* (profile, stored, registry) {\n yield* Console.log(`Profile: ${profile}`);\n const names = Object.keys(stored).sort();\n if (names.length === 0) {\n yield* Console.log(\"(no providers configured)\");\n return;\n }\n for (const name of names) {\n const cfg = stored[name];\n yield* Console.log(\"\");\n yield* Console.log(`── ${name} ──`);\n const provider = registry[name];\n if (provider == null) {\n yield* Console.log(` method: ${cfg.method}`);\n const { method: _method, ...rest } = cfg;\n for (const [k, v] of Object.entries(rest)) {\n yield* Console.log(` ${k}: ${typeof v === \"string\" ? v : JSON.stringify(v)}`);\n }\n continue;\n }\n // A provider's `prettyPrint` catches its own credential-resolution\n // failures, but some resolve paths `Effect.orDie` (e.g. AWS SSO with an\n // expired token), which escapes as a defect. Contain it here — via\n // `Console.log` so the message stays on stdout under this provider's\n // header instead of interleaving on stderr — so one broken provider\n // can't abort rendering the rest of the profile.\n yield* provider.prettyPrint(profile, cfg).pipe(Effect.catchCause((cause) => {\n const error = Cause.squash(cause);\n const message = error instanceof Error ? error.message : String(error);\n return Console.log(` Failed to retrieve credentials: ${message}`);\n }));\n }\n});\nexport const importStack = Effect.fn(function* (main) {\n const path = yield* Path.Path;\n // Build a `file://` URL from the absolute path. `import.meta.resolve` expects a\n // module specifier / URL, not a raw filesystem path: on Windows an absolute\n // path like `D:\\stack.ts` is not a valid specifier and fails to resolve, so the\n // CLI cannot load the user's stack. `pathToFileURL` produces a valid URL on\n // every platform.\n const url = pathToFileURL(path.resolve(main)).href;\n const module = yield* Effect.promise(() => import(__rewriteRelativeImportExtension(url)));\n const stackEffect = module.default;\n if (!Effect.isEffect(stackEffect)) {\n return yield* Effect.die(new Error(`Main file '${main}' must export a default stack definition (export default Alchemy.Stack({...}))`));\n }\n return stackEffect;\n});\n/**\n * Placeholder {@link Stack.Stack} value used while building a stack's\n * `providers()` layer out of band. No real resources exist yet — we only\n * want the layer's provider/auth registrations and cloud-environment\n * services, so `resources`/`bindings`/`actions` are empty and the stage is a\n * sentinel.\n */\nconst placeholderStack = (name) => ({\n actions: {},\n bindings: {},\n name,\n resources: {},\n stage: \"placeholder\",\n});\n/**\n * Import a stack entrypoint and build its `providers()` (+ `state()`) layer\n * out of band against placeholder {@link Stack.Stack}/{@link Stage} services,\n * so its `AuthProviderLayer` registrations land in an {@link AuthProviders}\n * registry and the built context holds every resource provider plus the\n * cloud-environment services their operations need.\n *\n * Shared by `alchemy login`, `alchemy profile show`, and `alchemy unsafe\n * nuke`. The caller decides what to do with the result — use `authProviders`\n * (login / profile show) or `context` (nuke) — and whether a missing/invalid\n * entrypoint is fatal (login / nuke let it propagate) or best-effort\n * (profile show wraps the call in `Effect.catchCause`).\n */\nexport const buildStackProviders = Effect.fn(\"buildStackProviders\")(function* (options) {\n const authProviders = options.registry ?? {};\n const stackEffect = yield* importStack(options.main);\n const configProvider = withProfileOverride(yield* loadConfigProvider(options.envFile), options.profile);\n const context = yield* Layer.build((stackEffect.providers ?? Layer.empty).pipe(Layer.provideMerge(stackEffect.state ?? Layer.empty), Layer.provideMerge(Layer.mergeAll(Layer.succeed(AuthProviders, authProviders), ConfigProvider.layer(configProvider), options.logger ??\n Logger.layer([fileLogger(\"out\")], { mergeWithExisting: true }), Layer.succeed(Stage, \"placeholder\"), Layer.succeed(Stack.Stack, placeholderStack(stackEffect.stackName)), options.extra ?? Layer.empty))));\n return { authProviders, context, stackEffect };\n});\n/**\n * The auth providers Alchemy ships with. Used as the baseline registry so\n * `alchemy login` works from any folder (no `alchemy.run.ts` required) and\n * `alchemy profile show` can pretty-print any provider a profile mentions,\n * even one the current stack doesn't wire up.\n */\nexport const builtinAuth = Layer.mergeAll(AwsAuth, AxiomAuth, CloudflareAuth, GitHubAuth, HetznerAuth, NeonAuth, PlanetscaleAuth, PrismaAuth);\n/**\n * Build {@link builtinAuth} against `registry` so every built-in auth\n * provider registers itself, without importing any stack entrypoint.\n */\nexport const buildBuiltinAuthProviders = Effect.fn(\"buildBuiltinAuthProviders\")(function* (options) {\n const authProviders = options.registry ?? {};\n yield* Layer.build(Layer.provide(builtinAuth, Layer.mergeAll(Layer.succeed(AuthProviders, authProviders), ConfigProvider.layer(withProfileOverride(yield* loadConfigProvider(options.envFile), options.profile)), Logger.layer([fileLogger(\"out\")], { mergeWithExisting: true }))));\n return authProviders;\n});\n//# sourceMappingURL=_shared.js.map","import * as Cause from \"effect/Cause\";\nimport * as ConfigProvider from \"effect/ConfigProvider\";\nimport * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Logger from \"effect/Logger\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\nimport * as Command from \"effect/unstable/cli/Command\";\nimport * as Flag from \"effect/unstable/cli/Flag\";\nimport { AdoptPolicy } from \"../../AdoptPolicy.js\";\nimport { AlchemyContext } from \"../../AlchemyContext.js\";\nimport { apply } from \"../../Apply.js\";\nimport { ArtifactStore, createArtifactStore } from \"../../Artifacts.js\";\nimport { AuthProviders } from \"../../Auth/AuthProvider.js\";\nimport { withProfileOverride } from \"../../Auth/Profile.js\";\nimport * as CLI from \"../../Cli/Cli.js\";\nimport * as Plan from \"../../Plan.js\";\nimport { Stage } from \"../../Stage.js\";\nimport { loadConfigProvider } from \"../../Util/ConfigProvider.js\";\nimport { fileLogger } from \"../../Util/FileLogger.js\";\nimport { dryRun as dryRunFlag, envFile, force, importStack, instrumentCommand, profile, script, stage, yes, } from \"./_shared.js\";\nexport const ExecStackOptions = Schema.Struct({\n main: Schema.String,\n stage: Schema.String,\n envFile: Schema.OptionFromOptional(Schema.String),\n profile: Schema.optional(Schema.String),\n dryRun: Schema.optional(Schema.Boolean),\n force: Schema.optional(Schema.Boolean),\n yes: Schema.optional(Schema.Boolean),\n destroy: Schema.optional(Schema.Boolean),\n dev: Schema.optional(Schema.Boolean),\n adopt: Schema.optional(Schema.Boolean),\n});\nconst stackSpanAttrs = (args) => ({\n \"alchemy.stage\": args.stage,\n \"alchemy.profile\": args.profile,\n \"alchemy.main\": args.main,\n \"alchemy.dry_run\": !!args.dryRun,\n \"alchemy.force\": !!args.force,\n \"alchemy.destroy\": !!args.destroy,\n \"alchemy.dev\": !!args.dev,\n \"alchemy.adopt\": !!args.adopt,\n});\nconst adopt = Flag.boolean(\"adopt\").pipe(Flag.withDescription(\"Adopt pre-existing cloud resources that conflict with this stack instead of failing. \" +\n \"Useful for re-importing infrastructure into a fresh state store.\"), Flag.withDefault(false));\nconst runStack = Effect.fn(function* ({ main, stage, envFile, profile, dryRun = false, force = false, yes = false, destroy = false, dev = false, adopt = false, }) {\n const stackEffect = yield* importStack(main);\n const services = Layer.mergeAll(Layer.effect(AlchemyContext, AlchemyContext.pipe(Effect.map((ctx) => ({\n ...ctx,\n dev,\n adopt,\n // `--yes` also auto-accepts (and performs) an out-of-date state\n // store upgrade, instead of prompting.\n updateStateStore: yes,\n })))), \n // `--adopt` opts the entire deploy in to adoption-on-conflict.\n // Resource providers that wire `AdoptPolicy` (Worker domains,\n // Cloudflare.SecretsStore, etc.) will reconcile against\n // pre-existing cloud resources instead of failing on duplicates.\n // Default is `false` so an unintentional collision still surfaces\n // loudly.\n Layer.succeed(AdoptPolicy, adopt), Layer.succeed(ArtifactStore, createArtifactStore()), Layer.succeed(AuthProviders, yield* Effect.serviceOption(AuthProviders).pipe(Effect.map(Option.getOrElse(() => ({}))))), ConfigProvider.layer(withProfileOverride(yield* loadConfigProvider(envFile), profile)), Logger.layer([fileLogger(\"out\")], { mergeWithExisting: true }), Layer.succeed(Stage, stage));\n yield* Effect.gen(function* () {\n const cli = yield* CLI.Cli;\n const stack = yield* stackEffect;\n yield* Effect.gen(function* () {\n const updatePlan = destroy\n ? yield* Plan.destroy(stack)\n : yield* Plan.make(stack, { force });\n if (dryRun) {\n yield* cli.displayPlan(updatePlan);\n }\n else {\n const hasChanges = Object.keys(updatePlan.deletions).length > 0 ||\n Object.values(updatePlan.resources).some((node) => node.action !== \"noop\" ||\n node.bindings.some((b) => b.action !== \"noop\"));\n if (!yes && hasChanges) {\n const approved = yield* cli.approvePlan(updatePlan);\n if (!approved) {\n return;\n }\n }\n // Smoke-test kill switch: `ALCHEMY_DEV_ONCE=1 alchemy dev` exits after\n // the first apply instead of keeping the dev session alive — apply\n // failures propagate (non-zero exit) instead of being swallowed, so\n // scripts and CI can assert \"dev deploys cleanly\" without a timeout.\n const devOnce = dev &&\n (process.env.ALCHEMY_DEV_ONCE === \"1\" ||\n process.env.ALCHEMY_DEV_ONCE === \"true\");\n // In dev, a failed apply must not drain the keep-alive below:\n // `alchemy dev` runs under `bun --watch`, which cancels watch mode\n // entirely on a clean exit (oven-sh/bun#10983), so completing here\n // would tear down every healthy local resource along with the failed\n // one. Swallow apply failures (logging the full cause, since the TUI\n // renderer only shows the failure status) so the keep-alive engages\n // and the rest of the stack keeps serving, but re-propagate a pure\n // interruption (Ctrl-C / fiber kill) so dev still shuts down cleanly.\n const applyPlan = dev && !devOnce\n ? apply(updatePlan).pipe(Effect.catchCause((cause) => Cause.hasInterruptsOnly(cause)\n ? Effect.failCause(cause)\n : Console.error(`alchemy dev: apply failed; keeping dev alive so healthy resources keep serving.\\n${Cause.pretty(cause)}`).pipe(Effect.as(undefined))))\n : apply(updatePlan);\n const outputs = yield* applyPlan;\n if (outputs !== undefined) {\n yield* Console.log(outputs);\n }\n if (dev) {\n if (devOnce) {\n return;\n }\n return yield* Effect.never;\n }\n }\n }).pipe(Effect.provide(stack.services));\n }).pipe(Effect.provide(services));\n});\n// In dev, failures OUTSIDE the apply guard above must not exit the process\n// either: the user saves mid-edit states where importing the stack module\n// itself throws (missing export, module-evaluation crash), or planning fails\n// against the half-edited program. Those failures escape `runStack` before\n// the apply-level guard exists, and exiting here kills the `--watch` session\n// (oven-sh/bun#10983), so dev would stop reloading on subsequent saves. Log\n// the cause and park forever; the watcher restarts the run on the next file\n// change. Pure interruption (Ctrl-C / fiber kill) still propagates so dev\n// shuts down cleanly.\nexport const devKeepAlive = (effect) => effect.pipe(Effect.catchCause((cause) => Cause.hasInterruptsOnly(cause)\n ? Effect.failCause(cause)\n : Console.error(`alchemy dev: run failed; waiting for the next file change to retry.\\n${Cause.pretty(cause)}`).pipe(Effect.andThen(Effect.never))));\nexport const execStack = (options) => options.dev ? devKeepAlive(runStack(options)) : runStack(options);\nexport const deployCommand = Command.make(\"deploy\", {\n dryRun: dryRunFlag,\n force,\n main: script,\n envFile,\n stage,\n yes,\n profile,\n adopt,\n}, instrumentCommand(\"deploy\", stackSpanAttrs)(execStack));\nexport const destroyCommand = Command.make(\"destroy\", {\n dryRun: dryRunFlag,\n main: script,\n envFile,\n stage,\n yes,\n profile,\n}, instrumentCommand(\"destroy\", stackSpanAttrs)((args) => execStack({\n ...args,\n destroy: true,\n})));\nexport const planCommand = Command.make(\"plan\", {\n main: script,\n envFile,\n stage,\n profile,\n}, instrumentCommand(\"plan\", stackSpanAttrs)((args) => execStack({\n ...args,\n // plan is the same as deploy with dryRun always set to true\n dryRun: true,\n})));\n//# sourceMappingURL=deploy.js.map","/**\n * Pure formatting shared by the plan/deploy renderers (Ink TUI +\n * non-interactive LoggingCli) for the local-vs-live provider-mode\n * indicator on a resource row.\n *\n * The rule: in a dev run every mode-stamped row shows its mode — the\n * whole point of `alchemy dev` is knowing what is emulated and what is\n * real, so `(local)` and `(remote)` are both explicit. A live deploy\n * only tags the exceptions (`local` leftovers from dev being\n * deleted/replaced) — tagging every row `remote` in a normal deploy\n * would be noise.\n *\n * - `alchemy dev` (default `\"local\"`): local rows are tagged `local`,\n * live rows are tagged `remote` — matching the `Alchemy.remote()`\n * vocabulary users see. The persisted enum stays `\"live\"`; only the\n * display says `remote`.\n * - `alchemy deploy` (default `\"live\"`): rows resolved to the local\n * provider are tagged `local`; live rows are untagged.\n * - Mode-agnostic providers have no resolved mode (`undefined`) — nothing\n * is shown.\n * - Mode-switch replacements ALWAYS annotate the transition\n * (e.g. `local → live`), regardless of the run default.\n */\n/** The display label for a mode-stamped row (`\"live\"` renders as `remote`). */\nexport const modeLabel = (mode) => mode === \"live\" ? \"remote\" : \"local\";\n/**\n * The mode note for a resource row, or `undefined` when nothing should be\n * shown (mode-agnostic rows, and live rows in a live-default run).\n *\n * @param mode the mode the node's provider was resolved for (`undefined`\n * for mode-agnostic providers — never annotated)\n * @param priorMode for replacements, the mode the old generation was\n * created with; when it differs from `mode` the transition is shown\n * @param defaultMode the run-level default (`alchemy dev` → `\"local\"`,\n * otherwise `\"live\"`); `undefined` is treated as `\"live\"`\n */\nexport const formatModeNote = (options) => {\n const { mode, priorMode } = options;\n if (mode === undefined)\n return undefined;\n // A genuine mode switch is always surfaced as the raw transition.\n if (priorMode !== undefined && priorMode !== mode) {\n return `${priorMode} → ${mode}`;\n }\n const defaultMode = options.defaultMode ?? \"live\";\n // Live-default runs stay quiet for live rows; dev runs tag everything.\n if (defaultMode === \"live\" && mode === \"live\")\n return undefined;\n return modeLabel(mode);\n};\n//# sourceMappingURL=ModeTag.js.map","import * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { Cli } from \"./Cli.js\";\nimport { formatModeNote } from \"./ModeTag.js\";\nconst ESC = \"\\x1b[\";\nconst RESET = `${ESC}0m`;\nconst useColor = process.stdout.hasColors?.() ?? !!process.stdout.isTTY;\nconst c = (code, s) => useColor ? `${ESC}${code}m${s}${RESET}` : s;\nconst dim = (s) => c(\"2\", s);\nconst bold = (s) => c(\"1\", s);\nconst red = (s) => c(\"31\", s);\nconst green = (s) => c(\"32\", s);\nconst yellow = (s) => c(\"33\", s);\nconst blue = (s) => c(\"34\", s);\nconst magenta = (s) => c(\"35\", s);\nconst cyan = (s) => c(\"36\", s);\nconst actionColor = {\n create: green,\n update: yellow,\n replace: magenta,\n delete: red,\n noop: dim,\n};\nconst statusColor = (status) => {\n switch (status) {\n case \"created\":\n case \"updated\":\n case \"replaced\":\n return green;\n case \"deleted\":\n return dim;\n case \"retained\":\n return dim;\n case \"fail\":\n return red;\n case \"attaching\":\n case \"post-attach\":\n return cyan;\n default:\n return yellow;\n }\n};\nconst tag = (id) => bold(`[${id}]`);\nconst isTerminal = (status) => status === \"created\" ||\n status === \"updated\" ||\n status === \"deleted\" ||\n status === \"retained\" ||\n status === \"replaced\" ||\n status === \"fail\";\n/**\n * Dim `(local)` / `(remote)` / `(local → live)` suffix for a resource row,\n * or `\"\"` when the row's mode matches the run default (the quiet common\n * case). See {@link formatModeNote} for the rule.\n */\nconst modeSuffix = (options) => {\n const note = formatModeNote(options);\n return note ? ` ${dim(`(${note})`)}` : \"\";\n};\n/** Exported for unit tests — pure plan-preview rendering. */\nexport const formatPlanLines = (plan) => {\n const items = [\n ...Object.values(plan.resources),\n ...Object.values(plan.deletions),\n ];\n if (items.length === 0)\n return [bold(\"Plan:\") + \" no changes\"];\n const counts = items.reduce((acc, item) => ((acc[item.action] = (acc[item.action] ?? 0) + 1), acc), {});\n const summary = [\"create\", \"update\", \"replace\", \"delete\", \"noop\"]\n .filter((a) => counts[a])\n .map((a) => actionColor[a](`${counts[a]} to ${a}`))\n .join(dim(\", \"));\n const sorted = [...items].sort((a, b) => a.resource.LogicalId.localeCompare(b.resource.LogicalId));\n const lines = [`${bold(\"Plan:\")} ${summary}`];\n for (const item of sorted) {\n const action = actionColor[item.action](item.action);\n const mode = modeSuffix({\n mode: item.mode,\n priorMode: item.action === \"replace\" ? item.state.providerMode : undefined,\n defaultMode: plan.defaultMode,\n });\n // Surface FQN migrations: `[Assets] update (renamed from Bucket)` —\n // the update exists to re-brand the moved row's physical resource, and\n // without the note the plan gives no hint why an untouched resource\n // reconciles. (Only apply-side nodes can carry a rename — see\n // `ApplyNodeBase`.)\n const renamed = item.action !== \"delete\" && item.renamedFrom?.length\n ? ` ${dim(`(renamed from ${item.renamedFrom.join(\", \")})`)}`\n : \"\";\n lines.push(`${tag(item.resource.LogicalId)} ${action}${mode}${renamed}`);\n for (const binding of item.bindings) {\n if (binding.action === \"noop\")\n continue;\n const bindingAction = actionColor[binding.action](binding.action);\n lines.push(`${tag(`${item.resource.LogicalId}/${binding.sid}`)} ${bindingAction}`);\n }\n }\n return lines;\n};\nexport const LoggingCli = Layer.succeed(Cli, Cli.of({\n approvePlan: (plan) => Effect.gen(function* () {\n for (const line of formatPlanLines(plan))\n yield* Console.log(line);\n yield* Console.log(`\\n${yellow(\"Non-interactive terminal detected.\")} Pass ${bold(\"--yes\")} to approve, or set ${bold(\"ALCHEMY_TUI=1\")} for the interactive UI.`);\n return false;\n }),\n displayPlan: (plan) => Effect.gen(function* () {\n for (const line of formatPlanLines(plan))\n yield* Console.log(line);\n }),\n startApplySession: (plan) => Effect.gen(function* () {\n for (const line of formatPlanLines(plan))\n yield* Console.log(line);\n yield* Console.log(\"\");\n const counts = { ok: 0, fail: 0 };\n return {\n // Write through the Effect Console SERVICE (not the global\n // `console`) so environments that override it — e.g. the\n // alchemy-test runner's per-test buffering console — capture\n // apply progress instead of having it leak to stdout.\n emit: (event) => Effect.suspend(() => {\n if (event.kind === \"annotate\") {\n return Console.log(`${tag(event.id)} ${blue(event.message)}`);\n }\n const id = event.bindingId\n ? `${event.id}/${event.bindingId}`\n : event.id;\n const status = statusColor(event.status)(event.status);\n const mode = modeSuffix({\n mode: event.providerMode,\n priorMode: event.fromProviderMode,\n defaultMode: plan.defaultMode,\n });\n const msg = event.message ? ` ${dim(\"—\")} ${event.message}` : \"\";\n if (isTerminal(event.status)) {\n if (event.status === \"fail\")\n counts.fail++;\n else\n counts.ok++;\n }\n return Console.log(`${tag(id)} ${status}${mode}${msg}`);\n }),\n done: () => Console.log(`\\n${bold(\"Done:\")} ${green(`${counts.ok} succeeded`)}${counts.fail ? dim(\", \") + red(`${counts.fail} failed`) : \"\"}`),\n };\n }),\n}));\n//# sourceMappingURL=LoggingCli.js.map","import { toPath } from \"../FQN.js\";\nexport function buildNamespaceTree(items, actions = []) {\n const root = {\n id: \"\",\n path: [],\n children: new Map(),\n resources: [],\n actions: [],\n };\n const getNode = (path) => {\n let current = root;\n for (let i = 0; i < path.length; i++) {\n const segment = path[i];\n let child = current.children.get(segment);\n if (!child) {\n child = {\n id: segment,\n path: path.slice(0, i + 1),\n children: new Map(),\n resources: [],\n actions: [],\n };\n current.children.set(segment, child);\n }\n current = child;\n }\n return current;\n };\n for (const item of items) {\n getNode(toPath(item.resource.Namespace)).resources.push(item);\n }\n for (const action of actions) {\n getNode(toPath(action.def.Namespace)).actions.push(action);\n }\n return root;\n}\nexport function deriveNamespaceAction(node) {\n const actions = new Set();\n for (const resource of node.resources) {\n actions.add(deriveResourceChildrenAction(resource, node));\n }\n for (const action of node.actions) {\n // Map task actions onto the resource action space for the rollup:\n // run → create, delete → delete, noop → noop.\n actions.add(action.action === \"run\"\n ? \"create\"\n : action.action === \"delete\"\n ? \"delete\"\n : \"noop\");\n }\n for (const child of node.children.values()) {\n const childAction = deriveNamespaceAction(child);\n if (childAction === \"mixed\") {\n return \"mixed\";\n }\n actions.add(childAction);\n }\n return deriveAction(actions);\n}\nexport function flattenTree(node, depth = 0, result = []) {\n flattenNamespace(node, depth, result);\n return result;\n}\nconst flattenNamespace = (node, depth, result) => {\n const sortedResources = [...node.resources].sort((a, b) => a.resource.LogicalId.localeCompare(b.resource.LogicalId));\n const sortedChildren = Array.from(node.children.entries()).sort(([a], [b]) => a.localeCompare(b));\n const resourceIds = new Set(sortedResources.map((resource) => resource.resource.LogicalId));\n for (const [id, child] of sortedChildren) {\n if (resourceIds.has(id) || isEmpty(child)) {\n continue;\n }\n result.push({\n type: \"namespace\",\n depth,\n id,\n path: child.path,\n action: deriveNamespaceAction(child),\n hasChildren: true,\n });\n flattenNamespace(child, depth + 1, result);\n }\n for (const resource of sortedResources) {\n const childNamespace = node.children.get(resource.resource.LogicalId);\n result.push({\n type: \"resource\",\n depth,\n id: resource.resource.LogicalId,\n path: [...node.path, resource.resource.LogicalId],\n action: resource.action,\n resourceType: resource.resource.Type,\n bindingCount: resource.bindings.length,\n providerMode: resource.mode,\n fromProviderMode: resource.action === \"replace\" &&\n resource.mode !== undefined &&\n resource.state.providerMode !== undefined &&\n resource.state.providerMode !== resource.mode\n ? resource.state.providerMode\n : undefined,\n });\n for (const binding of [...resource.bindings].sort((a, b) => a.sid.localeCompare(b.sid))) {\n result.push({\n type: \"binding\",\n depth: depth + 1,\n id: binding.sid,\n path: [...node.path, resource.resource.LogicalId, binding.sid],\n action: binding.action,\n bindingSid: binding.sid,\n });\n }\n if (childNamespace) {\n flattenNamespace(childNamespace, depth + 1, result);\n }\n }\n // Actions are listed after resources at the same depth.\n const sortedActions = [...node.actions].sort((a, b) => a.def.LogicalId.localeCompare(b.def.LogicalId));\n for (const action of sortedActions) {\n result.push({\n type: \"action\",\n depth,\n id: action.def.LogicalId,\n path: [...node.path, action.def.LogicalId],\n action: action.action,\n actionType: action.def.Type,\n });\n }\n};\nconst isEmpty = (node) => node.resources.length === 0 &&\n node.actions.length === 0 &&\n Array.from(node.children.values()).every(isEmpty);\nconst countVisibleChildren = (node) => {\n const resourceIds = new Set(node.resources.map((resource) => resource.resource.LogicalId));\n return (node.resources.length +\n Array.from(node.children.keys()).filter((id) => !resourceIds.has(id)).length);\n};\nconst deriveResourceChildrenAction = (resource, node) => {\n const actions = new Set([\n resource.action,\n ]);\n for (const binding of resource.bindings) {\n actions.add(binding.action);\n }\n const childNamespace = node.children.get(resource.resource.LogicalId);\n if (childNamespace) {\n actions.add(deriveNamespaceAction(childNamespace));\n }\n return deriveAction(actions);\n};\nconst deriveAction = (actions) => {\n if (actions.size === 0)\n return \"noop\";\n if (actions.has(\"replace\"))\n return actions.size === 1 ? \"replace\" : \"mixed\";\n if (actions.has(\"delete\"))\n return actions.size === 1 ? \"delete\" : \"mixed\";\n if (actions.has(\"create\"))\n return actions.size === 1 ? \"create\" : \"mixed\";\n if (actions.has(\"update\"))\n return actions.size === 1 ? \"update\" : \"mixed\";\n return \"noop\";\n};\n//# sourceMappingURL=NamespaceTree.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n/** @jsxImportSource react */\nimport { useMemo } from \"react\";\nimport { Box, Text } from \"ink\";\nimport { buildNamespaceTree, flattenTree, } from \"../../NamespaceTree.js\";\nimport { formatModeNote } from \"../../ModeTag.js\";\nexport function Plan({ plan }) {\n const items = useMemo(() => [\n ...Object.values(plan.resources),\n ...Object.values(plan.deletions),\n ], [plan]);\n const taskItems = useMemo(() => [\n ...Object.values(plan.actions ?? {}),\n ...Object.values(plan.actionDeletions ?? {}),\n ].filter((t) => t !== undefined), [plan]);\n const flatItems = useMemo(() => {\n const tree = buildNamespaceTree(items, taskItems);\n return flattenTree(tree);\n }, [items, taskItems]);\n if (items.length === 0 && taskItems.length === 0) {\n return _jsx(Text, { color: \"gray\", children: \"No changes planned\" });\n }\n const counts = items.reduce((acc, item) => (acc[item.action]++, acc), {\n create: 0,\n update: 0,\n delete: 0,\n noop: 0,\n replace: 0,\n });\n const taskCounts = taskItems.reduce((acc, item) => (acc[item.action]++, acc), { run: 0, noop: 0, delete: 0 });\n const actions = [\"create\", \"update\", \"delete\", \"replace\"].filter((action) => counts[action] > 0);\n const taskHeaderEntries = [\n taskCounts.run > 0 ? `${taskCounts.run} to run` : undefined,\n taskCounts.delete > 0 ? `${taskCounts.delete} to drop` : undefined,\n ].filter((s) => !!s);\n return (_jsxs(Box, { flexDirection: \"column\", children: [_jsxs(Box, { marginTop: 1, children: [_jsx(Text, { underline: true, children: \"Plan\" }), _jsx(Text, { children: \": \" }), [\n ...actions.map((action) => {\n const count = counts[action];\n const color = actionColor(action);\n return (_jsx(Box, { children: _jsxs(Text, { color: color, children: [count, \" to \", action] }) }, action));\n }),\n ...taskHeaderEntries.map((label, i) => (_jsx(Box, { children: _jsx(Text, { color: \"cyan\", children: label }) }, `task-${i}`))),\n ].flatMap((box, i, arr) => i === arr.length - 1\n ? [box]\n : [box, _jsx(Text, { children: \" | \" }, `sep-${i}`)])] }), _jsx(Box, { flexDirection: \"column\", marginTop: 1, children: flatItems.map((item) => {\n const indent = \" \".repeat(item.depth);\n const color = getActionColor(item.action);\n const icon = getActionIcon(item.action);\n const key = item.path.join(\"/\");\n if (item.type === \"namespace\") {\n return (_jsxs(Box, { flexDirection: \"row\", children: [_jsx(Text, { children: indent }), _jsx(Box, { width: 2, children: _jsxs(Text, { color: color, children: [icon, \" \"] }) }), _jsx(Text, { color: \"blueBright\", children: item.id })] }, key));\n }\n if (item.type === \"binding\") {\n return (_jsxs(Box, { flexDirection: \"row\", children: [_jsx(Text, { children: indent }), _jsx(Box, { width: 2, children: _jsxs(Text, { color: color, children: [icon, \" \"] }) }), _jsx(Text, { color: \"cyan\", children: item.bindingSid })] }, key));\n }\n if (item.type === \"action\") {\n return (_jsxs(Box, { flexDirection: \"row\", children: [_jsx(Text, { children: indent }), _jsx(Box, { width: 2, children: _jsxs(Text, { color: color, children: [icon, \" \"] }) }), _jsx(Box, { children: _jsx(Text, { bold: true, children: item.id }) }), _jsx(Box, { marginLeft: 1, children: _jsxs(Text, { color: \"blackBright\", children: [\"(\", item.actionType, \")\"] }) }), _jsx(Box, { marginLeft: 1, children: _jsx(Text, { color: \"cyan\", children: \"[action]\" }) })] }, key));\n }\n // Resource item\n const modeNote = formatModeNote({\n mode: item.providerMode,\n priorMode: item.fromProviderMode,\n defaultMode: plan.defaultMode,\n });\n return (_jsxs(Box, { flexDirection: \"row\", children: [_jsx(Text, { children: indent }), _jsx(Box, { width: 2, children: _jsxs(Text, { color: color, children: [icon, \" \"] }) }), _jsx(Box, { children: _jsx(Text, { bold: true, children: item.id }) }), _jsx(Box, { marginLeft: 1, children: _jsxs(Text, { color: \"blackBright\", children: [\"(\", item.resourceType, \")\"] }) }), modeNote && (_jsx(Box, { marginLeft: 1, children: _jsxs(Text, { color: \"blackBright\", children: [\"(\", modeNote, \")\"] }) })), item.bindingCount !== undefined && item.bindingCount > 0 && (_jsx(Box, { marginLeft: 1, children: _jsxs(Text, { color: \"cyan\", children: [\"(\", item.bindingCount, \" bindings)\"] }) }))] }, key));\n }) })] }));\n}\nconst getActionColor = (action) => ({\n noop: \"gray\",\n create: \"green\",\n update: \"yellow\",\n delete: \"red\",\n replace: \"magenta\",\n mixed: \"cyan\",\n run: \"cyan\",\n})[action] ?? \"gray\";\nconst getActionIcon = (action) => ({\n create: \"+\",\n update: \"~\",\n delete: \"-\",\n noop: \"•\",\n replace: \"!\",\n mixed: \"*\",\n run: \"λ\",\n})[action] ?? \"?\";\nconst actionColor = (action) => getActionColor(action);\n//# sourceMappingURL=Plan.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n/** @jsxImportSource react */\nimport { useState } from \"react\";\nimport { Box, Text, useApp, useInput } from \"ink\";\nimport { Plan } from \"./Plan.js\";\nexport function ApprovePlan(props) {\n const { plan, approve } = props;\n const [selected, setSelected] = useState(0);\n const { exit } = useApp();\n useInput((_input, key) => {\n if (key.leftArrow || key.rightArrow) {\n setSelected((prev) => (prev === 0 ? 1 : 0));\n }\n else if (key.return) {\n approve(selected === 0);\n exit();\n }\n });\n return (_jsxs(Box, { flexDirection: \"column\", children: [_jsx(Plan, { plan: plan }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { children: \"Proceed?\" }) }), _jsxs(Box, { gap: 1, children: [_jsxs(Text, { color: selected === 0 ? \"green\" : \"gray\", children: [selected === 0 ? \"◉\" : \"○\", \" Yes\"] }), _jsxs(Text, { color: selected === 1 ? \"red\" : \"gray\", children: [selected === 1 ? \"◉\" : \"○\", \" No\"] })] })] }));\n}\n//# sourceMappingURL=ApprovePlan.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n/** @jsxImportSource react */\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { Box, Text } from \"ink\";\nimport { buildNamespaceTree, flattenTree, } from \"../../NamespaceTree.js\";\nimport { formatModeNote } from \"../../ModeTag.js\";\nconst getTaskKey = (item) => item.path.join(\"/\");\nexport const buildProgressRows = (plan) => {\n const items = [\n ...Object.values(plan.resources),\n ...Object.values(plan.deletions).filter((item) => item !== undefined),\n ];\n const taskItems = [\n ...Object.values(plan.actions ?? {}),\n ...Object.values(plan.actionDeletions ?? {}),\n ].filter((t) => t !== undefined);\n const tree = buildNamespaceTree(items, taskItems);\n return flattenTree(tree)\n .filter((item) => item.type !== \"binding\")\n .map((item) => {\n if (item.type === \"namespace\") {\n return {\n key: getTaskKey(item),\n type: \"namespace\",\n id: item.id,\n depth: item.depth,\n action: item.action,\n };\n }\n if (item.type === \"action\") {\n return {\n key: getTaskKey(item),\n type: \"task\",\n id: item.id,\n depth: item.depth,\n actionType: item.actionType ?? \"unknown\",\n action: item.action,\n };\n }\n return {\n key: getTaskKey(item),\n type: \"resource\",\n id: item.id,\n depth: item.depth,\n resourceType: item.resourceType ?? \"unknown\",\n action: item.action,\n providerMode: item.providerMode,\n fromProviderMode: item.fromProviderMode,\n persistedApplyStatus: item.action === \"noop\"\n ? (() => {\n const crud = findCrudByLogicalId(plan, item.id);\n return crud?.action === \"noop\" ? crud.state.status : undefined;\n })()\n : undefined,\n };\n });\n};\nconst buildLogicalIdIndex = (rows) => {\n const index = new Map();\n for (const row of rows) {\n if (row.type !== \"resource\" && row.type !== \"task\")\n continue;\n const keys = index.get(row.id);\n if (keys) {\n keys.push(row.key);\n }\n else {\n index.set(row.id, [row.key]);\n }\n }\n return index;\n};\nexport function toPlanTask(rowOrId, planItem) {\n if (typeof rowOrId === \"string\") {\n return {\n key: rowOrId,\n id: rowOrId,\n type: planItem.resource.Type,\n status: planItem.action === \"noop\" ? planItem.state.status : \"pending\",\n updatedAt: Date.now(),\n };\n }\n return {\n key: rowOrId.key,\n id: rowOrId.id,\n type: rowOrId.resourceType,\n status: rowOrId.action === \"noop\"\n ? (rowOrId.persistedApplyStatus ?? \"created\")\n : \"pending\",\n updatedAt: Date.now(),\n };\n}\nconst buildInitialTasks = (rows) => new Map(rows.flatMap((row) => row.type === \"resource\"\n ? [[row.key, toPlanTask(row)]]\n : row.type === \"task\"\n ? [\n [\n row.key,\n {\n key: row.key,\n id: row.id,\n type: row.actionType,\n // `noop` tasks are skipped — render as gray `•` from the start\n // rather than briefly flashing the `ran` cyan styling.\n status: row.action === \"noop\"\n ? \"skipped\"\n : \"pending\",\n updatedAt: Date.now(),\n },\n ],\n ]\n : []));\nexport function PlanProgress(props) {\n const { source, plan } = props;\n const spinner = useGlobalSpinner();\n const rows = useMemo(() => buildProgressRows(plan), [plan]);\n const logicalIdIndex = useMemo(() => buildLogicalIdIndex(rows), [rows]);\n const [tasks, setTasks] = useState(() => buildInitialTasks(rows));\n const unsubscribeRef = useRef(null);\n useEffect(() => {\n unsubscribeRef.current?.();\n unsubscribeRef.current = source.subscribe((event) => {\n setTasks((prev) => {\n const next = new Map(prev);\n const keys = logicalIdIndex.get(event.id) ?? [];\n if (event.kind === \"status-change\") {\n if (!event.bindingId) {\n for (const key of keys) {\n const current = next.get(key);\n next.set(key, {\n key,\n id: event.id,\n type: event.type,\n status: event.status,\n message: event.message ?? current?.message,\n updatedAt: Date.now(),\n });\n }\n }\n }\n else {\n for (const key of keys) {\n const current = next.get(key);\n if (!current)\n continue;\n next.set(key, {\n ...current,\n message: event.message,\n updatedAt: Date.now(),\n });\n }\n }\n return next;\n });\n });\n return () => {\n unsubscribeRef.current?.();\n unsubscribeRef.current = null;\n };\n }, [logicalIdIndex, source]);\n useEffect(() => {\n setTasks(buildInitialTasks(rows));\n }, [rows]);\n return (_jsx(Box, { flexDirection: \"column\", children: rows.map((row) => {\n const indent = \" \".repeat(row.depth);\n if (row.type === \"namespace\") {\n return (_jsxs(Box, { flexDirection: \"row\", children: [_jsx(Text, { children: indent }), _jsx(Box, { width: 2, children: _jsx(Text, { color: \"blueBright\", children: \"\\u21B3 \" }) }), _jsx(Text, { color: \"blueBright\", children: row.id })] }, row.key));\n }\n if (row.type === \"task\") {\n const t = tasks.get(row.key);\n const status = t?.status ?? (row.action === \"noop\" ? \"ran\" : \"pending\");\n const color = statusColor(status);\n const icon = taskIcon(row.action, status, spinner);\n const label = row.action === \"delete\"\n ? status === \"deleted\" || status === \"retained\"\n ? status\n : \"drop\"\n : status === \"ran\"\n ? row.action === \"noop\"\n ? \"skip\"\n : \"ran\"\n : status === \"running\"\n ? \"running\"\n : status === \"fail\"\n ? \"fail\"\n : row.action === \"noop\"\n ? \"skip\"\n : \"run\";\n return (_jsxs(Box, { flexDirection: \"column\", children: [_jsxs(Box, { flexDirection: \"row\", children: [_jsx(Text, { children: indent }), _jsx(Box, { width: 2, children: _jsxs(Text, { color: color, children: [icon, \" \"] }) }), _jsx(Text, { bold: true, children: row.id }), _jsxs(Text, { dimColor: true, children: [\" (\", row.actionType, \")\"] }), _jsxs(Text, { color: color, children: [\" \", label] }), _jsxs(Text, { color: \"cyan\", dimColor: true, children: [\" \", \"[action]\"] })] }), t?.message ? (_jsx(Box, { paddingLeft: row.depth * 2 + 2, children: _jsxs(Text, { dimColor: true, children: [\"\\u2022 \", t.message] }) })) : null] }, row.key));\n }\n const task = tasks.get(row.key) ?? toPlanTask(row);\n const displayStatus = getDisplayStatus(row, task.status);\n const color = statusColor(displayStatus);\n const icon = statusIcon(task.status, spinner);\n const modeNote = formatModeNote({\n mode: row.providerMode,\n priorMode: row.fromProviderMode,\n defaultMode: plan.defaultMode,\n });\n return (_jsxs(Box, { flexDirection: \"column\", children: [_jsxs(Box, { flexDirection: \"row\", children: [_jsx(Text, { children: indent }), _jsx(Box, { width: 2, children: _jsxs(Text, { color: color, children: [icon, \" \"] }) }), _jsx(Text, { bold: true, children: task.id }), _jsxs(Text, { dimColor: true, children: [\" (\", task.type, \")\"] }), modeNote ? _jsxs(Text, { dimColor: true, children: [\" (\", modeNote, \")\"] }) : null, _jsxs(Text, { color: color, children: [\" \", displayStatus] })] }), task.message ? (_jsx(Box, { paddingLeft: row.depth * 2 + 2, children: _jsxs(Text, { dimColor: true, children: [\"\\u2022 \", task.message] }) })) : null] }, row.key));\n }) }));\n}\nfunction getDisplayStatus(row, status) {\n if (row.action === \"noop\" && (status === \"created\" || status === \"updated\")) {\n return \"no change\";\n }\n return status;\n}\nfunction statusColor(status) {\n switch (status) {\n case \"no change\":\n return \"gray\";\n case \"pending\":\n return \"gray\";\n case \"creating\":\n case \"created\":\n return \"green\";\n case \"updating\":\n case \"updated\":\n return \"yellow\";\n case \"deleting\":\n case \"deleted\":\n return \"red\";\n case \"retained\":\n return \"gray\";\n case \"running\":\n case \"ran\":\n return \"cyan\";\n case \"skipped\":\n return \"gray\";\n case \"fail\":\n return \"redBright\";\n default:\n return undefined;\n }\n}\nfunction taskIcon(action, status, spinnerChar) {\n if (status === \"running\")\n return spinnerChar;\n if (status === \"fail\")\n return \"✗\";\n if (status === \"skipped\")\n return \"•\";\n if (status === \"ran\")\n return action === \"noop\" ? \"•\" : \"✓\";\n if (status === \"deleted\" || status === \"retained\")\n return \"✓\";\n if (action === \"delete\")\n return \"-\";\n if (action === \"noop\")\n return \"•\";\n return \"λ\";\n}\nfunction statusIcon(status, spinnerChar) {\n if (isInProgress(status))\n return spinnerChar;\n if (status === \"fail\")\n return \"✗\";\n return \"✓\"; // created/updated/deleted/replaced/etc.\n}\nfunction isInProgress(status) {\n return (status === \"pending\" ||\n status === \"creating\" ||\n status === \"updating\" ||\n status === \"deleting\" ||\n status === \"running\");\n}\nconst spinnerFrames = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\nfunction useGlobalSpinner(intervalMs = 80) {\n const [index, setIndex] = useState(0);\n useEffect(() => {\n const timer = setInterval(() => {\n setIndex((i) => (i + 1) % spinnerFrames.length);\n }, intervalMs);\n return () => clearInterval(timer);\n }, [intervalMs]);\n return spinnerFrames[index];\n}\nconst findCrudByLogicalId = (plan, logicalId) => {\n for (const node of Object.values(plan.resources)) {\n if (node.resource.LogicalId === logicalId) {\n return node;\n }\n }\n for (const node of Object.values(plan.deletions)) {\n if (node?.resource.LogicalId === logicalId) {\n return node;\n }\n }\n return undefined;\n};\n//# sourceMappingURL=PlanProgress.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\n/** @jsxImportSource react */\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { render } from \"ink\";\nimport { Cli } from \"../Cli.js\";\nimport { ApprovePlan } from \"./components/ApprovePlan.js\";\nimport { Plan as PlanComponent } from \"./components/Plan.js\";\nimport { PlanProgress } from \"./components/PlanProgress.js\";\nexport const inkCLI = () => Layer.succeed(Cli, Cli.of({\n approvePlan,\n displayPlan,\n startApplySession,\n}));\nconst approvePlan = Effect.fn(function* (plan) {\n let approved = false;\n const { waitUntilExit } = render(_jsx(ApprovePlan, { plan: plan, approve: (a) => (approved = a) }));\n yield* Effect.promise(waitUntilExit);\n return approved;\n});\nconst displayPlan = (plan) => Effect.sync(() => {\n const { unmount } = render(_jsx(PlanComponent, { plan: plan }));\n unmount();\n});\nconst startApplySession = Effect.fn(function* (plan) {\n // Print the plan preview once into scrollback before mounting the\n // animated progress region (mirrors LoggingCli, which prints the plan\n // lines at session start — `alchemy dev`/`--yes` runs never call\n // displayPlan/approvePlan, so without this the TTY path shows no plan at\n // all). Rendering + immediately unmounting leaves the frame behind and\n // releases the Ink instance for PlanProgress; forwarded runtime logs then\n // insert BETWEEN the preview and the live region instead of piling above\n // the entire transcript.\n yield* displayPlan(plan);\n const listeners = new Set();\n const { unmount } = render(_jsx(PlanProgress, { plan: plan, source: {\n subscribe(listener) {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n } }));\n return {\n done: Effect.fn(function* () {\n yield* Effect.sleep(10); // give the react event loop time to re-render\n yield* Effect.sync(() => unmount());\n }),\n emit: (event) => Effect.sync(() => {\n for (const listener of listeners)\n listener(event);\n }),\n };\n});\n//# sourceMappingURL=InkCLI.js.map","import * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { isNonInteractive } from \"../Util/interactive.js\";\nimport { LoggingCli } from \"./LoggingCli.js\";\nexport { isNonInteractive } from \"../Util/interactive.js\";\nexport const selectCli = () => isNonInteractive()\n ? LoggingCli\n : // Defer importing the Ink/React TUI (`./tui/InkCLI.tsx` pulls in `ink`)\n // until we actually need the interactive renderer. Non-interactive runs\n // (agents, CI, piped output) take the cheap `LoggingCli` branch and never\n // pay the TUI import cost.\n Layer.unwrap(Effect.promise(() => import(\"./tui/InkCLI.js\").then((m) => m.inkCLI())));\n//# sourceMappingURL=selectCli.js.map","import * as ConfigProvider from \"effect/ConfigProvider\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Schema from \"effect/Schema\";\nimport * as FetchHttpClient from \"effect/unstable/http/FetchHttpClient\";\nimport { AlchemyContextLive } from \"../AlchemyContext.js\";\nimport { CredentialsStoreLive } from \"../Auth/Credentials.js\";\nimport { ProfileLive } from \"../Auth/Profile.js\";\nimport * as RpcProviderProxy from \"../Local/RpcProviderProxy.js\";\nimport { forwardSidecarLogs } from \"../Local/RpcSpawner.js\";\nimport { PlatformServices } from \"../Util/PlatformServices.js\";\nimport { execStack, ExecStackOptions } from \"./commands/deploy.js\";\nimport { LoggingCli } from \"./LoggingCli.js\";\nimport { selectCli } from \"./selectCli.js\";\n// `alchemy dev` is a long-running session whose primary output is the log\n// stream (worker starts, cron fires, request logs) interleaved with\n// re-applies on file change. Ink's insertion model stacks inserted lines\n// ABOVE the animated region, so runtime logs end up above the plan/apply\n// output in scrollback. Append-only chronological rendering is the correct\n// model for a dev server (plan → status → logs, strictly in order), so dev\n// always takes the line renderer; deploy/destroy keep the interactive TUI.\nconst makeServices = (dev) => Layer.merge(dev ? LoggingCli : selectCli(), RpcProviderProxy.fromEnv()).pipe(Layer.provideMerge(Layer.mergeAll(AlchemyContextLive, ProfileLive, CredentialsStoreLive)), Layer.provideMerge(Layer.mergeAll(PlatformServices, FetchHttpClient.layer, ConfigProvider.layer(ConfigProvider.fromEnv()))));\nexport const exec = () => {\n const options = Schema.decodeSync(ExecStackOptions)(JSON.parse(process.env.ALCHEMY_EXEC_OPTIONS));\n // Subscribe to the spawner's sidecar log stream BEFORE the stack runs:\n // this process owns the terminal renderer, so sidecar output printed here\n // lands in chronological order with the run's own lines instead of racing\n // the shared tty. No-op outside dev.\n return forwardSidecarLogs.pipe(Effect.andThen(execStack(options)), Effect.provide(makeServices(options.dev)), Effect.scoped);\n};\n//# sourceMappingURL=exec.js.map","import { exec } from \"alchemy/Cli\";\nimport { runMain } from \"alchemy/Util/PlatformServices\";\n\nexec().pipe(runMain);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKa,iBAAb,cAAoC,cAAc,QAAQ,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAC/E;CACa,qBAAqB,MAAM,OAAO,gBAAgB,OAAO,IAAI,aAAa;EACnF,MAAM,KAAK,OAAO,WAAW;EAE7B,MAAM,OAAM,OADQA,OAAK,KAAA,CACR,KAAK,QAAQ,IAAI,GAAG,UAAU;EAC/C,OAAO,GAAG,cAAc,KAAK,EAAE,WAAW,KAAK,CAAC;EAChD,OAAO;GACH,YAAY;GACZ,kBAAkB;GAClB,KAAK;GACL,OAAO;EACX;CACJ,CAAC,CAAC;;;;;;CCJW,yBAAyB;EAClC,MAAM,MAAM,QAAQ;EACpB,IAAI,IAAI,kBAAkB,OAAO,IAAI,mBAAmB,KACpD,OAAO;EACX,IAAI,IAAI,gBAAgB,KACpB,OAAO;EACX,IAAI,CAAC,QAAQ,OAAO,OAChB,OAAO;EACX,IAAI,IAAI,IACJ,OAAO;EAGX,IAAI,IAAI,cACJ,IAAI,0BACJ,IAAI,gBACJ,IAAI,eACJ,IAAI,WACJ,OAAO;EACX,OAAO;CACX;;;;;;cCxBsC;CAChC,6BAAa,IAAI,IAAI;CAGrB,QAAQ,SAAS,QAAQ,EAAE;CAC3B,UAAU,SAAS,QAAQ,EAAE;CAC7B,iBAAiB,SAAS,OAAO,EAAE;CACnC,kBAAkB,SAAS,QAAQ,CAAC;CACpC,WAAN,cAAuB,KAAK,YAAY,UAAU,CAAC,CAAC,C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AAe,QAAQ,CAAC,CAAC,CAAC,CAAC;AACjU,MAAa,aAAa;CACtB,MAAM,UAAU,OAAO,WAAW,gBAAgB,CAAC,CAAC,KAAK,MAAM,QAAQ,IAAI,oBAAoB,CAAC;CAKhG,OAAO,mBAAmB,KAAK,OAAO,QAAQ,UAAU,OAAO,CAAC,GAAG,OAAO,QAAQ,aAAa,QAAQ,GAAG,CAAC,GAAG,OAAO,MAAM;AAC/H;;;sBC5BuD;AAEvD,KAAK,CAAC,CAAC,KAAK,OAAO"}
|
|
1
|
+
{"version":3,"file":"exec.js","names":["Path","Path","Context","Context","Context","Context","Context","Context","Context","Context","Context","Context","Context","of","State.State","Context","Output.stackRef","make","Output.isOutput","Context","Output.NamedExpr","Output.EffectExpr","Output.VoidExpr","Context","make","Context","make","ChildProcessSpawner","ChildProcess","Output.isExpr","Output.hasOutputs","Context","Output.ResourceExpr","Output.isExpr","Output.of","Output.isResourceExpr","Output.isPropExpr","Output.isApplyExpr","Output.hasOutputs","Output.isEffectExpr","Output.isFlatMapExpr","Output.asOutput","Output.isAllExpr","Output.isLiteralExpr","Output.isRefExpr","Output.InvalidReferenceError","Output.isStackRefExpr","Output.isNamedExpr","Output.upstreamAny","Output.evaluate","Output.resolveUpstream","Output.upstreamAny","os","crypto","packageJson.version","Clank.PromptCancelled","Context","of","fromEnvironment","options","Region.of","Endpoint.of","Endpoint.none","Clank.text","Clank.password","Clank.success","Clank.select","Clank.info","Clank.warn","Path","NodeCrypto","NodeOs","STORAGE_KEY","options","Clank.text","Clank.select","Clank.password","Clank.success","generateState","crypto","extractCredentials","authorize","OAUTH_ENDPOINTS","OAUTH_CLIENT_ID","OAUTH_REDIRECT_URI","callbackPromise","OAUTH_LOCAL_CALLBACK_URI","OAuthError","exchange","tokenRequest","refresh","exchangeCallbackInput","callback","options","withOAuthCredentials","Clank.info","Clank.select","Clank.text","Clank.confirm","Clank.multiselect","OAuthClient.authorize","Clank.openUrl","Clank.warn","OAuthClient.callback","OAuthClient.exchangeCallbackInput","Clank.success","Clank.password","STATE_STORE_CREDENTIALS_FILE","OAuthClient.refresh","OAuthClient.revoke","OAUTH_CLIENT_ID","OAUTH_REDIRECT_URI","OAUTH_LOCAL_CALLBACK_URI","OAUTH_ENDPOINTS","options","ChildProcess","Clank.password","Clank.success","Clank.text","Clank.select","options","DEFAULT_API_BASE_URL","Clank.password","Clank.text","Clank.success","Clank.select","options","Clank.password","Clank.success","Clank.select","crypto","Clank.info","Clank.select","options","OAuthClient.authorize","Clank.openUrl","Clank.warn","OAuthClient.callback","Clank.text","OAuthClient.exchangeCallbackInput","Clank.success","Clank.password","OAuthClient.refresh","Clank.password","Clank.success","Clank.select","S","Path","Stack.Stack","CLI.Cli","destroy","Plan.destroy","Plan.make","dryRunFlag","actionColor","statusColor","_jsx","_jsxs","_jsxs","_jsx","_jsx","_jsxs","_jsx","PlanComponent","RpcProviderProxy.fromEnv","exec","exec"],"sources":["../lib/AlchemyContext.js","../lib/Util/interactive.js","../lib/Auth/Lock.js","../lib/Auth/AuthProvider.js","../lib/Auth/Profile.js","../lib/Auth/Credentials.js","../lib/Artifacts.js","../lib/Cli/Cli.js","../lib/Ref.js","../lib/AdoptPolicy.js","../lib/FQN.js","../lib/ProviderMode.js","../lib/Provider.js","../lib/Resource.js","../lib/RuntimeContext.js","../lib/Stage.js","../lib/State/State.js","../lib/Util/data.js","../lib/Output.js","../lib/Util/ConfigProvider.js","../lib/Util/effect.js","../lib/Util/FileLogger.js","../lib/Util/Node.js","../lib/Util/PlatformServices.js","../lib/Stack.js","../lib/State/StateEncoding.js","../lib/Local/RpcSerialization.js","../lib/Local/RpcServerEnvironment.js","../lib/Local/RpcProviderProxy.js","../lib/Local/RpcSpawner.js","../lib/ActionRuntimeContext.js","../lib/Auth/Demand.js","../lib/Diff.js","../lib/InstanceId.js","../lib/Util/types.js","../lib/Action.js","../lib/Telemetry/Metrics.js","../lib/Util/scc.js","../lib/Util/sha256.js","../lib/Plan.js","../lib/Apply.js","../package.json","../lib/Telemetry/Attributes.js","../lib/Util/Clank.js","../lib/Auth/Env.js","../lib/AWS/Environment.js","../lib/AWS/Endpoint.js","../lib/AWS/Region.js","../lib/AWS/AuthProvider.js","../lib/Axiom/AuthProvider.js","../lib/Cloudflare/StateStore/CredentialsFile.js","../lib/Cloudflare/Auth/OAuthClient.js","../lib/Cloudflare/Auth/AuthProvider.js","../lib/GitHub/BaseUrl.js","../lib/GitHub/AuthProvider.js","../lib/Hetzner/AuthProvider.js","../lib/Neon/AuthProvider.js","../lib/Planetscale/OAuthClient.js","../lib/Planetscale/AuthProvider.js","../lib/Prisma/AuthProvider.js","../lib/Cli/commands/_shared.js","../lib/Cli/commands/deploy.js","../lib/Cli/ModeTag.js","../lib/Cli/LoggingCli.js","../lib/Cli/NamespaceTree.js","../lib/Cli/tui/components/Plan.js","../lib/Cli/tui/components/ApprovePlan.js","../lib/Cli/tui/components/PlanProgress.js","../lib/Cli/tui/InkCLI.js","../lib/Cli/selectCli.js","../lib/Cli/exec.js","exec.ts"],"sourcesContent":["import * as EffectContext from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport * as Path from \"effect/Path\";\nexport class AlchemyContext extends EffectContext.Service()(\"alchemy/Context\") {\n}\nexport const AlchemyContextLive = Layer.effect(AlchemyContext, Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const dir = path.join(process.cwd(), \".alchemy\");\n yield* fs.makeDirectory(dir, { recursive: true });\n return {\n dotAlchemy: dir,\n updateStateStore: false,\n dev: false,\n adopt: false,\n };\n}));\n//# sourceMappingURL=AlchemyContext.js.map","/**\n * Returns true when the current process looks like it's being driven by a\n * coding agent, CI runner, test runner, or anything else that won't render an\n * interactive TUI / prompt well.\n *\n * Two callers rely on this:\n * - `Cli/selectCli.ts` uses it to pick `LoggingCli` over the Ink TUI.\n * - `Auth/Profile.ts` uses it to refuse to launch an interactive credential\n * configure flow (and thus avoid acquiring an auth lockfile) when there's\n * no TTY to drive the prompts.\n *\n * Kept in `Util` (rather than `Cli`) so `Auth` can depend on it without\n * pulling in the CLI layer.\n */\nexport const isNonInteractive = () => {\n const env = process.env;\n if (env.ALCHEMY_PLAIN === \"1\" || env.ALCHEMY_NO_TUI === \"1\")\n return true;\n if (env.ALCHEMY_TUI === \"1\")\n return false;\n if (!process.stdout.isTTY)\n return true;\n if (env.CI)\n return true;\n // Known coding-agent env vars. These are best-effort — the isTTY check\n // above already catches most cases since agents typically pipe stdout.\n if (env.CLAUDECODE ||\n env.CLAUDE_CODE_ENTRYPOINT ||\n env.CURSOR_AGENT ||\n env.AIDER_MODEL ||\n env.CODEX_CLI)\n return true;\n return false;\n};\n//# sourceMappingURL=interactive.js.map","import * as Clock from \"effect/Clock\";\nimport * as Console from \"effect/Console\";\nimport * as Data from \"effect/Data\";\nimport * as Duration from \"effect/Duration\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Option from \"effect/Option\";\nimport * as Path from \"effect/Path\";\nimport * as Schedule from \"effect/Schedule\";\nimport * as Semaphore from \"effect/Semaphore\";\nimport { rootDir } from \"./Profile.js\";\nconst semaphores = new Map();\n// Keep STALE well above REFRESH — a saturated machine can starve the\n// heartbeat fiber for seconds.\nconst STALE = Duration.seconds(30);\nconst REFRESH = Duration.seconds(10);\nconst RETRY_INTERVAL = Duration.millis(50);\nconst DEFAULT_TIMEOUT = Duration.minutes(2);\n// How often to remind the user that a lock wait / locked operation is still\n// outstanding. Long enough that healthy runs never print it.\nconst STALL_INTERVAL = Duration.seconds(30);\nclass LockHeld extends Data.TaggedError(\"LockHeld\") {\n}\nclass LockTimeout extends Data.TaggedError(\"LockTimeout\") {\n}\n/**\n * Make a lock key safe to use as a file name on every platform.\n *\n * Keys are derived from user-controlled values (profile names), which\n * have shown up in production containing shell placeholders like\n * `${ALCHEMY_PROFILE:-default}` — `:`/`{`/`$` are invalid in Windows\n * file names and mkdir fails with EINVAL. Collapse anything outside a\n * conservative allow-list to `_`.\n *\n * @internal exported for unit testing.\n */\nexport const sanitizeLockKey = (key) => key.replace(/[^A-Za-z0-9._-]/g, \"_\");\n/**\n * Take the cross-process lock. On success the ambient scope owns it: a\n * finalizer removes it and a forked heartbeat keeps its mtime fresh.\n */\nconst acquireFileLock = Effect.fn(function* (lockPath, timeout) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const ownerPath = path.join(lockPath, \"owner\");\n const owner = yield* Effect.sync(() => crypto.randomUUID());\n yield* fs.makeDirectory(path.dirname(lockPath), { recursive: true });\n // Reap a lock whose crashed holder stopped refreshing its mtime.\n const reapStale = Effect.gen(function* () {\n const info = yield* fs.stat(lockPath);\n const now = yield* Clock.currentTimeMillis;\n const isStale = Option.exists(info.mtime, (mtime) => mtime.getTime() < now - Duration.toMillis(STALE));\n if (isStale) {\n yield* fs.remove(lockPath, { recursive: true, force: true });\n }\n }).pipe(Effect.catchReason(\"PlatformError\", \"NotFound\", () => Effect.void));\n // A non-recursive mkdir is the atomic test-and-set; the owner marker lets\n // release and refresh verify the lock wasn't reaped and re-taken.\n yield* fs.makeDirectory(lockPath).pipe(Effect.andThen(fs\n .writeFileString(ownerPath, owner)\n .pipe(Effect.onError(() => fs\n .remove(lockPath, { recursive: true, force: true })\n .pipe(Effect.ignore)))), Effect.catchReason(\"PlatformError\", \"AlreadyExists\", () => reapStale.pipe(Effect.andThen(Effect.fail(new LockHeld())))), Effect.retry({\n while: (error) => error._tag === \"LockHeld\",\n schedule: Schedule.spaced(RETRY_INTERVAL).pipe(Schedule.upTo({ duration: timeout })),\n }), Effect.catchTag(\"LockHeld\", () => Effect.die(new LockTimeout({\n lockPath,\n timeout,\n message: `Timed out waiting for the alchemy auth lock '${lockPath}' — another alchemy ` +\n `process has held it for over ${Duration.toSeconds(timeout)}s. If no other ` +\n `alchemy process is running, delete the lock directory and retry.`,\n }))));\n yield* Effect.addFinalizer(() => fs.readFileString(ownerPath).pipe(Effect.filterOrFail((current) => current === owner), Effect.andThen(fs.remove(lockPath, { recursive: true, force: true })), Effect.ignore));\n yield* fs.readFileString(ownerPath).pipe(Effect.filterOrFail((current) => current === owner), Effect.andThen(Clock.currentTimeMillis.pipe(Effect.map((now) => new Date(now)))), \n // NB: utimes interprets a bare number as *seconds* since epoch.\n Effect.flatMap((now) => fs.utimes(lockPath, now, now)), Effect.repeat(Schedule.spaced(REFRESH)), Effect.catch(() => Effect.logWarning(`auth lock compromised (continuing): '${lockPath}' is no longer owned by this process`)), \n // Acquisition returns while this fiber refreshes until the lock scope ends.\n Effect.forkScoped);\n});\n/**\n * Periodic \"I am not dead, I am stuck here\" notice, forked for the lifetime\n * of a {@link withLock} call.\n *\n * Deliberately `Console.error` rather than `Effect.logWarning`: the CLI's\n * telemetry layer replaces the console logger with the OTLP one (see\n * `Telemetry/Layer.ts`), so log records reach `.alchemy/log/out` but never\n * the terminal. The whole point of this notice is to reach the user who is\n * watching a frozen terminal, so it must not go through the logger.\n */\nconst stallNotice = (lockPath, label, phase, interval) => Effect.suspend(() => {\n let seconds = 0;\n return Effect.suspend(() => {\n seconds += Duration.toSeconds(interval);\n return Console.error(phase.current === \"waiting\"\n ? `alchemy: ${seconds}s waiting for the auth lock '${lockPath}' (${label}). ` +\n `Another alchemy process holds it; if none is running, delete that directory.`\n : `alchemy: ${label} has been running for ${seconds}s while holding the auth lock ` +\n `'${lockPath}'. Re-run with --log-level debug for detail.`);\n }).pipe(Effect.delay(interval), Effect.repeat(Schedule.spaced(interval)));\n});\n/**\n * Serialise execution of `effect` for the same `key`, both within this\n * process (a semaphore) and across processes on the same machine (an atomic\n * lock directory whose mtime is refreshed while held so another process can\n * recover it after a crash).\n *\n * Failure to create or acquire the lock is fatal. Authentication writes its\n * profile state beneath the same root, so continuing without a writable lock\n * cannot produce a valid deployment and would permit concurrent corruption.\n */\nexport const withLock = (key, effect, options) => {\n const safeKey = sanitizeLockKey(key);\n const label = options?.label ?? key;\n let semaphore = semaphores.get(safeKey);\n if (semaphore === undefined) {\n semaphore = Semaphore.makeUnsafe(1);\n semaphores.set(safeKey, semaphore);\n }\n return semaphore.withPermit(Effect.gen(function* () {\n const path = yield* Path.Path;\n // Read `rootDir` here, not at module eval, so the\n // `Profile -> AuthProvider -> Lock -> Profile` import cycle never\n // sees it uninitialised.\n const lockPath = path.join(rootDir, \"lock\", `${safeKey}.lock`);\n const phase = { current: \"waiting\" };\n if (options?.watchdog !== false) {\n yield* Effect.forkScoped(stallNotice(lockPath, label, phase, options?.stallInterval ?? STALL_INTERVAL));\n }\n yield* Effect.logDebug(`auth lock: acquiring '${lockPath}' for ${label}`);\n yield* acquireFileLock(lockPath, options?.timeout ?? DEFAULT_TIMEOUT).pipe(Effect.orDie);\n phase.current = \"held\";\n yield* Effect.logDebug(`auth lock: acquired '${lockPath}' for ${label}`);\n return yield* effect.pipe(Effect.onExit(() => Effect.logDebug(`auth lock: releasing '${lockPath}' for ${label}`)));\n }).pipe(Effect.scoped));\n};\n//# sourceMappingURL=Lock.js.map","import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Schema from \"effect/Schema\";\nimport * as Semaphore from \"effect/Semaphore\";\nimport { withLock } from \"./Lock.js\";\n/**\n * Canonical web host for OAuth provider-agnostic landing pages\n * (`/auth/success`, `/auth/error`). The CLI's loopback server 302s the\n * browser to one of these after handling the OAuth callback. Centralized\n * here so the redirect target lives in exactly one place across all\n * provider OAuth clients.\n */\nexport const AUTH_LANDING_HOST = \"https://alchemy.run\";\nexport const AUTH_SUCCESS_URL = `${AUTH_LANDING_HOST}/auth/success`;\nexport const AUTH_ERROR_URL = `${AUTH_LANDING_HOST}/auth/error`;\n/**\n * Methods on an {@link AuthProviderImpl} that mutate (or could trigger\n * mutation of) on-disk credentials. The factory wraps these in a\n * cross-process file lock keyed by `(profileName, providerName)` so that\n * concurrent processes never refresh / write credentials simultaneously.\n *\n * `prettyPrint` is intentionally excluded: it's read-only display.\n */\nconst LOCKED_METHODS = new Set([\"read\", \"login\", \"logout\", \"configure\"]);\n/**\n * Methods that may drive an interactive flow (prompts, browser-based\n * OAuth, etc.). A process-wide mutex serializes these across providers\n * so that, e.g., Cloudflare's `configure` finishes its prompt sequence\n * before Planetscale's begins — even when the two auth provider Layers\n * are built in parallel as part of a single `providers()` Layer.\n *\n * The clack prompt wrapper in `Util/Clank.ts` enforces per-prompt\n * serialization; this mutex enforces per-flow serialization so the user\n * sees one provider's prompts grouped together rather than interleaved.\n */\nconst INTERACTIVE_METHODS = new Set([\"login\", \"configure\"]);\nconst interactiveMutex = Semaphore.makeUnsafe(1);\nexport class AuthError extends Schema.TaggedError()(\"AuthError\", {\n message: Schema.String,\n cause: Schema.optional(Schema.Defect()),\n}) {\n}\nexport class AuthProviders extends Context.Service()(\"AuthProviders\") {\n}\nexport const AuthProvider = () => (name, impl) => Effect.gen(function* () {\n const ctx = yield* Effect.context();\n const providers = yield* AuthProviders;\n const service = yield* Effect.isEffect(impl)\n ? impl\n : Effect.succeed(impl);\n return yield* Effect.sync(() => (providers[name] = {\n kind: \"AuthProvider\",\n name,\n ...Object.fromEntries(Object.entries(service).map(([methodName, fn]) => [\n methodName,\n (...args) => {\n let eff = fn(...args).pipe(Effect.provideContext(ctx));\n if (LOCKED_METHODS.has(methodName)) {\n // First positional arg is always `profileName`.\n const profileName = args[0];\n eff = withLock(`${profileName}-${name}`, eff, {\n label: `${name}.${methodName} (profile '${profileName}')`,\n // `login`/`configure` legitimately block on the user\n // (browser OAuth, `aws sso login`), and a periodic\n // notice would trample the prompt they are answering.\n watchdog: !INTERACTIVE_METHODS.has(methodName),\n });\n }\n if (INTERACTIVE_METHODS.has(methodName)) {\n eff = Semaphore.withPermits(interactiveMutex, 1)(eff);\n }\n return eff;\n },\n ])),\n }));\n});\n/**\n * Build a Layer that registers an AuthProvider into the {@link AuthProviders}\n * registry when its parent layer is built. Use this from a provider's\n * top-level `providers()` Layer so that `alchemy login` can discover the\n * provider via the registry without forcing credential resolution.\n */\nexport const AuthProviderLayer = () => (name, impl) => Layer.effectDiscard(AuthProvider()(name, impl));\n/**\n * Look up a registered {@link AuthProvider} by name. Fails with\n * {@link AuthError} if the provider hasn't been registered (typically because\n * its layer hasn't been built).\n */\nexport const getAuthProvider = (name) => AuthProviders.use((registry) => registry[name] == null\n ? Effect.fail(new AuthError({\n message: `AuthProvider '${name}' is not registered. Make sure its layer has been provided.`,\n }))\n : Effect.succeed(registry[name]));\n//# sourceMappingURL=AuthProvider.js.map","import * as Config from \"effect/Config\";\nimport * as ConfigProvider from \"effect/ConfigProvider\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport os from \"node:os\";\nimport path from \"pathe\";\nimport { isNonInteractive } from \"../Util/interactive.js\";\nimport { AuthError } from \"./AuthProvider.js\";\nexport const rootDir = path.join(os.homedir(), \".alchemy\");\nexport const configFilePath = path.join(rootDir, \"profiles.json\");\n/**\n * Config key consulted by the various `fromAuthProvider` /\n * `fromEnvironment` layers to pick which named profile in\n * `~/.alchemy/profiles.json` to use. Defaults to `\"default\"`.\n */\nexport const ALCHEMY_PROFILE = Config.string(\"ALCHEMY_PROFILE\").pipe(Config.withDefault(\"default\"));\nexport const CONFIG_VERSION = 0;\nexport class AlchemyConfig extends Context.Service()(\"Alchemy::Profiles\") {\n}\nconst emptyConfig = () => ({\n version: CONFIG_VERSION,\n profiles: {},\n});\nexport class AlchemyProfile extends Context.Service()(\"Alchemy::Profile\") {\n}\n/**\n * Layer that builds the {@link AlchemyProfile} service. Captures the\n * {@link FileSystem.FileSystem} dependency at layer-build time, so any\n * Effect that yields {@link AlchemyProfile} ends up with `R = Profile` (no\n * `FileSystem` leak). Provide this once at the top of your runtime\n * (alongside `PlatformServices` / `NodeContext`).\n */\nexport const ProfileLive = Layer.effect(AlchemyProfile, Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const readConfig = fs\n .readFileString(configFilePath)\n .pipe(Effect.flatMap((data) => Effect.try({\n try: () => {\n const parsed = JSON.parse(data);\n if (parsed?.version !== CONFIG_VERSION) {\n // TODO(sam): this is destructive, should we maintain a chain of migrations from 0 to current?\n return emptyConfig();\n }\n return parsed;\n },\n catch: emptyConfig,\n })), Effect.orElseSucceed(emptyConfig));\n const writeConfig = (config) => fs\n .makeDirectory(path.dirname(configFilePath), { recursive: true })\n .pipe(Effect.flatMap(() => fs.writeFileString(configFilePath, JSON.stringify(config, null, 2))));\n const getProfile = (name) => readConfig.pipe(Effect.map((config) => config.profiles[name]));\n const setProfile = (name, profile) => readConfig.pipe(Effect.tap((config) => Effect.sync(() => (config.profiles[name] = profile))), Effect.flatMap(writeConfig));\n const deleteProfile = (name) => readConfig.pipe(Effect.flatMap((config) => {\n if (!(name in config.profiles)) {\n return Effect.succeed(false);\n }\n delete config.profiles[name];\n return writeConfig(config).pipe(Effect.as(true));\n }));\n const loadOrConfigure = (auth, profileName, ctx) => Effect.flatMap(getProfile(profileName), (existing) => {\n const stored = existing?.[auth.name];\n if (stored) {\n return Effect.succeed(stored);\n }\n // No credentials are configured for this provider+profile. Driving\n // `auth.configure` requires an interactive terminal (clack prompts,\n // browser-based OAuth, ...). In a non-interactive, non-CI context\n // (e.g. a `vitest` run or piped stdout) there is no TTY to drive\n // those prompts, so bail *before* calling `auth.configure`.\n //\n // This matters beyond just avoiding a hang: `configure` is a locked\n // method, so entering it acquires a cross-process auth lockfile. We\n // must avoid creating that lock when we can't actually configure —\n // for OAuth providers a refresh token is typically single-use, so a\n // stray lock left by a doomed configure can wedge concurrent refreshes.\n if (!ctx.ci && isNonInteractive()) {\n return Effect.fail(new AuthError({\n message: `No credentials configured for '${auth.name}' in profile '${profileName}', ` +\n `and this process is non-interactive so it can't be configured interactively. ` +\n `Run \\`alchemy login --profile ${profileName}\\` to configure it, ` +\n `or set CI=1 to use environment-variable credentials.`,\n }));\n }\n return Effect.tap(auth.configure(profileName, ctx), (config) => setProfile(profileName, { ...existing, [auth.name]: config }));\n });\n return {\n readConfig,\n writeConfig,\n getProfile,\n setProfile,\n deleteProfile,\n loadOrConfigure,\n };\n}));\n/**\n * Returns a `ConfigProvider` that overrides `ALCHEMY_PROFILE` with the\n * given `profile` (when explicitly passed via the CLI `--profile` flag),\n * falling through to `base` for everything else.\n *\n * Use this to let the CLI's `--profile <name>` win over `$ALCHEMY_PROFILE`\n * without disturbing other config lookups.\n */\nexport const withProfileOverride = (base, profile) => {\n if (profile === undefined)\n return base;\n const overrides = { ALCHEMY_PROFILE: profile };\n const overrideProvider = ConfigProvider.make((path) => Effect.succeed(path.length === 1 && typeof path[0] === \"string\" && path[0] in overrides\n ? ConfigProvider.makeValue(overrides[path[0]])\n : undefined));\n return ConfigProvider.orElse(base)(overrideProvider);\n};\n//# sourceMappingURL=Profile.js.map","import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport * as Redacted from \"effect/Redacted\";\nimport path from \"pathe\";\nimport { rootDir } from \"./Profile.js\";\nconst credentialsDirPath = path.join(rootDir, \"credentials\");\nexport const profileCredentialsDirPath = (profile) => path.join(credentialsDirPath, profile);\nexport const credentialsFilePath = (profile, provider) => path.join(profileCredentialsDirPath(profile), `${provider}.json`);\nexport class CredentialsStore extends Context.Service()(\"Alchemy::CredentialsStore\") {\n}\nexport const CredentialsStoreLive = Layer.effect(CredentialsStore, Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const read = (profile, provider) => fs.readFileString(credentialsFilePath(profile, provider)).pipe(Effect.catch(() => Effect.succeed(undefined)), Effect.map((data) => {\n if (data === undefined)\n return undefined;\n try {\n return JSON.parse(data);\n }\n catch {\n return undefined;\n }\n }));\n const write = (profile, provider, credentials) => {\n const filePath = credentialsFilePath(profile, provider);\n return fs.makeDirectory(path.dirname(filePath), { recursive: true }).pipe(Effect.flatMap(() => {\n return fs.writeFileString(filePath, JSON.stringify(credentials, null, 2));\n }));\n };\n const remove_ = (profile, provider) => fs\n .remove(credentialsFilePath(profile, provider))\n .pipe(Effect.catch(() => Effect.void));\n const deleteProfile = (profile) => fs\n .remove(profileCredentialsDirPath(profile), { recursive: true })\n .pipe(Effect.catch(() => Effect.void));\n return {\n read,\n write,\n delete: remove_,\n deleteProfile,\n };\n}));\nexport function displayRedacted(r, visibleChars = 4) {\n const raw = Redacted.value(r);\n if (raw.length <= visibleChars)\n return \"****\";\n return `${raw.slice(0, visibleChars)}****`;\n}\n//# sourceMappingURL=Credentials.js.map","import * as Context from \"effect/Context\";\nimport * as Deferred from \"effect/Deferred\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\n/**\n * Per-resource in-memory artifacts shared across a single `Plan.make -> apply`\n * execution.\n *\n * The engine scopes this service by resource `FQN` before invoking lifecycle\n * handlers, so providers should treat it as a resource-local bag for expensive,\n * deterministic intermediate results that can be reused across phases.\n *\n * Expected usage:\n *\n * - `diff` computes an expensive artifact once and stores it\n * - `create` / `update` reads the same artifact and skips recomputing it\n * - artifacts are ephemeral and must never be required for correctness on a\n * later deploy because the bag is reset between runs\n *\n * Example:\n *\n * ```ts\n * const artifacts = yield* Artifacts;\n * const cached = yield* artifacts.get<PreparedBundle>(\"bundle\");\n * if (cached) return cached;\n *\n * const bundle = yield* prepareBundle();\n * yield* artifacts.set(\"bundle\", bundle);\n * return bundle;\n * ```\n */\nexport class Artifacts extends Context.Service()(\"Artifacts\") {\n}\nexport class ArtifactStore extends Context.Service()(\"Artifacts/Store\") {\n}\n/**\n * Create a fresh root store for one deploy/test run.\n */\nexport const createArtifactStore = () => new Map();\nconst getOrCreateBag = (store, fqn) => {\n const existing = store.get(fqn);\n if (existing) {\n return existing;\n }\n const bag = new Map();\n store.set(fqn, bag);\n return bag;\n};\nexport const makeScopedArtifacts = (store, fqn) => {\n const bag = getOrCreateBag(store, fqn);\n return {\n get: (key) => Effect.sync(() => bag.get(key)),\n set: (key, value) => Effect.sync(() => {\n bag.set(key, value);\n }),\n delete: (key) => Effect.sync(() => {\n bag.delete(key);\n }),\n };\n};\nexport const scopedArtifacts = (fqn) => Layer.effect(Artifacts, ArtifactStore.useSync((store) => makeScopedArtifacts(store, fqn)));\n/**\n * Run an effect with a fresh artifact root, replacing any existing store.\n * Use this at top-level entrypoints that intentionally define a new deploy run.\n */\nexport const provideFreshArtifactStore = (effect) => effect.pipe(Effect.provideServiceEffect(ArtifactStore, Effect.sync(createArtifactStore)));\n/**\n * Ensure an artifact root exists, reusing the ambient store when one is already\n * present. This lets nested helpers participate in the same run-scoped cache.\n */\nexport const ensureArtifactStore = (effect) => Effect.serviceOption(ArtifactStore).pipe(Effect.map(Option.getOrUndefined), Effect.flatMap((existing) => effect.pipe(Effect.provideService(ArtifactStore, existing ?? createArtifactStore()))));\nexport const cached = (id) => (eff) => Effect.gen(function* () {\n const artifacts = yield* Artifacts;\n const deferred = yield* Deferred.make();\n const cached = yield* artifacts.get(id);\n if (cached) {\n if (Effect.isEffect(cached)) {\n return yield* cached;\n }\n return cached;\n }\n yield* artifacts.set(id, Deferred.await(deferred));\n const result = yield* eff;\n yield* Deferred.succeed(deferred, result);\n yield* artifacts.set(id, result);\n return result;\n});\n//# sourceMappingURL=Artifacts.js.map","import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nexport class Cli extends Context.Service()(\"CLI\") {\n}\n//# sourceMappingURL=Cli.js.map","import * as Output from \"./Output.js\";\n// special runtime-only symbol for probing the Ref proxy for its metadata\nconst RefMetadata = Symbol.for(\"alchemy/RefMetadata\");\nexport const isRef = (s) => s && s[RefMetadata] !== undefined;\nexport const getRefMetadata = (ref) => ref[RefMetadata];\nexport const ref = (id, { stack, stage, } = {}, type) => {\n const ref = new Proxy({}, {\n get: (_, prop) => {\n if (prop === RefMetadata) {\n return {\n stack,\n stage,\n id,\n type,\n };\n }\n return Output.of(ref)[prop];\n },\n });\n return ref;\n};\n//# sourceMappingURL=Ref.js.map","import * as Context from \"effect/Context\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\n/**\n * AdoptPolicy controls whether the engine should \"adopt\" pre-existing cloud\n * resources that conflict with this stack instead of failing.\n *\n * The engine always calls a provider's `read` lifecycle operation when there\n * is no prior state and `read` is implemented. The provider's job is to\n * report two things:\n *\n * 1. Whether the resource exists (returns attributes vs. `undefined`).\n * 2. Whether *we* own it (plain attributes vs. {@link Unowned}-branded).\n *\n * The engine then routes:\n *\n * | `read` outcome | `adopt: false` | `adopt: true` |\n * | ------------------- | -------------- | ----------------- |\n * | undefined | create | create |\n * | owned (plain attrs) | silent adopt | silent adopt |\n * | {@link Unowned} | fail | takeover (adopt) |\n *\n * \"Owned\" means a provider has affirmatively determined the resource was\n * created by this stack/stage/logical-id (typically by inspecting tags or\n * naming conventions). Resources without ownership semantics simply always\n * return plain attrs — they are treated as owned by default, so silent\n * adoption is the norm and `--adopt` is unnecessary.\n *\n * The policy can be overridden per-effect via {@link adopt} — most commonly\n * applied at the resource or stack scope.\n */\nexport class AdoptPolicy extends Context.Service()(\"AdoptPolicy\") {\n}\n/**\n * Engine-raised failure produced when `read` reports an existing resource\n * marked as {@link Unowned} and `adopt` is `false`. Surface this to the user\n * to indicate they should either re-tag the cloud resource, pick a different\n * physical name, or re-run with `--adopt` (or `adopt(true)`) to force a\n * takeover.\n */\nexport class OwnedBySomeoneElse extends Data.TaggedError(\"OwnedBySomeoneElse\") {\n}\n/**\n * Private symbol used to brand attribute objects returned by `read` as\n * \"exists in cloud, but not owned by this stack/stage/logical-id\".\n *\n * Deliberately *not* registered via `Symbol.for` — the brand is an\n * engine-internal routing hint and must not be observable or\n * forgeable from outside this module. The engine strips it before any\n * state persistence (see {@link stripUnowned}) so it never leaks into\n * the state store, JSON serialization, or downstream `Output`s.\n */\nconst UnownedTag = Symbol(\"alchemy/Unowned\");\n/**\n * Brand a `read` return value as belonging to a different owner.\n *\n * Use this in a provider's `read` implementation when the resource exists in\n * the cloud but a positive ownership check (e.g. tag inspection) shows it\n * was *not* created by this stack/stage/logical-id:\n *\n * ```ts\n * read: Effect.fn(function* ({ id, output, olds }) {\n * const settings = yield* getScriptSettings({ ... }).pipe(\n * Effect.catchTag(\"WorkerNotFound\", () => Effect.succeed(undefined)),\n * );\n * if (!settings) return undefined;\n *\n * const attrs = { workerName, ...buildAttrs(settings) };\n * return hasAlchemyWorkerTags(id, settings.tags) ? attrs : Unowned(attrs);\n * }),\n * ```\n *\n * The returned value is structurally still `T` — there is no wrapper to\n * unwrap. The brand is a non-enumerable symbol that the engine inspects\n * during planning to decide whether to take over (`adopt: true`) or fail\n * loudly (`adopt: false`).\n *\n * Resources without ownership semantics should simply return plain attrs —\n * the engine treats them as owned and silent adoption is the default.\n */\nexport const Unowned = Object.assign((attrs) => {\n const cloned = { ...attrs };\n Object.defineProperty(cloned, UnownedTag, {\n value: true,\n enumerable: false,\n writable: false,\n configurable: false,\n });\n return cloned;\n}, {\n is: (value) => typeof value === \"object\" &&\n value !== null &&\n value[UnownedTag] === true,\n});\n/**\n * Strip the {@link Unowned} brand from an attributes object before persisting\n * it — state should not carry per-deploy ownership-routing metadata.\n *\n * The brand is intentionally non-enumerable, so a plain spread already\n * drops it; the additional `delete` is defense-in-depth in case a future\n * change makes the descriptor enumerable. Always returns a fresh object\n * (never mutates the input).\n */\nexport const stripUnowned = (attrs) => {\n const out = { ...attrs };\n if (UnownedTag in out)\n delete out[UnownedTag];\n return out;\n};\nexport const adopt = ((enabled = true) => (eff) => eff.pipe(typeof enabled === \"boolean\"\n ? Effect.provideService(AdoptPolicy, enabled ?? true)\n : Effect.provideServiceEffect(AdoptPolicy, enabled)));\n//# sourceMappingURL=AdoptPolicy.js.map","/**\n * Separator used in FQN strings.\n */\nexport const FQN_SEPARATOR = \"/\";\n/**\n * Encode an FQN for safe filesystem storage.\n * Replaces `/` (FQN separator) with `__` to avoid subdirectory creation.\n */\nexport const encodeFqn = (fqn) => fqn.replaceAll(FQN_SEPARATOR, \"__\");\n/**\n * Decode a filename back to FQN.\n */\nexport const decodeFqn = (filename) => filename.replaceAll(\"__\", FQN_SEPARATOR);\n/**\n * Convert a NamespaceNode chain to an array of namespace IDs, from root to leaf.\n *\n * @example\n * ```ts\n * const ns = { Id: \"Child\", Parent: { Id: \"Parent\", Parent: { Id: \"Root\" } } };\n * toPath(ns); // [\"Root\", \"Parent\", \"Child\"]\n * ```\n */\nexport const toPath = (ns) => {\n if (!ns)\n return [];\n const path = [];\n let current = ns;\n while (current) {\n path.unshift(current.Id);\n current = current.Parent;\n }\n return path;\n};\n/**\n * Create a fully-qualified name (FQN) from a namespace and logical ID.\n * The FQN is a flat key suitable for state storage.\n *\n * @example\n * ```ts\n * const ns = { Id: \"Child\", Parent: { Id: \"Parent\" } };\n * toFqn(ns, \"MyResource\"); // \"Parent/Child/MyResource\"\n * toFqn(undefined, \"MyResource\"); // \"MyResource\"\n * ```\n */\nexport const toFqn = (ns, logicalId) => {\n const path = toPath(ns);\n path.push(logicalId);\n return path.join(FQN_SEPARATOR);\n};\n/**\n * Parse an FQN back into namespace path segments and the logical ID.\n *\n * @example\n * ```ts\n * parseFqn(\"Parent/Child/MyResource\"); // { path: [\"Parent\", \"Child\"], logicalId: \"MyResource\" }\n * parseFqn(\"MyResource\"); // { path: [], logicalId: \"MyResource\" }\n * ```\n */\nexport const parseFqn = (fqn) => {\n const parts = fqn.split(FQN_SEPARATOR);\n const logicalId = parts.pop();\n return { path: parts, logicalId };\n};\n/**\n * Reconstruct a NamespaceNode chain from a path array.\n *\n * @example\n * ```ts\n * fromPath([\"Parent\", \"Child\"]);\n * // { Id: \"Child\", Parent: { Id: \"Parent\" } }\n * ```\n */\nexport const fromPath = (path) => {\n if (path.length === 0)\n return undefined;\n let node;\n for (const id of path) {\n node = { Id: id, Parent: node };\n }\n return node;\n};\n//# sourceMappingURL=FQN.js.map","import * as Context from \"effect/Context\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as Option from \"effect/Option\";\nimport { AlchemyContext } from \"./AlchemyContext.js\";\n/**\n * ProviderModePolicy opts resources OUT of local emulation: when `true`,\n * resources registered while it is in context resolve the **live**\n * provider even during `alchemy dev`.\n *\n * Apply it with the {@link remote} combinator. During `alchemy deploy`\n * everything is live anyway, so the policy only has an effect in dev.\n *\n * Tri-state `Context.Reference`: `undefined` (the default — no explicit\n * decoration, inherit/run default), `true` (`remote()`), `false`\n * (`remote(false)` — explicitly follow the run default again). The unset vs\n * explicit distinction is load-bearing for conflict detection at\n * registration (see `Resource.ts`).\n */\nexport const ProviderModePolicy = Context.Reference(\"ProviderModePolicy\", { defaultValue: () => undefined });\n/**\n * The same resource (identified by FQN) was registered (`yield*`ed) from two\n * places whose ambient {@link ProviderModePolicy} disagree — e.g. once inside\n * `remote()` and once without it. Context-based decoration cannot decide which\n * one wins, so the engine fails loudly instead of silently picking one.\n *\n * Fix: register the resource once and close over the returned value, or make\n * both registration sites agree.\n */\nexport class ConflictingProviderModeError extends Data.TaggedError(\"ConflictingProviderModeError\") {\n}\n/**\n * Prefix marking a locally-emulated resource's physical identity. Local\n * providers fabricate ids/names with this prefix (`dev:<uuid>` queue and\n * namespace ids, `dev:`-prefixed bucket names, ...) so a resource's\n * persisted attributes reveal which runtime hosts it even without the\n * `providerMode` stamp.\n */\nexport const LOCAL_ID_PREFIX = \"dev:\";\n/**\n * Does a persisted attributes value carry a local identity marker — any\n * string value (at any depth) with the {@link LOCAL_ID_PREFIX}? Persisted\n * attrs are plain JSON (state commits strip unresolved values), so a\n * structural scan is safe.\n */\nexport const hasLocalIdentity = (value) => {\n if (typeof value === \"string\")\n return value.startsWith(LOCAL_ID_PREFIX);\n if (Array.isArray(value))\n return value.some(hasLocalIdentity);\n if (typeof value === \"object\" && value !== null) {\n return Object.values(value).some(hasLocalIdentity);\n }\n return false;\n};\n/**\n * The mode a persisted state row was actually reconciled with: its stamped\n * `providerMode`, or — for legacy rows written before stamping existed —\n * `\"local\"` when the persisted attributes carry a {@link LOCAL_ID_PREFIX}\n * identity marker, `\"live\"` otherwise.\n *\n * An unstamped row without a marker predates provider modes or was written\n * by a mode-agnostic provider — in both cases the write acted on the REAL\n * cloud, so the row's physical resource is `\"live\"`. Assuming the current\n * run's mode instead silently adopts a deployed cloud resource as a local\n * instance during `alchemy dev`: the row noops (or restarts locally over\n * the live attrs), gets re-stamped `\"local\"`, and the live resource becomes\n * untracked — it is never deleted by a later destroy or replacement, and\n * its deployed URL keeps serving.\n *\n * An unstamped row WITH a marker (e.g. a queue with a `dev:<uuid>` id\n * written by `alchemy dev` on a pre-stamping version) is the mirror case:\n * assuming `\"live\"` hands the `dev:` identity to the live provider, which\n * sends it to the real cloud API (Cloudflare rejects it as a malformed\n * parameter, permanently wedging the destroy). The marker proves the row\n * was reconciled locally, so it is handled as `\"local\"`.\n *\n * For mode-agnostic providers the returned mode is harmless either way:\n * `providerForMode` ignores the mode when the provider has a single\n * implementation.\n */\nexport const stampedMode = (row) => row.providerMode ?? (hasLocalIdentity(row.attr) ? \"local\" : \"live\");\n/**\n * Run the wrapped resources **remotely (against the real cloud) even during\n * `alchemy dev`** — the opt-out from local emulation. During `alchemy deploy`\n * this is a no-op (everything is remote).\n *\n * Captured at registration time like `adopt()` / `retain()`, so it can be\n * applied to a single resource or a whole scope:\n *\n * ```ts\n * // This queue talks to real Cloudflare even in dev\n * const queue = yield* Queue(\"Jobs\", {}).pipe(Alchemy.remote());\n *\n * // Everything in this scope runs live in dev\n * yield* Effect.gen(function* () {\n * const queue = yield* Queue(\"Jobs\", {});\n * const consumer = yield* Consumer(\"JobsConsumer\", { queue });\n * }).pipe(Alchemy.remote());\n * ```\n *\n * `remote(false)` (or an `Effect<boolean>` resolving to false) removes the\n * pin — the resource follows the run default again.\n *\n * Providers with a single implementation are mode-agnostic and already run\n * live in dev; `remote()` on them is a no-op.\n */\nexport const remote = ((enabled = true) => (eff) => eff.pipe(typeof enabled === \"boolean\"\n ? Effect.provideService(ProviderModePolicy, enabled)\n : Effect.provideServiceEffect(ProviderModePolicy, enabled)));\n/**\n * Resolve the run-level default provider mode:\n *\n * 1. An ambient {@link ProviderModePolicy} of `true` (e.g. `remote()` wrapped\n * around a whole program) forces `\"live\"`.\n * 2. Otherwise `AlchemyContext.dev` decides: `dev: true` → `\"local\"`.\n * 3. Without an AlchemyContext (bare engine tests), default to `\"live\"`.\n */\nexport const defaultProviderMode = Effect.gen(function* () {\n if (yield* ProviderModePolicy)\n return \"live\";\n const ctx = yield* Effect.serviceOption(AlchemyContext);\n return Option.match(ctx, {\n onNone: () => \"live\",\n onSome: (c) => (c.dev ? \"local\" : \"live\"),\n });\n});\n//# sourceMappingURL=ProviderMode.js.map","import * as Context from \"effect/Context\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport { defaultProviderMode } from \"./ProviderMode.js\";\nexport const Provider = (type) => Context.Service()(type);\nconst withDefaultList = (service) => service.list ? service : { ...service, list: () => Effect.succeed([]) };\nexport const effect = (cls, eff) => Layer.effect(\n// @ts-expect-error\nProvider(cls.Type), Effect.map(eff, (service) => ({\n aliases: \"Aliases\" in cls ? cls.Aliases : undefined,\n ...withDefaultList(service),\n})));\nexport const succeed = (cls, service) => \n// @ts-expect-error\nLayer.succeed(Provider(cls.Type), {\n aliases: \"Aliases\" in cls ? cls.Aliases : undefined,\n ...withDefaultList(service),\n});\nexport const ProviderCollection = () => (id) => Context.Service()(id);\nexport const collection = (resources) => Effect.gen(function* () {\n const context = yield* Effect.context();\n const providers = Object.fromEntries(yield* Effect.all(resources.map((resource) => \"Provider\" in resource\n ? resource.Provider.pipe(Effect.map((provider) => [resource.Type, provider]))\n : Effect.succeed([\n resource.key,\n context.mapUnsafe.get(resource.key),\n ])), { concurrency: \"unbounded\" }));\n return {\n kind: \"ProviderCollection\",\n get: (service) => providers[service],\n providers,\n };\n});\nconst isProviderCollectionService = (value) => {\n return (typeof value === \"object\" &&\n value !== null &&\n \"kind\" in value &&\n value.kind === \"ProviderCollection\");\n};\n/**\n * Structural check for a {@link ProviderService} living in the Effect\n * context. Providers are keyed by their canonical resource type; when\n * searching for a legacy alias, the tag key won't match, so lookup has to\n * recognize provider services by shape.\n */\nconst isProviderService = (value) => typeof value === \"object\" &&\n value !== null &&\n \"reconcile\" in value &&\n typeof value.reconcile === \"function\" &&\n \"delete\" in value &&\n typeof value.delete === \"function\";\n/**\n * Resolve the concrete service for `mode` from a provider found in context.\n *\n * - `mode === undefined` → the service as registered (for dual\n * registrations that is the delegating service for the run's default\n * mode).\n * - `mode` given and the provider carries {@link ProviderService.modes} →\n * the (lazily built, memoized) variant for that mode.\n * - `mode` given but the provider is mode-agnostic → the service itself:\n * a single implementation satisfies every mode (hybrid), which is what\n * lets live-only resources (e.g. R2 buckets) participate in dev runs.\n */\nexport const providerForMode = (service, mode) => mode !== undefined && service.modes !== undefined\n ? service.modes[mode]\n : Effect.succeed(service);\n/**\n * Resolve where a resource's deploy-time binding clients should be routed:\n * its registration-captured {@link ResourceLike.Mode} (`Alchemy.remote()`\n * → `\"live\"`) or the run default (`alchemy dev` → `\"local\"`) — the same\n * resolution `Plan.make` applies to lifecycle operations — combined with\n * whether the provider registered a local data plane at all.\n */\nexport const describeDataPlane = (resource) => Effect.gen(function* () {\n const found = yield* tryFindProviderByType(resource.Type);\n if (Option.isNone(found))\n return { kind: \"unregistered\" };\n const provider = found.value;\n if (provider.modes === undefined)\n return { kind: \"agnostic\" };\n const mode = resource.Mode ?? (yield* defaultProviderMode);\n if (mode !== \"local\") {\n const layer = provider.liveDataPlane?.();\n return layer !== undefined\n ? { kind: \"live\", layer }\n : { kind: \"live\" };\n }\n if (provider.localDataPlane === undefined) {\n return { kind: \"undeclared\", providerType: resource.Type };\n }\n return { kind: \"local\", layer: provider.localDataPlane() };\n});\n/**\n * The data-plane override layer for a resource, or `undefined` when its\n * clients target the real cloud for any reason (see\n * {@link describeDataPlane} for which).\n */\nexport const resolveLocalDataPlane = (resource) => describeDataPlane(resource).pipe(Effect.map((plane) => (plane.kind === \"local\" ? plane.layer : undefined)));\nexport const findProviderByType = ((type, mode) => tryFindProviderByType(type, mode).pipe(Effect.flatMap(Option.match({\n onNone: () => Effect.die(`Provider not found for ${type}`),\n onSome: (provider) => Effect.succeed(provider),\n}))));\n/**\n * Typed provider lookup by resource class (or {@link Platform}) value. Infers\n * `R` from the class so `provider.list()` / `provider.read(...)` return the\n * resource's `Attributes` shape — prefer this over {@link findProviderByType},\n * which only takes the type string.\n */\nexport const findProvider = (resource, mode) => findProviderByType((resource.Type ?? resource.key), mode);\n/**\n * A persisted state row references a resource type with no registered\n * provider — the type was removed from the program (or renamed without an\n * alias) while its state row still exists (\"zombie\" row).\n *\n * This is FATAL at plan time: the program and state fundamentally disagree,\n * and without the provider the row's physical resource cannot be deleted\n * anyway, so proceeding would only strand it silently. The plan dies with\n * this error; nothing is deployed or destroyed until the provider is\n * re-registered (or aliased), or the state row is cleared manually.\n */\nexport class MissingProviderError extends Data.TaggedError(\"MissingProviderError\") {\n}\n/** Build the fatal plan-time error for a zombie state row. */\nexport const missingProviderError = (resourceType, fqn) => new MissingProviderError({\n message: `No provider is registered for resource type '${resourceType}' ` +\n `(state row '${fqn}'). The type was removed from the program or ` +\n \"renamed without an alias. Re-register the provider (or add the \" +\n \"old name to the resource's `aliases`) so this row can be \" +\n \"destroyed, or clear the state row manually if the physical \" +\n \"resource is already gone.\",\n resourceType,\n fqn,\n});\nexport const tryFindProviderByType = Effect.fn(function* (resourceType, mode) {\n // When a mode is requested, resolve the found service to that mode's\n // variant (building it lazily if needed) before returning.\n const found = yield* Effect.gen(function* () {\n const Tag = Provider(resourceType);\n const direct = yield* Effect.serviceOption(Tag);\n if (Option.isSome(direct)) {\n return direct;\n }\n const context = yield* Effect.context();\n for (const value of context.mapUnsafe.values()) {\n if (isProviderCollectionService(value)) {\n const provider = value.get(resourceType);\n if (provider) {\n return Option.some(provider);\n }\n }\n }\n // State persisted before a type rename carries the legacy name, so no\n // provider is keyed under it. Fall back to a provider that declares the\n // name in its `aliases` — scanning both bare Provider layers and the\n // members of every ProviderCollection.\n for (const value of context.mapUnsafe.values()) {\n if (isProviderCollectionService(value)) {\n for (const provider of Object.values(value.providers)) {\n if (provider.aliases?.includes(resourceType)) {\n return Option.some(provider);\n }\n }\n }\n else if (isProviderService(value) &&\n value.aliases?.includes(resourceType)) {\n return Option.some(value);\n }\n }\n return Option.none();\n });\n if (Option.isNone(found)) {\n return found;\n }\n return Option.some(yield* providerForMode(found.value, mode));\n});\n//# sourceMappingURL=Provider.js.map","import * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as Effectable from \"effect/Effectable\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport { AdoptPolicy } from \"./AdoptPolicy.js\";\nimport { toFqn } from \"./FQN.js\";\nimport { CurrentNamespace } from \"./Namespace.js\";\nimport * as Output from \"./Output.js\";\nimport { Provider } from \"./Provider.js\";\nimport { ConflictingProviderModeError, ProviderModePolicy, } from \"./ProviderMode.js\";\nimport { ref as makeRef } from \"./Ref.js\";\nimport { RemovalPolicy } from \"./RemovalPolicy.js\";\nimport { RenamePolicy } from \"./Rename.js\";\nimport { Self } from \"./Self.js\";\nimport { Stack } from \"./Stack.js\";\nexport const isResource = (value) => {\n // Require the full resource identity (Type AND FQN), not just `Type`:\n // user-authored prop objects legitimately carry a `Type` field (e.g.\n // Amazon States Language states like `{ Type: \"Pass\", End: true }` in a\n // Step Functions definition) and must not be mistaken for resources.\n // Locally-declared resources always expose both as own keys; refs\n // (`Resource.ref(...)`) deliberately report neither via `in` so they keep\n // routing through Output resolution.\n return (typeof value === \"object\" &&\n value !== null &&\n \"Type\" in value &&\n \"FQN\" in value);\n};\n/**\n * Does `value` reference an instance of the resource type `type` —\n * either a locally-declared resource or a `Resource.ref(...)` to one?\n *\n * Two constraints that ad-hoc guards get wrong for refs, which resolve\n * to Output-expression proxies:\n *\n * - Read `.Type` via property access (never `in`): the proxy answers\n * property reads with statically-known values but deliberately does\n * not report key existence (so {@link isResource} keeps routing refs\n * through Output resolution instead of the upstream-node lookup).\n * - Accept `typeof value === \"function\"`: the proxy's target is\n * callable (it needs an `apply` trap), so refs are not `\"object\"`.\n *\n * Either mistake silently rejects refs — in a Worker `env` that\n * degrades the binding to a plain JSON var.\n */\nexport const isResourceOfType = (value, type) => (typeof value === \"object\" || typeof value === \"function\") &&\n value !== null &&\n value.Type === type;\n/**\n * A tagged platform resource declared with neither props nor an inline\n * implementation was `yield*`ed, but its `.make(props, impl)` Layer never\n * built.\n *\n * Such a tag carries no configuration on its own — props AND impl both live\n * on the Layer — so its registration is a forward reference with `undefined`\n * props that the Layer's build repairs (in either order; see the #874\n * circular env-tag pattern). Props still `undefined` once the whole program\n * has evaluated means the Layer was never provided; `Plan.make` fails fast\n * with this error instead of letting the failure surface deep inside\n * whichever provider first reads a prop (e.g. `TypeError: undefined is not\n * an object (evaluating 'news.name')` in the Cloudflare Worker pre-create).\n */\nexport class MissingImplementationError extends Data.TaggedError(\"MissingImplementationError\") {\n}\nexport const missingImplementation = (type, id) => new MissingImplementationError({\n type,\n id,\n message: [\n `${type}<${id}> was yielded without its implementation.`,\n \"\",\n `\\`${id}\\` is declared as a bare tag — no props, no inline implementation — so both come from its \\`.make(...)\\` Layer:`,\n \"\",\n ` export class ${id} extends ${type}<${id}>()(\"${id}\") {}`,\n ` export const ${id}Live = ${id}.make({ /* props */ }, Effect.gen(function* () { /* ... */ }));`,\n \"\",\n `That Layer is not in scope where \\`${id}\\` is yielded. Provide it to the Stack's program:`,\n \"\",\n \" Alchemy.Stack(\",\n ` \"my-stack\",`,\n \" { providers, state },\",\n \" Effect.gen(function* () {\",\n ` const instance = yield* ${id};`,\n ` }).pipe(Effect.provide([${id}Live])),`,\n \" )\",\n \"\",\n `If \\`${id}\\` is not Effect-native, declare it with props instead: \\`()(\"${id}\", { /* props */ })\\`.`,\n ].join(\"\\n\"),\n});\n/**\n * Creates a resource constructor for a concrete resource type.\n *\n * The returned constructor registers the resource on the current stack,\n * resolves input props, exposes output attributes as `Output` expressions, and\n * records bindings contributed by policies and event sources. Resource\n * providers are attached separately through `.provider`.\n */\nexport function Resource(type, options) {\n const defaultRemovalPolicy = options?.defaultRemovalPolicy ?? \"destroy\";\n const self = Self(type);\n const constructor = (id, props) => Effect.gen(function* () {\n const stack = yield* Stack;\n const namespace = yield* CurrentNamespace;\n const fqn = toFqn(namespace, id);\n // `remote()` opts resources out of local emulation during dev. The\n // captured Mode is either \"live\" (pinned) or undefined (run default).\n // The Reference default is `undefined` — \"no explicit decoration\" —\n // which is distinct from an explicit `remote(false)`.\n const ambientPolicy = yield* ProviderModePolicy;\n const ambientMode = ambientPolicy\n ? \"live\"\n : undefined;\n const existing = stack.resources[fqn];\n if (existing) {\n // A resource may be `yield*`ed from several places (idempotent\n // registration). If a later site carries an *explicit* ambient\n // ProviderModePolicy that disagrees with what the resource was\n // registered with, the decorations are conflicting — fail loudly\n // instead of silently picking one. A later site with NO ambient\n // policy simply inherits the registered resource (the common\n // \"reference it from elsewhere\" pattern).\n if (ambientPolicy !== undefined && existing.Mode !== ambientMode) {\n return yield* Effect.die(new ConflictingProviderModeError({\n message: `Resource '${fqn}' was registered with provider mode ` +\n `'${existing.Mode ?? \"default\"}' but is now being registered ` +\n `with conflicting mode '${ambientMode ?? \"default\"}'. A ` +\n \"resource must resolve to a single provider mode: register \" +\n \"it once and close over the returned value, or make both \" +\n \"registration sites agree (e.g. wrap both in the same \" +\n \"`remote()` scope).\",\n fqn,\n existingMode: existing.Mode,\n conflictingMode: ambientMode,\n }));\n }\n // // TODO(sam): check if props are different and die\n return existing;\n }\n const bind = (...args) => typeof args[0] === \"string\"\n ? Effect.gen(function* () {\n const [sid, data] = args;\n (stack.bindings[fqn] ??= []).push({\n sid,\n data,\n });\n return undefined;\n })\n : (data) => {\n const stringifyBindArg = (arg) => {\n if (arg === undefined) {\n return undefined;\n }\n if (Array.isArray(arg)) {\n return arg\n .flatMap((item) => {\n const stringified = stringifyBindArg(item);\n return stringified === undefined ? [] : [stringified];\n })\n .join(\", \");\n }\n if (arg &&\n (typeof arg === \"object\" || typeof arg === \"function\")) {\n if (\"LogicalId\" in arg && typeof arg.LogicalId === \"string\") {\n return arg.LogicalId;\n }\n if (\"id\" in arg && typeof arg.id === \"string\") {\n return arg.id;\n }\n }\n return String(arg);\n };\n return bind(`${args[0]\n .flatMap((text, i) => {\n const stringified = stringifyBindArg(args[i + 1]);\n return stringified !== undefined\n ? [text, stringified]\n : [text];\n })\n .join(\"\")}`, data);\n };\n const target = {\n Type: type,\n Namespace: namespace,\n FQN: fqn,\n LogicalId: id,\n Props: props,\n Provider: ProviderTag,\n RemovalPolicy: yield* Effect.serviceOption(RemovalPolicy).pipe(Effect.map(Option.getOrElse(() => defaultRemovalPolicy))),\n Adopt: yield* Effect.serviceOption(AdoptPolicy).pipe(Effect.map(Option.getOrUndefined)),\n Mode: ambientMode,\n RequiresImplementation: options?.requiresImplementation || undefined,\n // Bare-string former ids resolve against the SAME namespace as the\n // resource's own id, so `renamedFrom(\"Site/Worker\")` declared at the\n // caller's level claims `<callerNs>/Site/Worker`; the `{ fqn }` form\n // is absolute (cross-namespace moves).\n FormerFqns: yield* Effect.serviceOption(RenamePolicy).pipe(Effect.map(Option.match({\n onNone: () => undefined,\n onSome: (formerIds) => formerIds.map((formerId) => typeof formerId === \"string\"\n ? toFqn(namespace, formerId)\n : formerId.fqn),\n }))),\n bind,\n toString() {\n return `Resource<${this.Type}>(${this.LogicalId})`;\n },\n [Symbol.toPrimitive](hint) {\n return hint === \"number\" ? NaN : this.toString();\n },\n };\n const Resource = (stack.resources[fqn] = new Proxy(target, {\n set: (t, prop, value) => {\n t[prop] = value;\n return true;\n },\n get: (t, prop) => typeof prop === \"symbol\" || prop in t\n ? t[prop]\n : new Output.PropExpr(Output.of(Resource), prop),\n }));\n Resource.Props = Effect.isEffect(props)\n ? // @effect-diagnostics-next-line anyUnknownInErrorContext:off\n yield* props.pipe(Effect.provide(Layer.mergeAll(Layer.succeed(Self, Resource), Layer.succeed(Self(type), Resource))))\n : props;\n return Resource;\n });\n const ProviderTag = Provider(type);\n const Service = {\n /**\n * Build a typed reference to a deployed instance of this resource\n * — in the current stack/stage by default, or in another via\n * `options`. Resolves to the same shape as `yield*\n * MyResource(\"id\", props)` so downstream code can read attributes\n * (`ref.someAttr`) exactly the way it would for a locally-declared\n * resource.\n */\n ref: (id, options) => Effect.succeed(Output.of(makeRef(id, options, type))),\n Type: type,\n Provider: ProviderTag,\n Self: self,\n Aliases: options?.aliases,\n };\n const ResourceClass = Object.assign((...args) => typeof args[0] === \"object\"\n ? Object.assign(ResourceClass, args[0])\n : constructor(...args), Service, \n // Make the constructor itself a real Effect: `yield* MyResource` resolves\n // to the constructor function (same as the old `asEffect()`), and\n // `Effect.isEffect(MyResource)` is now true so `Effect.all`/`forEach` work.\n Effectable.Prototype({\n label: `Resource<${type}>`,\n evaluate: () => Effect.succeed((id, props) => constructor(id, props)),\n }));\n return ResourceClass;\n}\n//# sourceMappingURL=Resource.js.map","import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport * as Redacted from \"effect/Redacted\";\n/**\n * Canonicalize a logical key into a key that is safe to use as the name of an\n * environment variable / binding (`[a-zA-Z][a-zA-Z0-9_]*`).\n *\n * `RuntimeContext.set`/`get` are dumb key/value stores: they read and write the\n * key **verbatim**. It is the *caller's* responsibility to hand them a\n * canonical key, since the caller is the one that knows the logical key may\n * contain `.`/`-` (e.g. a dotted config name from `Platform`, or an\n * `Output.toString()` like `\"QueueSinkQueue.queueUrl\"`). Callers run the key\n * through this before calling `set`/`get` so both sides agree.\n */\nexport const sanitizeKey = (key) => key.replaceAll(/[^a-zA-Z0-9]/g, \"_\");\n/**\n * Detect the (already JSON-parsed) {@link RedactedMarker} shape. After\n * `JSON.parse` the marker is a plain object — `Redacted.isRedacted` is\n * always `false` on it — so detection is structural.\n */\nexport const isRedactedMarker = (value) => typeof value === \"object\" &&\n value !== null &&\n value._tag === \"Redacted\" &&\n \"value\" in value;\n/**\n * Returns true when {@link unpackEnvValue}'s `JSON.parse` would reinterpret\n * the raw string as something other than itself — a number (`\"123\"`), a\n * boolean, `null`, or a JSON document. Such strings must stay\n * `JSON.stringify`-packed; everything else round-trips verbatim through the\n * parse-failure fallback.\n */\nconst parsesAsJson = (value) => {\n try {\n JSON.parse(value);\n return true;\n }\n catch {\n return false;\n }\n};\n/**\n * Serialize a binding value for an env var: `Redacted` values are packed as\n * a {@link RedactedMarker}, non-string values as JSON.\n *\n * A plain string is stored **verbatim** whenever `JSON.parse` would reject\n * it — which is almost every real-world string (names, URLs, ids). Packing\n * those too would put `\"my-queue\"` (quote characters included) on the wire,\n * where anything that consumes the raw binding without going through\n * {@link unpackEnvValue} — the Cloudflare dashboard, a hand-written env\n * read, a queue-name comparison against `MessageBatch.queue` — sees the\n * quoted form and mismatches (#1243). Only ambiguous strings (`\"123\"`,\n * `\"null\"`, JSON documents) keep the pack so the read side can't\n * reinterpret them.\n */\nexport const packEnvValue = (value) => Redacted.isRedacted(value)\n ? JSON.stringify({\n _tag: \"Redacted\",\n value: Redacted.value(value),\n })\n : typeof value === \"string\" && !parsesAsJson(value)\n ? value\n : JSON.stringify(value);\n/**\n * Like {@link packEnvValue}, but a `Redacted` input keeps its `Redacted`\n * wrapper on the *outside* of the packed string, so deploy-time code can\n * route secrets through a dedicated channel (Cloudflare `secret_text`,\n * Secrets Store) instead of leaking them as plain env vars. The inner\n * payload still carries the marker for the runtime `get` accessor.\n */\nexport const packEnvValueKeepRedacted = (value) => Redacted.isRedacted(value)\n ? Redacted.make(packEnvValue(value))\n : packEnvValue(value);\n/**\n * Parse an env-var string produced by {@link packEnvValue} back into its\n * value: rebuild `Redacted` from the marker, return other JSON values\n * as-is, and fall back to the raw string for non-JSON input (a verbatim\n * string from `packEnvValue`, or an env var the user set directly).\n * `undefined` passes through.\n *\n * Runtime `get` accessors MUST feed this from the raw environment\n * (`process.env[key]` / the platform env object) — never through\n * `Config.string`: the ambient runtime `ConfigProvider` reifies bound\n * values (unwrapping the marker before it could be detected here), and\n * during init the ambient provider is the interceptor installed in\n * `Platform.ts`, whose runtime branch calls back into `ctx.get(key)` —\n * resolving through `Config` would re-enter it for the same key and\n * recurse forever.\n */\nexport const unpackEnvValue = (raw) => {\n if (raw === undefined) {\n return undefined;\n }\n try {\n const parsed = JSON.parse(raw);\n if (isRedactedMarker(parsed)) {\n return Redacted.make(parsed.value);\n }\n return parsed;\n }\n catch {\n return raw; // assume it's just a string\n }\n};\n/**\n * Context of the runtime environment.\n *\n * E.g. the context of a running Worker, Task, Process, Function\n */\nexport class RuntimeContext extends Context.Service()(\"RuntimeContext\") {\n static phantom = Layer.empty;\n}\nexport const CurrentRuntimeContext = Effect.serviceOption(RuntimeContext).pipe(Effect.map(Option.getOrUndefined));\n//# sourceMappingURL=RuntimeContext.js.map","import * as Context from \"effect/Context\";\nexport class Stage extends Context.Service()(\"Stage\") {\n}\n//# sourceMappingURL=Stage.js.map","import * as Context from \"effect/Context\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nexport const isActionState = (s) => !!s && s.kind === \"action\";\nexport const isResourceState = (s) => !!s && s.kind !== \"task\";\nexport class StateStoreError extends Data.TaggedError(\"StateStoreError\") {\n}\nexport class State extends Context.Service()(\"alchemy/State\") {\n}\n//# sourceMappingURL=State.js.map","import * as Predicate from \"effect/Predicate\";\nimport * as EffectRecord from \"effect/Record\";\nimport * as Redacted from \"effect/Redacted\";\nexport const isPrimitive = (value) => value === undefined ||\n value === null ||\n typeof value === \"boolean\" ||\n typeof value === \"number\" ||\n typeof value === \"string\" ||\n typeof value === \"symbol\" ||\n typeof value === \"bigint\";\nexport const isPlainObject = (value) => {\n if (!Predicate.isObject(value))\n return false;\n return Object.getPrototypeOf(value) === Object.prototype;\n};\n/**\n * Is `value` plain data the engine's deep walkers may traverse — an array,\n * or an object whose prototype is `Object.prototype`/`null`?\n *\n * Everything else (class instances: effect's Effect/Layer/Context, Dates,\n * SDK config objects, functions, ...) is a LEAF for every deep walker in\n * the engine. The engine cannot meaningfully evaluate, diff, or persist\n * *through* a foreign class instance — rebuilding one entry-by-entry strips\n * its prototype — and walking one is not safe: effect ≥4.0.0-beta.103's\n * Context is self-referential (`cacheRoot` points back at itself), which\n * sent the naive walk-everything traversal into unbounded recursion\n * (#1082). Resources and Outputs are detected structurally *before* this\n * gate, so dependencies declared in plain props are unaffected.\n */\nexport const isPlainData = (value) => {\n if (Array.isArray(value))\n return true;\n if (typeof value !== \"object\" || value === null)\n return false;\n const proto = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n};\n/**\n * Rebuild a plain-data value by mapping each child through `walk`,\n * preserving the shape (array → array, object → object).\n *\n * Cycle-guarded by ancestor path: a value that appears on its own ancestor\n * chain is a true cycle and becomes `undefined` (it could never serialize\n * or persist anyway). The guard is scoped to the current path — NOT a\n * visited-set — so a diamond (the same object legitimately referenced from\n * two places) is rebuilt in both places. Sync DFS only: add/delete around\n * the recursion is race-free. (#1082)\n */\nexport const mapPlainData = (value, ancestors, walk) => {\n if (ancestors.has(value))\n return undefined;\n ancestors.add(value);\n try {\n return Array.isArray(value)\n ? value.map(walk)\n : Object.fromEntries(Object.entries(value).map(([key, child]) => [key, walk(child)]));\n }\n finally {\n ancestors.delete(value);\n }\n};\nexport const stripFields = (value, empty) => {\n if (Array.isArray(value)) {\n return value.map((item) => stripFields(item, empty));\n }\n if (!isPlainObject(value))\n return value;\n return EffectRecord.map(EffectRecord.filter(value, (entry) => entry !== empty), (entry) => stripFields(entry, empty));\n};\nexport const stripNullFields = (value) => stripFields(value, null);\nexport const stripUndefinedFields = (value) => stripFields(value, undefined);\nexport const unwrapRedacted = (value) => {\n if (Redacted.isRedacted(value)) {\n return Redacted.value(value);\n }\n if (Array.isArray(value)) {\n return value.map(unwrapRedacted);\n }\n if (!isPlainObject(value))\n return value;\n return EffectRecord.map(value, unwrapRedacted);\n};\n//# sourceMappingURL=data.js.map","import * as Config from \"effect/Config\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport { pipe } from \"effect/Function\";\nimport { SingleShotGen } from \"effect/Utils\";\nimport { getRefMetadata, isRef } from \"./Ref.js\";\nimport { isResource } from \"./Resource.js\";\nimport { RuntimeContext, sanitizeKey } from \"./RuntimeContext.js\";\nimport { Stack } from \"./Stack.js\";\nimport { Stage } from \"./Stage.js\";\nimport * as State from \"./State/State.js\";\nimport { isPlainData, isPrimitive } from \"./Util/data.js\";\nconst inspect = Symbol.for(\"nodejs.util.inspect.custom\");\nexport const of = (resource) => {\n if (isRef(resource)) {\n const metadata = getRefMetadata(resource);\n return new RefExpr(metadata.stack, metadata.stage, metadata.id, \n // Surface the target's resource type and logical id as\n // statically-known properties so duck-typing classifiers (Worker\n // env bindings) and label/bind templates (`${resource.LogicalId}`,\n // `host.bind\\`...\\``) identify the ref exactly like a\n // locally-declared resource.\n {\n LogicalId: metadata.id,\n ...(metadata.type !== undefined ? { Type: metadata.type } : {}),\n });\n }\n return new ResourceExpr(resource);\n};\nexport const asOutput = (t) => isOutput(t)\n ? t\n : Effect.isEffect(t)\n ? new EffectExpr(VoidExpr, () => t)\n : new LiteralExpr(t);\n/**\n * Lift a plan-time Effect into an {@link Output}.\n *\n * The effect runs when the stack resolves the Output during plan/deploy —\n * with the stack's services (cloud credentials, region, ...) provided — and\n * never inside a deployed runtime: constructing the Output is inert, so\n * helpers built on `fromEffect` (e.g. AMI lookups) are safe to call from\n * composition code that is re-executed inside a Function/Worker/Instance\n * bundle.\n *\n * The effect must not fail (`E = never`) — die with a descriptive error for\n * unresolvable lookups.\n */\nexport const fromEffect = (effect) => new EffectExpr(VoidExpr, () => effect);\nexport const isOutput = (value) => value &&\n (typeof value === \"object\" || typeof value === \"function\") &&\n ExprSymbol in value;\nexport const ExprSymbol = Symbol.for(\"alchemy/Expr\");\nconst exprKind = (node) => node?.[ExprSymbol]?.kind ?? node?.kind;\nexport const isExpr = (value) => value &&\n (typeof value === \"object\" || typeof value === \"function\") &&\n ExprSymbol in value;\nexport class BaseExpr {\n // we use a kind tag instead of instanceof to protect ourselves from duplicate alchemy module imports\n constructor() { }\n as() {\n return this;\n }\n [Symbol.iterator]() {\n // @ts-expect-error - TODO(sam): fix this (works at runtime, but maybe indicates a bad assumption)\n return new SingleShotGen(this.asEffect());\n }\n asEffect() {\n return this.bind(this.toString());\n }\n bind(id) {\n // `set`/`get` store keys verbatim, so canonicalize here (the caller's job).\n const key = sanitizeKey(id);\n return RuntimeContext.pipe(Effect.flatMap((ctx) => Effect.map(ctx.set(key, this), (k) => ctx.get(k))));\n }\n pipe(...fns) {\n // @ts-expect-error\n return pipe(this, ...fns);\n }\n toString() {\n return this[inspect]();\n }\n}\nexport const isResourceExpr = (node) => exprKind(node) === \"ResourceExpr\";\nexport class ResourceExpr extends BaseExpr {\n src;\n stables;\n kind = \"ResourceExpr\";\n constructor(src, stables) {\n super();\n this.src = src;\n this.stables = stables;\n return proxy(this);\n }\n [inspect]() {\n return this.src.LogicalId;\n }\n}\nexport const isPropExpr = (node) => exprKind(node) === \"PropExpr\";\nexport class PropExpr extends BaseExpr {\n expr;\n identifier;\n kind = \"PropExpr\";\n constructor(expr, identifier) {\n super();\n this.expr = expr;\n this.identifier = identifier;\n return proxy(this);\n }\n [inspect]() {\n return `${this.expr[inspect]()}.${this.identifier.toString()}`;\n }\n}\nexport const literal = (value) => new LiteralExpr(value);\nexport const isLiteralExpr = (node) => exprKind(node) === \"LiteralExpr\";\nexport class LiteralExpr extends BaseExpr {\n value;\n kind = \"LiteralExpr\";\n constructor(value) {\n super();\n this.value = value;\n return proxy(this);\n }\n [inspect]() {\n return String(this.value);\n }\n}\nexport const VoidExpr = new LiteralExpr(void 0);\nexport const map = ((...args) => args.length === 1\n ? (output) => new ApplyExpr(output, args[0])\n : new ApplyExpr(args[0], args[1]));\n//Output.ApplyExpr<any, any, ResourceLike, any>\nexport const isApplyExpr = (node) => exprKind(node) === \"ApplyExpr\";\nexport class ApplyExpr extends BaseExpr {\n expr;\n f;\n kind = \"ApplyExpr\";\n constructor(expr, f) {\n super();\n this.expr = expr;\n this.f = f;\n return proxy(this);\n }\n [inspect]() {\n return `${this.expr[inspect]()}.map(${this.f.toString()})`;\n }\n}\nexport const mapEffect = (fn) => (output) => new EffectExpr(output, fn);\nexport const flatMap = ((...args) => args.length === 1\n ? (output) => new FlatMapExpr(output, args[0])\n : new FlatMapExpr(args[0], args[1]));\nexport const isFlatMapExpr = (node) => exprKind(node) === \"FlatMapExpr\";\nexport class FlatMapExpr extends BaseExpr {\n expr;\n f;\n kind = \"FlatMapExpr\";\n constructor(expr, f) {\n super();\n this.expr = expr;\n this.f = f;\n return proxy(this);\n }\n [inspect]() {\n return `${this.expr[inspect]()}.flatMap(${this.f.toString()})`;\n }\n}\nexport const isEffectExpr = (node) => exprKind(node) === \"EffectExpr\";\nexport class EffectExpr extends BaseExpr {\n expr;\n f;\n kind = \"EffectExpr\";\n constructor(expr, f) {\n super();\n this.expr = expr;\n this.f = f;\n return proxy(this);\n }\n [inspect]() {\n return `${this.expr[inspect]()}.mapEffect(${this.f.toString()})`;\n }\n}\nexport const isNamedExpr = (node) => exprKind(node) === \"NamedExpr\";\n/**\n * Wraps another `Expr` and overrides its `toString()` / inspect output.\n *\n * `BaseExpr` derives the binding id from `this.toString()`, so\n * wrapping an expression in `NamedExpr` makes that derived id stable and\n * caller-controlled (e.g. an env var name like `\"API_KEY\"`).\n */\nexport class NamedExpr extends BaseExpr {\n expr;\n bindingName;\n kind = \"NamedExpr\";\n constructor(expr, bindingName) {\n super();\n this.expr = expr;\n this.bindingName = bindingName;\n return proxy(this);\n }\n [inspect]() {\n return this.bindingName;\n }\n}\nexport const named = (expr, name) => new NamedExpr(expr, name);\nexport const all = (...outs) => new AllExpr(outs);\nexport const isAllExpr = (node) => exprKind(node) === \"AllExpr\";\nexport class AllExpr extends BaseExpr {\n outs;\n kind = \"AllExpr\";\n constructor(outs) {\n super();\n this.outs = outs;\n return proxy(this);\n }\n [inspect]() {\n return `all(${this.outs.map((out) => out[inspect]()).join(\", \")})`;\n }\n}\nexport const isRefExpr = (node) => exprKind(node) === \"RefExpr\";\nexport class RefExpr extends BaseExpr {\n stack;\n stage;\n resourceId;\n stables;\n kind = \"RefExpr\";\n constructor(stack, stage, resourceId, \n /**\n * Statically-known properties of the ref's target (currently its\n * resource `Type`), served as literals by the proxy instead of\n * `PropExpr`s — mirrors {@link ResourceExpr}'s `stables`.\n */\n stables) {\n super();\n this.stack = stack;\n this.stage = stage;\n this.resourceId = resourceId;\n this.stables = stables;\n return proxy(this);\n }\n [inspect]() {\n return `ref(${this.resourceId}, { stack: ${this.stack}, stage: ${this.stage} })`;\n }\n}\nexport const isStackRefExpr = (node) => exprKind(node) === \"StackRefExpr\";\n/**\n * A reference to the persisted output of a Stack at `(stack, stage)`.\n *\n * Resolved at evaluation time by reading `state.getOutput({ stack,\n * stage })`. Distinct from {@link RefExpr}, which references a\n * single resource's attributes within a stack/stage. `stage` may be\n * `undefined`, in which case it falls back to the current stage.\n */\nexport class StackRefExpr extends BaseExpr {\n stack;\n stage;\n kind = \"StackRefExpr\";\n constructor(stack, stage) {\n super();\n this.stack = stack;\n this.stage = stage;\n return proxy(this);\n }\n [inspect]() {\n return `stackRef(${this.stack}${this.stage ? `, { stage: ${this.stage} }` : \"\"})`;\n }\n}\n/**\n * Build an `Output<A>` referencing the persisted output of another\n * Stack. The returned Effect resolves to a lazy `Output<A>` whose\n * value is read from the state store at plan/apply time.\n *\n * Returns `Effect<Output<A>>` (not `Output<A>` directly) so that\n * `yield* Output.stackRef(...)` reads ergonomically inside an Effect\n * generator and lines up with `Resource.ref` and `Stack.stage.<name>`.\n */\nexport const stackRef = (stack, options = {}) => Effect.succeed(new StackRefExpr(stack, options.stage));\nexport const filter = (...outs) => outs.filter(isOutput);\nexport const interpolate = (template, ...args) => all(...args.map((arg) => (isOutput(arg) ? arg : literal(arg)))).pipe(map((args) => template\n .map((str, i) => str + (args[i] == null ? \"\" : String(args[i])))\n .join(\"\")));\nfunction proxy(self) {\n const target = Object.assign(() => { }, self);\n if (inspect in self) {\n Object.defineProperty(target, inspect, {\n value: self[inspect].bind(self),\n configurable: true,\n });\n }\n const proxy = new Proxy(target, {\n has: (_, prop) => prop === ExprSymbol || prop === inspect\n ? true\n : // Statically-known literal props (`Type`, `LogicalId` on\n // resource/ref exprs) are visible to `in` checks so duck-typing\n // code paths (e.g. `\"LogicalId\" in arg`) treat them like real\n // properties, matching what `get` serves.\n ((isResourceExpr(self) || isRefExpr(self)) &&\n self.stables !== undefined &&\n prop in self.stables) ||\n prop in self,\n get: (target, prop) => prop === Symbol.toPrimitive\n ? (hint) => {\n // Any JS-level coercion of an unresolved Output produces a\n // placeholder that *looks* like a real value but isn't:\n //\n // - `string` / `default` hints (`${output}`, `output + \"\"`,\n // `==` against a primitive) previously fell through to\n // `self.toString()` and returned the inspect form\n // (e.g. \"tunnel.tunnelId\"). The bogus string flowed\n // into resource props and into the cloud — only\n // surfacing as an opaque downstream error (see PR\n // description for a real Cloudflare DNS landing).\n //\n // - `number` hint (`+output`, `output * 2`,\n // `Math.max(0, output)`) previously returned NaN, which\n // propagates silently through arithmetic and lands as\n // \"the API rejected a NaN field\" much later.\n //\n // All three hints fail loud at the coercion site with a\n // pointer to the right composition API.\n throw new Error(`Cannot coerce Output<${self[inspect]()}> to a ` +\n `${hint === \"number\" ? \"number\" : \"string\"} via JS coercion. ` +\n `Use Output.interpolate\\`...\\` or Output.map(output, fn) ` +\n `to compose Outputs — the value isn't known until deploy time.`);\n }\n : prop === ExprSymbol\n ? self\n : prop === inspect\n ? target[inspect]\n : (isResourceExpr(self) || isRefExpr(self)) &&\n self.stables &&\n prop in self.stables\n ? self.stables[prop]\n : prop in self\n ? typeof self[prop] === \"function\" &&\n !(\"kind\" in self)\n ? new PropExpr(proxy, prop)\n : self[prop]\n : new PropExpr(proxy, prop),\n apply: (_, thisArg, args) => {\n if (isPropExpr(self)) {\n // Method-style combinators on an Output proxy. `map`/`apply` and\n // `mapEffect`/`effect` are aliases that mirror the standalone\n // `Output.map` / `Output.mapEffect` / `Output.flatMap` functions.\n if (self.identifier === \"map\" || self.identifier === \"apply\") {\n return new ApplyExpr(self.expr, args[0]);\n }\n else if (self.identifier === \"mapEffect\" ||\n self.identifier === \"effect\") {\n return new EffectExpr(self.expr, args[0]);\n }\n else if (self.identifier === \"flatMap\") {\n return new FlatMapExpr(self.expr, args[0]);\n }\n }\n return undefined;\n },\n });\n return proxy;\n}\n/// Evaluation\nexport class MissingSourceError extends Data.TaggedError(\"MissingSourceError\") {\n}\nexport class InvalidReferenceError extends Data.TaggedError(\"InvalidReferenceError\") {\n}\nexport const evaluate = (expr, upstream, ancestors = new Set()) => Effect.gen(function* () {\n if (isResource(expr)) {\n const srcId = expr.FQN;\n const src = upstream[srcId];\n if (!src) {\n // type-safety should prevent this but let the caller decide how to handle it\n return yield* new MissingSourceError({\n message: `Source ${srcId} not found`,\n srcId,\n });\n }\n return src;\n }\n else if (isOutput(expr)) {\n if (isResourceExpr(expr)) {\n const srcId = expr.src.FQN;\n const src = upstream[srcId];\n if (!src) {\n // type-safety should prevent this but let the caller decide how to handle it\n return yield* new MissingSourceError({\n message: `Source ${srcId} not found`,\n srcId,\n });\n }\n return src;\n }\n else if (isLiteralExpr(expr)) {\n return expr.value;\n }\n else if (isApplyExpr(expr)) {\n return expr.f(yield* evaluate(expr.expr, upstream));\n }\n else if (isEffectExpr(expr)) {\n // TODO(sam): the same effect shoudl be memoized so that it's not run multiple times\n return yield* expr.f(yield* evaluate(expr.expr, upstream));\n }\n else if (isFlatMapExpr(expr)) {\n // Resolve the source, hand it to `f` to produce a new Output, then\n // recursively evaluate that Output (flattening one level).\n const value = yield* evaluate(expr.expr, upstream);\n return yield* evaluate(expr.f(value), upstream);\n }\n else if (isAllExpr(expr)) {\n return yield* Effect.all(expr.outs.map((out) => evaluate(out, upstream)));\n }\n else if (isPropExpr(expr)) {\n return (yield* evaluate(expr.expr, upstream))?.[expr.identifier];\n }\n else if (isNamedExpr(expr)) {\n return yield* evaluate(expr.expr, upstream);\n }\n else if (isRefExpr(expr)) {\n const state = yield* yield* State.State;\n const stack = expr.stack ?? (yield* Stack).name;\n const stage = expr.stage ?? (yield* Stage);\n const resource = yield* state.get({\n stack,\n stage,\n fqn: expr.resourceId,\n });\n if (!resource) {\n return yield* Effect.fail(new InvalidReferenceError({\n message: `Reference to '${expr.resourceId}' in stack '${stack}' and stage '${stage}' not found. Have you deployed '${stage}' or '${stack}'?`,\n stack,\n stage,\n resourceId: expr.resourceId,\n }));\n }\n // RefExpr targets persisted resources; tasks aren't cross-stack\n // referenceable. Return the resource's output attrs, otherwise the\n // task's output value, otherwise undefined.\n return resource.attr ?? resource.output;\n }\n else if (isStackRefExpr(expr)) {\n const state = yield* yield* State.State;\n const stack = expr.stack;\n const stage = expr.stage ?? (yield* Stage);\n const output = yield* state.getOutput({ stack, stage });\n if (output == null) {\n return yield* Effect.fail(new InvalidReferenceError({\n message: `Reference to stack '${stack}' at stage '${stage}' not found. Have you deployed stage '${stage}' of '${stack}'?`,\n stack,\n stage,\n resourceId: stack,\n }));\n }\n return output;\n }\n }\n if (Config.isConfig(expr)) {\n // Resolve Config against the deploy environment — see resolveInput in\n // Plan.ts for rationale. `Config.redacted` resolves to a `Redacted`,\n // which stays opaque via the leaf fallthrough below.\n return yield* evaluate(yield* expr, upstream, ancestors);\n }\n else if (isPlainData(expr)) {\n if (ancestors.has(expr)) {\n return undefined;\n }\n const nested = new Set(ancestors).add(expr);\n if (Array.isArray(expr)) {\n return yield* Effect.all(expr.map((item) => evaluate(item, upstream, nested)));\n }\n return Object.fromEntries(yield* Effect.all(Object.entries(expr).map(([key, value]) => evaluate(value, upstream, nested).pipe(Effect.map((value) => [key, value])))));\n }\n // Everything else is a leaf returned by identity: Duration, Redacted,\n // Date, and effect runtime values (a Worker's `exports` carries each\n // DO's `constructor` Effect and captured `services` Context). Rebuilding\n // a class instance entry-by-entry strips its prototype, and effect\n // ≥4.0.0-beta.103's Context is cyclic (#1082). This sits after\n // `Config.isConfig` on purpose — Configs are Effects but must resolve.\n return expr;\n});\nexport const hasOutputs = (value) => Object.keys(upstreamAny(value)).length > 0;\n/**\n * Cycle guard shared by the upstream walkers. Marks `value` as visited in\n * `seen`; returns true when it was already visited (the caller returns `{}`\n * — the first visit already contributed the subtree's resources to the\n * FQN-keyed union, so skipping repeats is lossless).\n */\nconst alreadySeen = (value, seen) => {\n if (seen.has(value)) {\n return true;\n }\n seen.add(value);\n return false;\n};\n// The dependency rule (#1082): a Resource or Output IS a dependency; plain\n// data (arrays, plain objects) is traversed to find them; every other value\n// — class instances like effect's Effect/Layer/Context, Dates, SDK objects,\n// functions — is a leaf. See `isPlainData` in Util/data.ts for why leaves\n// must never be walked.\nexport const upstreamAny = (value, seen = new WeakSet()) => {\n if (isResource(value)) {\n return { [value.FQN]: value };\n }\n else if (isExpr(value)) {\n return upstream(value, seen);\n }\n else if (isPlainData(value)) {\n if (alreadySeen(value, seen)) {\n return {};\n }\n return Object.assign({}, ...Object.values(value).map((value) => resolveUpstream(value, seen)));\n }\n return {};\n};\n// TODO(sam): add a type\nexport const upstream = (expr, seen = new WeakSet()) => {\n if (isResource(expr)) {\n return {\n [expr.FQN]: expr,\n };\n }\n else if (isResourceExpr(expr)) {\n return {\n [expr.src.FQN]: expr.src,\n };\n }\n else if (isPropExpr(expr)) {\n return upstream(expr.expr, seen);\n }\n else if (isAllExpr(expr)) {\n return Object.assign({}, ...expr.outs.map((out) => upstream(out, seen)));\n }\n else if (isEffectExpr(expr) ||\n isApplyExpr(expr) ||\n isFlatMapExpr(expr) ||\n isNamedExpr(expr)) {\n return upstream(expr.expr, seen);\n }\n else if (isPlainData(expr)) {\n if (alreadySeen(expr, seen)) {\n return {};\n }\n return Object.values(expr)\n .map((v) => upstream(v, seen))\n .reduce(toObject, {});\n }\n return {};\n};\n// TODO(sam): add a type\nexport const resolveUpstream = (value, seen = new WeakSet()) => {\n if (isPrimitive(value)) {\n return {};\n }\n else if (isResource(value)) {\n return { [value.FQN]: value };\n }\n else if (isOutput(value)) {\n return upstream(value, seen);\n }\n else if (isPlainData(value)) {\n if (alreadySeen(value, seen)) {\n return {};\n }\n return Object.fromEntries(Object.values(value)\n .map((v) => resolveUpstream(v, seen))\n .flatMap(Object.entries));\n }\n return {};\n};\nconst toObject = (acc, v) => ({\n ...acc,\n ...v,\n});\nexport const log = (_value) => Effect.gen(function* () {\n // TODO(sam): implement a log effect\n});\nexport const toEnvKey = (id, suffix) => `${replace(toUpper(id))}_${replace(toUpper(suffix))}`;\nexport const toUpper = (str) => str.toUpperCase();\nconst replace = (str) => str.replace(/-/g, \"_\");\n//# sourceMappingURL=Output.js.map","import * as ConfigProvider from \"effect/ConfigProvider\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Option from \"effect/Option\";\nexport const loadConfigProvider = (envFile) => {\n if (Option.isSome(envFile)) {\n return ConfigProvider.fromDotEnv({ path: envFile.value }).pipe(Effect.map((dotEnv) => ConfigProvider.orElse(dotEnv, ConfigProvider.fromEnv())));\n }\n return Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const exists = yield* fs.exists(\".env\");\n if (!exists) {\n return ConfigProvider.fromEnv();\n }\n return ConfigProvider.orElse(ConfigProvider.fromEnv(), yield* ConfigProvider.fromDotEnv({ path: \".env\" }));\n });\n};\n//# sourceMappingURL=ConfigProvider.js.map","import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Effectable from \"effect/Effectable\";\nexport const effectClass = ((impl) => impl === undefined\n ? (innerImpl) => effectClass(innerImpl)\n : Object.assign(class {\n }, \n // Spreading the Effect prototype onto the class (static side) makes the\n // class itself a real Effect — `Effect.isEffect(X)` is true, so\n // `Effect.all([X])` / `Effect.forEach` work — and subclasses\n // (`class Y extends effectClass(impl)`) inherit the protocol statically.\n Effectable.Prototype({\n label: \"alchemy/EffectClass\",\n evaluate: () => impl,\n })));\nexport const taggedFunction = (tag, fn) => {\n // The Proxy below forwards every Effect-protocol key to `tag` (already an\n // Effect), so `asEffect`/`[Symbol.iterator]`/`pipe` need no explicit\n // override — only `toString` diverges.\n const overrides = {\n toString: () => `${tag.toString()}.${fn.name}`,\n };\n return new Proxy(fn, {\n get: (target, prop, receiver) => Reflect.has(overrides, prop)\n ? Reflect.get(overrides, prop, receiver)\n : Reflect.has(target, prop)\n ? Reflect.get(target, prop, receiver)\n : Reflect.get(tag, prop, tag),\n has: (target, prop) => Reflect.has(overrides, prop) ||\n Reflect.has(target, prop) ||\n Reflect.has(tag, prop),\n });\n};\nexport const isYieldableEffect = (value) => Effect.isEffect(value) &&\n typeof value[Symbol.iterator] ===\n \"function\";\nexport const isEffectClassLike = (value) => typeof value === \"function\" &&\n typeof value.asEffect === \"function\";\nexport const isYieldableEffectLike = (value) => (isYieldableEffect(value) || isEffectClassLike(value)) &&\n !(\"~alchemy/Kind\" in value);\nexport const toEffectInterface = (raw) => ({\n raw,\n ...Object.fromEntries(Object.entries(raw).map(([key, value]) => [\n key,\n typeof value === \"function\"\n ? (...args) => Effect.tryPromise(async () => value(...args))\n : value,\n ])),\n});\n//# sourceMappingURL=effect.js.map","import * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Logger from \"effect/Logger\";\nimport { Path } from \"effect/Path\";\nimport { AlchemyContext } from \"../AlchemyContext.js\";\nexport const fileLogger = Effect.fn(function* (...segments) {\n const { dotAlchemy } = yield* AlchemyContext;\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path;\n const logFile = path.join(dotAlchemy, \"log\", ...segments);\n yield* fs.makeDirectory(path.dirname(logFile), { recursive: true });\n return yield* Logger.formatLogFmt.pipe(Logger.toFile(logFile, {\n flag: \"a\",\n }));\n});\n//# sourceMappingURL=FileLogger.js.map","import * as Effect from \"effect/Effect\";\nimport * as NodeNet from \"node:net\";\n/**\n * The process's working directory, captured ONCE at module load.\n *\n * Relative user paths (Vite roots, asset directories) must resolve against\n * this instead of a live `process.cwd()` read: third-party code sharing the\n * process can change the working directory transiently — most notably\n * cross-spawn, which `process.chdir`s into a spawn's `cwd` to resolve its\n * binary on PATH and then chdirs back. A live read racing that window\n * resolves against an unrelated directory. (`State/LocalState.ts` anchors\n * the state tree the same way, for the same reason.)\n */\nexport const initialCwd = process.cwd();\n/**\n * Opt out of cross-spawn's temporary `process.chdir` dance.\n *\n * cross-spawn (bundled inside vite, wrangler, next, tinyexec, playwright,\n * tsx, prisma, …) resolves a spawn's binary by `process.chdir`ing the\n * WHOLE parent process into the spawn's `cwd`, calling `which.sync`, and\n * chdiring back. In an alchemy process — which runs many resource builds\n * and hashers concurrently on one event loop — every fiber that touches a\n * relative path can race that window and resolve against an unrelated\n * directory.\n *\n * `process.chdir.disabled = true` is NODE'S OWN convention: Node sets it\n * on `process.chdir` inside worker threads (where chdir is forbidden),\n * and cross-spawn checks it to skip the dance. Setting it on the main\n * thread opts us into the exact mode every cross-spawn copy already runs\n * in inside jest/vitest/playwright workers daily — not an untested path.\n * The flag is purely advisory: `process.chdir` itself keeps working, and\n * an audit of the dependency tree shows the only readers are bundled\n * cross-spawn copies; nothing else writes or consults it.\n *\n * Behavior delta: a spawn combining a custom `cwd` with a command that is\n * neither absolute nor on PATH (e.g. `./scripts/build.sh`). POSIX still\n * works (cross-spawn falls back to the raw command; the OS resolves it in\n * the child's cwd). On Windows that shape can fail to resolve — the same\n * limitation those tools already have inside worker threads. Everything\n * alchemy and its toolchains spawn is absolute or on PATH, and `Command`\n * resources use effect's ChildProcess (plain spawn, no cross-spawn).\n */\nexport const disableCrossSpawnChdir = () => {\n process.chdir.disabled = true;\n};\nexport const isTransformTypesSupported = (version = process.versions.node) => {\n const [major, minor] = version.split(\".\").map(Number);\n return (major === 22 && minor >= 7) || (major >= 23 && major < 26);\n};\n/**\n * Node CLI flags that transparently transform TypeScript types so `.ts`\n * entry points work the same way they do under Bun. Empty when the running\n * Node doesn't support (or no longer needs) the experimental flag.\n */\nexport const transformTypesFlags = (version = process.versions.node) => isTransformTypesSupported(version)\n ? [\"--experimental-transform-types\", \"--no-warnings=ExperimentalWarning\"]\n : [];\n/**\n * Ask the OS for an unused TCP port, release it, and return its number.\n *\n * The port is only available, not reserved: another process can claim it\n * before the caller binds. Callers should keep the gap short and still handle\n * `EADDRINUSE`.\n */\nexport const findAvailablePort = (host = \"127.0.0.1\") => Effect.callback((resume) => {\n const server = NodeNet.createServer();\n server.unref();\n server.once(\"error\", (error) => resume(Effect.fail(error)));\n server.listen(0, host, () => {\n const address = server.address();\n const port = typeof address === \"object\" && address !== null\n ? address.port\n : undefined;\n server.close((error) => {\n if (error) {\n resume(Effect.fail(error));\n }\n else if (port !== undefined) {\n resume(Effect.succeed(port));\n }\n else {\n resume(Effect.fail(new Error(\"Failed to allocate an available port\")));\n }\n });\n });\n});\n//# sourceMappingURL=Node.js.map","import * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { defaultTeardown } from \"effect/Runtime\";\nimport { disableCrossSpawnChdir } from \"./Node.js\";\nconst isBun = typeof Bun !== \"undefined\";\nconst importPlatformPeer = (peerDependency, load) => load().catch(() => {\n console.error([\n `Alchemy could not load the required peer dependency \"${peerDependency}\".`,\n `Install a compatible version of \"${peerDependency}\" in the same project as \"alchemy\".`,\n \"If it is already installed, you may be running a globally installed Alchemy CLI; run the project-local CLI instead.\",\n ].join(\"\\n\"));\n process.exit(1);\n});\n/**\n * Constructs a layer with different implementations for Bun and Node.\n */\nexport const platformLayer = (constructors) => Layer.unwrap(Effect.promise(async () => {\n if (isBun) {\n return await constructors.bun();\n }\n else {\n return await constructors.node();\n }\n}));\nexport const PlatformServices = platformLayer({\n bun: async () => {\n const [BunServices, BunSocket] = await Promise.all([\n importPlatformPeer(\"@effect/platform-bun\", () => import(\"@effect/platform-bun/BunServices\")),\n importPlatformPeer(\"@effect/platform-bun\", () => import(\"@effect/platform-bun/BunSocket\")),\n ]);\n return Layer.merge(BunServices.layer, BunSocket.layerWebSocketConstructor);\n },\n node: async () => {\n const [NodeServices, NodeSocket] = await Promise.all([\n importPlatformPeer(\"@effect/platform-node\", () => import(\"@effect/platform-node/NodeServices\")),\n importPlatformPeer(\"@effect/platform-node\", () => import(\"@effect/platform-node/NodeSocket\")),\n ]);\n return Layer.merge(NodeServices.layer, NodeSocket.layerWebSocketConstructor);\n },\n});\n/**\n * ALWAYS exit once the main effect completes. The platform `runMain` default\n * only force-exits on failure or signal interruption — a *successful*\n * `alchemy deploy`/`destroy` otherwise lingers for ~100 seconds after \"Done\"\n * while keep-alive sockets (Cloudflare API agents, provider sidecar handles)\n * pin the event loop until the remote side closes them. All Effect finalizers\n * have already run by the time teardown is invoked; the macrotask hop lets\n * any buffered stdout drain before the process exits.\n */\nconst exitingTeardown = (exit, onExit) => {\n defaultTeardown(exit, (code) => {\n const finalCode = code !== 0 ? code : Number(process.exitCode ?? 0) || 0;\n setTimeout(() => process.exit(finalCode), 0);\n onExit(finalCode);\n });\n};\nexport const runMain = (effect, options) => {\n // Every alchemy process (CLI, exec child, sidecar, build/dev runners)\n // runs concurrent effects that depend on a stable working directory —\n // forbid cross-spawn's transient process-wide chdir (see Util/Node.ts).\n disableCrossSpawnChdir();\n const opts = {\n ...options,\n teardown: options?.teardown ?? exitingTeardown,\n };\n if (isBun) {\n void importPlatformPeer(\"@effect/platform-bun\", () => import(\"@effect/platform-bun/BunRuntime\")).then((BunRuntime) => BunRuntime.runMain(effect, opts));\n }\n else {\n void importPlatformPeer(\"@effect/platform-node\", () => import(\"@effect/platform-node/NodeRuntime\")).then((NodeRuntime) => NodeRuntime.runMain(effect, opts));\n }\n};\nexport const httpServer = (port = 0, host = \"127.0.0.1\") => platformLayer({\n bun: async () => {\n const BunHttpServer = await importPlatformPeer(\"@effect/platform-bun\", () => import(\"@effect/platform-bun/BunHttpServer\"));\n // `idleTimeout: 0` disables Bun's default 10s request idle timeout.\n // The RPC spawner serves a long-lived `/logs` stream (sidecar output\n // forwarded to the exec child's renderer) that can legitimately sit\n // idle between lines; Bun would otherwise sever it mid-session.\n return BunHttpServer.layer({ hostname: host, port, idleTimeout: 0 });\n },\n node: async () => {\n const [NodeHttpServer, Http] = await Promise.all([\n importPlatformPeer(\"@effect/platform-node\", () => import(\"@effect/platform-node/NodeHttpServer\")),\n import(\"node:http\"),\n ]);\n return NodeHttpServer.layerServer(Http.createServer, { host, port });\n },\n});\n//# sourceMappingURL=PlatformServices.js.map","import { ConfigProvider } from \"effect/ConfigProvider\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport { FileSystem } from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport * as Logger from \"effect/Logger\";\nimport * as Option from \"effect/Option\";\nimport { Path } from \"effect/Path\";\nimport * as Scope from \"effect/Scope\";\nimport * as FetchHttpClient from \"effect/unstable/http/FetchHttpClient\";\nimport { AlchemyContext, AlchemyContextLive } from \"./AlchemyContext.js\";\nimport { provideFreshArtifactStore } from \"./Artifacts.js\";\nimport { AuthProviders } from \"./Auth/AuthProvider.js\";\nimport { CredentialsStore, CredentialsStoreLive } from \"./Auth/Credentials.js\";\nimport { AlchemyProfile, ProfileLive } from \"./Auth/Profile.js\";\nimport { Cli } from \"./Cli/Cli.js\";\nimport * as Output from \"./Output.js\";\nimport { Stage } from \"./Stage.js\";\nimport { loadConfigProvider } from \"./Util/ConfigProvider.js\";\nimport { effectClass, taggedFunction } from \"./Util/effect.js\";\nimport { fileLogger } from \"./Util/FileLogger.js\";\nimport { PlatformServices } from \"./Util/PlatformServices.js\";\nexport const Stack = Object.assign(taggedFunction(Context.Service()(\"Stack\"), (stackName, options, eff) => {\n if (!stackName) {\n return (stackName) => Object.assign(\n // by default, reference the stack at the \"current\" stage of the importer\n Output.stackRef(stackName).pipe(effectClass), {\n stackName,\n stage: createStageProxy(stackName),\n state: options?.state,\n providers: options?.providers,\n make: (options, eff) => \n // @ts-expect-error\n Stack(stackName, options, eff),\n });\n }\n return eff.pipe(\n // @ts-expect-error\n make({\n name: stackName,\n ...options,\n }), (eff) => Object.assign(eff, {\n stackName,\n stage: createStageProxy(stackName),\n state: options?.state,\n providers: options?.providers,\n }));\n}));\nconst createStageProxy = (stackName) => new Proxy({}, {\n get: (_, stage) => Output.stackRef(stackName, { stage }),\n});\nexport const StackName = Stack.use((stack) => Effect.succeed(stack.name));\nexport const make = (options) => (effect) => Effect.scope.pipe(Effect.flatMap((scope) => {\n if (options.state == null) {\n return Effect.die(new Error(`Stack \"${options.name}\" is missing a state store. ` +\n `Add a \\`state\\` layer to the stack options, e.g.:\\n` +\n ` Alchemy.Stack(\"${options.name}\", {\\n` +\n ` providers: Cloudflare.providers(),\\n` +\n ` state: Cloudflare.state(), // <-- required\\n` +\n ` }, ...)\\n` +\n `See https://alchemy.run/state-store for available state stores.`));\n }\n if (options.providers == null) {\n return Effect.die(new Error(`Stack \"${options.name}\" is missing a providers layer. ` +\n `Add a \\`providers\\` layer to the stack options, e.g.:\\n` +\n ` Alchemy.Stack(\"${options.name}\", {\\n` +\n ` providers: Cloudflare.providers(), // <-- required\\n` +\n ` state: Cloudflare.state(),\\n` +\n ` }, ...)`));\n }\n return options.providers.pipe(Layer.provideMerge(options.state), Layer.provideMerge(Layer.effect(Stack, Stage.pipe(Effect.map((stage) => options.stack ?? {\n name: options.name,\n stage,\n resources: {},\n bindings: {},\n actions: {},\n })))), Layer.buildWithScope(scope));\n}), Effect.flatMap((context) => Effect.all([\n effect,\n Stack,\n Effect.context(),\n]).pipe(Effect.map(([output, stack, services]) => ({\n ...stack,\n output,\n services: Context.merge(services, context),\n})), Effect.provideContext(context))));\nexport const CurrentStack = Effect.serviceOption(Stack)\n .pipe(Effect.map(Option.getOrUndefined));\nconst platform = Layer.mergeAll(PlatformServices, FetchHttpClient.layer, Logger.layer([fileLogger(\"out\")], { mergeWithExisting: true }), Layer.provide(ProfileLive, PlatformServices), Layer.provide(CredentialsStoreLive, PlatformServices));\n// override alchemy state store, CLI/reporting, state, and Config\nconst alchemy = (overrides) => Layer.mergeAll(\n// CLI.inkCLI(),\n// optional\noverrides?.dev\n ? Layer.provide(Layer.effect(AlchemyContext, AlchemyContext.useSync((ctx) => ({ ...ctx, dev: overrides.dev }))), AlchemyContextLive)\n : AlchemyContextLive);\nexport const evalStack = (effect, fn, options) => {\n const body = Effect.gen(function* () {\n const stack = yield* effect;\n const configProvider = yield* loadConfigProvider(Option.none());\n return yield* fn(stack).pipe(provideFreshArtifactStore, Effect.provide(Layer.succeedContext(stack.services).pipe(Layer.provideMerge(Layer.succeed(ConfigProvider, configProvider)))));\n }).pipe(Effect.provide(Layer.effect(AuthProviders, Effect.serviceOption(AuthProviders).pipe(Effect.map(Option.getOrElse(() => ({}))))).pipe(Layer.provideMerge(Layer.succeed(Stage, options.stage)), Layer.provideMerge(Layer.provideMerge(alchemy({ dev: options.dev }), platform)))));\n return options.scope === undefined\n ? Effect.scoped(body)\n : Scope.provide(body, options.scope);\n};\n//# sourceMappingURL=Stack.js.map","import * as Duration from \"effect/Duration\";\nimport * as Redacted from \"effect/Redacted\";\nimport { isResource } from \"../Resource.js\";\n/**\n * JSON marker used to tag a `Redacted<T>` value when writing state.\n * The reviver recognises objects with exactly this key and rebuilds\n * the `Redacted` wrapper on read.\n */\nexport const REDACTED_MARKER = \"__redacted__\";\n/**\n * JSON marker used to tag a `Duration` value when writing state.\n * The reviver recognises objects with exactly this key and rebuilds\n * a real `Duration` instance on read so that downstream code can call\n * `Duration.toSeconds`, `Duration.toMillis`, etc. without first\n * decoding `Duration.toJSON`'s `{_id,_tag,...}` shape.\n */\nexport const DURATION_MARKER = \"__duration__\";\n/**\n * JSON marker used to tag a `Date` value when writing state. The reviver\n * recognises objects with exactly this key and rebuilds a real `Date`\n * instance on read, so a Date-typed prop read back out of persisted state\n * (`olds` in provider `diff`/`delete`/`read`) is a `Date` again — not the\n * bare ISO string `JSON.stringify` would otherwise leave behind.\n */\nexport const DATE_MARKER = \"__date__\";\nconst decodeDate = (encoded) => {\n if (typeof encoded !== \"string\")\n return undefined;\n const date = new Date(encoded);\n return Number.isNaN(date.getTime()) ? undefined : date;\n};\n/**\n * Rebuild a {@link Duration.Duration} from `Duration.toJSON`'s\n * `{_id,_tag,millis?,nanos?}` shape. Shared by state persistence and the\n * RPC sidecar — that JSON is not a valid `Duration.Input`.\n */\nexport const decodeDuration = (encoded) => {\n if (encoded === null || typeof encoded !== \"object\")\n return undefined;\n const json = encoded;\n switch (json._tag) {\n case \"Millis\":\n return json.millis !== undefined\n ? Duration.millis(json.millis)\n : undefined;\n case \"Nanos\":\n return json.nanos !== undefined\n ? Duration.nanos(BigInt(json.nanos))\n : undefined;\n case \"Infinity\":\n return Duration.infinity;\n case \"NegativeInfinity\":\n return Duration.negativeInfinity;\n default:\n return undefined;\n }\n};\n/**\n * Recursively encode a state value for JSON serialisation.\n *\n * - `Redacted<T>` values are wrapped as `{ [REDACTED_MARKER]: <inner> }`\n * so the actual string is persisted rather than the `<redacted>`\n * placeholder produced by the default `toJSON`.\n * - `Resource` instances are flattened to `{ id, type, props, attr }`\n * so persisted state matches the schema used by the loader.\n * - Plain objects and arrays are walked structurally.\n */\nexport const encodeState = (value) => {\n if (value === null ||\n value === undefined ||\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\")\n return value;\n if (Redacted.isRedacted(value)) {\n return {\n [REDACTED_MARKER]: encodeState(Redacted.value(value)),\n };\n }\n if (Duration.isDuration(value)) {\n // `JSON.stringify(Duration.seconds(N))` already invokes Duration.toJSON,\n // but encodeState is also called for code paths that don't go through\n // `JSON.stringify` (e.g. the HTTP state-store). Tag with our marker so\n // the reviver can unambiguously rebuild a real Duration instance —\n // Duration.toJSON's `{_id,_tag,...}` shape is NOT a valid Duration.Input.\n return {\n [DURATION_MARKER]: value.toJSON(),\n };\n }\n // Dates are serializable leaves and must round-trip: walking one\n // structurally would persist `{}` (`Object.entries(new Date())` is empty)\n // — and every later plan would then diff the empty object against the\n // program's Date and churn a phantom update forever. Tag with our marker\n // so the reviver rebuilds a real Date instance; rows written before the\n // marker carry a bare ISO string, which `canonicalize` in Diff.ts still\n // compares as equal to a live Date, so legacy rows never churn either.\n if (value instanceof Date) {\n return { [DATE_MARKER]: value.toJSON() };\n }\n if (isResource(value)) {\n return {\n id: value.LogicalId,\n type: value.Type,\n props: encodeState(value.Props),\n attr: encodeState(value.Attributes),\n };\n }\n if (Array.isArray(value))\n return value.map(encodeState);\n if (typeof value === \"object\") {\n const result = {};\n for (const [k, v] of Object.entries(value)) {\n result[k] = encodeState(v);\n }\n return result;\n }\n return value;\n};\n/**\n * JSON reviver that rebuilds `Redacted<T>` values that were written\n * through {@link encodeState}. Intended for use with `JSON.parse`.\n */\nexport const reviveState = (_key, value) => {\n if (value !== null && typeof value === \"object\" && !Array.isArray(value)) {\n const obj = value;\n if (REDACTED_MARKER in obj) {\n return Redacted.make(obj[REDACTED_MARKER]);\n }\n if (DURATION_MARKER in obj) {\n const decoded = decodeDuration(obj[DURATION_MARKER]);\n if (decoded !== undefined)\n return decoded;\n }\n // Exact single-key match only — unlike the legacy REDACTED/DURATION\n // markers there is no pre-marker data to tolerate, so a user object\n // that merely CONTAINS the key alongside other fields is never\n // collapsed into a Date (mirrors reviveStateRecursive's strictness).\n if (DATE_MARKER in obj && Object.keys(obj).length === 1) {\n const decoded = decodeDate(obj[DATE_MARKER]);\n if (decoded !== undefined)\n return decoded;\n }\n }\n return value;\n};\n/**\n * Recursively walk an already-decoded value and rebuild `Redacted<T>`\n * instances from `{ [REDACTED_MARKER]: <inner> }` envelopes. Mirror\n * image of {@link encodeState} for callers that hold a parsed JS\n * value rather than a JSON string (e.g. the HTTP state-store client,\n * which receives values pre-parsed by `HttpApiClient`).\n */\nexport const reviveStateRecursive = (value) => {\n if (value === null || typeof value !== \"object\")\n return value;\n if (Array.isArray(value))\n return value.map(reviveStateRecursive);\n const obj = value;\n const keys = Object.keys(obj);\n if (keys.length === 1 && keys[0] === REDACTED_MARKER) {\n return Redacted.make(reviveStateRecursive(obj[REDACTED_MARKER]));\n }\n if (keys.length === 1 && keys[0] === DURATION_MARKER) {\n const decoded = decodeDuration(obj[DURATION_MARKER]);\n if (decoded !== undefined)\n return decoded;\n }\n if (keys.length === 1 && keys[0] === DATE_MARKER) {\n const decoded = decodeDate(obj[DATE_MARKER]);\n if (decoded !== undefined)\n return decoded;\n }\n const result = {};\n for (const [k, v] of Object.entries(obj)) {\n result[k] = reviveStateRecursive(v);\n }\n return result;\n};\n//# sourceMappingURL=StateEncoding.js.map","import * as Cause from \"effect/Cause\";\nimport * as Context from \"effect/Context\";\nimport * as Duration from \"effect/Duration\";\nimport * as Effect from \"effect/Effect\";\nimport * as Exit from \"effect/Exit\";\nimport { flow } from \"effect/Function\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as Schema from \"effect/Schema\";\nimport * as Stream from \"effect/Stream\";\nimport * as NodeUtil from \"node:util\";\nimport * as Output from \"../Output.js\";\nimport { isRedactedMarker } from \"../RuntimeContext.js\";\nimport { decodeDuration, DURATION_MARKER, encodeState, } from \"../State/StateEncoding.js\";\nexport const wrapRpcHandlers = (handlers, streamKeys) => {\n return Object.fromEntries(Object.entries(handlers).map(([key, value]) => [\n key,\n typeof value === \"function\"\n ? streamKeys?.includes(key)\n ? wrapRpcStreamHandler(value)\n : wrapRpcEffectHandler(value)\n : typeof value === \"object\" && value !== null && !Array.isArray(value)\n ? wrapRpcHandlers(value)\n : value,\n ]));\n};\nexport const unwrapRpcHandlers = (handlers, streamKeys) => {\n return Object.fromEntries(Object.entries(handlers).map(([key, value]) => [\n key,\n typeof value === \"function\"\n ? streamKeys?.includes(key)\n ? unwrapRpcStreamHandler(value)\n : unwrapRpcEffectHandler(value)\n : typeof value === \"object\" && value !== null && !Array.isArray(value)\n ? unwrapRpcHandlers(value)\n : value,\n ]));\n};\nconst serializeError = Schema.encodeSync(Schema.Defect());\nconst wrapRpcEffectHandler = (handler) => flow((args) => deserializeRpcArgs(args), (args) => handler(...args), Effect.exit, Effect.map((exit) => {\n if (exit._tag === \"Success\") {\n // Success values need the same marker treatment as args: provider\n // attributes can legitimately carry `Redacted` secrets (e.g. a local\n // container's bound env), and a raw Redacted reaching capnweb dies\n // with `TypeError: Cannot serialize value: <redacted>`.\n return {\n _tag: \"Success\",\n value: serializeRpcArgs(exit.value),\n };\n }\n return {\n _tag: \"Failure\",\n cause: exit.cause.reasons.map((reason) => {\n switch (reason._tag) {\n case \"Fail\":\n return {\n _tag: \"Fail\",\n error: serializeError(reason.error),\n };\n case \"Die\":\n return { _tag: \"Die\", defect: serializeError(reason.defect) };\n case \"Interrupt\":\n return { _tag: \"Interrupt\", fiberId: reason.fiberId };\n }\n }),\n };\n}), Effect.runPromise);\nconst wrapRpcStreamHandler = (handler) => flow((args) => deserializeRpcArgs(args), (args) => handler(...args), (stream) => Stream.toReadableStream(stream));\nconst unwrapRpcEffectHandler = (handler) => flow((...args) => serializeRpcArgs(args), (args) => Effect.promise(() => handler(args)), Effect.flatMap((exit) => {\n if (exit._tag === \"Success\") {\n // Mirror of the wrap side: rebuild `Redacted` wrappers from their\n // wire markers so callers get the same shape an in-process provider\n // returns.\n return Exit.succeed(deserializeRpcArgs(exit.value));\n }\n return Exit.failCause(Cause.fromReasons(exit.cause.map((reason) => {\n switch (reason._tag) {\n case \"Fail\":\n return Cause.makeFailReason(reason.error);\n case \"Die\":\n return Cause.makeDieReason(reason.defect);\n case \"Interrupt\":\n return Cause.makeInterruptReason(reason.fiberId);\n }\n })));\n}));\nconst unwrapRpcStreamHandler = (handler) => flow((...args) => serializeRpcArgs(args), (args) => handler(args), (stream) => Stream.fromReadableStream({\n evaluate: () => stream,\n onError: (error) => error,\n}));\nconst serializeRpcArgs = (value) => {\n if (Redacted.isRedacted(value)) {\n return {\n _tag: \"Redacted\",\n value: Redacted.value(value),\n };\n }\n // Output must be tested BEFORE Effect.isEffect — Output exprs are yieldable\n // and would otherwise be misclassified as plain Effects.\n if (Output.isOutput(value)) {\n return {\n _tag: \"Output\",\n description: NodeUtil.inspect(value),\n };\n }\n // Runtime-only effect values riding in props (e.g. a Worker's `exports`\n // carries each DO's `constructor` Effect and captured `services` Context —\n // passed through prop resolution by identity since #1094). They cannot\n // cross the wire (function-valued internals kill capnweb) and the sidecar\n // never runs them (`stripEffects` drops them from `news` provider-side), so\n // ship a marker that deserializes back into an equivalent leaf: an Effect\n // that dies loudly if it IS ever run, keeping `isResolved`/`stripEffects`\n // semantics identical on both sides of the boundary.\n if (Effect.isEffect(value)) {\n return {\n _tag: \"~alchemy/Rpc/Effect\",\n description: NodeUtil.inspect(value),\n };\n }\n if (Context.isContext(value)) {\n return {\n _tag: \"~alchemy/Rpc/Context\",\n description: NodeUtil.inspect(value),\n };\n }\n // Duration has `toJSON` (so the structural walk below skips it) but\n // capnweb cannot serialize the live Effect Duration object — it dies\n // with `TypeError: Cannot serialize value: 15000 millis`. Use the same\n // `{ __duration__: toJSON() }` envelope as persisted state.\n if (Duration.isDuration(value)) {\n return encodeState(value);\n }\n if (typeof value === \"function\") {\n return null;\n }\n if (Array.isArray(value)) {\n return value.map(serializeRpcArgs);\n }\n if (value && typeof value === \"object\" && !(\"toJSON\" in value)) {\n return Object.fromEntries(Object.entries(value).map(([key, child]) => [\n key,\n serializeRpcArgs(child),\n ]));\n }\n return value;\n};\nconst isEffectMarker = (value) => \"_tag\" in value &&\n value._tag === \"~alchemy/Rpc/Effect\" &&\n \"description\" in value &&\n typeof value.description === \"string\";\nconst isContextMarker = (value) => \"_tag\" in value &&\n value._tag === \"~alchemy/Rpc/Context\" &&\n \"description\" in value &&\n typeof value.description === \"string\";\nconst isDurationEnvelope = (value) => DURATION_MARKER in value && Object.keys(value).length === 1;\nconst deserializeRpcArgs = (value) => {\n if (Array.isArray(value)) {\n return value.map(deserializeRpcArgs);\n }\n else if (typeof value === \"object\" && value !== null) {\n // These values are serialized as `{_tag: \"Redacted\", value: ...}` and `{_tag: \"Output\", description: ...}`,\n // so we need to detect them manually - Redacted.isRedacted and Output.isOutput do not work.\n if (isRedactedMarker(value)) {\n return Redacted.make(value.value);\n }\n else if (\"_tag\" in value &&\n value._tag === \"Output\" &&\n \"description\" in value &&\n typeof value.description === \"string\") {\n return new Output.NamedExpr(new Output.EffectExpr(Output.VoidExpr, () => Effect.never), value.description);\n }\n else if (isEffectMarker(value)) {\n // Rebuild an Effect-typed leaf so `isResolved`/`stripEffects` classify\n // it exactly like the original; dies loudly if anything ever runs it.\n const description = value.description;\n return Effect.suspend(() => Effect.die(new Error(`An Effect from the resource's props cannot cross the RPC provider boundary and was replaced by a placeholder: ${description}`)));\n }\n else if (isContextMarker(value)) {\n return Context.empty();\n }\n else if (isDurationEnvelope(value)) {\n return decodeDuration(value[DURATION_MARKER]) ?? value;\n }\n return Object.fromEntries(Object.entries(value).map(([key, child]) => [\n key,\n deserializeRpcArgs(child),\n ]));\n }\n return value;\n};\n//# sourceMappingURL=RpcSerialization.js.map","import * as Config from \"effect/Config\";\nimport * as ConfigProvider from \"effect/ConfigProvider\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport { AlchemyContext } from \"../AlchemyContext.js\";\nimport { AuthProviders } from \"../Auth/AuthProvider.js\";\nimport { CredentialsStoreLive } from \"../Auth/Credentials.js\";\nimport { ProfileLive, withProfileOverride } from \"../Auth/Profile.js\";\nimport { Stack } from \"../Stack.js\";\nimport { Stage } from \"../Stage.js\";\nimport { loadConfigProvider } from \"../Util/ConfigProvider.js\";\n/** Query parameter carrying the JSON {@link SessionEnvironment} on session websockets. */\nexport const SESSION_ENV_PARAM = \"alchemy-session-env\";\nexport const encodeSessionEnvironment = (env) => JSON.stringify(env);\nexport const decodeSessionEnvironment = (raw) => JSON.parse(raw);\nexport const layer = (environment) => Layer.mergeAll(ProfileLive, CredentialsStoreLive, Layer.succeed(AuthProviders, {}), ConfigProvider.layer(loadConfigProvider(Option.fromNullishOr(environment.envFile)).pipe(Effect.map((base) => withProfileOverride(base, environment.profile)))), Layer.succeed(AlchemyContext, environment.alchemyContext), Layer.succeed(Stack, {\n name: environment.stack.name,\n stage: environment.stack.stage,\n resources: {},\n bindings: {},\n actions: {},\n}), Layer.succeed(Stage, environment.stack.stage));\nexport const RPC_SERVER_ENVIRONMENT_KEY = \"ALCHEMY_RPC_SERVER_ENVIRONMENT\";\n/** The spawn-time environment the parent baked into the child's process env. */\nexport const fromProcessEnv = Config.string(RPC_SERVER_ENVIRONMENT_KEY).pipe(Config.map((raw) => JSON.parse(raw)));\n/**\n * Legacy single-stack boot: the full environment (including the stack) baked\n * into the process env at spawn time. Used by children that serve exactly one\n * stack for their whole lifetime (e.g. the Vite dev-server child, which gets\n * an explicit environment from `startViteChild`). RPC sidecars do NOT use\n * this — their sessions each carry a {@link SessionEnvironment}.\n */\nexport const fromEnv = () => Layer.unwrap(fromProcessEnv.pipe(Effect.flatMap((environment) => environment.stack === undefined ||\n environment.alchemyContext === undefined\n ? Effect.die(new Error(`${RPC_SERVER_ENVIRONMENT_KEY} carries no stack/alchemyContext — this child requires the legacy single-stack environment`))\n : Effect.succeed(layer({\n profile: environment.profile,\n envFile: environment.envFile,\n stack: environment.stack,\n alchemyContext: environment.alchemyContext,\n })))));\n//# sourceMappingURL=RpcServerEnvironment.js.map","import { newWebSocketRpcSession } from \"capnweb\";\nimport * as Cache from \"effect/Cache\";\nimport * as Config from \"effect/Config\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as HttpBody from \"effect/unstable/http/HttpBody\";\nimport * as HttpClient from \"effect/unstable/http/HttpClient\";\nimport { AlchemyContext } from \"../AlchemyContext.js\";\nimport { Stack } from \"../Stack.js\";\nimport { unwrapRpcHandlers } from \"./RpcSerialization.js\";\nimport { encodeSessionEnvironment, SESSION_ENV_PARAM, } from \"./RpcServerEnvironment.js\";\nexport class RpcProviderProxy extends Context.Service()(\"alchemy/Local/RpcProviderProxy\") {\n}\nexport const SPAWNER_URL_ENV_KEY = \"ALCHEMY_RPC_SPAWNER_URL\";\n/**\n * Separator for the session-cache key. `\\u0000` cannot appear in either half:\n * JSON.stringify escapes control characters and URLs cannot carry raw NULs.\n */\nconst SESSION_KEY_SEPARATOR = \"\\u0000\";\nconst make = Effect.fn(function* (spawnerUrl) {\n const client = yield* HttpClient.HttpClient;\n const getSession = Effect.fn(function* (serverEntryUrl, sessionEnv) {\n const payload = { serverEntryUrl };\n const response = yield* client.post(spawnerUrl, {\n body: yield* HttpBody.json(payload),\n });\n // The spawner returns one shared child per entry URL; the stack-specific\n // environment rides the session websocket so the child can build (and\n // memoize) a provider context per stack.\n const body = yield* response.text;\n if (response.status !== 200) {\n return yield* Effect.fail(new Error(`RPC spawner POST ${spawnerUrl} returned ${response.status}: ${body.slice(0, 300)}`));\n }\n let websocketUrl;\n try {\n websocketUrl = new URL(body);\n }\n catch {\n return yield* Effect.fail(new Error(`RPC spawner POST ${spawnerUrl} did not return a websocket URL (got ${JSON.stringify(body.slice(0, 200))})`));\n }\n if (websocketUrl.protocol !== \"ws:\" && websocketUrl.protocol !== \"wss:\") {\n return yield* Effect.fail(new Error(`RPC spawner POST ${spawnerUrl} returned a non-websocket URL: ${websocketUrl.toString()}`));\n }\n websocketUrl.searchParams.set(SESSION_ENV_PARAM, sessionEnv);\n return newWebSocketRpcSession(websocketUrl.toString());\n }, (effect, serverEntryUrl) => Effect.catch(effect, (error) => Effect.die(new Error(`Failed to create provider RPC session for \"${serverEntryUrl}\"`, {\n cause: error,\n }))));\n // A websocket that drops (sidecar crash/restart, abnormal 1006 close)\n // permanently breaks the capnweb session, and a cached broken session would\n // poison every subsequent call — including test-runner retries.\n // `onRpcBroken` fires on disconnect and evicts the entry, so the next `get`\n // re-registers with the spawner (which respawns the sidecar child if it\n // died). Assigned after the cache exists; the callback only fires on live\n // sessions, which the cache must already contain.\n let evictBrokenSession = () => { };\n const cache = yield* Cache.make({\n lookup: (key) => {\n const separator = key.indexOf(SESSION_KEY_SEPARATOR);\n return getSession(key.slice(0, separator), key.slice(separator + 1)).pipe(Effect.tap((session) => Effect.sync(() => session.onRpcBroken(() => evictBrokenSession(key)))));\n },\n capacity: Infinity,\n });\n evictBrokenSession = (key) => Effect.runFork(Cache.invalidate(cache, key));\n return RpcProviderProxy.of({\n get: Effect.fn(function* (mainUrl, providerName) {\n const alchemyContext = yield* AlchemyContext;\n const stack = yield* Stack;\n const sessionEnv = encodeSessionEnvironment({\n alchemyContext,\n stack: { name: stack.name, stage: stack.stage },\n });\n const key = mainUrl + SESSION_KEY_SEPARATOR + sessionEnv;\n const fetchProvider = Effect.gen(function* () {\n const session = yield* Cache.get(cache, key);\n return yield* Effect.tryPromise(() => session.getProvider(providerName));\n });\n // One in-place reconnect: if the session broke mid-call (the broken\n // callback may not have evicted it yet), drop it and re-register once\n // before giving up.\n const provider = yield* fetchProvider.pipe(Effect.catch(() => Cache.invalidate(cache, key).pipe(Effect.andThen(fetchProvider))), Effect.orDie);\n // The served shape omits the process-local `mode`/`modes` variant\n // machinery (see RpcProviderService); the unwrapped stub is a plain\n // (mode-agnostic) ProviderService.\n return unwrapRpcHandlers(provider, [\"tail\"]);\n }),\n });\n});\nexport const layer = (url) => Layer.effect(RpcProviderProxy, make(url));\nexport const fromEnv = () => Layer.effect(RpcProviderProxy, Config.string(SPAWNER_URL_ENV_KEY).pipe(Effect.flatMap(make)));\n//# sourceMappingURL=RpcProviderProxy.js.map","import * as Cache from \"effect/Cache\";\nimport * as Config from \"effect/Config\";\nimport * as Console from \"effect/Console\";\nimport * as Context from \"effect/Context\";\nimport * as Deferred from \"effect/Deferred\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Queue from \"effect/Queue\";\nimport * as Scope from \"effect/Scope\";\nimport * as Stream from \"effect/Stream\";\nimport * as HttpClient from \"effect/unstable/http/HttpClient\";\nimport * as HttpServer from \"effect/unstable/http/HttpServer\";\nimport { HttpServerRequest } from \"effect/unstable/http/HttpServerRequest\";\nimport * as HttpServerResponse from \"effect/unstable/http/HttpServerResponse\";\nimport * as ChildProcess from \"effect/unstable/process/ChildProcess\";\nimport * as ChildProcessSpawner from \"effect/unstable/process/ChildProcessSpawner\";\nimport { fileURLToPath } from \"node:url\";\nimport { transformTypesFlags } from \"../Util/Node.js\";\nimport { httpServer } from \"../Util/PlatformServices.js\";\nimport { SPAWNER_URL_ENV_KEY } from \"./RpcProviderProxy.js\";\nimport { RPC_SERVER_ENVIRONMENT_KEY, } from \"./RpcServerEnvironment.js\";\nexport class RpcSpawner extends Context.Service()(\"alchemy/Local/RpcSpawner\") {\n}\n/**\n * Path on the spawner's HTTP server that streams sidecar output as NDJSON\n * ({@link SidecarLogLine} per line). Consumed by {@link forwardSidecarLogs}\n * from the exec child, which owns the terminal renderer.\n */\nexport const LOGS_PATH = \"/logs\";\nexport const make = Effect.fn(function* ({ profile, envFile, }) {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const scope = yield* Effect.scope;\n const cache = yield* Cache.make({\n lookup: (serverEntryUrl) => spawn(serverEntryUrl).pipe(Scope.provide(scope)),\n capacity: Infinity,\n });\n // Sidecar output hub. During `alchemy dev` this process (the outer dev\n // command) shares the tty with the exec child, and the exec child owns the\n // repainting progress renderer (Ink patches its `console`). Printing\n // sidecar lines RAW from here interleaves with the renderer's repaints and\n // corrupts the region (stacked/duplicated frames). So: when an exec child\n // is subscribed via the /logs endpoint, hand lines to it and let it print\n // through its (patched) console; only print from this process as a\n // fallback when no subscriber is connected (e.g. during a --watch restart\n // gap, when no renderer is alive either).\n const subscribers = new Set();\n const publish = (line) => Effect.suspend(() => {\n if (subscribers.size > 0) {\n for (const notify of subscribers)\n notify(line);\n return Effect.void;\n }\n // Through the Console SERVICE so runners that override it (e.g.\n // alchemy-test's per-test buffer) capture the sidecar's output.\n return line.channel === \"stderr\"\n ? Console.error(line.line)\n : Console.log(line.line);\n });\n const spawn = Effect.fn(function* (serverEntryUrl) {\n const bin = typeof globalThis.Bun !== \"undefined\" ? \"bun\" : \"node\";\n const main = fileURLToPath(serverEntryUrl);\n // Stack-specific context is deliberately absent: sessions carry their\n // own SessionEnvironment, so one child serves every stack.\n const environment = {\n profile,\n envFile,\n };\n const command = ChildProcess.make(bin, {\n bun: [\"run\", main],\n // Under Node, transparently strip TypeScript types so that `.ts`\n // entry points work the same way they do under Bun. Mirrors what\n // `dev.ts` already does for the outer process, so the dev experience\n // is symmetric on both runtimes whether the entry came from `src/`\n // (dev/tests) or `lib/` (published packages).\n node: main.endsWith(\".ts\") ? [...transformTypesFlags(), main] : [main],\n }[bin], {\n stdout: \"pipe\",\n // Piped (NOT inherited) so the child's output routes through the\n // Effect Console service: raw writes to the parent's fd corrupt the\n // test runner's reporter/TUI. The drain below is mandatory — an\n // unread pipe eventually fills and blocks the child.\n stderr: \"pipe\",\n detached: false,\n env: {\n [RPC_SERVER_ENVIRONMENT_KEY]: JSON.stringify(environment),\n },\n extendEnv: true,\n });\n const handle = yield* spawner.spawn(command);\n yield* handle.stderr.pipe(Stream.decodeText, Stream.splitLines, Stream.runForEach((line) => publish({ channel: \"stderr\", line })), Effect.ignore, Effect.forkScoped);\n // This scope is the child handle's sole owner. Graceful shutdown runs this\n // finalizer; abrupt parent loss closes the RPC parent connection and the\n // child self-terminates (both paths are covered by RpcSpawnerCleanup).\n const kill = handle.kill({ forceKillAfter: \"500 millis\" });\n yield* Effect.addFinalizer(() => kill.pipe(Effect.ignore));\n const url = yield* getRpcAddress(handle.stdout, (line) => publish({ channel: \"stdout\", line }));\n const ws = yield* Effect.acquireRelease(Effect.sync(() => new WebSocket(new URL(\"/parent\", url))), (ws) => Effect.sync(() => ws.close()));\n return {\n url,\n isRunning: Effect.zipWith(handle.isRunning, Effect.sync(() => ws.readyState === WebSocket.CONNECTING ||\n ws.readyState === WebSocket.OPEN), (a, b) => a && b, { concurrent: true }),\n kill,\n };\n });\n const register = Effect.fn(function* (serverEntryUrl, attempt = 0) {\n const child = yield* Cache.get(cache, serverEntryUrl);\n if (yield* child.isRunning) {\n return child.url;\n }\n if (attempt > 3) {\n return yield* Effect.die(new Error(`Failed to spawn RPC server for \"${serverEntryUrl}\" after ${attempt} attempts.`));\n }\n yield* child.kill;\n yield* Cache.invalidate(cache, serverEntryUrl);\n return yield* register(serverEntryUrl, attempt + 1);\n });\n const server = yield* HttpServer.HttpServer;\n const encoder = new TextEncoder();\n yield* server.serve(Effect.gen(function* () {\n const request = yield* HttpServerRequest;\n if (request.url.startsWith(LOGS_PATH)) {\n // Long-lived NDJSON stream of sidecar output. The subscriber (exec\n // child) prints these lines through its own console, which the Ink\n // renderer patches — inserting them above the progress region\n // instead of tearing it. Client disconnect interrupts the stream\n // and unregisters the subscriber.\n const queue = yield* Queue.make();\n const notify = (line) => {\n Queue.offerUnsafe(queue, encoder.encode(`${JSON.stringify(line)}\\n`));\n };\n subscribers.add(notify);\n return HttpServerResponse.stream(Stream.fromQueue(queue).pipe(Stream.ensuring(Effect.sync(() => subscribers.delete(notify)))), { contentType: \"application/x-ndjson\" });\n }\n const payload = (yield* request.json);\n const url = yield* register(payload.serverEntryUrl);\n return HttpServerResponse.text(url);\n }));\n return RpcSpawner.of({\n url: HttpServer.formatAddress(server.address),\n });\n});\nexport const layerServer = (environment) => Layer.effect(RpcSpawner, make(environment)).pipe(Layer.provide(httpServer()));\nconst RPC_ADDRESS_REGEX = /(<ALCHEMY_RPC_ADDRESS>)(.+)(<\\/ALCHEMY_RPC_ADDRESS>)/;\nconst getRpcAddress = (stdout, publish) => Effect.gen(function* () {\n const address = yield* Deferred.make();\n let done = false;\n yield* stdout.pipe(Stream.decodeText, Stream.splitLines, Stream.runForEach((line) => {\n if (done) {\n return publish(line);\n }\n const match = line.match(RPC_ADDRESS_REGEX);\n if (match) {\n done = true;\n return Deferred.succeed(address, match[2]);\n }\n return Effect.void;\n }), Effect.forkScoped);\n return yield* Deferred.await(address);\n});\nconst parseSidecarLogLine = (raw) => {\n try {\n const parsed = JSON.parse(raw);\n return typeof parsed?.line === \"string\" ? parsed : undefined;\n }\n catch {\n return undefined;\n }\n};\n/**\n * Pull sidecar output from the spawner (the outer `alchemy dev` process)\n * into THIS process's Console. The exec child owns the terminal renderer —\n * Ink patches its `console`, so lines printed here are inserted cleanly\n * above the repainting progress region instead of racing it on the shared\n * tty. Forks in the ambient scope and never fails: when no spawner is\n * configured (`ALCHEMY_RPC_SPAWNER_URL` absent — plain deploy/destroy) it is\n * a no-op, and if the connection drops the spawner's own fallback printing\n * takes over.\n */\nexport const forwardSidecarLogs = Config.string(SPAWNER_URL_ENV_KEY).pipe(Effect.flatMap((spawnerUrl) => {\n const streamOnce = Effect.gen(function* () {\n const client = yield* HttpClient.HttpClient;\n const response = yield* client.get(new URL(LOGS_PATH, spawnerUrl).toString());\n yield* response.stream.pipe(Stream.decodeText, Stream.splitLines, Stream.runForEach((raw) => Effect.suspend(() => {\n const parsed = parseSidecarLogLine(raw);\n if (parsed === undefined)\n return Effect.void;\n return parsed.channel === \"stderr\"\n ? Console.error(parsed.line)\n : Console.log(parsed.line);\n })));\n });\n // Keep the subscription alive for the whole dev session: reconnect\n // (paced) if the stream ends or errors. While disconnected the spawner's\n // fallback printing covers the gap; the loop dies with the ambient scope.\n return streamOnce.pipe(Effect.ignore, Effect.andThen(Effect.sleep(\"1 second\")), Effect.forever);\n}), Effect.ignore, Effect.forkScoped, Effect.asVoid);\n//# sourceMappingURL=RpcSpawner.js.map","import * as Effect from \"effect/Effect\";\nimport { RuntimeContext } from \"./RuntimeContext.js\";\n/**\n * Runtime context bridge that lets an {@link Action} read Resource Outputs.\n *\n * Actions are peculiar: their init Effect runs at plan/stack-eval time (before\n * any resource exists) while their body runs at apply time (after upstreams are\n * materialized). To make `yield* db.databaseId` work inside an Action we split\n * the {@link RuntimeContext} into two cooperating halves that share nothing but\n * a sanitized key:\n *\n * - {@link makeCaptureContext} is provided while the init Effect runs. Its\n * `set(key, output)` records the referenced {@link Output} (so the engine can\n * add a dependency edge and later resolve it) and its `get(key)` hands back a\n * *deferred* accessor — an Effect that re-reads whatever `RuntimeContext` is\n * ambient when it actually runs.\n * - {@link makeResolveContext} is provided around the Action body at apply\n * time. Its `get(key)` returns the already-resolved value for that key.\n *\n * Because the accessor produced at init re-reads `RuntimeContext`, yielding it\n * inside the body resolves against the apply-time context — no shared mutable\n * state, no infinite recursion (the resolve context's `get` is terminal).\n */\nconst base = (id) => ({\n Type: \"Action\",\n id,\n env: {},\n});\n/**\n * Capture context — provided while an Action's init Effect runs. Records every\n * Output referenced via `yield* output` into `captures`, keyed by the Output's\n * sanitized key, and returns deferred accessors.\n */\nexport const makeCaptureContext = (captures) => ({\n ...base(\"capture\"),\n set: (key, output) => Effect.sync(() => {\n captures[key] = output;\n return key;\n }),\n // Deferred: re-read the ambient RuntimeContext at run time. At apply this is\n // the resolve context below; its `get` returns the materialized value. The\n // `RuntimeContext` requirement is erased at the Action boundary (`Run` is\n // typed `Effect<Out, any, any>`) and satisfied by the resolve context, so\n // the accessor presents as `Effect<T | undefined>`.\n get: ((key) => Effect.flatMap(RuntimeContext, (ctx) => ctx.get(key))),\n});\n/**\n * Resolve context — provided around an Action body at apply time. `resolved`\n * maps each captured key to its value (already evaluated against the tracker).\n */\nexport const makeResolveContext = (resolved) => ({\n ...base(\"resolve\"),\n set: (key) => Effect.succeed(key),\n get: (key) => Effect.succeed(resolved[key]),\n});\n//# sourceMappingURL=ActionRuntimeContext.js.map","/**\n * The credential-demand seam for credential-free `alchemy dev`.\n *\n * A dev run whose plan is entirely local must never touch (or prompt for)\n * cloud credentials. When the plan DOES need the cloud — a resource opted\n * out of local emulation via `Alchemy.remote()`, a local Worker binding\n * that proxies to a remote resource (`dev: { remote: true }`), or the\n * deletion of a row that was last reconciled live — credentials are\n * demanded exactly once, up front, in the exec process (which owns the\n * tty), BEFORE apply begins:\n *\n * - interactive: the provider's existing `configure` flow runs, prefixed\n * with a human-readable reason naming the demanding resources\n * (threaded via {@link ConfigureContext}'s `reason`).\n * - non-interactive: fail with the typed {@link CredentialsRequired}\n * error naming the demanding resources and pointing at `alchemy login`.\n *\n * The RPC sidecar never prompts — its stdio is piped and it only ever\n * reads credentials persisted by this seam (or a prior `alchemy login`).\n *\n * Non-dev runs (`alchemy deploy` / `destroy`) never enter this seam:\n * state-store init and live providers drive the pre-existing lazy\n * credential-resolution flow unchanged.\n */\nimport * as Config from \"effect/Config\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as Option from \"effect/Option\";\nimport { isNonInteractive } from \"../Util/interactive.js\";\nimport { AuthProviders } from \"./AuthProvider.js\";\nimport { ALCHEMY_PROFILE, AlchemyProfile } from \"./Profile.js\";\n/**\n * A dev-mode plan needs cloud credentials, none are configured for the\n * active profile, and the process is non-interactive so the configure flow\n * cannot run. The message names the demanding resources and the fix.\n */\nexport class CredentialsRequired extends Data.TaggedError(\"CredentialsRequired\") {\n}\nconst describeReason = (reason) => {\n switch (reason) {\n case \"remote\":\n return \"runs against the real cloud via Alchemy.remote()\";\n case \"remote-binding\":\n return \"has a binding that proxies to a remote resource (dev: { remote: true })\";\n case \"live-delete\":\n return \"deletes an instance that was deployed to the real cloud\";\n }\n};\n/** `\"AWS.S3.Bucket\"` → `\"AWS\"` (the auth-provider name). */\nconst cloudOf = (type) => type.split(\".\")[0] ?? type;\nconst resourceLines = (demand) => demand.resources\n .map((r) => ` - ${r.fqn} (${describeReason(r.reason)})`)\n .join(\"\\n\");\n/**\n * Build the typed {@link CredentialsRequired} failure for a demand.\n * Exported so tests can pin the message format.\n */\nexport const credentialsRequired = (demand, profileName) => new CredentialsRequired({\n provider: demand.provider,\n resources: demand.resources.map((r) => r.fqn),\n reason: [...new Set(demand.resources.map((r) => r.reason))].join(\", \"),\n message: `${demand.provider} credentials are required, but none are configured ` +\n `for profile '${profileName}' and this process is non-interactive so ` +\n \"they can't be configured now.\\n\" +\n `These resources require ${demand.provider} credentials:\\n` +\n `${resourceLines(demand)}\\n` +\n `Run \\`alchemy login --profile ${profileName}\\` to configure ` +\n \"credentials, or set CI=1 to use environment-variable credentials.\",\n});\n/**\n * The human-readable reason shown at the top of an interactive configure\n * flow triggered by this seam (threaded via {@link ConfigureContext}).\n */\nconst demandBanner = (demand) => `This dev session requires ${demand.provider} credentials:\\n` +\n resourceLines(demand);\nconst bindingDemandsRemote = (bindings) => (bindings ?? []).some((binding) => {\n // A binding being REMOVED needs no runtime proxy — the restarted\n // local instance simply no longer carries it.\n if (binding.action === \"delete\")\n return false;\n const data = binding.data;\n return (data != null &&\n typeof data === \"object\" &&\n data.devRemote != null &&\n typeof data.devRemote === \"object\" &&\n Object.values(data.devRemote).some((remote) => remote === true));\n});\n/**\n * Scan a plan for rows that need live (cloud) credentials during a dev\n * run, grouped by cloud provider:\n *\n * 1. resources whose resolved provider mode is `\"live\"` (`Alchemy.remote()`)\n * 2. resources whose binding data carries a truthy `devRemote` entry\n * (the local runtime proxies that binding to the real cloud)\n * 3. planned deletions of rows stamped `providerMode: \"live\"`\n *\n * Pure and side-effect-free — callers gate on the run being a dev run\n * (in a live run every dual-provider row resolves `\"live\"` and the\n * pre-existing lazy credential flow applies instead).\n *\n * Mode-agnostic rows (`mode === undefined`, single-implementation\n * providers that run live even in dev) are deliberately NOT collected:\n * they resolve credentials lazily exactly as they do today.\n */\nexport const collectCredentialDemands = (plan) => {\n const byProvider = new Map();\n const add = (type, fqn, reason) => {\n const provider = cloudOf(type);\n const resources = byProvider.get(provider) ?? new Map();\n if (!resources.has(fqn))\n resources.set(fqn, reason);\n byProvider.set(provider, resources);\n };\n for (const [fqn, node] of Object.entries(plan.resources)) {\n if (node.mode === \"live\") {\n add(node.resource.Type, fqn, \"remote\");\n }\n else if (bindingDemandsRemote(node.bindings)) {\n add(node.resource.Type, fqn, \"remote-binding\");\n }\n }\n for (const [fqn, node] of Object.entries(plan.deletions)) {\n if (node !== undefined && node.mode === \"live\") {\n add(node.resource.Type, fqn, \"live-delete\");\n }\n }\n return [...byProvider.entries()].map(([provider, resources]) => ({\n provider,\n resources: [...resources.entries()].map(([fqn, reason]) => ({\n fqn,\n reason,\n })),\n }));\n};\n/**\n * Ensure credentials exist for every demand, prompting at most once per\n * provider and only when nothing is configured yet:\n *\n * - already configured for the active profile → no-op (never re-prompts)\n * - missing + interactive → the provider's `configure` flow runs (via\n * `AlchemyProfile.loadOrConfigure`), prefixed with a reason naming the\n * demanding resources\n * - missing + non-interactive (and not CI) → typed\n * {@link CredentialsRequired} failure\n * - CI → `loadOrConfigure` picks the provider's non-interactive default\n * (env-var credentials), matching every other CI path\n *\n * Demands whose cloud has no registered auth provider are skipped (bare\n * engine runs with test providers demand nothing). All context is\n * resolved optionally, so the effect is safe to run in any environment.\n */\nexport const demandCredentials = Effect.fn(\"Alchemy.demandCredentials\")(function* (demands, options) {\n if (demands.length === 0)\n return;\n const registry = Option.getOrUndefined(yield* Effect.serviceOption(AuthProviders));\n const profile = Option.getOrUndefined(yield* Effect.serviceOption(AlchemyProfile));\n if (registry === undefined || profile === undefined)\n return;\n const profileName = yield* ALCHEMY_PROFILE;\n const ci = yield* Config.boolean(\"CI\").pipe(Config.withDefault(false));\n const nonInteractive = options?.nonInteractive ?? isNonInteractive();\n for (const demand of demands) {\n const auth = registry[demand.provider];\n if (auth == null)\n continue;\n const existing = yield* profile.getProfile(profileName);\n if (existing?.[auth.name] != null)\n continue;\n if (!ci && nonInteractive) {\n return yield* credentialsRequired(demand, profileName);\n }\n const ctx = { ci, reason: demandBanner(demand) };\n yield* profile.loadOrConfigure(auth, profileName, ctx);\n }\n});\n/**\n * The one-call seam wired into the dev path: scan the plan for live\n * demand and, if any, run {@link demandCredentials} BEFORE apply begins.\n */\nexport const demandPlanCredentials = (plan, options) => demandCredentials(collectCredentialDemands(plan), options);\n//# sourceMappingURL=Demand.js.map","import * as Duration from \"effect/Duration\";\nimport * as Effect from \"effect/Effect\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as Output from \"./Output.js\";\nimport { isPlainData, isPrimitive, mapPlainData } from \"./Util/data.js\";\n/**\n * Returns true when `value` (or any nested leaf) is still an unresolved\n * plan-time expression — i.e. an `Output`/`Expr` or an `Effect` that was\n * not fully evaluated by `resolveInput` in Plan.ts.\n *\n * Use at the top of a provider `diff` to short-circuit before field access:\n *\n * ```ts\n * if (!isResolved(news)) return undefined;\n * const resolved = news as MyProps;\n * ```\n */\nexport const hasUnresolvedInputs = (value) => _hasUnresolved(value);\nexport const isResolved = (value) => !_hasUnresolved(value);\nconst _hasUnresolved = (value, seen = new WeakSet()) => {\n if (value == null || isPrimitive(value))\n return false;\n if (Output.isExpr(value) || Effect.isEffect(value))\n return true;\n // Only plain data is traversed; any other class instance (Layer, Context,\n // Date, SDK objects) is a resolved leaf — see isPlainData (#1082).\n if (isPlainData(value)) {\n if (seen.has(value))\n return false;\n seen.add(value);\n return Object.values(value).some((v) => _hasUnresolved(v, seen));\n }\n return false;\n};\n/**\n * Deeply replace every unresolved plan-time expression (an `Output`/`Expr`\n * or an un-evaluated `Effect`) with `undefined`, leaving resolved values\n * (including opaque `Redacted`/`Duration` instances) intact.\n *\n * Persisted resource state must only ever hold plain data. Durable (JSON)\n * state stores already enforce this implicitly — Output proxies are\n * function-typed, so `JSON.stringify` silently drops them — but the\n * in-memory store used by tests retains live proxies, which would later be\n * fed back into provider lifecycle operations as `olds` after an\n * interrupted apply (e.g. `read` during a destroy plan) and blow up on\n * first string coercion. Sanitizing at the commit boundary keeps both\n * store kinds consistent with the provider contract that `olds` is\n * resolved `Props`.\n */\nexport const stripUnresolved = (value) => _stripUnresolved(value);\nconst _stripUnresolved = (value, \n// Ancestor-path cycle guard: a value on its own ancestor chain is cut to\n// `undefined` (a cycle can never persist). Sync DFS, so add/delete around\n// the recursion is race-free and keeps shared diamond references intact\n// (#1082).\nancestors = new WeakSet()) => {\n if (value == null || isPrimitive(value))\n return value;\n if (Output.isExpr(value) || Effect.isEffect(value))\n return undefined;\n // Serializable leaves — the only class instances persisted state may\n // carry (StateEncoding knows Redacted/Duration; Date JSON-encodes).\n // Rebuilding them structurally would strip their prototype.\n if (Redacted.isRedacted(value) ||\n Duration.isDuration(value) ||\n value instanceof Date) {\n return value;\n }\n if (isPlainData(value)) {\n return mapPlainData(value, ancestors, (child) => _stripUnresolved(child, ancestors));\n }\n // Any other class instance (Layer, Context, SDK objects) is runtime-only\n // wiring that can't round-trip through JSON — a beta.103 Context is even\n // cyclic (#1082). Persisted state holds plain data only.\n return undefined;\n};\n/**\n * Deeply replace Effect-valued entries with `undefined`, leaving resolved\n * values AND unresolved `Output`/`Expr`s intact.\n *\n * Effect-valued props — e.g. a tagged Worker class in `env` (the\n * circular-bindings pattern) — can never be evaluated inside lifecycle\n * operations, and {@link stripUnresolved} drops them from persisted state at\n * the commit boundary. A provider `diff` that wants its structural change\n * detection to still run despite them strips them first, so `isResolved`\n * gates only on genuinely-unresolved Outputs (#874). The Effects' deploy-time\n * identity is carried by the resolved binding data instead.\n */\nexport const stripEffects = (value) => _stripEffects(value);\nconst _stripEffects = (value, \n// Ancestor-path cycle guard — see _stripUnresolved (#1082).\nancestors = new WeakSet()) => {\n if (value == null || isPrimitive(value))\n return value;\n // Output proxies are left intact (so `isResolved` still sees them); they\n // must be tested BEFORE `Effect.isEffect` because Output exprs are\n // yieldable and would otherwise be misclassified as plain Effects.\n if (Output.isExpr(value))\n return value;\n if (Effect.isEffect(value))\n return undefined;\n if (Redacted.isRedacted(value) ||\n Duration.isDuration(value) ||\n value instanceof Date) {\n return value;\n }\n if (isPlainData(value)) {\n return mapPlainData(value, ancestors, (child) => _stripEffects(child, ancestors));\n }\n // Non-plain instances (Layer, Context, SDK objects) are dropped with\n // Effects — same runtime-only rationale, and their internals may be\n // cyclic (effect ≥4.0.0-beta.103's Context — #1082).\n return undefined;\n};\nexport const somePropsAreDifferent = (olds, news, props) => {\n for (const prop of props) {\n if (olds[prop] !== news[prop]) {\n return true;\n }\n }\n return false;\n};\nexport const anyPropsAreDifferent = (olds, news) => {\n for (const prop in olds) {\n if (olds[prop] !== news[prop]) {\n return true;\n }\n }\n for (const prop in news) {\n if (!(prop in olds)) {\n return true;\n }\n }\n return false;\n};\nexport const havePropsChanged = (oldProps, newProps) => Output.hasOutputs(newProps) ||\n // Compare both sides through `stripUnresolved` so the comparison is\n // symmetric with the commit boundary: persisted props can never hold an\n // Effect or Output expr (stripped at commit / silently dropped by JSON\n // serialization), while desired props may still carry them — e.g. a tagged\n // Worker class in `env` serializes via its `toJSON` to\n // `{\"_id\":\"Effect\",...}` and would otherwise report a phantom change on\n // every plan, forever (#874). Unresolved Outputs in `newProps` are already\n // caught by the `hasOutputs` guard above, so stripping here never hides a\n // real difference.\n JSON.stringify(canonicalize(stripUnresolved(oldProps ?? {}), false)) !==\n JSON.stringify(canonicalize(stripUnresolved(newProps ?? {}), false));\n/**\n * Sort-keys deep equality for plain data (objects, arrays, primitives).\n * Use in provider `diff` handlers instead of ad-hoc `JSON.stringify` comparisons.\n *\n * By default, `null` and `undefined` are treated as distinct. Pass\n * `{ stripNullish: true }` to opt into treating them as equivalent.\n */\nexport const deepEqual = (a, b, options) => JSON.stringify(canonicalize(a, options?.stripNullish ?? false)) ===\n JSON.stringify(canonicalize(b, options?.stripNullish ?? false));\nconst canonicalize = (value, stripNullish, \n// Ancestor-path cycle guard — see _stripUnresolved (#1082).\nancestors = new WeakSet()) => {\n if (stripNullish && value == null)\n return undefined;\n if (Redacted.isRedacted(value)) {\n return {\n _tag: \"Redacted\",\n value: Redacted.value(value),\n };\n }\n // JSON-safe leaves compare by their serialized form (Duration/Date have\n // toJSON).\n if (Duration.isDuration(value) || value instanceof Date)\n return value;\n if (isPlainData(value)) {\n const rebuilt = mapPlainData(value, ancestors, (child) => canonicalize(child, stripNullish, ancestors));\n if (rebuilt === undefined || Array.isArray(rebuilt))\n return rebuilt;\n // Deterministic key order for the JSON.stringify comparison. Filtering\n // after the walk is JSON-equivalent to filtering before it —\n // undefined-valued keys are dropped by JSON.stringify either way.\n return Object.fromEntries(Object.entries(rebuilt)\n .filter(([, nested]) => !stripNullish || nested != null)\n .sort(([a], [b]) => a.localeCompare(b)));\n }\n if (value && typeof value === \"object\") {\n // Non-plain instances (Effect, Layer, Context, SDK objects) never\n // canonicalize — walking them is unsafe (cyclic on effect\n // ≥4.0.0-beta.103 — #1082) and comparing them is meaningless.\n return undefined;\n }\n return value;\n};\n/**\n * Deterministic ordering for binding rows.\n *\n * Bindings are registered by concurrently-built layers (a Function/Worker's\n * capability layers run real IO — bundling, fs — before calling `host.bind`),\n * so the registration order of `stack.bindings[fqn]` is not stable across\n * deploys. `diffBindings` itself is sid-keyed and order-insensitive, but the\n * row order flows into provider `diff`/`reconcile` inputs and persisted\n * state — any consumer that hashes or deep-compares the binding array (e.g.\n * a metadata hash over bindings) would churn on registration-order flips.\n * Sorting by `sid` at every boundary makes binding rows stable.\n */\nconst bySid = (a, b) => a.sid < b.sid ? -1 : a.sid > b.sid ? 1 : 0;\nexport const sortBindings = (bindings) => [...bindings].sort(bySid);\n/**\n * Collapse bindings that share the same `sid`, keeping the last occurrence,\n * and return them in deterministic (sid-sorted) order.\n *\n * The same binding can be recorded more than once on a target resource — e.g.\n * a KV namespace bound to both a Worker and a Workflow ends up pushed twice to\n * `stack.bindings[fqn]`. `diffBindings` already collapses these implicitly via\n * its `Map` keyed by `sid`, so the `reconcile` path never observes duplicates.\n * Use this helper to give a provider's `diff` handler the same de-duplicated\n * binding set, keeping plan-time hashing consistent with deploy-time.\n */\nexport const dedupeBindings = (bindings) => sortBindings(Array.from(new Map(bindings.map((b) => [b.sid, b])).values()));\nexport const diffBindings = (oldBindings, newBindings) => {\n const oldMap = new Map(oldBindings.map((b) => [b.sid, b]));\n const newMap = new Map(newBindings.map((b) => [b.sid, b]));\n return sortBindings([\n ...Array.from(oldMap)\n .filter(([sid]) => !newMap.has(sid))\n .map(([sid, old]) => ({\n sid,\n action: \"delete\",\n data: old.data,\n })),\n ...Array.from(newMap).map(([sid, binding]) => {\n const old = oldMap.get(sid);\n return {\n sid,\n action: (!old\n ? \"create\"\n : havePropsChanged(old.data, binding.data)\n ? \"update\"\n : \"noop\"),\n data: binding.data,\n };\n }),\n ]);\n};\n//# sourceMappingURL=Diff.js.map","import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\n/** A 16-byte (128-bit) random hex-encoded string representing an physical instance of a logical resource */\nexport class InstanceId extends Context.Service()(\"instance-id\") {\n}\n/**\n * @returns Hex-encoded instance ID (16 random bytes)\n */\nexport const generateInstanceId = () => Effect.sync(() => {\n const bytes = new Uint8Array(16);\n crypto.getRandomValues(bytes);\n return Array.from(bytes)\n .map((b) => b.toString(16).padStart(2, \"0\"))\n .join(\"\");\n});\n//# sourceMappingURL=InstanceId.js.map","import * as Effect from \"effect/Effect\";\nexport const assertDefined = (value, message) => {\n if (!value) {\n throw new Error(message);\n }\n return value;\n};\nexport const asEffect = (effect) => typeof effect?.asEffect === \"function\"\n ? effect.asEffect()\n : Effect.isEffect(effect)\n ? effect\n : Effect.succeed(effect);\n//# sourceMappingURL=types.js.map","import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { makeCaptureContext } from \"./ActionRuntimeContext.js\";\nimport { toFqn } from \"./FQN.js\";\nimport { CurrentNamespace } from \"./Namespace.js\";\nimport * as Output from \"./Output.js\";\nimport { RuntimeContext } from \"./RuntimeContext.js\";\nimport { Stack } from \"./Stack.js\";\nexport const isAction = (value) => typeof value === \"object\" && value !== null && value?.Kind === \"action\";\nexport function Action(...args) {\n if (args.length === 0) {\n // Tagged form: Action<Self, In, Out>()(type)\n return (type) => makeActionClass(type, undefined);\n }\n // Inline form: Action(type, runnerOrInit)\n const [type, initOrRun] = args;\n return makeActionClass(type, initOrRun);\n}\nconst isRunnerEffect = (v) => Effect.isEffect(v);\nconst makeActionClass = (type, baked) => {\n // Pre-resolve baked init/runner into a single Effect<Runner, _, Req>. Use\n // Effect.cached so the init's body runs at most once per process — every\n // action instance after the first reuses the resolved runner without paying\n // the init cost (or re-yielding its dependencies).\n let resolveRunner;\n if (baked !== undefined) {\n resolveRunner = isRunnerEffect(baked)\n ? Effect.runSync(Effect.cached(baked))\n : Effect.succeed(baked);\n }\n // Tagged form needs a Context tag so the user can supply the runner\n // through a Layer. Inline form bakes the runner in and skips the tag.\n const SelfTag = baked\n ? undefined\n : Context.Service(`alchemy/Action<${type}>`);\n // Outputs referenced via `yield* output` inside the init Effect land here,\n // recorded by the capture RuntimeContext. Shared per definition — the init\n // runs at most once (Effect.cached), so captures are inherently\n // per-definition, matching how the init's `Req` bubbles per definition.\n const captures = {};\n const captureContext = makeCaptureContext(captures);\n const constructor = (...args) => {\n const [id, input] = args.length === 1 ? [type, args[0]] : args;\n return Effect.gen(function* () {\n const run = resolveRunner\n ? yield* resolveRunner.pipe(Effect.provideService(RuntimeContext, captureContext))\n : (yield* SelfTag);\n return yield* registerAction(type, id, input, run, captures);\n });\n };\n const extra = { Type: type };\n if (SelfTag) {\n extra.Self = SelfTag;\n // `.make(initOrRun)` — accepts either a direct runner or an init Effect.\n // For init form we use `Layer.effect` so the init's Req surfaces on the\n // Layer, and run it under the capture RuntimeContext so `yield* output`\n // accessors are recorded just like the inline form; for runners we use\n // `Layer.succeed` (nothing to capture).\n extra.make = (initOrRun) => isRunnerEffect(initOrRun)\n ? Layer.effect(SelfTag, initOrRun.pipe(Effect.provideService(RuntimeContext, captureContext)))\n : Layer.succeed(SelfTag, initOrRun);\n }\n return Object.assign(constructor, extra);\n};\nconst registerAction = (type, id, input, run, captures) => Effect.gen(function* () {\n const stack = yield* Stack;\n const namespace = yield* CurrentNamespace;\n const fqn = toFqn(namespace, id);\n const actions = (stack.actions ??= {});\n const existing = actions[fqn];\n if (existing)\n return Output.of(existing);\n // FQN collision check: actions share the same FQN namespace as resources\n // so the dependency graph stays unified. Rejecting overlaps here makes\n // the constraint obvious at registration time.\n if (stack.resources[fqn]) {\n return yield* Effect.die(new Error(`Action '${fqn}' collides with a Resource of the same logical id`));\n }\n const target = {\n Kind: \"action\",\n Type: type,\n Namespace: namespace,\n FQN: fqn,\n LogicalId: id,\n Input: input,\n Captures: captures,\n Run: run,\n Output: undefined,\n };\n target.toString = () => `Action<${type}>(${id})`;\n actions[fqn] = target;\n // `yield* Sync({...})` returns `Output<Out>`. The engine writes the\n // materialized value into `tracker[fqn]` during apply; `Output.of(action)`\n // resolves a ResourceExpr by looking up `outputs[fqn]` — which is\n // precisely that materialized value. Property access into the returned\n // Output chains through the standard PropExpr proxy.\n return Output.of(target);\n});\n//# sourceMappingURL=Action.js.map","import * as Duration from \"effect/Duration\";\nimport * as Effect from \"effect/Effect\";\nimport * as Exit from \"effect/Exit\";\nimport * as Metric from \"effect/Metric\";\n/**\n * Counter for resource lifecycle operations. Tagged per call with\n * `resource_type`, `op` (`precreate`/`create`/`update`/`delete`/`read`),\n * and `status` (`success`/`error`).\n */\nexport const resourceCounter = Metric.counter(\"alchemy.resource.operations\", {\n description: \"Number of resource lifecycle operations dispatched by alchemy apply.\",\n incremental: true,\n});\n/**\n * Histogram of how long each lifecycle operation takes.\n */\nexport const resourceDuration = Metric.timer(\"alchemy.resource.duration\", {\n description: \"Wall-clock duration of resource lifecycle operations dispatched by alchemy apply.\",\n});\n/**\n * Counter for CLI command invocations.\n */\nexport const cliCounter = Metric.counter(\"alchemy.cli.invocations\", {\n description: \"Number of alchemy CLI command invocations.\",\n incremental: true,\n});\n/**\n * Counter for Cloudflare State Store bootstrap/deploy operations.\n * Tagged per call with `op` (e.g. `deploy`) and `status`\n * (`success`/`error`) so that the deploy success rate of the\n * state store itself can be tracked separately from regular\n * resource lifecycle ops.\n */\nexport const stateStoreCounter = Metric.counter(\"alchemy.state_store.operations\", {\n description: \"Number of Cloudflare State Store deploy/bootstrap operations dispatched by alchemy.\",\n incremental: true,\n});\n/**\n * Counter for State store layer construction. Tagged with `id` (the\n * `StateService.id` slug) so we can answer \"how many distinct projects\n * are using each backend\" from the corresponding `state_store.init`\n * spans. Open-ended on purpose: third-party state stores get counted\n * automatically by setting their `StateService.id`.\n */\nexport const stateStoreInitCounter = Metric.counter(\"alchemy.state_store.inits\", {\n description: \"Number of times a State store layer is constructed.\",\n incremental: true,\n});\n/**\n * Wraps a resource lifecycle Effect to record a counter + timer entry,\n * tagged with `resource_type`, `op`, and `status` (`success`/`error`).\n *\n * Usage:\n * ```ts\n * provider.reconcile(input).pipe(recordResourceOp(node.resource.Type, \"create\"))\n * ```\n */\nexport const recordResourceOp = (resourceType, op) => (self) => Effect.suspend(() => {\n const startNs = process.hrtime.bigint();\n const baseAttrs = { resource_type: resourceType, op };\n return self.pipe(Effect.onExit((exit) => recordOutcome(baseAttrs, Exit.isSuccess(exit) ? \"success\" : \"error\", elapsed(startNs))));\n});\n/**\n * Wraps a CLI command Effect to bump {@link cliCounter} with the\n * outcome (`success`/`error`).\n */\nexport const recordCli = (command) => (self) => self.pipe(Effect.onExit((exit) => Metric.update(Metric.withAttributes(cliCounter, {\n command,\n status: Exit.isSuccess(exit) ? \"success\" : \"error\",\n}), 1)));\n/**\n * Wraps a Cloudflare State Store deploy/bootstrap Effect to bump\n * {@link stateStoreCounter} with the outcome (`success`/`error`),\n * tagged with the given `op`.\n */\nexport const recordStateStoreOp = (op) => (self) => self.pipe(Effect.onExit((exit) => Metric.update(Metric.withAttributes(stateStoreCounter, {\n op,\n status: Exit.isSuccess(exit) ? \"success\" : \"error\",\n}), 1)));\n/**\n * Wraps a State store construction Effect to:\n *\n * 1. Bump {@link stateStoreInitCounter} tagged with `id`.\n * 2. Open a `state_store.init` span carrying\n * `alchemy.state_store.id` so Axiom (which can't query metric\n * datasets via APL) can group projects by backend.\n *\n * The `id` is read off the constructed `StateService.id` field, so any\n * third-party state-store implementation gets tracked just by setting\n * a stable slug there. Apply at every `Layer.effect(State, …)` site\n * exactly once.\n */\nexport const recordStateStoreInit = (self) => \n// The debug lines bracket the first phase of a deploy that can block on\n// credential resolution (see `Auth/Lock.ts`). Without them a stalled\n// deploy produces no output at all, at any log level, and there is\n// nothing to tell \"hung\" apart from \"slow\".\nEffect.logDebug(\"state store: initializing\").pipe(Effect.andThen(self), Effect.tap((service) => Effect.all([\n Effect.logDebug(`state store: ready (${service.id})`),\n Metric.update(Metric.withAttributes(stateStoreInitCounter, { id: service.id }), 1),\n Effect.annotateCurrentSpan(\"alchemy.state_store.id\", service.id),\n], { discard: true })), Effect.withSpan(\"state_store.init\"));\nconst elapsed = (startNs) => Duration.nanos(process.hrtime.bigint() - startNs);\nconst recordOutcome = (baseAttrs, status, duration) => {\n const attrs = { ...baseAttrs, status };\n return Effect.all([\n Metric.update(Metric.withAttributes(resourceCounter, attrs), 1),\n Metric.update(Metric.withAttributes(resourceDuration, attrs), duration),\n ], { discard: true });\n};\n//# sourceMappingURL=Metrics.js.map","/**\n * Compute the set of graph nodes that participate in a dependency cycle.\n *\n * A node is considered \"in a cycle\" iff it sits in a strongly-connected\n * component (SCC) of size > 1, or has a self-edge (size-1 SCC that loops\n * back to itself).\n *\n * Implementation is iterative Tarjan's algorithm to avoid blowing the JS\n * call stack on very wide graphs.\n */\nexport const findCycleMembers = (edges) => {\n const cycleMembers = new Set();\n let index = 0;\n const indexOf = new Map();\n const lowlink = new Map();\n const onStack = new Set();\n const stack = [];\n const callStack = [];\n const startNode = (node) => {\n indexOf.set(node, index);\n lowlink.set(node, index);\n index += 1;\n stack.push(node);\n onStack.add(node);\n callStack.push({ node, childIdx: 0 });\n };\n for (const root of Object.keys(edges)) {\n if (indexOf.has(root))\n continue;\n startNode(root);\n while (callStack.length > 0) {\n const frame = callStack[callStack.length - 1];\n const children = edges[frame.node] ?? [];\n if (frame.childIdx < children.length) {\n const child = children[frame.childIdx];\n frame.childIdx += 1;\n if (!indexOf.has(child)) {\n startNode(child);\n continue;\n }\n if (onStack.has(child)) {\n lowlink.set(frame.node, Math.min(lowlink.get(frame.node), indexOf.get(child)));\n }\n continue;\n }\n // All children processed: maybe close an SCC.\n if (lowlink.get(frame.node) === indexOf.get(frame.node)) {\n const scc = [];\n for (;;) {\n const w = stack.pop();\n onStack.delete(w);\n scc.push(w);\n if (w === frame.node)\n break;\n }\n if (scc.length > 1) {\n for (const fqn of scc)\n cycleMembers.add(fqn);\n }\n else {\n // Size-1 SCC: only counts as a cycle if it has a self-edge.\n const only = scc[0];\n if ((edges[only] ?? []).includes(only)) {\n cycleMembers.add(only);\n }\n }\n }\n // Pop frame and propagate lowlink up to the parent.\n callStack.pop();\n const parent = callStack[callStack.length - 1];\n if (parent) {\n const cur = lowlink.get(parent.node);\n const childLow = lowlink.get(frame.node);\n if (childLow < cur)\n lowlink.set(parent.node, childLow);\n }\n }\n }\n return cycleMembers;\n};\n//# sourceMappingURL=scc.js.map","import * as Effect from \"effect/Effect\";\nimport { stableValue } from \"./stable.js\";\nexport const sha256 = (input) => Effect.promise(async () => {\n const digest = await crypto.subtle.digest(\"SHA-256\", toArrayBuffer(input));\n const hashArray = Array.from(new Uint8Array(digest));\n return hashArray.map((b) => b.toString(16).padStart(2, \"0\")).join(\"\");\n});\nexport const sha256Object = (input) => sha256(JSON.stringify(stableValue(input)));\n/**\n * Stable sha256 hex digest of a resolved Task input. Unlike\n * {@link sha256Object} this does not stabilize key ordering — it hashes the\n * raw `JSON.stringify(input ?? null)` so identical inputs map to identical\n * hashes for caching/equality checks.\n */\nexport const hashInput = (input) => sha256(JSON.stringify(input ?? null));\nconst toArrayBuffer = (input) => {\n if (input instanceof ArrayBuffer) {\n return input;\n }\n if (typeof input === \"string\") {\n return new TextEncoder().encode(input);\n }\n return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);\n};\n//# sourceMappingURL=sha256.js.map","/** @effect-diagnostics anyUnknownInErrorContext:off */\n/** @effect-diagnostics missingEffectError:off */\nimport * as Config from \"effect/Config\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as Option from \"effect/Option\";\nimport { asEffect } from \".//Util/types.js\";\nimport { isAction } from \"./Action.js\";\nimport { AdoptPolicy, OwnedBySomeoneElse, stripUnowned, Unowned, } from \"./AdoptPolicy.js\";\nimport { AlchemyContext } from \"./AlchemyContext.js\";\nimport { Artifacts, ArtifactStore, createArtifactStore, ensureArtifactStore, makeScopedArtifacts, } from \"./Artifacts.js\";\nimport { dedupeBindings, diffBindings, havePropsChanged, isResolved, } from \"./Diff.js\";\nimport { parseFqn } from \"./FQN.js\";\nimport { generateInstanceId, InstanceId } from \"./InstanceId.js\";\nimport * as Output from \"./Output.js\";\nimport { findProviderByType, missingProviderError, Provider, providerForMode, tryFindProviderByType, } from \"./Provider.js\";\nimport { defaultProviderMode, stampedMode, } from \"./ProviderMode.js\";\nimport { isResource, missingImplementation, } from \"./Resource.js\";\nimport {} from \"./Stack.js\";\nimport { isActionState, State, } from \"./State/index.js\";\nimport { isPlainData, mapPlainData } from \"./Util/data.js\";\nimport { findCycleMembers } from \"./Util/scc.js\";\nimport { hashInput } from \"./Util/sha256.js\";\nexport const isCRUD = (node) => {\n return (node &&\n typeof node === \"object\" &&\n (node.action === \"create\" ||\n node.action === \"update\" ||\n node.action === \"replace\" ||\n node.action === \"noop\"));\n};\nexport const make = (stack, options = {}) => \n// @ts-expect-error\nEffect.gen(function* () {\n const state = yield* yield* State;\n const resources = Object.values(stack.resources);\n const actions = Object.values(stack.actions ?? {});\n // A bare platform tag yields a forward reference registered with\n // `undefined` props (and `RequiresImplementation`); its `.make(props,\n // impl)` Layer repairs the props when it builds (in either order — the\n // #874 circular env-tag pattern). Props still `undefined` after the\n // whole program evaluated means the tag was yielded but its Layer was\n // never provided — fail fast naming the class and its Layer instead of\n // letting a provider read `undefined` props (#1054). Plain resources\n // may legitimately be yielded without props (a reference to\n // already-deployed state), so the check is scoped to platform tags.\n for (const resource of resources) {\n if (resource.RequiresImplementation && resource.Props === undefined) {\n yield* Effect.die(missingImplementation(resource.Type, resource.LogicalId));\n }\n }\n // TODO(sam): rename terminology to Stack\n const stackName = stack.name;\n const stage = stack.stage;\n // Resolve the effective adoption setting for this plan. AdoptPolicy\n // (provided by the CLI or scoped via `adopt(...)`) takes precedence; if\n // unset, fall back to the AlchemyContext's `adopt` default; otherwise\n // adoption is disabled.\n const shouldAdopt = Effect.gen(function* () {\n const fromService = yield* Effect.serviceOption(AdoptPolicy);\n if (Option.isSome(fromService))\n return fromService.value;\n const ctx = yield* Effect.serviceOption(AlchemyContext);\n return Option.match(ctx, {\n onNone: () => false,\n onSome: (c) => c.adopt,\n });\n });\n // The run-level default provider mode (`alchemy dev` → \"local\",\n // `alchemy deploy` → \"live\"). A resource-scoped `remote()` (captured on\n // the resource at registration as `Mode`) opts out of local emulation.\n const runDefaultMode = yield* defaultProviderMode;\n /**\n * Resolve the effective provider mode and the concrete provider\n * service for a resource.\n *\n * The mode only \"sticks\" when the provider actually distinguishes\n * modes (registered via `ProviderLayer.dual`). Mode-agnostic providers\n * satisfy any requested mode with their single implementation — in a\n * dev run, a construct that mixes emulatable resources with live-only\n * ones (e.g. R2 buckets) just works.\n */\n const resolveProviderAndMode = Effect.fn(function* (resource) {\n const base = yield* findProviderByType(resource.Type);\n const mode = base.modes !== undefined\n ? (resource.Mode ?? runDefaultMode)\n : undefined;\n const provider = yield* providerForMode(base, mode);\n return { provider, mode };\n });\n /**\n * Has this resource switched provider modes since it was last\n * reconciled? Rows without a persisted mode were written by a\n * pre-provider-mode engine (or a provider that only became dual-mode\n * later) — their physical resource is LIVE unless its attrs carry a\n * `dev:` identity marker proving it was reconciled locally (see\n * {@link stampedMode}). A dev run replaces unstamped live rows exactly\n * like stamped live rows; live runs replace unstamped marker rows.\n */\n const hasModeSwitched = (mode, oldState) => mode !== undefined &&\n oldState !== undefined &&\n stampedMode(oldState) !== mode;\n const resourceFqns = yield* state.list({\n stack: stackName,\n stage: stage,\n });\n const oldResources = yield* Effect.all(resourceFqns.map((fqn) => state.get({ stack: stackName, stage: stage, fqn })), { concurrency: \"unbounded\" });\n // Snapshot of every persisted row, keyed by FQN. The rename resolution\n // below reads from this map instead of issuing per-FQN `state.get`s —\n // every renamedFrom-decorated resource (each StaticSite carries one\n // forever) would otherwise add two round-trips per resource to every\n // plan against a remote state store. Plan is read-only, so the\n // snapshot cannot go stale within this run.\n const persistedRows = new Map(resourceFqns.map((fqn, i) => [fqn, oldResources[i]]));\n // ── FQN renames ──────────────────────────────────────────────────────\n // Map every former FQN claimed via `renamedFrom(...)` to its claimant's\n // current FQN. Two resources claiming the same former FQN is ambiguous\n // and fatal. A former FQN MAY still be actively declared — that is the\n // \"old id reused by a new resource\" case: the rename claim wins the\n // row (it is an explicit user statement that the row was theirs), and\n // the reusing resource plans a fresh create.\n const formerFqnClaims = new Map();\n for (const resource of resources) {\n for (const formerFqn of resource.FormerFqns ?? []) {\n if (formerFqn === resource.FQN)\n continue;\n const claimant = formerFqnClaims.get(formerFqn);\n if (claimant !== undefined && claimant !== resource.FQN) {\n return yield* Effect.die(new Error(`Resources '${claimant}' and '${resource.FQN}' both claim ` +\n `former FQN '${formerFqn}' via renamedFrom(...). A former ` +\n \"FQN can migrate to exactly one resource — remove the \" +\n \"decoration from one of them.\"));\n }\n formerFqnClaims.set(formerFqn, resource.FQN);\n }\n }\n // Resolve every rename migration up-front against the state snapshot,\n // BEFORE any node is built — other resources' planning depends on the\n // outcome (a resource declared at a former FQN whose row is migrating\n // away must start from scratch).\n //\n // For each renamer, in former-id declaration order (most recent\n // first):\n //\n // - `source` is the row that defines the resource's physical identity:\n // the row at its own FQN when present AND type-matching, otherwise\n // the first type-matching former row (→ `moved`).\n // - every OTHER type-matching former row sharing `source.instanceId`\n // is a leftover from an interrupted migration (only migration copies\n // instanceIds) — collected for state-only cleanup.\n // - former rows with a different instanceId belong to someone else and\n // are left to normal orphan handling; former rows with a different\n // resourceType (modulo registered type-aliases) can never be this\n // resource's row and are skipped entirely.\n // - a FOREIGN-typed row at the renamer's own FQN blocks the migration\n // fatally: landing the migrated row there would silently abandon\n // that row's cloud resource.\n const renameMigrations = new Map();\n const migratedRowFqns = new Set();\n const resolveRenamer = Effect.fn(function* (resource) {\n const provider = Option.getOrUndefined(yield* tryFindProviderByType(resource.Type));\n const allowedTypes = new Set([\n resource.Type,\n ...(provider?.aliases ?? []),\n ]);\n const persisted = persistedRows.get(resource.FQN);\n const persistedRow = isActionState(persisted)\n ? undefined\n : persisted;\n // A row at this resource's own FQN that a PREVIOUSLY RESOLVED\n // renamer claimed (a same-deploy shift: A→B while B→C — C took the\n // row at B) is moving away: it is not ours to keep and it does not\n // block the migration landing here.\n const rowTaken = migratedRowFqns.has(resource.FQN);\n const ownRow = !rowTaken &&\n persistedRow !== undefined &&\n allowedTypes.has(persistedRow.resourceType)\n ? persistedRow\n : undefined;\n let source = ownRow;\n let adopted = ownRow;\n const renamedFrom = [];\n for (const formerFqn of resource.FormerFqns) {\n if (formerFqnClaims.get(formerFqn) !== resource.FQN)\n continue;\n // The same former id may be listed twice (or resolve identically);\n // collect each former row once.\n if (renamedFrom.includes(formerFqn))\n continue;\n const formerPersisted = persistedRows.get(formerFqn);\n if (formerPersisted === undefined || isActionState(formerPersisted)) {\n continue;\n }\n const formerRow = formerPersisted;\n if (!allowedTypes.has(formerRow.resourceType))\n continue;\n if (source === undefined) {\n source = formerRow;\n adopted = {\n ...formerRow,\n fqn: resource.FQN,\n logicalId: resource.LogicalId,\n namespace: resource.Namespace,\n };\n renamedFrom.push(formerFqn);\n }\n else if (source.instanceId === formerRow.instanceId) {\n renamedFrom.push(formerFqn);\n }\n }\n if (renamedFrom.length === 0)\n return;\n if (persistedRow !== undefined && ownRow === undefined && !rowTaken) {\n return yield* Effect.die(new Error(`Cannot migrate '${renamedFrom[0]}' to '${resource.FQN}': a ` +\n `state row of a different type ('${persistedRow.resourceType}') ` +\n `already occupies '${resource.FQN}'. Migrating over it would ` +\n \"silently abandon that row's cloud resource. Delete or \" +\n \"rename the conflicting resource first, then re-deploy.\"));\n }\n renameMigrations.set(resource.FQN, {\n row: adopted,\n renamedFrom,\n moved: adopted !== ownRow,\n });\n for (const formerFqn of renamedFrom)\n migratedRowFqns.add(formerFqn);\n });\n // Resolve renamers in claim-dependency order: when resource R's OWN\n // FQN is claimed as a former id by resource S (a same-deploy shift:\n // A→B while B→C), S must resolve first — whether S takes R's row\n // decides whether R still owns it, or falls back to ITS former rows.\n // Iterate to fixpoint; anything left is a claim CYCLE (a swap: A⇄B),\n // which cannot be persisted safely — the migrations would overwrite\n // and delete each other's rows — and dies loudly.\n let pendingRenamers = resources.filter((r) => r.FormerFqns?.length);\n const resolvedRenamers = new Set();\n while (pendingRenamers.length > 0) {\n const ready = pendingRenamers.filter((resource) => {\n const claimant = formerFqnClaims.get(resource.FQN);\n return claimant === undefined || resolvedRenamers.has(claimant);\n });\n if (ready.length === 0) {\n return yield* Effect.die(new Error(`Rename cycle detected among [${pendingRenamers\n .map((r) => `'${r.FQN}'`)\n .join(\", \")}]: their renamedFrom(...) declarations claim each other's ` +\n \"FQNs. Swapping ids in one deploy is not supported — rename \" +\n \"through a temporary id across two deploys instead.\"));\n }\n for (const resource of ready) {\n yield* resolveRenamer(resource);\n resolvedRenamers.add(resource.FQN);\n }\n pendingRenamers = pendingRenamers.filter((r) => !resolvedRenamers.has(r.FQN));\n }\n /**\n * Fetch the persisted row for a declared resource, resolving renames\n * (see the pre-computed `renameMigrations` above):\n *\n * - a renamer plans from its migrated row (`renamedFrom` rides onto\n * the plan node; apply persists the move before any lifecycle op)\n * - a resource declared at a former FQN whose row is migrating away\n * starts from scratch — the row is NOT its state, whatever the FQN\n * says\n */\n const getPersistedRow = Effect.fn(function* (resource) {\n const migration = renameMigrations.get(resource.FQN);\n if (migration !== undefined) {\n return {\n row: migration.row,\n renamedFrom: migration.renamedFrom,\n renameMoved: migration.moved,\n };\n }\n const persisted = yield* state.get({\n stack: stackName,\n stage: stage,\n fqn: resource.FQN,\n });\n const row = isActionState(persisted)\n ? undefined\n : persisted;\n if (row !== undefined && migratedRowFqns.has(resource.FQN)) {\n return { row: undefined, renamedFrom: undefined, renameMoved: false };\n }\n return { row, renamedFrom: undefined, renameMoved: false };\n });\n const resolvedResources = {};\n const resolveResource = (resourceExpr) => Effect.gen(function* () {\n // Tasks share the ResourceExpr machinery but have no provider /\n // stable-properties story at plan time. Leave the expression\n // unsubstituted — Apply resolves it from the tracker at run time.\n if (isAction(resourceExpr.src)) {\n return resourceExpr;\n }\n // @ts-expect-error\n return yield* (resolvedResources[resourceExpr.src.FQN] ??=\n yield* Effect.cached(Effect.gen(function* () {\n const resource = resourceExpr.src;\n const { provider, mode } = yield* resolveProviderAndMode(resource);\n const props = materializeStableRefs(yield* resolveInput(resource.Props));\n // Falls back to the row at a former FQN (`renamedFrom`) so a\n // renamed resource's stable attributes keep flowing to\n // downstream diffs across the migration.\n const { row: oldState } = yield* getPersistedRow(resource);\n if (!oldState || oldState.status === \"creating\") {\n return resourceExpr;\n }\n // The resource is switching provider modes (local ⇄ live):\n // it will be replaced, so nothing about the persisted attrs\n // is stable for downstream consumers.\n if (hasModeSwitched(mode, oldState)) {\n return resourceExpr;\n }\n const oldProps = oldState.status === \"updating\"\n ? oldState.old.props\n : oldState.props;\n // Normalize both sides through `dedupeBindings` so the binding\n // sets handed to `diff` are deduped AND sid-sorted — provider\n // diffs that hash/compare the arrays never churn on\n // registration-order flips (or on legacy unsorted state).\n const oldBindings = dedupeBindings(oldState.bindings ?? []);\n const newBindings = dedupeBindings(stack.bindings[resource.FQN] ?? []);\n const diff = yield* provider.diff\n ? provider\n .diff({\n id: resource.LogicalId,\n fqn: resource.FQN,\n olds: oldProps,\n instanceId: oldState.instanceId,\n news: props,\n output: oldState.attr,\n oldBindings,\n newBindings,\n })\n .pipe(providePlanScope(resource.FQN, oldState.instanceId))\n : Effect.succeed(undefined);\n // A present `diff.stables` is authoritative for this update and\n // overrides `provider.stables`. We only fall back to the\n // provider-level \"always stable\" list when the diff does not\n // return one (e.g. no diff fn, or a diff that omits `stables`).\n const stables = diff?.stables ?? provider.stables ?? [];\n const withStables = (output) => stables.length > 0\n ? new Output.ResourceExpr(resourceExpr.src, Object.fromEntries(stables.map((stable) => [stable, output?.[stable]])))\n : // if there are no stable properties, treat every property as changed\n resourceExpr;\n if (diff == null) {\n if (havePropsChanged(oldProps, props)) {\n // the props have changed but the provider did not provide any hints as to what is stable\n // so we must assume everything has changed\n return withStables(oldState?.attr);\n }\n }\n else if (diff.action === \"update\") {\n return withStables(oldState?.attr);\n }\n else if (diff.action === \"replace\") {\n return resourceExpr;\n }\n // `--force` upgrades this resource's noop to an update (see the\n // diff mapping in the resource-graph pass below), so its\n // `reconcile` WILL re-run and may produce fresh attributes —\n // that is the point of --force. Returning the persisted attr\n // snapshot here would bake potentially-stale values into every\n // consumer's plan props and binding data, so consumers would\n // keep the stale attrs even though the upstream just\n // re-reconciled. Expose only the stable attributes and let\n // apply re-evaluate the rest against the forced reconcile's\n // fresh output.\n if (options.force) {\n return withStables(oldState?.attr);\n }\n if (oldState.status === \"created\" ||\n oldState.status === \"updated\" ||\n oldState.status === \"replaced\") {\n // we can safely return the attributes if we know they have stabilized\n return oldState?.attr;\n }\n else {\n // we must assume the resource doesn't exist if it hasn't stabilized\n return resourceExpr;\n }\n })));\n });\n /**\n * Resolve an input value as far as *truth* permits, keeping everything\n * else evaluable. A whole-resource reference to an updating upstream\n * stays a `ResourceExpr` (its stable attributes riding along): the\n * non-stable attributes are unknown at plan time and MUST be\n * re-evaluated — Apply runs `Output.evaluate(node.props, outputs)`\n * against the upstream's fresh post-reconcile attributes right before\n * `reconcile`. This is the value plan nodes carry; the diff-facing view\n * is derived from it by {@link materializeStableRefs}.\n */\n const resolveInput = (input, \n // Ancestor chain of the current walk. A value that appears on its own\n // ancestor path is a true cycle and is cut to `undefined` (a cycle can\n // never persist or serialize anyway); an immutable per-level set (not\n // a shared visited-set) keeps legitimately-shared diamond references\n // intact and is race-free under `concurrency: \"unbounded\"` (#1082).\n ancestors = new Set()) => Effect.gen(function* () {\n if (!input) {\n return input;\n }\n else if (Output.isExpr(input)) {\n return yield* resolveOutput(input);\n }\n else if (Config.isConfig(input)) {\n // Config is a lazy reference to the deploy environment. Resolve it\n // here so the concrete value flows into diffing/hashing (an opaque\n // Config hashes the same regardless of the underlying value) and so\n // providers receive a resolved value instead of a Config object.\n // `Config.redacted` resolves to a `Redacted`, which stays opaque via\n // the branch below.\n return yield* resolveInput(yield* input, ancestors);\n }\n else if (isResource(input)) {\n // Resource objects have dynamic properties (path, hash, etc.) that are\n // created on-demand by a Proxy getter and aren't enumerable via Object.entries.\n // Resolve the ResourceExpr to get the actual resource output, then continue\n // resolving any nested outputs in the result.\n const resourceExpr = Output.of(input);\n const resolved = yield* resolveOutput(resourceExpr);\n if (Output.isResourceExpr(resolved)) {\n // Still-unresolved reference (creating, replacing, or updating\n // upstream) — keep it evaluable for Apply.\n return resolved;\n }\n return yield* resolveInput(resolved, ancestors);\n }\n else if (isPlainData(input)) {\n if (ancestors.has(input)) {\n return undefined;\n }\n const nested = new Set(ancestors).add(input);\n if (Array.isArray(input)) {\n return yield* Effect.all(input.map((item) => resolveInput(item, nested)), { concurrency: \"unbounded\" });\n }\n return Object.fromEntries(yield* Effect.all(Object.entries(input).map(([key, value]) => resolveInput(value, nested).pipe(Effect.map((value) => [key, value]))), { concurrency: \"unbounded\" }));\n }\n // Everything else is an opaque leaf returned by identity: Duration,\n // Redacted, Date, and effect runtime values (a Worker's `exports`\n // carries each DO's `constructor` Effect and captured `services`\n // Context). Rebuilding a class instance entry-by-entry would strip\n // its prototype, and effect ≥4.0.0-beta.103's Context is cyclic\n // (#1082). Redacted additionally stays wrapped to preserve the\n // secrecy boundary. This sits after `Config.isConfig` on purpose —\n // Configs are Effects but must still resolve.\n return input;\n });\n /**\n * Project a {@link resolveInput} resolution into the DIFF-facing view:\n * replace each whole-resource `ResourceExpr` that carries stable\n * attributes (an upstream being *updated* in place — see `withStables` in\n * `resolveResource`) with a plain object of those stables, so the known\n * values flow into the consumer's `diff` and `havePropsChanged` instead\n * of the whole reference looking unresolved and `isResolved`\n * short-circuiting (#670 — this forced the Neon `Branch` to hand-extract\n * `project.projectId`).\n *\n * The projection is deliberately lossy — diffs compare VALUES. Plan nodes\n * never carry it: they keep the evaluable resolution so `reconcile` sees\n * the upstream's fresh non-stable attributes (e.g. a Lambda Version's\n * `version` number — #993's alias promotion bug).\n */\n const materializeStableRefs = (input, \n // Ancestor-path cycle guard — see resolveInput (#1082). Sync DFS, so\n // add/delete around the recursion is race-free.\n ancestors = new WeakSet()) => {\n // Expr checks come first: Output proxies are callable, so a plain\n // `typeof input === \"object\"` guard would let them slip through.\n if (Output.isResourceExpr(input) && input.stables) {\n return materializeStableRefs(input.stables, ancestors);\n }\n else if (Output.isExpr(input)) {\n // Genuinely unknown (e.g. a creating upstream) — nothing to show diff.\n return input;\n }\n else if (!input || !isPlainData(input)) {\n // Primitives and non-plain instances (Duration, Redacted, Date,\n // Effect/Layer/Context) are leaves — see isPlainData (#1082).\n return input;\n }\n return mapPlainData(input, ancestors, (child) => materializeStableRefs(child, ancestors));\n };\n const resolveOutput = (expr) => Effect.gen(function* () {\n if (Output.isResourceExpr(expr)) {\n return yield* resolveResource(expr);\n }\n else if (Output.isPropExpr(expr)) {\n const upstream = yield* resolveOutput(expr.expr);\n return upstream?.[expr.identifier];\n }\n else if (Output.isApplyExpr(expr)) {\n const upstream = yield* resolveOutput(expr.expr);\n return Output.hasOutputs(upstream) ? expr : expr.f(upstream);\n }\n else if (Output.isEffectExpr(expr)) {\n const upstream = yield* resolveOutput(expr.expr);\n return Output.hasOutputs(upstream) ? expr : yield* expr.f(upstream);\n }\n else if (Output.isFlatMapExpr(expr)) {\n const upstream = yield* resolveOutput(expr.expr);\n // Source still unresolved -> keep the flatMap intact for a later pass.\n // Otherwise run `f` to produce the next Output and resolve into it.\n return Output.hasOutputs(upstream)\n ? expr\n : yield* resolveOutput(Output.asOutput(expr.f(upstream)));\n }\n else if (Output.isAllExpr(expr)) {\n return yield* Effect.all(expr.outs.map(resolveOutput), {\n concurrency: \"unbounded\",\n });\n }\n else if (Output.isLiteralExpr(expr)) {\n return expr.value;\n }\n else if (Output.isRefExpr(expr)) {\n const refStack = expr.stack ?? stackName;\n const refStage = expr.stage ?? stage;\n const refState = yield* state\n .get({\n stack: refStack,\n stage: refStage,\n fqn: expr.resourceId,\n })\n .pipe(Effect.orDie);\n if (!refState) {\n return yield* Effect.die(new Output.InvalidReferenceError({\n message: `Reference to '${expr.resourceId}' in stack '${refStack}' and stage '${refStage}' not found. Have you deployed '${refStage}' of '${refStack}'?`,\n stack: refStack,\n stage: refStage,\n resourceId: expr.resourceId,\n }));\n }\n return refState.attr ?? refState.output;\n }\n else if (Output.isStackRefExpr(expr)) {\n const refStack = expr.stack;\n const refStage = expr.stage ?? stage;\n const output = yield* state\n .getOutput({\n stack: refStack,\n stage: refStage,\n })\n .pipe(Effect.orDie);\n if (output == null) {\n return yield* Effect.die(new Output.InvalidReferenceError({\n message: `Reference to stack '${refStack}' at stage '${refStage}' not found. Have you deployed stage '${refStage}' of '${refStack}'?`,\n stack: refStack,\n stage: refStage,\n resourceId: refStack,\n }));\n }\n return output;\n }\n else if (Output.isNamedExpr(expr)) {\n return yield* resolveOutput(expr.expr);\n }\n return yield* Effect.die(new Error(\"Not implemented yet\" + expr.kind));\n });\n // map of resource FQN -> its downstream dependencies (resources that depend on it)\n const oldDownstreamDependencies = Object.fromEntries(oldResources\n .filter((resource) => !!resource)\n .map((resource) => [resource.fqn, resource.downstream]));\n // Build a set of FQNs for the new resources to detect orphans\n const newResourceFqns = new Set(resources.map((r) => r.FQN));\n const newActionFqns = new Set(actions.map((t) => t.FQN));\n // Unified set used wherever the DAG must include both kinds.\n const newNodeFqns = new Set([...newResourceFqns, ...newActionFqns]);\n // Map FQN -> list of upstream FQNs (resources this one depends on via props).\n // Tasks contribute upstream edges through their `Input` expression.\n const newUpstreamDependencies = Object.fromEntries([\n ...resources.map((resource) => [\n resource.FQN,\n Object.values(Output.upstreamAny(resource.Props)).map((r) => r.FQN),\n ]),\n ...actions.map((action) => [\n action.FQN,\n // An Action depends on the resources referenced by its Input *and*\n // any Output captured via `yield* output` inside its init Effect.\n Array.from(new Set([\n ...Object.values(Output.upstreamAny(action.Input)).map((r) => r.FQN),\n ...Object.values(Output.upstreamAny(action.Captures)).map((r) => r.FQN),\n ])),\n ]),\n ]);\n // Map FQN -> list of upstream FQNs from bindings\n const bindingUpstreamDependencies = Object.fromEntries(resources.map((resource) => [\n resource.FQN,\n Object.values(Output.upstreamAny(stack.bindings[resource.FQN] ?? [])).map((r) => r.FQN),\n ]));\n // Combined prop + binding upstream for the desired graph, including\n // references to resources outside the current graph so delete validation can\n // tell whether any surviving resource still points at an orphan.\n const rawUpstreamDependencies = Object.fromEntries([\n ...resources.map((resource) => {\n const fqn = resource.FQN;\n const propDeps = newUpstreamDependencies[fqn] ?? [];\n const bindDeps = bindingUpstreamDependencies[fqn] ?? [];\n return [fqn, [...new Set([...propDeps, ...bindDeps])]];\n }),\n // Actions have no bindings — their upstream is input + init captures,\n // both already folded into newUpstreamDependencies above.\n ...actions.map((action) => {\n const fqn = action.FQN;\n return [fqn, newUpstreamDependencies[fqn] ?? []];\n }),\n ]);\n // Combined prop + binding upstream, filtered to resources/tasks in this\n // graph for scheduling and cycle detection.\n const allUpstreamDependencies = Object.fromEntries([\n ...resources.map((resource) => {\n const fqn = resource.FQN;\n const deps = rawUpstreamDependencies[fqn] ?? [];\n return [fqn, deps.filter((dep) => newNodeFqns.has(dep))];\n }),\n ...actions.map((action) => {\n const fqn = action.FQN;\n const deps = newUpstreamDependencies[fqn] ?? [];\n return [fqn, deps.filter((dep) => newNodeFqns.has(dep))];\n }),\n ]);\n // Resources that participate in a cycle when both prop and binding\n // edges are considered. Used below to decide whether an acyclic\n // binding edge should also become a downstream edge.\n const combinedCycleMembers = findCycleMembers(allUpstreamDependencies);\n // Map FQN -> list of downstream FQNs (resources/actions that depend on\n // this one).\n //\n // Prop edges always become downstream edges — they can't form cycles\n // (the resource graph is a DAG by construction once props are fully\n // resolved). Binding edges become downstream edges too, except when\n // they participate in a cycle in the combined graph: mutual bindings\n // (A binds to B's data, B binds to A's data) intentionally do not\n // create downstream edges, so deletion does not deadlock waiting on\n // each other (see the \"binding-only cycles inside a construct\" test\n // in `plan.test.ts`).\n //\n // Including acyclic binding edges is required for cloud APIs that\n // enforce the binding at the provider level — e.g. a Cloudflare\n // Worker with a `service` binding to another Worker cannot delete\n // the upstream worker until the downstream worker's binding has been\n // removed. Without the binding edge in `downstream`, the two delete\n // concurrently and the upstream delete fails with\n // `ServiceBindingConflict`.\n //\n // Actions don't have bindings, so for action upstreams we use only\n // prop edges (which collapse to `newUpstreamDependencies` lookups).\n const computeDownstream = (upFqn) => {\n const downstream = [];\n for (const [downFqn, upstreams] of Object.entries(rawUpstreamDependencies)) {\n if (downFqn === upFqn)\n continue;\n if (!upstreams.includes(upFqn))\n continue;\n const isPropEdge = (newUpstreamDependencies[downFqn] ?? []).includes(upFqn);\n if (isPropEdge) {\n downstream.push(downFqn);\n continue;\n }\n // Binding-only edge — exclude when both endpoints sit inside\n // the same SCC of the combined graph.\n if (combinedCycleMembers.has(upFqn) &&\n combinedCycleMembers.has(downFqn)) {\n continue;\n }\n downstream.push(downFqn);\n }\n return downstream;\n };\n const newDownstreamDependencies = Object.fromEntries([\n ...resources.map((resource) => [resource.FQN, computeDownstream(resource.FQN)]),\n ...actions.map((action) => [action.FQN, computeDownstream(action.FQN)]),\n ]);\n const resourceGraph = Object.fromEntries((yield* Effect.all(resources.map(Effect.fn(\"plan.diff.resource\")(function* (resource) {\n const { provider, mode } = yield* resolveProviderAndMode(resource);\n const id = resource.LogicalId;\n const fqn = resource.FQN;\n // Apply-facing props (stored on the plan node): whole-resource\n // references to updating upstreams stay evaluable `ResourceExpr`s.\n // Apply runs `Output.evaluate(node.props, outputs)` right before\n // `reconcile`, so these references resolve to the upstream's\n // fresh post-reconcile attributes.\n const applyProps = yield* resolveInput(resource.Props);\n // Diff-facing view of the same resolution: stable attributes\n // materialized so their known values flow into `diff` /\n // `havePropsChanged`.\n const news = materializeStableRefs(applyProps);\n const downstream = newDownstreamDependencies[fqn] ?? [];\n // Apply-facing binding rows, mirroring `applyProps`: payloads\n // whose data embeds a whole-resource reference to an updating\n // upstream keep it as an evaluable `ResourceExpr`. Apply runs\n // `Output.evaluate(node.bindings, outputs)` right before\n // `reconcile`, so the host receives the upstream's fresh\n // post-reconcile attributes. Collapse duplicates by sid so the\n // binding set handed to `diff` matches what `reconcile` receives\n // (see `dedupeBindings`).\n const applyBindings = dedupeBindings(yield* resolveInput(stack.bindings[fqn] ?? []));\n // Diff-facing view of the same rows: stable attributes\n // materialized so `diffBindings` / `provider.diff` compare known\n // values. Terminal commits still persist the payload the provider\n // actually reconciled with (#874) — Apply commits the evaluated\n // `bindingOutputs`, not these plan-time shapes.\n const newBindings = materializeStableRefs(applyBindings);\n // The row is looked up at the resource's FQN with a fallback to\n // its former FQNs (`renamedFrom`); a row found under a former\n // FQN arrives here already remapped to the new identity, and\n // `renamedFrom` rides onto the plan node so apply persists the\n // move. (A Task previously holding this FQN is treated as no\n // prior state — its row is reaped by `actionDeletions` below.)\n const { row: persistedRow, renamedFrom, renameMoved, } = yield* getPersistedRow(resource);\n let oldState = persistedRow;\n // Engine-level adoption. When there is no prior state, always\n // consult `provider.read` (if implemented) so the engine — not\n // each lifecycle method — owns the existence/ownership decision.\n //\n // The provider returns one of:\n // - `undefined` → resource doesn't exist; create it\n // - plain attrs → exists and is owned by us; silent adopt\n // - `Unowned(attrs)` → exists but is *not* ours\n //\n // Routing:\n // - owned → adopt the `created` state\n // from attrs and continue\n // through the normal diff\n // path (so subsequent props\n // drift produces an update).\n // - unowned + adopt enabled → take over: adopt the\n // `created` state and let the\n // next update overwrite tags.\n // - unowned + adopt disabled → fail with\n // `OwnedBySomeoneElse`.\n //\n // Plan construction is side-effect-free: the adopted `created`\n // state is only held in-memory here (to drive the diff) and rides\n // onto the plan node as `node.state`. Persisting it to the state\n // store happens exclusively during APPLY of that node (the update\n // lifecycle commits `updating` / `updated` carrying this state).\n // If planning persisted here, a mere `alchemy plan` / `--dry-run`\n // would claim ownership of an unowned cloud resource, arming a\n // later unrelated deploy to orphan-delete it. See\n // https://github.com/alchemy-run/alchemy/issues/793.\n //\n // After a cold-start adoption (engine just discovered an\n // existing cloud resource via `read`), force the engine's\n // normal `update` path so the provider can re-sync ownership\n // tags, configuration, etc. against the desired props.\n // Adoption carries state with `props: news`, so the default\n // diff sees no drift and would noop — which would leave any\n // foreign-owned tags / divergent config in place. Forcing\n // update keeps the deploy idempotent: if cloud state already\n // matches news, the provider's update is a no-op write.\n //\n // Skip the adoption probe entirely when `news` still contains\n // unresolved upstream Outputs (e.g. a `streamArn` referencing\n // a stream being created in the same plan). Calling `read` with\n // an unresolved value would surface as `ParseError` from the\n // SDK protocol layer. Resources whose props depend on\n // not-yet-created upstreams cannot themselves be pre-existing\n // — there's nothing to adopt.\n // A resource declared at a former FQN whose row just migrated\n // away is genuinely NEW by declaration — skip the probe. Its\n // predecessor's physical resource still carries tags branded\n // with THIS logical id (the migrated row's reconcile hasn't\n // re-branded them yet), so a tag-based `read` would find it\n // and silently adopt the very resource that was renamed away.\n const reusesMigratedFqn = migratedRowFqns.has(fqn);\n let forceUpdateAfterAdoption = false;\n if (oldState === undefined &&\n provider.read &&\n isResolved(news) &&\n !reusesMigratedFqn) {\n const adoptInstanceId = yield* generateInstanceId();\n const readResult = yield* provider\n .read({\n id,\n fqn,\n instanceId: adoptInstanceId,\n olds: news,\n output: undefined,\n })\n .pipe(providePlanScope(fqn, adoptInstanceId));\n if (readResult !== undefined) {\n const isUnowned = Unowned.is(readResult);\n // A resource-scoped `adopt(...)` (captured on the resource at\n // registration) overrides the stack/CLI default.\n const adoptThis = resource.Adopt ?? (yield* shouldAdopt);\n if (isUnowned && !adoptThis) {\n return yield* new OwnedBySomeoneElse({\n message: `Cannot adopt resource '${fqn}' (${resource.Type}): ` +\n \"it exists in the cloud but is not owned by this \" +\n \"stack/stage/logical-id. Re-run with `--adopt` (or \" +\n \"wrap the effect in `adopt(true)`) to take it over.\",\n resourceType: resource.Type,\n logicalId: id,\n });\n }\n const adoptedState = {\n status: \"created\",\n fqn,\n logicalId: id,\n instanceId: adoptInstanceId,\n namespace: resource.Namespace,\n resourceType: resource.Type,\n props: news,\n attr: stripUnowned(readResult),\n providerVersion: provider.version ?? 0,\n bindings: [],\n downstream,\n removalPolicy: resource.RemovalPolicy,\n providerMode: mode,\n };\n // In-memory only — do NOT persist here. Plan.make runs for\n // `alchemy plan` / `deploy --dry-run` too, so a `state.set`\n // would mutate persistent state during a read-only preview.\n // The adopted state rides onto the plan node via `oldState`\n // (→ `node.state`) and is persisted at APPLY time by the\n // update lifecycle's `updating` / `updated` commits. See\n // https://github.com/alchemy-run/alchemy/issues/793.\n oldState = adoptedState;\n forceUpdateAfterAdoption = true;\n }\n }\n // Sid-sorted like `newBindings` (see the resolveResource note).\n const oldBindings = dedupeBindings(oldState?.bindings ?? []);\n // Actions come from the materialized comparison (`newBindings`);\n // the payloads the node carries into Apply come from the\n // apply-faithful rows, joined by sid — both are views of the same\n // deduped `stack.bindings[fqn]` rows, so action and payload can\n // never drift. `delete` rows keep the persisted old data.\n const applyBindingData = new Map(applyBindings.map((b) => [b.sid, b.data]));\n const bindingDiffs = diffBindings(oldBindings, newBindings).map((b) => b.action === \"delete\" || !applyBindingData.has(b.sid)\n ? b\n : { ...b, data: applyBindingData.get(b.sid) });\n // Local ⇄ live switch: the persisted row was reconciled by a\n // different provider mode than the one resolved for this run.\n // The two runtimes host distinct physical instances, so this is\n // always a replacement — the new instance is created with the\n // new mode's provider, and Apply deletes the old generation\n // with the provider of the mode that created it (see\n // `deleteOldGenerations` / `collectGarbage`).\n const modeSwitched = hasModeSwitched(mode, oldState);\n const Node = (node) => ({\n ...node,\n provider,\n resource,\n bindings: bindingDiffs,\n downstream,\n mode,\n renamedFrom,\n });\n // Plan against the persisted state we have, not the ideal final state we\n // hoped to reach last time. Recovery is expressed by mapping each\n // intermediate state back onto a fresh CRUD action.\n if (oldState === undefined) {\n return Node({\n action: \"create\",\n props: applyProps,\n state: oldState,\n });\n }\n else if (!modeSwitched &&\n oldState.status === \"creating\" &&\n oldState.attr === undefined) {\n // A create may have succeeded before state persistence failed. If the\n // provider can recover an attribute snapshot, keep driving the same\n // create instead of starting over blindly.\n //\n // `creating` state persists the RAW plan-time props, which may\n // still contain unresolved Output expressions (e.g. a name\n // referencing an upstream created in the same failed deploy).\n // `read` implementations derive identity from `olds` when\n // `output` is undefined (as it is here), so handing them\n // unresolved exprs crashes. Skip the probe — same behavior as\n // a read that found nothing — and re-drive the create.\n if (provider.read && isResolved(oldState.props)) {\n const attr = yield* provider\n .read({\n id,\n fqn,\n instanceId: oldState.instanceId,\n olds: oldState.props,\n output: oldState.attr,\n })\n .pipe(providePlanScope(fqn, oldState.instanceId), \n // `creating` props pass `isResolved` yet can still carry\n // holes where unresolved Outputs were stripped at commit\n // time (see stripUnresolved) — e.g. a parent reference\n // persisted as `{}`. A provider that dereferences one\n // crashes deep inside its SDK client (a SchemaError\n // defect), which would brick every subsequent plan on\n // the stage. Recovery is best-effort: degrade the defect\n // to \"nothing recovered\" and re-drive the create (#995).\n Effect.catchDefect((defect) => Effect.logWarning(`Recovery read for '${fqn}' crashed; treating the ` +\n \"interrupted create as not recoverable and \" +\n \"re-driving it.\", defect).pipe(Effect.as(undefined))));\n if (attr !== undefined) {\n // The recovered resource may be foreign: our interrupted\n // create could have lost a name race, or died before\n // stamping ownership. Route `Unowned` through the same\n // adoption table as the cold-start probe above — never\n // silently take over (and later mutate/delete) a resource\n // we cannot prove we created.\n if (Unowned.is(attr)) {\n const adoptThis = resource.Adopt ?? (yield* shouldAdopt);\n if (!adoptThis) {\n return yield* new OwnedBySomeoneElse({\n message: `Cannot resume creating resource '${fqn}' ` +\n `(${resource.Type}): a resource with its physical ` +\n \"identity exists in the cloud but is not owned by \" +\n \"this stack/stage/logical-id. Re-run with `--adopt` \" +\n \"(or wrap the effect in `adopt(true)`) to take it \" +\n \"over.\",\n resourceType: resource.Type,\n logicalId: id,\n });\n }\n }\n // Continue through the normal diff below with the recovered\n // live snapshot. Desired props may have changed while the\n // previous create was interrupted; bypassing diff here can\n // drive an immutable change through reconcile and falsely\n // persist the old physical resource as converged.\n oldState = { ...oldState, attr: stripUnowned(attr) };\n }\n }\n }\n // Diff against whatever props represent the best-known current attempt.\n // For replacement recovery that means the top-level replacement props,\n // not the older generations stored under `old`.\n const oldProps = oldState.props;\n // On a mode switch the provider diff is skipped entirely:\n // comparing props across runtimes is meaningless (and the new\n // mode's provider has never seen the old mode's state). The\n // action is a replacement by definition.\n const diff = modeSwitched\n ? {\n action: \"replace\",\n deleteFirst: false,\n }\n : yield* asEffect(provider\n ?.diff?.({\n id,\n fqn,\n olds: oldProps,\n instanceId: oldState.instanceId,\n output: oldState.attr,\n news,\n oldBindings,\n newBindings,\n })\n .pipe(providePlanScope(fqn, oldState.instanceId))).pipe(Effect.map((diff) => diff ??\n {\n action: havePropsChanged(oldProps, news) ||\n bindingDiffs.some((b) => b.action !== \"noop\")\n ? \"update\"\n : \"noop\",\n }), Effect.map((diff) => options.force && diff.action === \"noop\"\n ? {\n action: \"update\",\n }\n : diff), \n // After a cold-start adoption (silent or takeover), force at\n // least an update so the provider re-syncs ownership tags /\n // config against the desired props (otherwise the engine\n // would noop and any drift between the existing cloud\n // resource and `news` — including foreign-owned tags after a\n // takeover — would persist).\n //\n // A row that just migrated from a former FQN (`renameMoved`)\n // gets the same treatment: its cloud resource is still\n // branded with the OLD logical id's tags, and if the old id\n // is being reused by a new resource, leaving them stale\n // would let the reuser's future adoption probes match the\n // wrong physical resource.\n Effect.map((diff) => (forceUpdateAfterAdoption || renameMoved) &&\n diff.action === \"noop\"\n ? { action: \"update\" }\n : diff));\n if (oldState.status === \"creating\") {\n if (diff.action === \"noop\") {\n // we're in the creating state and props are un-changed\n // let's just continue where we left off\n return Node({\n action: \"create\",\n props: applyProps,\n state: oldState,\n });\n }\n else if (diff.action === \"update\") {\n // props have changed in a way that is updatable\n // again, just continue with the create\n // TODO(sam): should we maybe try an update instead?\n return Node({\n action: \"create\",\n props: applyProps,\n state: oldState,\n });\n }\n else {\n // props have changed in an incompatible way\n // because it's possible that an un-updatable resource has already been created\n // we must use a replace step to create a new one and delete the potential old one\n return Node({\n action: \"replace\",\n props: applyProps,\n deleteFirst: diff.deleteFirst ?? false,\n state: oldState,\n });\n }\n }\n else if (oldState.status === \"updating\") {\n // Updating already targets the live resource, so noop/update both mean\n // \"finish the interrupted update\". Only a replace diff escalates it\n // into a fresh replacement.\n if (diff.action === \"update\" || diff.action === \"noop\") {\n // we can continue where we left off\n return Node({\n action: \"update\",\n props: applyProps,\n state: oldState,\n });\n }\n else {\n // we started to update a resource but now believe we should replace it\n return Node({\n action: \"replace\",\n deleteFirst: diff.deleteFirst ?? false,\n props: applyProps,\n // TODO(sam): can Apply handle replacements when the oldState is UpdatingResourceState?\n // -> or should we do a provider.read to try and reconcile back to UpdatedResourceState?\n state: oldState,\n });\n }\n }\n else if (oldState.status === \"replacing\") {\n // The replacement candidate is still being created. Noop/update keep\n // driving the same generation; replace means that candidate itself is\n // now obsolete and must be wrapped in a new outer generation.\n if (diff.action === \"noop\") {\n // this is the stable case - noop means just continue with the replacement\n return Node({\n action: \"replace\",\n deleteFirst: oldState.deleteFirst,\n props: applyProps,\n state: oldState,\n });\n }\n else if (diff.action === \"update\") {\n // potential problem here - the props have changed since we tried to replace,\n // but not enough to trigger another replacement. the resource provider should\n // be designed as idempotent to converge to the right state when creating the new resource\n // the newly generated instanceId is intended to assist with this\n return Node({\n action: \"replace\",\n deleteFirst: oldState.deleteFirst,\n props: applyProps,\n state: oldState,\n });\n }\n else {\n // The in-flight replacement candidate itself now needs replacement.\n // Mark this as a restart so Apply creates a fresh generation instead\n // of resuming the old replacement instance.\n return Node({\n restart: true,\n action: \"replace\",\n deleteFirst: diff.deleteFirst ?? oldState.deleteFirst,\n props: applyProps,\n state: oldState,\n });\n }\n }\n else if (oldState.status === \"replaced\") {\n // The new resource already exists. Noop means \"just let GC finish\",\n // update means \"mutate the current replacement before GC finishes\",\n // and replace means \"the current replacement also became obsolete\".\n if (diff.action === \"noop\") {\n // this is the stable case - noop means just continue cleaning up the replacement\n return Node({\n action: \"replace\",\n deleteFirst: oldState.deleteFirst,\n props: applyProps,\n state: oldState,\n });\n }\n else if (diff.action === \"update\") {\n // the replacement has been created but now also needs to be updated\n // the resource provider should:\n // 1. Update the newly created replacement resource\n // 2. Then proceed as normal to delete the replaced resources (after all downstream references are updated)\n return Node({\n action: \"update\",\n props: applyProps,\n state: oldState,\n });\n }\n else {\n // Cleanup is still pending, but the current \"new\" resource has already\n // become obsolete. Start another replacement generation and preserve\n // the existing replaced node as part of the recursive old chain.\n return Node({\n restart: true,\n action: \"replace\",\n deleteFirst: diff.deleteFirst ?? oldState.deleteFirst,\n props: applyProps,\n state: oldState,\n });\n }\n }\n else if (oldState.status === \"deleting\") {\n // we're in a partially deleted state, it is unclear whether it was or was not deleted\n // so continue by re-creating it with the same instanceId and desired props\n return Node({\n action: \"create\",\n props: applyProps,\n state: {\n ...oldState,\n status: \"creating\",\n props: news,\n },\n });\n }\n else if (diff.action === \"update\") {\n // Stable created/updated resources follow the normal CRUD mapping.\n return Node({\n action: \"update\",\n adopting: forceUpdateAfterAdoption,\n props: applyProps,\n state: oldState,\n });\n }\n else if (diff.action === \"replace\") {\n return Node({\n action: \"replace\",\n props: applyProps,\n state: oldState,\n deleteFirst: diff?.deleteFirst ?? false,\n });\n }\n else {\n return Node({\n action: \"noop\",\n state: oldState,\n });\n }\n })), { concurrency: \"unbounded\" })).map((update) => [update.resource.FQN, update]));\n // ── Action plan nodes ────────────────────────────────────────────────\n const actionGraph = Object.fromEntries((yield* Effect.all(actions.map(Effect.fn(\"plan.diff.action\")(function* (action) {\n const fqn = action.FQN;\n const downstream = newDownstreamDependencies[fqn] ?? [];\n // The node carries the RAW input expression (evaluated at apply);\n // the drift hash uses the diff-facing view so stable upstream\n // attributes hash as their known values.\n const resolvedInput = materializeStableRefs(yield* resolveInput(action.Input));\n const inputHash = yield* hashInput(resolvedInput);\n const oldState = yield* state.get({\n stack: stackName,\n stage,\n fqn,\n });\n if (oldState && !isActionState(oldState)) {\n // FQN collision with a resource — surface as a fatal error so\n // the user resolves it before we touch anything.\n return [\n fqn,\n {\n kind: \"action\",\n action: \"run\",\n def: action,\n input: action.Input,\n state: undefined,\n downstream,\n forced: false,\n },\n ];\n }\n const prior = oldState;\n const sameInput = prior?.status === \"ran\" && prior.inputHash === inputHash;\n if (sameInput && !options.force) {\n return [\n fqn,\n {\n kind: \"action\",\n action: \"noop\",\n def: action,\n state: prior,\n downstream,\n },\n ];\n }\n return [\n fqn,\n {\n kind: \"action\",\n action: \"run\",\n def: action,\n input: action.Input,\n state: prior,\n downstream,\n forced: !!options.force,\n },\n ];\n })), { concurrency: \"unbounded\" })));\n // SCC membership of the combined upstream graph. Apply uses it to\n // decide whether an update node must publish its prior attr early to\n // break a cycle, or can simply wait for upstreams like a DAG node\n // (the common case). Computed once, above, for the downstream graph.\n const cycleMembers = combinedCycleMembers;\n // Detect unsatisfiable dependency cycles among create/replace nodes.\n // Update/noop nodes signal their Deferred before waitForDeps when in a\n // cycle so they cannot deadlock. Create/replace nodes only signal\n // early when they have a precreate handler. Simulate the concurrent\n // execution: precreate nodes are immediately \"resolved\", then\n // iteratively resolve any node whose deps are all resolved. Remaining\n // nodes would deadlock.\n {\n const createReplaceNodes = new Set(Object.entries(resourceGraph)\n .filter(([_, node]) => node.action === \"create\" || node.action === \"replace\")\n .map(([fqn]) => fqn));\n if (createReplaceNodes.size > 0) {\n const hasPrecreate = new Set([...createReplaceNodes].filter((fqn) => !!resourceGraph[fqn]?.provider?.precreate));\n const resolved = new Set(hasPrecreate);\n let changed = true;\n while (changed) {\n changed = false;\n for (const fqn of createReplaceNodes) {\n if (resolved.has(fqn))\n continue;\n const deps = (allUpstreamDependencies[fqn] ?? []).filter((dep) => createReplaceNodes.has(dep));\n if (deps.every((dep) => resolved.has(dep))) {\n resolved.add(fqn);\n changed = true;\n }\n }\n }\n const deadlocked = [...createReplaceNodes].filter((fqn) => !resolved.has(fqn));\n if (deadlocked.length > 0) {\n const missingPrecreate = deadlocked.filter((fqn) => !hasPrecreate.has(fqn));\n return yield* Effect.die(new UnsatisfiedResourceCycle({\n message: `Circular dependency detected that cannot be resolved: [${deadlocked.join(\", \")}]. ` +\n `Resources lacking a precreate handler: [${missingPrecreate.join(\", \")}]. ` +\n `All resources in a dependency cycle must implement precreate to allow early signaling.`,\n cycle: deadlocked,\n missingPrecreate,\n }));\n }\n }\n }\n // Task deletions: state rows previously written by tasks that no\n // longer appear in the stack. The body is NOT invoked — we just drop\n // the row.\n const actionDeletions = Object.fromEntries((yield* Effect.all((yield* state.list({ stack: stackName, stage })).map(Effect.fn(\"plan.diff.actionDeletion\")(function* (fqn) {\n if (newActionFqns.has(fqn) || newResourceFqns.has(fqn))\n return;\n const persisted = yield* state.get({\n stack: stackName,\n stage,\n fqn,\n });\n if (!isActionState(persisted))\n return;\n const { logicalId } = parseFqn(fqn);\n return [\n fqn,\n {\n kind: \"action\",\n action: \"delete\",\n state: persisted,\n downstream: persisted.downstream ?? [],\n def: {\n Kind: \"action\",\n Namespace: persisted.namespace,\n FQN: fqn,\n LogicalId: logicalId,\n Type: persisted.actionType,\n Input: persisted.input,\n Captures: {},\n Run: () => undefined,\n Output: undefined,\n },\n },\n ];\n })), { concurrency: \"unbounded\" })).filter((v) => !!v));\n const deletions = Object.fromEntries((yield* Effect.all((yield* state.list({ stack: stackName, stage: stage })).map(Effect.fn(\"plan.diff.deletion\")(function* (fqn) {\n if (newResourceFqns.has(fqn) || newActionFqns.has(fqn)) {\n return;\n }\n const persisted = yield* state.get({\n stack: stackName,\n stage: stage,\n fqn,\n });\n // Tasks are routed through `actionDeletions` above.\n if (isActionState(persisted))\n return;\n const oldState = persisted;\n if (oldState) {\n // A row being migrated by a rename (`renameMigrations`) is\n // moving, not orphaned — apply drops it state-only after\n // committing the migrated row at its new FQN. Rows at former\n // FQNs that did NOT migrate (foreign type, different\n // instanceId, unclaimed) are absent from this set and fall\n // through to normal orphan deletion.\n if (migratedRowFqns.has(fqn)) {\n return;\n }\n const { logicalId } = parseFqn(fqn);\n const resourceType = oldState.resourceType;\n // A \"zombie\" row references a type with no registered provider\n // (removed from the program, or renamed without an alias).\n // That is fatal: the program and state disagree, and without\n // the provider the row's physical resource cannot be deleted\n // anyway. Die at plan time with a typed error naming the row\n // and the remediation instead of limping into a partial apply.\n //\n // Orphan deletes resolve the provider variant for the mode\n // that created the row (`providerMode`, or the `dev:` marker\n // inference for legacy unstamped rows), so e.g. a local dev\n // worker's row is deleted by the local provider even during a\n // live deploy — and vice versa. Unstamped rows are physically\n // live unless their attrs carry the marker (see stampedMode),\n // never the run default.\n const rowMode = stampedMode(oldState);\n const providerOption = yield* tryFindProviderByType(resourceType, rowMode);\n if (Option.isNone(providerOption)) {\n return yield* Effect.die(missingProviderError(resourceType, fqn));\n }\n const provider = providerOption.value;\n // NOTE: an attr-less row (interrupted create) is NOT recovered\n // here. Apply's `deleteResource` performs the authoritative\n // read-then-delete recovery — it also covers replaced-chain\n // old generations that never pass through plan, and routes\n // `Unowned` results away from `provider.delete`.\n return [\n fqn,\n {\n action: \"delete\",\n state: oldState,\n provider: provider,\n mode: oldState.providerMode,\n resource: {\n Namespace: oldState.namespace,\n FQN: fqn,\n LogicalId: logicalId,\n Type: oldState.resourceType,\n Attributes: oldState.attr,\n Props: oldState.props,\n Binding: undefined,\n Provider: Provider(resourceType),\n RemovalPolicy: oldState.removalPolicy,\n Adopt: undefined,\n RequiresImplementation: undefined,\n Mode: oldState.providerMode,\n FormerFqns: undefined,\n RuntimeContext: undefined,\n Providers: undefined,\n },\n downstream: oldDownstreamDependencies[fqn] ?? [],\n bindings: oldState.bindings.map((binding) => ({\n sid: binding.sid,\n action: \"delete\",\n data: binding.data,\n })),\n },\n ];\n }\n })), { concurrency: \"unbounded\" })).filter((v) => !!v));\n for (const resourceFqn of Object.keys(deletions)) {\n const dependencies = Object.entries(rawUpstreamDependencies)\n .filter(([survivorFqn, upstream]) => survivorFqn in resourceGraph && upstream.includes(resourceFqn))\n .map(([survivorFqn]) => survivorFqn);\n if (dependencies.length > 0) {\n return yield* new DeleteResourceHasDownstreamDependencies({\n message: `Resource ${resourceFqn} has downstream dependencies`,\n resourceId: resourceFqn,\n dependencies,\n });\n }\n }\n return {\n resources: resourceGraph,\n actions: actionGraph,\n deletions,\n actionDeletions,\n output: stack.output,\n cycleMembers,\n defaultMode: runDefaultMode,\n };\n}).pipe(ensureArtifactStore, Effect.withSpan(\"plan.make\", {\n attributes: {\n \"alchemy.stack\": stack.name,\n \"alchemy.stage\": stack.stage,\n \"alchemy.resources.count\": Object.keys(stack.resources).length,\n \"alchemy.force\": !!options.force,\n },\n}));\n/**\n * Build the plan that destroys every resource of `(stack.name, stack.stage)`.\n *\n * The spec is emptied out so every persisted resource becomes an orphan\n * deletion, and `output` is left undefined so `apply` does not overwrite the\n * last deploy's persisted stack output with an empty husk. `apply` recognizes\n * the `destroy` marker and deletes the stage's remaining persisted state (the\n * stack output record) once the destroy has converged, so `state.getOutput`\n * and `state.listStages` agree the stage is gone.\n *\n * @see https://github.com/alchemy-run/alchemy/issues/961\n */\nexport const destroy = (stack) => make({\n name: stack.name,\n stage: stack.stage,\n resources: {},\n bindings: {},\n actions: {},\n output: undefined,\n}).pipe(Effect.map((plan) => ({ ...plan, destroy: true })));\nconst providePlanScope = (fqn, instanceId) => (effect) => Effect.serviceOption(ArtifactStore).pipe(Effect.map(Option.getOrElse(createArtifactStore)), Effect.flatMap((store) => effect.pipe(Effect.provideService(Artifacts, makeScopedArtifacts(store, fqn)), Effect.provideService(InstanceId, instanceId))));\nexport class DeleteResourceHasDownstreamDependencies extends Data.TaggedError(\"DeleteResourceHasDownstreamDependencies\") {\n}\nexport class UnsatisfiedResourceCycle extends Data.TaggedError(\"UnsatisfiedResourceCycle\") {\n}\n// TODO(sam): compare props\n// oldBinding.props !== newBinding.props;\n/**\n * Print a plan in a human-readable format that shows the graph topology.\n */\nexport const printPlan = (plan) => {\n const lines = [];\n const allNodes = { ...plan.resources, ...plan.deletions };\n // Build reverse mapping: upstream -> downstream\n const upstreamMap = {};\n for (const [id] of Object.entries(allNodes)) {\n upstreamMap[id] = [];\n }\n for (const [id, node] of Object.entries(allNodes)) {\n if (!node)\n continue;\n for (const downstreamId of node.state?.downstream ?? []) {\n if (upstreamMap[downstreamId]) {\n upstreamMap[downstreamId].push(id);\n }\n }\n }\n // Action symbols\n const actionSymbol = (action) => {\n switch (action) {\n case \"create\":\n return \"+\";\n case \"update\":\n return \"~\";\n case \"delete\":\n return \"-\";\n case \"replace\":\n return \"±\";\n case \"noop\":\n return \"=\";\n default:\n return \"?\";\n }\n };\n // Print header\n lines.push(\"╔════════════════════════════════════════════════════════════════╗\");\n lines.push(\"║ PLAN ║\");\n lines.push(\"╠════════════════════════════════════════════════════════════════╣\");\n lines.push(\"║ Legend: + create, ~ update, - delete, ± replace, = noop, ║\");\n lines.push(\"║ λ run task, · skip task ║\");\n lines.push(\"╚════════════════════════════════════════════════════════════════╝\");\n lines.push(\"\");\n // Print resources section\n lines.push(\"┌─ Resources ────────────────────────────────────────────────────┐\");\n const resourceIds = Object.keys(plan.resources).sort();\n for (const id of resourceIds) {\n const node = plan.resources[id];\n const symbol = actionSymbol(node.action);\n const type = node.resource?.type ?? \"unknown\";\n const downstream = node.state?.downstream?.length\n ? ` → [${node.state?.downstream.join(\", \")}]`\n : \"\";\n const renamed = node.renamedFrom?.length\n ? ` (renamed from ${node.renamedFrom.join(\", \")})`\n : \"\";\n lines.push(`│ [${symbol}] ${id} (${type})${downstream}${renamed}`);\n }\n if (resourceIds.length === 0) {\n lines.push(\"│ (none)\");\n }\n lines.push(\"└────────────────────────────────────────────────────────────────┘\");\n lines.push(\"\");\n // Print tasks section\n lines.push(\"┌─ Tasks ────────────────────────────────────────────────────────┐\");\n const taskIds = Object.keys(plan.actions ?? {}).sort();\n for (const id of taskIds) {\n const node = plan.actions[id];\n const symbol = node.action === \"run\" ? \"λ\" : \"·\";\n const type = node.def.Type;\n const downstream = node.downstream.length\n ? ` → [${node.downstream.join(\", \")}]`\n : \"\";\n lines.push(`│ [${symbol}] ${id} (${type})${downstream}`);\n }\n if (taskIds.length === 0) {\n lines.push(\"│ (none)\");\n }\n lines.push(\"└────────────────────────────────────────────────────────────────┘\");\n lines.push(\"\");\n // Print deletions section\n lines.push(\"┌─ Deletions ────────────────────────────────────────────────────┐\");\n const deletionIds = Object.keys(plan.deletions).sort();\n for (const id of deletionIds) {\n const node = plan.deletions[id];\n const type = node.resource?.Type ?? \"unknown\";\n const downstream = node.state.downstream?.length\n ? ` → [${node.state.downstream.join(\", \")}]`\n : \"\";\n lines.push(`│ [-] ${id} (${type})${downstream}`);\n }\n const taskDeletionIds = Object.keys(plan.actionDeletions ?? {}).sort();\n for (const id of taskDeletionIds) {\n const node = plan.actionDeletions[id];\n lines.push(`│ [-] ${id} (${node.def.Type}) [action]`);\n }\n if (deletionIds.length === 0 && taskDeletionIds.length === 0) {\n lines.push(\"│ (none)\");\n }\n lines.push(\"└────────────────────────────────────────────────────────────────┘\");\n lines.push(\"\");\n return lines.join(\"\\n\");\n};\n//# sourceMappingURL=Plan.js.map","import * as Cause from \"effect/Cause\";\nimport * as Data from \"effect/Data\";\nimport * as Deferred from \"effect/Deferred\";\nimport * as Effect from \"effect/Effect\";\nimport * as Option from \"effect/Option\";\nimport { makeResolveContext } from \"./ActionRuntimeContext.js\";\nimport { stripUnowned, Unowned } from \"./AdoptPolicy.js\";\nimport { AlchemyContext } from \"./AlchemyContext.js\";\nimport { demandPlanCredentials, } from \"./Auth/Demand.js\";\nimport { RuntimeContext } from \"./RuntimeContext.js\";\nimport { Artifacts, ArtifactStore, createArtifactStore, ensureArtifactStore, makeScopedArtifacts, } from \"./Artifacts.js\";\nimport { Cli, } from \"./Cli/Cli.js\";\nimport { havePropsChanged, stripUnresolved } from \"./Diff.js\";\nimport { generateInstanceId, InstanceId } from \"./InstanceId.js\";\nimport * as Output from \"./Output.js\";\nimport {} from \"./Plan.js\";\nimport { findProviderByType, missingProviderError, tryFindProviderByType, } from \"./Provider.js\";\nimport { stampedMode } from \"./ProviderMode.js\";\nimport { Stack } from \"./Stack.js\";\nimport { Stage } from \"./Stage.js\";\nimport { State, StateStoreError, } from \"./State/index.js\";\nimport { recordResourceOp } from \"./Telemetry/Metrics.js\";\nimport { hashInput } from \"./Util/sha256.js\";\nconst provideLifecycleScope = (fqn, instanceId) => (effect) => Effect.serviceOption(ArtifactStore).pipe(Effect.map(Option.getOrElse(createArtifactStore)), Effect.flatMap((store) => effect.pipe(Effect.provideService(Artifacts, makeScopedArtifacts(store, fqn)), Effect.provideService(InstanceId, instanceId))));\n/**\n * Instruments a single provider lifecycle call with an OTel span\n * (`provider.<op>`), the resource counter / duration histogram, and the\n * scoped artifacts/instance services normally supplied by\n * {@link provideLifecycleScope}.\n *\n * This is the only call site through which provider lifecycle methods\n * are dispatched, so wrapping it here gives us a fully-instrumented\n * toolchain without touching any individual provider implementation.\n */\nconst instrumentLifecycle = (op, fqn, resourceType, logicalId, instanceId) => (effect) => effect.pipe(provideLifecycleScope(fqn, instanceId), recordResourceOp(resourceType, op), Effect.withSpan(`provider.${op}`, {\n attributes: {\n \"alchemy.resource.fqn\": fqn,\n \"alchemy.resource.type\": resourceType,\n \"alchemy.resource.logical_id\": logicalId,\n \"alchemy.resource.instance_id\": instanceId,\n \"alchemy.resource.op\": op,\n },\n}));\nexport const apply = (plan) => Effect.gen(function* () {\n // Credential-free dev: a dev-mode plan that needs the real cloud\n // (`Alchemy.remote()` rows, remote-proxied bindings, deletions of rows\n // stamped `providerMode: \"live\"`) demands cloud credentials exactly\n // once, up front, BEFORE any lifecycle operation runs — a fully-local\n // dev plan demands nothing. Non-dev runs never enter the seam: live\n // providers keep the pre-existing lazy credential flow. Wired here (not\n // in Deploy/Destroy) because `apply` is the single choke point every\n // path shares — CLI deploy/destroy, `Test.make` deploys, and\n // `test.provider` scratch stacks. See `Auth/Demand.ts`.\n const alchemy = yield* Effect.serviceOption(AlchemyContext);\n if (Option.isSome(alchemy) && alchemy.value.dev) {\n yield* demandPlanCredentials(plan);\n }\n const cli = yield* Cli;\n const session = yield* cli.startApplySession(plan);\n const state = yield* yield* State;\n const stack = yield* Stack;\n const stage = yield* Stage;\n const stackName = stack.name;\n const tracker = {};\n const terminalStatuses = new Map();\n // ── FQN migrations (renamedFrom) ──\n // Persist renames before any lifecycle operation runs: a node whose row\n // was found under a former FQN carries that row pre-remapped in\n // `node.state` (see Plan's rename resolution). Commit it at the current\n // FQN FIRST, then drop the former row — in that order, so an\n // interruption leaves rows at both FQNs with the same instanceId, which\n // the next plan recognizes as an in-flight migration (and never as an\n // orphan to delete).\n //\n // In a same-deploy shift (A→B while B→C), C's former FQN `B` is\n // simultaneously B's migration TARGET. C must NOT delete it: B's own\n // `state.set` supersedes the stale copy, and the migrations run\n // concurrently — the delete could land after B's write and destroy the\n // freshly migrated row.\n const migrationTargets = new Set(Object.values(plan.resources)\n .filter((node) => node.renamedFrom?.length && node.state !== undefined)\n .map((node) => node.resource.FQN));\n yield* Effect.forEach(Object.values(plan.resources), (node) => {\n const { renamedFrom, state: row } = node;\n return renamedFrom === undefined ||\n renamedFrom.length === 0 ||\n row === undefined\n ? Effect.void\n : Effect.gen(function* () {\n yield* state.set({\n stack: stackName,\n stage,\n fqn: node.resource.FQN,\n value: row,\n });\n yield* Effect.forEach(renamedFrom.filter((formerFqn) => !migrationTargets.has(formerFqn)), (formerFqn) => state.delete({ stack: stackName, stage, fqn: formerFqn }), { concurrency: \"unbounded\" });\n });\n }, { concurrency: \"unbounded\" });\n yield* executePlan(plan, tracker, terminalStatuses, session, state, stackName, stage);\n // TODO(sam): support roll back to previous state if errors occur during expansion\n // -> RISK: some UPDATEs may not be reversible (i.e. trigger replacements)\n // TODO(sam): should pivot be done separately? E.g shift traffic?\n yield* collectGarbage(plan, session);\n yield* converge(plan, tracker, terminalStatuses, session, state, stackName, stage);\n yield* Effect.forEach(Array.from(terminalStatuses.values()), ({ id, type, status, providerMode }) => session.emit({ kind: \"status-change\", id, type, status, providerMode }), { concurrency: \"unbounded\" });\n yield* session.done();\n if (plan.destroy) {\n // The destroy converged: every resource row was deleted above. Drop\n // the rest of the stage's persisted state — notably the stack output\n // record written by the last deploy — so `getOutput` returns\n // undefined and `listStages` no longer reports the stage.\n // https://github.com/alchemy-run/alchemy/issues/961\n yield* state.deleteStack({ stack: stackName, stage });\n // Invariant: a successful destroy leaves the stage EMPTY. If rows\n // survive, this destroy session could not actually see (or delete)\n // the stack's state — e.g. its plan listed an empty store while\n // committed rows existed — and reporting success here would silently\n // leak every cloud resource those rows track. Fail loudly instead so\n // the leak surfaces in the run that caused it.\n const remaining = yield* state.list({ stack: stackName, stage });\n if (remaining.length > 0) {\n return yield* Effect.fail(new StateStoreError({\n message: `destroy of ${stackName}/${stage} reported success but ${remaining.length} ` +\n `state row(s) remain (${remaining.join(\", \")}) — the destroy session could ` +\n `not see the stack's persisted state, so its cloud resources were NOT deleted`,\n }));\n }\n return undefined;\n }\n if (!plan.output) {\n return undefined;\n }\n const outputs = Object.fromEntries(Object.entries(tracker).map(([fqn, t]) => [fqn, t.output]));\n const resolved = yield* Output.evaluate(plan.output, outputs);\n // Persist the stack's evaluated outputs so cross-stack references\n // (`yield* OtherStack` / `OtherStack.stage.<name>` / `Output.stackRef`)\n // can read them back out of the state store.\n yield* state.setOutput({ stack: stackName, stage, value: resolved });\n return resolved;\n}).pipe(ensureArtifactStore, Effect.withSpan(\"apply\", {\n attributes: {\n \"alchemy.resources.count\": Object.keys(plan.resources).length,\n \"alchemy.deletions.count\": Object.keys(plan.deletions).length,\n },\n}));\n// ── Phase 1: concurrent initial execution ──────────────────────────────────\n//\n// Each resource gets a Deferred<void> that signals \"I have some output\n// available in `tracker`.\" Resources with `precreate` signal early so that\n// downstream resources can resolve stable identifiers without deadlocking.\n// The actual output lives in the mutable `tracker` map, not in the Deferred.\nconst executePlan = Effect.fn(function* (plan, tracker, terminalStatuses, session, state, stackName, stage) {\n // Resources and tasks share the same FQN namespace and DAG, so the\n // scheduler tracks them together. Each entry gets a single Deferred that\n // signals \"my output is available in `tracker`.\"\n const allNodes = {\n ...plan.resources,\n ...plan.actions,\n };\n const ready = Object.fromEntries(yield* Effect.all(Object.keys(allNodes).map((fqn) => Effect.map(Deferred.make(), (d) => [fqn, d]))));\n // `readyStable` fires only when a node has reached its TERMINAL output —\n // resources after `reconcile`, tasks after the body completes. Resource\n // precreate stubs do NOT signal `readyStable`, so any consumer that\n // requires stable inputs (e.g. Tasks) waits past the precreate phase.\n const readyStable = Object.fromEntries(yield* Effect.all(Object.keys(allNodes).map((fqn) => Effect.map(Deferred.make(), (d) => [fqn, d]))));\n const getOutputs = () => Object.fromEntries(Object.entries(tracker).map(([fqn, t]) => [fqn, t.output]));\n const waitForDeps = (fqns) => Effect.all(fqns\n .filter((fqn) => fqn in ready)\n .map((fqn) => \n // Non-cycle upstreams must be observed at their TERMINAL output\n // (`readyStable`), not their early precreate signal (`ready`). This\n // is what makes a failed upstream actually interrupt its downstream:\n // a resource with `precreate` resolves `ready` before its real\n // `reconcile` runs, so a downstream waiting on `ready` would proceed\n // (and even finish) even though the upstream's reconcile later\n // failed. Waiting on `readyStable` means the downstream's\n // `waitForDeps` short-circuits with the upstream's failure cause.\n //\n // Cycle members are the exception: peers in an SCC depend on each\n // other, so they must rendezvous on the early `ready`/precreate\n // signal to break the deadlock. Phase 3 (`converge`) re-runs them\n // against final outputs once the cycle settles.\n plan.cycleMembers.has(fqn)\n ? Deferred.await(ready[fqn])\n : Deferred.await(readyStable[fqn])), { concurrency: \"unbounded\" });\n const waitForStableDeps = (fqns) => Effect.all(fqns\n .filter((fqn) => fqn in readyStable)\n .map((fqn) => Deferred.await(readyStable[fqn])), { concurrency: \"unbounded\" });\n const failures = [];\n yield* Effect.all(Object.entries(allNodes).map(([fqn, node]) => node.kind === \"action\"\n ? executeActionNode(fqn, node, tracker, ready, readyStable, terminalStatuses, session, state, stackName, stage, getOutputs, waitForStableDeps, failures)\n : executeNode(fqn, node, tracker, ready, readyStable, terminalStatuses, session, state, stackName, stage, getOutputs, waitForDeps, failures, plan.cycleMembers.has(fqn))), { concurrency: \"unbounded\" });\n if (failures.length > 0) {\n // Aggregate every collected lifecycle failure into a single parallel Cause\n // so the apply ends with one combined error containing every distinct\n // failure / defect that occurred across the concurrent fibers.\n return yield* Effect.failCause(failures.map((f) => f.cause).reduce(Cause.combine));\n }\n});\nconst executeNode = (fqn, node, tracker, ready, readyStable, terminalStatuses, session, state, stackName, stage, getOutputs, waitForDeps, failures, inCycle) => Effect.gen(function* () {\n const logicalId = node.resource.LogicalId;\n const namespace = node.resource.Namespace;\n const commit = (value) => state.set({\n stack: stackName,\n stage,\n fqn,\n // Early commits (`creating`/`replacing`) persist plan props that may\n // still hold unresolved Output exprs; strip them so state stores only\n // plain data (see stripUnresolved in Diff.ts).\n //\n // Binding rows follow the same rule. Even the RESOLVED binding\n // payload can carry Effect leaves — a tagged Worker/Function class in\n // `env` (the circular-bindings pattern) is a function-typed Effect\n // that `Output.evaluate` passes through untouched. A JSON state store\n // would persist it via its `toJSON` as an `{\"_id\":\"Effect\",...}`\n // relic, which the next plan's `diffBindings` compares against the\n // live class stripped to `undefined` — a phantom binding \"update\" on\n // every deploy, forever. Stripping at the commit boundary keeps both\n // store kinds consistent with the comparison in `havePropsChanged`.\n value: {\n ...value,\n props: stripUnresolved(value.props),\n bindings: stripUnresolved(value.bindings),\n namespace,\n },\n });\n const scopedSession = {\n ...session,\n note: (note) => session.emit({ id: logicalId, kind: \"annotate\", message: note }),\n };\n // On a mode-switch replacement (local ⇄ live) surface the transition:\n // the old generation's stamped mode → the mode resolved for this run.\n const fromProviderMode = node.action === \"replace\" &&\n node.mode !== undefined &&\n node.state.providerMode !== undefined &&\n node.state.providerMode !== node.mode\n ? node.state.providerMode\n : undefined;\n const report = (status) => session.emit({\n kind: \"status-change\",\n id: logicalId,\n type: node.resource.Type,\n status,\n providerMode: node.mode,\n fromProviderMode,\n });\n const markTerminal = (status) => Effect.gen(function* () {\n terminalStatuses.set(fqn, {\n id: logicalId,\n type: node.resource.Type,\n status,\n providerMode: node.mode,\n });\n // A local dev instance announces where it's serving: any\n // local-mode row whose fresh Attributes carry a string `url`\n // (Workers expose their dev-proxy URL this way) gets a\n // `[id] ready at http://localhost:1337` line.\n if (node.mode === \"local\") {\n const url = tracker[fqn]?.output?.url;\n if (typeof url === \"string\" && url.length > 0) {\n yield* scopedSession.note(`ready at ${url}`);\n }\n }\n // Emit immediately so the CLI surfaces the terminal status as soon\n // as the resource is actually done — instead of batching every\n // resource's \"created\"/\"updated\" event to the end of apply(), which\n // makes long-running siblings appear stuck in \"creating\" until the\n // entire deploy finishes.\n //\n // Cycle members are exempt: their initial pass produces an\n // intermediate result that Phase 3 (`converge`) will overwrite once\n // the SCC reaches a fixed point. Emitting \"created\"/\"updated\" here\n // would surface that intermediate state to the CLI before the real\n // terminal status is known. Their final status is flushed from\n // `terminalStatuses` after `converge` completes.\n if (inCycle)\n return;\n yield* session.emit({\n kind: \"status-change\",\n id: logicalId,\n type: node.resource.Type,\n status,\n providerMode: node.mode,\n });\n });\n const signalReady = Deferred.succeed(ready[fqn], void 0);\n // Signal only after reconcile completes — never during precreate. Tasks\n // (and any other consumer that calls `waitForStableDeps`) block on this\n // so they observe the resource's final attrs rather than a stub.\n const signalReadyStable = Deferred.succeed(readyStable[fqn], void 0);\n const storeAndSignal = (t) => Effect.gen(function* () {\n tracker[fqn] = t;\n yield* signalReady;\n });\n // ── noop ──\n if (node.action === \"noop\") {\n // No work to do on the cloud resource — the persisted attr is already\n // stable. Two pieces of row METADATA can still have drifted from the\n // declaration, and this is the only pass that will ever see them:\n //\n // 1. `resourceType` — the row was persisted under a legacy type name\n // (the type was since renamed and carries the old name as an\n // alias); migrate it so the state stops depending on the alias.\n // 2. `removalPolicy` — `RemovalPolicy.retain()` / `.destroy()` is a\n // decoration on the declaration, not a prop, so changing it never\n // produces a diff. Without this commit the new policy would never\n // reach state, and the orphan delete (which reads the policy from\n // the persisted row, see `Plan.ts`'s delete node) would act on the\n // stale one — destroying a resource the user had marked `retain`.\n // See https://github.com/alchemy-run/alchemy/issues/1248.\n const policyChanged = node.state.removalPolicy !== node.resource.RemovalPolicy;\n if (node.state.resourceType !== node.resource.Type || policyChanged) {\n yield* commit({\n ...node.state,\n resourceType: node.resource.Type,\n removalPolicy: node.resource.RemovalPolicy,\n });\n }\n // A policy flip is otherwise invisible (the row is a noop), and it is\n // exactly the change a user wants confirmation of. Legacy rows with no\n // persisted policy normalize silently — there is nothing to report.\n if (policyChanged && node.state.removalPolicy !== undefined) {\n yield* scopedSession.note(`removal policy ${node.state.removalPolicy} → ${node.resource.RemovalPolicy}`);\n }\n yield* signalReadyStable;\n yield* storeAndSignal({\n output: node.state.attr,\n props: node.state.props,\n bindings: node.state.bindings ?? [],\n instanceId: node.state.instanceId,\n });\n return;\n }\n const allUpstreamFqns = () => {\n const propDeps = Object.keys(Output.resolveUpstream(node.props));\n const bindingDeps = Object.keys(Output.resolveUpstream(node.bindings));\n return [...new Set([...propDeps, ...bindingDeps])];\n };\n // ── instance ID ──\n const instanceId = yield* Effect.gen(function* () {\n if (node.action === \"create\" && !node.state?.instanceId) {\n const id = yield* generateInstanceId();\n yield* commit({\n status: \"creating\",\n fqn,\n logicalId,\n instanceId: id,\n downstream: node.downstream,\n props: node.props,\n providerVersion: node.provider.version ?? 0,\n resourceType: node.resource.Type,\n bindings: excludeDeletedBindings(node.bindings),\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n return id;\n }\n else if (node.action === \"replace\") {\n if ((node.state.status === \"replaced\" ||\n node.state.status === \"replacing\") &&\n !node.restart) {\n // Ordinary replacement recovery keeps using the same replacement\n // generation. Only `restart` is allowed to mint a new instance id.\n return node.state.instanceId;\n }\n const id = yield* generateInstanceId();\n yield* commit({\n status: \"replacing\",\n fqn,\n logicalId,\n instanceId: id,\n downstream: node.downstream,\n props: node.props,\n providerVersion: node.provider.version ?? 0,\n resourceType: node.resource.Type,\n bindings: excludeDeletedBindings(node.bindings),\n old: node.state,\n deleteFirst: node.deleteFirst,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n return id;\n }\n else if (node.state?.instanceId) {\n return node.state.instanceId;\n }\n return yield* Effect.die(`Instance ID not found for resource '${logicalId}' and action is '${node.action}'`);\n });\n // ── lifecycle ──\n yield* Effect.gen(function* () {\n // ── create ──\n if (node.action === \"create\") {\n if (!node.state) {\n // First persistence point for a brand new logical resource. Once this is\n // written, retries know they should resume creation instead of planning\n // another fresh create from scratch.\n yield* commit({\n status: \"creating\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: node.props,\n attr: undefined,\n providerVersion: node.provider.version ?? 0,\n bindings: excludeDeletedBindings(node.bindings),\n downstream: node.downstream,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n }\n let attr = node.state?.attr;\n if (attr !== undefined) {\n // Precreate/read may already have produced a usable output snapshot. Publish\n // it early so downstream resources can start resolving against it.\n yield* storeAndSignal({\n output: attr,\n props: {},\n bindings: [],\n instanceId,\n });\n }\n if (node.provider.precreate && attr === undefined) {\n // Some resources need a placeholder physical resource before their real\n // create can finish. Persist that stub so downstream evaluation can proceed.\n yield* report(\"pre-creating\");\n attr = yield* node.provider\n .precreate({\n id: logicalId,\n fqn,\n news: node.props,\n session: scopedSession,\n instanceId,\n bindings: excludeDeletedBindings(node.bindings),\n })\n .pipe(instrumentLifecycle(\"precreate\", fqn, node.resource.Type, logicalId, instanceId));\n yield* commit({\n status: \"creating\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: node.props,\n attr,\n providerVersion: node.provider.version ?? 0,\n bindings: excludeDeletedBindings(node.bindings),\n downstream: node.downstream,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n yield* storeAndSignal({\n output: attr,\n props: {},\n bindings: [],\n instanceId,\n });\n }\n // While we're waiting on upstream outputs the resource isn't actually\n // creating anything yet — surface that as \"pending\" so the CLI doesn't\n // look stuck in \"creating\" for slow-upstream deploys.\n yield* report(\"pending\");\n // Create runs against fully resolved upstream outputs and bindings, not the\n // raw Output expressions stored in the plan.\n yield* waitForDeps(allUpstreamFqns());\n yield* report(\"creating\");\n const outputs = getOutputs();\n const news = (yield* Output.evaluate(node.props, outputs));\n const bindingOutputs = excludeDeletedBindings(yield* Output.evaluate(node.bindings, outputs));\n attr = yield* node.provider\n .reconcile({\n id: logicalId,\n fqn,\n news,\n instanceId,\n bindings: bindingOutputs,\n session: scopedSession,\n olds: undefined,\n output: attr,\n })\n .pipe(instrumentLifecycle(\"create\", fqn, node.resource.Type, logicalId, instanceId));\n yield* commit({\n status: \"created\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: news,\n attr,\n // Terminal commits persist the RESOLVED binding payload the\n // provider actually reconciled with, not the raw plan-time\n // expressions. Raw `node.bindings` may hold unresolved Outputs\n // (silently dropped by JSON state stores), so persisting them\n // makes the next plan's `diffBindings` compare a lossy stored\n // shape against fully-resolved data — a phantom binding update\n // on every plan (#874).\n bindings: bindingOutputs,\n providerVersion: node.provider.version ?? 0,\n downstream: node.downstream,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n tracker[fqn] = {\n output: attr,\n props: news,\n bindings: bindingOutputs,\n instanceId,\n };\n yield* signalReady;\n yield* signalReadyStable;\n yield* markTerminal(\"created\");\n return;\n }\n // ── update ──\n if (node.action === \"update\") {\n // Cycle members publish their previous live attr *before* waiting on\n // upstreams so the SCC can converge — peers in the cycle would\n // otherwise deadlock waiting on each other. Phase 3 (`converge`)\n // re-runs each peer's update against fresh outputs once everyone\n // has settled.\n //\n // Linear (DAG) update nodes skip this entirely and simply wait for\n // fresh upstream outputs, mirroring the create flow. This is the\n // important property: a downstream of a non-cycle update never\n // observes the upstream's stale attr, which prevents wasted/\n // destructive intermediate updates (e.g. a Worker deploying with\n // stale Build assets).\n if (inCycle) {\n yield* storeAndSignal({\n output: node.state.attr,\n props: node.state.props,\n bindings: node.state.bindings ?? [],\n instanceId,\n });\n }\n // See create-flow note: while we're waiting on upstream outputs\n // this resource isn't actually updating yet.\n yield* report(\"pending\");\n yield* waitForDeps(allUpstreamFqns());\n const outputs = getOutputs();\n const news = (yield* Output.evaluate(node.props, outputs));\n const adopting = node.adopting === true ||\n (node.state.status === \"updating\" && node.state.adopting === true);\n yield* node.state.status === \"replaced\"\n ? commit({\n // Keep the replacement wrapper intact while changing the live\n // replacement props; GC still has older generations to delete.\n ...node.state,\n attr: node.state.attr,\n props: news,\n providerMode: node.mode,\n })\n : commit({\n // For ordinary updates we snapshot the previously stable props/attrs\n // once, so retries can continue from the same baseline.\n status: \"updating\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: news,\n attr: node.state.attr,\n providerVersion: node.provider.version ?? 0,\n bindings: excludeDeletedBindings(node.bindings),\n downstream: node.downstream,\n old: node.state.status === \"updating\" ? node.state.old : node.state,\n adopting: adopting ? true : undefined,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n yield* report(\"updating\");\n const previousProps = adopting\n ? undefined\n : node.state.status === \"created\" ||\n node.state.status === \"updated\" ||\n node.state.status === \"replaced\"\n ? node.state.props\n : node.state.old.props;\n // Providers receive the resolved binding payload for this exact pass, while\n // `previousProps` tells them what state the live resource is being updated from.\n const bindingOutputs = excludeDeletedBindings(yield* Output.evaluate(node.bindings, outputs));\n const attr = yield* node.provider\n .reconcile({\n id: logicalId,\n fqn,\n news,\n instanceId,\n bindings: bindingOutputs,\n session: scopedSession,\n olds: previousProps,\n output: node.state.attr,\n })\n .pipe(instrumentLifecycle(\"update\", fqn, node.resource.Type, logicalId, instanceId));\n if (node.state.status === \"replaced\") {\n yield* commit({\n // The live replacement changed, but cleanup of older generations still\n // has to continue afterwards.\n ...node.state,\n attr,\n props: news,\n // Resolved payload, not raw `node.bindings` — see create commit.\n bindings: bindingOutputs,\n providerMode: node.mode,\n });\n }\n else {\n yield* commit({\n status: \"updated\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: news,\n attr,\n // Resolved payload, not raw `node.bindings` — see create commit.\n bindings: bindingOutputs,\n providerVersion: node.provider.version ?? 0,\n downstream: node.downstream,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n }\n tracker[fqn] = {\n output: attr,\n props: news,\n bindings: bindingOutputs,\n instanceId,\n };\n // Signal here for the linear (non-cycle) path. For in-cycle updates\n // the deferred has already been resolved by the early `storeAndSignal`\n // above and `signalReady` is a no-op the second time.\n yield* signalReady;\n yield* signalReadyStable;\n yield* markTerminal(\"updated\");\n return;\n }\n // ── replace ──\n if (node.action === \"replace\") {\n if (node.state.status === \"replaced\" && !node.restart) {\n // The replacement already exists; this pass only needs GC to clean up\n // older generations, so expose the current replacement and stop here.\n tracker[fqn] = {\n output: node.state.attr,\n props: node.state.props,\n bindings: node.state.bindings ?? [],\n instanceId,\n };\n yield* signalReady;\n yield* signalReadyStable;\n yield* markTerminal(\"created\");\n return;\n }\n let replState;\n if (node.state.status !== \"replacing\" || node.restart) {\n // `restart` deliberately nests the previous top-level replacement state\n // into `old`, creating a new outer generation to replace it.\n replState = yield* commit({\n status: \"replacing\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: node.props,\n bindings: excludeDeletedBindings(node.bindings),\n attr: undefined,\n providerVersion: node.provider.version ?? 0,\n deleteFirst: node.deleteFirst,\n old: node.state,\n downstream: node.downstream,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n }\n else {\n // Resume the same replacement generation after an interrupted apply.\n replState = node.state;\n }\n // ── delete-first replacements ──\n //\n // By default a replacement is create-first: the new generation is\n // created here and the old generation(s) are reclaimed afterwards by\n // `collectGarbage` (Phase 2). That ordering keeps the old resource\n // alive if the create fails, but it is wrong for resources whose\n // replacement cannot coexist with the original — a fixed physical\n // name, a singleton, etc. Those providers return\n // `{ action: \"replace\", deleteFirst: true }`.\n //\n // When `deleteFirst` is set we tear the previous generation(s) down\n // BEFORE creating the new one, and commit the result as a terminal\n // `created` state (rather than `replaced`) so Phase 2 has no old chain\n // left to drain. `delete` is required to be idempotent, so a re-run\n // after an interrupted apply simply re-converges.\n const deleteOldGenerations = (old) => Effect.gen(function* () {\n const retain = node.resource.RemovalPolicy === \"retain\";\n if (old.attr !== undefined && !retain) {\n // Delete each old generation with the provider variant of the\n // mode that created it — after a local ⇄ live switch,\n // `node.provider` (the new mode) cannot tear down the other\n // runtime's instance. Unstamped rows (legacy or written by a\n // mode-agnostic provider) are physically live, unless their\n // attrs carry the `dev:` identity marker — see stampedMode.\n const oldProvider = yield* findProviderByType(node.resource.Type, stampedMode(old));\n yield* oldProvider\n .delete({\n id: logicalId,\n fqn,\n instanceId: old.instanceId,\n olds: old.props,\n output: old.attr,\n session: scopedSession,\n bindings: [],\n })\n .pipe(instrumentLifecycle(\"delete\", fqn, node.resource.Type, logicalId, old.instanceId));\n }\n if (old.status === \"replacing\" || old.status === \"replaced\") {\n yield* deleteOldGenerations(old.old);\n }\n });\n if (node.deleteFirst) {\n yield* scopedSession.note(\"Deleting previous resource before creating its replacement (deleteFirst)...\");\n yield* deleteOldGenerations(replState.old);\n }\n let attr = replState.attr;\n if (attr !== undefined) {\n // If precreate already ran, expose that intermediate output immediately so\n // downstream resources can resolve against the same in-flight replacement.\n yield* storeAndSignal({\n output: attr,\n props: {},\n bindings: [],\n instanceId,\n });\n }\n if (node.provider.precreate && attr === undefined) {\n yield* report(\"pre-creating\");\n attr = yield* node.provider\n .precreate({\n id: logicalId,\n fqn,\n news: node.props,\n session: scopedSession,\n instanceId,\n bindings: excludeDeletedBindings(node.bindings),\n })\n .pipe(instrumentLifecycle(\"precreate\", fqn, node.resource.Type, logicalId, instanceId));\n yield* commit({\n status: \"replacing\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: node.props,\n attr,\n providerVersion: node.provider.version ?? 0,\n bindings: excludeDeletedBindings(node.bindings),\n downstream: node.downstream,\n old: replState.old,\n deleteFirst: node.deleteFirst,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n yield* storeAndSignal({\n output: attr,\n props: {},\n bindings: [],\n instanceId,\n });\n }\n // See create-flow note: while we're waiting on upstream outputs\n // the replacement isn't actually being created yet.\n yield* report(\"pending\");\n // Replacement create is evaluated exactly like create, but against the new\n // generation's instance id and with the previous generations preserved in `old`.\n yield* waitForDeps(allUpstreamFqns());\n yield* report(\"creating replacement\");\n const outputs = getOutputs();\n const news = (yield* Output.evaluate(node.props, outputs));\n const bindingOutputs = excludeDeletedBindings(yield* Output.evaluate(node.bindings, outputs));\n attr = yield* node.provider\n .reconcile({\n id: logicalId,\n fqn,\n news,\n instanceId,\n bindings: bindingOutputs,\n session: scopedSession,\n olds: undefined,\n output: attr,\n })\n .pipe(instrumentLifecycle(\"create\", fqn, node.resource.Type, logicalId, instanceId));\n if (node.deleteFirst) {\n // The old generation(s) were already torn down above, so there is\n // nothing left for `collectGarbage` to drain — collapse straight to\n // the terminal `created` state.\n yield* commit({\n status: \"created\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: news,\n attr,\n providerVersion: node.provider.version ?? 0,\n // Resolved payload, not raw `node.bindings` — see create commit.\n bindings: bindingOutputs,\n downstream: node.downstream,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n }\n else {\n yield* commit({\n // Creation of the new generation succeeded; from here on the only remaining\n // work is draining the old chain via garbage collection.\n status: \"replaced\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n props: news,\n attr,\n providerVersion: node.provider.version ?? 0,\n // Resolved payload, not raw `node.bindings` — see create commit.\n bindings: bindingOutputs,\n downstream: node.downstream,\n // Preserve the remaining backlog exactly as-is. GC is responsible for\n // popping one generation at a time until the chain is exhausted.\n old: replState.old,\n deleteFirst: node.deleteFirst,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n });\n }\n tracker[fqn] = {\n output: attr,\n props: news,\n bindings: bindingOutputs,\n instanceId,\n };\n yield* signalReady;\n yield* signalReadyStable;\n // Keep progress anchored to the live replacement while GC drains the\n // previous generation(s) in the background.\n yield* markTerminal(\"created\");\n return;\n }\n // @ts-expect-error - node is never, this should be unreachable\n return yield* Effect.die(`Unknown action: ${node.action}`);\n });\n}).pipe(Effect.catchCause((cause) => \n// Record the failure, propagate it to any downstream resources waiting on\n// our Deferred (so their waitForDeps short-circuits instead of deadlocking),\n// emit a \"fail\" status to the session, and resolve to void so Effect.all\n// does not interrupt sibling fibers. The aggregated cause is raised at\n// the end of executePlan.\nEffect.gen(function* () {\n failures.push({\n fqn,\n logicalId: node.resource.LogicalId,\n type: node.resource.Type,\n cause,\n });\n yield* Deferred.failCause(ready[fqn], cause);\n yield* Deferred.failCause(readyStable[fqn], cause);\n yield* session.emit({\n kind: \"status-change\",\n id: node.resource.LogicalId,\n type: node.resource.Type,\n status: \"fail\",\n providerMode: node.mode,\n });\n})), Effect.withSpan(\"apply.resource\", {\n attributes: {\n \"alchemy.resource.fqn\": fqn,\n \"alchemy.resource.type\": node.resource.Type,\n \"alchemy.resource.logical_id\": node.resource.LogicalId,\n \"alchemy.resource.action\": node.action,\n },\n}));\n// ── Task execution ─────────────────────────────────────────────────────────\n//\n// Tasks slot into the same scheduler as resources. They have no provider\n// lifecycle — just a single Effect that runs when inputs change (or when\n// `--force` is set). The output value is written to `tracker[fqn].output`\n// so downstream Output evaluation works identically to resource attrs.\n/**\n * Run an Action body, resolving any Outputs it captured via `yield* output`\n * during init against the current tracker and exposing them to the body through\n * the resolve {@link RuntimeContext}. See {@link makeCaptureContext}.\n */\nconst runAction = Effect.fn(\"apply.runAction\")(function* (task, input, outputs) {\n const resolved = {};\n for (const [key, output] of Object.entries(task.Captures)) {\n resolved[key] = yield* Output.evaluate(output, outputs);\n }\n return yield* task\n .Run(input)\n .pipe(Effect.provideService(RuntimeContext, makeResolveContext(resolved)));\n});\nconst executeActionNode = (fqn, node, tracker, ready, readyStable, terminalStatuses, session, state, stackName, stage, getOutputs, waitForDeps, failures) => Effect.gen(function* () {\n const task = node.def;\n const logicalId = task.LogicalId;\n const namespace = task.Namespace;\n const commit = (value) => state.set({\n stack: stackName,\n stage,\n fqn,\n value: { ...value, namespace },\n });\n const report = (status) => session.emit({\n kind: \"status-change\",\n id: logicalId,\n type: task.Type,\n status,\n });\n const signalReady = Deferred.succeed(ready[fqn], void 0);\n const signalReadyStable = Deferred.succeed(readyStable[fqn], void 0);\n if (node.action === \"noop\") {\n tracker[fqn] = {\n output: node.state.output,\n props: { __input: node.state.input },\n bindings: [],\n instanceId: fqn,\n };\n yield* signalReady;\n yield* signalReadyStable;\n terminalStatuses.set(fqn, {\n id: logicalId,\n type: task.Type,\n status: \"skipped\",\n });\n yield* report(\"skipped\");\n return;\n }\n // ── run ──\n // Tasks wait on `waitForStableDeps` (post-reconcile attrs) for their\n // upstreams, which is often the slowest dep chain in the deploy.\n // Surface that as \"pending\" instead of having the task show no status\n // until its run actually starts.\n yield* report(\"pending\");\n yield* waitForDeps([\n ...new Set([\n ...Object.keys(Output.resolveUpstream(node.input)),\n ...Object.keys(Output.upstreamAny(task.Captures)),\n ]),\n ].filter((f) => f in readyStable));\n const outputs = getOutputs();\n const resolvedInput = (yield* Output.evaluate(node.input, outputs));\n const inputHashValue = yield* hashInput(resolvedInput);\n yield* commit({\n kind: \"action\",\n status: \"running\",\n fqn,\n logicalId,\n actionType: task.Type,\n inputHash: inputHashValue,\n input: resolvedInput,\n downstream: node.downstream,\n });\n yield* report(\"running\");\n const result = yield* runAction(task, resolvedInput, outputs);\n yield* commit({\n kind: \"action\",\n status: \"ran\",\n fqn,\n logicalId,\n actionType: task.Type,\n inputHash: inputHashValue,\n input: resolvedInput,\n output: result,\n downstream: node.downstream,\n });\n tracker[fqn] = {\n output: result,\n props: { __input: resolvedInput },\n bindings: [],\n instanceId: fqn,\n };\n yield* signalReady;\n yield* signalReadyStable;\n terminalStatuses.set(fqn, {\n id: logicalId,\n type: task.Type,\n status: \"ran\",\n });\n yield* report(\"ran\");\n}).pipe(Effect.catchCause((cause) => Effect.gen(function* () {\n failures.push({\n fqn,\n logicalId: node.def.LogicalId,\n type: node.def.Type,\n cause,\n });\n yield* Deferred.failCause(ready[fqn], cause);\n yield* Deferred.failCause(readyStable[fqn], cause);\n yield* session.emit({\n kind: \"status-change\",\n id: node.def.LogicalId,\n type: node.def.Type,\n status: \"fail\",\n });\n})), Effect.withSpan(\"apply.action\", {\n attributes: {\n \"alchemy.action.fqn\": fqn,\n \"alchemy.action.type\": node.def.Type,\n \"alchemy.action.logical_id\": node.def.LogicalId,\n \"alchemy.action.verb\": node.action,\n },\n}));\n// ── Phase 3: imperative convergence loop ───────────────────────────────────\n//\n// After the initial concurrent pass, some resources may have been created\n// with stale upstream values (e.g. a precreate stub instead of the final\n// output). Walk the plan and re-evaluate each resource's props/bindings\n// against the current tracker outputs. Call provider.reconcile for any\n// resource whose resolved inputs differ from what it was last applied with.\n// Repeat until no resource needs updating.\nconst converge = Effect.fn(function* (plan, tracker, terminalStatuses, session, state, stackName, stage) {\n for (;;) {\n let anyUpdated = false;\n for (const [fqn, node] of Object.entries(plan.resources)) {\n if (node.action === \"noop\")\n continue;\n if (!tracker[fqn])\n continue;\n const outputs = Object.fromEntries(Object.entries(tracker).map(([k, t]) => [k, t.output]));\n const newProps = (yield* Output.evaluate(node.props, outputs));\n const newBindings = excludeDeletedBindings(yield* Output.evaluate(node.bindings, outputs));\n const oldProps = tracker[fqn].props;\n const oldBindings = tracker[fqn].bindings;\n const propsChanged = havePropsChanged(oldProps, newProps);\n const bindingsChanged = JSON.stringify(oldBindings) !== JSON.stringify(newBindings);\n if (!propsChanged && !bindingsChanged)\n continue;\n anyUpdated = true;\n const logicalId = node.resource.LogicalId;\n const namespace = node.resource.Namespace;\n const instanceId = tracker[fqn].instanceId;\n const scopedSession = {\n ...session,\n note: (note) => session.emit({ id: logicalId, kind: \"annotate\", message: note }),\n };\n const attr = yield* node.provider\n .reconcile({\n id: logicalId,\n fqn,\n news: newProps,\n instanceId,\n bindings: newBindings,\n session: scopedSession,\n olds: oldProps,\n output: tracker[fqn].output,\n })\n .pipe(instrumentLifecycle(\"update\", fqn, node.resource.Type, logicalId, instanceId));\n tracker[fqn] = {\n output: attr,\n props: newProps,\n bindings: newBindings,\n instanceId,\n };\n yield* state.set({\n stack: stackName,\n stage,\n fqn,\n value: {\n status: \"updated\",\n fqn,\n logicalId,\n instanceId,\n resourceType: node.resource.Type,\n // This site bypasses the `commit` helper, so strip unresolved\n // leaves (Effect-valued env entries survive `Output.evaluate`)\n // the same way `commit` does — state only ever holds plain data.\n props: stripUnresolved(newProps),\n attr,\n providerVersion: node.provider.version ?? 0,\n // Resolved payload, not raw `node.bindings` — see the create\n // commit in applyResource. Stripped like the commit helper so\n // Effect leaves (e.g. tagged Worker classes in `env`) never reach\n // the state store.\n bindings: stripUnresolved(newBindings),\n downstream: node.downstream,\n namespace,\n removalPolicy: node.resource.RemovalPolicy,\n providerMode: node.mode,\n },\n });\n terminalStatuses.set(fqn, {\n id: logicalId,\n type: node.resource.Type,\n status: \"updated\",\n providerMode: node.mode,\n });\n }\n // Tasks: re-run when their resolved input drifts vs. the value they\n // last applied with (e.g. an upstream resource produced new attrs in\n // this pass). Skipped (noop) tasks are not re-checked here — their\n // recorded inputHash is authoritative until the next plan.\n for (const [fqn, node] of Object.entries(plan.actions)) {\n if (node.action !== \"run\")\n continue;\n if (!tracker[fqn])\n continue;\n const outputs = Object.fromEntries(Object.entries(tracker).map(([k, t]) => [k, t.output]));\n const newInput = (yield* Output.evaluate(node.input, outputs));\n const newHash = yield* hashInput(newInput);\n const oldInput = tracker[fqn].props?.__input;\n const oldHash = yield* hashInput(oldInput);\n if (newHash === oldHash)\n continue;\n anyUpdated = true;\n yield* state.set({\n stack: stackName,\n stage,\n fqn,\n value: {\n kind: \"action\",\n status: \"running\",\n fqn,\n logicalId: node.def.LogicalId,\n namespace: node.def.Namespace,\n actionType: node.def.Type,\n inputHash: newHash,\n input: newInput,\n downstream: node.downstream,\n },\n });\n const result = yield* runAction(node.def, newInput, outputs);\n yield* state.set({\n stack: stackName,\n stage,\n fqn,\n value: {\n kind: \"action\",\n status: \"ran\",\n fqn,\n logicalId: node.def.LogicalId,\n namespace: node.def.Namespace,\n actionType: node.def.Type,\n inputHash: newHash,\n input: newInput,\n output: result,\n downstream: node.downstream,\n },\n });\n tracker[fqn] = {\n output: result,\n props: { __input: newInput },\n bindings: [],\n instanceId: fqn,\n };\n terminalStatuses.set(fqn, {\n id: node.def.LogicalId,\n type: node.def.Type,\n status: \"ran\",\n });\n }\n if (!anyUpdated)\n break;\n }\n});\n/**\n * Aggregate raised at the end of the deletion phase when one or more\n * resource deletes failed. Every resource whose delete did not depend on a\n * failed one was still attempted — a single failure no longer strands\n * unrelated siblings.\n */\nexport class DestroyError extends Data.TaggedError(\"DestroyError\") {\n get message() {\n return [\n `Failed to delete ${this.failures.length} resource(s)` +\n (this.blocked.length > 0\n ? ` (${this.blocked.length} more skipped because a dependent's delete failed)`\n : \"\") +\n \":\",\n ...this.failures.map((f) => ` ✗ ${f.fqn} (${f.resourceType}): ${Cause.pretty(f.cause)}`),\n ...this.blocked.map((b) => ` ⊘ ${b.fqn} (${b.resourceType}): skipped — blocked by failed delete of ${b.blockedBy.join(\", \")}`),\n ].join(\"\\n\");\n }\n}\nconst collectGarbage = Effect.fn(function* (plan, session) {\n const state = yield* yield* State;\n const stack = yield* Stack;\n const stackName = stack.name;\n const stage = yield* Stage;\n // Task deletions are pure state drops — no body is invoked. Run them in\n // parallel before resource GC; tasks never have provider-side dependencies\n // to wait on.\n yield* Effect.all(Object.entries(plan.actionDeletions ?? {}).map(([fqn, node]) => node === undefined\n ? Effect.void\n : Effect.gen(function* () {\n yield* session.emit({\n kind: \"status-change\",\n id: node.def.LogicalId,\n type: node.def.Type,\n status: \"deleting\",\n });\n yield* state.delete({ stack: stackName, stage, fqn });\n yield* session.emit({\n kind: \"status-change\",\n id: node.def.LogicalId,\n type: node.def.Type,\n status: \"deleted\",\n });\n })), { concurrency: \"unbounded\" });\n // Failures are collected — not propagated — so one bad delete never\n // strands unrelated siblings. `unresolved` tracks every FQN whose delete\n // failed or was blocked this run: later passes must not retry them (a\n // still-`replaced` row would otherwise spin the drain loop forever) and\n // dependencies scheduled in later passes must observe them as blocking.\n const failures = [];\n const blockedDeletes = [];\n const unresolved = new Set();\n const deleteGraph = Effect.fn(function* (deletionGraph) {\n const deletions = {};\n const deleteResource = (node, ancestors = new Set()) => Effect.gen(function* () {\n const isDeleteNode = (node) => \"action\" in node;\n const { fqn, logicalId, namespace, resourceType, instanceId, downstream, props, attr: persistedAttr, provider, providerMode, } = isDeleteNode(node)\n ? {\n // Use the persisted FQN verbatim — never recompute it from\n // `toFqn(namespace, logicalId)`. A logical ID may legitimately\n // contain the FQN separator (`/`), in which case `parseFqn`\n // truncated it and a recomputed key would miss the real state\n // row (the row would then resurface as an orphan on every\n // subsequent destroy, never getting deleted).\n fqn: node.resource.FQN,\n logicalId: node.resource.LogicalId,\n namespace: node.resource.Namespace,\n resourceType: node.resource.Type,\n instanceId: node.state.instanceId,\n downstream: node.downstream,\n props: node.state.props,\n attr: node.state.attr,\n // Plan resolved this provider for the row's persisted (or\n // marker-inferred) `providerMode` (see the deletions builder\n // in Plan.ts).\n provider: node.provider,\n providerMode: node.state.providerMode,\n }\n : {\n fqn: node.fqn,\n logicalId: node.logicalId,\n namespace: node.namespace,\n resourceType: node.old.resourceType,\n instanceId: node.old.instanceId,\n downstream: node.old.downstream,\n props: node.old.props,\n attr: node.old.attr,\n // A missing provider is fatal — plan already dies on zombie\n // rows (see the deletions builder in Plan.ts); this guards\n // the replaced-chain generations that bypass plan. The old\n // generation is torn down with the provider variant of the\n // mode that created it (local ⇄ live replacements);\n // unstamped rows are physically live unless their attrs\n // carry the `dev:` identity marker (see stampedMode).\n provider: yield* tryFindProviderByType(node.old.resourceType, stampedMode(node.old)).pipe(Effect.flatMap(Option.match({\n onNone: () => Effect.die(missingProviderError(node.old.resourceType, node.fqn)),\n onSome: Effect.succeed,\n }))),\n providerMode: node.old.providerMode,\n };\n // Mutable: an attr-less row (interrupted create) may recover its\n // attributes from `provider.read` below, right before deletion.\n let attr = persistedAttr;\n const nextAncestors = new Set(ancestors).add(fqn);\n const commit = (value) => state.set({\n stack: stackName,\n stage,\n fqn,\n // Same rule as the lifecycle commit above: state only stores\n // plain data, never unresolved Output exprs or Effect leaves.\n value: {\n ...value,\n props: stripUnresolved(value.props),\n bindings: stripUnresolved(value.bindings),\n namespace,\n },\n });\n const report = (status) => session.emit({\n kind: \"status-change\",\n id: logicalId,\n type: resourceType,\n status,\n providerMode,\n });\n const scopedSession = {\n ...session,\n note: (note) => session.emit({\n id: logicalId,\n kind: \"annotate\",\n message: note,\n }),\n };\n return yield* (deletions[fqn] ??= yield* Effect.cached(Effect.gen(function* () {\n // Dependents (`downstream`) are deleted before this resource. A\n // dependent whose delete failed (or was itself blocked) may make\n // this resource legitimately undeletable (dependency violation),\n // so it is skipped with a \"blocked by\" note instead of surfacing\n // a spurious second error.\n const dependents = yield* Effect.all(downstream.map((dep) => dep !== fqn && !ancestors.has(dep)\n ? dep in deletionGraph\n ? deleteResource(deletionGraph[dep], nextAncestors).pipe(Effect.map((outcome) => ({ dep, outcome })))\n : // Not in this pass's graph — but it may have failed in\n // an earlier drain pass of the same destroy.\n Effect.sync(() => ({\n dep,\n outcome: unresolved.has(dep)\n ? \"failed\"\n : \"deleted\",\n }))\n : Effect.succeed({ dep, outcome: \"deleted\" })), { concurrency: \"unbounded\" });\n const blockedBy = dependents\n .filter(({ outcome }) => outcome !== \"deleted\")\n .map(({ dep }) => dep);\n if (blockedBy.length > 0) {\n unresolved.add(fqn);\n blockedDeletes.push({\n fqn,\n logicalId,\n resourceType,\n blockedBy,\n });\n yield* scopedSession.note(`Skipping delete — blocked by failed delete of ${blockedBy.join(\", \")}.`);\n yield* report(\"skipped\");\n return \"blocked\";\n }\n return yield* deleteResourceBody().pipe(Effect.catchCause((cause) => Effect.gen(function* () {\n unresolved.add(fqn);\n failures.push({ fqn, logicalId, resourceType, cause });\n yield* report(\"fail\");\n return \"failed\";\n })));\n })));\n function deleteResourceBody() {\n return Effect.gen(function* () {\n if (isDeleteNode(node)) {\n yield* report(\"deleting\");\n if (node.resource.RemovalPolicy === \"retain\") {\n yield* state.delete({\n stack: stackName,\n stage,\n fqn,\n });\n yield* report(\"retained\");\n // Retention is intentional — it never blocks dependencies.\n return \"deleted\";\n }\n }\n // Honor `retain` for the old generation of a replacement, mirroring\n // the orphan-delete path above. Delete-node retain is already\n // handled with an early return; this guards the replaced\n // old-generation physical delete.\n const retainOldGeneration = !isDeleteNode(node) && node.removalPolicy === \"retain\";\n if (retainOldGeneration) {\n yield* scopedSession.note(\"Retaining replaced resource (removal policy: retain)...\");\n }\n // A row can reach deletion with `attr === undefined` when a create\n // was interrupted after the cloud-side call succeeded but before\n // `reconcile` returned Attributes (a `creating` row — or the old\n // generation of a replacement chain in the same predicament).\n // Skipping the provider's delete outright would silently orphan\n // the physical resource, so ask `read` to look it up from the\n // persisted props (providers derive the deterministic physical\n // name from id/props):\n // - plain attrs → exists and is ours; proceed to delete\n // - Unowned(attrs) → exists but is NOT ours (e.g. our create\n // actually lost a name race, or died before\n // stamping ownership) — never delete a\n // foreign resource; drop our state and say so\n // - undefined → nothing exists; dropping state is safe\n if (attr === undefined && !retainOldGeneration) {\n if (provider.read) {\n const recovered = yield* provider\n .read({\n id: logicalId,\n fqn,\n instanceId,\n olds: props,\n output: undefined,\n })\n .pipe(instrumentLifecycle(\"read\", fqn, resourceType, logicalId, instanceId), \n // The persisted props of an interrupted create can carry\n // holes where unresolved Outputs were stripped at commit\n // time (see stripUnresolved) — e.g. a parent reference\n // persisted as `{}`. A provider that dereferences one\n // crashes deep inside its SDK client (a SchemaError\n // defect), which would make the stage impossible to\n // destroy. Recovery is best-effort: degrade the defect\n // to \"nothing recovered\", surface a note, and let the\n // row be dropped (#995).\n Effect.catchDefect((defect) => scopedSession\n .note(\"Recovery read crashed while looking up this \" +\n \"resource's interrupted create \" +\n `(${String(defect)}) — if a physical resource ` +\n \"was created, it must be cleaned up manually.\")\n .pipe(Effect.as(undefined))));\n if (recovered !== undefined) {\n if (Unowned.is(recovered)) {\n yield* scopedSession.note(\"Resource exists in the cloud but is not owned by this \" +\n \"stack — leaving it in place (re-deploy with --adopt \" +\n \"to take ownership, then destroy).\");\n }\n else {\n attr = stripUnowned(recovered);\n }\n }\n }\n else {\n yield* scopedSession.note(\"No attributes were recorded for this resource (its create \" +\n \"was interrupted) and the provider does not implement \" +\n \"`read` — if a physical resource was created, it must be \" +\n \"cleaned up manually.\");\n }\n }\n if (isDeleteNode(node)) {\n yield* commit({\n status: \"deleting\",\n fqn,\n logicalId,\n instanceId,\n resourceType,\n props,\n attr,\n downstream,\n providerVersion: provider.version ?? 0,\n bindings: excludeDeletedBindings(node.bindings),\n removalPolicy: node.resource.RemovalPolicy,\n providerMode,\n });\n }\n if (attr !== undefined && !retainOldGeneration) {\n yield* provider\n .delete({\n id: logicalId,\n fqn,\n instanceId,\n olds: props,\n output: attr,\n session: scopedSession,\n bindings: [],\n })\n .pipe(instrumentLifecycle(\"delete\", fqn, resourceType, logicalId, instanceId));\n }\n if (isDeleteNode(node)) {\n yield* state.delete({\n stack: stackName,\n stage,\n fqn,\n });\n yield* report(\"deleted\");\n }\n else {\n if (!retainOldGeneration) {\n yield* scopedSession.note(\"Cleaning up replaced resource...\");\n }\n if (node.old.status === \"replacing\" ||\n node.old.status === \"replaced\") {\n // We only deleted the outermost old generation. A nested replacement\n // chain still exists, so stay in `replaced` and pop the chain forward\n // one level. The outer loop will pick this resource up again.\n yield* commit({\n status: \"replaced\",\n fqn,\n logicalId: node.logicalId,\n instanceId: node.instanceId,\n resourceType: node.resourceType,\n props: node.props,\n attr: node.attr,\n providerVersion: node.providerVersion,\n downstream: node.downstream,\n bindings: excludeDeletedBindings(node.bindings),\n old: node.old.old,\n deleteFirst: node.deleteFirst,\n removalPolicy: node.removalPolicy,\n providerMode: node.providerMode,\n });\n }\n else {\n // The old chain is fully drained, so the current replacement is now\n // the stable resource and we can collapse back to a terminal state.\n yield* commit({\n status: \"created\",\n fqn,\n logicalId: node.logicalId,\n instanceId: node.instanceId,\n resourceType: node.resourceType,\n props: node.props,\n attr: node.attr,\n providerVersion: node.providerVersion,\n downstream: node.downstream,\n bindings: excludeDeletedBindings(node.bindings),\n removalPolicy: node.removalPolicy,\n providerMode: node.providerMode,\n });\n }\n yield* scopedSession.note(retainOldGeneration\n ? \"Replaced resource retained.\"\n : \"Replaced resource cleanup complete.\");\n }\n return \"deleted\";\n });\n }\n });\n // Attempt every root. Per-node failures were recorded (and their state\n // retained) inside each node's delete effect — the effects resolve to\n // outcomes and never fail, so one bad resource never interrupts sibling\n // deletions mid-flight.\n yield* Effect.all(Object.values(deletionGraph)\n .filter((node) => node !== undefined)\n .map((node) => deleteResource(node)), { concurrency: \"unbounded\" });\n });\n // The first pass handles both planned deletions and any top-level replaced\n // resources already present in state. Later passes only drain replacement\n // chains that were re-committed as `replaced` while deleting older generations.\n let first = true;\n while (true) {\n const remainingReplacedResources = (yield* state.getReplacedResources({\n stack: stackName,\n stage,\n }))\n // A row whose drain already failed (or was blocked) this run stays\n // `replaced` in state — retrying it in a later pass would loop forever.\n // It stays behind for the next destroy; the aggregate error below\n // reports it.\n .filter((replaced) => !unresolved.has(replaced.fqn));\n if (!first && remainingReplacedResources.length === 0) {\n break;\n }\n yield* deleteGraph({\n // Orphan/resource deletions from the current plan should only run once.\n ...(first ? plan.deletions : {}),\n ...Object.fromEntries(remainingReplacedResources.map((replaced) => [\n // Key by the persisted FQN (not a recomputed one) so logical IDs\n // containing the FQN separator round-trip correctly.\n replaced.fqn,\n replaced,\n ])),\n });\n first = false;\n }\n if (failures.length > 0) {\n // Every independent delete was still attempted; now surface everything\n // that went wrong (and everything skipped as a consequence) as one\n // typed aggregate. The destroy as a whole still fails.\n return yield* Effect.fail(new DestroyError({ failures, blocked: blockedDeletes }));\n }\n});\nconst excludeDeletedBindings = (bindings) => bindings.flatMap(({ action, sid, data }) => action === \"delete\" ? [] : [{ sid, data }]);\n//# sourceMappingURL=Apply.js.map","","import { exec } from \"node:child_process\";\nimport * as crypto from \"node:crypto\";\nimport * as fs from \"node:fs/promises\";\nimport * as os from \"node:os\";\nimport * as nodePath from \"node:path\";\nimport * as Effect from \"effect/Effect\";\nimport packageJson from \"../../package.json\" with { type: \"json\" };\nconst ALCHEMY_DIR = nodePath.join(os.homedir(), \".alchemy\");\nconst ID_PATH = nodePath.join(ALCHEMY_DIR, \"id\");\nconst DISABLED_PATH = nodePath.join(ALCHEMY_DIR, \"telemetry-disabled\");\nconst tryRead = (path) => Effect.tryPromise(() => fs.readFile(path, \"utf-8\").then((s) => s.trim())).pipe(Effect.orElseSucceed(() => null));\nconst sha256Hex = (input) => crypto.createHash(\"sha256\").update(input).digest(\"hex\");\nconst hashStringOrEmpty = (input) => input == null || input === \"\" ? \"\" : sha256Hex(input);\nconst execCapture = (cmd) => Effect.callback((resume) => {\n exec(cmd, { timeout: 1500 }, (err, stdout) => {\n if (err) {\n resume(Effect.succeed(null));\n return;\n }\n resume(Effect.succeed(stdout.toString().trim()));\n });\n});\nconst getOrCreateUserId = Effect.gen(function* () {\n const existing = yield* tryRead(ID_PATH);\n if (existing)\n return existing;\n const id = crypto.randomUUID();\n yield* Effect.tryPromise({\n try: async () => {\n await fs.mkdir(ALCHEMY_DIR, { recursive: true });\n await fs.writeFile(ID_PATH, id);\n },\n catch: () => null,\n }).pipe(Effect.catch(() => Effect.void));\n return id;\n});\nconst getRootCommitHash = execCapture(process.platform === \"win32\"\n ? `git rev-list --max-parents=0 HEAD | ForEach-Object { if (-not (git cat-file -p $_ | Select-String \"^parent \")) { $_ } }`\n : `git rev-list --max-parents=0 HEAD | xargs -r -I{} sh -c 'git cat-file -p {} | grep -q \"^parent \" || echo {}'`);\nconst getGitOriginUrl = execCapture(\"git config --get remote.origin.url\");\nconst getBranchName = execCapture(\"git rev-parse --abbrev-ref HEAD\");\nconst getRuntime = () => {\n const g = globalThis;\n if (typeof g.Bun !== \"undefined\") {\n return { name: \"bun\", version: g.Bun.version };\n }\n if (typeof g.Deno !== \"undefined\") {\n return { name: \"deno\", version: g.Deno.version?.deno ?? \"\" };\n }\n if (globalThis.process?.versions?.node) {\n return { name: \"node\", version: process.versions.node };\n }\n return { name: \"\", version: \"\" };\n};\nconst CI_PROVIDERS = [\n { env: \"GITHUB_ACTIONS\", provider: \"GitHub Actions\", isCI: true },\n { env: \"GITLAB_CI\", provider: \"GitLab CI\", isCI: true },\n { env: \"CIRCLECI\", provider: \"CircleCI\", isCI: true },\n { env: \"JENKINS_URL\", provider: \"Jenkins\", isCI: true },\n { env: \"TRAVIS\", provider: \"Travis CI\", isCI: true },\n { env: \"BUILDKITE\", provider: \"Buildkite\", isCI: true },\n { env: \"NOW_BUILDER\", provider: \"Vercel\", isCI: true },\n { env: \"VERCEL\", provider: \"Vercel\", isCI: false },\n];\nconst getCIEnvironment = () => {\n for (const p of CI_PROVIDERS) {\n if (process.env[p.env]) {\n return { provider: p.provider, isCI: p.isCI };\n }\n }\n return { provider: \"\", isCI: !!process.env.CI };\n};\nconst TELEMETRY_DISABLED_ENV = () => !!process.env.ALCHEMY_TELEMETRY_DISABLED ||\n !!process.env.DO_NOT_TRACK ||\n !!process.env.NO_TRACK;\n/**\n * `true` if telemetry is disabled via environment variable\n * (`DO_NOT_TRACK`, `NO_TRACK`, `ALCHEMY_TELEMETRY_DISABLED`) or via a\n * persisted opt-out file at `~/.alchemy/telemetry-disabled`.\n */\nexport const isTelemetryDisabled = Effect.gen(function* () {\n if (TELEMETRY_DISABLED_ENV())\n return true;\n const persisted = yield* tryRead(DISABLED_PATH);\n return persisted === \"true\";\n});\n/**\n * Persists an opt-out so future invocations skip telemetry without needing\n * an env var.\n */\nexport const setTelemetryDisabled = Effect.tryPromise(async () => {\n await fs.mkdir(ALCHEMY_DIR, { recursive: true });\n await fs.writeFile(DISABLED_PATH, \"true\");\n}).pipe(Effect.ignore);\nexport const setTelemetryEnabled = Effect.tryPromise(() => fs.rm(DISABLED_PATH, { force: true })).pipe(Effect.ignore);\nconst collectAttributesUncached = Effect.gen(function* () {\n const [userId, rootCommit, originUrl, branch] = yield* Effect.all([\n getOrCreateUserId,\n getRootCommitHash,\n getGitOriginUrl,\n getBranchName,\n ], { concurrency: \"unbounded\" });\n const runtime = getRuntime();\n const ci = getCIEnvironment();\n return {\n \"alchemy.user.id\": userId,\n \"alchemy.session.id\": process.env.ALCHEMY_TELEMETRY_SESSION_ID ?? crypto.randomUUID(),\n \"alchemy.version\": packageJson.version,\n \"alchemy.git.root_commit\": rootCommit ?? \"\",\n \"alchemy.git.origin_hash\": hashStringOrEmpty(originUrl),\n \"alchemy.git.branch_hash\": hashStringOrEmpty(branch),\n \"alchemy.runtime.name\": runtime.name,\n \"alchemy.runtime.version\": runtime.version,\n \"alchemy.ci.provider\": ci.provider,\n \"alchemy.ci\": ci.isCI,\n \"host.arch\": os.arch(),\n \"os.type\": os.platform(),\n \"os.version\": os.release(),\n \"host.cpus\": os.cpus().length,\n \"host.memory_mb\": Math.round(os.totalmem() / 1024 / 1024),\n };\n});\nlet cachedAttrs;\n/**\n * Resolves the {@link TelemetryAttributes} for the current process. Cached\n * so file I/O and `git` invocations only run once per CLI invocation; every\n * subsequent caller gets the same record (and therefore the same session\n * id).\n */\nexport const collectAttributes = Effect.suspend(() => cachedAttrs !== undefined\n ? Effect.succeed(cachedAttrs)\n : collectAttributesUncached.pipe(Effect.tap((a) => Effect.sync(() => {\n cachedAttrs = a;\n }))));\n//# sourceMappingURL=Attributes.js.map","import * as p from \"@clack/prompts\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport { ChildProcess } from \"effect/unstable/process\";\nexport class PromptCancelled extends Data.TaggedError(\"PromptCancelled\") {\n}\nexport const retryIfCancelled = Effect.retry({\n while: (e) => e instanceof PromptCancelled,\n});\n/**\n * Wraps a clack prompt (which returns a `Promise<T | symbol>` where the\n * symbol indicates user cancellation) in an Effect.\n *\n * Returns `undefined` if the user cancels (Ctrl+C / Escape).\n *\n * Uses `Effect.callback` so fiber interruption propagates to the clack\n * prompt through its abort signal, releasing stdin and restoring the cursor.\n */\nexport const prompt = (fn) => Effect.callback((resume, signal) => {\n let settled = false;\n fn(signal).then((result) => {\n if (settled || signal.aborted)\n return;\n settled = true;\n if (p.isCancel(result)) {\n resume(Effect.fail(new PromptCancelled()));\n }\n else {\n resume(Effect.succeed(result));\n }\n }, (err) => {\n if (settled || signal.aborted)\n return;\n settled = true;\n resume(Effect.die(err));\n });\n});\nexport const success = (str) => Effect.sync(() => p.log.success(str));\nexport const warn = (str) => Effect.sync(() => p.log.warn(str));\nexport const error = (str) => Effect.sync(() => p.log.error(str));\nexport const info = (str) => Effect.sync(() => p.log.info(str));\nexport const text = (opts) => {\n const validate = opts.validate;\n return prompt((signal) => p.text({\n ...opts,\n signal,\n validate: validate === undefined ? undefined : (value) => validate(value ?? \"\"),\n }));\n};\nexport const password = (opts) => {\n const validate = opts.validate;\n return prompt((signal) => p.password({\n ...opts,\n signal,\n validate: validate === undefined ? undefined : (value) => validate(value ?? \"\"),\n }));\n};\nexport const select = (opts) => prompt((signal) => p.select({ ...opts, signal }));\nexport const confirm = (opts) => prompt((signal) => p.confirm({ ...opts, signal }));\nexport const multiselect = (opts) => prompt((signal) => p.multiselect({ ...opts, signal }));\n/**\n * Open a URL in the user's default browser.\n *\n * On Windows, uses rundll32's FileProtocolHandler — a built-in shim that\n * opens URLs in the default browser. It accepts the URL as a direct\n * argument (no shell, no quoting of `&`). cmd.exe `start` would treat\n * `&` in OAuth URLs as a command separator, and `explorer.exe` treats\n * its arg as a path.\n */\nexport const openUrl = (url) => Effect.gen(function* () {\n const [cmd, args] = process.platform === \"win32\"\n ? [\"rundll32.exe\", [\"url.dll,FileProtocolHandler\", url]]\n : process.platform === \"darwin\"\n ? [\"open\", [url]]\n : [\"xdg-open\", [url]];\n const handle = yield* ChildProcess.make(cmd, [...args], { shell: false });\n yield* handle.exitCode;\n}).pipe(Effect.scoped);\n//# sourceMappingURL=Clank.js.map","import * as Config from \"effect/Config\";\nimport * as Effect from \"effect/Effect\";\nimport * as Clank from \"../Util/Clank.js\";\nimport { AuthError } from \"./AuthProvider.js\";\nexport const getEnv = (key) => Config.string(key).pipe(Effect.orElseSucceed(() => undefined));\nexport const getEnvRequired = (key) => Config.string(key).pipe(Effect.catch(() => Effect.fail(new AuthError({ message: `Missing required env: ${key}` }))));\nexport const getEnvRedacted = (key) => Config.redacted(key).pipe(Effect.orElseSucceed(() => undefined));\nexport const getEnvRedactedRequired = (key) => Config.redacted(key).pipe(Effect.catch(() => Effect.fail(new AuthError({ message: `Missing required env: ${key}` }))));\nexport const retryOnce = (self) => self.pipe(Effect.retry({\n times: 1,\n while: (e) => e instanceof Clank.PromptCancelled,\n}), Effect.mapError((e) => new AuthError({ message: \"User cancelled prompt\", cause: e })));\n//# sourceMappingURL=Env.js.map","import * as Config from \"effect/Config\";\nimport * as Context from \"effect/Context\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport * as Result from \"effect/Result\";\nimport { AlchemyContext } from \"../AlchemyContext.js\";\nimport { getAuthProvider } from \"../Auth/AuthProvider.js\";\nimport { ALCHEMY_PROFILE, AlchemyProfile } from \"../Auth/Profile.js\";\nimport { AWS_AUTH_PROVIDER_NAME, LOCAL_ACCOUNT_ID, } from \"./AuthProvider.js\";\nexport const AWS_PROFILE = Config.string(\"AWS_PROFILE\").pipe(Config.withDefault(\"default\"));\nexport const AWS_REGION = Config.string(\"AWS_REGION\");\nexport const AWS_ACCOUNT_ID = Config.string(\"AWS_ACCOUNT_ID\");\nexport const AWS_ACCESS_KEY_ID = Config.string(\"AWS_ACCESS_KEY_ID\");\nexport const AWS_SECRET_ACCESS_KEY = Config.redacted(\"AWS_SECRET_ACCESS_KEY\");\nexport const AWS_SESSION_TOKEN = Config.redacted(\"AWS_SESSION_TOKEN\");\nexport class FailedToGetAccount extends Data.TaggedError(\"AWS::Environment::FailedToGetAccount\") {\n}\nexport class AWSEnvironment extends Context.Service()(\"AWS::Environment\") {\n static current = AWSEnvironment.use((env) => env);\n /**\n * Whether this environment is the floci / `{ method: \"local\" }` emulator\n * (dummy account {@link LOCAL_ACCOUNT_ID}). A set `endpoint` is not\n * enough: `AWS_ENDPOINT_URL` and explicit endpoint overrides also\n * populate it on real-account credentials.\n */\n static isLocalEmulator = Effect.map(AWSEnvironment.current, (env) => env.accountId === LOCAL_ACCOUNT_ID);\n kind = \"Environment\";\n}\n/** @see {@link AWSEnvironment.isLocalEmulator} */\nexport const isLocalEmulator = AWSEnvironment.isLocalEmulator;\nexport const Default = Layer.effect(AWSEnvironment, Effect.gen(function* () {\n const profile = yield* AlchemyProfile;\n const auth = yield* getAuthProvider(AWS_AUTH_PROVIDER_NAME);\n const profileName = yield* ALCHEMY_PROFILE;\n const ci = yield* Config.boolean(\"CI\").pipe(Config.withDefault(false));\n const dev = Option.match(yield* Effect.serviceOption(AlchemyContext), {\n onNone: () => false,\n onSome: (ctx) => ctx.dev,\n });\n // The pre-existing resolution path: stored profile config (or, when\n // nothing is stored, the interactive configure flow / non-interactive\n // AuthError) → resolved credentials. Deploy-mode behavior is unchanged.\n const resolveConfigured = profile\n .loadOrConfigure(auth, profileName, { ci })\n .pipe(Effect.flatMap((config) => auth.read(profileName, config)));\n // Credential-free dev: an `alchemy dev` run must work with zero AWS\n // credentials. When nothing is configured for the active profile, try\n // ambient env-var credentials first (a developer who exported AWS_*\n // wants the real cloud), then fall back to the local emulator — the\n // same environment `{ method: \"local\" }` produces (dummy creds,\n // account 000000000000, endpoint localhost:4566, ensureFloci).\n // A profile that IS configured keeps its normal resolution (and its\n // normal failures) even in dev.\n const resolveDev = Effect.gen(function* () {\n const stored = yield* profile.getProfile(profileName);\n if (stored?.[AWS_AUTH_PROVIDER_NAME] != null) {\n return yield* resolveConfigured;\n }\n const fromEnv = yield* Effect.result(auth.read(profileName, { method: \"env\" }));\n if (Result.isSuccess(fromEnv)) {\n return fromEnv.success;\n }\n yield* Effect.logInfo(\"no AWS credentials — using the local emulator\");\n return yield* auth.read(profileName, { method: \"local\" });\n });\n return yield* (dev ? resolveDev : resolveConfigured).pipe(Effect.orDie, Effect.cached);\n})).pipe(Layer.orDie);\n//# sourceMappingURL=Environment.js.map","import { Endpoint } from \"@distilled.cloud/aws\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { AWSEnvironment } from \"./Environment.js\";\nexport const of = (endpoint) => Layer.succeed(Endpoint.Endpoint, Effect.succeed(endpoint));\n/**\n * Derive a custom endpoint (if any) from the surrounding\n * {@link AWSEnvironment}. If the environment has no `endpoint` set, this\n * Layer is empty (the SDK uses its default endpoint resolver).\n */\nexport const fromEnvironment = Layer.effect(Endpoint.Endpoint, Effect.gen(function* () {\n return Effect.map(yield* AWSEnvironment, (env) => env.endpoint ?? undefined);\n}));\n/**\n * Explicitly \"no custom endpoint\" — the SDK falls back to its default\n * endpoint resolver.\n *\n * Use this (never `Layer.empty`) when an AWS call is made from *inside*\n * the construction of {@link AWSEnvironment}: leaving `Endpoint`\n * unprovided lets the call fall through to {@link fromEnvironment},\n * whose service Effect re-enters the in-flight `AWSEnvironment` cache and\n * deadlocks the fiber with no I/O and no timer pending.\n */\nexport const none = Layer.succeed(Endpoint.Endpoint, Effect.succeed(undefined));\n//# sourceMappingURL=Endpoint.js.map","import * as Region from \"@distilled.cloud/aws/Region\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { AWSEnvironment } from \"./Environment.js\";\nexport { AWS_REGION } from \"./Environment.js\";\nexport { Region } from \"@distilled.cloud/aws/Region\";\nexport const of = (region) => Layer.succeed(Region.Region, Effect.succeed(region));\nexport const fromEnvOrElse = (region) => Layer.succeed(Region.Region, Effect.succeed(process.env.AWS_REGION ?? region));\n// Deferred with `Effect.suspend` so it does not dereference `AWSEnvironment`\n// during module evaluation. `Region.ts` and `Environment.ts` are part of an\n// import cycle (AuthProvider → Region → Environment → AuthProvider); touching\n// `AWSEnvironment` eagerly at top level hits a temporal-dead-zone error when\n// this module is evaluated mid-cycle.\nexport const CurrentRegion = Effect.suspend(() => AWSEnvironment.use((env) => Effect.flatMap(env, ({ region }) => Effect.succeed(region))));\n/**\n * Derive the AWS region from the surrounding {@link AWSEnvironment}.\n */\nexport const fromEnvironment = Layer.effect(Region.Region, Effect.gen(function* () {\n const env = yield* AWSEnvironment;\n return Effect.map(env, (env) => env.region);\n}));\n//# sourceMappingURL=Region.js.map","import * as Floci from \"@alchemy.run/floci\";\nimport * as DistilledAuth from \"@distilled.cloud/aws/Auth\";\nimport { Credentials } from \"@distilled.cloud/aws/Credentials\";\nimport * as STS from \"@distilled.cloud/aws/sts\";\nimport * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport * as Match from \"effect/Match\";\nimport * as Path from \"effect/Path\";\nimport * as Redacted from \"effect/Redacted\";\nimport { ChildProcess } from \"effect/unstable/process\";\nimport * as NodeCrypto from \"node:crypto\";\nimport * as NodeOs from \"node:os\";\nimport { AuthError, AuthProviderLayer, } from \"../Auth/AuthProvider.js\";\nimport { CredentialsStore, displayRedacted } from \"../Auth/Credentials.js\";\nimport { getEnv, getEnvRedacted, getEnvRedactedRequired, getEnvRequired, retryOnce, } from \"../Auth/Env.js\";\nimport * as Clank from \"../Util/Clank.js\";\nimport * as Endpoint from \"./Endpoint.js\";\nimport * as Region from \"./Region.js\";\nexport const AWS_AUTH_PROVIDER_NAME = \"AWS\";\n/** Default endpoint of a local AWS emulator (floci / LocalStack). */\nexport const DEFAULT_LOCAL_ENDPOINT = `http://localhost:${Floci.DEFAULT_FLOCI_PORT}`;\n/**\n * Dummy account stamped on every floci / `{ method: \"local\" }` environment.\n * A custom `AWS_ENDPOINT_URL` on env/sso credentials does NOT use this —\n * those keep the real account from STS / `AWS_ACCOUNT_ID`.\n */\nexport const LOCAL_ACCOUNT_ID = \"000000000000\";\nconst options = [\n {\n value: \"sso\",\n label: \"SSO\",\n hint: \"aws sso login — credentials loaded from AWS SSO cache\",\n },\n {\n value: \"env\",\n label: \"Environment Variables\",\n hint: \"AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY\",\n },\n {\n value: \"stored\",\n label: \"Stored\",\n hint: \"stored in ~/.alchemy/credentials\",\n },\n {\n value: \"local\",\n label: \"Local emulator\",\n hint: \"floci / LocalStack on localhost:4566 — no AWS account\",\n },\n];\n/**\n * An explicitly-set `AWS_REGION` env var wins over the region recorded in an\n * SSO profile (`~/.aws/config`) or in stored credentials. `AWS_DEFAULT_REGION`\n * deliberately does NOT override — it is a *default* for when no region is\n * configured anywhere, and the profile's region is explicit configuration.\n */\nexport const applyEnvRegionOverride = (creds) => getEnv(\"AWS_REGION\").pipe(Effect.map((envRegion) => envRegion ? { ...creds, region: envRegion } : creds));\n/**\n * Layer that registers the AWS {@link AuthProvider} into the\n * {@link AuthProviders} registry when built. Include this in the AWS\n * `providers()` layer so `alchemy login` can discover it.\n */\nexport const AwsAuth = AuthProviderLayer()(AWS_AUTH_PROVIDER_NAME, Effect.gen(function* () {\n const store = yield* CredentialsStore;\n const getAccountId = ({ accessKeyId, secretAccessKey, sessionToken, region, endpoint, }) => STS.getCallerIdentity({}).pipe(Effect.provide(Layer.mergeAll(Layer.succeed(Credentials, Effect.succeed({\n accessKeyId,\n secretAccessKey,\n sessionToken,\n region,\n })), \n // Provide Region directly from the resolved inputs. Relying on the\n // ambient Region provider (Region.fromEnvironment) here would\n // deadlock: it derives the region from AWSEnvironment, which is the\n // very service still being constructed by this STS call.\n Region.of(region), \n // A custom endpoint (local emulator) must apply to this STS call\n // too — the default resolver would call real AWS. When there is\n // no custom endpoint we must still provide `Endpoint.none`\n // rather than leaving it unset: falling through to the ambient\n // `Endpoint.fromEnvironment` reads it off AWSEnvironment — the\n // very service this STS call is constructing — and deadlocks\n // the fiber on its own in-flight cache (no I/O, no timer, no\n // output). Same reason as `Region.of` above.\n endpoint ? Endpoint.of(endpoint) : Endpoint.none)), Effect.flatMap((self) => self.Account\n ? Effect.succeed(self.Account)\n : Effect.die(new Error(\"No account ID found\"))));\n const loginStored = Effect.fn(function* (profileName) {\n const accessKeyId = yield* Clank.text({\n message: \"AWS Access Key ID\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const secretAccessKey = yield* Clank.password({\n message: \"AWS Secret Access Key\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const sessionToken = yield* Clank.text({\n message: \"AWS Session Token (optional — press Enter or Esc to skip)\",\n placeholder: \"(none)\",\n }).pipe(Effect.catch(() => Effect.succeed(\"\")));\n const region = yield* Clank.text({\n message: \"AWS Region\",\n placeholder: \"us-east-1\",\n defaultValue: \"us-east-1\",\n }).pipe(retryOnce);\n const accountId = yield* getAccountId({\n accessKeyId: Redacted.make(accessKeyId),\n secretAccessKey: Redacted.make(secretAccessKey),\n sessionToken: sessionToken ? Redacted.make(sessionToken) : undefined,\n region,\n });\n yield* store.write(profileName, \"aws\", {\n accountId,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n region,\n });\n yield* Clank.success(\"AWS credentials saved.\");\n return { method: \"stored\" };\n });\n const configureInteractive = (profileName) => Clank.select({\n message: \"AWS authentication method\",\n options,\n }).pipe(Effect.flatMap((method) => Match.value(method).pipe(Match.when(\"env\", () => Effect.succeed({ method: \"env\" })), Match.when(\"sso\", () => Effect.gen(function* () {\n const ssoProfile = yield* Clank.text({\n message: \"AWS profile name (from ~/.aws/config)\",\n placeholder: \"default\",\n defaultValue: \"default\",\n });\n const config = {\n method: \"sso\",\n ssoProfile: ssoProfile ?? \"default\",\n };\n yield* loginSSO(config);\n return config;\n })), Match.when(\"stored\", () => loginStored(profileName)), Match.when(\"local\", () => Effect.gen(function* () {\n const endpoint = yield* Clank.text({\n message: \"Emulator endpoint\",\n placeholder: DEFAULT_LOCAL_ENDPOINT,\n defaultValue: DEFAULT_LOCAL_ENDPOINT,\n });\n const region = yield* Clank.text({\n message: \"Region\",\n placeholder: \"us-east-1\",\n defaultValue: \"us-east-1\",\n });\n return {\n method: \"local\",\n endpoint: endpoint || DEFAULT_LOCAL_ENDPOINT,\n region: region || \"us-east-1\",\n };\n })), Match.exhaustive)));\n const configureCredentials = (profileName, ctx) => Effect.gen(function* () {\n if (ctx.ci) {\n return { method: \"env\" };\n }\n if (ctx.reason) {\n // e.g. the credential-demand seam (`Auth/Demand.ts`) explaining\n // which dev-plan resources require real AWS credentials.\n yield* Clank.info(ctx.reason);\n }\n return yield* configureInteractive(profileName);\n }).pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to configure credentials\",\n cause: e,\n })));\n const resolveCredentials = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, Effect.fn(function* () {\n const accessKeyId = yield* getEnvRedactedRequired(\"AWS_ACCESS_KEY_ID\");\n const secretAccessKey = yield* getEnvRedactedRequired(\"AWS_SECRET_ACCESS_KEY\");\n const sessionToken = yield* getEnvRedacted(\"AWS_SESSION_TOKEN\");\n const region = yield* getEnv(\"AWS_REGION\").pipe(Effect.flatMap((region) => region\n ? Effect.succeed(region)\n : getEnv(\"AWS_DEFAULT_REGION\")));\n if (!region) {\n return yield* Effect.fail(new AuthError({\n message: \"AWS region not found. Set AWS_REGION or AWS_DEFAULT_REGION.\",\n }));\n }\n // LocalStack-standard endpoint override: with\n // AWS_ENDPOINT_URL set, every AWS call (including the STS\n // account lookup below) targets the emulator.\n const endpoint = yield* getEnv(\"AWS_ENDPOINT_URL\");\n const accountId = yield* getEnvRequired(\"AWS_ACCOUNT_ID\").pipe(Effect.catch(() => getAccountId({\n accessKeyId,\n secretAccessKey,\n sessionToken,\n region,\n endpoint,\n })));\n return {\n accountId,\n credentials: Effect.succeed({\n accessKeyId,\n secretAccessKey,\n sessionToken,\n region,\n }),\n region,\n endpoint,\n source: { type: \"env\" },\n };\n })), Match.when({ method: \"local\" }, Effect.fn(function* (config) {\n const endpoint = config.endpoint ?? DEFAULT_LOCAL_ENDPOINT;\n const autoStart = config.autoStart ?? endpoint === DEFAULT_LOCAL_ENDPOINT;\n if (autoStart) {\n const port = yield* Effect.try({\n try: () => Number.parseInt(new URL(endpoint).port, 10) ||\n Floci.DEFAULT_FLOCI_PORT,\n catch: () => new AuthError({\n message: `invalid local emulator endpoint: ${endpoint}`,\n }),\n });\n // Reuses anything already serving on the endpoint (dev-mode\n // JVM, hand-run container, previous session's container);\n // otherwise starts the managed floci container and waits for\n // health.\n yield* Floci.ensureFloci({ port }).pipe(Effect.mapError((e) => new AuthError({ message: e.message, cause: e })));\n }\n else {\n const serving = yield* Floci.isServing(endpoint);\n if (!serving) {\n return yield* Effect.fail(new AuthError({\n message: `no local AWS emulator is listening at ${endpoint} — start one, or omit \\`endpoint\\` to auto-start floci on ${DEFAULT_LOCAL_ENDPOINT}`,\n }));\n }\n }\n const region = config.region ?? \"us-east-1\";\n return {\n // Fixed dummy account — emulators accept any non-empty\n // credentials, and calling STS here would be pure overhead.\n accountId: config.accountId ?? LOCAL_ACCOUNT_ID,\n credentials: Effect.succeed({\n accessKeyId: Redacted.make(\"test\"),\n secretAccessKey: Redacted.make(\"test\"),\n sessionToken: undefined,\n region,\n }),\n region,\n endpoint,\n source: { type: \"local\", details: endpoint },\n };\n })), Match.when({ method: \"stored\" }, () => store.read(profileName, \"aws\").pipe(Effect.flatMap((creds) => creds == null\n ? Effect.fail(new AuthError({\n message: \"AWS stored credentials not found. Run: alchemy login --configure\",\n }))\n : Effect.succeed({\n accountId: creds.accountId,\n credentials: Effect.succeed({\n accessKeyId: Redacted.make(creds.accessKeyId),\n secretAccessKey: Redacted.make(creds.secretAccessKey),\n sessionToken: creds.sessionToken\n ? Redacted.make(creds.sessionToken)\n : undefined,\n region: creds.region,\n }),\n region: creds.region,\n source: { type: \"stored\" },\n })), \n // an older verson of the stored credentials didn't include the account ID, so we patch it hre\n Effect.flatMap((creds) => creds.accountId\n ? Effect.succeed(creds)\n : creds.credentials.pipe(Effect.flatMap((resolved) => getAccountId({\n accessKeyId: resolved.accessKeyId,\n secretAccessKey: resolved.secretAccessKey,\n sessionToken: resolved.sessionToken,\n region: creds.region,\n })), Effect.map((accountId) => ({\n ...creds,\n accountId,\n })), \n // re-write the stored credentials\n Effect.tap((creds) => creds.credentials.pipe(Effect.tap(({ accessKeyId, secretAccessKey, sessionToken }) => store.write(profileName, \"aws\", {\n accessKeyId: Redacted.value(accessKeyId),\n secretAccessKey: Redacted.value(secretAccessKey),\n sessionToken: sessionToken\n ? Redacted.value(sessionToken)\n : undefined,\n region: creds.region,\n accountId: creds.accountId,\n })))))))), Match.when({ method: \"sso\" }, (config) => Effect.gen(function* () {\n const auth = yield* DistilledAuth.Default;\n const profile = yield* auth\n .loadProfile(config.ssoProfile)\n .pipe(Effect.catch(() => Effect.succeed(undefined)));\n return {\n accountId: profile?.sso_account_id,\n credentials: auth\n .loadProfileCredentials(config.ssoProfile)\n .pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to load credentials\",\n cause: e,\n })), Effect.orDie),\n region: profile?.region,\n source: { type: \"sso\", details: config.ssoProfile },\n };\n })), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })), Effect.flatMap(applyEnvRegionOverride));\n const prettyPrint = (profileName, config) => resolveCredentials(profileName, config).pipe(Effect.tap(Effect.fn(function* (creds) {\n const { accessKeyId, secretAccessKey, sessionToken } = yield* creds.credentials;\n yield* Console.log(` accessKeyId: ${displayRedacted(accessKeyId)}`);\n yield* Console.log(` secretAccessKey: ${displayRedacted(secretAccessKey)}`);\n if (sessionToken) {\n yield* Console.log(` sessionToken: ${displayRedacted(sessionToken)}`);\n }\n if (creds.region) {\n yield* Console.log(` region: ${creds.region}`);\n }\n yield* Console.log(\n //@ts-expect-error\n ` source: ${creds.source.details ? `${creds.source.type} - ${creds.source.details}` : creds.source.type}`);\n })));\n const logout = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"local\" }, () => Effect.void), Match.when({ method: \"sso\" }, (config) => Clank.info(`AWS: running 'aws sso logout --profile ${config.ssoProfile}'...`).pipe(Effect.zip(runSsoCommand(\"logout\", config.ssoProfile)), Effect.zip(clearDistilledSsoCache(config.ssoProfile)), Effect.match({\n onSuccess: () => Clank.success(\"AWS: SSO logout complete\"),\n onFailure: (e) => Clank.warn(`AWS: SSO logout failed: \\`${e.message}\\``),\n }))), Match.when({ method: \"stored\" }, () => store\n .delete(profileName, \"aws\")\n .pipe(Effect.andThen(Clank.success(\"AWS: stored credentials removed\")))), Match.exhaustive);\n const login = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"local\" }, () => Effect.void), Match.when({ method: \"sso\" }, loginSSO), Match.when({ method: \"stored\" }, () => store\n .read(profileName, \"aws\")\n .pipe(Effect.flatMap((creds) => creds == null ? loginStored(profileName) : Effect.void))), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })));\n return {\n configure: configureCredentials,\n login,\n logout,\n prettyPrint,\n read: resolveCredentials,\n };\n}));\nconst runSsoCommand = (command, ssoProfile) => Effect.gen(function* () {\n const handle = yield* ChildProcess.make(\"aws\", [\"sso\", command, \"--profile\", ssoProfile], {\n shell: false,\n stdin: \"inherit\",\n stdout: \"inherit\",\n stderr: \"inherit\",\n });\n const exit = yield* handle.exitCode;\n if (exit !== 0) {\n return yield* new AuthError({\n message: `aws sso ${command} exited with code ${exit}`,\n });\n }\n}).pipe(Effect.scoped);\nconst loginSSO = (config) => Clank.info(`AWS SSO: running 'aws sso login --profile ${config.ssoProfile}'...`).pipe(Effect.andThen(runSsoCommand(\"login\", config.ssoProfile)), Effect.matchEffect({\n onSuccess: () => Clank.success(\"AWS SSO: login complete\"),\n onFailure: (e) => Clank.warn(`AWS SSO: login faield: \\`${e.message}\\``),\n}));\n/**\n * `aws sso logout` only clears AWS CLI's own caches — it does not know about the\n * `<sha1(sso_session)>.credentials.json` file that `@distilled.cloud/aws`\n * writes alongside the SSO token. Without this cleanup, `loadProfileCredentials`\n * short-circuits on the stale distilled cache file after logout and appears to\n * stay logged in until the role creds hit their TTL.\n */\nconst clearDistilledSsoCache = (ssoProfile) => Effect.gen(function* () {\n const auth = yield* DistilledAuth.Default;\n const profile = yield* auth.loadProfile(ssoProfile);\n const ssoSession = profile.sso_session;\n if (!ssoSession)\n return;\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const hash = NodeCrypto.createHash(\"sha1\").update(ssoSession).digest(\"hex\");\n const cacheFile = path.join(NodeOs.homedir(), \".aws\", \"sso\", \"cache\", `${hash}.credentials.json`);\n yield* fs.remove(cacheFile).pipe(Effect.catch(() => Effect.void));\n}).pipe(Effect.catch(() => Effect.void));\n//# sourceMappingURL=AuthProvider.js.map","import { DEFAULT_API_BASE_URL } from \"@distilled.cloud/axiom/Credentials\";\nimport * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as Match from \"effect/Match\";\nimport * as Redacted from \"effect/Redacted\";\nimport { AuthError, AuthProviderLayer, } from \"../Auth/AuthProvider.js\";\nimport { CredentialsStore, displayRedacted } from \"../Auth/Credentials.js\";\nimport { getEnv, getEnvRedacted, retryOnce } from \"../Auth/Env.js\";\nimport * as Clank from \"../Util/Clank.js\";\nconst STORAGE_KEY = \"axiom-stored\";\nconst options = [\n {\n value: \"env\",\n label: \"Environment Variables\",\n hint: \"AXIOM_TOKEN (or AXIOM_API_KEY) + optional AXIOM_ORG_ID, AXIOM_URL\",\n },\n {\n value: \"stored\",\n label: \"API Token or Personal Access Token\",\n hint: \"enter credentials interactively, stored in ~/.alchemy/credentials\",\n },\n];\nexport const AXIOM_AUTH_PROVIDER_NAME = \"Axiom\";\nconst promptOrgId = (required) => getEnv(\"AXIOM_ORG_ID\").pipe(Effect.flatMap((envOrgId) => Clank.text({\n message: required\n ? \"Axiom Org ID (required for PAT)\"\n : \"Axiom Org ID (Enter to skip)\",\n placeholder: envOrgId ?? \"\",\n defaultValue: envOrgId ?? \"\",\n validate: required\n ? (v) => (v.length === 0 ? \"Required\" : undefined)\n : undefined,\n}).pipe(retryOnce)));\n/**\n * Layer that registers the Axiom {@link AuthProvider} into the\n * {@link AuthProviders} registry when built. Include this in the Axiom\n * `providers()` layer so `alchemy login` can discover it.\n */\nexport const AxiomAuth = AuthProviderLayer()(AXIOM_AUTH_PROVIDER_NAME, Effect.gen(function* () {\n const store = yield* CredentialsStore;\n const loginStored = Effect.fn(function* (profileName) {\n const credentialType = yield* Clank.select({\n message: \"Axiom credential type\",\n options: [\n {\n value: \"apiToken\",\n label: \"API Token\",\n hint: \"recommended — scoped to specific datasets/actions\",\n },\n {\n value: \"pat\",\n label: \"Personal Access Token\",\n hint: \"full account control, requires Org ID\",\n },\n ],\n }).pipe(retryOnce);\n const apiBaseUrlPrompt = yield* Clank.text({\n message: \"Axiom API Base URL (Enter for default)\",\n placeholder: DEFAULT_API_BASE_URL,\n defaultValue: DEFAULT_API_BASE_URL,\n }).pipe(retryOnce);\n const apiBaseUrl = apiBaseUrlPrompt && apiBaseUrlPrompt.length > 0\n ? apiBaseUrlPrompt\n : undefined;\n return yield* Match.value(credentialType).pipe(Match.when(\"apiToken\", () => Effect.gen(function* () {\n const apiToken = yield* Clank.password({\n message: \"Axiom API Token\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const orgId = yield* promptOrgId(false);\n yield* store.write(profileName, STORAGE_KEY, {\n type: \"apiToken\",\n apiToken,\n apiBaseUrl,\n orgId: orgId && orgId.length > 0 ? orgId : undefined,\n });\n yield* Clank.success(\"Axiom: credentials saved.\");\n return {\n method: \"stored\",\n credentialType: \"apiToken\",\n };\n })), Match.when(\"pat\", () => Effect.gen(function* () {\n const apiToken = yield* Clank.password({\n message: \"Axiom Personal Access Token\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const orgId = yield* promptOrgId(true);\n yield* store.write(profileName, STORAGE_KEY, { type: \"pat\", apiToken, apiBaseUrl, orgId });\n yield* Clank.success(\"Axiom: credentials saved.\");\n return {\n method: \"stored\",\n credentialType: \"pat\",\n };\n })), Match.exhaustive);\n });\n const configureInteractive = (profileName) => Clank.select({\n message: \"Axiom authentication method\",\n options,\n }).pipe(Effect.flatMap((method) => Match.value(method).pipe(Match.when(\"env\", () => Effect.succeed({ method: \"env\" })), Match.when(\"stored\", () => loginStored(profileName)), Match.exhaustive)));\n const configureCredentials = (profileName, ctx) => Effect.gen(function* () {\n if (ctx.ci) {\n return { method: \"env\" };\n }\n return yield* configureInteractive(profileName);\n }).pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to configure credentials\",\n cause: e,\n })));\n const resolveCredentials = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, Effect.fn(function* () {\n const apiToken = (yield* getEnvRedacted(\"AXIOM_TOKEN\")) ??\n (yield* getEnvRedacted(\"AXIOM_API_KEY\"));\n if (!apiToken) {\n return yield* new AuthError({\n message: \"Axiom env credentials not found. Set AXIOM_TOKEN (or AXIOM_API_KEY).\",\n });\n }\n const apiBaseUrl = (yield* getEnv(\"AXIOM_URL\")) ?? DEFAULT_API_BASE_URL;\n const orgId = yield* getEnv(\"AXIOM_ORG_ID\");\n if (orgId) {\n return {\n type: \"pat\",\n apiToken,\n apiBaseUrl,\n orgId,\n source: { type: \"env\" },\n };\n }\n return {\n type: \"apiToken\",\n apiToken,\n apiBaseUrl,\n source: { type: \"env\" },\n };\n })), Match.when({ method: \"stored\" }, () => store.read(profileName, STORAGE_KEY).pipe(Effect.flatMap((creds) => creds == null\n ? Effect.fail(new AuthError({\n message: \"Axiom stored credentials not found. Run: alchemy login --configure\",\n }))\n : Effect.succeed(Match.value(creds).pipe(Match.when({ type: \"apiToken\" }, (c) => ({\n type: \"apiToken\",\n apiToken: Redacted.make(c.apiToken),\n apiBaseUrl: c.apiBaseUrl ?? DEFAULT_API_BASE_URL,\n orgId: c.orgId,\n source: { type: \"stored\" },\n })), Match.when({ type: \"pat\" }, (c) => ({\n type: \"pat\",\n apiToken: Redacted.make(c.apiToken),\n apiBaseUrl: c.apiBaseUrl ?? DEFAULT_API_BASE_URL,\n orgId: c.orgId,\n source: { type: \"stored\" },\n })), Match.exhaustive))))), Match.exhaustive);\n const logout = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .delete(profileName, STORAGE_KEY)\n .pipe(Effect.andThen(Clank.success(\"Axiom: stored credentials removed\")))), Match.exhaustive);\n const login = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .read(profileName, STORAGE_KEY)\n .pipe(Effect.flatMap((creds) => creds == null ? loginStored(profileName) : Effect.void))), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })));\n const prettyPrint = (profileName, config) => resolveCredentials(profileName, config).pipe(Effect.tap((creds) => {\n const sourceStr = creds.source.details\n ? `${creds.source.type} - ${creds.source.details}`\n : creds.source.type;\n return Match.value(creds).pipe(Match.when({ type: \"apiToken\" }, (c) => Effect.all([\n Console.log(` apiToken: ${displayRedacted(c.apiToken, 9)}`),\n Console.log(` apiBaseUrl: ${c.apiBaseUrl}`),\n Console.log(` orgId: ${c.orgId ?? \"(none)\"}`),\n Console.log(` source: ${sourceStr}`),\n ])), Match.when({ type: \"pat\" }, (c) => Effect.all([\n Console.log(` apiToken: ${displayRedacted(c.apiToken, 9)}`),\n Console.log(` apiBaseUrl: ${c.apiBaseUrl}`),\n Console.log(` orgId: ${c.orgId}`),\n Console.log(` source: ${sourceStr}`),\n ])), Match.exhaustive);\n }));\n return {\n configure: configureCredentials,\n logout,\n login,\n prettyPrint,\n read: resolveCredentials,\n };\n}));\n//# sourceMappingURL=AuthProvider.js.map","/**\n * Filename (under `~/.alchemy/credentials/{profile}/`) used to cache the\n * Cloudflare-deployed HTTP state store's endpoint + bearer token.\n *\n * Kept in this leaf module (rather than `StateStore/State.ts`) so the\n * Cloudflare auth provider can invalidate the cache on\n * `login --configure` / `logout` without importing the heavy state-store\n * module and creating an import cycle\n * (`StateStore/State.ts` -> `Providers.ts` -> `Auth/AuthProvider.ts`).\n */\nexport const CREDENTIALS_FILE = \"cloudflare-state-store\";\n/**\n * `true` when cached state-store credentials must not be trusted for the\n * current account:\n *\n * - the file predates the `accountId` field (legacy cache — exactly the\n * artifact that caused deploys to silently target the wrong account), or\n * - it was minted against a different account than the one now in use.\n *\n * A stale cache is discarded and re-derived from the current account.\n */\nexport const isStateStoreCredentialsStale = (credentials, currentAccountId) => credentials.accountId == null || credentials.accountId !== currentAccountId;\n//# sourceMappingURL=CredentialsFile.js.map","import * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport crypto from \"node:crypto\";\nimport http from \"node:http\";\nimport { AUTH_ERROR_URL, AUTH_SUCCESS_URL } from \"../../Auth/AuthProvider.js\";\nimport { OAUTH_CLIENT_ID, OAUTH_ENDPOINTS, OAUTH_LOCAL_CALLBACK_URI, OAUTH_REDIRECT_URI, } from \"./AuthProvider.js\";\nexport class OAuthError extends Data.TaggedError(\"OAuthError\") {\n}\nfunction generateState(length = 32) {\n return Buffer.from(crypto.randomBytes(length)).toString(\"base64url\");\n}\nfunction generatePKCE(length = 96) {\n const verifier = Buffer.from(crypto.randomBytes(length)).toString(\"base64url\");\n const challenge = crypto\n .createHash(\"sha256\")\n .update(verifier)\n .digest(\"base64url\");\n return { verifier, challenge };\n}\nfunction extractCredentials(json) {\n return {\n type: \"oauth\",\n access: json.access_token,\n refresh: json.refresh_token,\n expires: Date.now() + json.expires_in * 1000,\n scopes: json.scope.split(\" \"),\n };\n}\nconst tokenRequest = (body) => Effect.gen(function* () {\n const res = yield* Effect.tryPromise({\n try: () => fetch(OAUTH_ENDPOINTS.token, {\n method: \"POST\",\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n body: new URLSearchParams(body).toString(),\n }),\n catch: (err) => new OAuthError({\n error: \"network_error\",\n errorDescription: `Token request failed: ${err}`,\n }),\n });\n if (!res.ok) {\n const json = yield* Effect.tryPromise({\n try: () => res.json(),\n catch: () => new OAuthError({\n error: \"parse_error\",\n errorDescription: `Token endpoint returned ${res.status}`,\n }),\n });\n return yield* new OAuthError({\n error: json.error,\n errorDescription: json.error_description,\n });\n }\n const json = yield* Effect.tryPromise({\n try: () => res.json(),\n catch: () => new OAuthError({\n error: \"parse_error\",\n errorDescription: \"Failed to parse token response\",\n }),\n });\n return extractCredentials(json);\n});\n/**\n * Generate an authorization URL with PKCE for the given scopes.\n */\nexport function authorize(scopes) {\n const state = generateState();\n const pkce = generatePKCE();\n const url = new URL(OAUTH_ENDPOINTS.authorize);\n url.searchParams.set(\"client_id\", OAUTH_CLIENT_ID);\n url.searchParams.set(\"redirect_uri\", OAUTH_REDIRECT_URI);\n url.searchParams.set(\"response_type\", \"code\");\n url.searchParams.set(\"scope\", scopes.join(\" \"));\n url.searchParams.set(\"state\", state);\n url.searchParams.set(\"code_challenge\", pkce.challenge);\n url.searchParams.set(\"code_challenge_method\", \"S256\");\n return { url: url.toString(), state, verifier: pkce.verifier };\n}\n/**\n * Exchange an authorization code for OAuth credentials.\n */\nexport const exchange = (code, verifier) => tokenRequest({\n grant_type: \"authorization_code\",\n code,\n code_verifier: verifier,\n client_id: OAUTH_CLIENT_ID,\n redirect_uri: OAUTH_REDIRECT_URI,\n});\n/**\n * Refresh expired OAuth credentials.\n */\nexport const refresh = (credentials) => tokenRequest({\n grant_type: \"refresh_token\",\n refresh_token: credentials.refresh,\n client_id: OAUTH_CLIENT_ID,\n redirect_uri: OAUTH_REDIRECT_URI,\n});\n/**\n * Revoke OAuth credentials.\n */\nexport const revoke = (credentials) => Effect.gen(function* () {\n yield* Effect.tryPromise({\n try: () => fetch(OAUTH_ENDPOINTS.revoke, {\n method: \"POST\",\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n body: new URLSearchParams({\n refresh_token: credentials.refresh,\n client_id: OAUTH_CLIENT_ID,\n redirect_uri: OAUTH_REDIRECT_URI,\n }).toString(),\n }),\n catch: (err) => new OAuthError({\n error: \"network_error\",\n errorDescription: `Revoke request failed: ${err}`,\n }),\n });\n});\n/**\n * Exchange a code copied from the hosted relay page, or extract the code from\n * either the hosted or loopback callback URL.\n */\nexport const exchangeCallbackInput = (input, authorization) => Effect.gen(function* () {\n const value = input.trim();\n let code = value;\n let state = null;\n try {\n const url = new URL(value);\n code = url.searchParams.get(\"code\") ?? \"\";\n state = url.searchParams.get(\"state\");\n }\n catch {\n const separator = value.lastIndexOf(\"#\");\n if (separator >= 0) {\n code = value.slice(0, separator);\n state = value.slice(separator + 1);\n }\n }\n if (!code) {\n return yield* new OAuthError({\n error: \"invalid_request\",\n errorDescription: \"The authorization code is missing.\",\n });\n }\n if (state !== null && state !== authorization.state) {\n return yield* new OAuthError({\n error: \"invalid_request\",\n errorDescription: \"The authorization state does not match.\",\n });\n }\n return yield* exchange(code, authorization.verifier);\n});\n/**\n * Start a local HTTP server to listen for the OAuth callback, exchange\n * the authorization code, and return the credentials.\n *\n * Times out after 5 minutes.\n */\nexport const callback = (authorization) => Effect.tryPromise({\n try: (signal) => callbackPromise(authorization, signal),\n catch: (err) => {\n if (err instanceof OAuthError)\n return err;\n return new OAuthError({\n error: \"callback_error\",\n errorDescription: `OAuth callback failed: ${err}`,\n });\n },\n});\nfunction callbackPromise(authorization, signal) {\n const { pathname, port } = new URL(OAUTH_LOCAL_CALLBACK_URI);\n return new Promise((resolve, reject) => {\n const server = http.createServer(async (req, res) => {\n const url = new URL(req.url ?? \"/\", `http://${req.headers.host}`);\n if (url.pathname === \"/auth/ping\") {\n res.writeHead(req.method === \"OPTIONS\" ? 204 : 200, {\n \"Access-Control-Allow-Origin\": new URL(OAUTH_REDIRECT_URI).origin,\n \"Access-Control-Allow-Methods\": \"GET, OPTIONS\",\n \"Access-Control-Allow-Private-Network\": \"true\",\n \"Cache-Control\": \"no-store\",\n });\n res.end();\n return;\n }\n if (url.pathname !== pathname) {\n res.statusCode = 404;\n res.end(\"Not Found\");\n return;\n }\n const error = url.searchParams.get(\"error\");\n const errorDescription = url.searchParams.get(\"error_description\");\n if (error) {\n res.writeHead(302, { Location: AUTH_ERROR_URL });\n res.end();\n cleanup();\n reject(new OAuthError({\n error,\n errorDescription: errorDescription ?? \"An unknown error occurred.\",\n }));\n return;\n }\n const code = url.searchParams.get(\"code\");\n const state = url.searchParams.get(\"state\");\n if (!code || !state) {\n res.writeHead(302, { Location: AUTH_ERROR_URL });\n res.end();\n cleanup();\n reject(new OAuthError({\n error: \"invalid_request\",\n errorDescription: \"Missing code or state\",\n }));\n return;\n }\n if (state !== authorization.state) {\n res.writeHead(302, { Location: AUTH_ERROR_URL });\n res.end();\n cleanup();\n reject(new OAuthError({\n error: \"invalid_request\",\n errorDescription: \"Invalid state\",\n }));\n return;\n }\n try {\n const credentials = await Effect.runPromise(exchange(code, authorization.verifier));\n res.writeHead(302, { Location: AUTH_SUCCESS_URL });\n res.end();\n cleanup();\n resolve(credentials);\n }\n catch (err) {\n res.writeHead(302, { Location: AUTH_ERROR_URL });\n res.end();\n cleanup();\n reject(err);\n }\n });\n const timeout = setTimeout(() => {\n cleanup();\n reject(new OAuthError({\n error: \"timeout\",\n errorDescription: \"The authorization process timed out.\",\n }));\n }, 5 * 60 * 1000);\n function cleanup() {\n clearTimeout(timeout);\n signal.removeEventListener(\"abort\", cleanup);\n server.close();\n }\n signal.addEventListener(\"abort\", cleanup, { once: true });\n server.on(\"error\", (err) => {\n cleanup();\n reject(new OAuthError({\n error: \"server_error\",\n errorDescription: `Failed to start callback server: ${err.message}`,\n }));\n });\n server.listen(Number(port));\n });\n}\n//# sourceMappingURL=OAuthClient.js.map","import * as cfAccounts from \"@distilled.cloud/cloudflare/accounts\";\nimport * as CfCredentialsModule from \"@distilled.cloud/cloudflare/Credentials\";\nimport * as Console from \"effect/Console\";\nimport * as Duration from \"effect/Duration\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Match from \"effect/Match\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as FetchHttpClient from \"effect/unstable/http/FetchHttpClient\";\nimport * as HttpClient from \"effect/unstable/http/HttpClient\";\nimport { AuthError, AuthProviderLayer, } from \"../../Auth/AuthProvider.js\";\nimport { CredentialsStore, displayRedacted } from \"../../Auth/Credentials.js\";\nimport { getEnv, getEnvRedacted, getEnvRequired, retryOnce, } from \"../../Auth/Env.js\";\nimport * as Clank from \"../../Util/Clank.js\";\nimport { CREDENTIALS_FILE as STATE_STORE_CREDENTIALS_FILE } from \"../StateStore/CredentialsFile.js\";\nimport * as OAuthClient from \"./OAuthClient.js\";\nconst options = [\n {\n value: \"oauth\",\n label: \"OAuth\",\n hint: \"recommended — browser-based login with automatic token refresh\",\n },\n {\n value: \"env\",\n label: \"Environment Variables\",\n hint: \"CLOUDFLARE_API_TOKEN or CLOUDFLARE_API_KEY + CLOUDFLARE_EMAIL\",\n },\n {\n value: \"stored\",\n label: \"API Token or API Key\",\n hint: \"enter credentials interactively, stored in ~/.alchemy/credentials\",\n },\n];\nexport const CLOUDFLARE_AUTH_PROVIDER_NAME = \"Cloudflare\";\nconst withOAuthCredentials = (accessToken, effect) => Effect.provide(effect, Layer.mergeAll(CfCredentialsModule.fromOAuth({\n load: Effect.succeed({ accessToken }),\n refresh: () => Effect.die(\"refresh not expected during account selection\"),\n}), FetchHttpClient.layer));\nconst selectAccount = (accessToken) => Effect.gen(function* () {\n const list = yield* cfAccounts.listAccounts;\n const response = yield* list({});\n const accounts = response.result;\n if (accounts.length === 0) {\n return yield* new AuthError({\n message: \"Cloudflare: no accounts found for this credential.\",\n });\n }\n if (accounts.length === 1) {\n const account = accounts[0];\n yield* Clank.info(`Cloudflare: using account: ${account.name} (${account.id})`);\n return account.id;\n }\n return yield* Clank.select({\n message: \"Select a Cloudflare account\",\n options: accounts.map((a) => ({\n value: a.id,\n label: a.name,\n hint: a.id,\n })),\n }).pipe(retryOnce);\n}).pipe((e) => withOAuthCredentials(accessToken, e));\n/**\n * Cloudflare account IDs are 32 lowercase hex characters. Placeholder\n * values (\"\", \"-\", \"dummy\", …) end up interpolated into API paths and\n * surface as baffling `InvalidRoute: Could not route to\n * /accounts/<value>/...` errors, so reject them up front with an\n * actionable message instead.\n */\nconst ACCOUNT_ID_PATTERN = /^[0-9a-f]{32}$/i;\nexport const validateAccountId = (accountId, source) => {\n const trimmed = accountId?.trim() ?? \"\";\n if (trimmed.length === 0) {\n return Effect.fail(new AuthError({\n message: `Cloudflare account ID is missing (${source}). ` +\n \"Set CLOUDFLARE_ACCOUNT_ID or re-run 'alchemy login' and provide your account ID \" +\n \"(found in the Cloudflare dashboard under Workers & Pages → Account details).\",\n }));\n }\n if (!ACCOUNT_ID_PATTERN.test(trimmed)) {\n return Effect.fail(new AuthError({\n message: `'${trimmed}' is not a valid Cloudflare account ID (${source}) — expected 32 hex characters. ` +\n \"Copy the account ID from the Cloudflare dashboard (Workers & Pages → Account details) \" +\n \"into CLOUDFLARE_ACCOUNT_ID or re-run 'alchemy login'.\",\n }));\n }\n return Effect.succeed(trimmed.toLowerCase());\n};\nconst promptAccountId = () => getEnv(\"CLOUDFLARE_ACCOUNT_ID\").pipe(Effect.flatMap((envAccountId) => Clank.text({\n message: \"Cloudflare Account ID (Enter to skip)\",\n placeholder: envAccountId ?? \"\",\n defaultValue: envAccountId ?? \"\",\n validate: (v) => v.trim().length === 0 || ACCOUNT_ID_PATTERN.test(v.trim())\n ? undefined\n : \"Expected a 32-character hex account ID (Workers & Pages → Account details)\",\n}).pipe(retryOnce)));\nconst promptOAuthScopes = () => Clank.confirm({\n message: \"Customize OAuth scopes? (default covers typical use cases)\",\n initialValue: false,\n}).pipe(retryOnce, Effect.flatMap((customize) => {\n if (!customize)\n return Effect.succeed([...DEFAULT_SCOPES]);\n return Clank.multiselect({\n message: \"Select OAuth scopes\",\n initialValues: DEFAULT_SCOPES,\n options: Object.entries(ALL_SCOPES).map(([value, hint]) => ({\n value: value,\n label: value,\n hint,\n })),\n required: true,\n }).pipe(Effect.map((s) => s), retryOnce);\n}));\n/**\n * Layer that registers the Cloudflare {@link AuthProvider} into the\n * {@link AuthProviders} registry when built. Include this in the Cloudflare\n * `providers()` layer so `alchemy login` can discover it.\n */\nexport const CloudflareAuth = AuthProviderLayer()(CLOUDFLARE_AUTH_PROVIDER_NAME, Effect.gen(function* () {\n const store = yield* CredentialsStore;\n const oauthLogin = (profileName, scopes) => Effect.gen(function* () {\n const authorization = OAuthClient.authorize([\n ...scopes,\n \"offline_access\",\n ]);\n yield* Clank.info(\"Cloudflare: opening browser for OAuth login...\");\n yield* Clank.info(authorization.url);\n yield* Clank.openUrl(authorization.url).pipe(Effect.catch(() => Clank.warn(\"Cloudflare: could not open browser automatically. Please open the URL above manually.\")));\n yield* Clank.info(\"Cloudflare: waiting for authorization (up to 5 minutes).\");\n const credentials = yield* Effect.raceFirst(OAuthClient.callback(authorization), Clank.text({\n message: \"Paste the authorization code or callback URL\",\n placeholder: \"The browser will complete this automatically when local\",\n validate: (value) => value.trim().length > 0 ? undefined : \"Paste a code or URL\",\n }).pipe(Effect.flatMap((input) => OAuthClient.exchangeCallbackInput(input, authorization))));\n yield* store.write(profileName, \"cf-oauth\", credentials);\n yield* Clank.success(\"Cloudflare: OAuth credentials saved.\");\n return credentials;\n });\n const loginStored = Effect.fn(function* (profileName) {\n const credentialType = yield* Clank.select({\n message: \"Cloudflare credential type\",\n options: [\n {\n value: \"apiToken\",\n label: \"API Token\",\n hint: \"recommended\",\n },\n { value: \"apiKey\", label: \"API Key + Email\" },\n ],\n }).pipe(retryOnce);\n return yield* Match.value(credentialType).pipe(Match.when(\"apiToken\", () => Effect.gen(function* () {\n const apiToken = yield* Clank.password({\n message: \"Cloudflare API Token\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const accountId = yield* promptAccountId();\n yield* store.write(profileName, \"cf-stored\", { type: \"apiToken\", apiToken, accountId });\n yield* Clank.success(\"Cloudflare: credentials saved.\");\n return {\n method: \"stored\",\n credentialType: \"apiToken\",\n };\n })), Match.when(\"apiKey\", () => Effect.gen(function* () {\n const apiKey = yield* Clank.text({\n message: \"Cloudflare API Key\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const email = yield* Clank.text({\n message: \"Cloudflare Email\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const accountId = yield* promptAccountId();\n yield* store.write(profileName, \"cf-stored\", { type: \"apiKey\", apiKey, email, accountId });\n yield* Clank.success(\"Cloudflare: credentials saved.\");\n return {\n method: \"stored\",\n credentialType: \"apiKey\",\n };\n })), Match.exhaustive);\n });\n const configureOAuth = Effect.fn(function* (profileName) {\n const scopes = yield* promptOAuthScopes();\n const oauthCreds = yield* oauthLogin(profileName, scopes);\n const accountId = yield* selectAccount(oauthCreds.access).pipe(Effect.mapError((e) => new AuthError({\n message: \"Cloudflare: could not list accounts\",\n cause: e,\n })));\n return {\n method: \"oauth\",\n scopes,\n accountId,\n };\n });\n const configureInteractive = (profileName) => Clank.select({\n message: \"Cloudflare authentication method\",\n options,\n }).pipe(Effect.flatMap((method) => Match.value(method).pipe(Match.when(\"env\", () => Effect.succeed({ method: \"env\" })), Match.when(\"oauth\", () => configureOAuth(profileName)), Match.when(\"stored\", () => loginStored(profileName)), Match.exhaustive)));\n const configureCredentials = (profileName, ctx) => Effect.gen(function* () {\n const config = ctx.ci\n ? { method: \"env\" }\n : yield* configureInteractive(profileName);\n // Re-configuring auth may point this profile at a different\n // Cloudflare account. The cached state-store credentials\n // (`~/.alchemy/credentials/{profile}/cloudflare-state-store.json`)\n // are minted per-account, so drop them here; the next deploy\n // re-derives them against the freshly-configured account.\n yield* store\n .delete(profileName, STATE_STORE_CREDENTIALS_FILE)\n .pipe(Effect.ignore);\n return config;\n }).pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to configure credentials\",\n cause: e,\n })));\n const resolveCredentials = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, Effect.fn(function* () {\n const accountId = yield* getEnvRequired(\"CLOUDFLARE_ACCOUNT_ID\").pipe(Effect.flatMap((id) => validateAccountId(id, \"from the CLOUDFLARE_ACCOUNT_ID env var\")));\n const apiToken = yield* getEnvRedacted(\"CLOUDFLARE_API_TOKEN\");\n if (apiToken) {\n return {\n type: \"apiToken\",\n apiToken,\n accountId,\n source: { type: \"env\" },\n };\n }\n const apiKey = yield* getEnvRedacted(\"CLOUDFLARE_API_KEY\");\n const email = yield* getEnvRedacted(\"CLOUDFLARE_EMAIL\");\n if (apiKey && email) {\n return {\n type: \"apiKey\",\n apiKey,\n email,\n accountId,\n source: { type: \"env\" },\n };\n }\n return yield* new AuthError({\n message: \"Cloudflare env credentials not found. Set CLOUDFLARE_API_TOKEN or CLOUDFLARE_API_KEY + CLOUDFLARE_EMAIL.\",\n });\n })), Match.when({ method: \"stored\" }, () => store\n .read(profileName, \"cf-stored\")\n .pipe(Effect.flatMap((creds) => creds == null\n ? Effect.fail(new AuthError({\n message: \"Cloudflare stored credentials not found. Run: alchemy login --configure\",\n }))\n : Effect.gen(function* () {\n // The account ID prompt is skippable, so stored\n // credentials may carry an empty accountId; fall\n // back to the env var before validating.\n const envAccountId = yield* getEnv(\"CLOUDFLARE_ACCOUNT_ID\");\n const accountId = yield* validateAccountId(creds.accountId?.trim() || envAccountId, `stored for profile '${profileName}'`);\n return Match.value(creds).pipe(Match.when({ type: \"apiToken\" }, (c) => ({\n type: \"apiToken\",\n apiToken: Redacted.make(c.apiToken),\n accountId,\n source: { type: \"stored\" },\n })), Match.when({ type: \"apiKey\" }, (c) => ({\n type: \"apiKey\",\n apiKey: Redacted.make(c.apiKey),\n email: Redacted.make(c.email),\n accountId,\n source: { type: \"stored\" },\n })), Match.exhaustive);\n })))), Match.when({ method: \"oauth\" }, (cfg) => Effect.gen(function* () {\n const accountId = yield* validateAccountId(cfg.accountId, `configured for profile '${profileName}'`);\n const creds = yield* store.read(profileName, \"cf-oauth\");\n if (creds == null || creds.type !== \"oauth\") {\n return yield* Effect.fail(new AuthError({\n message: \"Cloudflare OAuth credentials not found. Run: alchemy login\",\n }));\n }\n // Refresh proactively if the token has expired (or is within\n // 10s of expiring). Persist the refreshed creds so subsequent\n // resolves don't repeat the round-trip.\n const fresh = creds.expires > Date.now() + 10_000\n ? creds\n : yield* OAuthClient.refresh(creds).pipe(Effect.tap((refreshed) => store.write(profileName, \"cf-oauth\", refreshed)), Effect.mapError((e) => new AuthError({\n message: \"Cloudflare OAuth refresh failed. Run: alchemy login\",\n cause: e,\n })));\n return {\n type: \"oauth\",\n accessToken: Redacted.make(fresh.access),\n expires: fresh.expires,\n accountId,\n source: { type: \"oauth\" },\n };\n })), Match.exhaustive);\n const logout = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .delete(profileName, \"cf-stored\")\n .pipe(Effect.andThen(Clank.success(\"Cloudflare: stored credentials removed\")))), Match.when({ method: \"oauth\" }, () => store\n .read(profileName, \"cf-oauth\")\n .pipe(Effect.tap((creds) => creds?.type === \"oauth\"\n ? OAuthClient.revoke(creds).pipe(Effect.catchTag(\"OAuthError\", (err) => Clank.warn(`Cloudflare: could not revoke OAuth token: ${err.errorDescription}`)))\n : Effect.void), Effect.andThen(store.delete(profileName, \"cf-oauth\")), Effect.andThen(Clank.success(\"Cloudflare: OAuth credentials removed.\")))), Match.exhaustive)\n // The cached state-store credentials are derived from the account we\n // just logged out of, so drop them regardless of auth method.\n .pipe(Effect.andThen(store\n .delete(profileName, STATE_STORE_CREDENTIALS_FILE)\n .pipe(Effect.ignore)));\n const login = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .read(profileName, \"cf-stored\")\n .pipe(Effect.flatMap((creds) => creds == null ? loginStored(profileName) : Effect.void))), Match.when({ method: \"oauth\" }, (c) => Effect.gen(function* () {\n const creds = yield* store.read(profileName, \"cf-oauth\");\n if (creds?.type === \"oauth\") {\n yield* Clank.info(\"Cloudflare: refreshing OAuth credentials...\");\n yield* OAuthClient.refresh(creds).pipe(Effect.flatMap((refreshed) => store\n .write(profileName, \"cf-oauth\", refreshed)\n .pipe(Effect.andThen(Clank.success(\"Cloudflare: OAuth credentials refreshed.\")))), Effect.catchTag(\"OAuthError\", () => oauthLogin(profileName, c.scopes).pipe(Effect.asVoid)));\n return;\n }\n yield* oauthLogin(profileName, c.scopes);\n })), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })));\n const prettyPrint = (profileName, config) => resolveCredentials(profileName, config).pipe(Effect.tap((creds) => {\n const sourceStr = creds.source.details\n ? `${creds.source.type} - ${creds.source.details}`\n : creds.source.type;\n return Match.value(creds).pipe(Match.when({ type: \"apiToken\" }, (c) => Effect.all([\n Console.log(` apiToken: ${displayRedacted(c.apiToken, 9)}`),\n Console.log(` accountId: ${c.accountId}`),\n Console.log(` source: ${sourceStr}`),\n ])), Match.when({ type: \"apiKey\" }, (c) => Effect.all([\n Console.log(` apiKey: ${displayRedacted(c.apiKey)}`),\n Console.log(` email: ${displayRedacted(c.email)}`),\n Console.log(` accountId: ${c.accountId}`),\n Console.log(` source: ${sourceStr}`),\n ])), Match.when({ type: \"oauth\" }, (c) => {\n const remainingMs = c.expires - Date.now();\n const expiresAt = new Date(c.expires).toISOString();\n const expiresStr = remainingMs <= 0\n ? `expired (${expiresAt})`\n : `in ${Duration.format(Duration.millis(remainingMs))} (${expiresAt})`;\n return Effect.all([\n Console.log(` accessToken: ${displayRedacted(c.accessToken)}`),\n Console.log(` expires: ${expiresStr}`),\n Console.log(` accountId: ${c.accountId}`),\n Console.log(` source: ${sourceStr}`),\n ]);\n }), Match.exhaustive);\n }));\n return {\n configure: configureCredentials,\n logout,\n login,\n prettyPrint,\n read: resolveCredentials,\n };\n}));\nexport const ALL_SCOPES = {\n \"access:read\": \"See Cloudflare Access data such as zones, applications, certificates, device postures, groups, identity providers, login counts, organizations, policies, service tokens, and users\",\n \"access:write\": \"See and change Cloudflare Access data such as zones, applications, certificates, device postures, groups, identity providers, login counts, organizations, policies, service tokens, and users\",\n \"account:read\": \"See your account info such as account details, analytics, and memberships\",\n \"agw:read\": \"Grants read level access to Agents Gateway\",\n \"agw:run\": \"Grants run level access to Agents Gateway\",\n \"agw:write\": \"Grants read and write level access to Agents Gateway\",\n \"ai:read\": \"Grants read level access to Workers AI\",\n \"ai:write\": \"Grants write level access to Workers AI\",\n \"aiaudit:read\": \"Grants read level access to AI Audit\",\n \"aiaudit:write\": \"Grants write level access to AI Audit\",\n \"aig:read\": \"Grants read level access to AI Gateway\",\n \"aig:write\": \"Grants write level access to AI Gateway\",\n \"auditlogs:read\": \"View Cloudflare Account Audit Logs\",\n \"browser:read\": \"Grants read level access to Browser Rendering\",\n \"browser:write\": \"Grants write level access to Browser Rendering\",\n \"cfone:read\": \"Grants read level access to Cloudforce One data\",\n \"cfone:write\": \"Grants write level access to Cloudforce One data\",\n \"cloudchamber:write\": \"See and make changes to Cloudchamber\",\n \"connectivity:admin\": \"See, change, and bind to Connectivity Directory services, including creating services targeting Cloudflare Tunnel\",\n \"connectivity:bind\": \"read, list, and bind to Connectivity Directory services, as well as read and list Cloudflare Tunnels\",\n \"connectivity:read\": \"See Connectivity Directory services and Cloudflare Tunnels\",\n \"constellation:write\": \"Grants write access to Constellation configuration and models\",\n \"containers:write\": \"See and make changes to Workers Containers\",\n \"d1:write\": \"See and make changes to D1\",\n \"dex:read\": \"Grants read level access to Cloudflare DEX\",\n \"dex:write\": \"Grants write level access to Cloudflare DEX\",\n \"dns_analytics:read\": \"Grants read level access to Cloudflare DNS Analytics\",\n \"dns_records:edit\": \"Grants edit level access to dns records\",\n \"dns_records:read\": \"Grants read level access to dns records\",\n \"dns_settings:read\": \"Grants read level access to Cloudflare DNS Settings\",\n \"firstpartytags:write\": \"Can see, edit and publish Google tag gateway configuration.\",\n \"lb:edit\": \"Grants edit level access to lb and lb pools\",\n \"lb:read\": \"Grants read level access to lb and lb pools\",\n \"logpush:read\": \"See Cloudflare Logpush data\",\n \"logpush:write\": \"See and change Cloudflare Logpush data\",\n \"notification:read\": \"View Cloudflare Notifications\",\n \"notification:write\": \"View and Modify Cloudflare Notifications\",\n \"pages:read\": \"See Cloudflare Pages projects, settings and deployments\",\n \"pages:write\": \"See and change Cloudflare Pages projects, settings and deployments\",\n \"pipelines:read\": \"Grants read level access to Cloudflare Pipelines\",\n \"pipelines:setup\": \"Grants permission to generate R2 tokens for Workers Pipelines\",\n \"pipelines:write\": \"Grants write level access to Cloudflare Pipelines\",\n \"query_cache:write\": \"See and make changes to Hyperdrive\",\n \"queues:write\": \"See and change Cloudflare Queues settings and data\",\n \"r2_catalog:write\": \"Grants write level access to R2 Data Catalog\",\n \"radar:read\": \"Grants access to read Cloudflare Radar data\",\n \"ai-search:read\": \"Grants read level access to AI Search\",\n \"ai-search:write\": \"Grants write level access to AI Search\",\n \"ai-search:run\": \"Grants run level access to AI Search\",\n \"secrets_store:read\": \"Grants read level access to Secrets Store\",\n \"secrets_store:write\": \"Grants write level access to Secrets Store\",\n \"ssl_certs:write\": \"Grants read and write access to SSL MTLS certificates or Certificate Store\",\n \"sso-connector:read\": \"See Cloudflare SSO connectors\",\n \"sso-connector:write\": \"See Cloudflare SSO connectors to toggle activation and deactivation of SSO\",\n \"teams:pii\": \"See personally identifiable Cloudflare Teams data\",\n \"teams:read\": \"See Cloudflare Teams data such as zones, gateway, and argo tunnel details\",\n \"teams:secure_location\": \"See all DNS Location data but can only change secure DNS Locations\",\n \"teams:write\": \"See and change Cloudflare Teams data such as zones, gateway, and argo tunnel details\",\n \"url_scanner:read\": \"Grants read level access to URL Scanner\",\n \"url_scanner:write\": \"Grants write level access to URL Scanner\",\n \"user:read\": \"See your user info such as name, email address, and account memberships\",\n \"vectorize:write\": \"See and make changes to Vectorize\",\n \"workers:read\": \"See Cloudflare Workers data such as zones, KV storage, R2 storage, scripts, and routes\",\n \"workers:write\": \"See and change Cloudflare Workers data such as zones, KV storage, R2 storage, scripts, and routes\",\n \"workers_builds:read\": \"See Cloudflare Workers Builds data such as builds, build configuration, and build logs\",\n \"workers_builds:write\": \"See and change Cloudflare Workers Builds data such as builds, build configuration, and build logs\",\n \"workers_kv:write\": \"See and change Cloudflare Workers KV Storage data such as keys and namespaces\",\n \"workers_observability:read\": \"Grants read access to Cloudflare Workers Observability\",\n \"workers_observability:write\": \"Grants read and write access to Cloudflare Workers Observability\",\n \"workers_observability_telemetry:write\": \"Grants write access to Cloudflare Workers Observability Telemetry API\",\n \"workers_routes:write\": \"See and change Cloudflare Workers data such as filters and routes\",\n \"workers_scripts:write\": \"See and change Cloudflare Workers scripts, durable objects, subdomains, triggers, and tail data\",\n \"workers_tail:read\": \"See Cloudflare Workers tail and script data\",\n \"zone:read\": \"Grants read level access to account zone\",\n};\nexport const DEFAULT_SCOPES = [\n \"account:read\",\n \"ai-search:write\",\n \"ai-search:run\",\n \"ai:write\",\n \"aig:read\",\n \"aig:write\",\n \"cloudchamber:write\",\n \"connectivity:admin\",\n \"containers:write\",\n \"d1:write\",\n \"pages:write\",\n \"pipelines:write\",\n \"queues:write\",\n \"secrets_store:write\",\n \"ssl_certs:write\",\n \"user:read\",\n \"vectorize:write\",\n \"workers_kv:write\",\n \"workers_observability:read\",\n \"workers_observability:write\",\n \"workers_observability_telemetry:write\",\n \"workers_routes:write\",\n \"workers_scripts:write\",\n \"workers_tail:read\",\n \"workers:write\",\n \"zone:read\",\n];\nexport const OAUTH_CLIENT_ID = \"6d8c2255-0773-45f6-b376-2914632e6f91\";\nexport const OAUTH_REDIRECT_URI = \"https://alchemy.run/auth/callback\";\nexport const OAUTH_LOCAL_CALLBACK_URI = \"http://localhost:9976/auth/callback\";\nexport const OAUTH_ENDPOINTS = {\n authorize: \"https://dash.cloudflare.com/oauth2/authorize\",\n token: \"https://dash.cloudflare.com/oauth2/token\",\n revoke: \"https://dash.cloudflare.com/oauth2/revoke\",\n};\n//# sourceMappingURL=AuthProvider.js.map","import * as Effect from \"effect/Effect\";\nimport { AuthError } from \"../Auth/AuthProvider.js\";\nimport { getEnv } from \"../Auth/Env.js\";\n/**\n * Normalize a user-supplied GitHub host or URL into the REST API base URL\n * Octokit expects, following the same conventions as the `gh` CLI and the\n * Terraform GitHub provider:\n *\n * - `github.com` / `api.github.com` → `undefined` (Octokit's default)\n * - GitHub Enterprise Cloud with data residency (`acme.ghe.com` or\n * `api.acme.ghe.com`) → `https://api.acme.ghe.com`\n * - GitHub Enterprise Server (`github.example.com`) → `https://github.example.com/api/v3`;\n * an explicit path (e.g. an already-complete `/api/v3` URL) is honored as-is.\n *\n * Accepts a bare hostname or a full URL.\n */\nexport const normalizeGitHubBaseUrl = (input) => Effect.try({\n try: () => {\n const trimmed = input.trim();\n const url = new URL(trimmed.includes(\"://\") ? trimmed : `https://${trimmed}`);\n const host = url.hostname.toLowerCase();\n if (host === \"github.com\" ||\n host === \"www.github.com\" ||\n host === \"api.github.com\") {\n return undefined;\n }\n if (host.endsWith(\".ghe.com\")) {\n return `https://${host.startsWith(\"api.\") ? host : `api.${host}`}`;\n }\n const path = url.pathname.replace(/\\/+$/, \"\");\n return `${url.protocol}//${url.host}${path === \"\" ? \"/api/v3\" : path}`;\n },\n catch: () => new AuthError({\n message: `Invalid GitHub base URL: '${input}'. Provide a hostname (github.example.com) or URL (https://github.example.com/api/v3).`,\n }),\n});\n/**\n * The hostname `gh auth token --hostname` expects for a normalized API base\n * URL — the plain host for GitHub Enterprise Server, and the `api.`-less\n * host for GitHub Enterprise Cloud with data residency.\n */\nexport const githubHostname = (baseUrl) => {\n const host = new URL(baseUrl).hostname;\n return host.startsWith(\"api.\") && host.endsWith(\".ghe.com\")\n ? host.slice(\"api.\".length)\n : host;\n};\n/**\n * Resolve the GitHub API base URL from the environment:\n * `GITHUB_BASE_URL` (Terraform convention), then `GITHUB_API_URL` (set by\n * GitHub Actions runners), then `GH_HOST` (gh CLI convention, a bare\n * hostname). Returns `undefined` when unset or when the value points at\n * github.com.\n */\nexport const resolveGitHubBaseUrlFromEnv = Effect.gen(function* () {\n for (const key of [\"GITHUB_BASE_URL\", \"GITHUB_API_URL\", \"GH_HOST\"]) {\n const value = yield* getEnv(key);\n if (value !== undefined && value.trim() !== \"\") {\n return yield* normalizeGitHubBaseUrl(value);\n }\n }\n return undefined;\n});\n//# sourceMappingURL=BaseUrl.js.map","import * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as Match from \"effect/Match\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as Stream from \"effect/Stream\";\nimport * as ChildProcess from \"effect/unstable/process/ChildProcess\";\nimport { ChildProcessSpawner } from \"effect/unstable/process/ChildProcessSpawner\";\nimport { AuthError, AuthProviderLayer, } from \"../Auth/AuthProvider.js\";\nimport { CredentialsStore, displayRedacted } from \"../Auth/Credentials.js\";\nimport { getEnvRedacted, retryOnce } from \"../Auth/Env.js\";\nimport * as Clank from \"../Util/Clank.js\";\nimport { githubHostname, normalizeGitHubBaseUrl, resolveGitHubBaseUrlFromEnv, } from \"./BaseUrl.js\";\nconst options = [\n {\n value: \"gh-cli\",\n label: \"GitHub CLI\",\n hint: \"delegate to `gh auth token` (run `gh auth login` first)\",\n },\n {\n value: \"env\",\n label: \"Environment Variables\",\n hint: \"GITHUB_ACCESS_TOKEN or GITHUB_TOKEN\",\n },\n {\n value: \"stored\",\n label: \"Personal Access Token\",\n hint: \"enter PAT interactively, stored in ~/.alchemy/credentials\",\n },\n];\nexport const GITHUB_AUTH_PROVIDER_NAME = \"GitHub\";\nclass GhCliError extends Error {\n _tag = \"GhCliError\";\n}\n/**\n * Read a token from the environment for the given (already-resolved) base\n * URL. On a GitHub Enterprise host, the gh CLI's enterprise token variables\n * (`GH_ENTERPRISE_TOKEN`, `GITHUB_ENTERPRISE_TOKEN`) are checked before the\n * standard `GITHUB_ACCESS_TOKEN` / `GITHUB_TOKEN`.\n */\nconst readEnvTokenFor = (baseUrl) => Effect.gen(function* () {\n const candidates = baseUrl !== undefined\n ? [\n \"GH_ENTERPRISE_TOKEN\",\n \"GITHUB_ENTERPRISE_TOKEN\",\n \"GITHUB_ACCESS_TOKEN\",\n \"GITHUB_TOKEN\",\n ]\n : [\"GITHUB_ACCESS_TOKEN\", \"GITHUB_TOKEN\"];\n for (const key of candidates) {\n const token = yield* getEnvRedacted(key);\n if (token) {\n return {\n type: \"token\",\n token,\n baseUrl,\n source: { type: \"env\", details: key },\n };\n }\n }\n return yield* new AuthError({\n message: `GitHub env credentials not found. Set ${candidates.join(\", \")}.`,\n });\n});\n/**\n * Read GitHub credentials from the environment. The base URL comes from the\n * stored config when set, otherwise from `GITHUB_BASE_URL`, `GITHUB_API_URL`,\n * or `GH_HOST`.\n */\nexport const readEnvCredentials = (configBaseUrl) => Effect.gen(function* () {\n const baseUrl = configBaseUrl ?? (yield* resolveGitHubBaseUrlFromEnv);\n return yield* readEnvTokenFor(baseUrl);\n});\nexport const makeGitHubAuth = (authOptions) => AuthProviderLayer()(GITHUB_AUTH_PROVIDER_NAME, Effect.gen(function* () {\n const store = yield* CredentialsStore;\n const cp = yield* ChildProcessSpawner;\n // Hard-coded host from `providers({ baseUrl })`, resolved once at layer\n // build. Kept as an object so \"no option\" (undefined) is distinct from\n // \"option normalized to the github.com default\" ({ baseUrl: undefined })\n // — both matter: the latter still pins the host and mutes the prompt.\n const fixed = authOptions?.baseUrl !== undefined\n ? {\n baseUrl: yield* normalizeGitHubBaseUrl(authOptions.baseUrl).pipe(Effect.orDie),\n }\n : undefined;\n // The host every method authenticates against: the hard-coded value\n // wins, then the profile's configured host, then the environment.\n const effectiveBaseUrl = (config) => fixed !== undefined\n ? Effect.succeed(fixed.baseUrl)\n : config.baseUrl !== undefined\n ? Effect.succeed(config.baseUrl)\n : resolveGitHubBaseUrlFromEnv;\n const ghCliToken = (hostname) => Effect.gen(function* () {\n const handle = yield* cp.spawn(ChildProcess.make(\"gh\", [\n \"auth\",\n \"token\",\n ...(hostname !== undefined ? [\"--hostname\", hostname] : []),\n ], { shell: false }));\n const [exitCode, stdout, stderr] = yield* Effect.all([\n handle.exitCode,\n Stream.mkString(Stream.decodeText(handle.stdout)),\n Stream.mkString(Stream.decodeText(handle.stderr)),\n ], { concurrency: 3 });\n if (exitCode !== 0) {\n return yield* Effect.fail(new GhCliError(`gh auth token exited with ${exitCode}: ${stderr.trim() || stdout.trim()}`));\n }\n const token = stdout.trim();\n if (!token) {\n return yield* Effect.fail(new GhCliError(\"gh auth token returned empty output\"));\n }\n return token;\n }).pipe(Effect.scoped, Effect.mapError((e) => e instanceof GhCliError\n ? new AuthError({ message: e.message, cause: e })\n : new AuthError({\n message: \"Could not invoke `gh`. Install GitHub CLI from https://cli.github.com/ and run `gh auth login`.\",\n cause: e,\n })));\n const loginStored = Effect.fn(function* (profileName, baseUrl) {\n const token = yield* Clank.password({\n message: \"GitHub Personal Access Token (needs `repo` scope; `workflow` for Actions)\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n yield* store.write(profileName, \"gh-stored\", {\n type: \"pat\",\n token,\n });\n yield* Clank.success(\"GitHub: credentials saved.\");\n return { method: \"stored\", baseUrl };\n });\n // Optional GitHub Enterprise host. Blank means github.com; anything else\n // is normalized into the REST API base URL (GHES gets `/api/v3`\n // appended, data-residency hosts get the `api.` prefix).\n const promptBaseUrl = Clank.text({\n message: \"GitHub host (leave blank for github.com; e.g. github.example.com for GitHub Enterprise)\",\n placeholder: \"github.com\",\n defaultValue: \"\",\n }).pipe(retryOnce, Effect.flatMap((input) => {\n const trimmed = (input ?? \"\").trim();\n return trimmed === \"\"\n ? Effect.succeed(undefined)\n : normalizeGitHubBaseUrl(trimmed);\n }));\n const configureInteractive = (profileName) => Effect.gen(function* () {\n const method = yield* Clank.select({\n message: \"GitHub authentication method\",\n options,\n });\n // The host prompt is skipped when providers({ baseUrl }) pinned it —\n // nothing is stored in the profile config; `read` re-applies the\n // pinned value from code on every resolution.\n const baseUrl = fixed !== undefined ? undefined : yield* promptBaseUrl;\n const verifyHost = fixed !== undefined ? fixed.baseUrl : baseUrl;\n return yield* Match.value(method).pipe(Match.when(\"env\", () => Effect.succeed({ method: \"env\", baseUrl })), Match.when(\"gh-cli\", () => ghCliToken(verifyHost !== undefined\n ? githubHostname(verifyHost)\n : undefined).pipe(Effect.as({ method: \"gh-cli\", baseUrl }), Effect.mapError((e) => new AuthError({\n message: `gh CLI not available: ${e.message}`,\n cause: e,\n })))), Match.when(\"stored\", () => loginStored(profileName, baseUrl)), Match.exhaustive);\n });\n const configureCredentials = (profileName, ctx) => Effect.gen(function* () {\n if (ctx.ci) {\n return { method: \"env\" };\n }\n return yield* configureInteractive(profileName);\n }).pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to configure credentials\",\n cause: e,\n })));\n const resolveCredentials = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, (c) => effectiveBaseUrl(c).pipe(Effect.flatMap(readEnvTokenFor))), Match.when({ method: \"stored\" }, Effect.fn(function* (c) {\n const baseUrl = yield* effectiveBaseUrl(c);\n const creds = yield* store.read(profileName, \"gh-stored\");\n if (creds == null) {\n return yield* new AuthError({\n message: \"GitHub stored credentials not found. Run: alchemy login --configure\",\n });\n }\n return {\n type: \"token\",\n token: Redacted.make(creds.token),\n baseUrl,\n source: { type: \"stored\" },\n };\n })), Match.when({ method: \"gh-cli\" }, Effect.fn(function* (c) {\n const baseUrl = yield* effectiveBaseUrl(c);\n const token = yield* ghCliToken(baseUrl !== undefined ? githubHostname(baseUrl) : undefined);\n return {\n type: \"token\",\n token: Redacted.make(token),\n baseUrl,\n source: { type: \"gh-cli\" },\n };\n })), Match.exhaustive);\n const logout = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"gh-cli\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .delete(profileName, \"gh-stored\")\n .pipe(Effect.andThen(Clank.success(\"GitHub: stored credentials removed\")))), Match.exhaustive);\n const login = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"gh-cli\" }, (c) => effectiveBaseUrl(c).pipe(Effect.flatMap((baseUrl) => ghCliToken(baseUrl !== undefined ? githubHostname(baseUrl) : undefined)), Effect.tap(() => Clank.success(\"GitHub: gh CLI authentication available.\")), Effect.asVoid)), Match.when({ method: \"stored\" }, (c) => store\n .read(profileName, \"gh-stored\")\n .pipe(Effect.flatMap((creds) => creds == null\n ? loginStored(profileName, c.baseUrl)\n : Effect.void))), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })));\n const prettyPrint = (profileName, config) => resolveCredentials(profileName, config).pipe(Effect.tap((creds) => {\n const sourceStr = creds.source.details\n ? `${creds.source.type} - ${creds.source.details}`\n : creds.source.type;\n return Effect.all([\n Console.log(` token: ${displayRedacted(creds.token, 6)}`),\n Console.log(` source: ${sourceStr}`),\n ...(creds.baseUrl !== undefined\n ? [Console.log(` baseUrl: ${creds.baseUrl}`)]\n : []),\n ]);\n }));\n return {\n configure: configureCredentials,\n logout,\n login,\n prettyPrint,\n read: resolveCredentials,\n };\n}));\n/**\n * The default GitHub AuthProvider layer — {@link makeGitHubAuth} with no\n * hard-coded host. Use `GitHub.providers({ baseUrl })` (or\n * `makeGitHubAuth({ baseUrl })` directly) to pin a GitHub Enterprise host.\n */\nexport const GitHubAuth = makeGitHubAuth();\n//# sourceMappingURL=AuthProvider.js.map","import { DEFAULT_API_BASE_URL } from \"@distilled.cloud/hetzner\";\nimport * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as Match from \"effect/Match\";\nimport * as Redacted from \"effect/Redacted\";\nimport { AuthError, AuthProviderLayer, } from \"../Auth/AuthProvider.js\";\nimport { CredentialsStore, displayRedacted } from \"../Auth/Credentials.js\";\nimport { getEnv, getEnvRedacted, retryOnce } from \"../Auth/Env.js\";\nimport { AlchemyProfile } from \"../Auth/Profile.js\";\nimport * as Clank from \"../Util/Clank.js\";\nexport const HETZNER_AUTH_PROVIDER_NAME = \"Hetzner\";\nexport const HCLOUD_TOKEN_ENV = \"HCLOUD_TOKEN\";\nexport const HCLOUD_ENDPOINT_ENV = \"HCLOUD_ENDPOINT\";\nconst STORAGE_KEY = \"hetzner-stored\";\nconst options = [\n {\n value: \"env\",\n label: \"Environment Variables\",\n hint: `${HCLOUD_TOKEN_ENV} + optional ${HCLOUD_ENDPOINT_ENV}`,\n },\n {\n value: \"stored\",\n label: \"API Token\",\n hint: \"enter interactively, stored in ~/.alchemy/credentials\",\n },\n];\nconst resolveApiBaseUrl = (explicit) => getEnv(HCLOUD_ENDPOINT_ENV).pipe(Effect.map((fromEnv) => explicit ?? fromEnv ?? DEFAULT_API_BASE_URL));\n/**\n * Layer that registers the Hetzner {@link AuthProvider} into the\n * {@link AuthProviders} registry. Include this in the Hetzner\n * `providers()` layer so `alchemy login` can discover it.\n *\n * Auth is a Hetzner Cloud API token (`HCLOUD_TOKEN`). The token is\n * issued per project in the Cloud Console — there is no account-wide\n * token. An optional `HCLOUD_ENDPOINT` overrides the API root\n * (default `https://api.hetzner.cloud/v1`).\n */\nexport const HetznerAuth = AuthProviderLayer()(HETZNER_AUTH_PROVIDER_NAME, Effect.gen(function* () {\n const profiles = yield* AlchemyProfile;\n const store = yield* CredentialsStore;\n const loginStored = Effect.fn(function* (profileName) {\n const token = yield* Clank.password({\n message: \"Hetzner Cloud API Token\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const envEndpoint = yield* getEnv(HCLOUD_ENDPOINT_ENV);\n const endpointPrompt = yield* Clank.text({\n message: \"Hetzner API endpoint (Enter for default)\",\n placeholder: DEFAULT_API_BASE_URL,\n defaultValue: envEndpoint ?? DEFAULT_API_BASE_URL,\n }).pipe(retryOnce);\n const trimmed = (endpointPrompt ?? \"\").trim();\n const apiBaseUrl = trimmed.length > 0 && trimmed !== DEFAULT_API_BASE_URL\n ? trimmed\n : undefined;\n yield* store.write(profileName, STORAGE_KEY, {\n type: \"token\",\n token,\n apiBaseUrl,\n });\n yield* Clank.success(\"Hetzner: credentials saved.\");\n return { method: \"stored\" };\n });\n const configureInteractive = (profileName) => Clank.select({\n message: \"Hetzner authentication method\",\n options,\n }).pipe(Effect.flatMap((method) => Match.value(method).pipe(Match.when(\"env\", () => Effect.succeed({ method: \"env\" })), Match.when(\"stored\", () => loginStored(profileName)), Match.exhaustive)));\n const configureCredentials = (profileName, ctx) => Effect.gen(function* () {\n if (ctx.ci) {\n return { method: \"env\" };\n }\n return yield* configureInteractive(profileName);\n }).pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to configure credentials\",\n cause: e,\n })));\n const resolveCredentials = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, Effect.fn(function* () {\n const token = yield* getEnvRedacted(HCLOUD_TOKEN_ENV);\n if (!token) {\n return yield* new AuthError({\n message: `Hetzner env credentials not found. Set ${HCLOUD_TOKEN_ENV}.`,\n });\n }\n const apiBaseUrl = yield* resolveApiBaseUrl();\n return {\n type: \"token\",\n token,\n apiBaseUrl,\n source: { type: \"env\", details: HCLOUD_TOKEN_ENV },\n };\n })), Match.when({ method: \"stored\" }, () => store.read(profileName, STORAGE_KEY).pipe(Effect.flatMap((creds) => creds == null\n ? Effect.fail(new AuthError({\n message: \"Hetzner stored credentials not found. Run: alchemy login --configure\",\n }))\n : resolveApiBaseUrl(creds.apiBaseUrl).pipe(Effect.map((apiBaseUrl) => ({\n type: \"token\",\n token: Redacted.make(creds.token),\n apiBaseUrl,\n source: { type: \"stored\" },\n })))))), Match.exhaustive);\n const logout = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .delete(profileName, STORAGE_KEY)\n .pipe(Effect.andThen(Clank.success(\"Hetzner: stored credentials removed\")))), Match.exhaustive);\n const login = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => \n // If HCLOUD_TOKEN isn't set, fall through to the interactive picker\n // so the user can switch to `stored` (or be told to set the env var)\n // instead of silently failing later in `read`. The new selection is\n // persisted to the profile so subsequent logins don't re-prompt.\n getEnvRedacted(HCLOUD_TOKEN_ENV).pipe(Effect.flatMap((token) => token\n ? Effect.void\n : Effect.gen(function* () {\n const next = yield* configureInteractive(profileName);\n const existing = yield* profiles.getProfile(profileName);\n yield* profiles.setProfile(profileName, {\n ...existing,\n [HETZNER_AUTH_PROVIDER_NAME]: next,\n });\n })))), Match.when({ method: \"stored\" }, () => store\n .read(profileName, STORAGE_KEY)\n .pipe(Effect.flatMap((creds) => creds == null ? loginStored(profileName) : Effect.void))), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })));\n const prettyPrint = (profileName, config) => resolveCredentials(profileName, config).pipe(Effect.tap((creds) => {\n const sourceStr = creds.source.details\n ? `${creds.source.type} - ${creds.source.details}`\n : creds.source.type;\n return Effect.all([\n Console.log(` token: ${displayRedacted(creds.token, 6)}`),\n Console.log(` apiBaseUrl: ${creds.apiBaseUrl}`),\n Console.log(` source: ${sourceStr}`),\n ]);\n }));\n return {\n configure: configureCredentials,\n logout,\n login,\n prettyPrint,\n read: resolveCredentials,\n };\n}));\n//# sourceMappingURL=AuthProvider.js.map","import * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as Match from \"effect/Match\";\nimport * as Redacted from \"effect/Redacted\";\nimport { AuthError, AuthProviderLayer, } from \"../Auth/AuthProvider.js\";\nimport { CredentialsStore, displayRedacted } from \"../Auth/Credentials.js\";\nimport { getEnvRedacted, retryOnce } from \"../Auth/Env.js\";\nimport { AlchemyProfile } from \"../Auth/Profile.js\";\nimport * as Clank from \"../Util/Clank.js\";\nexport const NEON_AUTH_PROVIDER_NAME = \"Neon\";\nconst options = [\n {\n value: \"env\",\n label: \"Environment Variable\",\n hint: \"NEON_API_KEY\",\n },\n {\n value: \"stored\",\n label: \"API Key\",\n hint: \"enter interactively, stored in ~/.alchemy/credentials\",\n },\n];\n/**\n * Layer that registers the Neon {@link AuthProvider} into the\n * {@link AuthProviders} registry.\n */\nexport const NeonAuth = AuthProviderLayer()(NEON_AUTH_PROVIDER_NAME, Effect.gen(function* () {\n const profiles = yield* AlchemyProfile;\n const store = yield* CredentialsStore;\n const loginStored = Effect.fn(function* (profileName) {\n const apiKey = yield* Clank.password({\n message: \"Neon API Key\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n yield* store.write(profileName, \"neon-stored\", {\n type: \"apiKey\",\n apiKey,\n });\n yield* Clank.success(\"Neon: credentials saved.\");\n return { method: \"stored\" };\n });\n const configureInteractive = (profileName) => Clank.select({\n message: \"Neon authentication method\",\n options,\n }).pipe(Effect.flatMap((method) => Match.value(method).pipe(Match.when(\"env\", () => Effect.succeed({ method: \"env\" })), Match.when(\"stored\", () => loginStored(profileName)), Match.exhaustive)));\n const configureCredentials = (profileName, ctx) => Effect.gen(function* () {\n if (ctx.ci) {\n return { method: \"env\" };\n }\n return yield* configureInteractive(profileName);\n }).pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to configure credentials\",\n cause: e,\n })));\n const resolveCredentials = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, Effect.fn(function* () {\n const apiKey = yield* getEnvRedacted(\"NEON_API_KEY\");\n if (!apiKey) {\n return yield* new AuthError({\n message: \"Neon env credentials not found. Set NEON_API_KEY.\",\n });\n }\n return {\n type: \"apiKey\",\n apiKey,\n source: { type: \"env\" },\n };\n })), Match.when({ method: \"stored\" }, () => store.read(profileName, \"neon-stored\").pipe(Effect.flatMap((creds) => creds == null\n ? Effect.fail(new AuthError({\n message: \"Neon stored credentials not found. Run: alchemy login --configure\",\n }))\n : Effect.succeed({\n type: \"apiKey\",\n apiKey: Redacted.make(creds.apiKey),\n source: { type: \"stored\" },\n })))), Match.exhaustive);\n const logout = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .delete(profileName, \"neon-stored\")\n .pipe(Effect.andThen(Clank.success(\"Neon: stored credentials removed\")))), Match.exhaustive);\n const login = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => \n // If NEON_API_KEY isn't set, fall through to the interactive picker\n // so the user can switch to `stored` (or be told to set the env var)\n // instead of silently failing later in `read`. The new selection is\n // persisted to the profile so subsequent logins don't re-prompt.\n getEnvRedacted(\"NEON_API_KEY\").pipe(Effect.flatMap((apiKey) => apiKey\n ? Effect.void\n : Effect.gen(function* () {\n const next = yield* configureInteractive(profileName);\n const existing = yield* profiles.getProfile(profileName);\n yield* profiles.setProfile(profileName, {\n ...existing,\n [NEON_AUTH_PROVIDER_NAME]: next,\n });\n })))), Match.when({ method: \"stored\" }, () => store\n .read(profileName, \"neon-stored\")\n .pipe(Effect.flatMap((creds) => creds == null ? loginStored(profileName) : Effect.void))), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })));\n const prettyPrint = (profileName, config) => resolveCredentials(profileName, config).pipe(Effect.tap((creds) => {\n const sourceStr = creds.source.details\n ? `${creds.source.type} - ${creds.source.details}`\n : creds.source.type;\n return Effect.all([\n Console.log(` apiKey: ${displayRedacted(creds.apiKey, 9)}`),\n Console.log(` source: ${sourceStr}`),\n ]);\n }));\n return {\n configure: configureCredentials,\n logout,\n login,\n prettyPrint,\n read: resolveCredentials,\n };\n}));\n//# sourceMappingURL=AuthProvider.js.map","import * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport crypto from \"node:crypto\";\nimport http from \"node:http\";\nimport { AUTH_ERROR_URL, AUTH_SUCCESS_URL } from \"../Auth/AuthProvider.js\";\nexport class OAuthError extends Data.TaggedError(\"OAuthError\") {\n}\n/**\n * Registered PlanetScale OAuth application credentials.\n *\n * Unlike Cloudflare, PlanetScale OAuth has **no public-client flow** — the\n * token endpoint requires client authentication for every grant (PKCE is\n * advertised in their discovery doc but does not lift that requirement), so\n * exchanging the authorization code (and refreshing the token) requires the\n * application's `client_secret`. There is no way to keep that secret out of\n * a distributed CLI, so it ships here: the exposure is the same posture as a\n * public `client_id` (a stolen refresh token is usable, exactly like\n * Cloudflare's secret-less refresh), and it can be rotated by cutting a new\n * release. PlanetScale's own CLI ships its OAuth `client_secret` in source\n * the same way:\n * https://github.com/planetscale/cli/blob/main/internal/auth/authenticator.go\n *\n * Registered at https://app.planetscale.com with redirect URI\n * {@link OAUTH_REDIRECT_URI}. Scopes are configured on the application\n * itself, not requested per-authorization. Rotate by registering a new\n * secret and cutting a release.\n */\nexport const OAUTH_CLIENT_ID = \"pscale_app_aa12e3938baebb788aac443f66e422da\";\nexport const OAUTH_CLIENT_SECRET = \"pscale_app_secret_yyZ3Q8oe99GP9_yA5wrA5er6RuN6Lz9dC66Bj1OJzpg\";\nexport const OAUTH_REDIRECT_URI = \"https://alchemy.run/auth/callback\";\nexport const OAUTH_LOCAL_CALLBACK_URI = \"http://localhost:9976/auth/callback\";\nexport const OAUTH_ENDPOINTS = {\n // PlanetScale's own .well-known OAuth discovery doc declares this as\n // the authorization_endpoint — NOT auth.planetscale.com/oauth/authorize\n // (which their public docs cite). The auth.planetscale.com alias does\n // render a consent screen but emits codes whose resulting tokens lack\n // a `sub` claim, so the resource API at api.planetscale.com rejects\n // them as invalid. Use the canonical endpoint.\n authorize: \"https://app.planetscale.com/oauth/authorize\",\n token: \"https://auth.planetscale.com/oauth/token\",\n};\nfunction generateState(length = 32) {\n return Buffer.from(crypto.randomBytes(length)).toString(\"base64url\");\n}\nfunction extractCredentials(json) {\n return {\n type: \"oauth\",\n access: json.access_token,\n refresh: json.refresh_token,\n expires: Date.now() + json.expires_in * 1000,\n scopes: json.scope ? json.scope.split(\" \") : [],\n };\n}\nconst tokenRequest = (params) => Effect.gen(function* () {\n // PlanetScale's docs show the token endpoint with all parameters in\n // the query string (https://planetscale.com/docs/api/reference/oauth).\n // Their .well-known discovery doc advertises client_secret_basic /\n // client_secret_post instead, but both behave identically to the\n // query-string form in practice, so we follow the public docs\n // literally.\n const url = new URL(OAUTH_ENDPOINTS.token);\n for (const [k, v] of Object.entries(params)) {\n url.searchParams.set(k, v);\n }\n const res = yield* Effect.tryPromise({\n try: () => fetch(url.toString(), {\n method: \"POST\",\n headers: { Accept: \"application/json\" },\n }),\n catch: (err) => new OAuthError({\n error: \"network_error\",\n errorDescription: `Token request failed: ${err}`,\n }),\n });\n if (!res.ok) {\n const json = yield* Effect.tryPromise({\n try: () => res.json(),\n catch: () => new OAuthError({\n error: \"parse_error\",\n errorDescription: `Token endpoint returned ${res.status}`,\n }),\n });\n return yield* new OAuthError({\n error: json.error,\n errorDescription: json.error_description,\n });\n }\n const json = yield* Effect.tryPromise({\n try: () => res.json(),\n catch: () => new OAuthError({\n error: \"parse_error\",\n errorDescription: \"Failed to parse token response\",\n }),\n });\n return extractCredentials(json);\n});\n/**\n * Generate a PlanetScale authorization URL.\n *\n * No `scope` parameter is sent: PlanetScale scopes are configured on the\n * OAuth application itself, not requested per-authorization, so the\n * consent screen shows whatever the app is registered with.\n */\nexport function authorize() {\n const state = generateState();\n const url = new URL(OAUTH_ENDPOINTS.authorize);\n url.searchParams.set(\"client_id\", OAUTH_CLIENT_ID);\n url.searchParams.set(\"redirect_uri\", OAUTH_REDIRECT_URI);\n url.searchParams.set(\"response_type\", \"code\");\n url.searchParams.set(\"state\", state);\n return { url: url.toString(), state };\n}\n/**\n * Exchange an authorization code for OAuth credentials.\n */\nexport const exchange = (code) => tokenRequest({\n grant_type: \"authorization_code\",\n code,\n client_id: OAUTH_CLIENT_ID,\n client_secret: OAUTH_CLIENT_SECRET,\n redirect_uri: OAUTH_REDIRECT_URI,\n});\n/**\n * Refresh expired OAuth credentials.\n */\nexport const refresh = (credentials) => tokenRequest({\n grant_type: \"refresh_token\",\n refresh_token: credentials.refresh,\n client_id: OAUTH_CLIENT_ID,\n client_secret: OAUTH_CLIENT_SECRET,\n});\n/**\n * Exchange a code copied from the hosted relay page, or extract the code from\n * either the hosted or loopback callback URL.\n */\nexport const exchangeCallbackInput = (input, authorization) => Effect.gen(function* () {\n const value = input.trim();\n let code = value;\n let state = null;\n try {\n const url = new URL(value);\n code = url.searchParams.get(\"code\") ?? \"\";\n state = url.searchParams.get(\"state\");\n }\n catch {\n const separator = value.lastIndexOf(\"#\");\n if (separator >= 0) {\n code = value.slice(0, separator);\n state = value.slice(separator + 1);\n }\n }\n if (!code) {\n return yield* new OAuthError({\n error: \"invalid_request\",\n errorDescription: \"The authorization code is missing.\",\n });\n }\n if (state !== null && state !== authorization.state) {\n return yield* new OAuthError({\n error: \"invalid_request\",\n errorDescription: \"The authorization state does not match.\",\n });\n }\n return yield* exchange(code);\n});\n/**\n * Start a local HTTP server to listen for the OAuth callback, exchange\n * the authorization code, and return the credentials.\n *\n * Times out after 5 minutes.\n */\nexport const callback = (authorization) => Effect.tryPromise({\n try: (signal) => callbackPromise(authorization, signal),\n catch: (err) => {\n if (err instanceof OAuthError)\n return err;\n return new OAuthError({\n error: \"callback_error\",\n errorDescription: `OAuth callback failed: ${err}`,\n });\n },\n});\nfunction callbackPromise(authorization, signal) {\n const { pathname, port } = new URL(OAUTH_LOCAL_CALLBACK_URI);\n return new Promise((resolve, reject) => {\n const server = http.createServer(async (req, res) => {\n const url = new URL(req.url ?? \"/\", `http://${req.headers.host}`);\n if (url.pathname === \"/auth/ping\") {\n res.writeHead(req.method === \"OPTIONS\" ? 204 : 200, {\n \"Access-Control-Allow-Origin\": new URL(OAUTH_REDIRECT_URI).origin,\n \"Access-Control-Allow-Methods\": \"GET, OPTIONS\",\n \"Access-Control-Allow-Private-Network\": \"true\",\n \"Cache-Control\": \"no-store\",\n });\n res.end();\n return;\n }\n if (url.pathname !== pathname) {\n res.statusCode = 404;\n res.end(\"Not Found\");\n return;\n }\n const error = url.searchParams.get(\"error\");\n const errorDescription = url.searchParams.get(\"error_description\");\n if (error) {\n res.writeHead(302, { Location: AUTH_ERROR_URL });\n res.end();\n cleanup();\n reject(new OAuthError({\n error,\n errorDescription: errorDescription ?? \"An unknown error occurred.\",\n }));\n return;\n }\n const code = url.searchParams.get(\"code\");\n const state = url.searchParams.get(\"state\");\n if (!code || !state) {\n res.writeHead(302, { Location: AUTH_ERROR_URL });\n res.end();\n cleanup();\n reject(new OAuthError({\n error: \"invalid_request\",\n errorDescription: \"Missing code or state\",\n }));\n return;\n }\n if (state !== authorization.state) {\n res.writeHead(302, { Location: AUTH_ERROR_URL });\n res.end();\n cleanup();\n reject(new OAuthError({\n error: \"invalid_request\",\n errorDescription: \"Invalid state\",\n }));\n return;\n }\n try {\n const credentials = await Effect.runPromise(exchange(code));\n res.writeHead(302, { Location: AUTH_SUCCESS_URL });\n res.end();\n cleanup();\n resolve(credentials);\n }\n catch (err) {\n res.writeHead(302, { Location: AUTH_ERROR_URL });\n res.end();\n cleanup();\n reject(err);\n }\n });\n const timeout = setTimeout(() => {\n cleanup();\n reject(new OAuthError({\n error: \"timeout\",\n errorDescription: \"The authorization process timed out.\",\n }));\n }, 5 * 60 * 1000);\n function cleanup() {\n clearTimeout(timeout);\n signal.removeEventListener(\"abort\", cleanup);\n server.close();\n }\n signal.addEventListener(\"abort\", cleanup, { once: true });\n server.on(\"error\", (err) => {\n cleanup();\n reject(new OAuthError({\n error: \"server_error\",\n errorDescription: `Failed to start callback server: ${err.message}`,\n }));\n });\n server.listen(Number(port));\n });\n}\n//# sourceMappingURL=OAuthClient.js.map","import { listOrganizations } from \"@distilled.cloud/planetscale\";\nimport * as PsCredentialsModule from \"@distilled.cloud/planetscale/Credentials\";\nimport * as Console from \"effect/Console\";\nimport * as Duration from \"effect/Duration\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Match from \"effect/Match\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as FetchHttpClient from \"effect/unstable/http/FetchHttpClient\";\nimport * as HttpClient from \"effect/unstable/http/HttpClient\";\nimport { AuthError, AuthProviderLayer, } from \"../Auth/AuthProvider.js\";\nimport { CredentialsStore, displayRedacted } from \"../Auth/Credentials.js\";\nimport { getEnvRedactedRequired, getEnvRequired, retryOnce, } from \"../Auth/Env.js\";\nimport * as Clank from \"../Util/Clank.js\";\nimport * as OAuthClient from \"./OAuthClient.js\";\n/**\n * Canonical name registered in {@link AuthProviders}. Use this key to look\n * up the PlanetScale {@link AuthProvider} from inside provider Layers.\n */\nexport const PLANETSCALE_AUTH_PROVIDER_NAME = \"Planetscale\";\n/**\n * Provide PlanetScale `Credentials` + `HttpClient` to an Effect using a\n * just-obtained OAuth access token. Used during configure to call\n * org-discovery endpoints before the user has chosen an org.\n *\n * `organization` is required by the credential type but isn't consulted by\n * `listOrganizations` (it's a user-scoped endpoint), so an empty string is\n * fine here.\n */\nconst withOAuthCredentials = (accessToken, effect) => Effect.provide(effect, Layer.mergeAll(PsCredentialsModule.fromOAuth({\n accessToken,\n organization: \"\",\n}), FetchHttpClient.layer));\n/**\n * List the organizations the OAuth user belongs to and either auto-pick\n * (one org) or prompt the user to choose. Returns the org's URL slug\n * (`name` field, used as `{organization}` in API paths).\n */\nconst selectOrganization = (accessToken) => Effect.gen(function* () {\n const list = yield* listOrganizations;\n const response = yield* list({});\n const orgs = response.data;\n if (orgs.length === 0) {\n return yield* new AuthError({\n message: \"Planetscale: no organizations found for this credential.\",\n });\n }\n if (orgs.length === 1) {\n const org = orgs[0];\n yield* Clank.info(`Planetscale: using organization: ${org.name} (${org.id})`);\n return org.name;\n }\n return yield* Clank.select({\n message: \"Select a Planetscale organization\",\n options: orgs.map((o) => ({\n value: o.name,\n label: o.name,\n hint: o.id,\n })),\n }).pipe(retryOnce);\n}).pipe((e) => withOAuthCredentials(accessToken, e));\nconst options = [\n {\n value: \"env\",\n label: \"Environment Variables\",\n hint: \"PLANETSCALE_API_TOKEN_ID + PLANETSCALE_API_TOKEN + PLANETSCALE_ORGANIZATION\",\n },\n {\n value: \"oauth\",\n label: \"OAuth\",\n hint: \"recommended — browser-based login with automatic token refresh\",\n },\n {\n value: \"stored\",\n label: \"Service Token\",\n hint: \"enter service token interactively, stored in ~/.alchemy/credentials\",\n },\n];\n/**\n * Layer that registers the PlanetScale {@link AuthProvider} into the\n * {@link AuthProviders} registry when built. Include this in the\n * PlanetScale `providers()` layer so `alchemy login` can discover it.\n *\n * Supported methods:\n * - `env`: reads `PLANETSCALE_API_TOKEN_ID`/`PLANETSCALE_API_TOKEN`/`PLANETSCALE_ORGANIZATION`.\n * - `stored`: prompts for a service token interactively and writes it to\n * `~/.alchemy/credentials/<profile>/planetscale-stored.json`.\n * - `oauth`: browser-based login storing access/refresh tokens at\n * `~/.alchemy/credentials/<profile>/planetscale-oauth.json`.\n */\nexport const PlanetscaleAuth = AuthProviderLayer()(PLANETSCALE_AUTH_PROVIDER_NAME, Effect.gen(function* () {\n const store = yield* CredentialsStore;\n const oauthLogin = (profileName) => Effect.gen(function* () {\n const authorization = OAuthClient.authorize();\n yield* Clank.info(\"Planetscale: opening browser for OAuth login...\");\n yield* Clank.info(authorization.url);\n yield* Clank.openUrl(authorization.url).pipe(Effect.catch(() => Clank.warn(\"Planetscale: could not open browser automatically. Please open the URL above manually.\")));\n yield* Clank.info(\"Planetscale: waiting for authorization (up to 5 minutes).\");\n const credentials = yield* Effect.raceFirst(OAuthClient.callback(authorization), Clank.text({\n message: \"Paste the authorization code or callback URL\",\n placeholder: \"The browser will complete this automatically when local\",\n validate: (value) => value.trim().length > 0 ? undefined : \"Paste a code or URL\",\n }).pipe(Effect.flatMap((input) => OAuthClient.exchangeCallbackInput(input, authorization))));\n yield* store.write(profileName, \"planetscale-oauth\", credentials);\n yield* Clank.success(\"Planetscale: OAuth credentials saved.\");\n return credentials;\n });\n const configureOAuth = Effect.fn(function* (profileName) {\n const oauthCreds = yield* oauthLogin(profileName);\n // Use the just-issued access token to list the user's orgs and let\n // them pick (mirrors Cloudflare's selectAccount). Requires the\n // `user:read_organizations` scope. If the call fails for any\n // reason — missing scope, network, off-spec response — fall back\n // to a manual prompt so login still completes.\n const organization = yield* selectOrganization(oauthCreds.access).pipe(Effect.catch((e) => Effect.gen(function* () {\n yield* Clank.warn(`Planetscale: could not auto-list organizations (${String(e)}). Falling back to manual entry.`);\n return yield* Clank.text({\n message: \"Planetscale Organization (URL slug)\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n })));\n return { method: \"oauth\", organization };\n });\n const loginStored = Effect.fn(function* (profileName) {\n const tokenId = yield* Clank.text({\n message: \"Planetscale Service Token ID\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const token = yield* Clank.password({\n message: \"Planetscale Service Token\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n const organization = yield* Clank.text({\n message: \"Planetscale Organization (URL slug)\",\n validate: (v) => (v.length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n yield* store.write(profileName, \"planetscale-stored\", {\n type: \"apiToken\",\n tokenId,\n token,\n organization,\n });\n yield* Clank.success(\"Planetscale: credentials saved.\");\n return { method: \"stored\" };\n });\n const configureInteractive = (profileName) => Clank.select({\n message: \"Planetscale authentication method\",\n options,\n }).pipe(Effect.flatMap((method) => Match.value(method).pipe(Match.when(\"env\", () => Effect.succeed({ method: \"env\" })), Match.when(\"oauth\", () => configureOAuth(profileName)), Match.when(\"stored\", () => loginStored(profileName)), Match.exhaustive)));\n const configureCredentials = (profileName, ctx) => Effect.gen(function* () {\n if (ctx.ci) {\n return { method: \"env\" };\n }\n return yield* configureInteractive(profileName);\n }).pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to configure credentials\",\n cause: e,\n })));\n const resolveCredentials = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, Effect.fn(function* () {\n const tokenId = yield* getEnvRedactedRequired(\"PLANETSCALE_API_TOKEN_ID\");\n const token = yield* getEnvRedactedRequired(\"PLANETSCALE_API_TOKEN\");\n const organization = yield* getEnvRequired(\"PLANETSCALE_ORGANIZATION\");\n return {\n type: \"apiToken\",\n tokenId,\n token,\n organization,\n source: {\n type: \"env\",\n details: \"PLANETSCALE_API_TOKEN_ID/PLANETSCALE_API_TOKEN\",\n },\n };\n })), Match.when({ method: \"stored\" }, () => store\n .read(profileName, \"planetscale-stored\")\n .pipe(Effect.flatMap((creds) => creds == null\n ? Effect.fail(new AuthError({\n message: \"Planetscale stored credentials not found. Run: alchemy login --configure\",\n }))\n : Effect.succeed({\n type: \"apiToken\",\n tokenId: Redacted.make(creds.tokenId),\n token: Redacted.make(creds.token),\n organization: creds.organization,\n source: {\n type: \"stored\",\n details: undefined,\n },\n })))), Match.when({ method: \"oauth\" }, (cfg) => Effect.gen(function* () {\n const creds = yield* store.read(profileName, \"planetscale-oauth\");\n if (creds == null || creds.type !== \"oauth\") {\n return yield* Effect.fail(new AuthError({\n message: \"Planetscale OAuth credentials not found. Run: alchemy login\",\n }));\n }\n // Refresh proactively if the token has expired (or is within\n // 10s of expiring). Persist the refreshed creds so subsequent\n // resolves don't repeat the round-trip.\n const fresh = creds.expires > Date.now() + 10_000\n ? creds\n : yield* OAuthClient.refresh(creds).pipe(Effect.tap((refreshed) => store.write(profileName, \"planetscale-oauth\", refreshed)), Effect.mapError((e) => new AuthError({\n message: \"Planetscale OAuth refresh failed. Run: alchemy login\",\n cause: e,\n })));\n return {\n type: \"oauth\",\n accessToken: Redacted.make(fresh.access),\n expires: fresh.expires,\n organization: cfg.organization,\n source: { type: \"oauth\" },\n };\n })), Match.exhaustive);\n const logout = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .delete(profileName, \"planetscale-stored\")\n .pipe(Effect.andThen(Clank.success(\"Planetscale: stored credentials removed\")))), \n // PlanetScale publishes no token-revocation endpoint, so logout just\n // drops the locally stored tokens.\n Match.when({ method: \"oauth\" }, () => store\n .delete(profileName, \"planetscale-oauth\")\n .pipe(Effect.andThen(Clank.success(\"Planetscale: OAuth credentials removed.\")))), Match.exhaustive);\n const login = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .read(profileName, \"planetscale-stored\")\n .pipe(Effect.flatMap((creds) => creds == null ? loginStored(profileName) : Effect.void))), Match.when({ method: \"oauth\" }, (c) => Effect.gen(function* () {\n const creds = yield* store.read(profileName, \"planetscale-oauth\");\n if (creds?.type === \"oauth\") {\n yield* Clank.info(\"Planetscale: refreshing OAuth credentials...\");\n yield* OAuthClient.refresh(creds).pipe(Effect.flatMap((refreshed) => store\n .write(profileName, \"planetscale-oauth\", refreshed)\n .pipe(Effect.andThen(Clank.success(\"Planetscale: OAuth credentials refreshed.\")))), Effect.catchTag(\"OAuthError\", () => oauthLogin(profileName).pipe(Effect.asVoid)));\n return;\n }\n yield* oauthLogin(profileName);\n })), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })));\n const prettyPrint = (profileName, config) => resolveCredentials(profileName, config).pipe(Effect.tap((creds) => {\n const sourceStr = creds.source.details\n ? `${creds.source.type} - ${creds.source.details}`\n : creds.source.type;\n return Match.value(creds).pipe(Match.when({ type: \"apiToken\" }, (c) => Effect.all([\n Console.log(` tokenId: ${displayRedacted(c.tokenId, 3)}`),\n Console.log(` token: ${displayRedacted(c.token, 6)}`),\n Console.log(` organization: ${c.organization}`),\n Console.log(` source: ${sourceStr}`),\n ])), Match.when({ type: \"oauth\" }, (c) => {\n const remainingMs = c.expires - Date.now();\n const expiresAt = new Date(c.expires).toISOString();\n const expiresStr = remainingMs <= 0\n ? `expired (${expiresAt})`\n : `in ${Duration.format(Duration.millis(remainingMs))} (${expiresAt})`;\n return Effect.all([\n Console.log(` accessToken: ${displayRedacted(c.accessToken)}`),\n Console.log(` expires: ${expiresStr}`),\n Console.log(` organization: ${c.organization}`),\n Console.log(` source: ${sourceStr}`),\n ]);\n }), Match.exhaustive);\n }));\n return {\n configure: configureCredentials,\n logout,\n login,\n prettyPrint,\n read: resolveCredentials,\n };\n}));\n//# sourceMappingURL=AuthProvider.js.map","import * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as Match from \"effect/Match\";\nimport * as Redacted from \"effect/Redacted\";\nimport { AuthError, AuthProviderLayer, } from \"../Auth/AuthProvider.js\";\nimport { CredentialsStore, displayRedacted } from \"../Auth/Credentials.js\";\nimport { getEnvRedacted, retryOnce } from \"../Auth/Env.js\";\nimport { AlchemyProfile } from \"../Auth/Profile.js\";\nimport * as Clank from \"../Util/Clank.js\";\nexport const PRISMA_AUTH_PROVIDER_NAME = \"Prisma\";\nexport const PRISMA_SERVICE_TOKEN_ENV = \"PRISMA_SERVICE_TOKEN\";\nexport const PRISMA_API_TOKEN_ENV = \"PRISMA_API_TOKEN\";\nconst options = [\n {\n value: \"env\",\n label: \"Environment Variable\",\n hint: `${PRISMA_SERVICE_TOKEN_ENV} or ${PRISMA_API_TOKEN_ENV}`,\n },\n {\n value: \"stored\",\n label: \"Service Token\",\n hint: \"enter interactively, stored in ~/.alchemy/credentials\",\n },\n];\nconst nonEmptyToken = (token) => token !== undefined && Redacted.value(token).trim().length > 0;\nconst validStoredCredentials = (credentials) => credentials?.type === \"serviceToken\" &&\n credentials.serviceToken.trim().length > 0;\nconst trimToken = (token) => Redacted.make(Redacted.value(token).trim());\nconst readEnvServiceToken = Effect.fnUntraced(function* () {\n const serviceToken = yield* getEnvRedacted(PRISMA_SERVICE_TOKEN_ENV);\n if (nonEmptyToken(serviceToken)) {\n return {\n serviceToken: trimToken(serviceToken),\n envName: PRISMA_SERVICE_TOKEN_ENV,\n };\n }\n const apiToken = yield* getEnvRedacted(PRISMA_API_TOKEN_ENV);\n if (nonEmptyToken(apiToken)) {\n return {\n serviceToken: trimToken(apiToken),\n envName: PRISMA_API_TOKEN_ENV,\n };\n }\n return undefined;\n});\n/**\n * Layer that registers the Prisma Management API auth provider.\n */\nexport const PrismaAuth = AuthProviderLayer()(PRISMA_AUTH_PROVIDER_NAME, Effect.gen(function* () {\n const profiles = yield* AlchemyProfile;\n const store = yield* CredentialsStore;\n const loginStored = Effect.fnUntraced(function* (profileName) {\n const serviceToken = yield* Clank.password({\n message: \"Prisma Service Token\",\n validate: (v) => (v.trim().length === 0 ? \"Required\" : undefined),\n }).pipe(retryOnce);\n yield* store.write(profileName, \"prisma-stored\", {\n type: \"serviceToken\",\n serviceToken: serviceToken.trim(),\n });\n yield* Clank.success(\"Prisma: credentials saved.\");\n return { method: \"stored\" };\n });\n const configureInteractive = (profileName) => Clank.select({\n message: \"Prisma authentication method\",\n options,\n }).pipe(Effect.flatMap((method) => Match.value(method).pipe(Match.when(\"env\", () => Effect.succeed({ method: \"env\" })), Match.when(\"stored\", () => loginStored(profileName)), Match.exhaustive)));\n const configure = (profileName, ctx) => Effect.gen(function* () {\n if (ctx.ci)\n return { method: \"env\" };\n return yield* configureInteractive(profileName);\n }).pipe(Effect.mapError((e) => new AuthError({\n message: \"failed to configure credentials\",\n cause: e,\n })));\n const read = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, Effect.fnUntraced(function* () {\n const envToken = yield* readEnvServiceToken();\n if (!envToken) {\n return yield* new AuthError({\n message: `Prisma env credentials not found. Set ${PRISMA_SERVICE_TOKEN_ENV} or ${PRISMA_API_TOKEN_ENV}.`,\n });\n }\n return {\n type: \"serviceToken\",\n serviceToken: envToken.serviceToken,\n source: { type: \"env\", details: envToken.envName },\n };\n })), Match.when({ method: \"stored\" }, () => store\n .read(profileName, \"prisma-stored\")\n .pipe(Effect.flatMap((creds) => !validStoredCredentials(creds)\n ? Effect.fail(new AuthError({\n message: creds == null\n ? \"Prisma stored credentials not found. Run: alchemy login --configure\"\n : \"Prisma stored credentials are invalid. Run: alchemy login --configure\",\n }))\n : Effect.succeed({\n type: \"serviceToken\",\n serviceToken: Redacted.make(creds.serviceToken.trim()),\n source: { type: \"stored\" },\n })))), Match.exhaustive);\n const login = (profileName, config) => Match.value(config)\n .pipe(Match.when({ method: \"env\" }, () => readEnvServiceToken().pipe(Effect.flatMap((envToken) => envToken\n ? Effect.void\n : Effect.gen(function* () {\n const next = yield* configureInteractive(profileName);\n const existing = yield* profiles.getProfile(profileName);\n yield* profiles.setProfile(profileName, {\n ...existing,\n [PRISMA_AUTH_PROVIDER_NAME]: next,\n });\n })))), Match.when({ method: \"stored\" }, () => store\n .read(profileName, \"prisma-stored\")\n .pipe(Effect.flatMap((creds) => validStoredCredentials(creds)\n ? Effect.void\n : loginStored(profileName)))), Match.exhaustive)\n .pipe(Effect.mapError((e) => new AuthError({ message: \"login failed\", cause: e })));\n const logout = (profileName, config) => Match.value(config).pipe(Match.when({ method: \"env\" }, () => Effect.void), Match.when({ method: \"stored\" }, () => store\n .delete(profileName, \"prisma-stored\")\n .pipe(Effect.andThen(Clank.success(\"Prisma: stored credentials removed\")))), Match.exhaustive);\n const prettyPrint = (profileName, config) => read(profileName, config).pipe(Effect.tap((creds) => {\n const source = creds.source.details\n ? `${creds.source.type} - ${creds.source.details}`\n : creds.source.type;\n return Effect.all([\n Console.log(` serviceToken: ${displayRedacted(creds.serviceToken, 9)}`),\n Console.log(` source: ${source}`),\n ]);\n }), Effect.catch((e) => Console.error(` Failed to retrieve credentials: ${e}`)));\n return { configure, login, logout, prettyPrint, read };\n}));\n//# sourceMappingURL=AuthProvider.js.map","var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\n });\n }\n return path;\n};\nimport * as Cause from \"effect/Cause\";\nimport * as Config from \"effect/Config\";\nimport * as ConfigProvider from \"effect/ConfigProvider\";\nimport * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Logger from \"effect/Logger\";\nimport * as Option from \"effect/Option\";\nimport * as Path from \"effect/Path\";\nimport * as S from \"effect/Schema\";\nimport * as Argument from \"effect/unstable/cli/Argument\";\nimport * as CliError from \"effect/unstable/cli/CliError\";\nimport * as Flag from \"effect/unstable/cli/Flag\";\nimport { pathToFileURL } from \"node:url\";\nimport { AuthError, AuthProviders, } from \"../../Auth/AuthProvider.js\";\nimport { ALCHEMY_PROFILE, withProfileOverride, } from \"../../Auth/Profile.js\";\nimport { AwsAuth } from \"../../AWS/AuthProvider.js\";\nimport { AxiomAuth } from \"../../Axiom/AuthProvider.js\";\nimport { CloudflareAuth } from \"../../Cloudflare/Auth/AuthProvider.js\";\nimport { GitHubAuth } from \"../../GitHub/AuthProvider.js\";\nimport { HetznerAuth } from \"../../Hetzner/AuthProvider.js\";\nimport { NeonAuth } from \"../../Neon/AuthProvider.js\";\nimport { PlanetscaleAuth } from \"../../Planetscale/AuthProvider.js\";\nimport { PrismaAuth } from \"../../Prisma/AuthProvider.js\";\nimport * as Stack from \"../../Stack.js\";\nimport { Stage } from \"../../Stage.js\";\nimport { recordCli } from \"../../Telemetry/Metrics.js\";\nimport { PromptCancelled } from \"../../Util/Clank.js\";\nimport { loadConfigProvider } from \"../../Util/ConfigProvider.js\";\nimport { fileLogger } from \"../../Util/FileLogger.js\";\nexport const USER = Config.string(\"USER\").pipe(Config.orElse(() => Config.string(\"USERNAME\")), Config.withDefault(\"unknown\"));\nexport const STAGE = Config.string(\"STAGE\").pipe(Config.option, (a) => a, Effect.map(Option.getOrUndefined));\n/**\n * `true` if `e` is a {@link PromptCancelled}, or an {@link AuthError} whose\n * `cause` chain bottoms out in one. Schema-tagged errors don't always\n * survive `instanceof` across module boundaries, so we also accept any\n * object whose `_tag` matches.\n */\nconst isPromptCancellation = (e) => {\n for (let cur = e, i = 0; cur != null && i < 16; i++) {\n if (cur instanceof PromptCancelled)\n return true;\n if (typeof cur === \"object\" &&\n cur._tag === \"PromptCancelled\") {\n return true;\n }\n if (cur instanceof AuthError ||\n (typeof cur === \"object\" &&\n cur._tag === \"AuthError\")) {\n cur = cur.cause;\n continue;\n }\n return false;\n }\n return false;\n};\n/**\n * Catches user cancellations (Ctrl+C inside a prompt, surfaced as\n * {@link PromptCancelled} or wrapped in an {@link AuthError}) and exits\n * the CLI cleanly with a friendly message instead of dumping a stack\n * trace.\n */\nexport const handleCancellation = (self) => self.pipe(Effect.catchCause((cause) => {\n const cancelled = cause.reasons.some((r) => {\n if (Cause.isFailReason(r))\n return isPromptCancellation(r.error);\n if (Cause.isDieReason(r))\n return isPromptCancellation(r.defect);\n return false;\n });\n return cancelled\n ? Console.log(\"\\nCancelled.\")\n : Effect.failCause(cause);\n}), \n// A bare fiber interrupt (Ctrl+C while not inside a prompt) shouldn't\n// dump a stack trace either.\nEffect.onInterrupt(() => Console.log(\"\\nInterrupted.\")));\nexport const stage = Flag.string(\"stage\").pipe(Flag.withSchema(S.String.check(S.isPattern(/^[a-z0-9]+([-_a-z0-9]+)*$/gi))), Flag.withDescription(\"Stage to deploy to, defaults to dev_${USER}\"), Flag.optional, Flag.map(Option.getOrUndefined), Flag.mapEffect(Effect.fn(function* (stage) {\n if (stage) {\n return stage;\n }\n return yield* STAGE.pipe(Effect.catch(() => Effect.fail(new CliError.MissingOption({\n option: \"stage\",\n }))), Effect.flatMap((s) => s === undefined\n ? USER.pipe(Effect.map((user) => `dev_${user}`), Effect.catch(() => Effect.succeed(\"unknown\")))\n : Effect.succeed(s)));\n})));\nexport const envFile = Flag.file(\"env-file\").pipe(Flag.optional, Flag.withDescription(\"File to load environment variables from, defaults to .env\"));\nexport const dryRun = Flag.boolean(\"dry-run\").pipe(Flag.withDescription(\"Dry run the deployment, do not actually deploy\"), Flag.withDefault(false));\nexport const yes = Flag.boolean(\"yes\").pipe(Flag.withDescription(\"Yes to all prompts\"), Flag.withDefault(false));\nexport const force = Flag.boolean(\"force\").pipe(Flag.withDescription(\"Force updates for resources that would otherwise no-op\"), Flag.withDefault(false));\nexport const script = Argument.file(\"main\", {\n mustExist: true,\n}).pipe(Argument.withDescription(\"Main file to deploy, defaults to alchemy.run.ts\"), Argument.withDefault(\"alchemy.run.ts\"));\nexport const profile = Flag.string(\"profile\").pipe(Flag.withDescription(\"Auth profile to use (~/.alchemy/profiles.json). Defaults to $ALCHEMY_PROFILE or 'default'.\"), Flag.optional, Flag.mapEffect(Effect.fn(function* (profile) {\n // --profile wins; otherwise fall back to $ALCHEMY_PROFILE (which\n // itself defaults to \"default\"). Without this, the flag's default\n // would shadow the env var via withProfileOverride.\n if (Option.isSome(profile)) {\n return profile.value;\n }\n return yield* ALCHEMY_PROFILE.pipe(Effect.catch(() => Effect.succeed(\"default\")));\n})));\nexport const resourceFilter = Flag.string(\"filter\").pipe(Flag.withDescription(\"Comma-separated logical resource IDs (e.g. Api,Sandbox). Only those resources are included.\"), Flag.optional, Flag.map(Option.getOrUndefined));\nexport const TAIL_COLORS = [\n \"\\x1b[36m\", // cyan\n \"\\x1b[35m\", // magenta\n \"\\x1b[33m\", // yellow\n \"\\x1b[32m\", // green\n \"\\x1b[34m\", // blue\n \"\\x1b[91m\", // bright red\n \"\\x1b[96m\", // bright cyan\n \"\\x1b[95m\", // bright magenta\n \"\\x1b[93m\", // bright yellow\n \"\\x1b[92m\", // bright green\n];\nexport const TAIL_RESET = \"\\x1b[0m\";\nexport const formatLocalTimestamp = (date) => {\n const y = date.getFullYear();\n const mo = String(date.getMonth() + 1).padStart(2, \"0\");\n const d = String(date.getDate()).padStart(2, \"0\");\n const h = String(date.getHours()).padStart(2, \"0\");\n const mi = String(date.getMinutes()).padStart(2, \"0\");\n const s = String(date.getSeconds()).padStart(2, \"0\");\n const ms = String(date.getMilliseconds()).padStart(3, \"0\");\n const tz = new Intl.DateTimeFormat(\"en-US\", { timeZoneName: \"short\" })\n .formatToParts(date)\n .find((p) => p.type === \"timeZoneName\")?.value ?? \"\";\n return `${y}-${mo}-${d} ${h}:${mi}:${s}.${ms} ${tz}`;\n};\nexport const parseResourceFilter = (filter) => {\n if (filter === undefined)\n return undefined;\n const ids = filter\n .split(\",\")\n .map((s) => s.trim())\n .filter((s) => s.length > 0);\n if (ids.length === 0)\n return undefined;\n return new Set(ids);\n};\nexport const parseSince = (value) => {\n const match = value.match(/^(\\d+)([smhd])$/);\n if (match) {\n const num = parseInt(match[1], 10);\n const unit = match[2];\n const ms = unit === \"s\"\n ? num * 1000\n : unit === \"m\"\n ? num * 60_000\n : unit === \"h\"\n ? num * 3_600_000\n : num * 86_400_000;\n return new Date(Date.now() - ms);\n }\n const parsed = new Date(value);\n if (isNaN(parsed.getTime())) {\n throw new Error(`Invalid --since value: '${value}'. Use a duration (e.g. '1h', '30m') or ISO date.`);\n }\n return parsed;\n};\n/**\n * Wraps a CLI command handler with a top-level OpenTelemetry span\n * (`cli.<command>`) and bumps the `alchemy.cli.invocations` counter.\n *\n * `attrs` runs against the parsed command args and contributes\n * additional attributes to the span (e.g. stage, profile, dry-run flag).\n *\n * Usage:\n * ```ts\n * Command.make(\n * \"deploy\",\n * { ...flags },\n * instrumentCommand(\"deploy\", (a) => ({\n * \"alchemy.stage\": a.stage,\n * \"alchemy.profile\": a.profile,\n * }))(execStack),\n * );\n * ```\n */\nexport const instrumentCommand = (command, attrs) => (handler) => (args) => handler(args).pipe(Effect.withSpan(`cli.${command}`, {\n attributes: attrs ? attrs(args) : {},\n}), recordCli(command));\n/**\n * Render a profile's stored credential entries the same way across\n * `alchemy login` and `alchemy profile show`: one `── Provider ──`\n * header per entry, then either the provider's own `prettyPrint` block\n * (preferred) or a JSON-style fallback when the provider isn't\n * registered in the supplied {@link AuthProviders} registry.\n */\nexport const printProfile = Effect.fn(function* (profile, stored, registry) {\n yield* Console.log(`Profile: ${profile}`);\n const names = Object.keys(stored).sort();\n if (names.length === 0) {\n yield* Console.log(\"(no providers configured)\");\n return;\n }\n for (const name of names) {\n const cfg = stored[name];\n yield* Console.log(\"\");\n yield* Console.log(`── ${name} ──`);\n const provider = registry[name];\n if (provider == null) {\n yield* Console.log(` method: ${cfg.method}`);\n const { method: _method, ...rest } = cfg;\n for (const [k, v] of Object.entries(rest)) {\n yield* Console.log(` ${k}: ${typeof v === \"string\" ? v : JSON.stringify(v)}`);\n }\n continue;\n }\n // A provider's `prettyPrint` catches its own credential-resolution\n // failures, but some resolve paths `Effect.orDie` (e.g. AWS SSO with an\n // expired token), which escapes as a defect. Contain it here — via\n // `Console.log` so the message stays on stdout under this provider's\n // header instead of interleaving on stderr — so one broken provider\n // can't abort rendering the rest of the profile.\n yield* provider.prettyPrint(profile, cfg).pipe(Effect.catchCause((cause) => {\n const error = Cause.squash(cause);\n const message = error instanceof Error ? error.message : String(error);\n return Console.log(` Failed to retrieve credentials: ${message}`);\n }));\n }\n});\nexport const importStack = Effect.fn(function* (main) {\n const path = yield* Path.Path;\n // Build a `file://` URL from the absolute path. `import.meta.resolve` expects a\n // module specifier / URL, not a raw filesystem path: on Windows an absolute\n // path like `D:\\stack.ts` is not a valid specifier and fails to resolve, so the\n // CLI cannot load the user's stack. `pathToFileURL` produces a valid URL on\n // every platform.\n const url = pathToFileURL(path.resolve(main)).href;\n const module = yield* Effect.promise(() => import(__rewriteRelativeImportExtension(url)));\n const stackEffect = module.default;\n if (!Effect.isEffect(stackEffect)) {\n return yield* Effect.die(new Error(`Main file '${main}' must export a default stack definition (export default Alchemy.Stack({...}))`));\n }\n return stackEffect;\n});\n/**\n * Placeholder {@link Stack.Stack} value used while building a stack's\n * `providers()` layer out of band. No real resources exist yet — we only\n * want the layer's provider/auth registrations and cloud-environment\n * services, so `resources`/`bindings`/`actions` are empty and the stage is a\n * sentinel.\n */\nconst placeholderStack = (name) => ({\n actions: {},\n bindings: {},\n name,\n resources: {},\n stage: \"placeholder\",\n});\n/**\n * Import a stack entrypoint and build its `providers()` (+ `state()`) layer\n * out of band against placeholder {@link Stack.Stack}/{@link Stage} services,\n * so its `AuthProviderLayer` registrations land in an {@link AuthProviders}\n * registry and the built context holds every resource provider plus the\n * cloud-environment services their operations need.\n *\n * Shared by `alchemy login`, `alchemy profile show`, and `alchemy unsafe\n * nuke`. The caller decides what to do with the result — use `authProviders`\n * (login / profile show) or `context` (nuke) — and whether a missing/invalid\n * entrypoint is fatal (login / nuke let it propagate) or best-effort\n * (profile show wraps the call in `Effect.catchCause`).\n */\nexport const buildStackProviders = Effect.fn(\"buildStackProviders\")(function* (options) {\n const authProviders = options.registry ?? {};\n const stackEffect = yield* importStack(options.main);\n const configProvider = withProfileOverride(yield* loadConfigProvider(options.envFile), options.profile);\n const context = yield* Layer.build((stackEffect.providers ?? Layer.empty).pipe(Layer.provideMerge(stackEffect.state ?? Layer.empty), Layer.provideMerge(Layer.mergeAll(Layer.succeed(AuthProviders, authProviders), ConfigProvider.layer(configProvider), options.logger ??\n Logger.layer([fileLogger(\"out\")], { mergeWithExisting: true }), Layer.succeed(Stage, \"placeholder\"), Layer.succeed(Stack.Stack, placeholderStack(stackEffect.stackName)), options.extra ?? Layer.empty))));\n return { authProviders, context, stackEffect };\n});\n/**\n * The auth providers Alchemy ships with. Used as the baseline registry so\n * `alchemy login` works from any folder (no `alchemy.run.ts` required) and\n * `alchemy profile show` can pretty-print any provider a profile mentions,\n * even one the current stack doesn't wire up.\n */\nexport const builtinAuth = Layer.mergeAll(AwsAuth, AxiomAuth, CloudflareAuth, GitHubAuth, HetznerAuth, NeonAuth, PlanetscaleAuth, PrismaAuth);\n/**\n * Build {@link builtinAuth} against `registry` so every built-in auth\n * provider registers itself, without importing any stack entrypoint.\n */\nexport const buildBuiltinAuthProviders = Effect.fn(\"buildBuiltinAuthProviders\")(function* (options) {\n const authProviders = options.registry ?? {};\n yield* Layer.build(Layer.provide(builtinAuth, Layer.mergeAll(Layer.succeed(AuthProviders, authProviders), ConfigProvider.layer(withProfileOverride(yield* loadConfigProvider(options.envFile), options.profile)), Logger.layer([fileLogger(\"out\")], { mergeWithExisting: true }))));\n return authProviders;\n});\n//# sourceMappingURL=_shared.js.map","import * as Cause from \"effect/Cause\";\nimport * as ConfigProvider from \"effect/ConfigProvider\";\nimport * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Logger from \"effect/Logger\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\nimport * as Command from \"effect/unstable/cli/Command\";\nimport * as Flag from \"effect/unstable/cli/Flag\";\nimport * as GlobalFlag from \"effect/unstable/cli/GlobalFlag\";\nimport { AdoptPolicy } from \"../../AdoptPolicy.js\";\nimport { AlchemyContext } from \"../../AlchemyContext.js\";\nimport { apply } from \"../../Apply.js\";\nimport { ArtifactStore, createArtifactStore } from \"../../Artifacts.js\";\nimport { AuthProviders } from \"../../Auth/AuthProvider.js\";\nimport { withProfileOverride } from \"../../Auth/Profile.js\";\nimport * as CLI from \"../../Cli/Cli.js\";\nimport * as Plan from \"../../Plan.js\";\nimport { Stage } from \"../../Stage.js\";\nimport { isTelemetryDisabled } from \"../../Telemetry/Attributes.js\";\nimport { loadConfigProvider } from \"../../Util/ConfigProvider.js\";\nimport { fileLogger } from \"../../Util/FileLogger.js\";\nimport { dryRun as dryRunFlag, envFile, force, importStack, instrumentCommand, profile, script, stage, yes, } from \"./_shared.js\";\nexport const ExecStackOptions = Schema.Struct({\n main: Schema.String,\n stage: Schema.String,\n envFile: Schema.OptionFromOptional(Schema.String),\n profile: Schema.optional(Schema.String),\n dryRun: Schema.optional(Schema.Boolean),\n force: Schema.optional(Schema.Boolean),\n yes: Schema.optional(Schema.Boolean),\n destroy: Schema.optional(Schema.Boolean),\n dev: Schema.optional(Schema.Boolean),\n adopt: Schema.optional(Schema.Boolean),\n});\nconst stackSpanAttrs = (args) => ({\n \"alchemy.stage\": args.stage,\n \"alchemy.profile\": args.profile,\n \"alchemy.main\": args.main,\n \"alchemy.dry_run\": !!args.dryRun,\n \"alchemy.force\": !!args.force,\n \"alchemy.destroy\": !!args.destroy,\n \"alchemy.dev\": !!args.dev,\n \"alchemy.adopt\": !!args.adopt,\n});\nconst adopt = Flag.boolean(\"adopt\").pipe(Flag.withDescription(\"Adopt pre-existing cloud resources that conflict with this stack instead of failing. \" +\n \"Useful for re-importing infrastructure into a fresh state store.\"), Flag.withDefault(false));\nconst runStack = Effect.fn(function* ({ main, stage, envFile, profile, dryRun = false, force = false, yes = false, destroy = false, dev = false, adopt = false, }) {\n const stackEffect = yield* importStack(main);\n // `--log-level <x>` has to actually put log records on the user's\n // terminal. With telemetry on (the default) `TelemetryLive` deliberately\n // drops the console logger, so every record lands in `.alchemy/log/out`\n // and nothing reaches stderr — which is how a stalled deploy produced ten\n // minutes of `--log-level debug` and zero bytes of output (#1231). Re-add\n // a console sink for that run only. With telemetry off the default\n // console logger is still in the set, and adding a second would\n // double-print every line.\n const askedForLogs = Option.isSome(Option.flatten(yield* Effect.serviceOption(GlobalFlag.LogLevel)));\n const consoleSink = askedForLogs && !(yield* isTelemetryDisabled)\n ? [Logger.consolePretty()]\n : [];\n const services = Layer.mergeAll(Layer.effect(AlchemyContext, AlchemyContext.pipe(Effect.map((ctx) => ({\n ...ctx,\n dev,\n adopt,\n // `--yes` also auto-accepts (and performs) an out-of-date state\n // store upgrade, instead of prompting.\n updateStateStore: yes,\n })))), \n // `--adopt` opts the entire deploy in to adoption-on-conflict.\n // Resource providers that wire `AdoptPolicy` (Worker domains,\n // Cloudflare.SecretsStore, etc.) will reconcile against\n // pre-existing cloud resources instead of failing on duplicates.\n // Default is `false` so an unintentional collision still surfaces\n // loudly.\n Layer.succeed(AdoptPolicy, adopt), Layer.succeed(ArtifactStore, createArtifactStore()), Layer.succeed(AuthProviders, yield* Effect.serviceOption(AuthProviders).pipe(Effect.map(Option.getOrElse(() => ({}))))), ConfigProvider.layer(withProfileOverride(yield* loadConfigProvider(envFile), profile)), Logger.layer([fileLogger(\"out\"), ...consoleSink], {\n mergeWithExisting: true,\n }), Layer.succeed(Stage, stage));\n yield* Effect.gen(function* () {\n const cli = yield* CLI.Cli;\n const stack = yield* stackEffect;\n yield* Effect.gen(function* () {\n const updatePlan = destroy\n ? yield* Plan.destroy(stack)\n : yield* Plan.make(stack, { force });\n if (dryRun) {\n yield* cli.displayPlan(updatePlan);\n }\n else {\n const hasChanges = Object.keys(updatePlan.deletions).length > 0 ||\n Object.values(updatePlan.resources).some((node) => node.action !== \"noop\" ||\n node.bindings.some((b) => b.action !== \"noop\"));\n if (!yes && hasChanges) {\n const approved = yield* cli.approvePlan(updatePlan);\n if (!approved) {\n return;\n }\n }\n // Smoke-test kill switch: `ALCHEMY_DEV_ONCE=1 alchemy dev` exits after\n // the first apply instead of keeping the dev session alive — apply\n // failures propagate (non-zero exit) instead of being swallowed, so\n // scripts and CI can assert \"dev deploys cleanly\" without a timeout.\n const devOnce = dev &&\n (process.env.ALCHEMY_DEV_ONCE === \"1\" ||\n process.env.ALCHEMY_DEV_ONCE === \"true\");\n // In dev, a failed apply must not drain the keep-alive below:\n // `alchemy dev` runs under `bun --watch`, which cancels watch mode\n // entirely on a clean exit (oven-sh/bun#10983), so completing here\n // would tear down every healthy local resource along with the failed\n // one. Swallow apply failures (logging the full cause, since the TUI\n // renderer only shows the failure status) so the keep-alive engages\n // and the rest of the stack keeps serving, but re-propagate a pure\n // interruption (Ctrl-C / fiber kill) so dev still shuts down cleanly.\n const applyPlan = dev && !devOnce\n ? apply(updatePlan).pipe(Effect.catchCause((cause) => Cause.hasInterruptsOnly(cause)\n ? Effect.failCause(cause)\n : Console.error(`alchemy dev: apply failed; keeping dev alive so healthy resources keep serving.\\n${Cause.pretty(cause)}`).pipe(Effect.as(undefined))))\n : apply(updatePlan);\n const outputs = yield* applyPlan;\n if (outputs !== undefined) {\n yield* Console.log(outputs);\n }\n if (dev) {\n if (devOnce) {\n return;\n }\n return yield* Effect.never;\n }\n }\n }).pipe(Effect.provide(stack.services));\n }).pipe(Effect.provide(services));\n});\n// In dev, failures OUTSIDE the apply guard above must not exit the process\n// either: the user saves mid-edit states where importing the stack module\n// itself throws (missing export, module-evaluation crash), or planning fails\n// against the half-edited program. Those failures escape `runStack` before\n// the apply-level guard exists, and exiting here kills the `--watch` session\n// (oven-sh/bun#10983), so dev would stop reloading on subsequent saves. Log\n// the cause and park forever; the watcher restarts the run on the next file\n// change. Pure interruption (Ctrl-C / fiber kill) still propagates so dev\n// shuts down cleanly.\nexport const devKeepAlive = (effect) => effect.pipe(Effect.catchCause((cause) => Cause.hasInterruptsOnly(cause)\n ? Effect.failCause(cause)\n : Console.error(`alchemy dev: run failed; waiting for the next file change to retry.\\n${Cause.pretty(cause)}`).pipe(Effect.andThen(Effect.never))));\nexport const execStack = (options) => options.dev ? devKeepAlive(runStack(options)) : runStack(options);\nexport const deployCommand = Command.make(\"deploy\", {\n dryRun: dryRunFlag,\n force,\n main: script,\n envFile,\n stage,\n yes,\n profile,\n adopt,\n}, instrumentCommand(\"deploy\", stackSpanAttrs)(execStack));\nexport const destroyCommand = Command.make(\"destroy\", {\n dryRun: dryRunFlag,\n main: script,\n envFile,\n stage,\n yes,\n profile,\n}, instrumentCommand(\"destroy\", stackSpanAttrs)((args) => execStack({\n ...args,\n destroy: true,\n})));\nexport const planCommand = Command.make(\"plan\", {\n main: script,\n envFile,\n stage,\n profile,\n}, instrumentCommand(\"plan\", stackSpanAttrs)((args) => execStack({\n ...args,\n // plan is the same as deploy with dryRun always set to true\n dryRun: true,\n})));\n//# sourceMappingURL=deploy.js.map","/**\n * Pure formatting shared by the plan/deploy renderers (Ink TUI +\n * non-interactive LoggingCli) for the local-vs-live provider-mode\n * indicator on a resource row.\n *\n * The rule: in a dev run every mode-stamped row shows its mode — the\n * whole point of `alchemy dev` is knowing what is emulated and what is\n * real, so `(local)` and `(remote)` are both explicit. A live deploy\n * only tags the exceptions (`local` leftovers from dev being\n * deleted/replaced) — tagging every row `remote` in a normal deploy\n * would be noise.\n *\n * - `alchemy dev` (default `\"local\"`): local rows are tagged `local`,\n * live rows are tagged `remote` — matching the `Alchemy.remote()`\n * vocabulary users see. The persisted enum stays `\"live\"`; only the\n * display says `remote`.\n * - `alchemy deploy` (default `\"live\"`): rows resolved to the local\n * provider are tagged `local`; live rows are untagged.\n * - Mode-agnostic providers have no resolved mode (`undefined`) — nothing\n * is shown.\n * - Mode-switch replacements ALWAYS annotate the transition\n * (e.g. `local → live`), regardless of the run default.\n */\n/** The display label for a mode-stamped row (`\"live\"` renders as `remote`). */\nexport const modeLabel = (mode) => mode === \"live\" ? \"remote\" : \"local\";\n/**\n * The mode note for a resource row, or `undefined` when nothing should be\n * shown (mode-agnostic rows, and live rows in a live-default run).\n *\n * @param mode the mode the node's provider was resolved for (`undefined`\n * for mode-agnostic providers — never annotated)\n * @param priorMode for replacements, the mode the old generation was\n * created with; when it differs from `mode` the transition is shown\n * @param defaultMode the run-level default (`alchemy dev` → `\"local\"`,\n * otherwise `\"live\"`); `undefined` is treated as `\"live\"`\n */\nexport const formatModeNote = (options) => {\n const { mode, priorMode } = options;\n if (mode === undefined)\n return undefined;\n // A genuine mode switch is always surfaced as the raw transition.\n if (priorMode !== undefined && priorMode !== mode) {\n return `${priorMode} → ${mode}`;\n }\n const defaultMode = options.defaultMode ?? \"live\";\n // Live-default runs stay quiet for live rows; dev runs tag everything.\n if (defaultMode === \"live\" && mode === \"live\")\n return undefined;\n return modeLabel(mode);\n};\n//# sourceMappingURL=ModeTag.js.map","import * as Console from \"effect/Console\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { Cli } from \"./Cli.js\";\nimport { formatModeNote } from \"./ModeTag.js\";\nconst ESC = \"\\x1b[\";\nconst RESET = `${ESC}0m`;\nconst useColor = process.stdout.hasColors?.() ?? !!process.stdout.isTTY;\nconst c = (code, s) => useColor ? `${ESC}${code}m${s}${RESET}` : s;\nconst dim = (s) => c(\"2\", s);\nconst bold = (s) => c(\"1\", s);\nconst red = (s) => c(\"31\", s);\nconst green = (s) => c(\"32\", s);\nconst yellow = (s) => c(\"33\", s);\nconst blue = (s) => c(\"34\", s);\nconst magenta = (s) => c(\"35\", s);\nconst cyan = (s) => c(\"36\", s);\nconst actionColor = {\n create: green,\n update: yellow,\n replace: magenta,\n delete: red,\n noop: dim,\n};\nconst statusColor = (status) => {\n switch (status) {\n case \"created\":\n case \"updated\":\n case \"replaced\":\n return green;\n case \"deleted\":\n return dim;\n case \"retained\":\n return dim;\n case \"fail\":\n return red;\n case \"attaching\":\n case \"post-attach\":\n return cyan;\n default:\n return yellow;\n }\n};\nconst tag = (id) => bold(`[${id}]`);\nconst isTerminal = (status) => status === \"created\" ||\n status === \"updated\" ||\n status === \"deleted\" ||\n status === \"retained\" ||\n status === \"replaced\" ||\n status === \"fail\";\n/**\n * Dim `(local)` / `(remote)` / `(local → live)` suffix for a resource row,\n * or `\"\"` when the row's mode matches the run default (the quiet common\n * case). See {@link formatModeNote} for the rule.\n */\nconst modeSuffix = (options) => {\n const note = formatModeNote(options);\n return note ? ` ${dim(`(${note})`)}` : \"\";\n};\n/** Exported for unit tests — pure plan-preview rendering. */\nexport const formatPlanLines = (plan) => {\n const items = [\n ...Object.values(plan.resources),\n ...Object.values(plan.deletions),\n ];\n if (items.length === 0)\n return [bold(\"Plan:\") + \" no changes\"];\n const counts = items.reduce((acc, item) => ((acc[item.action] = (acc[item.action] ?? 0) + 1), acc), {});\n const summary = [\"create\", \"update\", \"replace\", \"delete\", \"noop\"]\n .filter((a) => counts[a])\n .map((a) => actionColor[a](`${counts[a]} to ${a}`))\n .join(dim(\", \"));\n const sorted = [...items].sort((a, b) => a.resource.LogicalId.localeCompare(b.resource.LogicalId));\n const lines = [`${bold(\"Plan:\")} ${summary}`];\n for (const item of sorted) {\n const action = actionColor[item.action](item.action);\n const mode = modeSuffix({\n mode: item.mode,\n priorMode: item.action === \"replace\" ? item.state.providerMode : undefined,\n defaultMode: plan.defaultMode,\n });\n // Surface FQN migrations: `[Assets] update (renamed from Bucket)` —\n // the update exists to re-brand the moved row's physical resource, and\n // without the note the plan gives no hint why an untouched resource\n // reconciles. (Only apply-side nodes can carry a rename — see\n // `ApplyNodeBase`.)\n const renamed = item.action !== \"delete\" && item.renamedFrom?.length\n ? ` ${dim(`(renamed from ${item.renamedFrom.join(\", \")})`)}`\n : \"\";\n lines.push(`${tag(item.resource.LogicalId)} ${action}${mode}${renamed}`);\n for (const binding of item.bindings) {\n if (binding.action === \"noop\")\n continue;\n const bindingAction = actionColor[binding.action](binding.action);\n lines.push(`${tag(`${item.resource.LogicalId}/${binding.sid}`)} ${bindingAction}`);\n }\n }\n return lines;\n};\nexport const LoggingCli = Layer.succeed(Cli, Cli.of({\n approvePlan: (plan) => Effect.gen(function* () {\n for (const line of formatPlanLines(plan))\n yield* Console.log(line);\n yield* Console.log(`\\n${yellow(\"Non-interactive terminal detected.\")} Pass ${bold(\"--yes\")} to approve, or set ${bold(\"ALCHEMY_TUI=1\")} for the interactive UI.`);\n return false;\n }),\n displayPlan: (plan) => Effect.gen(function* () {\n for (const line of formatPlanLines(plan))\n yield* Console.log(line);\n }),\n startApplySession: (plan) => Effect.gen(function* () {\n for (const line of formatPlanLines(plan))\n yield* Console.log(line);\n yield* Console.log(\"\");\n const counts = { ok: 0, fail: 0 };\n return {\n // Write through the Effect Console SERVICE (not the global\n // `console`) so environments that override it — e.g. the\n // alchemy-test runner's per-test buffering console — capture\n // apply progress instead of having it leak to stdout.\n emit: (event) => Effect.suspend(() => {\n if (event.kind === \"annotate\") {\n return Console.log(`${tag(event.id)} ${blue(event.message)}`);\n }\n const id = event.bindingId\n ? `${event.id}/${event.bindingId}`\n : event.id;\n const status = statusColor(event.status)(event.status);\n const mode = modeSuffix({\n mode: event.providerMode,\n priorMode: event.fromProviderMode,\n defaultMode: plan.defaultMode,\n });\n const msg = event.message ? ` ${dim(\"—\")} ${event.message}` : \"\";\n if (isTerminal(event.status)) {\n if (event.status === \"fail\")\n counts.fail++;\n else\n counts.ok++;\n }\n return Console.log(`${tag(id)} ${status}${mode}${msg}`);\n }),\n done: () => Console.log(`\\n${bold(\"Done:\")} ${green(`${counts.ok} succeeded`)}${counts.fail ? dim(\", \") + red(`${counts.fail} failed`) : \"\"}`),\n };\n }),\n}));\n//# sourceMappingURL=LoggingCli.js.map","import { toPath } from \"../FQN.js\";\nexport function buildNamespaceTree(items, actions = []) {\n const root = {\n id: \"\",\n path: [],\n children: new Map(),\n resources: [],\n actions: [],\n };\n const getNode = (path) => {\n let current = root;\n for (let i = 0; i < path.length; i++) {\n const segment = path[i];\n let child = current.children.get(segment);\n if (!child) {\n child = {\n id: segment,\n path: path.slice(0, i + 1),\n children: new Map(),\n resources: [],\n actions: [],\n };\n current.children.set(segment, child);\n }\n current = child;\n }\n return current;\n };\n for (const item of items) {\n getNode(toPath(item.resource.Namespace)).resources.push(item);\n }\n for (const action of actions) {\n getNode(toPath(action.def.Namespace)).actions.push(action);\n }\n return root;\n}\nexport function deriveNamespaceAction(node) {\n const actions = new Set();\n for (const resource of node.resources) {\n actions.add(deriveResourceChildrenAction(resource, node));\n }\n for (const action of node.actions) {\n // Map task actions onto the resource action space for the rollup:\n // run → create, delete → delete, noop → noop.\n actions.add(action.action === \"run\"\n ? \"create\"\n : action.action === \"delete\"\n ? \"delete\"\n : \"noop\");\n }\n for (const child of node.children.values()) {\n const childAction = deriveNamespaceAction(child);\n if (childAction === \"mixed\") {\n return \"mixed\";\n }\n actions.add(childAction);\n }\n return deriveAction(actions);\n}\nexport function flattenTree(node, depth = 0, result = []) {\n flattenNamespace(node, depth, result);\n return result;\n}\nconst flattenNamespace = (node, depth, result) => {\n const sortedResources = [...node.resources].sort((a, b) => a.resource.LogicalId.localeCompare(b.resource.LogicalId));\n const sortedChildren = Array.from(node.children.entries()).sort(([a], [b]) => a.localeCompare(b));\n const resourceIds = new Set(sortedResources.map((resource) => resource.resource.LogicalId));\n for (const [id, child] of sortedChildren) {\n if (resourceIds.has(id) || isEmpty(child)) {\n continue;\n }\n result.push({\n type: \"namespace\",\n depth,\n id,\n path: child.path,\n action: deriveNamespaceAction(child),\n hasChildren: true,\n });\n flattenNamespace(child, depth + 1, result);\n }\n for (const resource of sortedResources) {\n const childNamespace = node.children.get(resource.resource.LogicalId);\n result.push({\n type: \"resource\",\n depth,\n id: resource.resource.LogicalId,\n path: [...node.path, resource.resource.LogicalId],\n action: resource.action,\n resourceType: resource.resource.Type,\n bindingCount: resource.bindings.length,\n providerMode: resource.mode,\n fromProviderMode: resource.action === \"replace\" &&\n resource.mode !== undefined &&\n resource.state.providerMode !== undefined &&\n resource.state.providerMode !== resource.mode\n ? resource.state.providerMode\n : undefined,\n });\n for (const binding of [...resource.bindings].sort((a, b) => a.sid.localeCompare(b.sid))) {\n result.push({\n type: \"binding\",\n depth: depth + 1,\n id: binding.sid,\n path: [...node.path, resource.resource.LogicalId, binding.sid],\n action: binding.action,\n bindingSid: binding.sid,\n });\n }\n if (childNamespace) {\n flattenNamespace(childNamespace, depth + 1, result);\n }\n }\n // Actions are listed after resources at the same depth.\n const sortedActions = [...node.actions].sort((a, b) => a.def.LogicalId.localeCompare(b.def.LogicalId));\n for (const action of sortedActions) {\n result.push({\n type: \"action\",\n depth,\n id: action.def.LogicalId,\n path: [...node.path, action.def.LogicalId],\n action: action.action,\n actionType: action.def.Type,\n });\n }\n};\nconst isEmpty = (node) => node.resources.length === 0 &&\n node.actions.length === 0 &&\n Array.from(node.children.values()).every(isEmpty);\nconst countVisibleChildren = (node) => {\n const resourceIds = new Set(node.resources.map((resource) => resource.resource.LogicalId));\n return (node.resources.length +\n Array.from(node.children.keys()).filter((id) => !resourceIds.has(id)).length);\n};\nconst deriveResourceChildrenAction = (resource, node) => {\n const actions = new Set([\n resource.action,\n ]);\n for (const binding of resource.bindings) {\n actions.add(binding.action);\n }\n const childNamespace = node.children.get(resource.resource.LogicalId);\n if (childNamespace) {\n actions.add(deriveNamespaceAction(childNamespace));\n }\n return deriveAction(actions);\n};\nconst deriveAction = (actions) => {\n if (actions.size === 0)\n return \"noop\";\n if (actions.has(\"replace\"))\n return actions.size === 1 ? \"replace\" : \"mixed\";\n if (actions.has(\"delete\"))\n return actions.size === 1 ? \"delete\" : \"mixed\";\n if (actions.has(\"create\"))\n return actions.size === 1 ? \"create\" : \"mixed\";\n if (actions.has(\"update\"))\n return actions.size === 1 ? \"update\" : \"mixed\";\n return \"noop\";\n};\n//# sourceMappingURL=NamespaceTree.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n/** @jsxImportSource react */\nimport { useMemo } from \"react\";\nimport { Box, Text } from \"ink\";\nimport { buildNamespaceTree, flattenTree, } from \"../../NamespaceTree.js\";\nimport { formatModeNote } from \"../../ModeTag.js\";\nexport function Plan({ plan }) {\n const items = useMemo(() => [\n ...Object.values(plan.resources),\n ...Object.values(plan.deletions),\n ], [plan]);\n const taskItems = useMemo(() => [\n ...Object.values(plan.actions ?? {}),\n ...Object.values(plan.actionDeletions ?? {}),\n ].filter((t) => t !== undefined), [plan]);\n const flatItems = useMemo(() => {\n const tree = buildNamespaceTree(items, taskItems);\n return flattenTree(tree);\n }, [items, taskItems]);\n if (items.length === 0 && taskItems.length === 0) {\n return _jsx(Text, { color: \"gray\", children: \"No changes planned\" });\n }\n const counts = items.reduce((acc, item) => (acc[item.action]++, acc), {\n create: 0,\n update: 0,\n delete: 0,\n noop: 0,\n replace: 0,\n });\n const taskCounts = taskItems.reduce((acc, item) => (acc[item.action]++, acc), { run: 0, noop: 0, delete: 0 });\n const actions = [\"create\", \"update\", \"delete\", \"replace\"].filter((action) => counts[action] > 0);\n const taskHeaderEntries = [\n taskCounts.run > 0 ? `${taskCounts.run} to run` : undefined,\n taskCounts.delete > 0 ? `${taskCounts.delete} to drop` : undefined,\n ].filter((s) => !!s);\n return (_jsxs(Box, { flexDirection: \"column\", children: [_jsxs(Box, { marginTop: 1, children: [_jsx(Text, { underline: true, children: \"Plan\" }), _jsx(Text, { children: \": \" }), [\n ...actions.map((action) => {\n const count = counts[action];\n const color = actionColor(action);\n return (_jsx(Box, { children: _jsxs(Text, { color: color, children: [count, \" to \", action] }) }, action));\n }),\n ...taskHeaderEntries.map((label, i) => (_jsx(Box, { children: _jsx(Text, { color: \"cyan\", children: label }) }, `task-${i}`))),\n ].flatMap((box, i, arr) => i === arr.length - 1\n ? [box]\n : [box, _jsx(Text, { children: \" | \" }, `sep-${i}`)])] }), _jsx(Box, { flexDirection: \"column\", marginTop: 1, children: flatItems.map((item) => {\n const indent = \" \".repeat(item.depth);\n const color = getActionColor(item.action);\n const icon = getActionIcon(item.action);\n const key = item.path.join(\"/\");\n if (item.type === \"namespace\") {\n return (_jsxs(Box, { flexDirection: \"row\", children: [_jsx(Text, { children: indent }), _jsx(Box, { width: 2, children: _jsxs(Text, { color: color, children: [icon, \" \"] }) }), _jsx(Text, { color: \"blueBright\", children: item.id })] }, key));\n }\n if (item.type === \"binding\") {\n return (_jsxs(Box, { flexDirection: \"row\", children: [_jsx(Text, { children: indent }), _jsx(Box, { width: 2, children: _jsxs(Text, { color: color, children: [icon, \" \"] }) }), _jsx(Text, { color: \"cyan\", children: item.bindingSid })] }, key));\n }\n if (item.type === \"action\") {\n return (_jsxs(Box, { flexDirection: \"row\", children: [_jsx(Text, { children: indent }), _jsx(Box, { width: 2, children: _jsxs(Text, { color: color, children: [icon, \" \"] }) }), _jsx(Box, { children: _jsx(Text, { bold: true, children: item.id }) }), _jsx(Box, { marginLeft: 1, children: _jsxs(Text, { color: \"blackBright\", children: [\"(\", item.actionType, \")\"] }) }), _jsx(Box, { marginLeft: 1, children: _jsx(Text, { color: \"cyan\", children: \"[action]\" }) })] }, key));\n }\n // Resource item\n const modeNote = formatModeNote({\n mode: item.providerMode,\n priorMode: item.fromProviderMode,\n defaultMode: plan.defaultMode,\n });\n return (_jsxs(Box, { flexDirection: \"row\", children: [_jsx(Text, { children: indent }), _jsx(Box, { width: 2, children: _jsxs(Text, { color: color, children: [icon, \" \"] }) }), _jsx(Box, { children: _jsx(Text, { bold: true, children: item.id }) }), _jsx(Box, { marginLeft: 1, children: _jsxs(Text, { color: \"blackBright\", children: [\"(\", item.resourceType, \")\"] }) }), modeNote && (_jsx(Box, { marginLeft: 1, children: _jsxs(Text, { color: \"blackBright\", children: [\"(\", modeNote, \")\"] }) })), item.bindingCount !== undefined && item.bindingCount > 0 && (_jsx(Box, { marginLeft: 1, children: _jsxs(Text, { color: \"cyan\", children: [\"(\", item.bindingCount, \" bindings)\"] }) }))] }, key));\n }) })] }));\n}\nconst getActionColor = (action) => ({\n noop: \"gray\",\n create: \"green\",\n update: \"yellow\",\n delete: \"red\",\n replace: \"magenta\",\n mixed: \"cyan\",\n run: \"cyan\",\n})[action] ?? \"gray\";\nconst getActionIcon = (action) => ({\n create: \"+\",\n update: \"~\",\n delete: \"-\",\n noop: \"•\",\n replace: \"!\",\n mixed: \"*\",\n run: \"λ\",\n})[action] ?? \"?\";\nconst actionColor = (action) => getActionColor(action);\n//# sourceMappingURL=Plan.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n/** @jsxImportSource react */\nimport { useState } from \"react\";\nimport { Box, Text, useApp, useInput } from \"ink\";\nimport { Plan } from \"./Plan.js\";\nexport function ApprovePlan(props) {\n const { plan, approve } = props;\n const [selected, setSelected] = useState(0);\n const { exit } = useApp();\n useInput((_input, key) => {\n if (key.leftArrow || key.rightArrow) {\n setSelected((prev) => (prev === 0 ? 1 : 0));\n }\n else if (key.return) {\n approve(selected === 0);\n exit();\n }\n });\n return (_jsxs(Box, { flexDirection: \"column\", children: [_jsx(Plan, { plan: plan }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { children: \"Proceed?\" }) }), _jsxs(Box, { gap: 1, children: [_jsxs(Text, { color: selected === 0 ? \"green\" : \"gray\", children: [selected === 0 ? \"◉\" : \"○\", \" Yes\"] }), _jsxs(Text, { color: selected === 1 ? \"red\" : \"gray\", children: [selected === 1 ? \"◉\" : \"○\", \" No\"] })] })] }));\n}\n//# sourceMappingURL=ApprovePlan.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n/** @jsxImportSource react */\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { Box, Text } from \"ink\";\nimport { buildNamespaceTree, flattenTree, } from \"../../NamespaceTree.js\";\nimport { formatModeNote } from \"../../ModeTag.js\";\nconst getTaskKey = (item) => item.path.join(\"/\");\nexport const buildProgressRows = (plan) => {\n const items = [\n ...Object.values(plan.resources),\n ...Object.values(plan.deletions).filter((item) => item !== undefined),\n ];\n const taskItems = [\n ...Object.values(plan.actions ?? {}),\n ...Object.values(plan.actionDeletions ?? {}),\n ].filter((t) => t !== undefined);\n const tree = buildNamespaceTree(items, taskItems);\n return flattenTree(tree)\n .filter((item) => item.type !== \"binding\")\n .map((item) => {\n if (item.type === \"namespace\") {\n return {\n key: getTaskKey(item),\n type: \"namespace\",\n id: item.id,\n depth: item.depth,\n action: item.action,\n };\n }\n if (item.type === \"action\") {\n return {\n key: getTaskKey(item),\n type: \"task\",\n id: item.id,\n depth: item.depth,\n actionType: item.actionType ?? \"unknown\",\n action: item.action,\n };\n }\n return {\n key: getTaskKey(item),\n type: \"resource\",\n id: item.id,\n depth: item.depth,\n resourceType: item.resourceType ?? \"unknown\",\n action: item.action,\n providerMode: item.providerMode,\n fromProviderMode: item.fromProviderMode,\n persistedApplyStatus: item.action === \"noop\"\n ? (() => {\n const crud = findCrudByLogicalId(plan, item.id);\n return crud?.action === \"noop\" ? crud.state.status : undefined;\n })()\n : undefined,\n };\n });\n};\nconst buildLogicalIdIndex = (rows) => {\n const index = new Map();\n for (const row of rows) {\n if (row.type !== \"resource\" && row.type !== \"task\")\n continue;\n const keys = index.get(row.id);\n if (keys) {\n keys.push(row.key);\n }\n else {\n index.set(row.id, [row.key]);\n }\n }\n return index;\n};\nexport function toPlanTask(rowOrId, planItem) {\n if (typeof rowOrId === \"string\") {\n return {\n key: rowOrId,\n id: rowOrId,\n type: planItem.resource.Type,\n status: planItem.action === \"noop\" ? planItem.state.status : \"pending\",\n updatedAt: Date.now(),\n };\n }\n return {\n key: rowOrId.key,\n id: rowOrId.id,\n type: rowOrId.resourceType,\n status: rowOrId.action === \"noop\"\n ? (rowOrId.persistedApplyStatus ?? \"created\")\n : \"pending\",\n updatedAt: Date.now(),\n };\n}\nconst buildInitialTasks = (rows) => new Map(rows.flatMap((row) => row.type === \"resource\"\n ? [[row.key, toPlanTask(row)]]\n : row.type === \"task\"\n ? [\n [\n row.key,\n {\n key: row.key,\n id: row.id,\n type: row.actionType,\n // `noop` tasks are skipped — render as gray `•` from the start\n // rather than briefly flashing the `ran` cyan styling.\n status: row.action === \"noop\"\n ? \"skipped\"\n : \"pending\",\n updatedAt: Date.now(),\n },\n ],\n ]\n : []));\nexport function PlanProgress(props) {\n const { source, plan } = props;\n const spinner = useGlobalSpinner();\n const rows = useMemo(() => buildProgressRows(plan), [plan]);\n const logicalIdIndex = useMemo(() => buildLogicalIdIndex(rows), [rows]);\n const [tasks, setTasks] = useState(() => buildInitialTasks(rows));\n const unsubscribeRef = useRef(null);\n useEffect(() => {\n unsubscribeRef.current?.();\n unsubscribeRef.current = source.subscribe((event) => {\n setTasks((prev) => {\n const next = new Map(prev);\n const keys = logicalIdIndex.get(event.id) ?? [];\n if (event.kind === \"status-change\") {\n if (!event.bindingId) {\n for (const key of keys) {\n const current = next.get(key);\n next.set(key, {\n key,\n id: event.id,\n type: event.type,\n status: event.status,\n message: event.message ?? current?.message,\n updatedAt: Date.now(),\n });\n }\n }\n }\n else {\n for (const key of keys) {\n const current = next.get(key);\n if (!current)\n continue;\n next.set(key, {\n ...current,\n message: event.message,\n updatedAt: Date.now(),\n });\n }\n }\n return next;\n });\n });\n return () => {\n unsubscribeRef.current?.();\n unsubscribeRef.current = null;\n };\n }, [logicalIdIndex, source]);\n useEffect(() => {\n setTasks(buildInitialTasks(rows));\n }, [rows]);\n return (_jsx(Box, { flexDirection: \"column\", children: rows.map((row) => {\n const indent = \" \".repeat(row.depth);\n if (row.type === \"namespace\") {\n return (_jsxs(Box, { flexDirection: \"row\", children: [_jsx(Text, { children: indent }), _jsx(Box, { width: 2, children: _jsx(Text, { color: \"blueBright\", children: \"\\u21B3 \" }) }), _jsx(Text, { color: \"blueBright\", children: row.id })] }, row.key));\n }\n if (row.type === \"task\") {\n const t = tasks.get(row.key);\n const status = t?.status ?? (row.action === \"noop\" ? \"ran\" : \"pending\");\n const color = statusColor(status);\n const icon = taskIcon(row.action, status, spinner);\n const label = row.action === \"delete\"\n ? status === \"deleted\" || status === \"retained\"\n ? status\n : \"drop\"\n : status === \"ran\"\n ? row.action === \"noop\"\n ? \"skip\"\n : \"ran\"\n : status === \"running\"\n ? \"running\"\n : status === \"fail\"\n ? \"fail\"\n : row.action === \"noop\"\n ? \"skip\"\n : \"run\";\n return (_jsxs(Box, { flexDirection: \"column\", children: [_jsxs(Box, { flexDirection: \"row\", children: [_jsx(Text, { children: indent }), _jsx(Box, { width: 2, children: _jsxs(Text, { color: color, children: [icon, \" \"] }) }), _jsx(Text, { bold: true, children: row.id }), _jsxs(Text, { dimColor: true, children: [\" (\", row.actionType, \")\"] }), _jsxs(Text, { color: color, children: [\" \", label] }), _jsxs(Text, { color: \"cyan\", dimColor: true, children: [\" \", \"[action]\"] })] }), t?.message ? (_jsx(Box, { paddingLeft: row.depth * 2 + 2, children: _jsxs(Text, { dimColor: true, children: [\"\\u2022 \", t.message] }) })) : null] }, row.key));\n }\n const task = tasks.get(row.key) ?? toPlanTask(row);\n const displayStatus = getDisplayStatus(row, task.status);\n const color = statusColor(displayStatus);\n const icon = statusIcon(task.status, spinner);\n const modeNote = formatModeNote({\n mode: row.providerMode,\n priorMode: row.fromProviderMode,\n defaultMode: plan.defaultMode,\n });\n return (_jsxs(Box, { flexDirection: \"column\", children: [_jsxs(Box, { flexDirection: \"row\", children: [_jsx(Text, { children: indent }), _jsx(Box, { width: 2, children: _jsxs(Text, { color: color, children: [icon, \" \"] }) }), _jsx(Text, { bold: true, children: task.id }), _jsxs(Text, { dimColor: true, children: [\" (\", task.type, \")\"] }), modeNote ? _jsxs(Text, { dimColor: true, children: [\" (\", modeNote, \")\"] }) : null, _jsxs(Text, { color: color, children: [\" \", displayStatus] })] }), task.message ? (_jsx(Box, { paddingLeft: row.depth * 2 + 2, children: _jsxs(Text, { dimColor: true, children: [\"\\u2022 \", task.message] }) })) : null] }, row.key));\n }) }));\n}\nfunction getDisplayStatus(row, status) {\n if (row.action === \"noop\" && (status === \"created\" || status === \"updated\")) {\n return \"no change\";\n }\n return status;\n}\nfunction statusColor(status) {\n switch (status) {\n case \"no change\":\n return \"gray\";\n case \"pending\":\n return \"gray\";\n case \"creating\":\n case \"created\":\n return \"green\";\n case \"updating\":\n case \"updated\":\n return \"yellow\";\n case \"deleting\":\n case \"deleted\":\n return \"red\";\n case \"retained\":\n return \"gray\";\n case \"running\":\n case \"ran\":\n return \"cyan\";\n case \"skipped\":\n return \"gray\";\n case \"fail\":\n return \"redBright\";\n default:\n return undefined;\n }\n}\nfunction taskIcon(action, status, spinnerChar) {\n if (status === \"running\")\n return spinnerChar;\n if (status === \"fail\")\n return \"✗\";\n if (status === \"skipped\")\n return \"•\";\n if (status === \"ran\")\n return action === \"noop\" ? \"•\" : \"✓\";\n if (status === \"deleted\" || status === \"retained\")\n return \"✓\";\n if (action === \"delete\")\n return \"-\";\n if (action === \"noop\")\n return \"•\";\n return \"λ\";\n}\nfunction statusIcon(status, spinnerChar) {\n if (isInProgress(status))\n return spinnerChar;\n if (status === \"fail\")\n return \"✗\";\n return \"✓\"; // created/updated/deleted/replaced/etc.\n}\nfunction isInProgress(status) {\n return (status === \"pending\" ||\n status === \"creating\" ||\n status === \"updating\" ||\n status === \"deleting\" ||\n status === \"running\");\n}\nconst spinnerFrames = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\nfunction useGlobalSpinner(intervalMs = 80) {\n const [index, setIndex] = useState(0);\n useEffect(() => {\n const timer = setInterval(() => {\n setIndex((i) => (i + 1) % spinnerFrames.length);\n }, intervalMs);\n return () => clearInterval(timer);\n }, [intervalMs]);\n return spinnerFrames[index];\n}\nconst findCrudByLogicalId = (plan, logicalId) => {\n for (const node of Object.values(plan.resources)) {\n if (node.resource.LogicalId === logicalId) {\n return node;\n }\n }\n for (const node of Object.values(plan.deletions)) {\n if (node?.resource.LogicalId === logicalId) {\n return node;\n }\n }\n return undefined;\n};\n//# sourceMappingURL=PlanProgress.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\n/** @jsxImportSource react */\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { render } from \"ink\";\nimport { Cli } from \"../Cli.js\";\nimport { ApprovePlan } from \"./components/ApprovePlan.js\";\nimport { Plan as PlanComponent } from \"./components/Plan.js\";\nimport { PlanProgress } from \"./components/PlanProgress.js\";\nexport const inkCLI = () => Layer.succeed(Cli, Cli.of({\n approvePlan,\n displayPlan,\n startApplySession,\n}));\nconst approvePlan = Effect.fn(function* (plan) {\n let approved = false;\n const { waitUntilExit } = render(_jsx(ApprovePlan, { plan: plan, approve: (a) => (approved = a) }));\n yield* Effect.promise(waitUntilExit);\n return approved;\n});\nconst displayPlan = (plan) => Effect.sync(() => {\n const { unmount } = render(_jsx(PlanComponent, { plan: plan }));\n unmount();\n});\nconst startApplySession = Effect.fn(function* (plan) {\n // Print the plan preview once into scrollback before mounting the\n // animated progress region (mirrors LoggingCli, which prints the plan\n // lines at session start — `alchemy dev`/`--yes` runs never call\n // displayPlan/approvePlan, so without this the TTY path shows no plan at\n // all). Rendering + immediately unmounting leaves the frame behind and\n // releases the Ink instance for PlanProgress; forwarded runtime logs then\n // insert BETWEEN the preview and the live region instead of piling above\n // the entire transcript.\n yield* displayPlan(plan);\n const listeners = new Set();\n const { unmount } = render(_jsx(PlanProgress, { plan: plan, source: {\n subscribe(listener) {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n } }));\n return {\n done: Effect.fn(function* () {\n yield* Effect.sleep(10); // give the react event loop time to re-render\n yield* Effect.sync(() => unmount());\n }),\n emit: (event) => Effect.sync(() => {\n for (const listener of listeners)\n listener(event);\n }),\n };\n});\n//# sourceMappingURL=InkCLI.js.map","import * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { isNonInteractive } from \"../Util/interactive.js\";\nimport { LoggingCli } from \"./LoggingCli.js\";\nexport { isNonInteractive } from \"../Util/interactive.js\";\nexport const selectCli = () => isNonInteractive()\n ? LoggingCli\n : // Defer importing the Ink/React TUI (`./tui/InkCLI.tsx` pulls in `ink`)\n // until we actually need the interactive renderer. Non-interactive runs\n // (agents, CI, piped output) take the cheap `LoggingCli` branch and never\n // pay the TUI import cost.\n Layer.unwrap(Effect.promise(() => import(\"./tui/InkCLI.js\").then((m) => m.inkCLI())));\n//# sourceMappingURL=selectCli.js.map","import * as ConfigProvider from \"effect/ConfigProvider\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Schema from \"effect/Schema\";\nimport * as FetchHttpClient from \"effect/unstable/http/FetchHttpClient\";\nimport { AlchemyContextLive } from \"../AlchemyContext.js\";\nimport { CredentialsStoreLive } from \"../Auth/Credentials.js\";\nimport { ProfileLive } from \"../Auth/Profile.js\";\nimport * as RpcProviderProxy from \"../Local/RpcProviderProxy.js\";\nimport { forwardSidecarLogs } from \"../Local/RpcSpawner.js\";\nimport { PlatformServices } from \"../Util/PlatformServices.js\";\nimport { execStack, ExecStackOptions } from \"./commands/deploy.js\";\nimport { LoggingCli } from \"./LoggingCli.js\";\nimport { selectCli } from \"./selectCli.js\";\n// `alchemy dev` is a long-running session whose primary output is the log\n// stream (worker starts, cron fires, request logs) interleaved with\n// re-applies on file change. Ink's insertion model stacks inserted lines\n// ABOVE the animated region, so runtime logs end up above the plan/apply\n// output in scrollback. Append-only chronological rendering is the correct\n// model for a dev server (plan → status → logs, strictly in order), so dev\n// always takes the line renderer; deploy/destroy keep the interactive TUI.\nconst makeServices = (dev) => Layer.merge(dev ? LoggingCli : selectCli(), RpcProviderProxy.fromEnv()).pipe(Layer.provideMerge(Layer.mergeAll(AlchemyContextLive, ProfileLive, CredentialsStoreLive)), Layer.provideMerge(Layer.mergeAll(PlatformServices, FetchHttpClient.layer, ConfigProvider.layer(ConfigProvider.fromEnv()))));\nexport const exec = () => {\n const options = Schema.decodeSync(ExecStackOptions)(JSON.parse(process.env.ALCHEMY_EXEC_OPTIONS));\n // Subscribe to the spawner's sidecar log stream BEFORE the stack runs:\n // this process owns the terminal renderer, so sidecar output printed here\n // lands in chronological order with the run's own lines instead of racing\n // the shared tty. No-op outside dev.\n return forwardSidecarLogs.pipe(Effect.andThen(execStack(options)), Effect.provide(makeServices(options.dev)), Effect.scoped);\n};\n//# sourceMappingURL=exec.js.map","import { exec } from \"alchemy/Cli\";\nimport { runMain } from \"alchemy/Util/PlatformServices\";\n\nexec().pipe(runMain);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKa,iBAAb,cAAoC,cAAc,QAAQ,CAAC,CAAC,iBAAiB,CAAC,CAAC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