alchemy 2.0.0-beta.84 → 2.0.0-beta.85
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/THIRD_PARTY_LICENSES.md +2 -2
- package/bin/cli.js +14 -6
- package/bin/register-oxc.js +16 -12
- package/lib/AdoptPolicy.d.ts +73 -0
- package/lib/AdoptPolicy.d.ts.map +1 -1
- package/lib/AdoptPolicy.js +54 -0
- package/lib/AdoptPolicy.js.map +1 -1
- package/lib/Alchemist/AuthRegistry.d.ts +31 -0
- package/lib/Alchemist/AuthRegistry.d.ts.map +1 -0
- package/lib/Alchemist/AuthRegistry.js +95 -0
- package/lib/Alchemist/AuthRegistry.js.map +1 -0
- package/lib/Alchemist/Drift.d.ts +70 -0
- package/lib/Alchemist/Drift.d.ts.map +1 -0
- package/lib/Alchemist/Drift.js +54 -0
- package/lib/Alchemist/Drift.js.map +1 -0
- package/lib/Alchemist/Entrypoint.d.ts +27 -3
- package/lib/Alchemist/Entrypoint.d.ts.map +1 -1
- package/lib/Alchemist/Entrypoint.js +34 -3
- package/lib/Alchemist/Entrypoint.js.map +1 -1
- package/lib/Alchemist/Errors.d.ts +1 -1
- package/lib/Alchemist/Errors.d.ts.map +1 -1
- package/lib/Alchemist/Errors.js +1 -1
- package/lib/Alchemist/Errors.js.map +1 -1
- package/lib/Alchemist/Logs.d.ts +46 -0
- package/lib/Alchemist/Logs.d.ts.map +1 -0
- package/lib/Alchemist/{routes/logs.js → Logs.js} +21 -26
- package/lib/Alchemist/Logs.js.map +1 -0
- package/lib/Alchemist/Nuke.d.ts +69 -0
- package/lib/Alchemist/Nuke.d.ts.map +1 -0
- package/lib/Alchemist/Nuke.js +35 -0
- package/lib/Alchemist/Nuke.js.map +1 -0
- package/lib/Alchemist/Operations.d.ts +168 -0
- package/lib/Alchemist/Operations.d.ts.map +1 -0
- package/lib/Alchemist/Operations.js +165 -0
- package/lib/Alchemist/Operations.js.map +1 -0
- package/lib/Alchemist/Profile.d.ts +132 -0
- package/lib/Alchemist/Profile.d.ts.map +1 -0
- package/lib/Alchemist/{routes/profile.js → Profile.js} +20 -21
- package/lib/Alchemist/Profile.js.map +1 -0
- package/lib/Alchemist/{routes/provider.d.ts → Provider.d.ts} +4 -4
- package/lib/Alchemist/Provider.d.ts.map +1 -0
- package/lib/Alchemist/{routes/provider.js → Provider.js} +7 -6
- package/lib/Alchemist/Provider.js.map +1 -0
- package/lib/Alchemist/Runtime.d.ts +10 -6
- package/lib/Alchemist/Runtime.d.ts.map +1 -1
- package/lib/Alchemist/Runtime.js +38 -2
- package/lib/Alchemist/Runtime.js.map +1 -1
- package/lib/Alchemist/{routes/state.d.ts → State.d.ts} +36 -16
- package/lib/Alchemist/State.d.ts.map +1 -0
- package/lib/Alchemist/{routes/state.js → State.js} +50 -15
- package/lib/Alchemist/State.js.map +1 -0
- package/lib/Alchemist/index.d.ts +11 -10
- package/lib/Alchemist/index.d.ts.map +1 -1
- package/lib/Alchemist/index.js +10 -9
- package/lib/Alchemist/index.js.map +1 -1
- package/lib/Apply.d.ts +2 -8
- package/lib/Apply.d.ts.map +1 -1
- package/lib/Apply.js +364 -184
- package/lib/Apply.js.map +1 -1
- package/lib/Auth/AuthProvider.d.ts +24 -11
- package/lib/Auth/AuthProvider.d.ts.map +1 -1
- package/lib/Auth/AuthProvider.js +28 -12
- package/lib/Auth/AuthProvider.js.map +1 -1
- package/lib/Auth/BrowserOAuth.d.ts +6 -8
- package/lib/Auth/BrowserOAuth.d.ts.map +1 -1
- package/lib/Auth/BrowserOAuth.js +25 -41
- package/lib/Auth/BrowserOAuth.js.map +1 -1
- package/lib/Auth/Credentials.d.ts.map +1 -1
- package/lib/Auth/Credentials.js +2 -2
- package/lib/Auth/Credentials.js.map +1 -1
- package/lib/Auth/Demand.d.ts +4 -4
- package/lib/Auth/Demand.d.ts.map +1 -1
- package/lib/Auth/Demand.js +16 -10
- package/lib/Auth/Demand.js.map +1 -1
- package/lib/Auth/Env.d.ts +2 -1
- package/lib/Auth/Env.d.ts.map +1 -1
- package/lib/Auth/Env.js +4 -2
- package/lib/Auth/Env.js.map +1 -1
- package/lib/Auth/Inspect.d.ts +2 -2
- package/lib/Auth/Inspect.d.ts.map +1 -1
- package/lib/Auth/Inspect.js +3 -1
- package/lib/Auth/Inspect.js.map +1 -1
- package/lib/Auth/Lock.d.ts.map +1 -1
- package/lib/Auth/Lock.js +4 -8
- package/lib/Auth/Lock.js.map +1 -1
- package/lib/Auth/OAuthFlow.d.ts +3 -12
- package/lib/Auth/OAuthFlow.d.ts.map +1 -1
- package/lib/Auth/OAuthFlow.js +7 -17
- package/lib/Auth/OAuthFlow.js.map +1 -1
- package/lib/Auth/Paths.d.ts +2 -1
- package/lib/Auth/Paths.d.ts.map +1 -1
- package/lib/Auth/Paths.js +3 -2
- package/lib/Auth/Paths.js.map +1 -1
- package/lib/Auth/Profile.d.ts +10 -0
- package/lib/Auth/Profile.d.ts.map +1 -1
- package/lib/Auth/Profile.js +19 -2
- package/lib/Auth/Profile.js.map +1 -1
- package/lib/Auth/Registry.d.ts +20 -0
- package/lib/Auth/Registry.d.ts.map +1 -0
- package/lib/Auth/Registry.js +17 -0
- package/lib/Auth/Registry.js.map +1 -0
- package/lib/Auth/Resolve.d.ts +34 -2
- package/lib/Auth/Resolve.d.ts.map +1 -1
- package/lib/Auth/Resolve.js +51 -3
- package/lib/Auth/Resolve.js.map +1 -1
- package/lib/Auth/StoredAuthProvider.d.ts +1 -1
- package/lib/Auth/StoredAuthProvider.d.ts.map +1 -1
- package/lib/Auth/StoredAuthProvider.js +1 -2
- package/lib/Auth/StoredAuthProvider.js.map +1 -1
- package/lib/Binding.d.ts.map +1 -1
- package/lib/Binding.js +3 -1
- package/lib/Binding.js.map +1 -1
- package/lib/Bundle/Bundle.d.ts +5 -0
- package/lib/Bundle/Bundle.d.ts.map +1 -1
- package/lib/Bundle/Bundle.js +36 -6
- package/lib/Bundle/Bundle.js.map +1 -1
- package/lib/Bundle/NamespaceImportPlugin.d.ts +55 -0
- package/lib/Bundle/NamespaceImportPlugin.d.ts.map +1 -0
- package/lib/Bundle/NamespaceImportPlugin.js +226 -0
- package/lib/Bundle/NamespaceImportPlugin.js.map +1 -0
- package/lib/Bundle/index.d.ts +1 -0
- package/lib/Bundle/index.d.ts.map +1 -1
- package/lib/Bundle/index.js +1 -0
- package/lib/Bundle/index.js.map +1 -1
- package/lib/Cli/Format.d.ts.map +1 -1
- package/lib/Cli/Format.js +2 -1
- package/lib/Cli/Format.js.map +1 -1
- package/lib/Cli/GlobalLog.d.ts +72 -26
- package/lib/Cli/GlobalLog.d.ts.map +1 -1
- package/lib/Cli/GlobalLog.js +151 -59
- package/lib/Cli/GlobalLog.js.map +1 -1
- package/lib/Cli/LoggingCli.d.ts.map +1 -1
- package/lib/Cli/LoggingCli.js +24 -18
- package/lib/Cli/LoggingCli.js.map +1 -1
- package/lib/Cli/PlainCliFormatter.d.ts.map +1 -1
- package/lib/Cli/PlainCliFormatter.js +4 -1
- package/lib/Cli/PlainCliFormatter.js.map +1 -1
- package/lib/Cli/Present.d.ts +14 -0
- package/lib/Cli/Present.d.ts.map +1 -0
- package/lib/Cli/Present.js +22 -0
- package/lib/Cli/Present.js.map +1 -0
- package/lib/Cli/SigilRenderer.d.ts +58 -0
- package/lib/Cli/SigilRenderer.d.ts.map +1 -0
- package/lib/Cli/SigilRenderer.js +39 -0
- package/lib/Cli/SigilRenderer.js.map +1 -0
- package/lib/Cli/checkVersion.d.ts +11 -14
- package/lib/Cli/checkVersion.d.ts.map +1 -1
- package/lib/Cli/checkVersion.js +19 -77
- package/lib/Cli/checkVersion.js.map +1 -1
- package/lib/Cli/commands/confirm.d.ts +2 -2
- package/lib/Cli/commands/confirm.d.ts.map +1 -1
- package/lib/Cli/commands/confirm.js +3 -3
- package/lib/Cli/commands/confirm.js.map +1 -1
- package/lib/Cli/commands/deploy.d.ts +4 -4
- package/lib/Cli/commands/deploy.d.ts.map +1 -1
- package/lib/Cli/commands/deploy.js +40 -39
- package/lib/Cli/commands/deploy.js.map +1 -1
- package/lib/Cli/commands/dev.d.ts.map +1 -1
- package/lib/Cli/commands/dev.js +41 -3
- package/lib/Cli/commands/dev.js.map +1 -1
- package/lib/Cli/commands/drift.d.ts +2 -2
- package/lib/Cli/commands/drift.d.ts.map +1 -1
- package/lib/Cli/commands/drift.js +14 -13
- package/lib/Cli/commands/drift.js.map +1 -1
- package/lib/Cli/commands/errors.d.ts.map +1 -1
- package/lib/Cli/commands/errors.js +2 -1
- package/lib/Cli/commands/errors.js.map +1 -1
- package/lib/Cli/commands/instrument.d.ts +15 -5
- package/lib/Cli/commands/instrument.d.ts.map +1 -1
- package/lib/Cli/commands/instrument.js +33 -8
- package/lib/Cli/commands/instrument.js.map +1 -1
- package/lib/Cli/commands/logs.d.ts +1 -1
- package/lib/Cli/commands/logs.d.ts.map +1 -1
- package/lib/Cli/commands/logs.js +22 -22
- package/lib/Cli/commands/logs.js.map +1 -1
- package/lib/Cli/commands/nuke.d.ts +3 -2
- package/lib/Cli/commands/nuke.d.ts.map +1 -1
- package/lib/Cli/commands/nuke.js +19 -17
- package/lib/Cli/commands/nuke.js.map +1 -1
- package/lib/Cli/commands/profile/commands.d.ts +3 -2
- package/lib/Cli/commands/profile/commands.d.ts.map +1 -1
- package/lib/Cli/commands/profile/commands.js +26 -27
- package/lib/Cli/commands/profile/commands.js.map +1 -1
- package/lib/Cli/commands/profile/flows.d.ts +6 -5
- package/lib/Cli/commands/profile/flows.d.ts.map +1 -1
- package/lib/Cli/commands/profile/flows.js +19 -17
- package/lib/Cli/commands/profile/flows.js.map +1 -1
- package/lib/Cli/commands/profile/hub.d.ts +1 -2
- package/lib/Cli/commands/profile/hub.d.ts.map +1 -1
- package/lib/Cli/commands/profile/hub.js +15 -17
- package/lib/Cli/commands/profile/hub.js.map +1 -1
- package/lib/Cli/commands/provider.d.ts +3 -1
- package/lib/Cli/commands/provider.d.ts.map +1 -1
- package/lib/Cli/commands/provider.js +4 -4
- package/lib/Cli/commands/provider.js.map +1 -1
- package/lib/Cli/commands/render.d.ts +2 -4
- package/lib/Cli/commands/render.d.ts.map +1 -1
- package/lib/Cli/commands/render.js +33 -56
- package/lib/Cli/commands/render.js.map +1 -1
- package/lib/Cli/commands/state.d.ts +1 -2
- package/lib/Cli/commands/state.d.ts.map +1 -1
- package/lib/Cli/commands/state.js +74 -27
- package/lib/Cli/commands/state.js.map +1 -1
- package/lib/Cli/components/capabilities.d.ts +4 -0
- package/lib/Cli/components/capabilities.d.ts.map +1 -0
- package/lib/Cli/components/capabilities.js +18 -0
- package/lib/Cli/components/capabilities.js.map +1 -0
- package/lib/Cli/components/types.d.ts +2 -81
- package/lib/Cli/components/types.d.ts.map +1 -1
- package/lib/Cli/components/types.js +1 -3
- package/lib/Cli/components/types.js.map +1 -1
- package/lib/Cli/components/ui/Environment.d.ts +3 -3
- package/lib/Cli/components/ui/Environment.d.ts.map +1 -1
- package/lib/Cli/components/ui/Environment.js.map +1 -1
- package/lib/Cli/components/ui/Interactive.d.ts +17 -4
- package/lib/Cli/components/ui/Interactive.d.ts.map +1 -1
- package/lib/Cli/components/ui/Interactive.js +7 -11
- package/lib/Cli/components/ui/Interactive.js.map +1 -1
- package/lib/Cli/components/ui/Layout.d.ts +1 -1
- package/lib/Cli/components/ui/Layout.d.ts.map +1 -1
- package/lib/Cli/components/ui/Layout.js +1 -1
- package/lib/Cli/components/ui/Layout.js.map +1 -1
- package/lib/Cli/components/ui/Typography.d.ts +1 -1
- package/lib/Cli/components/ui/Typography.d.ts.map +1 -1
- package/lib/Cli/components/ui/Typography.js +1 -1
- package/lib/Cli/components/ui/Typography.js.map +1 -1
- package/lib/Cli/components/ui/index.d.ts +2 -2
- package/lib/Cli/components/ui/index.js +2 -2
- package/lib/Cli/components/view/ApprovePlan.d.ts +1 -1
- package/lib/Cli/components/view/ApprovePlan.d.ts.map +1 -1
- package/lib/Cli/components/view/ApprovePlan.js +2 -1
- package/lib/Cli/components/view/ApprovePlan.js.map +1 -1
- package/lib/Cli/components/view/Format.d.ts +5 -0
- package/lib/Cli/components/view/Format.d.ts.map +1 -0
- package/lib/Cli/components/view/Format.js +39 -0
- package/lib/Cli/components/view/Format.js.map +1 -0
- package/lib/Cli/components/view/Help.d.ts +2 -2
- package/lib/Cli/components/view/Help.d.ts.map +1 -1
- package/lib/Cli/components/view/Help.js +7 -5
- package/lib/Cli/components/view/Help.js.map +1 -1
- package/lib/Cli/components/view/Logo.js +1 -1
- package/lib/Cli/components/view/Logo.js.map +1 -1
- package/lib/Cli/components/view/Nuke.d.ts +8 -9
- package/lib/Cli/components/view/Nuke.d.ts.map +1 -1
- package/lib/Cli/components/view/Nuke.js +49 -52
- package/lib/Cli/components/view/Nuke.js.map +1 -1
- package/lib/Cli/components/view/PlanDecision.d.ts +1 -1
- package/lib/Cli/components/view/PlanDecision.d.ts.map +1 -1
- package/lib/Cli/components/view/PlanDecision.js +1 -1
- package/lib/Cli/components/view/PlanDecision.js.map +1 -1
- package/lib/Cli/components/view/PlanRow.js +1 -1
- package/lib/Cli/components/view/PlanRow.js.map +1 -1
- package/lib/Cli/components/view/PlanTree.d.ts +1 -1
- package/lib/Cli/components/view/PlanTree.d.ts.map +1 -1
- package/lib/Cli/components/view/PlanTree.js +1 -1
- package/lib/Cli/components/view/PlanView.js +1 -1
- package/lib/Cli/components/view/PlanView.js.map +1 -1
- package/lib/Cli/components/view/Profile.d.ts +1 -1
- package/lib/Cli/components/view/Profile.js +2 -2
- package/lib/Cli/components/view/Profile.js.map +1 -1
- package/lib/Cli/components/view/ProfileDashboard.d.ts +4 -4
- package/lib/Cli/components/view/ProfileDashboard.d.ts.map +1 -1
- package/lib/Cli/components/view/ProfileDashboard.js +9 -8
- package/lib/Cli/components/view/ProfileDashboard.js.map +1 -1
- package/lib/Cli/components/view/Prompts.d.ts +3 -3
- package/lib/Cli/components/view/Prompts.d.ts.map +1 -1
- package/lib/Cli/components/view/Prompts.js +11 -18
- package/lib/Cli/components/view/Prompts.js.map +1 -1
- package/lib/Cli/components/view/Runtime.d.ts +5 -5
- package/lib/Cli/components/view/Runtime.d.ts.map +1 -1
- package/lib/Cli/components/view/Runtime.js +136 -219
- package/lib/Cli/components/view/Runtime.js.map +1 -1
- package/lib/Cli/components/view/SigilCli.d.ts +2 -2
- package/lib/Cli/components/view/SigilCli.d.ts.map +1 -1
- package/lib/Cli/components/view/SigilCli.js +7 -7
- package/lib/Cli/components/view/SigilCli.js.map +1 -1
- package/lib/Cli/components/view/StateExplorer.d.ts +1 -1
- package/lib/Cli/components/view/StateExplorer.d.ts.map +1 -1
- package/lib/Cli/components/view/StateExplorer.js +2 -1
- package/lib/Cli/components/view/StateExplorer.js.map +1 -1
- package/lib/Cli/components/view/statusStyle.d.ts +2 -2
- package/lib/Cli/components/view/statusStyle.d.ts.map +1 -1
- package/lib/Cli/components/view/statusStyle.js +1 -1
- package/lib/Cli/components/view/statusStyle.js.map +1 -1
- package/lib/Cli/exec.d.ts +6 -1
- package/lib/Cli/exec.d.ts.map +1 -1
- package/lib/Cli/exec.js +29 -34
- package/lib/Cli/exec.js.map +1 -1
- package/lib/Cli/main.d.ts.map +1 -1
- package/lib/Cli/main.js +35 -26
- package/lib/Cli/main.js.map +1 -1
- package/lib/Cli/selectCli.d.ts +2 -2
- package/lib/Cli/selectCli.d.ts.map +1 -1
- package/lib/Cli/selectCli.js +2 -2
- package/lib/Cli/selectCli.js.map +1 -1
- package/lib/Command/Command.js +1 -1
- package/lib/Command/Command.js.map +1 -1
- package/lib/Command/Dev.d.ts +58 -4
- package/lib/Command/Dev.d.ts.map +1 -1
- package/lib/Command/Dev.js +87 -30
- package/lib/Command/Dev.js.map +1 -1
- package/lib/Command/Local.d.ts +1 -1
- package/lib/Command/Memo.js +1 -1
- package/lib/Command/Memo.js.map +1 -1
- package/lib/Command/Providers.d.ts +1 -1
- package/lib/Command/Providers.d.ts.map +1 -1
- package/lib/Contributions.d.ts +2 -3
- package/lib/Contributions.d.ts.map +1 -1
- package/lib/Contributions.js +38 -6
- package/lib/Contributions.js.map +1 -1
- package/lib/DNS/Adapter.d.ts +204 -0
- package/lib/DNS/Adapter.d.ts.map +1 -0
- package/lib/DNS/Adapter.js +112 -0
- package/lib/DNS/Adapter.js.map +1 -0
- package/lib/DNS/index.d.ts +2 -0
- package/lib/DNS/index.d.ts.map +1 -0
- package/lib/DNS/index.js +2 -0
- package/lib/DNS/index.js.map +1 -0
- package/lib/Deploy.d.ts +7 -2
- package/lib/Deploy.d.ts.map +1 -1
- package/lib/Deploy.js +8 -3
- package/lib/Deploy.js.map +1 -1
- package/lib/Destroy.d.ts +5 -8
- package/lib/Destroy.d.ts.map +1 -1
- package/lib/Destroy.js +10 -7
- package/lib/Destroy.js.map +1 -1
- package/lib/Diff.d.ts.map +1 -1
- package/lib/Diff.js +14 -4
- package/lib/Diff.js.map +1 -1
- package/lib/Drift.d.ts +7 -7
- package/lib/Drift.d.ts.map +1 -1
- package/lib/Drift.js +184 -101
- package/lib/Drift.js.map +1 -1
- package/lib/EvalStack.d.ts +23 -0
- package/lib/EvalStack.d.ts.map +1 -0
- package/lib/EvalStack.js +47 -0
- package/lib/EvalStack.js.map +1 -0
- package/lib/Events.d.ts +210 -0
- package/lib/Events.d.ts.map +1 -0
- package/lib/Events.js +244 -0
- package/lib/Events.js.map +1 -0
- package/lib/Interaction.d.ts +159 -48
- package/lib/Interaction.d.ts.map +1 -1
- package/lib/Interaction.js +139 -58
- package/lib/Interaction.js.map +1 -1
- package/lib/Local/LocalProvider.d.ts.map +1 -1
- package/lib/Local/LocalProvider.js +31 -9
- package/lib/Local/LocalProvider.js.map +1 -1
- package/lib/Local/RpcProvider.d.ts.map +1 -1
- package/lib/Local/RpcProvider.js +10 -1
- package/lib/Local/RpcProvider.js.map +1 -1
- package/lib/Local/RpcProviderProxy.d.ts +16 -0
- package/lib/Local/RpcProviderProxy.d.ts.map +1 -1
- package/lib/Local/RpcProviderProxy.js +19 -10
- package/lib/Local/RpcProviderProxy.js.map +1 -1
- package/lib/Local/RpcSerialization.d.ts +3 -2
- package/lib/Local/RpcSerialization.d.ts.map +1 -1
- package/lib/Local/RpcSerialization.js +13 -10
- package/lib/Local/RpcSerialization.js.map +1 -1
- package/lib/Local/RpcServer.d.ts +2 -1
- package/lib/Local/RpcServer.d.ts.map +1 -1
- package/lib/Local/RpcServer.js +19 -14
- package/lib/Local/RpcServer.js.map +1 -1
- package/lib/Local/RpcServerBun.d.ts.map +1 -1
- package/lib/Local/RpcServerBun.js +8 -4
- package/lib/Local/RpcServerBun.js.map +1 -1
- package/lib/Local/RpcServerEnvironment.d.ts +2 -3
- package/lib/Local/RpcServerEnvironment.d.ts.map +1 -1
- package/lib/Local/RpcServerEnvironment.js +2 -2
- package/lib/Local/RpcServerEnvironment.js.map +1 -1
- package/lib/Local/RpcServerNode.d.ts.map +1 -1
- package/lib/Local/RpcServerNode.js +5 -1
- package/lib/Local/RpcServerNode.js.map +1 -1
- package/lib/Local/RpcServerSession.d.ts +1 -1
- package/lib/Local/RpcServerSession.d.ts.map +1 -1
- package/lib/Local/RpcServerSession.js.map +1 -1
- package/lib/Local/RpcSpawner.d.ts +6 -8
- package/lib/Local/RpcSpawner.d.ts.map +1 -1
- package/lib/Local/RpcSpawner.js +45 -36
- package/lib/Local/RpcSpawner.js.map +1 -1
- package/lib/Local/Sidecar.d.ts +23 -0
- package/lib/Local/Sidecar.d.ts.map +1 -1
- package/lib/Local/Sidecar.js +14 -9
- package/lib/Local/Sidecar.js.map +1 -1
- package/lib/Nuke.d.ts +5 -23
- package/lib/Nuke.d.ts.map +1 -1
- package/lib/Nuke.js +48 -13
- package/lib/Nuke.js.map +1 -1
- package/lib/Output.d.ts +19 -1
- package/lib/Output.d.ts.map +1 -1
- package/lib/Output.js +96 -3
- package/lib/Output.js.map +1 -1
- package/lib/Plan.d.ts +5 -1
- package/lib/Plan.d.ts.map +1 -1
- package/lib/Plan.js +111 -33
- package/lib/Plan.js.map +1 -1
- package/lib/Platform.d.ts.map +1 -1
- package/lib/Platform.js +31 -7
- package/lib/Platform.js.map +1 -1
- package/lib/Provider.d.ts +45 -0
- package/lib/Provider.d.ts.map +1 -1
- package/lib/Provider.js +2 -2
- package/lib/Provider.js.map +1 -1
- package/lib/Report.d.ts +17 -195
- package/lib/Report.d.ts.map +1 -1
- package/lib/Report.js +39 -12
- package/lib/Report.js.map +1 -1
- package/lib/Runtime/ManagedHttpShutdown.d.ts +17 -0
- package/lib/Runtime/ManagedHttpShutdown.d.ts.map +1 -1
- package/lib/Runtime/ManagedHttpShutdown.js +11 -2
- package/lib/Runtime/ManagedHttpShutdown.js.map +1 -1
- package/lib/RuntimeContext.js +1 -1
- package/lib/RuntimeContext.js.map +1 -1
- package/lib/Stack.d.ts +49 -29
- package/lib/Stack.d.ts.map +1 -1
- package/lib/Stack.js +25 -31
- package/lib/Stack.js.map +1 -1
- package/lib/State/BucketState.d.ts.map +1 -1
- package/lib/State/BucketState.js +43 -14
- package/lib/State/BucketState.js.map +1 -1
- package/lib/State/LocalState.d.ts.map +1 -1
- package/lib/State/LocalState.js +3 -3
- package/lib/State/LocalState.js.map +1 -1
- package/lib/State/Provisioning.d.ts +5 -0
- package/lib/State/Provisioning.d.ts.map +1 -1
- package/lib/State/Provisioning.js +3 -1
- package/lib/State/Provisioning.js.map +1 -1
- package/lib/State/ResourceState.d.ts +2 -0
- package/lib/State/ResourceState.d.ts.map +1 -1
- package/lib/State/State.d.ts +26 -0
- package/lib/State/State.d.ts.map +1 -1
- package/lib/State/StateEncoding.d.ts +7 -0
- package/lib/State/StateEncoding.d.ts.map +1 -1
- package/lib/State/StateEncoding.js +19 -0
- package/lib/State/StateEncoding.js.map +1 -1
- package/lib/State/index.js +2 -2
- package/lib/State/index.js.map +1 -1
- package/lib/Telemetry/Layer.d.ts +2 -5
- package/lib/Telemetry/Layer.d.ts.map +1 -1
- package/lib/Telemetry/Layer.js +3 -23
- package/lib/Telemetry/Layer.js.map +1 -1
- package/lib/Telemetry/Metrics.d.ts +1 -1
- package/lib/Telemetry/Metrics.d.ts.map +1 -1
- package/lib/TelemetryRelay.js +1 -1
- package/lib/TelemetryRelay.js.map +1 -1
- package/lib/TelemetryRuntime.d.ts +1 -1
- package/lib/TelemetryRuntime.d.ts.map +1 -1
- package/lib/TelemetryRuntime.js +4 -3
- package/lib/TelemetryRuntime.js.map +1 -1
- package/lib/Util/ConsoleSink.d.ts +23 -2
- package/lib/Util/ConsoleSink.d.ts.map +1 -1
- package/lib/Util/ConsoleSink.js +54 -14
- package/lib/Util/ConsoleSink.js.map +1 -1
- package/lib/Util/LogAnnotation.d.ts +19 -0
- package/lib/Util/LogAnnotation.d.ts.map +1 -0
- package/lib/Util/LogAnnotation.js +19 -0
- package/lib/Util/LogAnnotation.js.map +1 -0
- package/lib/Util/LogRecord.d.ts +281 -0
- package/lib/Util/LogRecord.d.ts.map +1 -0
- package/lib/Util/LogRecord.js +267 -0
- package/lib/Util/LogRecord.js.map +1 -0
- package/lib/Util/Node.d.ts +9 -0
- package/lib/Util/Node.d.ts.map +1 -1
- package/lib/Util/Node.js +10 -6
- package/lib/Util/Node.js.map +1 -1
- package/lib/Util/PlatformServices.d.ts +3 -2
- package/lib/Util/PlatformServices.d.ts.map +1 -1
- package/lib/Util/PlatformServices.js +6 -2
- package/lib/Util/PlatformServices.js.map +1 -1
- package/lib/Util/ResourceOutput.d.ts +18 -10
- package/lib/Util/ResourceOutput.d.ts.map +1 -1
- package/lib/Util/ResourceOutput.js +22 -23
- package/lib/Util/ResourceOutput.js.map +1 -1
- package/lib/Util/Shutdown.d.ts +10 -0
- package/lib/Util/Shutdown.d.ts.map +1 -0
- package/lib/Util/Shutdown.js +32 -0
- package/lib/Util/Shutdown.js.map +1 -0
- package/lib/Util/Terminal.d.ts +2 -4
- package/lib/Util/Terminal.d.ts.map +1 -1
- package/lib/Util/Terminal.js +3 -11
- package/lib/Util/Terminal.js.map +1 -1
- package/lib/Util/TraceParent.d.ts +32 -0
- package/lib/Util/TraceParent.d.ts.map +1 -0
- package/lib/Util/TraceParent.js +42 -0
- package/lib/Util/TraceParent.js.map +1 -0
- package/lib/Util/base64.d.ts +7 -0
- package/lib/Util/base64.d.ts.map +1 -0
- package/lib/Util/base64.js +24 -0
- package/lib/Util/base64.js.map +1 -0
- package/lib/Util/cached-function.d.ts +5 -0
- package/lib/Util/cached-function.d.ts.map +1 -1
- package/lib/Util/cached-function.js +13 -8
- package/lib/Util/cached-function.js.map +1 -1
- package/lib/Util/data.d.ts +1 -1
- package/lib/Util/data.d.ts.map +1 -1
- package/lib/Util/data.js +1 -1
- package/lib/Util/data.js.map +1 -1
- package/lib/Util/equal.d.ts.map +1 -1
- package/lib/Util/equal.js +3 -2
- package/lib/Util/equal.js.map +1 -1
- package/lib/Util/extraFiles.d.ts.map +1 -1
- package/lib/Util/extraFiles.js +5 -5
- package/lib/Util/extraFiles.js.map +1 -1
- package/lib/Util/interactive.js +1 -1
- package/lib/Website/AstroOutput.d.ts +42 -0
- package/lib/Website/AstroOutput.d.ts.map +1 -0
- package/lib/Website/AstroOutput.js +34 -0
- package/lib/Website/AstroOutput.js.map +1 -0
- package/lib/Website/FrontendCore.d.ts +1 -1
- package/lib/Workflows.d.ts +9 -0
- package/lib/Workflows.d.ts.map +1 -1
- package/lib/Workflows.js +8 -0
- package/lib/Workflows.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/package.json +21 -28
- package/src/AdoptPolicy.ts +76 -0
- package/src/Alchemist/AuthRegistry.ts +164 -0
- package/src/Alchemist/Drift.ts +103 -0
- package/src/Alchemist/Entrypoint.ts +51 -3
- package/src/Alchemist/Errors.ts +1 -1
- package/src/Alchemist/{routes/logs.ts → Logs.ts} +28 -30
- package/src/Alchemist/Nuke.ts +90 -0
- package/src/Alchemist/Operations.ts +309 -0
- package/src/Alchemist/{routes/profile.ts → Profile.ts} +22 -22
- package/src/Alchemist/{routes/provider.ts → Provider.ts} +7 -6
- package/src/Alchemist/Runtime.ts +46 -12
- package/src/Alchemist/{routes/state.ts → State.ts} +78 -21
- package/src/Alchemist/index.ts +32 -15
- package/src/Apply.ts +513 -274
- package/src/Auth/AuthProvider.ts +76 -23
- package/src/Auth/BrowserOAuth.ts +37 -60
- package/src/Auth/Credentials.ts +2 -4
- package/src/Auth/Demand.ts +27 -18
- package/src/Auth/Env.ts +13 -8
- package/src/Auth/Inspect.ts +5 -2
- package/src/Auth/Lock.ts +4 -8
- package/src/Auth/OAuthFlow.ts +12 -26
- package/src/Auth/Paths.ts +3 -2
- package/src/Auth/Profile.ts +30 -2
- package/src/Auth/Registry.ts +27 -0
- package/src/Auth/Resolve.ts +75 -3
- package/src/Auth/StoredAuthProvider.ts +1 -2
- package/src/Binding.ts +3 -4
- package/src/Bundle/Bundle.ts +58 -7
- package/src/Bundle/NamespaceImportPlugin.ts +259 -0
- package/src/Bundle/index.ts +1 -0
- package/src/Cli/Format.ts +2 -1
- package/src/Cli/GlobalLog.ts +206 -68
- package/src/Cli/LoggingCli.ts +33 -20
- package/src/Cli/PlainCliFormatter.ts +4 -1
- package/src/Cli/Present.ts +34 -0
- package/src/Cli/SigilRenderer.ts +75 -0
- package/src/Cli/checkVersion.ts +25 -78
- package/src/Cli/commands/confirm.ts +3 -3
- package/src/Cli/commands/deploy.ts +53 -44
- package/src/Cli/commands/dev.ts +65 -7
- package/src/Cli/commands/drift.ts +20 -16
- package/src/Cli/commands/errors.ts +2 -3
- package/src/Cli/commands/instrument.ts +39 -8
- package/src/Cli/commands/logs.ts +22 -30
- package/src/Cli/commands/nuke.ts +25 -26
- package/src/Cli/commands/profile/commands.ts +34 -34
- package/src/Cli/commands/profile/flows.ts +26 -20
- package/src/Cli/commands/profile/hub.ts +16 -18
- package/src/Cli/commands/provider.ts +4 -4
- package/src/Cli/commands/render.ts +43 -71
- package/src/Cli/commands/state.ts +113 -33
- package/src/Cli/components/capabilities.ts +20 -0
- package/src/Cli/components/types.ts +13 -99
- package/src/Cli/components/ui/Environment.tsx +5 -5
- package/src/Cli/components/ui/Interactive.tsx +24 -15
- package/src/Cli/components/ui/Layout.tsx +1 -1
- package/src/Cli/components/ui/Typography.tsx +1 -1
- package/src/Cli/components/ui/index.ts +2 -2
- package/src/Cli/components/view/ApprovePlan.tsx +2 -1
- package/src/Cli/components/view/Format.tsx +58 -0
- package/src/Cli/components/view/Help.tsx +14 -17
- package/src/Cli/components/view/Logo.tsx +1 -1
- package/src/Cli/components/view/Nuke.tsx +74 -49
- package/src/Cli/components/view/PlanDecision.tsx +1 -1
- package/src/Cli/components/view/PlanRow.tsx +1 -1
- package/src/Cli/components/view/PlanTree.ts +2 -2
- package/src/Cli/components/view/PlanView.tsx +2 -2
- package/src/Cli/components/view/Profile.tsx +2 -2
- package/src/Cli/components/view/ProfileDashboard.tsx +12 -11
- package/src/Cli/components/view/Prompts.tsx +37 -75
- package/src/Cli/components/view/Runtime.tsx +132 -238
- package/src/Cli/components/view/SigilCli.tsx +12 -12
- package/src/Cli/components/view/StateExplorer.tsx +2 -1
- package/src/Cli/components/view/statusStyle.ts +2 -2
- package/src/Cli/exec.ts +48 -41
- package/src/Cli/main.ts +52 -33
- package/src/Cli/selectCli.ts +3 -3
- package/src/Command/Command.ts +1 -1
- package/src/Command/Dev.ts +129 -36
- package/src/Command/Memo.ts +1 -1
- package/src/Contributions.ts +42 -8
- package/src/DNS/Adapter.ts +289 -0
- package/src/DNS/index.ts +1 -0
- package/src/Deploy.ts +11 -3
- package/src/Destroy.ts +19 -13
- package/src/Diff.ts +17 -4
- package/src/Drift.ts +256 -127
- package/src/EvalStack.ts +97 -0
- package/src/Events.ts +296 -0
- package/src/Interaction.ts +332 -97
- package/src/Local/LocalProvider.ts +40 -9
- package/src/Local/RpcProvider.ts +11 -1
- package/src/Local/RpcProviderProxy.ts +29 -21
- package/src/Local/RpcSerialization.ts +32 -17
- package/src/Local/RpcServer.ts +25 -17
- package/src/Local/RpcServerBun.ts +10 -6
- package/src/Local/RpcServerEnvironment.ts +2 -2
- package/src/Local/RpcServerNode.ts +8 -1
- package/src/Local/RpcServerSession.ts +2 -2
- package/src/Local/RpcSpawner.ts +61 -37
- package/src/Local/Sidecar.ts +10 -1
- package/src/Nuke.ts +66 -43
- package/src/Output.ts +120 -7
- package/src/Plan.ts +140 -52
- package/src/Platform.ts +47 -18
- package/src/Provider.ts +48 -3
- package/src/Report.ts +77 -275
- package/src/Runtime/ManagedHttpShutdown.ts +21 -4
- package/src/RuntimeContext.ts +1 -1
- package/src/Stack.ts +113 -135
- package/src/State/BucketState.ts +53 -21
- package/src/State/LocalState.ts +7 -9
- package/src/State/Provisioning.ts +8 -1
- package/src/State/ResourceState.ts +2 -0
- package/src/State/State.ts +30 -0
- package/src/State/StateEncoding.ts +22 -0
- package/src/State/index.ts +2 -2
- package/src/Telemetry/Layer.ts +3 -24
- package/src/Telemetry/Metrics.ts +1 -1
- package/src/TelemetryRelay.ts +1 -1
- package/src/TelemetryRuntime.ts +8 -8
- package/src/Util/ConsoleSink.ts +76 -13
- package/src/Util/LogAnnotation.ts +18 -0
- package/src/Util/LogRecord.ts +386 -0
- package/src/Util/Node.ts +20 -6
- package/src/Util/PlatformServices.ts +17 -4
- package/src/Util/ResourceOutput.ts +26 -25
- package/src/Util/Shutdown.ts +52 -0
- package/src/Util/Terminal.ts +3 -20
- package/src/Util/TraceParent.ts +70 -0
- package/src/Util/base64.ts +22 -0
- package/src/Util/cached-function.ts +30 -19
- package/src/Util/data.ts +2 -2
- package/src/Util/equal.ts +3 -2
- package/src/Util/extraFiles.ts +9 -8
- package/src/Util/interactive.ts +1 -1
- package/src/Website/AstroOutput.ts +83 -0
- package/src/Workflows.ts +11 -0
- package/src/index.ts +1 -0
- package/lib/Alchemist/Progress.d.ts +0 -16
- package/lib/Alchemist/Progress.d.ts.map +0 -1
- package/lib/Alchemist/Progress.js +0 -123
- package/lib/Alchemist/Progress.js.map +0 -1
- package/lib/Alchemist/Session.d.ts +0 -116
- package/lib/Alchemist/Session.d.ts.map +0 -1
- package/lib/Alchemist/Session.js +0 -212
- package/lib/Alchemist/Session.js.map +0 -1
- package/lib/Alchemist/routes/drift.d.ts +0 -55
- package/lib/Alchemist/routes/drift.d.ts.map +0 -1
- package/lib/Alchemist/routes/drift.js +0 -52
- package/lib/Alchemist/routes/drift.js.map +0 -1
- package/lib/Alchemist/routes/logs.d.ts +0 -41
- package/lib/Alchemist/routes/logs.d.ts.map +0 -1
- package/lib/Alchemist/routes/logs.js.map +0 -1
- package/lib/Alchemist/routes/nuke.d.ts +0 -46
- package/lib/Alchemist/routes/nuke.d.ts.map +0 -1
- package/lib/Alchemist/routes/nuke.js +0 -80
- package/lib/Alchemist/routes/nuke.js.map +0 -1
- package/lib/Alchemist/routes/profile.d.ts +0 -133
- package/lib/Alchemist/routes/profile.d.ts.map +0 -1
- package/lib/Alchemist/routes/profile.js.map +0 -1
- package/lib/Alchemist/routes/provider.d.ts.map +0 -1
- package/lib/Alchemist/routes/provider.js.map +0 -1
- package/lib/Alchemist/routes/stack.d.ts +0 -95
- package/lib/Alchemist/routes/stack.d.ts.map +0 -1
- package/lib/Alchemist/routes/stack.js +0 -73
- package/lib/Alchemist/routes/stack.js.map +0 -1
- package/lib/Alchemist/routes/state.d.ts.map +0 -1
- package/lib/Alchemist/routes/state.js.map +0 -1
- package/lib/Cli/CliKit/CliKit.d.ts +0 -92
- package/lib/Cli/CliKit/CliKit.d.ts.map +0 -1
- package/lib/Cli/CliKit/CliKit.js +0 -27
- package/lib/Cli/CliKit/CliKit.js.map +0 -1
- package/lib/Cli/CliKit/index.d.ts +0 -9
- package/lib/Cli/CliKit/index.d.ts.map +0 -1
- package/lib/Cli/CliKit/index.js +0 -9
- package/lib/Cli/CliKit/index.js.map +0 -1
- package/lib/Cli/CliKit/interaction.d.ts +0 -13
- package/lib/Cli/CliKit/interaction.d.ts.map +0 -1
- package/lib/Cli/CliKit/interaction.js +0 -17
- package/lib/Cli/CliKit/interaction.js.map +0 -1
- package/lib/Cli/CliKit/layer.d.ts +0 -7
- package/lib/Cli/CliKit/layer.d.ts.map +0 -1
- package/lib/Cli/CliKit/layer.js +0 -33
- package/lib/Cli/CliKit/layer.js.map +0 -1
- package/lib/Local/DevLog.d.ts +0 -32
- package/lib/Local/DevLog.d.ts.map +0 -1
- package/lib/Local/DevLog.js +0 -112
- package/lib/Local/DevLog.js.map +0 -1
- package/lib/Test/Alchemy.d.ts +0 -79
- package/lib/Test/Alchemy.d.ts.map +0 -1
- package/lib/Test/Alchemy.js +0 -193
- package/lib/Test/Alchemy.js.map +0 -1
- package/lib/Test/Bun.d.ts +0 -69
- package/lib/Test/Bun.d.ts.map +0 -1
- package/lib/Test/Bun.js +0 -126
- package/lib/Test/Bun.js.map +0 -1
- package/lib/Test/Core.d.ts +0 -277
- package/lib/Test/Core.d.ts.map +0 -1
- package/lib/Test/Core.js +0 -362
- package/lib/Test/Core.js.map +0 -1
- package/lib/Test/Http.d.ts +0 -109
- package/lib/Test/Http.d.ts.map +0 -1
- package/lib/Test/Http.js +0 -123
- package/lib/Test/Http.js.map +0 -1
- package/lib/Test/TestState.d.ts +0 -12
- package/lib/Test/TestState.d.ts.map +0 -1
- package/lib/Test/TestState.js +0 -15
- package/lib/Test/TestState.js.map +0 -1
- package/lib/Test/Vitest.d.ts +0 -60
- package/lib/Test/Vitest.d.ts.map +0 -1
- package/lib/Test/Vitest.js +0 -132
- package/lib/Test/Vitest.js.map +0 -1
- package/lib/Test/index.d.ts +0 -3
- package/lib/Test/index.d.ts.map +0 -1
- package/lib/Test/index.js +0 -3
- package/lib/Test/index.js.map +0 -1
- package/lib/Util/FileLogger.d.ts +0 -7
- package/lib/Util/FileLogger.d.ts.map +0 -1
- package/lib/Util/FileLogger.js +0 -16
- package/lib/Util/FileLogger.js.map +0 -1
- package/src/Alchemist/Progress.ts +0 -167
- package/src/Alchemist/Session.ts +0 -415
- package/src/Alchemist/routes/drift.ts +0 -87
- package/src/Alchemist/routes/nuke.ts +0 -131
- package/src/Alchemist/routes/stack.ts +0 -173
- package/src/Cli/CliKit/CliKit.ts +0 -159
- package/src/Cli/CliKit/index.ts +0 -41
- package/src/Cli/CliKit/interaction.ts +0 -19
- package/src/Cli/CliKit/layer.ts +0 -44
- package/src/Local/DevLog.ts +0 -122
- package/src/Test/Alchemy.ts +0 -334
- package/src/Test/Bun.ts +0 -230
- package/src/Test/Core.ts +0 -785
- package/src/Test/Http.ts +0 -201
- package/src/Test/TestState.ts +0 -35
- package/src/Test/Vitest.ts +0 -239
- package/src/Test/index.ts +0 -2
- package/src/Util/FileLogger.ts +0 -20
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { newWebSocketRpcSession, type RpcStub } from "capnweb";
|
|
2
2
|
import * as Config from "effect/Config";
|
|
3
3
|
import * as Context from "effect/Context";
|
|
4
|
+
import * as Data from "effect/Data";
|
|
4
5
|
import * as Effect from "effect/Effect";
|
|
5
6
|
import * as HttpBody from "effect/http/HttpBody";
|
|
6
7
|
import * as HttpClient from "effect/http/HttpClient";
|
|
@@ -14,6 +15,20 @@ import type { RpcProxyApi, SessionProviderCounts } from "./RpcServer.ts";
|
|
|
14
15
|
import { encodeSessionEnvironment, SESSION_ENV_PARAM } from "./RpcServerEnvironment.ts";
|
|
15
16
|
import type { RpcSpawnPayload } from "./RpcSpawner.ts";
|
|
16
17
|
|
|
18
|
+
export class RpcProviderProxyOperationFailed extends Data.TaggedError(
|
|
19
|
+
"RpcProviderProxyOperationFailed",
|
|
20
|
+
)<{
|
|
21
|
+
readonly message: string;
|
|
22
|
+
readonly cause?: unknown;
|
|
23
|
+
}> {}
|
|
24
|
+
|
|
25
|
+
export class RpcProviderProxyUnexpectedResponse extends Data.TaggedError(
|
|
26
|
+
"RpcProviderProxyUnexpectedResponse",
|
|
27
|
+
)<{
|
|
28
|
+
readonly message: string;
|
|
29
|
+
readonly cause?: unknown;
|
|
30
|
+
}> {}
|
|
31
|
+
|
|
17
32
|
/** A test file's leases on the sessions it actually uses. */
|
|
18
33
|
export interface SessionOwner {
|
|
19
34
|
closed: boolean;
|
|
@@ -100,28 +115,20 @@ const make = Effect.fn(function* (spawnerUrl: string) {
|
|
|
100
115
|
});
|
|
101
116
|
const body = yield* response.text;
|
|
102
117
|
if (response.status !== 200) {
|
|
103
|
-
return yield*
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
),
|
|
107
|
-
);
|
|
118
|
+
return yield* new RpcProviderProxyOperationFailed({
|
|
119
|
+
message: `RPC spawner POST ${spawnerUrl} returned ${response.status}: ${body.slice(0, 300)}`,
|
|
120
|
+
});
|
|
108
121
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return yield* Effect.fail(
|
|
114
|
-
new Error(
|
|
115
|
-
`RPC spawner POST ${spawnerUrl} did not return a websocket URL (got ${JSON.stringify(body.slice(0, 200))})`,
|
|
116
|
-
),
|
|
117
|
-
);
|
|
122
|
+
if (!URL.canParse(body)) {
|
|
123
|
+
return yield* new RpcProviderProxyUnexpectedResponse({
|
|
124
|
+
message: `RPC spawner POST ${spawnerUrl} did not return a websocket URL (got ${JSON.stringify(body.slice(0, 200))})`,
|
|
125
|
+
});
|
|
118
126
|
}
|
|
127
|
+
const websocketUrl = new URL(body);
|
|
119
128
|
if (websocketUrl.protocol !== "ws:" && websocketUrl.protocol !== "wss:") {
|
|
120
|
-
return yield*
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
),
|
|
124
|
-
);
|
|
129
|
+
return yield* new RpcProviderProxyUnexpectedResponse({
|
|
130
|
+
message: `RPC spawner POST ${spawnerUrl} returned a non-websocket URL: ${websocketUrl.toString()}`,
|
|
131
|
+
});
|
|
125
132
|
}
|
|
126
133
|
websocketUrl.searchParams.set(SESSION_ENV_PARAM, sessionEnv);
|
|
127
134
|
const socket = new WebSocket(websocketUrl.toString());
|
|
@@ -185,7 +192,7 @@ const make = Effect.fn(function* (spawnerUrl: string) {
|
|
|
185
192
|
(entry) => entry.connection !== undefined,
|
|
186
193
|
)?.connection;
|
|
187
194
|
return connection === undefined
|
|
188
|
-
? Effect.
|
|
195
|
+
? Effect.undefined
|
|
189
196
|
: Effect.tryPromise(async () => (await connection.pending).rpc.getDiagnostics()).pipe(
|
|
190
197
|
Effect.map(
|
|
191
198
|
({ sessions, testSessions, contexts, building, artifactBags, artifacts }) => ({
|
|
@@ -239,8 +246,9 @@ const make = Effect.fn(function* (spawnerUrl: string) {
|
|
|
239
246
|
let connection = current.connection;
|
|
240
247
|
if (connection === undefined) {
|
|
241
248
|
const open = getSession(environment);
|
|
249
|
+
const context = yield* Effect.context();
|
|
242
250
|
connection = {
|
|
243
|
-
pending: Effect.
|
|
251
|
+
pending: Effect.runPromiseWith(context)(
|
|
244
252
|
current.testOwned ? open.pipe(Effect.timeout("30 seconds")) : open,
|
|
245
253
|
),
|
|
246
254
|
};
|
|
@@ -12,13 +12,21 @@ import * as Stream from "effect/Stream";
|
|
|
12
12
|
import * as Output from "../Output.ts";
|
|
13
13
|
import { isRedactedMarker, type RedactedMarker } from "../RuntimeContext.ts";
|
|
14
14
|
import { decodeDuration, DURATION_MARKER, encodeState } from "../State/StateEncoding.ts";
|
|
15
|
+
import {
|
|
16
|
+
currentTraceParent,
|
|
17
|
+
type TraceParent,
|
|
18
|
+
withStreamTraceParent,
|
|
19
|
+
withTraceParent,
|
|
20
|
+
} from "../Util/TraceParent.ts";
|
|
15
21
|
|
|
16
22
|
type RpcEffectHandler<Args extends Array<any>, Success, Error> = (
|
|
17
23
|
...args: Args
|
|
18
24
|
) => Effect.Effect<Success, Error>;
|
|
19
25
|
|
|
26
|
+
// `parent`: the caller's span, so the sidecar's work joins its trace.
|
|
20
27
|
type RpcWrappedEffectHandler<Args extends Array<any>, Success, Error> = (
|
|
21
28
|
args: Args,
|
|
29
|
+
parent?: TraceParent,
|
|
22
30
|
) => Promise<RpcSerializedExit<Success, Error>>;
|
|
23
31
|
|
|
24
32
|
type RpcStreamHandler<Args extends Array<any>, Success, Error> = (
|
|
@@ -27,6 +35,7 @@ type RpcStreamHandler<Args extends Array<any>, Success, Error> = (
|
|
|
27
35
|
|
|
28
36
|
type RpcWrappedStreamHandler<Args extends Array<any>, Success, Error> = (
|
|
29
37
|
args: Args,
|
|
38
|
+
parent?: TraceParent,
|
|
30
39
|
) => RpcSerializedStream<Success, Error>;
|
|
31
40
|
|
|
32
41
|
type RpcSerializedStream<Success, _Error> = ReadableStream<Success>;
|
|
@@ -186,11 +195,12 @@ const wrapRpcEffectHandler = <Args extends Array<any>, Success, Error>(
|
|
|
186
195
|
registerCall?: Effect.Effect<void, never, Scope.Scope>,
|
|
187
196
|
): RpcWrappedEffectHandler<Args, Success, Error> =>
|
|
188
197
|
flow(
|
|
189
|
-
(args) =>
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
?
|
|
193
|
-
|
|
198
|
+
(args, parent) => {
|
|
199
|
+
const call = Effect.suspend(() => handler(...(deserializeRpcArgs(args) as Args)));
|
|
200
|
+
return (
|
|
201
|
+
registerCall === undefined ? call : Effect.scoped(registerCall.pipe(Effect.andThen(call)))
|
|
202
|
+
).pipe(withTraceParent(parent));
|
|
203
|
+
},
|
|
194
204
|
Effect.exit,
|
|
195
205
|
Effect.flatMap((exit): Effect.Effect<RpcSerializedExit<Success, Error>> => {
|
|
196
206
|
if (exit._tag === "Success") {
|
|
@@ -229,11 +239,12 @@ const wrapRpcStreamHandler = <Args extends Array<any>, Success, Error>(
|
|
|
229
239
|
registerCall?: Effect.Effect<void, never, Scope.Scope>,
|
|
230
240
|
): RpcWrappedStreamHandler<Args, Success, Error> =>
|
|
231
241
|
flow(
|
|
232
|
-
(args) =>
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
?
|
|
236
|
-
|
|
242
|
+
(args, parent) => {
|
|
243
|
+
const call = Effect.sync(() => handler(...(deserializeRpcArgs(args) as Args)));
|
|
244
|
+
return Stream.unwrap(
|
|
245
|
+
registerCall === undefined ? call : registerCall.pipe(Effect.andThen(call)),
|
|
246
|
+
).pipe(withStreamTraceParent(parent));
|
|
247
|
+
},
|
|
237
248
|
(stream) => Stream.toReadableStream(stream),
|
|
238
249
|
);
|
|
239
250
|
|
|
@@ -242,7 +253,8 @@ const unwrapRpcEffectHandler = <Args extends Array<any>, Success, Error>(
|
|
|
242
253
|
): RpcEffectHandler<Args, Success, Error> =>
|
|
243
254
|
flow(
|
|
244
255
|
(...args) => serializeRpcArgs(args) as Args,
|
|
245
|
-
(args) =>
|
|
256
|
+
(args) =>
|
|
257
|
+
Effect.flatMap(currentTraceParent, (parent) => Effect.promise(() => handler(args, parent))),
|
|
246
258
|
Effect.flatMap((exit): Exit.Exit<Success, Error> => {
|
|
247
259
|
if (exit._tag === "Success") {
|
|
248
260
|
// Mirror of the wrap side: rebuild `Redacted` wrappers from their
|
|
@@ -272,12 +284,15 @@ const unwrapRpcStreamHandler = <Args extends Array<any>, Success, Error>(
|
|
|
272
284
|
): RpcStreamHandler<Args, Success, Error> =>
|
|
273
285
|
flow(
|
|
274
286
|
(...args) => serializeRpcArgs(args) as Args,
|
|
275
|
-
(args) =>
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
287
|
+
(args) =>
|
|
288
|
+
Stream.unwrap(
|
|
289
|
+
Effect.map(currentTraceParent, (parent) =>
|
|
290
|
+
Stream.fromReadableStream({
|
|
291
|
+
evaluate: () => handler(args, parent),
|
|
292
|
+
onError: (error) => error as Error,
|
|
293
|
+
}),
|
|
294
|
+
),
|
|
295
|
+
),
|
|
281
296
|
);
|
|
282
297
|
|
|
283
298
|
const serializeRpcArgs = (value: unknown): unknown => {
|
package/src/Local/RpcServer.ts
CHANGED
|
@@ -7,13 +7,14 @@ import * as Fiber from "effect/Fiber";
|
|
|
7
7
|
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
8
8
|
import type { HttpClient } from "effect/http/HttpClient";
|
|
9
9
|
import * as Layer from "effect/Layer";
|
|
10
|
-
import * as Logger from "effect/Logger";
|
|
11
10
|
import * as Scope from "effect/Scope";
|
|
12
11
|
import { ArtifactStore, createArtifactStore } from "../Artifacts.ts";
|
|
13
12
|
import type { ProviderService } from "../Provider.ts";
|
|
14
13
|
import type { ResourceLike } from "../Resource.ts";
|
|
15
|
-
import {
|
|
14
|
+
import { childJsonLogLayer, LOG_FORMAT_ENV, LogProcess } from "../Util/LogRecord.ts";
|
|
16
15
|
import { platformLayer, PlatformServices, runMain } from "../Util/PlatformServices.ts";
|
|
16
|
+
import { logShutdown } from "../Util/Shutdown.ts";
|
|
17
|
+
import { processTrace, withTraceParent } from "../Util/TraceParent.ts";
|
|
17
18
|
import * as RpcSerialization from "./RpcSerialization.ts";
|
|
18
19
|
import * as RpcServerEnvironment from "./RpcServerEnvironment.ts";
|
|
19
20
|
import type { SessionEnvironment } from "./RpcServerEnvironment.ts";
|
|
@@ -156,7 +157,7 @@ const sessionProviders = (resolve: ProviderGroupLoader) =>
|
|
|
156
157
|
};
|
|
157
158
|
sessions.set(key, session);
|
|
158
159
|
const current = session;
|
|
159
|
-
Effect.
|
|
160
|
+
Effect.runSyncWith(ambient)(
|
|
160
161
|
Scope.addFinalizer(
|
|
161
162
|
current.scope,
|
|
162
163
|
// Calls drain before provider finalizers and artifact disposal.
|
|
@@ -195,7 +196,7 @@ const sessionProviders = (resolve: ProviderGroupLoader) =>
|
|
|
195
196
|
);
|
|
196
197
|
}
|
|
197
198
|
const groupScope = Scope.forkUnsafe(current.resources);
|
|
198
|
-
const pending = Effect.
|
|
199
|
+
const pending = Effect.runPromiseWith(ambient)(
|
|
199
200
|
resolve(group).pipe(
|
|
200
201
|
Effect.flatMap((providers) =>
|
|
201
202
|
Layer.buildWithMemoMap(
|
|
@@ -265,7 +266,7 @@ const sessionProviders = (resolve: ProviderGroupLoader) =>
|
|
|
265
266
|
lease.closing =
|
|
266
267
|
session === undefined
|
|
267
268
|
? Promise.resolve()
|
|
268
|
-
: Effect.
|
|
269
|
+
: Effect.runPromiseWith(ambient)(Scope.close(session.scope, Exit.void));
|
|
269
270
|
return lease.closing;
|
|
270
271
|
},
|
|
271
272
|
get: async (sessionEnv, type, group, lease) => {
|
|
@@ -332,14 +333,15 @@ export const launch = (providers: ProviderLayer | ProviderGroupLoader) =>
|
|
|
332
333
|
sessionProviders(Layer.isLayer(providers) ? () => Effect.succeed(providers) : providers),
|
|
333
334
|
),
|
|
334
335
|
Layer.provide(Layer.mergeAll(PlatformServices, FetchHttpClient.layer)),
|
|
335
|
-
// Sidecar stdio is piped, so effect's default pretty logger disables
|
|
336
|
-
// colors (it only checks `isTTY`, never FORCE_COLOR). The spawner sets
|
|
337
|
-
// FORCE_COLOR exactly when the destination terminal supports color —
|
|
338
|
-
// honor it here so sidecar log lines match the rest of the dev output.
|
|
339
|
-
Layer.provide(
|
|
340
|
-
process.env.FORCE_COLOR ? Logger.layer([makePlainConsoleSink(true)]) : Layer.empty,
|
|
341
|
-
),
|
|
342
336
|
Layer.launch,
|
|
337
|
+
logShutdown("sidecar"),
|
|
338
|
+
// Spans outside RPC calls join the `alchemy dev` trace, like its records.
|
|
339
|
+
withTraceParent(processTrace),
|
|
340
|
+
// The spawner asks for JSON records: the process that owns the
|
|
341
|
+
// terminal decodes and renders them, so structure (level, resource,
|
|
342
|
+
// text as written) survives the pipe.
|
|
343
|
+
Effect.provide(process.env[LOG_FORMAT_ENV] === "json" ? childJsonLogLayer : Layer.empty),
|
|
344
|
+
Effect.provideService(LogProcess, "sidecar"),
|
|
343
345
|
Effect.scoped,
|
|
344
346
|
runMain,
|
|
345
347
|
);
|
|
@@ -363,15 +365,17 @@ export const layerServer = (
|
|
|
363
365
|
/** Called when the parent connection, indicated by the `/parent` path, is established. */
|
|
364
366
|
parentConnected: () => void;
|
|
365
367
|
/** Called when the parent disconnects. The server will shut down when this is called. */
|
|
366
|
-
|
|
368
|
+
/** The parent link closed; `detail` says how, when the server knows. */
|
|
369
|
+
parentDisconnected: (detail?: string) => void;
|
|
367
370
|
}) => Effect.Effect<{ readonly url: string }, never, Scope.Scope>,
|
|
368
371
|
) =>
|
|
369
372
|
Layer.effect(
|
|
370
373
|
RpcServer,
|
|
371
374
|
Effect.gen(function* () {
|
|
372
375
|
const providers = yield* SessionProviders;
|
|
376
|
+
const context = yield* Effect.context();
|
|
373
377
|
const connected = yield* Deferred.make<void>();
|
|
374
|
-
const disconnected = yield* Deferred.make<
|
|
378
|
+
const disconnected = yield* Deferred.make<string | undefined>();
|
|
375
379
|
const { url } = yield* serve({
|
|
376
380
|
createRpcSession: (ws, sessionEnv) => {
|
|
377
381
|
const lease: SessionLease = { closed: false, calls: new Set() };
|
|
@@ -395,18 +399,22 @@ export const layerServer = (
|
|
|
395
399
|
// deliberately retain their contexts across hot reloads.
|
|
396
400
|
if (testOwned) {
|
|
397
401
|
void providers.release(lease).catch((error) => {
|
|
398
|
-
Effect.
|
|
402
|
+
Effect.runForkWith(context)(Effect.logError(error));
|
|
399
403
|
});
|
|
400
404
|
}
|
|
401
405
|
};
|
|
402
406
|
return session;
|
|
403
407
|
},
|
|
404
408
|
parentConnected: () => Deferred.doneUnsafe(connected, Effect.void),
|
|
405
|
-
parentDisconnected: () => Deferred.doneUnsafe(disconnected, Effect.
|
|
409
|
+
parentDisconnected: (detail) => Deferred.doneUnsafe(disconnected, Effect.succeed(detail)),
|
|
406
410
|
});
|
|
407
411
|
yield* Console.log(`<ALCHEMY_RPC_ADDRESS>${url}</ALCHEMY_RPC_ADDRESS>`);
|
|
408
412
|
yield* Deferred.await(connected).pipe(Effect.timeout("10 seconds")); // TODO(john): should the timeout be shorter?
|
|
409
|
-
|
|
413
|
+
// The sidecar exits with its parent; record why the link closed.
|
|
414
|
+
const detail = yield* Deferred.await(disconnected);
|
|
415
|
+
yield* Effect.logInfo(
|
|
416
|
+
`parent connection closed${detail === undefined ? "" : ` (${detail})`}; shutting down`,
|
|
417
|
+
);
|
|
410
418
|
return yield* Effect.interrupt;
|
|
411
419
|
}),
|
|
412
420
|
);
|
|
@@ -12,6 +12,9 @@ export const RpcServerBun = RpcServer.layerServer(
|
|
|
12
12
|
| { type: "parent" }
|
|
13
13
|
>({
|
|
14
14
|
port: 0,
|
|
15
|
+
// Loopback only, as in RpcServerNode: with no hostname Bun listens on
|
|
16
|
+
// every interface.
|
|
17
|
+
hostname: "127.0.0.1",
|
|
15
18
|
fetch: (request, server) => {
|
|
16
19
|
const url = new URL(request.url);
|
|
17
20
|
if (
|
|
@@ -56,17 +59,18 @@ export const RpcServerBun = RpcServer.layerServer(
|
|
|
56
59
|
if (ws.data.type === "session") {
|
|
57
60
|
ws.data.session.dispatch.close(code, reason);
|
|
58
61
|
} else if (ws.data.type === "parent") {
|
|
59
|
-
|
|
60
|
-
console.error(
|
|
61
|
-
`[alchemy sidecar] parent connection closed (code ${code}${reason ? `, ${reason}` : ""}); shutting down`,
|
|
62
|
-
);
|
|
63
|
-
parentDisconnected();
|
|
62
|
+
parentDisconnected(`code ${code}${reason ? `, ${reason}` : ""}`);
|
|
64
63
|
}
|
|
65
64
|
},
|
|
66
65
|
},
|
|
67
66
|
}),
|
|
68
67
|
);
|
|
69
|
-
|
|
68
|
+
// Fire and forget: awaiting `stop(true)` can outlive the process's own shutdown.
|
|
69
|
+
yield* Effect.addFinalizer(() =>
|
|
70
|
+
Effect.sync(() => {
|
|
71
|
+
void server.stop(true);
|
|
72
|
+
}),
|
|
73
|
+
);
|
|
70
74
|
return {
|
|
71
75
|
url: `ws://${server.hostname}:${server.port}`,
|
|
72
76
|
};
|
|
@@ -4,9 +4,9 @@ import * as Effect from "effect/Effect";
|
|
|
4
4
|
import * as Layer from "effect/Layer";
|
|
5
5
|
import * as Option from "effect/Option";
|
|
6
6
|
import { AlchemyContext } from "../AlchemyContext.ts";
|
|
7
|
-
import { AuthProviders } from "../Auth/AuthProvider.ts";
|
|
8
7
|
import { CredentialsStoreLive } from "../Auth/Credentials.ts";
|
|
9
8
|
import { ProfileStoreLive } from "../Auth/Profile.ts";
|
|
9
|
+
import { AuthProvidersLive } from "../Auth/Registry.ts";
|
|
10
10
|
import { withProfileOverride } from "../Auth/Resolve.ts";
|
|
11
11
|
import { Stack } from "../Stack.ts";
|
|
12
12
|
import { Stage } from "../Stage.ts";
|
|
@@ -58,7 +58,7 @@ export const layer = (
|
|
|
58
58
|
Layer.mergeAll(
|
|
59
59
|
ProfileStoreLive,
|
|
60
60
|
CredentialsStoreLive,
|
|
61
|
-
|
|
61
|
+
AuthProvidersLive,
|
|
62
62
|
loadConfigProvider(Option.fromNullishOr(environment.envFile)).pipe(
|
|
63
63
|
Effect.map((base) => withProfileOverride(base, environment.profile)),
|
|
64
64
|
ConfigProvider.layer,
|
|
@@ -20,7 +20,14 @@ export const RpcServerNode = RpcServer.layerServer(
|
|
|
20
20
|
undefined;
|
|
21
21
|
const session = createRpcSession(ws, sessionEnv);
|
|
22
22
|
ws.on("message", (data) => {
|
|
23
|
-
session.dispatch.message(
|
|
23
|
+
session.dispatch.message(
|
|
24
|
+
(Array.isArray(data)
|
|
25
|
+
? Buffer.concat(data)
|
|
26
|
+
: Buffer.isBuffer(data)
|
|
27
|
+
? data
|
|
28
|
+
: Buffer.from(data)
|
|
29
|
+
).toString(),
|
|
30
|
+
);
|
|
24
31
|
});
|
|
25
32
|
ws.on("close", (code, reason) => {
|
|
26
33
|
session.dispatch.close(code, reason.toString());
|
|
@@ -4,7 +4,7 @@ import { RpcSession, type RpcCompatible, type RpcTransport } from "capnweb";
|
|
|
4
4
|
* A platform-agnostic interface for a server-side WebSocket.
|
|
5
5
|
*/
|
|
6
6
|
export interface ServerWebSocketLike {
|
|
7
|
-
send: (message: string) => any
|
|
7
|
+
send: (message: string) => any;
|
|
8
8
|
close: (code?: number, reason?: string) => void;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -32,7 +32,7 @@ function makeWebSocketRpcTransport(ws: ServerWebSocketLike) {
|
|
|
32
32
|
let receiveQueue: Array<string> = [];
|
|
33
33
|
let receiveResolver: ((value: string) => void) | undefined;
|
|
34
34
|
let receiveRejecter: ((reason: unknown) => void) | undefined;
|
|
35
|
-
let error: unknown
|
|
35
|
+
let error: unknown;
|
|
36
36
|
return {
|
|
37
37
|
transport: {
|
|
38
38
|
send: async (message: string) => await ws.send(message),
|
package/src/Local/RpcSpawner.ts
CHANGED
|
@@ -2,11 +2,12 @@ import { fileURLToPath } from "node:url";
|
|
|
2
2
|
import * as Cache from "effect/Cache";
|
|
3
3
|
import type * as Cause from "effect/Cause";
|
|
4
4
|
import * as Config from "effect/Config";
|
|
5
|
-
import * as Console from "effect/Console";
|
|
6
5
|
import * as Context from "effect/Context";
|
|
6
|
+
import * as Data from "effect/Data";
|
|
7
7
|
import * as Deferred from "effect/Deferred";
|
|
8
8
|
import * as Duration from "effect/Duration";
|
|
9
9
|
import * as Effect from "effect/Effect";
|
|
10
|
+
import * as Fiber from "effect/Fiber";
|
|
10
11
|
import * as HttpClient from "effect/http/HttpClient";
|
|
11
12
|
import * as HttpServer from "effect/http/HttpServer";
|
|
12
13
|
import { HttpServerRequest } from "effect/http/HttpServerRequest";
|
|
@@ -21,9 +22,12 @@ import * as Schedule from "effect/Schedule";
|
|
|
21
22
|
import * as Schema from "effect/Schema";
|
|
22
23
|
import * as Scope from "effect/Scope";
|
|
23
24
|
import * as Stream from "effect/Stream";
|
|
25
|
+
import { LOG_FORMAT_ENV, logChildLine } from "../Util/LogRecord.ts";
|
|
24
26
|
import { nodeLoaderArgs } from "../Util/Node.ts";
|
|
25
27
|
import { httpServer } from "../Util/PlatformServices.ts";
|
|
28
|
+
import { timedShutdownStep } from "../Util/Shutdown.ts";
|
|
26
29
|
import { pipedColorEnv } from "../Util/Terminal.ts";
|
|
30
|
+
import { traceParentEnv } from "../Util/TraceParent.ts";
|
|
27
31
|
import { SPAWNER_URL_ENV_KEY } from "./RpcProviderProxy.ts";
|
|
28
32
|
import { RPC_SERVER_ENVIRONMENT_KEY, type RpcServerEnvironment } from "./RpcServerEnvironment.ts";
|
|
29
33
|
|
|
@@ -34,6 +38,10 @@ export class RpcSpawner extends Context.Service<
|
|
|
34
38
|
}
|
|
35
39
|
>()("alchemy/Local/RpcSpawner") {}
|
|
36
40
|
|
|
41
|
+
class InvalidServerEntryUrl extends Data.TaggedError("InvalidServerEntryUrl")<{
|
|
42
|
+
cause: unknown;
|
|
43
|
+
}> {}
|
|
44
|
+
|
|
37
45
|
/**
|
|
38
46
|
* The spawner forks one child per distinct `serverEntryUrl`. Stack-specific
|
|
39
47
|
* context (stack name/stage, AlchemyContext) is NOT part of the spawn key —
|
|
@@ -103,10 +111,9 @@ export const make = Effect.fn(function* ({ profile, envFile, omitEnv = [] }: Rpc
|
|
|
103
111
|
for (const notify of subscribers) notify(line);
|
|
104
112
|
return Effect.void;
|
|
105
113
|
}
|
|
106
|
-
// Fallback path (no exec child subscribed):
|
|
107
|
-
//
|
|
108
|
-
|
|
109
|
-
return line.channel === "stderr" ? Console.error(line.line) : Console.log(line.line);
|
|
114
|
+
// Fallback path (no exec child subscribed): render the sidecar's
|
|
115
|
+
// records through this process's loggers.
|
|
116
|
+
return logChildLine(line.line, { stream: line.channel, process: "sidecar" });
|
|
110
117
|
});
|
|
111
118
|
|
|
112
119
|
const spawn = Effect.fn(function* (serverEntryUrl: string) {
|
|
@@ -157,6 +164,13 @@ export const make = Effect.fn(function* ({ profile, envFile, omitEnv = [] }: Rpc
|
|
|
157
164
|
env: {
|
|
158
165
|
...(omitEnv.length > 0 ? yield* inheritedEnv(omitEnv) : {}),
|
|
159
166
|
[RPC_SERVER_ENVIRONMENT_KEY]: JSON.stringify(environment),
|
|
167
|
+
// Its startup joins the trace of the call that spawned it; each
|
|
168
|
+
// provider call then carries its caller's span (RpcSerialization).
|
|
169
|
+
...(yield* traceParentEnv),
|
|
170
|
+
// Log records, not rendered text: see `forwardSidecarLogs`.
|
|
171
|
+
[LOG_FORMAT_ENV]: "json",
|
|
172
|
+
// Tools further down (vite, workerd) still style their own output;
|
|
173
|
+
// records keep that text as written.
|
|
160
174
|
...pipedColorEnv(),
|
|
161
175
|
},
|
|
162
176
|
// With variables to withhold, the full environment is built above.
|
|
@@ -164,20 +178,36 @@ export const make = Effect.fn(function* ({ profile, envFile, omitEnv = [] }: Rpc
|
|
|
164
178
|
},
|
|
165
179
|
);
|
|
166
180
|
const handle = yield* spawner.spawn(command);
|
|
167
|
-
yield* handle.stderr.pipe(
|
|
181
|
+
const stderrReader = yield* handle.stderr.pipe(
|
|
168
182
|
Stream.decodeText,
|
|
169
183
|
Stream.splitLines,
|
|
170
184
|
Stream.runForEach((line) => publish({ channel: "stderr", line })),
|
|
171
185
|
Effect.ignore,
|
|
172
186
|
Effect.forkScoped,
|
|
173
187
|
);
|
|
188
|
+
const stdout = yield* readRpcOutput(handle.stdout, (line) =>
|
|
189
|
+
publish({ channel: "stdout", line }),
|
|
190
|
+
);
|
|
174
191
|
// This scope is the child handle's sole owner. Graceful shutdown runs this
|
|
175
192
|
// finalizer; abrupt parent loss closes the RPC parent connection and the
|
|
176
193
|
// child self-terminates (both paths are covered by RpcSpawnerCleanup).
|
|
177
194
|
// Command cleanup allows 1s for TERM and 1s for KILL; reserve 1s for sidecar teardown.
|
|
178
195
|
const kill = handle.kill({ forceKillAfter: "3 seconds" });
|
|
179
|
-
|
|
180
|
-
|
|
196
|
+
// Registered after the readers, so it runs before they are interrupted:
|
|
197
|
+
// the sidecar's own shutdown records drain until its pipes close.
|
|
198
|
+
yield* Effect.addFinalizer(() =>
|
|
199
|
+
kill.pipe(
|
|
200
|
+
Effect.ignore,
|
|
201
|
+
Effect.andThen(
|
|
202
|
+
Fiber.joinAll([stderrReader, stdout.reader]).pipe(
|
|
203
|
+
Effect.timeout("1 second"),
|
|
204
|
+
Effect.ignore,
|
|
205
|
+
),
|
|
206
|
+
),
|
|
207
|
+
timedShutdownStep(`stopped sidecar pid ${handle.pid}`),
|
|
208
|
+
),
|
|
209
|
+
);
|
|
210
|
+
const url = yield* Deferred.await(stdout.address);
|
|
181
211
|
const ws = yield* Effect.acquireRelease(
|
|
182
212
|
Effect.sync(() => {
|
|
183
213
|
const ws = new WebSocket(new URL("/parent", url));
|
|
@@ -219,8 +249,8 @@ export const make = Effect.fn(function* ({ profile, envFile, omitEnv = [] }: Rpc
|
|
|
219
249
|
new Error(`Failed to spawn RPC server for "${serverEntryUrl}" after ${attempt} attempts.`),
|
|
220
250
|
);
|
|
221
251
|
}
|
|
222
|
-
yield*
|
|
223
|
-
`
|
|
252
|
+
yield* Effect.logWarning(
|
|
253
|
+
`RPC sidecar for ${serverEntryUrl} is no longer running; respawning (attempt ${attempt + 1})`,
|
|
224
254
|
);
|
|
225
255
|
// The sidecar is usually already gone, and killing an exited process fails.
|
|
226
256
|
yield* child.kill.pipe(Effect.ignore);
|
|
@@ -282,7 +312,7 @@ export const make = Effect.fn(function* ({ profile, envFile, omitEnv = [] }: Rpc
|
|
|
282
312
|
const entry = yield* Effect.result(
|
|
283
313
|
Effect.try({
|
|
284
314
|
try: () => new URL(decoded.success.serverEntryUrl),
|
|
285
|
-
catch: (cause) => cause,
|
|
315
|
+
catch: (cause) => new InvalidServerEntryUrl({ cause }),
|
|
286
316
|
}),
|
|
287
317
|
);
|
|
288
318
|
if (entry._tag === "Failure" || entry.success.protocol !== "file:") {
|
|
@@ -320,28 +350,29 @@ export const layerServer = (environment: RpcSpawnerOptions) =>
|
|
|
320
350
|
|
|
321
351
|
const RPC_ADDRESS_REGEX = /(<ALCHEMY_RPC_ADDRESS>)(.+)(<\/ALCHEMY_RPC_ADDRESS>)/;
|
|
322
352
|
|
|
323
|
-
|
|
353
|
+
/**
|
|
354
|
+
* Read the sidecar's stdout: its log lines and the RPC address line. The
|
|
355
|
+
* reader runs until the pipe closes, so a caller can drain it on shutdown.
|
|
356
|
+
*/
|
|
357
|
+
const readRpcOutput = (
|
|
324
358
|
stdout: Stream.Stream<Uint8Array, PlatformError>,
|
|
325
359
|
publish: (line: string) => Effect.Effect<void>,
|
|
326
360
|
) =>
|
|
327
361
|
Effect.gen(function* () {
|
|
328
362
|
const address = yield* Deferred.make<string>();
|
|
329
|
-
//
|
|
330
|
-
|
|
331
|
-
yield* stdout.pipe(
|
|
363
|
+
// Every line but the address is published, including what the sidecar
|
|
364
|
+
// logs while starting: a layer that fails to build says why there.
|
|
365
|
+
const reader = yield* stdout.pipe(
|
|
332
366
|
Stream.decodeText,
|
|
333
367
|
Stream.splitLines,
|
|
334
368
|
Stream.runForEach((line) => {
|
|
335
369
|
const match = line.match(RPC_ADDRESS_REGEX);
|
|
336
|
-
|
|
337
|
-
addressSeen = true;
|
|
338
|
-
return Deferred.succeed(address, match[2]);
|
|
339
|
-
}
|
|
340
|
-
return addressSeen ? publish(line) : Effect.void;
|
|
370
|
+
return match ? Deferred.succeed(address, match[2]) : publish(line);
|
|
341
371
|
}),
|
|
372
|
+
Effect.ignore,
|
|
342
373
|
Effect.forkScoped,
|
|
343
374
|
);
|
|
344
|
-
return
|
|
375
|
+
return { address, reader };
|
|
345
376
|
});
|
|
346
377
|
|
|
347
378
|
export const parseSidecarLogLine = (raw: string): SidecarLogLine | undefined => {
|
|
@@ -355,19 +386,16 @@ export const parseSidecarLogLine = (raw: string): SidecarLogLine | undefined =>
|
|
|
355
386
|
};
|
|
356
387
|
|
|
357
388
|
/**
|
|
358
|
-
* Pull
|
|
359
|
-
* into THIS process's
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
389
|
+
* Pull the sidecars' log records from the spawner (the outer `alchemy dev`
|
|
390
|
+
* process) into THIS process's loggers. The exec child owns the terminal
|
|
391
|
+
* renderer, so the records render above the repainting progress region
|
|
392
|
+
* instead of racing it on the shared tty; it forwards them on to the
|
|
393
|
+
* supervisor, which writes the run log. Forks in the ambient scope and never fails: when no spawner is
|
|
363
394
|
* configured (`ALCHEMY_RPC_SPAWNER_URL` absent — plain deploy/destroy) it is
|
|
364
395
|
* a no-op, and if the connection drops the spawner's own fallback printing
|
|
365
396
|
* takes over.
|
|
366
397
|
*/
|
|
367
|
-
export const forwardSidecarLogs =
|
|
368
|
-
/** Mirrors every forwarded line (e.g. into a dev log file). */
|
|
369
|
-
tee?: (line: SidecarLogLine) => void,
|
|
370
|
-
): Effect.Effect<void, never, HttpClient.HttpClient | Scope.Scope> =>
|
|
398
|
+
export const forwardSidecarLogs: Effect.Effect<void, never, HttpClient.HttpClient | Scope.Scope> =
|
|
371
399
|
Config.String(SPAWNER_URL_ENV_KEY).pipe(
|
|
372
400
|
Effect.flatMap((spawnerUrl) => {
|
|
373
401
|
const streamOnce = Effect.gen(function* () {
|
|
@@ -380,13 +408,9 @@ export const forwardSidecarLogs = (
|
|
|
380
408
|
Effect.suspend(() => {
|
|
381
409
|
const parsed = parseSidecarLogLine(raw);
|
|
382
410
|
if (parsed === undefined) return Effect.void;
|
|
383
|
-
|
|
384
|
-
//
|
|
385
|
-
|
|
386
|
-
// this process's logger would stamp a second prefix on top.
|
|
387
|
-
return parsed.channel === "stderr"
|
|
388
|
-
? Console.error(parsed.line)
|
|
389
|
-
: Console.log(parsed.line);
|
|
411
|
+
// Sidecar lines are log records: replay them through this
|
|
412
|
+
// process's loggers, which render them (or pass them on as JSON).
|
|
413
|
+
return logChildLine(parsed.line, { stream: parsed.channel, process: "sidecar" });
|
|
390
414
|
}),
|
|
391
415
|
),
|
|
392
416
|
);
|
package/src/Local/Sidecar.ts
CHANGED
|
@@ -13,10 +13,17 @@
|
|
|
13
13
|
* (`RpcSpawner`) forks this entry once per run; `RpcProviderProxy` points
|
|
14
14
|
* every provider at it.
|
|
15
15
|
*/
|
|
16
|
+
|
|
17
|
+
import * as Data from "effect/Data";
|
|
16
18
|
import * as Effect from "effect/Effect";
|
|
17
19
|
import * as Layer from "effect/Layer";
|
|
18
20
|
import * as RpcServer from "./RpcServer.ts";
|
|
19
21
|
|
|
22
|
+
export class SidecarInvalidProps extends Data.TaggedError("SidecarInvalidProps")<{
|
|
23
|
+
readonly message: string;
|
|
24
|
+
readonly cause?: unknown;
|
|
25
|
+
}> {}
|
|
26
|
+
|
|
20
27
|
RpcServer.launch((group) =>
|
|
21
28
|
Effect.promise(() => import(group)).pipe(
|
|
22
29
|
Effect.flatMap((module: { default?: unknown }) =>
|
|
@@ -24,7 +31,9 @@ RpcServer.launch((group) =>
|
|
|
24
31
|
? // oxlint-disable-next-line effecttsgo/unsafe-effect-type-assertion -- dynamically imported provider group module
|
|
25
32
|
Effect.succeed(module.default as RpcServer.ProviderLayer)
|
|
26
33
|
: Effect.fail(
|
|
27
|
-
new
|
|
34
|
+
new SidecarInvalidProps({
|
|
35
|
+
message: `Provider group module ${group} must default-export its provider Layer`,
|
|
36
|
+
}),
|
|
28
37
|
),
|
|
29
38
|
),
|
|
30
39
|
),
|