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
package/src/Interaction.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
2
|
+
* The capability to talk to the human driving this process.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
4
|
+
* One contract, two renderers:
|
|
5
|
+
*
|
|
6
|
+
* - {@link layerSigil} — the interactive Sigil renderer: live rows,
|
|
7
|
+
* prompts as real screens, full-screen sessions.
|
|
8
|
+
* - {@link layerNonInteractive} — append-only plain output for CI, piped
|
|
9
|
+
* output, the Alchemist API and tests. Views print once, every prompt,
|
|
10
|
+
* screen and session fails with the typed {@link NonInteractiveTerminal}.
|
|
11
|
+
*
|
|
12
|
+
* {@link layer} picks between them from the terminal's capabilities, so
|
|
13
|
+
* callers never branch on the renderer themselves.
|
|
12
14
|
*
|
|
13
15
|
* Child processes (the RPC sidecar, spawned dev children) deliberately do
|
|
14
16
|
* NOT provide this service at all — interaction capability is structural,
|
|
@@ -23,9 +25,11 @@ import * as Exit from "effect/Exit";
|
|
|
23
25
|
import * as Layer from "effect/Layer";
|
|
24
26
|
import * as Option from "effect/Option";
|
|
25
27
|
import { ChildProcess } from "effect/process";
|
|
28
|
+
import type { ChildProcessSpawner } from "effect/process/ChildProcessSpawner";
|
|
29
|
+
import type * as Scope from "effect/Scope";
|
|
30
|
+
import type { ReactNode } from "react";
|
|
26
31
|
import { UserFacingError } from "./UserFacingError.ts";
|
|
27
|
-
import { ANSI_DIM, ANSI_RESET, ansiFg, colorsEnabled } from "./Util/Terminal.ts";
|
|
28
|
-
import { unicodeEnabled } from "./Util/Terminal.ts";
|
|
32
|
+
import { ANSI_DIM, ANSI_RESET, ansiFg, colorsEnabled, unicodeEnabled } from "./Util/Terminal.ts";
|
|
29
33
|
import { glyphsFor, statusColor, type StatusVariant } from "./Util/Theme.ts";
|
|
30
34
|
|
|
31
35
|
/** The user dismissed the active terminal interaction. */
|
|
@@ -107,20 +111,24 @@ export interface MultiSelectOptions<Value> extends Omit<SelectOptions<Value>, "i
|
|
|
107
111
|
readonly required?: boolean;
|
|
108
112
|
}
|
|
109
113
|
|
|
110
|
-
export interface
|
|
111
|
-
|
|
112
|
-
readonly
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
export interface BrowserLoginOptions<A, E, R, E2 = never, R2 = never> {
|
|
115
|
+
/** Display name, e.g. `"Railway"`; titles the login. */
|
|
116
|
+
readonly provider: string;
|
|
117
|
+
/** The page the user logs in on. Opened in their browser for them. */
|
|
118
|
+
readonly url: string;
|
|
119
|
+
/** Short code the user confirms on the login page (device flows). */
|
|
115
120
|
readonly code?: string;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
readonly
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
/** @default "waiting for browser authorization (up to 5 minutes)…" */
|
|
122
|
+
readonly waitingLabel?: string;
|
|
123
|
+
/** Completes the login: a token poll, a CLI process, an OAuth callback. */
|
|
124
|
+
readonly waitFor: Effect.Effect<A, E, R>;
|
|
125
|
+
/** Let the user paste a code instead, exchanged for the same result. */
|
|
126
|
+
readonly manualCode?: {
|
|
127
|
+
readonly label?: string;
|
|
128
|
+
readonly placeholder?: string;
|
|
129
|
+
readonly validate?: (value: string) => string | Error | undefined;
|
|
130
|
+
readonly exchange: (code: string) => Effect.Effect<A, E2, R2>;
|
|
131
|
+
};
|
|
124
132
|
}
|
|
125
133
|
|
|
126
134
|
export interface ProgressOptions {
|
|
@@ -132,15 +140,90 @@ export interface ProgressOptions {
|
|
|
132
140
|
readonly spinning?: boolean;
|
|
133
141
|
}
|
|
134
142
|
|
|
143
|
+
/** A composable layout. Views are inert; only a renderer draws them. */
|
|
144
|
+
export type View = ReactNode;
|
|
145
|
+
|
|
146
|
+
/** What the terminal behind this process can do. */
|
|
147
|
+
export interface TerminalCapabilities {
|
|
148
|
+
/** Whether this process has usable terminal input for prompts and sessions. */
|
|
149
|
+
readonly input: boolean;
|
|
150
|
+
readonly columns: number;
|
|
151
|
+
readonly rows: number;
|
|
152
|
+
readonly colors: boolean;
|
|
153
|
+
readonly unicode: boolean;
|
|
154
|
+
/** Whether full-screen sessions may use the terminal's alternate buffer. */
|
|
155
|
+
readonly alternateScreen: boolean;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface ScreenController<Value> {
|
|
159
|
+
readonly submit: (value: Value, summary?: View) => void;
|
|
160
|
+
readonly cancel: () => void;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* An interactive scene. The scene owns its local component state while the
|
|
165
|
+
* renderer owns input streams, serialization, rendering and teardown. Every
|
|
166
|
+
* prompt is a screen; {@link Interaction} `prompt.screen` runs any other.
|
|
167
|
+
*/
|
|
168
|
+
export interface Screen<Value> {
|
|
169
|
+
readonly name: string;
|
|
170
|
+
readonly render: (controller: ScreenController<Value>) => View;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export const Screen = {
|
|
174
|
+
make: <Value>(
|
|
175
|
+
name: string,
|
|
176
|
+
render: (controller: ScreenController<Value>) => View,
|
|
177
|
+
): Screen<Value> => ({ name, render }),
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Handle for a progress row. Acquired within a `Scope`: the enclosing
|
|
182
|
+
* scope's close is a release backstop, so an interrupted fiber can never leave
|
|
183
|
+
* an orphaned row pinning the renderer. Settling early via `succeed`/`fail`/
|
|
184
|
+
* `close` is the normal path; every settle operation is idempotent.
|
|
185
|
+
*/
|
|
186
|
+
export interface ProgressHandle {
|
|
187
|
+
readonly update: (options: ProgressOptions) => Effect.Effect<void>;
|
|
188
|
+
readonly succeed: (message?: string) => Effect.Effect<void>;
|
|
189
|
+
readonly fail: (message?: string) => Effect.Effect<void>;
|
|
190
|
+
readonly close: Effect.Effect<void>;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* A mounted live view. The view itself is immutable — dynamic content flows
|
|
195
|
+
* through a caller-owned store that its component subscribes to — so the
|
|
196
|
+
* handle only controls the block's lifetime. Scope-bound the same way as
|
|
197
|
+
* {@link ProgressHandle}; `close` settles early and is idempotent.
|
|
198
|
+
*/
|
|
199
|
+
export interface LiveViewHandle {
|
|
200
|
+
readonly close: Effect.Effect<void>;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface LiveViewOptions {
|
|
204
|
+
/** Place a session shell/header before completed prompt output. */
|
|
205
|
+
readonly placement?: "beforeTranscript" | "afterTranscript";
|
|
206
|
+
/** Commit the final view to the static transcript when it closes. */
|
|
207
|
+
readonly persistOnClose?: boolean;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export interface SessionOptions {
|
|
211
|
+
/** Take over the terminal's alternate screen buffer when supported. */
|
|
212
|
+
readonly alternate?: boolean;
|
|
213
|
+
}
|
|
214
|
+
|
|
135
215
|
/**
|
|
136
216
|
* The capability to ask or tell the human driving this process. Provided
|
|
137
|
-
* by
|
|
138
|
-
* output, typed prompt failures); never provided in child processes.
|
|
217
|
+
* by {@link layer}; never provided in child processes.
|
|
139
218
|
*/
|
|
140
219
|
export class Interaction extends Context.Service<
|
|
141
220
|
Interaction,
|
|
142
221
|
{
|
|
222
|
+
readonly terminal: TerminalCapabilities;
|
|
223
|
+
|
|
143
224
|
readonly output: {
|
|
225
|
+
/** Append a completed layout to terminal scrollback/output. */
|
|
226
|
+
readonly print: (view: View) => Effect.Effect<void>;
|
|
144
227
|
readonly info: (message: string | MessageOptions) => Effect.Effect<void>;
|
|
145
228
|
readonly success: (message: string | MessageOptions) => Effect.Effect<void>;
|
|
146
229
|
readonly warning: (message: string | MessageOptions) => Effect.Effect<void>;
|
|
@@ -157,46 +240,103 @@ export class Interaction extends Context.Service<
|
|
|
157
240
|
readonly multiSelect: <Value>(
|
|
158
241
|
options: MultiSelectOptions<Value>,
|
|
159
242
|
) => Effect.Effect<ReadonlyArray<Value>, InteractionError>;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
) => Effect.Effect<string, InteractionError>;
|
|
243
|
+
/** Run an arbitrary interactive screen. */
|
|
244
|
+
readonly screen: <Value>(screen: Screen<Value>) => Effect.Effect<Value, InteractionError>;
|
|
163
245
|
};
|
|
164
246
|
|
|
247
|
+
/**
|
|
248
|
+
* Log the user in through their browser: open `url`, show it (and the
|
|
249
|
+
* device code), and wait for `waitFor`. Fails with `TerminalCancelled`
|
|
250
|
+
* when the user dismisses the login.
|
|
251
|
+
*/
|
|
252
|
+
readonly browserLogin: <A, E, R, E2 = never, R2 = never>(
|
|
253
|
+
options: BrowserLoginOptions<A, E, R, E2, R2>,
|
|
254
|
+
) => Effect.Effect<A, E | E2 | InteractionError, R | R2 | ChildProcessSpawner>;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Mount a live layout while the scope is open. Without an interactive
|
|
258
|
+
* renderer the view prints once.
|
|
259
|
+
*/
|
|
260
|
+
readonly live: (
|
|
261
|
+
view: View,
|
|
262
|
+
options?: LiveViewOptions,
|
|
263
|
+
) => Effect.Effect<LiveViewHandle, never, Scope.Scope>;
|
|
264
|
+
|
|
265
|
+
/** Add a mutable progress row, settled through its handle. */
|
|
266
|
+
readonly progress: (
|
|
267
|
+
options: ProgressOptions,
|
|
268
|
+
) => Effect.Effect<ProgressHandle, never, Scope.Scope>;
|
|
269
|
+
|
|
165
270
|
/** Run work behind a progress row and collapse it to a final status line. */
|
|
166
271
|
readonly task: <A, E, R>(
|
|
167
272
|
options: ProgressOptions,
|
|
168
273
|
effect: Effect.Effect<A, E, R>,
|
|
169
274
|
) => Effect.Effect<A, E, R>;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Keep one renderer alive while an Effect drives screens and prompts. A
|
|
278
|
+
* nested session reuses the outer renderer and clears the prompts it
|
|
279
|
+
* showed when it settles.
|
|
280
|
+
*/
|
|
281
|
+
readonly session: <A, E, R>(
|
|
282
|
+
effect: Effect.Effect<A, E, R>,
|
|
283
|
+
options?: SessionOptions,
|
|
284
|
+
) => Effect.Effect<A, E | NonInteractiveTerminal, R>;
|
|
170
285
|
}
|
|
171
286
|
>()("Alchemy::Interaction") {}
|
|
172
287
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
288
|
+
// Top-level forms of the service's messages and prompts. Each acquires
|
|
289
|
+
// `Interaction` when it runs, not when it's built, so a provider can hold
|
|
290
|
+
// one in a value without capturing whichever service was ambient then.
|
|
291
|
+
|
|
292
|
+
export const print = (view: View) => Effect.flatMap(Interaction, (i) => i.output.print(view));
|
|
293
|
+
export const info = (message: string | MessageOptions) =>
|
|
294
|
+
Effect.flatMap(Interaction, (i) => i.output.info(message));
|
|
295
|
+
export const success = (message: string | MessageOptions) =>
|
|
296
|
+
Effect.flatMap(Interaction, (i) => i.output.success(message));
|
|
297
|
+
export const warning = (message: string | MessageOptions) =>
|
|
298
|
+
Effect.flatMap(Interaction, (i) => i.output.warning(message));
|
|
299
|
+
export const error = (message: string | MessageOptions) =>
|
|
300
|
+
Effect.flatMap(Interaction, (i) => i.output.error(message));
|
|
301
|
+
|
|
302
|
+
export const text = (options: TextInputOptions) =>
|
|
303
|
+
Effect.flatMap(Interaction, (i) => i.prompt.text(options));
|
|
304
|
+
export const password = (options: PasswordInputOptions) =>
|
|
305
|
+
Effect.flatMap(Interaction, (i) => i.prompt.password(options));
|
|
306
|
+
export const confirm = (options: ConfirmOptions) =>
|
|
307
|
+
Effect.flatMap(Interaction, (i) => i.prompt.confirm(options));
|
|
308
|
+
export const select = <Value>(options: SelectOptions<Value>) =>
|
|
309
|
+
Effect.flatMap(Interaction, (i) => i.prompt.select(options));
|
|
310
|
+
export const multiSelect = <Value>(options: MultiSelectOptions<Value>) =>
|
|
311
|
+
Effect.flatMap(Interaction, (i) => i.prompt.multiSelect(options));
|
|
312
|
+
export const browserLogin = <A, E, R, E2 = never, R2 = never>(
|
|
313
|
+
options: BrowserLoginOptions<A, E, R, E2, R2>,
|
|
314
|
+
) => Effect.flatMap(Interaction, (i) => i.browserLogin(options));
|
|
315
|
+
export const screen = <Value>(scene: Screen<Value>) =>
|
|
316
|
+
Effect.flatMap(Interaction, (i) => i.prompt.screen(scene));
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* `task` for any renderer: a scoped progress row settled by the effect's
|
|
320
|
+
* exit. Interruption (Ctrl+C) is not a failure — the row is dropped instead
|
|
321
|
+
* of painted as an error.
|
|
322
|
+
*/
|
|
323
|
+
export const taskFromProgress =
|
|
324
|
+
(progress: Interaction["Service"]["progress"]): Interaction["Service"]["task"] =>
|
|
325
|
+
(options, effect) =>
|
|
326
|
+
Effect.scoped(
|
|
327
|
+
Effect.gen(function* () {
|
|
328
|
+
const handle = yield* progress(options);
|
|
329
|
+
return yield* effect.pipe(
|
|
330
|
+
Effect.onExit((exit) =>
|
|
331
|
+
Exit.isSuccess(exit)
|
|
332
|
+
? handle.succeed()
|
|
333
|
+
: Cause.hasInterruptsOnly(exit.cause)
|
|
334
|
+
? handle.close
|
|
335
|
+
: handle.fail(),
|
|
336
|
+
),
|
|
337
|
+
);
|
|
338
|
+
}),
|
|
339
|
+
);
|
|
200
340
|
|
|
201
341
|
/**
|
|
202
342
|
* Open a URL in the platform's default browser without invoking a shell.
|
|
@@ -223,16 +363,50 @@ export const openUrl = (url: string) =>
|
|
|
223
363
|
}
|
|
224
364
|
}).pipe(Effect.scoped);
|
|
225
365
|
|
|
226
|
-
|
|
366
|
+
// Bun can hand concurrent dynamic imports of one module a half-evaluated
|
|
367
|
+
// namespace (a TDZ ReferenceError on its exports), so every lazy renderer
|
|
368
|
+
// module is imported through one shared promise.
|
|
369
|
+
const importOnce = <M>(load: () => Promise<M>) => {
|
|
370
|
+
let module: Promise<M> | undefined;
|
|
371
|
+
return () => (module ??= load());
|
|
372
|
+
};
|
|
373
|
+
const loadFormat = importOnce(() => import("./Cli/components/view/Format.tsx"));
|
|
374
|
+
const loadSigilRuntime = importOnce(() => import("./Cli/components/view/Runtime.tsx"));
|
|
375
|
+
const loadCapabilities = importOnce(() => import("./Cli/components/capabilities.ts"));
|
|
376
|
+
|
|
377
|
+
export interface TerminalOptions {
|
|
378
|
+
readonly stdin?: NodeJS.ReadStream;
|
|
227
379
|
readonly stdout?: NodeJS.WriteStream;
|
|
380
|
+
readonly stderr?: NodeJS.WriteStream;
|
|
381
|
+
/** Override automatic TTY input detection. Primarily useful for tests. */
|
|
382
|
+
readonly input?: boolean;
|
|
228
383
|
readonly colors?: boolean;
|
|
229
384
|
readonly unicode?: boolean;
|
|
385
|
+
/** Capture console output while the interactive renderer owns the tty. */
|
|
386
|
+
readonly captureConsole?: boolean;
|
|
230
387
|
}
|
|
231
388
|
|
|
232
|
-
|
|
389
|
+
export type NonInteractiveOptions = Pick<TerminalOptions, "stdout" | "colors" | "unicode">;
|
|
390
|
+
|
|
391
|
+
const nonInteractiveFailure = (operation: string) =>
|
|
392
|
+
new NonInteractiveTerminal({
|
|
393
|
+
operation,
|
|
394
|
+
message: `Cannot run ${operation} without an interactive terminal. Provide the equivalent command flags instead.`,
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
export const makeNonInteractive = (options: NonInteractiveOptions = {}): Interaction["Service"] => {
|
|
233
398
|
const stdout = options.stdout ?? process.stdout;
|
|
234
399
|
const colors = options.colors ?? colorsEnabled(stdout);
|
|
235
|
-
const
|
|
400
|
+
const unicode = options.unicode ?? unicodeEnabled();
|
|
401
|
+
const glyphs = glyphsFor(unicode);
|
|
402
|
+
const terminal: TerminalCapabilities = {
|
|
403
|
+
input: false,
|
|
404
|
+
columns: stdout.columns ?? 80,
|
|
405
|
+
rows: stdout.rows ?? 24,
|
|
406
|
+
colors,
|
|
407
|
+
unicode,
|
|
408
|
+
alternateScreen: false,
|
|
409
|
+
};
|
|
236
410
|
|
|
237
411
|
const colorize = (hex: string, value: string) =>
|
|
238
412
|
colors ? `${ansiFg(hex)}${value}${ANSI_RESET}` : value;
|
|
@@ -252,16 +426,52 @@ const makeNonInteractive = (options: NonInteractiveOptions): Interaction["Servic
|
|
|
252
426
|
stdout.write(`${statusText(variant, text, detail)}\n`);
|
|
253
427
|
});
|
|
254
428
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
429
|
+
// Views are React layouts: load the static formatter only when one is
|
|
430
|
+
// actually printed, so headless processes never pull in the renderer.
|
|
431
|
+
const print = (view: View) =>
|
|
432
|
+
Effect.promise(loadFormat).pipe(
|
|
433
|
+
Effect.map(({ formatView }) =>
|
|
434
|
+
formatView(view, { ...terminal, columns: stdout.columns ?? terminal.columns }),
|
|
435
|
+
),
|
|
436
|
+
Effect.flatMap((text) =>
|
|
437
|
+
text === "" ? Effect.void : Effect.sync(() => void stdout.write(`${text}\n`)),
|
|
438
|
+
),
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
const unavailable = (operation: string) => Effect.fail(nonInteractiveFailure(operation));
|
|
442
|
+
|
|
443
|
+
const progress: Interaction["Service"]["progress"] = (initial) =>
|
|
444
|
+
Effect.acquireRelease(
|
|
445
|
+
log("info")({ message: initial.label, detail: initial.detail }).pipe(
|
|
446
|
+
Effect.map((): ProgressHandle => {
|
|
447
|
+
let current = initial;
|
|
448
|
+
let settled = false;
|
|
449
|
+
const settle = (variant: "success" | "error", message?: string) =>
|
|
450
|
+
Effect.suspend(() => {
|
|
451
|
+
if (settled) return Effect.void;
|
|
452
|
+
settled = true;
|
|
453
|
+
return log(variant)(message ?? current.label);
|
|
454
|
+
});
|
|
455
|
+
return {
|
|
456
|
+
update: (next) =>
|
|
457
|
+
Effect.sync(() => {
|
|
458
|
+
if (!settled) current = next;
|
|
459
|
+
}),
|
|
460
|
+
succeed: (message) => settle("success", message),
|
|
461
|
+
fail: (message) => settle("error", message),
|
|
462
|
+
close: Effect.sync(() => {
|
|
463
|
+
settled = true;
|
|
464
|
+
}),
|
|
465
|
+
};
|
|
466
|
+
}),
|
|
467
|
+
),
|
|
468
|
+
(handle) => handle.close,
|
|
261
469
|
);
|
|
262
470
|
|
|
263
471
|
return {
|
|
472
|
+
terminal,
|
|
264
473
|
output: {
|
|
474
|
+
print,
|
|
265
475
|
info: log("info"),
|
|
266
476
|
success: log("success"),
|
|
267
477
|
warning: log("warning"),
|
|
@@ -273,47 +483,72 @@ const makeNonInteractive = (options: NonInteractiveOptions): Interaction["Servic
|
|
|
273
483
|
confirm: () => unavailable("confirmation"),
|
|
274
484
|
select: () => unavailable("selection"),
|
|
275
485
|
multiSelect: () => unavailable("multiple selection"),
|
|
276
|
-
|
|
486
|
+
screen: (screen) => unavailable(screen.name),
|
|
277
487
|
},
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
return
|
|
288
|
-
message: taskOptions.label,
|
|
289
|
-
detail: taskOptions.detail,
|
|
290
|
-
}).pipe(
|
|
291
|
-
Effect.andThen(
|
|
292
|
-
effect.pipe(
|
|
293
|
-
Effect.onExit((exit) =>
|
|
294
|
-
Exit.isSuccess(exit)
|
|
295
|
-
? settle("success")
|
|
296
|
-
: // Interruption (Ctrl+C) is not a failure — leave the row
|
|
297
|
-
// unsettled instead of painting a red error status.
|
|
298
|
-
Cause.hasInterruptsOnly(exit.cause)
|
|
299
|
-
? Effect.void
|
|
300
|
-
: settle("error"),
|
|
301
|
-
),
|
|
302
|
-
),
|
|
303
|
-
),
|
|
304
|
-
);
|
|
488
|
+
// Without a screen there's nothing to paste a code into: print the URL
|
|
489
|
+
// and wait, so device and poll logins still work headless.
|
|
490
|
+
browserLogin: (login) =>
|
|
491
|
+
Effect.gen(function* () {
|
|
492
|
+
const openFailed = yield* Effect.isFailure(openUrl(login.url));
|
|
493
|
+
yield* log("info")({
|
|
494
|
+
message: `${login.provider} authorization: ${openFailed ? "open" : "opened"} ${login.url}`,
|
|
495
|
+
detail: login.code === undefined ? undefined : `code ${login.code}`,
|
|
496
|
+
});
|
|
497
|
+
return yield* login.waitFor;
|
|
305
498
|
}),
|
|
499
|
+
live: (view) => print(view).pipe(Effect.as({ close: Effect.void })),
|
|
500
|
+
progress,
|
|
501
|
+
task: taskFromProgress(progress),
|
|
502
|
+
session: () => unavailable("application"),
|
|
306
503
|
};
|
|
307
504
|
};
|
|
308
505
|
|
|
309
506
|
/**
|
|
310
|
-
* The
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
507
|
+
* The append-only renderer: CI, redirected output, the programmatic engine
|
|
508
|
+
* API, tests, and any headless embedding. Messages print as plain status
|
|
509
|
+
* lines; every prompt fails immediately with the typed
|
|
510
|
+
* {@link NonInteractiveTerminal}.
|
|
314
511
|
*/
|
|
315
512
|
export const layerNonInteractive = (options: NonInteractiveOptions = {}) =>
|
|
316
513
|
Layer.effect(
|
|
317
514
|
Interaction,
|
|
318
515
|
Effect.sync(() => makeNonInteractive(options)),
|
|
319
516
|
);
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* The interactive Sigil renderer, regardless of what the terminal reports.
|
|
520
|
+
* Prefer {@link layer}, which falls back to plain output without a TTY.
|
|
521
|
+
*/
|
|
522
|
+
export const layerSigil = (options: TerminalOptions = {}) =>
|
|
523
|
+
Layer.effect(
|
|
524
|
+
Interaction,
|
|
525
|
+
Effect.gen(function* () {
|
|
526
|
+
const { resolveCapabilities } = yield* Effect.promise(loadCapabilities);
|
|
527
|
+
const { makeRuntime } = yield* Effect.promise(loadSigilRuntime);
|
|
528
|
+
const { service } = yield* Effect.acquireRelease(
|
|
529
|
+
Effect.sync(() => makeRuntime(options, { ...resolveCapabilities(options), input: true })),
|
|
530
|
+
({ dispose }) => Effect.promise(dispose),
|
|
531
|
+
);
|
|
532
|
+
return service;
|
|
533
|
+
}),
|
|
534
|
+
);
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* The renderer this process's terminal supports: the interactive one when
|
|
538
|
+
* stdin and stdout are a TTY and nothing opted out (`--no-input`, CI, coding
|
|
539
|
+
* agents), plain output otherwise.
|
|
540
|
+
*/
|
|
541
|
+
export const layer = (options: TerminalOptions = {}) =>
|
|
542
|
+
Layer.unwrap(
|
|
543
|
+
Effect.gen(function* () {
|
|
544
|
+
const { resolveCapabilities } = yield* Effect.promise(loadCapabilities);
|
|
545
|
+
const capabilities = resolveCapabilities(options);
|
|
546
|
+
return capabilities.input
|
|
547
|
+
? layerSigil(options)
|
|
548
|
+
: layerNonInteractive({
|
|
549
|
+
stdout: options.stdout,
|
|
550
|
+
colors: capabilities.colors,
|
|
551
|
+
unicode: capabilities.unicode,
|
|
552
|
+
});
|
|
553
|
+
}),
|
|
554
|
+
);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @effect-diagnostics anyUnknownInErrorContext:off */
|
|
2
2
|
|
|
3
|
+
import * as Clock from "effect/Clock";
|
|
3
4
|
import * as Effect from "effect/Effect";
|
|
4
5
|
import * as Exit from "effect/Exit";
|
|
5
6
|
import * as Fiber from "effect/Fiber";
|
|
@@ -11,6 +12,7 @@ import type { Platform } from "../Platform.ts";
|
|
|
11
12
|
import type { ProviderService } from "../Provider.ts";
|
|
12
13
|
import type { ScopedPlanStatusSession } from "../Report.ts";
|
|
13
14
|
import type { ResourceBinding, ResourceClassLike, ResourceLike } from "../Resource.ts";
|
|
15
|
+
import { LogAnnotation } from "../Util/LogAnnotation.ts";
|
|
14
16
|
import { sha256 } from "../Util/sha256.ts";
|
|
15
17
|
import * as RpcProvider from "./RpcProvider.ts";
|
|
16
18
|
|
|
@@ -283,7 +285,27 @@ export const make = <
|
|
|
283
285
|
// shutdown, interrupting every registered instance and running its
|
|
284
286
|
// finalizers (killing the processes).
|
|
285
287
|
// Close independent instances concurrently at provider shutdown.
|
|
286
|
-
const
|
|
288
|
+
const providerScope = yield* Effect.scope;
|
|
289
|
+
// Registered before the fork, so it runs after every instance closed.
|
|
290
|
+
let closingAt: number | undefined;
|
|
291
|
+
yield* Scope.addFinalizer(
|
|
292
|
+
providerScope,
|
|
293
|
+
Effect.flatMap(Clock.currentTimeMillis, (now) =>
|
|
294
|
+
closingAt === undefined
|
|
295
|
+
? Effect.void
|
|
296
|
+
: Effect.logDebug(`shutdown: stopped ${cls.Type} instances in ${now - closingAt}ms`),
|
|
297
|
+
),
|
|
298
|
+
);
|
|
299
|
+
const rootScope = yield* Scope.fork(providerScope, "parallel");
|
|
300
|
+
// Registered after the fork, so it runs first: the shutdown start.
|
|
301
|
+
yield* Scope.addFinalizer(
|
|
302
|
+
providerScope,
|
|
303
|
+
Effect.flatMap(Clock.currentTimeMillis, (now) => {
|
|
304
|
+
if (instances.size === 0) return Effect.void;
|
|
305
|
+
closingAt = now;
|
|
306
|
+
return Effect.logDebug(`shutdown: stopping ${instances.size} ${cls.Type} instance(s)`);
|
|
307
|
+
}),
|
|
308
|
+
);
|
|
287
309
|
|
|
288
310
|
// Keyed by FQN (namespace path + logical id): a restart replaces the
|
|
289
311
|
// entry, a replacement's new generation overwrites it (and the old
|
|
@@ -313,9 +335,14 @@ export const make = <
|
|
|
313
335
|
return { config, configHash };
|
|
314
336
|
});
|
|
315
337
|
|
|
316
|
-
const teardown = Effect.fn(function* (instance: Instance<R["Attributes"]>) {
|
|
338
|
+
const teardown = Effect.fn(function* (fqn: string, instance: Instance<R["Attributes"]>) {
|
|
339
|
+
const start = yield* Clock.currentTimeMillis;
|
|
317
340
|
yield* Fiber.interrupt(instance.fiber);
|
|
318
341
|
yield* Scope.close(instance.scope, Exit.void);
|
|
342
|
+
const end = yield* Clock.currentTimeMillis;
|
|
343
|
+
yield* Effect.logDebug(`stopped ${fqn} in ${end - start}ms`).pipe(
|
|
344
|
+
Effect.annotateLogs(LogAnnotation.fqn, fqn),
|
|
345
|
+
);
|
|
319
346
|
});
|
|
320
347
|
|
|
321
348
|
const startInstance = Effect.fn(function* (
|
|
@@ -349,8 +376,12 @@ export const make = <
|
|
|
349
376
|
Effect.onExit((exit) =>
|
|
350
377
|
exit._tag === "Failure"
|
|
351
378
|
? // A failed start must not linger as "running" — the next
|
|
352
|
-
// plan should report `update` and try again
|
|
353
|
-
|
|
379
|
+
// plan should report `update` and try again — nor keep what
|
|
380
|
+
// it acquired: the instance scope would otherwise hold a
|
|
381
|
+
// process that outlived its start (one still waiting for
|
|
382
|
+
// its URL when the deploy was interrupted, say) until the
|
|
383
|
+
// provider shut down.
|
|
384
|
+
invalidate.pipe(Effect.andThen(Scope.close(scope, exit)))
|
|
354
385
|
: Effect.void,
|
|
355
386
|
),
|
|
356
387
|
);
|
|
@@ -431,18 +462,18 @@ export const make = <
|
|
|
431
462
|
const existing = instances.get(fqn);
|
|
432
463
|
if (existing) {
|
|
433
464
|
if (existing.configHash === configHash) {
|
|
434
|
-
yield* Effect.log(`
|
|
465
|
+
yield* Effect.log(`No changes, using existing instance`);
|
|
435
466
|
// Adopt the newest instanceId so a later replacement's
|
|
436
467
|
// old-generation delete cannot tear this instance down.
|
|
437
468
|
existing.instanceId = instanceId;
|
|
438
469
|
return yield* Fiber.join(existing.fiber);
|
|
439
470
|
}
|
|
440
|
-
yield* Effect.log(`
|
|
441
|
-
yield* teardown(existing);
|
|
471
|
+
yield* Effect.log(`Changes detected, restarting instance`);
|
|
472
|
+
yield* teardown(fqn, existing);
|
|
442
473
|
instances.delete(fqn);
|
|
443
474
|
}
|
|
444
475
|
return yield* startInstance(input, session, config, configHash);
|
|
445
|
-
}),
|
|
476
|
+
}).pipe(Effect.annotateLogs(LogAnnotation.fqn, fqn)),
|
|
446
477
|
);
|
|
447
478
|
}),
|
|
448
479
|
delete: Effect.fn(function* ({
|
|
@@ -465,7 +496,7 @@ export const make = <
|
|
|
465
496
|
return;
|
|
466
497
|
}
|
|
467
498
|
if (existing) {
|
|
468
|
-
yield* teardown(existing);
|
|
499
|
+
yield* teardown(fqn, existing);
|
|
469
500
|
instances.delete(fqn);
|
|
470
501
|
}
|
|
471
502
|
// Runs even when nothing is registered: cross-restart state
|
package/src/Local/RpcProvider.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type * as Context from "effect/Context";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
|
+
import { identity } from "effect/Function";
|
|
3
4
|
import * as Layer from "effect/Layer";
|
|
4
5
|
import * as Option from "effect/Option";
|
|
5
6
|
import * as Predicate from "effect/Predicate";
|
|
@@ -13,6 +14,7 @@ import type { ResourceClassLike, ResourceLike } from "../Resource.ts";
|
|
|
13
14
|
import { ResourceContext } from "../ResourceContext.ts";
|
|
14
15
|
import { Stack } from "../Stack.ts";
|
|
15
16
|
import { Stage } from "../Stage.ts";
|
|
17
|
+
import { LogAnnotation } from "../Util/LogAnnotation.ts";
|
|
16
18
|
import { RpcProviderProxy } from "./RpcProviderProxy.ts";
|
|
17
19
|
|
|
18
20
|
/**
|
|
@@ -221,8 +223,16 @@ export const effect = <
|
|
|
221
223
|
)
|
|
222
224
|
: Layer.empty,
|
|
223
225
|
);
|
|
226
|
+
if (Stream.isStream(result)) return result.pipe(Stream.provide(services));
|
|
227
|
+
// In a sidecar the engine's per-resource annotation doesn't
|
|
228
|
+
// cross the RPC boundary: tag the call's logs here.
|
|
229
|
+
const fqn =
|
|
230
|
+
Predicate.hasProperty(args[0], "fqn") && Predicate.isString(args[0].fqn)
|
|
231
|
+
? args[0].fqn
|
|
232
|
+
: undefined;
|
|
224
233
|
return result.pipe(
|
|
225
|
-
|
|
234
|
+
Effect.provide(services),
|
|
235
|
+
fqn === undefined ? identity : Effect.annotateLogs(LogAnnotation.fqn, fqn),
|
|
226
236
|
);
|
|
227
237
|
};
|
|
228
238
|
},
|