@mysten-incubation/devstack 0.0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/dashboard-ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dashboard-ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dashboard-ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dashboard-ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-cyrillic-ext-wght-normal-I4S5GZfc.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-cyrillic-wght-normal-BmXc_FBt.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-latin-ext-wght-normal-DrnZ1wKl.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-latin-wght-normal-B_7UjwxQ.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-symbols2-wght-normal-GZpp1pK2.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-vietnamese-wght-normal-D8KDMBhC.woff2 +0 -0
- package/dashboard-ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dashboard-ui/assets/index-Bmi1UtAg.js +1356 -0
- package/dashboard-ui/assets/index-D5EShVt4.js +3 -0
- package/dashboard-ui/assets/index-Deml9drg.css +1 -0
- package/dashboard-ui/index.html +13 -0
- package/dist/api/define-capabilities.d.mts +14 -3
- package/dist/api/define-capabilities.mjs +18 -1
- package/dist/api/define-capabilities.mjs.map +1 -1
- package/dist/api/define-devstack.d.mts +1 -1
- package/dist/api/define-devstack.mjs +6 -26
- package/dist/api/define-devstack.mjs.map +1 -1
- package/dist/api/define-plugin.d.mts +1 -0
- package/dist/api/define-plugin.mjs +2 -0
- package/dist/api/inference-network.d.mts +132 -0
- package/dist/api/inference-network.mjs +105 -16
- package/dist/api/inference-network.mjs.map +1 -1
- package/dist/api/plugin-errors.d.mts +7 -0
- package/dist/api/run-stack.d.mts +20 -9
- package/dist/api/run-stack.mjs +56 -29
- package/dist/api/run-stack.mjs.map +1 -1
- package/dist/build-integrations/playwright/config.d.mts +6 -4
- package/dist/build-integrations/playwright/config.mjs +5 -3
- package/dist/build-integrations/playwright/config.mjs.map +1 -1
- package/dist/build-integrations/playwright/errors.d.mts +1 -1
- package/dist/build-integrations/playwright/global-setup.d.mts +43 -17
- package/dist/build-integrations/playwright/global-setup.mjs +250 -13
- package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
- package/dist/build-integrations/playwright/index.d.mts +5 -3
- package/dist/build-integrations/playwright/index.mjs +4 -2
- package/dist/build-integrations/playwright/stack-context.d.mts +0 -1
- package/dist/build-integrations/playwright/stack-context.mjs +24 -63
- package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
- package/dist/build-integrations/playwright/wallet-context.d.mts +7 -10
- package/dist/build-integrations/playwright/wallet-context.mjs +8 -13
- package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
- package/dist/build-integrations/runtime/cold-start-url.d.mts +5 -0
- package/dist/build-integrations/runtime/cold-start-url.mjs +4 -3
- package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
- package/dist/build-integrations/runtime/conventional-routes.d.mts +51 -0
- package/dist/build-integrations/runtime/conventional-routes.mjs +92 -0
- package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -0
- package/dist/build-integrations/runtime/discover.d.mts +38 -30
- package/dist/build-integrations/runtime/discover.mjs +73 -70
- package/dist/build-integrations/runtime/discover.mjs.map +1 -1
- package/dist/build-integrations/runtime/endpoint-registry.d.mts +3 -1
- package/dist/build-integrations/runtime/endpoint-registry.mjs +3 -1
- package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
- package/dist/build-integrations/runtime/index.d.mts +7 -2
- package/dist/build-integrations/runtime/index.mjs +9 -2
- package/dist/build-integrations/runtime/manifest-types.d.mts +2 -0
- package/dist/build-integrations/runtime/manifest-types.mjs +3 -0
- package/dist/build-integrations/runtime/playwright-stack-context-slot.d.mts +29 -0
- package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs +10 -0
- package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs.map +1 -0
- package/dist/build-integrations/runtime/read-stack-context.d.mts +1 -1
- package/dist/build-integrations/runtime/read-stack-context.mjs +10 -4
- package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
- package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +48 -0
- package/dist/build-integrations/runtime/resolve-discovery-env.mjs +42 -0
- package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -0
- package/dist/build-integrations/runtime/stack-context.d.mts +1 -1
- package/dist/build-integrations/runtime/wallet-paths.mjs +2 -0
- package/dist/build-integrations/vite/index.d.mts +51 -0
- package/dist/build-integrations/vite/index.mjs +73 -0
- package/dist/build-integrations/vite/index.mjs.map +1 -0
- package/dist/build-integrations/vitest/env.d.mts +4 -3
- package/dist/build-integrations/vitest/env.mjs +6 -4
- package/dist/build-integrations/vitest/env.mjs.map +1 -1
- package/dist/build-integrations/vitest/errors.d.mts +25 -4
- package/dist/build-integrations/vitest/errors.mjs +15 -2
- package/dist/build-integrations/vitest/errors.mjs.map +1 -1
- package/dist/build-integrations/vitest/index.d.mts +2 -2
- package/dist/build-integrations/vitest/index.mjs +3 -3
- package/dist/build-integrations/vitest/setup.d.mts +4 -2
- package/dist/build-integrations/vitest/setup.mjs +2 -2
- package/dist/build-integrations/vitest/setup.mjs.map +1 -1
- package/dist/build-integrations/vitest/stack-context.d.mts +0 -1
- package/dist/build-integrations/vitest/stack-context.mjs +33 -13
- package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
- package/dist/cli/bail.mjs +23 -0
- package/dist/cli/bail.mjs.map +1 -0
- package/dist/{surfaces/cli/commands → cli}/doctor-probes.mjs +26 -16
- package/dist/cli/doctor-probes.mjs.map +1 -0
- package/dist/cli/main.d.mts +15 -1
- package/dist/cli/main.mjs +166 -482
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/prune-direct.mjs +31 -201
- package/dist/cli/prune-direct.mjs.map +1 -1
- package/dist/cli/snapshot-reader.mjs +14 -11
- package/dist/cli/snapshot-reader.mjs.map +1 -1
- package/dist/cli/up-lifecycle.mjs +4 -1
- package/dist/cli/up-lifecycle.mjs.map +1 -1
- package/dist/cli/wirings/apply.mjs +95 -0
- package/dist/cli/wirings/apply.mjs.map +1 -0
- package/dist/cli/wirings/build-verb-layers.mjs +42 -0
- package/dist/cli/wirings/build-verb-layers.mjs.map +1 -0
- package/dist/cli/wirings/config-loader.mjs +69 -0
- package/dist/cli/wirings/config-loader.mjs.map +1 -0
- package/dist/cli/wirings/engine-command.mjs +30 -0
- package/dist/cli/wirings/engine-command.mjs.map +1 -0
- package/dist/cli/wirings/identity.mjs +72 -0
- package/dist/cli/wirings/identity.mjs.map +1 -0
- package/dist/cli/wirings/provide-file-system.mjs +7 -0
- package/dist/cli/wirings/provide-file-system.mjs.map +1 -0
- package/dist/cli/wirings/snapshot.mjs +177 -0
- package/dist/cli/wirings/snapshot.mjs.map +1 -0
- package/dist/cli/wirings/up.mjs +287 -0
- package/dist/cli/wirings/up.mjs.map +1 -0
- package/dist/cli/wirings/wipe.mjs +40 -0
- package/dist/cli/wirings/wipe.mjs.map +1 -0
- package/dist/contracts/capability-decl.d.mts +0 -2
- package/dist/contracts/codegenable.d.mts +43 -0
- package/dist/contracts/container-runtime.d.mts +26 -1
- package/dist/contracts/faucet-strategy.d.mts +25 -0
- package/dist/contracts/funding-strategy.d.mts +42 -0
- package/dist/contracts/plugin-expander.mjs +60 -0
- package/dist/contracts/plugin-expander.mjs.map +1 -0
- package/dist/contracts/projection.d.mts +5 -3
- package/dist/contracts/renderer.d.mts +23 -0
- package/dist/contracts/routable.d.mts +14 -1
- package/dist/contracts/snapshotable.d.mts +25 -3
- package/dist/contracts/wallet-protocol.d.mts +52 -0
- package/dist/contracts/wallet-protocol.mjs +52 -0
- package/dist/contracts/wallet-protocol.mjs.map +1 -0
- package/dist/index.d.mts +26 -25
- package/dist/index.mjs +20 -13
- package/dist/{runtime → orchestrators}/built-in-plugin-layers.mjs +10 -5
- package/dist/orchestrators/built-in-plugin-layers.mjs.map +1 -0
- package/dist/orchestrators/codegen/bindings.d.mts +1 -2
- package/dist/orchestrators/codegen/bindings.mjs +52 -186
- package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
- package/dist/orchestrators/codegen/emit.mjs +19 -1
- package/dist/orchestrators/codegen/emit.mjs.map +1 -1
- package/dist/orchestrators/codegen/errors.mjs +8 -3
- package/dist/orchestrators/codegen/errors.mjs.map +1 -1
- package/dist/orchestrators/codegen/format.mjs +47 -39
- package/dist/orchestrators/codegen/format.mjs.map +1 -1
- package/dist/orchestrators/codegen/gitignore.mjs +3 -1
- package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
- package/dist/orchestrators/codegen/output-location.mjs +41 -0
- package/dist/orchestrators/codegen/output-location.mjs.map +1 -0
- package/dist/orchestrators/codegen/paths.d.mts +1 -1
- package/dist/orchestrators/codegen/paths.mjs +40 -14
- package/dist/orchestrators/codegen/paths.mjs.map +1 -1
- package/dist/orchestrators/codegen/permissions.mjs +3 -1
- package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
- package/dist/orchestrators/codegen/service.mjs +157 -105
- package/dist/orchestrators/codegen/service.mjs.map +1 -1
- package/dist/orchestrators/lifecycle-prune/errors.mjs +31 -0
- package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -0
- package/dist/orchestrators/lifecycle-prune/index.mjs +350 -0
- package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -0
- package/dist/orchestrators/router/cleanup.mjs +26 -27
- package/dist/orchestrators/router/cleanup.mjs.map +1 -1
- package/dist/orchestrators/router/entrypoints.mjs +2 -2
- package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
- package/dist/orchestrators/router/file-provider.mjs +14 -5
- package/dist/orchestrators/router/file-provider.mjs.map +1 -1
- package/dist/orchestrators/router/hostname.mjs +19 -55
- package/dist/orchestrators/router/hostname.mjs.map +1 -1
- package/dist/orchestrators/router/index.mjs +11 -0
- package/dist/orchestrators/router/profile.mjs +2 -2
- package/dist/orchestrators/router/sentinels.mjs +26 -0
- package/dist/orchestrators/router/sentinels.mjs.map +1 -0
- package/dist/orchestrators/router/service.mjs +40 -37
- package/dist/orchestrators/router/service.mjs.map +1 -1
- package/dist/orchestrators/router/traefik-container.mjs +27 -16
- package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
- package/dist/{substrate/runtime → orchestrators}/run.mjs +26 -21
- package/dist/orchestrators/run.mjs.map +1 -0
- package/dist/orchestrators/runtime-composition.d.mts +1 -1
- package/dist/orchestrators/runtime-composition.mjs +123 -39
- package/dist/orchestrators/runtime-composition.mjs.map +1 -1
- package/dist/orchestrators/snapshot/capture-command.d.mts +1 -0
- package/dist/orchestrators/snapshot/capture-command.mjs +25 -0
- package/dist/orchestrators/snapshot/capture-command.mjs.map +1 -0
- package/dist/orchestrators/snapshot/capture.mjs +42 -28
- package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
- package/dist/orchestrators/snapshot/descriptor.mjs +35 -10
- package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
- package/dist/orchestrators/snapshot/identity-guard.mjs +1 -1
- package/dist/orchestrators/snapshot/index.mjs +13 -0
- package/dist/orchestrators/snapshot/integrity.d.mts +1 -1
- package/dist/orchestrators/snapshot/integrity.mjs +73 -17
- package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
- package/dist/orchestrators/snapshot/pending-marker.d.mts +1 -0
- package/dist/orchestrators/snapshot/pending-marker.mjs +99 -0
- package/dist/orchestrators/snapshot/pending-marker.mjs.map +1 -0
- package/dist/orchestrators/snapshot/phase-error.mjs +23 -0
- package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -0
- package/dist/orchestrators/snapshot/prune.mjs +20 -55
- package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
- package/dist/orchestrators/snapshot/recover-pending.d.mts +1 -0
- package/dist/orchestrators/snapshot/recover-pending.mjs +223 -0
- package/dist/orchestrators/snapshot/recover-pending.mjs.map +1 -0
- package/dist/orchestrators/snapshot/restore.mjs +118 -84
- package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
- package/dist/orchestrators/snapshot/service.mjs +53 -56
- package/dist/orchestrators/snapshot/service.mjs.map +1 -1
- package/dist/orchestrators/snapshot/state-document.d.mts +1 -0
- package/dist/orchestrators/snapshot/state-document.mjs +47 -7
- package/dist/orchestrators/snapshot/state-document.mjs.map +1 -1
- package/dist/orchestrators/snapshot/wipe.mjs +67 -10
- package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
- package/dist/plugins/account/codegen.mjs +9 -8
- package/dist/plugins/account/codegen.mjs.map +1 -1
- package/dist/plugins/account/errors.d.mts +33 -6
- package/dist/plugins/account/errors.mjs.map +1 -1
- package/dist/plugins/account/funding.d.mts +29 -19
- package/dist/plugins/account/funding.mjs +84 -66
- package/dist/plugins/account/funding.mjs.map +1 -1
- package/dist/plugins/account/index.d.mts +2 -4
- package/dist/plugins/account/index.mjs +64 -31
- package/dist/plugins/account/index.mjs.map +1 -1
- package/dist/plugins/account/keypair.mjs +6 -9
- package/dist/plugins/account/keypair.mjs.map +1 -1
- package/dist/plugins/account/lease.mjs +1 -0
- package/dist/plugins/account/lease.mjs.map +1 -1
- package/dist/plugins/account/registry.d.mts +14 -1
- package/dist/plugins/account/registry.mjs +18 -18
- package/dist/plugins/account/registry.mjs.map +1 -1
- package/dist/plugins/account/service.d.mts +23 -4
- package/dist/plugins/account/service.mjs +83 -45
- package/dist/plugins/account/service.mjs.map +1 -1
- package/dist/plugins/account/snapshot.mjs +2 -5
- package/dist/plugins/account/snapshot.mjs.map +1 -1
- package/dist/plugins/account/spans.mjs +16 -0
- package/dist/plugins/account/spans.mjs.map +1 -0
- package/dist/plugins/account/variants/keystore.mjs +6 -8
- package/dist/plugins/account/variants/keystore.mjs.map +1 -1
- package/dist/plugins/action/build-context.d.mts +3 -2
- package/dist/plugins/action/errors.d.mts +16 -12
- package/dist/plugins/action/errors.mjs.map +1 -1
- package/dist/plugins/action/execute.mjs +65 -103
- package/dist/plugins/action/execute.mjs.map +1 -1
- package/dist/plugins/action/index.d.mts +0 -2
- package/dist/plugins/action/index.mjs +17 -13
- package/dist/plugins/action/index.mjs.map +1 -1
- package/dist/plugins/action/service.mjs +38 -35
- package/dist/plugins/action/service.mjs.map +1 -1
- package/dist/plugins/action/spans.mjs +11 -0
- package/dist/plugins/action/spans.mjs.map +1 -0
- package/dist/plugins/coin/codegen.mjs +9 -8
- package/dist/plugins/coin/codegen.mjs.map +1 -1
- package/dist/plugins/coin/discovery.mjs +8 -4
- package/dist/plugins/coin/discovery.mjs.map +1 -1
- package/dist/plugins/coin/index.d.mts +11 -29
- package/dist/plugins/coin/index.mjs +56 -27
- package/dist/plugins/coin/index.mjs.map +1 -1
- package/dist/plugins/coin/metadata.mjs +8 -15
- package/dist/plugins/coin/metadata.mjs.map +1 -1
- package/dist/plugins/coin/mint.d.mts +30 -11
- package/dist/plugins/coin/mint.mjs +78 -74
- package/dist/plugins/coin/mint.mjs.map +1 -1
- package/dist/plugins/coin/registry.mjs +4 -7
- package/dist/plugins/coin/registry.mjs.map +1 -1
- package/dist/plugins/coin/service.d.mts +39 -1
- package/dist/plugins/coin/service.mjs +11 -4
- package/dist/plugins/coin/service.mjs.map +1 -1
- package/dist/plugins/coin/spans.mjs +20 -0
- package/dist/plugins/coin/spans.mjs.map +1 -0
- package/dist/plugins/dashboard/domain.mjs +402 -0
- package/dist/plugins/dashboard/domain.mjs.map +1 -0
- package/dist/plugins/dashboard/index.d.mts +29 -0
- package/dist/plugins/dashboard/index.mjs +91 -0
- package/dist/plugins/dashboard/index.mjs.map +1 -0
- package/dist/plugins/dashboard/origin-policy.mjs +36 -0
- package/dist/plugins/dashboard/origin-policy.mjs.map +1 -0
- package/dist/plugins/dashboard/routable.mjs +27 -0
- package/dist/plugins/dashboard/routable.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/builder.mjs +21 -0
- package/dist/plugins/dashboard/schema/builder.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/enums.mjs +72 -0
- package/dist/plugins/dashboard/schema/enums.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/root.mjs +351 -0
- package/dist/plugins/dashboard/schema/root.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/types.mjs +508 -0
- package/dist/plugins/dashboard/schema/types.mjs.map +1 -0
- package/dist/plugins/dashboard/schema.mjs +11 -0
- package/dist/plugins/dashboard/schema.mjs.map +1 -0
- package/dist/plugins/dashboard/server.mjs +166 -0
- package/dist/plugins/dashboard/server.mjs.map +1 -0
- package/dist/plugins/deepbook/deploy.mjs +53 -115
- package/dist/plugins/deepbook/deploy.mjs.map +1 -1
- package/dist/plugins/deepbook/errors.mjs +1 -0
- package/dist/plugins/deepbook/errors.mjs.map +1 -1
- package/dist/plugins/deepbook/faucet-strategy.mjs +47 -34
- package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
- package/dist/plugins/deepbook/hash.mjs +9 -0
- package/dist/plugins/deepbook/hash.mjs.map +1 -0
- package/dist/plugins/deepbook/index.d.mts +1 -10
- package/dist/plugins/deepbook/index.mjs +25 -22
- package/dist/plugins/deepbook/index.mjs.map +1 -1
- package/dist/plugins/deepbook/pyth/index.mjs +26 -55
- package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
- package/dist/plugins/deepbook/snapshot.mjs +17 -29
- package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
- package/dist/plugins/deepbook/spans.mjs +18 -0
- package/dist/plugins/deepbook/spans.mjs.map +1 -0
- package/dist/plugins/deepbook/type-strings.mjs +65 -0
- package/dist/plugins/deepbook/type-strings.mjs.map +1 -0
- package/dist/plugins/deepbook/types.d.mts +2 -3
- package/dist/plugins/deepbook/types.mjs.map +1 -1
- package/dist/plugins/faucet/dispatcher.d.mts +21 -2
- package/dist/plugins/faucet/dispatcher.mjs +1 -2
- package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
- package/dist/plugins/faucet/errors.d.mts +11 -24
- package/dist/plugins/faucet/errors.mjs.map +1 -1
- package/dist/plugins/faucet/http.mjs +33 -14
- package/dist/plugins/faucet/http.mjs.map +1 -1
- package/dist/plugins/faucet/index.d.mts +15 -5
- package/dist/plugins/faucet/index.mjs +3 -0
- package/dist/plugins/faucet/index.mjs.map +1 -1
- package/dist/plugins/faucet/spans.mjs +12 -0
- package/dist/plugins/faucet/spans.mjs.map +1 -0
- package/dist/plugins/host-service/errors.d.mts +1 -1
- package/dist/plugins/host-service/index.mjs +34 -8
- package/dist/plugins/host-service/index.mjs.map +1 -1
- package/dist/plugins/host-service/routable.mjs +2 -1
- package/dist/plugins/host-service/routable.mjs.map +1 -1
- package/dist/plugins/host-service/service.d.mts +21 -0
- package/dist/plugins/host-service/service.mjs +136 -81
- package/dist/plugins/host-service/service.mjs.map +1 -1
- package/dist/plugins/internal/acquire-on-chain-artifact.mjs +23 -0
- package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -0
- package/dist/plugins/internal/codegen-helpers.mjs +18 -0
- package/dist/plugins/internal/codegen-helpers.mjs.map +1 -0
- package/dist/plugins/internal/funding-failure-error.mjs +32 -0
- package/dist/plugins/internal/funding-failure-error.mjs.map +1 -0
- package/dist/plugins/package/build.mjs +1 -1
- package/dist/plugins/package/build.mjs.map +1 -1
- package/dist/plugins/package/codegen.mjs +26 -0
- package/dist/plugins/package/codegen.mjs.map +1 -1
- package/dist/plugins/package/errors.d.mts +16 -6
- package/dist/plugins/package/errors.mjs.map +1 -1
- package/dist/plugins/package/index.d.mts +0 -4
- package/dist/plugins/package/index.mjs +27 -21
- package/dist/plugins/package/index.mjs.map +1 -1
- package/dist/plugins/package/mode-known.mjs +26 -12
- package/dist/plugins/package/mode-known.mjs.map +1 -1
- package/dist/plugins/package/mode-local.mjs +47 -41
- package/dist/plugins/package/mode-local.mjs.map +1 -1
- package/dist/plugins/package/publish-executor.mjs +55 -114
- package/dist/plugins/package/publish-executor.mjs.map +1 -1
- package/dist/plugins/package/registry.mjs +2 -1
- package/dist/plugins/package/registry.mjs.map +1 -1
- package/dist/plugins/package/service.mjs.map +1 -1
- package/dist/plugins/package/spans.mjs +14 -0
- package/dist/plugins/package/spans.mjs.map +1 -0
- package/dist/plugins/postgres/db-ensure.mjs +19 -12
- package/dist/plugins/postgres/db-ensure.mjs.map +1 -1
- package/dist/plugins/postgres/errors.d.mts +5 -0
- package/dist/plugins/postgres/errors.mjs.map +1 -1
- package/dist/plugins/postgres/index.mjs +10 -17
- package/dist/plugins/postgres/index.mjs.map +1 -1
- package/dist/plugins/postgres/service.mjs +58 -24
- package/dist/plugins/postgres/service.mjs.map +1 -1
- package/dist/plugins/postgres/snapshot.mjs.map +1 -1
- package/dist/plugins/postgres/spans.mjs +11 -0
- package/dist/plugins/postgres/spans.mjs.map +1 -0
- package/dist/plugins/router-entrypoints.mjs +4 -4
- package/dist/plugins/router-entrypoints.mjs.map +1 -1
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +15 -13
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +15 -19
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
- package/dist/plugins/seal/codegen.d.mts +2 -3
- package/dist/plugins/seal/codegen.mjs.map +1 -1
- package/dist/plugins/seal/config-render.mjs +35 -8
- package/dist/plugins/seal/config-render.mjs.map +1 -1
- package/dist/plugins/seal/deploy.mjs +31 -39
- package/dist/plugins/seal/deploy.mjs.map +1 -1
- package/dist/plugins/seal/errors.d.mts +1 -3
- package/dist/plugins/seal/errors.mjs +7 -1
- package/dist/plugins/seal/errors.mjs.map +1 -1
- package/dist/plugins/seal/index.d.mts +1 -6
- package/dist/plugins/seal/index.mjs +40 -14
- package/dist/plugins/seal/index.mjs.map +1 -1
- package/dist/plugins/seal/key-manager.d.mts +1 -9
- package/dist/plugins/seal/key-manager.mjs +2 -18
- package/dist/plugins/seal/key-manager.mjs.map +1 -1
- package/dist/plugins/seal/key-server.mjs +37 -36
- package/dist/plugins/seal/key-server.mjs.map +1 -1
- package/dist/plugins/seal/keygen.mjs +16 -17
- package/dist/plugins/seal/keygen.mjs.map +1 -1
- package/dist/plugins/seal/mode/fork-known.mjs +36 -14
- package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
- package/dist/plugins/seal/mode/live.d.mts +6 -4
- package/dist/plugins/seal/mode/live.mjs +14 -21
- package/dist/plugins/seal/mode/live.mjs.map +1 -1
- package/dist/plugins/seal/mode/local-keygen.mjs +57 -21
- package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
- package/dist/plugins/seal/registry-publish.mjs +1 -0
- package/dist/plugins/seal/registry-publish.mjs.map +1 -1
- package/dist/plugins/seal/routable.mjs.map +1 -1
- package/dist/plugins/seal/service.mjs.map +1 -1
- package/dist/plugins/seal/spans.mjs +18 -0
- package/dist/plugins/seal/spans.mjs.map +1 -0
- package/dist/plugins/sui/auto-tick.mjs +17 -23
- package/dist/plugins/sui/auto-tick.mjs.map +1 -1
- package/dist/plugins/sui/chain-build-container.mjs +18 -0
- package/dist/plugins/sui/chain-build-container.mjs.map +1 -0
- package/dist/plugins/sui/chain-probe.d.mts +5 -5
- package/dist/plugins/sui/chain-probe.mjs +28 -58
- package/dist/plugins/sui/chain-probe.mjs.map +1 -1
- package/dist/plugins/sui/codegen.mjs +26 -0
- package/dist/plugins/sui/codegen.mjs.map +1 -1
- package/dist/plugins/sui/errors.d.mts +2 -29
- package/dist/plugins/sui/errors.mjs +1 -3
- package/dist/plugins/sui/errors.mjs.map +1 -1
- package/dist/plugins/sui/fork-faucet-strategy.d.mts +1 -0
- package/dist/plugins/sui/fork-faucet-strategy.mjs +55 -0
- package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -0
- package/dist/plugins/sui/fork-orchestration.d.mts +1 -0
- package/dist/plugins/sui/fork-orchestration.mjs +170 -2
- package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
- package/dist/plugins/sui/fork-transaction.d.mts +2 -0
- package/dist/plugins/sui/fork-transaction.mjs +92 -28
- package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
- package/dist/plugins/sui/index.d.mts +33 -70
- package/dist/plugins/sui/index.mjs +58 -35
- package/dist/plugins/sui/index.mjs.map +1 -1
- package/dist/plugins/{faucet/strategies/sui-local.mjs → sui/local-faucet-strategy.mjs} +10 -7
- package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -0
- package/dist/plugins/sui/mode/external.mjs +7 -13
- package/dist/plugins/sui/mode/external.mjs.map +1 -1
- package/dist/plugins/sui/mode/fork.mjs +136 -59
- package/dist/plugins/sui/mode/fork.mjs.map +1 -1
- package/dist/plugins/sui/mode/live.mjs +10 -16
- package/dist/plugins/sui/mode/live.mjs.map +1 -1
- package/dist/plugins/sui/mode/local.mjs +37 -36
- package/dist/plugins/sui/mode/local.mjs.map +1 -1
- package/dist/plugins/sui/mode/shared-boot.mjs +38 -115
- package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
- package/dist/plugins/sui/mode/shared.d.mts +1 -5
- package/dist/plugins/sui/mode/shared.mjs.map +1 -1
- package/dist/plugins/sui/mode/spec.d.mts +18 -0
- package/dist/plugins/sui/move-summary-runner.mjs +207 -0
- package/dist/plugins/sui/move-summary-runner.mjs.map +1 -0
- package/dist/plugins/sui/network-resolver.d.mts +4 -3
- package/dist/plugins/sui/service.mjs.map +1 -1
- package/dist/plugins/sui/snapshot.mjs +3 -0
- package/dist/plugins/sui/snapshot.mjs.map +1 -1
- package/dist/plugins/sui/spans.mjs +17 -0
- package/dist/plugins/sui/spans.mjs.map +1 -0
- package/dist/plugins/wallet/codegen.d.mts +0 -1
- package/dist/plugins/wallet/codegen.mjs +8 -9
- package/dist/plugins/wallet/codegen.mjs.map +1 -1
- package/dist/plugins/wallet/index.d.mts +6 -8
- package/dist/plugins/wallet/index.mjs +46 -35
- package/dist/plugins/wallet/index.mjs.map +1 -1
- package/dist/plugins/wallet/origin-policy.mjs +12 -28
- package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
- package/dist/plugins/wallet/pairing.mjs +6 -4
- package/dist/plugins/wallet/pairing.mjs.map +1 -1
- package/dist/plugins/wallet/protocol.d.mts +1 -0
- package/dist/plugins/wallet/protocol.mjs +5 -44
- package/dist/plugins/wallet/protocol.mjs.map +1 -1
- package/dist/plugins/wallet/routable.mjs +2 -8
- package/dist/plugins/wallet/routable.mjs.map +1 -1
- package/dist/plugins/wallet/server.mjs +36 -44
- package/dist/plugins/wallet/server.mjs.map +1 -1
- package/dist/plugins/wallet/service.d.mts +1 -5
- package/dist/plugins/wallet/service.mjs +22 -18
- package/dist/plugins/wallet/service.mjs.map +1 -1
- package/dist/plugins/wallet/spans.mjs +22 -0
- package/dist/plugins/wallet/spans.mjs.map +1 -0
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +33 -8
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
- package/dist/plugins/walrus/codegen.d.mts +3 -3
- package/dist/plugins/walrus/codegen.mjs.map +1 -1
- package/dist/plugins/walrus/deploy-paths.mjs +21 -5
- package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
- package/dist/plugins/walrus/deploy.mjs +67 -69
- package/dist/plugins/walrus/deploy.mjs.map +1 -1
- package/dist/plugins/walrus/errors.mjs +1 -0
- package/dist/plugins/walrus/errors.mjs.map +1 -1
- package/dist/plugins/walrus/faucet-strategy.mjs +12 -7
- package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
- package/dist/plugins/walrus/index.d.mts +2 -13
- package/dist/plugins/walrus/index.mjs +18 -23
- package/dist/plugins/walrus/index.mjs.map +1 -1
- package/dist/plugins/walrus/mode/known-deploy.mjs +7 -5
- package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
- package/dist/plugins/walrus/mode/local-cluster.mjs +26 -7
- package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
- package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
- package/dist/plugins/walrus/routable.mjs +7 -23
- package/dist/plugins/walrus/routable.mjs.map +1 -1
- package/dist/plugins/walrus/service.mjs.map +1 -1
- package/dist/plugins/walrus/spans.mjs +18 -0
- package/dist/plugins/walrus/spans.mjs.map +1 -0
- package/dist/plugins/walrus/storage-nodes.d.mts +6 -2
- package/dist/plugins/walrus/storage-nodes.mjs +15 -8
- package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
- package/dist/plugins/walrus/wal-swap.mjs +58 -15
- package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
- package/dist/primitives/artifact-publisher.d.mts +1 -1
- package/dist/primitives/artifact-publisher.mjs +15 -0
- package/dist/primitives/artifact-publisher.mjs.map +1 -0
- package/dist/runtime/docker/client.mjs +17 -4
- package/dist/runtime/docker/client.mjs.map +1 -1
- package/dist/runtime/docker/container.mjs +219 -132
- package/dist/runtime/docker/container.mjs.map +1 -1
- package/dist/runtime/docker/errors.mjs +0 -6
- package/dist/runtime/docker/errors.mjs.map +1 -1
- package/dist/runtime/docker/exec.mjs +21 -18
- package/dist/runtime/docker/exec.mjs.map +1 -1
- package/dist/runtime/docker/image.mjs +36 -13
- package/dist/runtime/docker/image.mjs.map +1 -1
- package/dist/runtime/docker/index.mjs +14 -0
- package/dist/runtime/docker/inspect-and-decode.mjs +51 -0
- package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -0
- package/dist/runtime/docker/inventory.mjs +14 -11
- package/dist/runtime/docker/inventory.mjs.map +1 -1
- package/dist/runtime/docker/labels.mjs +38 -5
- package/dist/runtime/docker/labels.mjs.map +1 -1
- package/dist/runtime/docker/logs.d.mts +1 -1
- package/dist/runtime/docker/logs.mjs.map +1 -1
- package/dist/runtime/docker/network.mjs +83 -47
- package/dist/runtime/docker/network.mjs.map +1 -1
- package/dist/runtime/docker/render-run-args.mjs +82 -0
- package/dist/runtime/docker/render-run-args.mjs.map +1 -0
- package/dist/runtime/docker/service.d.mts +1 -1
- package/dist/runtime/docker/service.mjs +12 -7
- package/dist/runtime/docker/service.mjs.map +1 -1
- package/dist/runtime/docker/sweep.mjs +118 -43
- package/dist/runtime/docker/sweep.mjs.map +1 -1
- package/dist/runtime/docker/volume.mjs +2 -0
- package/dist/runtime/docker/volume.mjs.map +1 -1
- package/dist/runtime/docker/wrap.mjs +30 -1
- package/dist/runtime/docker/wrap.mjs.map +1 -1
- package/dist/substrate/cross-process.mjs +14 -8
- package/dist/substrate/cross-process.mjs.map +1 -1
- package/dist/substrate/event-time.mjs +33 -0
- package/dist/substrate/event-time.mjs.map +1 -0
- package/dist/substrate/events.d.mts +28 -8
- package/dist/substrate/identity.d.mts +2 -1
- package/dist/substrate/manifest.d.mts +68 -5
- package/dist/substrate/manifest.mjs +34 -5
- package/dist/substrate/manifest.mjs.map +1 -1
- package/dist/substrate/network.d.mts +3 -5
- package/dist/substrate/options.d.mts +0 -2
- package/dist/substrate/plugin.d.mts +13 -0
- package/dist/substrate/plugin.mjs +4 -2
- package/dist/substrate/plugin.mjs.map +1 -1
- package/dist/substrate/projection.d.mts +35 -3
- package/dist/substrate/runtime/artifact-publisher/index.mjs +19 -9
- package/dist/substrate/runtime/artifact-publisher/index.mjs.map +1 -1
- package/dist/substrate/runtime/atomic-write.mjs +97 -32
- package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
- package/dist/substrate/runtime/cache/index.mjs +3 -0
- package/dist/substrate/runtime/cache/schema.mjs +2 -2
- package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
- package/dist/substrate/runtime/cache/service.mjs +9 -7
- package/dist/substrate/runtime/cache/service.mjs.map +1 -1
- package/dist/substrate/runtime/capability-sinks/index.d.mts +1 -1
- package/dist/substrate/runtime/capability-sinks/index.mjs +3 -0
- package/dist/substrate/runtime/capability-sinks/layer.mjs +1 -1
- package/dist/substrate/runtime/capability-sinks/service.d.mts +61 -2
- package/dist/substrate/runtime/capability-sinks/service.mjs +21 -26
- package/dist/substrate/runtime/capability-sinks/service.mjs.map +1 -1
- package/dist/substrate/runtime/config-validation.d.mts +1 -13
- package/dist/substrate/runtime/config-validation.mjs +2 -91
- package/dist/substrate/runtime/config-validation.mjs.map +1 -1
- package/dist/substrate/runtime/container-runtime.d.mts +1 -0
- package/dist/substrate/runtime/container-runtime.mjs +2 -0
- package/dist/substrate/runtime/control-plane/domain.mjs +101 -0
- package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -0
- package/dist/substrate/runtime/control-plane/service.mjs +7 -0
- package/dist/substrate/runtime/control-plane/service.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +46 -19
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs +30 -12
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/index.mjs +5 -0
- package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs +11 -2
- package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs +1 -1
- package/dist/substrate/runtime/cross-process/index.mjs +11 -0
- package/dist/substrate/runtime/cross-process/live-clock.mjs +34 -0
- package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/liveness.mjs +52 -10
- package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/lock.d.mts +1 -0
- package/dist/substrate/runtime/cross-process/lock.mjs +23 -0
- package/dist/substrate/runtime/cross-process/lock.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +64 -0
- package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/roster.mjs +97 -83
- package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/self-pid.mjs +8 -0
- package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +24 -28
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/stack-lock.mjs +41 -20
- package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
- package/dist/substrate/runtime/current-plugin.mjs +2 -2
- package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
- package/dist/substrate/runtime/errors.mjs +12 -6
- package/dist/substrate/runtime/errors.mjs.map +1 -1
- package/dist/substrate/runtime/format-unknown-error.mjs +30 -0
- package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -0
- package/dist/substrate/runtime/host-bind-mount-owner.mjs +10 -0
- package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -0
- package/dist/substrate/runtime/host-gateway.mjs +20 -0
- package/dist/substrate/runtime/host-gateway.mjs.map +1 -0
- package/dist/substrate/runtime/host-tree-tar/index.mjs +61 -50
- package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
- package/dist/substrate/runtime/http-probe.d.mts +1 -1
- package/dist/substrate/runtime/index.mjs +14 -0
- package/dist/substrate/runtime/lease-broker/index.d.mts +1 -1
- package/dist/substrate/runtime/lease-broker/index.mjs +2 -0
- package/dist/substrate/runtime/lease-broker/service.d.mts +1 -64
- package/dist/substrate/runtime/lease-broker/service.mjs +1 -1
- package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs +22 -3
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/index.mjs +9 -0
- package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +20 -3
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/selective-restart.mjs +1 -1
- package/dist/substrate/runtime/lifecycle/signals.mjs +5 -5
- package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/state-machine.mjs +1 -1
- package/dist/substrate/runtime/managed-container.d.mts +19 -1
- package/dist/substrate/runtime/managed-container.mjs +20 -1
- package/dist/substrate/runtime/managed-container.mjs.map +1 -1
- package/dist/substrate/runtime/manifest/index.mjs +3 -0
- package/dist/substrate/runtime/manifest/manifest.mjs +15 -11
- package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
- package/dist/substrate/runtime/mode-errors.mjs +20 -0
- package/dist/substrate/runtime/mode-errors.mjs.map +1 -0
- package/dist/substrate/runtime/observability/cascade-formatter.mjs +9 -13
- package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
- package/dist/substrate/runtime/observability/formatter-registry.mjs +19 -36
- package/dist/substrate/runtime/observability/formatter-registry.mjs.map +1 -1
- package/dist/substrate/runtime/observability/ignore-with-log.d.mts +1 -0
- package/dist/substrate/runtime/observability/ignore-with-log.mjs +17 -0
- package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -0
- package/dist/substrate/runtime/observability/index.d.mts +1 -1
- package/dist/substrate/runtime/observability/index.mjs +13 -0
- package/dist/substrate/runtime/observability/log-store.d.mts +1 -0
- package/dist/substrate/runtime/observability/log-store.mjs +175 -0
- package/dist/substrate/runtime/observability/log-store.mjs.map +1 -0
- package/dist/substrate/runtime/observability/logger.d.mts +2 -1
- package/dist/substrate/runtime/observability/logger.mjs +5 -9
- package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
- package/dist/substrate/runtime/observability/output-truncate.mjs +35 -0
- package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -0
- package/dist/substrate/runtime/observability/pretty-error.mjs +9 -12
- package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
- package/dist/substrate/runtime/observability/redaction.d.mts +2 -13
- package/dist/substrate/runtime/observability/redaction.mjs +8 -14
- package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
- package/dist/substrate/runtime/observability/span-store.d.mts +1 -0
- package/dist/substrate/runtime/observability/span-store.mjs +110 -0
- package/dist/substrate/runtime/observability/span-store.mjs.map +1 -0
- package/dist/substrate/runtime/observability/spans.mjs +14 -14
- package/dist/substrate/runtime/observability/spans.mjs.map +1 -1
- package/dist/substrate/runtime/observability/subprocess-capture.mjs +1 -1
- package/dist/substrate/runtime/passthrough-or-wrap.mjs +33 -0
- package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -0
- package/dist/substrate/runtime/paths.d.mts +1 -1
- package/dist/substrate/runtime/paths.mjs +4 -3
- package/dist/substrate/runtime/paths.mjs.map +1 -1
- package/dist/substrate/runtime/phase-preserving-produce.mjs +40 -0
- package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -0
- package/dist/substrate/runtime/port-broker/index.mjs +3 -0
- package/dist/substrate/runtime/port-broker/service.mjs +170 -126
- package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
- package/dist/substrate/runtime/post-acquire-tasks.mjs +1 -1
- package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
- package/dist/substrate/runtime/probes.d.mts +7 -5
- package/dist/substrate/runtime/probes.mjs +3 -1
- package/dist/substrate/runtime/probes.mjs.map +1 -1
- package/dist/substrate/runtime/projection/index.mjs +4 -0
- package/dist/substrate/runtime/projection/operational-endpoints.mjs +1 -2
- package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
- package/dist/substrate/runtime/projection/persisted.mjs +33 -15
- package/dist/substrate/runtime/projection/persisted.mjs.map +1 -1
- package/dist/substrate/runtime/projection/state-ref.mjs +26 -2
- package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
- package/dist/substrate/runtime/projection/update.mjs +88 -24
- package/dist/substrate/runtime/projection/update.mjs.map +1 -1
- package/dist/substrate/runtime/random-suffix.mjs +11 -0
- package/dist/substrate/runtime/random-suffix.mjs.map +1 -0
- package/dist/substrate/runtime/retry-policy.d.mts +59 -1
- package/dist/substrate/runtime/retry-policy.mjs +66 -1
- package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
- package/dist/substrate/runtime/routed-url.d.mts +1 -0
- package/dist/substrate/runtime/routed-url.mjs +79 -0
- package/dist/substrate/runtime/routed-url.mjs.map +1 -0
- package/dist/substrate/runtime/runtime-decode.d.mts +1 -1
- package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
- package/dist/substrate/runtime/scoped-http-server.mjs +2 -3
- package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
- package/dist/substrate/runtime/scoped-multimap/index.mjs +2 -0
- package/dist/substrate/runtime/scoped-multimap/service.mjs +52 -0
- package/dist/substrate/runtime/scoped-multimap/service.mjs.map +1 -0
- package/dist/substrate/runtime/scoped-ref-map/index.mjs +2 -0
- package/dist/substrate/runtime/scoped-ref-map/service.mjs +2 -2
- package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +1 -1
- package/dist/substrate/runtime/stage-and-swap/index.mjs +72 -4
- package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
- package/dist/substrate/runtime/state-store/index.d.mts +1 -0
- package/dist/substrate/runtime/state-store/index.mjs +3 -0
- package/dist/substrate/runtime/state-store/schema.d.mts +1 -0
- package/dist/substrate/runtime/state-store/schema.mjs +19 -14
- package/dist/substrate/runtime/state-store/schema.mjs.map +1 -1
- package/dist/substrate/runtime/state-store/service.d.mts +1 -0
- package/dist/substrate/runtime/state-store/service.mjs +145 -0
- package/dist/substrate/runtime/state-store/service.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.d.mts +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs +33 -0
- package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs +1 -1
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
- package/dist/substrate/runtime/strategy-registry/index.mjs +4 -0
- package/dist/substrate/runtime/strategy-registry/service.mjs +19 -33
- package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
- package/dist/substrate/runtime/subnet-broker.mjs +60 -0
- package/dist/substrate/runtime/subnet-broker.mjs.map +1 -0
- package/dist/substrate/runtime/sui-execute/index.d.mts +21 -1
- package/dist/substrate/runtime/sui-execute/index.mjs +84 -20
- package/dist/substrate/runtime/sui-execute/index.mjs.map +1 -1
- package/dist/substrate/runtime/sui-execute/sign-and-dispatch.d.mts +1 -0
- package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs +32 -0
- package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +1 -0
- package/dist/substrate/runtime/sui-ledger/object-ref.mjs +32 -0
- package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +1 -0
- package/dist/substrate/runtime/sui-move-build/index.mjs +93 -19
- package/dist/substrate/runtime/sui-move-build/index.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/acquire-node.mjs +181 -0
- package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/background-tasks.mjs +144 -0
- package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/command-loop.mjs +68 -0
- package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +151 -0
- package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/errors.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/errors.mjs +9 -0
- package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/index.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/index.mjs +3 -0
- package/dist/substrate/runtime/supervisor/shutdown.mjs +51 -0
- package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/start-supervisor.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/start-supervisor.mjs +250 -0
- package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/state.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/state.mjs +22 -0
- package/dist/substrate/runtime/supervisor/state.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/teardown.mjs +57 -0
- package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/types.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/wiring.mjs +133 -0
- package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -0
- package/dist/substrate/runtime/typed-env.mjs +8 -0
- package/dist/substrate/runtime/typed-env.mjs.map +1 -0
- package/dist/substrate/state-store.d.mts +1 -0
- package/dist/substrate/versioned-doc-schema.mjs +17 -0
- package/dist/substrate/versioned-doc-schema.mjs.map +1 -0
- package/dist/substrate/versioned-doc-sync.mjs +94 -0
- package/dist/substrate/versioned-doc-sync.mjs.map +1 -0
- package/dist/surfaces/cli/command-tree.mjs.map +1 -1
- package/dist/surfaces/cli/commands/index.mjs +9 -0
- package/dist/surfaces/cli/commands/prune-picker-entry.mjs +13 -0
- package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -0
- package/dist/surfaces/cli/commands/prune-picker.mjs +3 -2
- package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
- package/dist/surfaces/cli/commands/prune.mjs +34 -17
- package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
- package/dist/surfaces/cli/commands/status.mjs +2 -2
- package/dist/surfaces/cli/commands/status.mjs.map +1 -1
- package/dist/surfaces/cli/commands/supervisor-presence.mjs +5 -3
- package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
- package/dist/surfaces/cli/commands/wipe.mjs +38 -4
- package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
- package/dist/surfaces/cli/errors.mjs +1 -1
- package/dist/surfaces/cli/errors.mjs.map +1 -1
- package/dist/surfaces/cli/flags.mjs +0 -1
- package/dist/surfaces/cli/flags.mjs.map +1 -1
- package/dist/surfaces/cli/index.mjs +98 -18
- package/dist/surfaces/cli/index.mjs.map +1 -1
- package/dist/surfaces/cli/output.mjs +1 -0
- package/dist/surfaces/cli/output.mjs.map +1 -1
- package/dist/surfaces/cli/sysexits.mjs +2 -1
- package/dist/surfaces/cli/sysexits.mjs.map +1 -1
- package/dist/surfaces/tui/app.mjs +25 -3
- package/dist/surfaces/tui/app.mjs.map +1 -1
- package/dist/surfaces/tui/display-derivation.mjs +23 -74
- package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
- package/dist/surfaces/tui/event-log.mjs +35 -23
- package/dist/surfaces/tui/event-log.mjs.map +1 -1
- package/dist/surfaces/tui/input.mjs +5 -1
- package/dist/surfaces/tui/input.mjs.map +1 -1
- package/dist/surfaces/tui/plain-renderer.mjs +70 -34
- package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
- package/package.json +24 -4
- package/dist/contracts/liveness-classifier.d.mts +0 -19
- package/dist/contracts/network-resolver.d.mts +0 -15
- package/dist/contracts/network-resolver.mjs +0 -7
- package/dist/contracts/network-resolver.mjs.map +0 -1
- package/dist/orchestrators/codegen/extras.mjs +0 -16
- package/dist/orchestrators/codegen/extras.mjs.map +0 -1
- package/dist/plugins/deepbook/routable.mjs +0 -21
- package/dist/plugins/deepbook/routable.mjs.map +0 -1
- package/dist/plugins/faucet/service.d.mts +0 -20
- package/dist/plugins/faucet/strategies/sui-local.d.mts +0 -23
- package/dist/plugins/faucet/strategies/sui-local.mjs.map +0 -1
- package/dist/plugins/sui/seed-objects.d.mts +0 -18
- package/dist/plugins/sui/seed-objects.mjs +0 -25
- package/dist/plugins/sui/seed-objects.mjs.map +0 -1
- package/dist/runtime/built-in-plugin-layers.mjs.map +0 -1
- package/dist/substrate/runtime/context-helpers.mjs +0 -32
- package/dist/substrate/runtime/context-helpers.mjs.map +0 -1
- package/dist/substrate/runtime/run.mjs.map +0 -1
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs +0 -30
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs.map +0 -1
- package/dist/substrate/runtime/supervisor.d.mts +0 -1
- package/dist/substrate/runtime/supervisor.mjs +0 -831
- package/dist/substrate/runtime/supervisor.mjs.map +0 -1
- package/dist/surfaces/cli/commands/doctor-probes.mjs.map +0 -1
- /package/dist/{substrate/runtime/strategy-registry/faucet-capability-for.d.mts → plugins/faucet/http.d.mts} +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { StackPathsService } from "../../substrate/runtime/paths.mjs";
|
|
2
|
+
import { makeProjectionRef } from "../../substrate/runtime/projection/state-ref.mjs";
|
|
3
|
+
import { writeProjectionSnapshot } from "../../substrate/runtime/projection/persisted.mjs";
|
|
4
|
+
import { commandChannelPaths, makeCommandChannelPublisher } from "../../substrate/runtime/cross-process/command-channel/channel.mjs";
|
|
5
|
+
import { SnapshotOrchestratorService } from "../../orchestrators/snapshot/service.mjs";
|
|
6
|
+
import "../../substrate/runtime/index.mjs";
|
|
7
|
+
import { superviseStackEffect } from "../../orchestrators/run.mjs";
|
|
8
|
+
import "../../orchestrators/snapshot/index.mjs";
|
|
9
|
+
import { buildProductionOrchestratorSinks, buildProductionPostAcquireHook } from "../../orchestrators/runtime-composition.mjs";
|
|
10
|
+
import { extendBuiltInPluginContext, layerBuiltInPluginRuntime } from "../../orchestrators/built-in-plugin-layers.mjs";
|
|
11
|
+
import { ExitCode } from "../../surfaces/cli/sysexits.mjs";
|
|
12
|
+
import { CliInternalError } from "../../surfaces/cli/errors.mjs";
|
|
13
|
+
import { probeSupervisorPresence } from "../../surfaces/cli/commands/supervisor-presence.mjs";
|
|
14
|
+
import "../../surfaces/cli/commands/index.mjs";
|
|
15
|
+
import { cliErrorFromConfigExit } from "../bail.mjs";
|
|
16
|
+
import { makeConfigLoader } from "./config-loader.mjs";
|
|
17
|
+
import { identityValueFor, resolvedIdentityForStack, stackRootFor } from "./identity.mjs";
|
|
18
|
+
import { buildVerbLayers } from "./build-verb-layers.mjs";
|
|
19
|
+
import { Cause, Effect, Exit, Logger, SubscriptionRef } from "effect";
|
|
20
|
+
import { dirname, resolve } from "node:path";
|
|
21
|
+
//#region src/cli/wirings/apply.ts
|
|
22
|
+
const LIVE_APPLY_ACK_TIMEOUT_MILLIS = 600 * 1e3;
|
|
23
|
+
/** Probe the roster file; if a supervisor is live, publish
|
|
24
|
+
* `apply.requested` and await its ack. */
|
|
25
|
+
const runApplyAgainstLiveSupervisor = (identity, identityValue) => Effect.gen(function* () {
|
|
26
|
+
const stackRoot = stackRootFor(identity.runtimeRoot, String(identityValue.stack));
|
|
27
|
+
if (!(yield* probeSupervisorPresence(resolve(stackRoot, "roster.json")).pipe(Effect.catch(() => Effect.succeed({
|
|
28
|
+
live: false,
|
|
29
|
+
pid: null,
|
|
30
|
+
hostname: null
|
|
31
|
+
})))).live) return { kind: "direct" };
|
|
32
|
+
const exit = yield* Effect.exit(Effect.gen(function* () {
|
|
33
|
+
const publisher = yield* makeCommandChannelPublisher(commandChannelPaths(stackRoot));
|
|
34
|
+
const published = yield* publisher.publish({ tag: "apply.requested" });
|
|
35
|
+
const reply = yield* publisher.awaitCompletion(published, { timeoutMillis: LIVE_APPLY_ACK_TIMEOUT_MILLIS });
|
|
36
|
+
if (!reply.ok) return yield* Effect.fail(reply.message);
|
|
37
|
+
}));
|
|
38
|
+
if (Exit.isFailure(exit)) return {
|
|
39
|
+
kind: "live-failed",
|
|
40
|
+
error: new CliInternalError({
|
|
41
|
+
message: "live stack apply failed",
|
|
42
|
+
cause: Cause.pretty(exit.cause)
|
|
43
|
+
})
|
|
44
|
+
};
|
|
45
|
+
return { kind: "live-ok" };
|
|
46
|
+
});
|
|
47
|
+
const runApplyLive = (configPath, identity) => {
|
|
48
|
+
const loader = makeConfigLoader();
|
|
49
|
+
return Effect.gen(function* () {
|
|
50
|
+
const loadExit = yield* Effect.exit(loader.load(configPath));
|
|
51
|
+
if (Exit.isFailure(loadExit)) return yield* Effect.fail(cliErrorFromConfigExit(loadExit));
|
|
52
|
+
const loaded = loadExit.value;
|
|
53
|
+
const stack = loaded.stack;
|
|
54
|
+
const effectiveIdentity = resolvedIdentityForStack(identity, stack);
|
|
55
|
+
const identityValue = identityValueFor(effectiveIdentity);
|
|
56
|
+
const dispatch = yield* runApplyAgainstLiveSupervisor(effectiveIdentity, identityValue);
|
|
57
|
+
if (dispatch.kind === "live-failed") return yield* Effect.fail(dispatch.error);
|
|
58
|
+
if (dispatch.kind === "live-ok") return { exitCode: ExitCode.OK };
|
|
59
|
+
const substrateLayers = buildVerbLayers({
|
|
60
|
+
identity: identityValue,
|
|
61
|
+
stack,
|
|
62
|
+
appRoot: dirname(loaded.resolvedConfigPath),
|
|
63
|
+
runtimeRoot: effectiveIdentity.runtimeRoot
|
|
64
|
+
});
|
|
65
|
+
return yield* Effect.gen(function* () {
|
|
66
|
+
const state = yield* makeProjectionRef();
|
|
67
|
+
const orchestratorSinks = yield* buildProductionOrchestratorSinks();
|
|
68
|
+
const postAcquireHook = yield* buildProductionPostAcquireHook({ extras: stack.options.extras });
|
|
69
|
+
yield* (yield* SnapshotOrchestratorService).recoverPendingRestore.pipe(Effect.tapCause((cause) => Effect.sync(() => {
|
|
70
|
+
process.stderr.write(`snapshot recovery scan failed: ${Cause.pretty(cause)}\n`);
|
|
71
|
+
})), Effect.catch(() => Effect.succeed(null)));
|
|
72
|
+
yield* superviseStackEffect({
|
|
73
|
+
_tag: "Stack",
|
|
74
|
+
members: stack.members,
|
|
75
|
+
options: stack.options
|
|
76
|
+
}, identityValue, state, {
|
|
77
|
+
orchestratorSinks,
|
|
78
|
+
postAcquireHook,
|
|
79
|
+
lifetime: "one-shot",
|
|
80
|
+
extendContext: extendBuiltInPluginContext
|
|
81
|
+
}).pipe(Effect.provide(layerBuiltInPluginRuntime(orchestratorSinks)));
|
|
82
|
+
yield* writeProjectionSnapshot((yield* StackPathsService).stackRoot, yield* SubscriptionRef.get(state));
|
|
83
|
+
}).pipe(Effect.provide(substrateLayers), Effect.provide(Logger.layer([Logger.consolePretty()])), Effect.matchCauseEffect({
|
|
84
|
+
onFailure: (cause) => Effect.fail(new CliInternalError({
|
|
85
|
+
message: "stack apply failed",
|
|
86
|
+
cause: Cause.pretty(cause)
|
|
87
|
+
})),
|
|
88
|
+
onSuccess: () => Effect.succeed({ exitCode: ExitCode.OK })
|
|
89
|
+
}));
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
//#endregion
|
|
93
|
+
export { runApplyLive };
|
|
94
|
+
|
|
95
|
+
//# sourceMappingURL=apply.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.mjs","names":["resolvePath"],"sources":["../../../src/cli/wirings/apply.ts"],"sourcesContent":["// `devstack apply` verb wiring.\n//\n// Live-aware: if a supervisor owns the selected stack, publish an\n// `apply.requested` command and await its ack. Otherwise run a\n// one-shot supervise that exits when all plugins are ready.\n//\n// Logger layer: `Logger.consolePretty()`. `apply` is the documented\n// one-shot mode (no TUI) — its consumers are CI logs and ad-hoc\n// operator runs that read raw stderr. Structured `Effect.log*` records\n// are the only operator-visible diagnostic for non-TUI surfaces, so we\n// route them through the pretty console layer. The sibling `up` verb\n// silences this layer (see `wirings/up.ts` header) because it owns the\n// TUI and would render duplicate / scrambled output otherwise.\n\nimport { dirname, resolve as resolvePath } from 'node:path';\n\nimport { Cause, Effect, Exit, Logger, SubscriptionRef } from 'effect';\n\nimport type { Identity } from '../../substrate/identity.ts';\nimport { StackPathsService } from '../../substrate/runtime/paths.ts';\nimport {\n\tcommandChannelPaths,\n\tmakeCommandChannelPublisher,\n\tmakeProjectionRef,\n\ttype SupervisedStack,\n\twriteProjectionSnapshot,\n} from '../../substrate/runtime/index.ts';\nimport { superviseStackEffect } from '../../orchestrators/run.ts';\nimport {\n\tbuildProductionOrchestratorSinks,\n\tbuildProductionPostAcquireHook,\n} from '../../orchestrators/runtime-composition.ts';\nimport {\n\textendBuiltInPluginContext,\n\tlayerBuiltInPluginRuntime,\n} from '../../orchestrators/built-in-plugin-layers.ts';\nimport { SnapshotOrchestratorService } from '../../orchestrators/snapshot/index.ts';\nimport { type CliError, CliInternalError } from '../../surfaces/cli/errors.ts';\nimport { type CommandResult, probeSupervisorPresence } from '../../surfaces/cli/commands/index.ts';\nimport { ExitCode } from '../../surfaces/cli/sysexits.ts';\nimport type { LoadedConfig } from '../../surfaces/cli/commands/config-loader.ts';\n\nimport { cliErrorFromConfigExit } from '../bail.ts';\nimport { makeConfigLoader } from './config-loader.ts';\nimport {\n\tidentityValueFor,\n\tresolvedIdentityForStack,\n\tstackRootFor,\n\ttype ResolvedIdentity,\n} from './identity.ts';\nimport { buildVerbLayers } from './build-verb-layers.ts';\n\nconst LIVE_APPLY_ACK_TIMEOUT_MILLIS = 10 * 60 * 1000;\n\n/** Outcome of the live-supervisor probe + dispatch:\n * - `kind: 'direct'` — no supervisor; caller runs the direct path.\n * - `kind: 'live-ok'` — live supervisor acked; verb is done.\n * - `kind: 'live-failed'` — live supervisor refused/timed-out; caller\n * surfaces the typed `CliError` via the dispatcher envelope. */\ntype ApplyDispatch =\n\t| { readonly kind: 'direct' }\n\t| { readonly kind: 'live-ok' }\n\t| { readonly kind: 'live-failed'; readonly error: CliError };\n\n/** Probe the roster file; if a supervisor is live, publish\n * `apply.requested` and await its ack. */\nconst runApplyAgainstLiveSupervisor = (\n\tidentity: ResolvedIdentity,\n\tidentityValue: Identity,\n): Effect.Effect<ApplyDispatch> =>\n\tEffect.gen(function* () {\n\t\tconst stackRoot = stackRootFor(identity.runtimeRoot, String(identityValue.stack));\n\t\tconst presence = yield* probeSupervisorPresence(resolvePath(stackRoot, 'roster.json')).pipe(\n\t\t\tEffect.catch(() => Effect.succeed({ live: false, pid: null, hostname: null })),\n\t\t);\n\t\tif (!presence.live) return { kind: 'direct' as const };\n\n\t\tconst exit = yield* Effect.exit(\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst publisher = yield* makeCommandChannelPublisher(commandChannelPaths(stackRoot));\n\t\t\t\tconst published = yield* publisher.publish({ tag: 'apply.requested' });\n\t\t\t\tconst reply = yield* publisher.awaitCompletion(published, {\n\t\t\t\t\ttimeoutMillis: LIVE_APPLY_ACK_TIMEOUT_MILLIS,\n\t\t\t\t});\n\t\t\t\tif (!reply.ok) {\n\t\t\t\t\treturn yield* Effect.fail(reply.message);\n\t\t\t\t}\n\t\t\t}),\n\t\t);\n\n\t\tif (Exit.isFailure(exit)) {\n\t\t\treturn {\n\t\t\t\tkind: 'live-failed' as const,\n\t\t\t\terror: new CliInternalError({\n\t\t\t\t\tmessage: 'live stack apply failed',\n\t\t\t\t\tcause: Cause.pretty(exit.cause as Cause.Cause<unknown>),\n\t\t\t\t}),\n\t\t\t};\n\t\t}\n\n\t\treturn { kind: 'live-ok' as const };\n\t});\n\nexport const runApplyLive = (\n\tconfigPath: string | undefined,\n\tidentity: ResolvedIdentity,\n): Effect.Effect<CommandResult, CliError> => {\n\tconst loader = makeConfigLoader();\n\treturn Effect.gen(function* () {\n\t\t// Config-load failures surface as typed `CliError`s; the\n\t\t// dispatcher's outer `emitFailure` renders the envelope.\n\t\tconst loadExit = yield* Effect.exit(loader.load(configPath));\n\t\tif (Exit.isFailure(loadExit)) {\n\t\t\treturn yield* Effect.fail(cliErrorFromConfigExit(loadExit));\n\t\t}\n\t\tconst loaded = loadExit.value;\n\t\tconst stack = (loaded as LoadedConfig & { readonly stack: SupervisedStack }).stack;\n\t\t// Re-derive the identity against the EFFECTIVE stack (explicit\n\t\t// `--stack`/`$DEVSTACK_STACK` > `config.stackName` > inferred) so\n\t\t// the live-supervisor probe + roster paths target the same stack\n\t\t// the operator selected — matching `snapshot.ts`. An explicit\n\t\t// `--stack` must NOT be overridden by `config.stackName`, otherwise\n\t\t// `apply` would probe/boot the wrong stack's supervisor.\n\t\tconst effectiveIdentity = resolvedIdentityForStack(identity, stack);\n\t\tconst identityValue: Identity = identityValueFor(effectiveIdentity);\n\t\tconst dispatch = yield* runApplyAgainstLiveSupervisor(effectiveIdentity, identityValue);\n\t\tif (dispatch.kind === 'live-failed') {\n\t\t\treturn yield* Effect.fail(dispatch.error);\n\t\t}\n\t\tif (dispatch.kind === 'live-ok') {\n\t\t\treturn { exitCode: ExitCode.OK };\n\t\t}\n\t\tconst appRoot = dirname(loaded.resolvedConfigPath);\n\t\tconst substrateLayers = buildVerbLayers({\n\t\t\tidentity: identityValue,\n\t\t\tstack,\n\t\t\tappRoot,\n\t\t\truntimeRoot: effectiveIdentity.runtimeRoot,\n\t\t});\n\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst state = yield* makeProjectionRef();\n\t\t\tconst orchestratorSinks = yield* buildProductionOrchestratorSinks();\n\t\t\tconst postAcquireHook = yield* buildProductionPostAcquireHook({\n\t\t\t\textras: stack.options.extras,\n\t\t\t});\n\t\t\t// Mirror the up-path recovery: reconcile any half-promoted\n\t\t\t// snapshot restore from a prior supervise BEFORE the one-shot\n\t\t\t// apply starts the stack. Idempotent + no-op when no marker.\n\t\t\tconst snapshot = yield* SnapshotOrchestratorService;\n\t\t\tyield* snapshot.recoverPendingRestore.pipe(\n\t\t\t\tEffect.tapCause((cause) =>\n\t\t\t\t\tEffect.sync(() => {\n\t\t\t\t\t\tprocess.stderr.write(\n\t\t\t\t\t\t\t`snapshot recovery scan failed: ${Cause.pretty(cause as Cause.Cause<unknown>)}\\n`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t\tEffect.catch(() => Effect.succeed(null)),\n\t\t\t);\n\t\t\tyield* superviseStackEffect(\n\t\t\t\t{ _tag: 'Stack', members: stack.members, options: stack.options },\n\t\t\t\tidentityValue,\n\t\t\t\tstate,\n\t\t\t\t{\n\t\t\t\t\torchestratorSinks,\n\t\t\t\t\tpostAcquireHook,\n\t\t\t\t\tlifetime: 'one-shot',\n\t\t\t\t\textendContext: extendBuiltInPluginContext,\n\t\t\t\t},\n\t\t\t).pipe(Effect.provide(layerBuiltInPluginRuntime(orchestratorSinks)));\n\t\t\tconst stackPaths = yield* StackPathsService;\n\t\t\tyield* writeProjectionSnapshot(stackPaths.stackRoot, yield* SubscriptionRef.get(state));\n\t\t});\n\n\t\treturn yield* program.pipe(\n\t\t\tEffect.provide(substrateLayers),\n\t\t\tEffect.provide(Logger.layer([Logger.consolePretty()])),\n\t\t\tEffect.matchCauseEffect({\n\t\t\t\tonFailure: (cause): Effect.Effect<CommandResult, CliError> =>\n\t\t\t\t\tEffect.fail(\n\t\t\t\t\t\tnew CliInternalError({\n\t\t\t\t\t\t\tmessage: 'stack apply failed',\n\t\t\t\t\t\t\tcause: Cause.pretty(cause as Cause.Cause<unknown>),\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\tonSuccess: (): Effect.Effect<CommandResult, CliError> =>\n\t\t\t\t\tEffect.succeed({ exitCode: ExitCode.OK }),\n\t\t\t}),\n\t\t);\n\t});\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { buildSubstrateLayers } from "../../orchestrators/run.mjs";
|
|
2
|
+
import { layerProductionOrchestrators } from "../../orchestrators/runtime-composition.mjs";
|
|
3
|
+
import { resolveCodegenOutput } from "../../orchestrators/codegen/output-location.mjs";
|
|
4
|
+
import { Layer } from "effect";
|
|
5
|
+
//#region src/cli/wirings/build-verb-layers.ts
|
|
6
|
+
/** Compose substrate + orchestrator Layers for a verb that knows its
|
|
7
|
+
* stack-config (i.e. has a `loaded` config and can pass codegen
|
|
8
|
+
* options). Use `buildDirectSnapshotLayers` when the verb does NOT
|
|
9
|
+
* load a config (e.g. restore/delete/wipe).
|
|
10
|
+
*
|
|
11
|
+
* Resolves the per-stack codegen output location HERE — the one boot
|
|
12
|
+
* seam where both the primary stack (`stack.options.stackName`) and the
|
|
13
|
+
* EFFECTIVE stack (`String(identity.stack)`, already run through the
|
|
14
|
+
* explicit-`--stack` > `config.stackName` > inferred precedence ladder
|
|
15
|
+
* by `resolvedIdentityForStack`/`identityValueFor` upstream) are in
|
|
16
|
+
* scope. The primary run emits into `src/generated/`; a secondary run
|
|
17
|
+
* (concurrent `--stack e2e`/etc.) emits into
|
|
18
|
+
* `.devstack/stacks/<stack>/generated/` so the two never clobber. The
|
|
19
|
+
* resolved literal `outputDir`/`stackSubdir` flow into
|
|
20
|
+
* `layerProductionOrchestrators` unchanged — `paths.ts` keeps consuming
|
|
21
|
+
* a literal, minimal blast radius. */
|
|
22
|
+
const buildVerbLayers = (params) => {
|
|
23
|
+
const codegenOutput = resolveCodegenOutput({
|
|
24
|
+
appRoot: params.appRoot,
|
|
25
|
+
effectiveStack: String(params.identity.stack),
|
|
26
|
+
primaryStack: params.stack.options.stackName,
|
|
27
|
+
explicitOutputDir: params.stack.options.codegen?.outputDir,
|
|
28
|
+
explicitStackSubdir: params.stack.options.codegen?.stackSubdir ?? null
|
|
29
|
+
});
|
|
30
|
+
return layerProductionOrchestrators({ codegen: {
|
|
31
|
+
appRoot: params.appRoot,
|
|
32
|
+
outputDir: codegenOutput.outputDir,
|
|
33
|
+
stackSubdir: codegenOutput.stackSubdir
|
|
34
|
+
} }).pipe(Layer.provideMerge(buildSubstrateLayers(params.identity, params.runtimeRoot)));
|
|
35
|
+
};
|
|
36
|
+
/** Substrate + (default-codegen) orchestrator Layers for verbs that
|
|
37
|
+
* don't load a config. */
|
|
38
|
+
const buildDirectSnapshotLayers = (params) => layerProductionOrchestrators().pipe(Layer.provideMerge(buildSubstrateLayers(params.identity, params.runtimeRoot)));
|
|
39
|
+
//#endregion
|
|
40
|
+
export { buildDirectSnapshotLayers, buildVerbLayers };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=build-verb-layers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-verb-layers.mjs","names":[],"sources":["../../../src/cli/wirings/build-verb-layers.ts"],"sourcesContent":["// Shared substrate + orchestrator Layer composition for verb wirings.\n//\n// The CLI verbs that boot a substrate (`up`, `apply --direct`, snapshot\n// capture --direct) all build the same composition:\n// - `layerProductionOrchestrators({ codegen })` on top of\n// - `buildSubstrateLayers(identity, runtimeRoot)`.\n//\n// Extracted here so each wiring file references one helper instead of\n// rebuilding the composition inline (formerly ~5 sites in `main.ts`).\n\nimport { Layer } from 'effect';\n\nimport type { Identity } from '../../substrate/identity.ts';\nimport { buildSubstrateLayers } from '../../orchestrators/run.ts';\nimport { layerProductionOrchestrators } from '../../orchestrators/runtime-composition.ts';\nimport { resolveCodegenOutput } from '../../orchestrators/codegen/output-location.ts';\nimport type { SupervisedStack } from '../../substrate/runtime/index.ts';\n\n/** Compose substrate + orchestrator Layers for a verb that knows its\n * stack-config (i.e. has a `loaded` config and can pass codegen\n * options). Use `buildDirectSnapshotLayers` when the verb does NOT\n * load a config (e.g. restore/delete/wipe).\n *\n * Resolves the per-stack codegen output location HERE — the one boot\n * seam where both the primary stack (`stack.options.stackName`) and the\n * EFFECTIVE stack (`String(identity.stack)`, already run through the\n * explicit-`--stack` > `config.stackName` > inferred precedence ladder\n * by `resolvedIdentityForStack`/`identityValueFor` upstream) are in\n * scope. The primary run emits into `src/generated/`; a secondary run\n * (concurrent `--stack e2e`/etc.) emits into\n * `.devstack/stacks/<stack>/generated/` so the two never clobber. The\n * resolved literal `outputDir`/`stackSubdir` flow into\n * `layerProductionOrchestrators` unchanged — `paths.ts` keeps consuming\n * a literal, minimal blast radius. */\nexport const buildVerbLayers = (params: {\n\treadonly identity: Identity;\n\treadonly stack: SupervisedStack;\n\treadonly appRoot: string;\n\treadonly runtimeRoot: string;\n}) => {\n\tconst codegenOutput = resolveCodegenOutput({\n\t\tappRoot: params.appRoot,\n\t\teffectiveStack: String(params.identity.stack),\n\t\tprimaryStack: params.stack.options.stackName,\n\t\texplicitOutputDir: params.stack.options.codegen?.outputDir,\n\t\texplicitStackSubdir: params.stack.options.codegen?.stackSubdir ?? null,\n\t});\n\treturn layerProductionOrchestrators({\n\t\tcodegen: {\n\t\t\tappRoot: params.appRoot,\n\t\t\toutputDir: codegenOutput.outputDir,\n\t\t\tstackSubdir: codegenOutput.stackSubdir,\n\t\t},\n\t}).pipe(Layer.provideMerge(buildSubstrateLayers(params.identity, params.runtimeRoot)));\n};\n\n/** Substrate + (default-codegen) orchestrator Layers for verbs that\n * don't load a config. */\nexport const buildDirectSnapshotLayers = (params: {\n\treadonly identity: Identity;\n\treadonly runtimeRoot: string;\n}) =>\n\tlayerProductionOrchestrators().pipe(\n\t\tLayer.provideMerge(buildSubstrateLayers(params.identity, params.runtimeRoot)),\n\t);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,mBAAmB,WAK1B;CACL,MAAM,gBAAgB,qBAAqB;EAC1C,SAAS,OAAO;EAChB,gBAAgB,OAAO,OAAO,SAAS,MAAM;EAC7C,cAAc,OAAO,MAAM,QAAQ;EACnC,mBAAmB,OAAO,MAAM,QAAQ,SAAS;EACjD,qBAAqB,OAAO,MAAM,QAAQ,SAAS,eAAe;EAClE,CAAC;AACF,QAAO,6BAA6B,EACnC,SAAS;EACR,SAAS,OAAO;EAChB,WAAW,cAAc;EACzB,aAAa,cAAc;EAC3B,EACD,CAAC,CAAC,KAAK,MAAM,aAAa,qBAAqB,OAAO,UAAU,OAAO,YAAY,CAAC,CAAC;;;;AAKvF,MAAa,6BAA6B,WAIzC,8BAA8B,CAAC,KAC9B,MAAM,aAAa,qBAAqB,OAAO,UAAU,OAAO,YAAY,CAAC,CAC7E"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { readStackEngine } from "../../api/define-devstack.mjs";
|
|
2
|
+
import { CliConfigInvalidError, CliConfigNotFoundError } from "../../surfaces/cli/errors.mjs";
|
|
3
|
+
import "../../surfaces/cli/index.mjs";
|
|
4
|
+
import { Effect } from "effect";
|
|
5
|
+
import { existsSync } from "node:fs";
|
|
6
|
+
import { isAbsolute, resolve } from "node:path";
|
|
7
|
+
import { pathToFileURL } from "node:url";
|
|
8
|
+
//#region src/cli/wirings/config-loader.ts
|
|
9
|
+
const DEFAULT_CONFIG_PATH = "./devstack.config.ts";
|
|
10
|
+
/** Resolve a `--config <path>` argument to an absolute path, falling
|
|
11
|
+
* through to a parent-directory search when the default value is
|
|
12
|
+
* used. Returns `null` when no candidate exists. */
|
|
13
|
+
const resolveConfigPath = (configPath) => {
|
|
14
|
+
const target = configPath ?? "./devstack.config.ts";
|
|
15
|
+
const explicit = isAbsolute(target) ? target : resolve(process.cwd(), target);
|
|
16
|
+
if (existsSync(explicit)) return explicit;
|
|
17
|
+
if (configPath !== void 0 && configPath !== "./devstack.config.ts") return null;
|
|
18
|
+
let dir = process.cwd();
|
|
19
|
+
for (;;) {
|
|
20
|
+
const candidate = resolve(dir, "devstack.config.ts");
|
|
21
|
+
if (existsSync(candidate)) return candidate;
|
|
22
|
+
const parent = resolve(dir, "..");
|
|
23
|
+
if (parent === dir) return null;
|
|
24
|
+
dir = parent;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const validateStackModule = (resolvedConfigPath, mod) => {
|
|
28
|
+
const def = mod.default;
|
|
29
|
+
if (def === null || typeof def !== "object" || def._tag !== "Stack") throw new CliConfigInvalidError({ message: `config at ${resolvedConfigPath} does not default-export a Stack value (got _tag=${String(def?._tag)})` });
|
|
30
|
+
let stack;
|
|
31
|
+
try {
|
|
32
|
+
stack = readStackEngine(def);
|
|
33
|
+
} catch (cause) {
|
|
34
|
+
throw new CliConfigInvalidError({ message: `config at ${resolvedConfigPath} default-exported an invalid Stack handle: ${cause instanceof Error ? cause.message : String(cause)}` });
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
stack,
|
|
38
|
+
resolvedConfigPath
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
const makeConfigLoader = () => ({ load: (configPath) => Effect.gen(function* () {
|
|
42
|
+
const abs = resolveConfigPath(configPath);
|
|
43
|
+
if (abs === null) {
|
|
44
|
+
const attempted = configPath !== void 0 ? resolve(process.cwd(), configPath) : resolve(process.cwd(), DEFAULT_CONFIG_PATH);
|
|
45
|
+
return yield* Effect.fail(new CliConfigNotFoundError({
|
|
46
|
+
message: `devstack config not found at ${attempted}`,
|
|
47
|
+
searchedPaths: [attempted]
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
const url = pathToFileURL(abs).href;
|
|
51
|
+
const mod = yield* Effect.tryPromise({
|
|
52
|
+
try: () => import(url),
|
|
53
|
+
catch: (cause) => new CliConfigInvalidError({
|
|
54
|
+
message: `failed to import ${abs}: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
55
|
+
cause
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
return yield* Effect.try({
|
|
59
|
+
try: () => validateStackModule(abs, mod),
|
|
60
|
+
catch: (cause) => cause instanceof CliConfigInvalidError ? cause : new CliConfigInvalidError({
|
|
61
|
+
message: `invalid config at ${abs}`,
|
|
62
|
+
cause
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
}) });
|
|
66
|
+
//#endregion
|
|
67
|
+
export { makeConfigLoader, resolveConfigPath };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=config-loader.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loader.mjs","names":["resolvePath","m"],"sources":["../../../src/cli/wirings/config-loader.ts"],"sourcesContent":["// Shared config loader consumed by every verb wiring that imports a\n// `devstack.config.ts`. Returns a `LoadedConfig` whose `stack` field\n// is the validated `SupervisedStack` value.\n\nimport { existsSync } from 'node:fs';\nimport { isAbsolute, resolve as resolvePath } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\nimport { Effect } from 'effect';\n\nimport { readStackEngine, type Stack } from '../../api/define-devstack.ts';\nimport type { LoadedConfig } from '../../surfaces/cli/commands/config-loader.ts';\nimport { CliConfigInvalidError, CliConfigNotFoundError } from '../../surfaces/cli/index.ts';\nimport type { SupervisedStack } from '../../substrate/runtime/index.ts';\n\nexport const DEFAULT_CONFIG_PATH = './devstack.config.ts';\n\n/** Resolve a `--config <path>` argument to an absolute path, falling\n * through to a parent-directory search when the default value is\n * used. Returns `null` when no candidate exists. */\nexport const resolveConfigPath = (configPath: string | undefined): string | null => {\n\tconst target = configPath ?? DEFAULT_CONFIG_PATH;\n\tconst explicit = isAbsolute(target) ? target : resolvePath(process.cwd(), target);\n\tif (existsSync(explicit)) return explicit;\n\tif (configPath !== undefined && configPath !== DEFAULT_CONFIG_PATH) return null;\n\tlet dir = process.cwd();\n\tfor (;;) {\n\t\tconst candidate = resolvePath(dir, 'devstack.config.ts');\n\t\tif (existsSync(candidate)) return candidate;\n\t\tconst parent = resolvePath(dir, '..');\n\t\tif (parent === dir) return null;\n\t\tdir = parent;\n\t}\n};\n\ninterface RawConfigModule {\n\treadonly default?: unknown;\n}\n\nconst validateStackModule = (\n\tresolvedConfigPath: string,\n\tmod: unknown,\n): LoadedConfig & { readonly stack: SupervisedStack } => {\n\tconst m = mod as RawConfigModule;\n\tconst def = m.default;\n\tif (def === null || typeof def !== 'object' || (def as { _tag?: unknown })._tag !== 'Stack') {\n\t\tthrow new CliConfigInvalidError({\n\t\t\tmessage: `config at ${resolvedConfigPath} does not default-export a Stack value (got _tag=${String((def as { _tag?: unknown })?._tag)})`,\n\t\t});\n\t}\n\tlet stack: SupervisedStack;\n\ttry {\n\t\tstack = readStackEngine(def as Stack<SupervisedStack['members']>);\n\t} catch (cause) {\n\t\tthrow new CliConfigInvalidError({\n\t\t\tmessage: `config at ${resolvedConfigPath} default-exported an invalid Stack handle: ${cause instanceof Error ? cause.message : String(cause)}`,\n\t\t});\n\t}\n\treturn {\n\t\tstack,\n\t\tresolvedConfigPath,\n\t};\n};\n\nexport interface ConfigLoader {\n\treadonly load: (\n\t\tconfigPath: string | undefined,\n\t) => Effect.Effect<LoadedConfig, CliConfigNotFoundError | CliConfigInvalidError>;\n}\n\nexport const makeConfigLoader = (): ConfigLoader => ({\n\tload: (configPath) =>\n\t\tEffect.gen(function* () {\n\t\t\tconst abs = resolveConfigPath(configPath);\n\t\t\tif (abs === null) {\n\t\t\t\tconst attempted =\n\t\t\t\t\tconfigPath !== undefined\n\t\t\t\t\t\t? resolvePath(process.cwd(), configPath)\n\t\t\t\t\t\t: resolvePath(process.cwd(), DEFAULT_CONFIG_PATH);\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\tnew CliConfigNotFoundError({\n\t\t\t\t\t\tmessage: `devstack config not found at ${attempted}`,\n\t\t\t\t\t\tsearchedPaths: [attempted],\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst url = pathToFileURL(abs).href;\n\t\t\tconst mod = yield* Effect.tryPromise({\n\t\t\t\ttry: () => import(url) as Promise<unknown>,\n\t\t\t\tcatch: (cause) =>\n\t\t\t\t\tnew CliConfigInvalidError({\n\t\t\t\t\t\tmessage: `failed to import ${abs}: ${cause instanceof Error ? cause.message : String(cause)}`,\n\t\t\t\t\t\tcause,\n\t\t\t\t\t}),\n\t\t\t});\n\t\t\treturn yield* Effect.try({\n\t\t\t\ttry: () => validateStackModule(abs, mod),\n\t\t\t\tcatch: (cause) =>\n\t\t\t\t\tcause instanceof CliConfigInvalidError\n\t\t\t\t\t\t? cause\n\t\t\t\t\t\t: new CliConfigInvalidError({\n\t\t\t\t\t\t\t\tmessage: `invalid config at ${abs}`,\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t});\n\t\t}) as Effect.Effect<LoadedConfig, CliConfigNotFoundError | CliConfigInvalidError>,\n});\n"],"mappings":";;;;;;;;AAeA,MAAa,sBAAsB;;;;AAKnC,MAAa,qBAAqB,eAAkD;CACnF,MAAM,SAAS,cAAA;CACf,MAAM,WAAW,WAAW,OAAO,GAAG,SAASA,QAAY,QAAQ,KAAK,EAAE,OAAO;AACjF,KAAI,WAAW,SAAS,CAAE,QAAO;AACjC,KAAI,eAAe,KAAA,KAAa,eAAA,uBAAoC,QAAO;CAC3E,IAAI,MAAM,QAAQ,KAAK;AACvB,UAAS;EACR,MAAM,YAAYA,QAAY,KAAK,qBAAqB;AACxD,MAAI,WAAW,UAAU,CAAE,QAAO;EAClC,MAAM,SAASA,QAAY,KAAK,KAAK;AACrC,MAAI,WAAW,IAAK,QAAO;AAC3B,QAAM;;;AAQR,MAAM,uBACL,oBACA,QACwD;CAExD,MAAM,MAAMC,IAAE;AACd,KAAI,QAAQ,QAAQ,OAAO,QAAQ,YAAa,IAA2B,SAAS,QACnF,OAAM,IAAI,sBAAsB,EAC/B,SAAS,aAAa,mBAAmB,mDAAmD,OAAQ,KAA4B,KAAK,CAAC,IACtI,CAAC;CAEH,IAAI;AACJ,KAAI;AACH,UAAQ,gBAAgB,IAAyC;UACzD,OAAO;AACf,QAAM,IAAI,sBAAsB,EAC/B,SAAS,aAAa,mBAAmB,6CAA6C,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,IAC5I,CAAC;;AAEH,QAAO;EACN;EACA;EACA;;AASF,MAAa,0BAAwC,EACpD,OAAO,eACN,OAAO,IAAI,aAAa;CACvB,MAAM,MAAM,kBAAkB,WAAW;AACzC,KAAI,QAAQ,MAAM;EACjB,MAAM,YACL,eAAe,KAAA,IACZD,QAAY,QAAQ,KAAK,EAAE,WAAW,GACtCA,QAAY,QAAQ,KAAK,EAAE,oBAAoB;AACnD,SAAO,OAAO,OAAO,KACpB,IAAI,uBAAuB;GAC1B,SAAS,gCAAgC;GACzC,eAAe,CAAC,UAAU;GAC1B,CAAC,CACF;;CAEF,MAAM,MAAM,cAAc,IAAI,CAAC;CAC/B,MAAM,MAAM,OAAO,OAAO,WAAW;EACpC,WAAW,OAAO;EAClB,QAAQ,UACP,IAAI,sBAAsB;GACzB,SAAS,oBAAoB,IAAI,IAAI,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;GAC3F;GACA,CAAC;EACH,CAAC;AACF,QAAO,OAAO,OAAO,IAAI;EACxB,WAAW,oBAAoB,KAAK,IAAI;EACxC,QAAQ,UACP,iBAAiB,wBACd,QACA,IAAI,sBAAsB;GAC1B,SAAS,qBAAqB;GAC9B;GACA,CAAC;EACL,CAAC;EACD,EACH"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/cli/wirings/engine-command.ts
|
|
2
|
+
const hasString = (value, key) => typeof value[key] === "string";
|
|
3
|
+
const isEngineCommand = (value) => {
|
|
4
|
+
if (typeof value !== "object" || value === null) return false;
|
|
5
|
+
const record = value;
|
|
6
|
+
const tag = record.tag;
|
|
7
|
+
if (typeof tag !== "string") return false;
|
|
8
|
+
switch (tag) {
|
|
9
|
+
case "stack.start":
|
|
10
|
+
case "stack.stop":
|
|
11
|
+
case "stack.restart":
|
|
12
|
+
case "codegen.requested":
|
|
13
|
+
case "snapshot.list":
|
|
14
|
+
case "wipe.requested":
|
|
15
|
+
case "prune.requested":
|
|
16
|
+
case "shutdown.requested": return true;
|
|
17
|
+
case "snapshot.restore":
|
|
18
|
+
case "snapshot.delete": return hasString(record, "snapshotId");
|
|
19
|
+
case "advance-clock.requested": return typeof record.toMillis === "number";
|
|
20
|
+
case "shutdown.hardKillRequested": return (record.signal === "SIGINT" || record.signal === "SIGTERM") && typeof record.exitCode === "number" && typeof record.at === "number";
|
|
21
|
+
case "selective-restart.requested": return hasString(record, "pluginKey");
|
|
22
|
+
case "apply.requested": return record.pluginKey === void 0 || typeof record.pluginKey === "string";
|
|
23
|
+
case "snapshot.capture": return (record.snapshotId === void 0 || typeof record.snapshotId === "string") && (record.name === void 0 || typeof record.name === "string");
|
|
24
|
+
default: return false;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { isEngineCommand };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=engine-command.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-command.mjs","names":["knownTag"],"sources":["../../../src/cli/wirings/engine-command.ts"],"sourcesContent":["// Type guard for `EngineCommand` records arriving over the\n// cross-process command channel. Exhaustive switch over the union's\n// tag — a new variant added without a corresponding case here fails\n// typecheck on the `_exhaustive: never` proof so we never drift.\n\nimport type { EngineCommand } from '../../substrate/events.ts';\n\nconst hasString = (value: Record<string, unknown>, key: string): boolean =>\n\ttypeof value[key] === 'string';\n\nexport const isEngineCommand = (value: unknown): value is EngineCommand => {\n\tif (typeof value !== 'object' || value === null) return false;\n\tconst record = value as Record<string, unknown>;\n\tconst tag = record.tag;\n\tif (typeof tag !== 'string') return false;\n\tconst knownTag = tag as EngineCommand['tag'];\n\tswitch (knownTag) {\n\t\tcase 'stack.start':\n\t\tcase 'stack.stop':\n\t\tcase 'stack.restart':\n\t\tcase 'codegen.requested':\n\t\tcase 'snapshot.list':\n\t\tcase 'wipe.requested':\n\t\tcase 'prune.requested':\n\t\tcase 'shutdown.requested':\n\t\t\treturn true;\n\t\tcase 'snapshot.restore':\n\t\tcase 'snapshot.delete':\n\t\t\treturn hasString(record, 'snapshotId');\n\t\tcase 'advance-clock.requested':\n\t\t\treturn typeof record.toMillis === 'number';\n\t\tcase 'shutdown.hardKillRequested':\n\t\t\treturn (\n\t\t\t\t(record.signal === 'SIGINT' || record.signal === 'SIGTERM') &&\n\t\t\t\ttypeof record.exitCode === 'number' &&\n\t\t\t\ttypeof record.at === 'number'\n\t\t\t);\n\t\tcase 'selective-restart.requested':\n\t\t\treturn hasString(record, 'pluginKey');\n\t\tcase 'apply.requested':\n\t\t\treturn record.pluginKey === undefined || typeof record.pluginKey === 'string';\n\t\tcase 'snapshot.capture':\n\t\t\treturn (\n\t\t\t\t(record.snapshotId === undefined || typeof record.snapshotId === 'string') &&\n\t\t\t\t(record.name === undefined || typeof record.name === 'string')\n\t\t\t);\n\t\tdefault: {\n\t\t\tconst _exhaustive: never = knownTag;\n\t\t\tvoid _exhaustive;\n\t\t\treturn false;\n\t\t}\n\t}\n};\n"],"mappings":";AAOA,MAAM,aAAa,OAAgC,QAClD,OAAO,MAAM,SAAS;AAEvB,MAAa,mBAAmB,UAA2C;AAC1E,KAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;CACxD,MAAM,SAAS;CACf,MAAM,MAAM,OAAO;AACnB,KAAI,OAAO,QAAQ,SAAU,QAAO;AAEpC,SAAQA,KAAR;EACC,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,qBACJ,QAAO;EACR,KAAK;EACL,KAAK,kBACJ,QAAO,UAAU,QAAQ,aAAa;EACvC,KAAK,0BACJ,QAAO,OAAO,OAAO,aAAa;EACnC,KAAK,6BACJ,SACE,OAAO,WAAW,YAAY,OAAO,WAAW,cACjD,OAAO,OAAO,aAAa,YAC3B,OAAO,OAAO,OAAO;EAEvB,KAAK,8BACJ,QAAO,UAAU,QAAQ,YAAY;EACtC,KAAK,kBACJ,QAAO,OAAO,cAAc,KAAA,KAAa,OAAO,OAAO,cAAc;EACtE,KAAK,mBACJ,SACE,OAAO,eAAe,KAAA,KAAa,OAAO,OAAO,eAAe,cAChE,OAAO,SAAS,KAAA,KAAa,OAAO,OAAO,SAAS;EAEvD,QAGC,QAAO"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { appName, chainId, stackName } from "../../substrate/brand.mjs";
|
|
2
|
+
import { CliSupervisorLiveError } from "../../surfaces/cli/errors.mjs";
|
|
3
|
+
import { probeSupervisorPresence } from "../../surfaces/cli/commands/supervisor-presence.mjs";
|
|
4
|
+
import "../../surfaces/cli/commands/index.mjs";
|
|
5
|
+
import "../../surfaces/cli/index.mjs";
|
|
6
|
+
import { Cause, Effect } from "effect";
|
|
7
|
+
import { resolve } from "node:path";
|
|
8
|
+
//#region src/cli/wirings/identity.ts
|
|
9
|
+
const stackRootFor = (runtimeRoot, stack) => resolve(runtimeRoot, "stacks", stack);
|
|
10
|
+
/** Stack-name precedence ladder, mirrored from the state-dir ladder in
|
|
11
|
+
* `main.ts` (`--state-dir` flag > `config.stateDir` > env > default):
|
|
12
|
+
*
|
|
13
|
+
* explicit `--stack` / `$DEVSTACK_STACK` (`identity.explicitStack`)
|
|
14
|
+
* > config's `defineDevstack({ stackName })` (`stack.options.stackName`)
|
|
15
|
+
* > cwd/package inference (already folded into `identity.stack`,
|
|
16
|
+
* default `'main'`).
|
|
17
|
+
*
|
|
18
|
+
* The explicit rung MUST win over a config `stackName` so an operator
|
|
19
|
+
* can run `pnpm dev` (default stack) and `pnpm test:e2e` (a `test`/`e2e`
|
|
20
|
+
* stack via `--stack`/env) against the SAME config concurrently — the
|
|
21
|
+
* two supervisors then claim distinct stack roots instead of colliding
|
|
22
|
+
* on `error: supervisor live for <app>/<stack>` (exit 40). `runStack`
|
|
23
|
+
* (`api/run-stack.ts`) already prefers its explicit option over
|
|
24
|
+
* `stack.options.stackName`; this keeps the CLI consistent with it. */
|
|
25
|
+
const effectiveStackName = (identity, stack) => identity.explicitStack ?? stack?.options.stackName ?? identity.stack;
|
|
26
|
+
const identityValueFor = (identity, stack) => ({
|
|
27
|
+
app: appName(identity.app),
|
|
28
|
+
stack: stackName(effectiveStackName(identity, stack)),
|
|
29
|
+
chain: chainId(identity.network)
|
|
30
|
+
});
|
|
31
|
+
/** When a verb loads a config whose `stackName` may differ from the
|
|
32
|
+
* effective stack, re-derive the `ResolvedIdentity` against the
|
|
33
|
+
* effective stack so the stack-root, roster file, and command channel
|
|
34
|
+
* paths all target the same stack the supervisor uses. The effective
|
|
35
|
+
* stack follows the precedence ladder documented on `effectiveStackName`
|
|
36
|
+
* (explicit flag/env > config `stackName` > inferred), so an explicit
|
|
37
|
+
* `--stack`/`$DEVSTACK_STACK` is NOT overridden by `config.stackName`. */
|
|
38
|
+
const resolvedIdentityForStack = (identity, stack) => {
|
|
39
|
+
const stackValue = effectiveStackName(identity, stack);
|
|
40
|
+
const stackRoot = stackRootFor(identity.runtimeRoot, stackValue);
|
|
41
|
+
return {
|
|
42
|
+
...identity,
|
|
43
|
+
stack: stackValue,
|
|
44
|
+
stackRoot,
|
|
45
|
+
rosterFile: resolve(stackRoot, "roster.json")
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
/** Probe the roster file; if a supervisor is live, refuse the verb
|
|
49
|
+
* with a `CliSupervisorLiveError` carrying the operator hint. */
|
|
50
|
+
const ensureNoLiveSupervisor = (identity, hint) => Effect.gen(function* () {
|
|
51
|
+
if ((yield* probeSupervisorPresence(identity.rosterFile).pipe(Effect.catch(() => Effect.succeed({
|
|
52
|
+
live: false,
|
|
53
|
+
pid: null,
|
|
54
|
+
hostname: null
|
|
55
|
+
})))).live) return yield* Effect.fail(new CliSupervisorLiveError({
|
|
56
|
+
app: identity.app,
|
|
57
|
+
stack: identity.stack,
|
|
58
|
+
hint
|
|
59
|
+
}));
|
|
60
|
+
});
|
|
61
|
+
const findCliSupervisorLiveError = (cause) => {
|
|
62
|
+
for (const reason of cause.reasons) {
|
|
63
|
+
if (!Cause.isFailReason(reason)) continue;
|
|
64
|
+
const error = reason.error;
|
|
65
|
+
if (typeof error === "object" && error !== null && error._tag === "CliSupervisorLiveError") return error;
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
};
|
|
69
|
+
//#endregion
|
|
70
|
+
export { ensureNoLiveSupervisor, findCliSupervisorLiveError, identityValueFor, resolvedIdentityForStack, stackRootFor };
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=identity.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.mjs","names":["resolvePath"],"sources":["../../../src/cli/wirings/identity.ts"],"sourcesContent":["// Shared identity types + helpers consumed by every verb wiring.\n//\n// `ResolvedIdentity` is the flat CLI-internal identity bundle (app /\n// stack / network / runtimeRoot / stackRoot) that the `main.ts` argv\n// pre-parser produces. Wirings consume it directly; they do NOT\n// re-derive identity from process.env.\n\nimport { resolve as resolvePath } from 'node:path';\n\nimport { Cause, Effect } from 'effect';\n\nimport { appName, chainId, stackName } from '../../substrate/brand.ts';\nimport type { Identity } from '../../substrate/identity.ts';\nimport type { SupervisedStack } from '../../substrate/runtime/index.ts';\nimport { CliSupervisorLiveError } from '../../surfaces/cli/index.ts';\nimport { probeSupervisorPresence } from '../../surfaces/cli/commands/index.ts';\n\nexport interface ResolvedIdentity {\n\treadonly app: string;\n\treadonly stack: string;\n\treadonly network: string;\n\treadonly runtimeRoot: string;\n\treadonly stacksRoot: string;\n\treadonly stackRoot: string;\n\treadonly rosterFile: string;\n\t/** The stack name the operator supplied EXPLICITLY via the `--stack`\n\t * flag or `$DEVSTACK_STACK` env var — `undefined` when neither was\n\t * given (i.e. `stack` above was cwd/package-inferred). Threaded from\n\t * `main.ts`'s argv pre-parser so the stack-precedence ladder below\n\t * can let an explicit flag/env beat a config-declared `stackName`. */\n\treadonly explicitStack?: string | undefined;\n}\n\nexport const stackRootFor = (runtimeRoot: string, stack: string): string =>\n\tresolvePath(runtimeRoot, 'stacks', stack);\n\n/** Stack-name precedence ladder, mirrored from the state-dir ladder in\n * `main.ts` (`--state-dir` flag > `config.stateDir` > env > default):\n *\n * explicit `--stack` / `$DEVSTACK_STACK` (`identity.explicitStack`)\n * > config's `defineDevstack({ stackName })` (`stack.options.stackName`)\n * > cwd/package inference (already folded into `identity.stack`,\n * default `'main'`).\n *\n * The explicit rung MUST win over a config `stackName` so an operator\n * can run `pnpm dev` (default stack) and `pnpm test:e2e` (a `test`/`e2e`\n * stack via `--stack`/env) against the SAME config concurrently — the\n * two supervisors then claim distinct stack roots instead of colliding\n * on `error: supervisor live for <app>/<stack>` (exit 40). `runStack`\n * (`api/run-stack.ts`) already prefers its explicit option over\n * `stack.options.stackName`; this keeps the CLI consistent with it. */\nconst effectiveStackName = (identity: ResolvedIdentity, stack?: SupervisedStack): string =>\n\tidentity.explicitStack ?? stack?.options.stackName ?? identity.stack;\n\nexport const identityValueFor = (\n\tidentity: ResolvedIdentity,\n\tstack?: SupervisedStack,\n): Identity => ({\n\tapp: appName(identity.app),\n\tstack: stackName(effectiveStackName(identity, stack)),\n\tchain: chainId(identity.network),\n});\n\n/** When a verb loads a config whose `stackName` may differ from the\n * effective stack, re-derive the `ResolvedIdentity` against the\n * effective stack so the stack-root, roster file, and command channel\n * paths all target the same stack the supervisor uses. The effective\n * stack follows the precedence ladder documented on `effectiveStackName`\n * (explicit flag/env > config `stackName` > inferred), so an explicit\n * `--stack`/`$DEVSTACK_STACK` is NOT overridden by `config.stackName`. */\nexport const resolvedIdentityForStack = (\n\tidentity: ResolvedIdentity,\n\tstack: SupervisedStack,\n): ResolvedIdentity => {\n\tconst stackValue = effectiveStackName(identity, stack);\n\tconst stackRoot = stackRootFor(identity.runtimeRoot, stackValue);\n\treturn {\n\t\t...identity,\n\t\tstack: stackValue,\n\t\tstackRoot,\n\t\trosterFile: resolvePath(stackRoot, 'roster.json'),\n\t};\n};\n\n/** Probe the roster file; if a supervisor is live, refuse the verb\n * with a `CliSupervisorLiveError` carrying the operator hint. */\nexport const ensureNoLiveSupervisor = (\n\tidentity: ResolvedIdentity,\n\thint: string,\n): Effect.Effect<void, CliSupervisorLiveError> =>\n\tEffect.gen(function* () {\n\t\tconst presence = yield* probeSupervisorPresence(identity.rosterFile).pipe(\n\t\t\tEffect.catch(() => Effect.succeed({ live: false, pid: null, hostname: null })),\n\t\t);\n\t\tif (presence.live) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tnew CliSupervisorLiveError({\n\t\t\t\t\tapp: identity.app,\n\t\t\t\t\tstack: identity.stack,\n\t\t\t\t\thint,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t});\n\nexport const findCliSupervisorLiveError = (\n\tcause: Cause.Cause<unknown>,\n): CliSupervisorLiveError | null => {\n\tfor (const reason of cause.reasons) {\n\t\tif (!Cause.isFailReason(reason)) continue;\n\t\tconst error = reason.error;\n\t\tif (\n\t\t\ttypeof error === 'object' &&\n\t\t\terror !== null &&\n\t\t\t(error as { readonly _tag?: unknown })._tag === 'CliSupervisorLiveError'\n\t\t) {\n\t\t\treturn error as CliSupervisorLiveError;\n\t\t}\n\t}\n\treturn null;\n};\n"],"mappings":";;;;;;;;AAiCA,MAAa,gBAAgB,aAAqB,UACjDA,QAAY,aAAa,UAAU,MAAM;;;;;;;;;;;;;;;;AAiB1C,MAAM,sBAAsB,UAA4B,UACvD,SAAS,iBAAiB,OAAO,QAAQ,aAAa,SAAS;AAEhE,MAAa,oBACZ,UACA,WACe;CACf,KAAK,QAAQ,SAAS,IAAI;CAC1B,OAAO,UAAU,mBAAmB,UAAU,MAAM,CAAC;CACrD,OAAO,QAAQ,SAAS,QAAQ;CAChC;;;;;;;;AASD,MAAa,4BACZ,UACA,UACsB;CACtB,MAAM,aAAa,mBAAmB,UAAU,MAAM;CACtD,MAAM,YAAY,aAAa,SAAS,aAAa,WAAW;AAChE,QAAO;EACN,GAAG;EACH,OAAO;EACP;EACA,YAAYA,QAAY,WAAW,cAAc;EACjD;;;;AAKF,MAAa,0BACZ,UACA,SAEA,OAAO,IAAI,aAAa;AAIvB,MAAI,OAHoB,wBAAwB,SAAS,WAAW,CAAC,KACpE,OAAO,YAAY,OAAO,QAAQ;EAAE,MAAM;EAAO,KAAK;EAAM,UAAU;EAAM,CAAC,CAAC,CAC9E,EACY,KACZ,QAAO,OAAO,OAAO,KACpB,IAAI,uBAAuB;EAC1B,KAAK,SAAS;EACd,OAAO,SAAS;EAChB;EACA,CAAC,CACF;EAED;AAEH,MAAa,8BACZ,UACmC;AACnC,MAAK,MAAM,UAAU,MAAM,SAAS;AACnC,MAAI,CAAC,MAAM,aAAa,OAAO,CAAE;EACjC,MAAM,QAAQ,OAAO;AACrB,MACC,OAAO,UAAU,YACjB,UAAU,QACT,MAAsC,SAAS,yBAEhD,QAAO;;AAGT,QAAO"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Effect, FileSystem } from "effect";
|
|
2
|
+
//#region src/cli/wirings/provide-file-system.ts
|
|
3
|
+
const provideFileSystem = (fs, effect) => effect.pipe(Effect.provideService(FileSystem.FileSystem, fs));
|
|
4
|
+
//#endregion
|
|
5
|
+
export { provideFileSystem };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=provide-file-system.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provide-file-system.mjs","names":[],"sources":["../../../src/cli/wirings/provide-file-system.ts"],"sourcesContent":["// Shared `provideFileSystem` helper for verb wirings.\n//\n// Several wirings (`up`, `snapshot`, `wipe`) hoist a `FileSystem.FileSystem`\n// out of an enclosing Effect and re-thread it into sub-Effects that depend\n// on it. Factor the one-liner so we don't drift on signature/import (and so\n// later changes — e.g. tagging the call site with a span — happen in one\n// place).\n\nimport { Effect, FileSystem } from 'effect';\n\nexport const provideFileSystem = <A, E, R>(\n\tfs: FileSystem.FileSystem,\n\teffect: Effect.Effect<A, E, R | FileSystem.FileSystem>,\n): Effect.Effect<A, E, Exclude<R, FileSystem.FileSystem>> =>\n\teffect.pipe(Effect.provideService(FileSystem.FileSystem, fs)) as Effect.Effect<\n\t\tA,\n\t\tE,\n\t\tExclude<R, FileSystem.FileSystem>\n\t>;\n"],"mappings":";;AAUA,MAAa,qBACZ,IACA,WAEA,OAAO,KAAK,OAAO,eAAe,WAAW,YAAY,GAAG,CAAC"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { StackPathsService } from "../../substrate/runtime/paths.mjs";
|
|
2
|
+
import { makeProjectionRef } from "../../substrate/runtime/projection/state-ref.mjs";
|
|
3
|
+
import { writeProjectionSnapshot } from "../../substrate/runtime/projection/persisted.mjs";
|
|
4
|
+
import { commandChannelPaths, makeCommandChannelPublisher } from "../../substrate/runtime/cross-process/command-channel/channel.mjs";
|
|
5
|
+
import { mintRandomSuffix } from "../../substrate/runtime/random-suffix.mjs";
|
|
6
|
+
import { SnapshotOrchestratorService } from "../../orchestrators/snapshot/service.mjs";
|
|
7
|
+
import "../../substrate/runtime/index.mjs";
|
|
8
|
+
import { superviseStackEffect } from "../../orchestrators/run.mjs";
|
|
9
|
+
import { captureSnapshot } from "../../orchestrators/snapshot/capture-command.mjs";
|
|
10
|
+
import "../../orchestrators/snapshot/index.mjs";
|
|
11
|
+
import { buildProductionOrchestratorSinks, buildProductionPostAcquireHook } from "../../orchestrators/runtime-composition.mjs";
|
|
12
|
+
import { extendBuiltInPluginContext, layerBuiltInPluginRuntime } from "../../orchestrators/built-in-plugin-layers.mjs";
|
|
13
|
+
import { CliInternalError, CliUnavailableError } from "../../surfaces/cli/errors.mjs";
|
|
14
|
+
import { probeSupervisorPresence } from "../../surfaces/cli/commands/supervisor-presence.mjs";
|
|
15
|
+
import "../../surfaces/cli/commands/index.mjs";
|
|
16
|
+
import "../../surfaces/cli/index.mjs";
|
|
17
|
+
import { makeConfigLoader, resolveConfigPath } from "./config-loader.mjs";
|
|
18
|
+
import { ensureNoLiveSupervisor, identityValueFor, resolvedIdentityForStack } from "./identity.mjs";
|
|
19
|
+
import { buildDirectSnapshotLayers, buildVerbLayers } from "./build-verb-layers.mjs";
|
|
20
|
+
import { provideFileSystem } from "./provide-file-system.mjs";
|
|
21
|
+
import { Effect, Exit, FileSystem, Logger, SubscriptionRef } from "effect";
|
|
22
|
+
import { dirname } from "node:path";
|
|
23
|
+
//#region src/cli/wirings/snapshot.ts
|
|
24
|
+
const LIVE_SNAPSHOT_CAPTURE_TIMEOUT_MILLIS = 3600 * 1e3;
|
|
25
|
+
const mintCliSnapshotId = () => `snap-${Date.now()}-${mintRandomSuffix(8)}`;
|
|
26
|
+
const isCapturePayload = (value) => {
|
|
27
|
+
if (typeof value !== "object" || value === null) return false;
|
|
28
|
+
const kind = value.kind;
|
|
29
|
+
return kind === "captured" || kind === "failed" || kind === "skipped";
|
|
30
|
+
};
|
|
31
|
+
/** Publish `snapshot.capture` to a live supervisor and surface its
|
|
32
|
+
* structured ack/error payload. The reply payload carries the
|
|
33
|
+
* captured metadata (success) or failure summary (failure) — no
|
|
34
|
+
* side-channel event tail required. Returns `null` if no supervisor
|
|
35
|
+
* is live so the caller can fall through to the direct path. */
|
|
36
|
+
const runSnapshotCaptureAgainstLiveSupervisor = (identity, args) => Effect.gen(function* () {
|
|
37
|
+
if (!(yield* probeSupervisorPresence(identity.rosterFile).pipe(Effect.catch(() => Effect.succeed({
|
|
38
|
+
live: false,
|
|
39
|
+
pid: null,
|
|
40
|
+
hostname: null
|
|
41
|
+
})))).live) return null;
|
|
42
|
+
const snapshotId = args.snapshotId ?? mintCliSnapshotId();
|
|
43
|
+
return yield* Effect.scoped(Effect.gen(function* () {
|
|
44
|
+
const publisher = yield* makeCommandChannelPublisher(commandChannelPaths(identity.stackRoot));
|
|
45
|
+
const published = yield* publisher.publish({
|
|
46
|
+
tag: "snapshot.capture",
|
|
47
|
+
snapshotId,
|
|
48
|
+
...args.name === void 0 ? {} : { name: args.name }
|
|
49
|
+
});
|
|
50
|
+
const reply = yield* publisher.awaitCompletion(published, { timeoutMillis: LIVE_SNAPSHOT_CAPTURE_TIMEOUT_MILLIS });
|
|
51
|
+
if (reply.ok) {
|
|
52
|
+
const payload = isCapturePayload(reply.payload) ? reply.payload : null;
|
|
53
|
+
if (payload?.kind === "captured" && typeof payload.snapshotId === "string") return {
|
|
54
|
+
snapshotId: payload.snapshotId,
|
|
55
|
+
name: payload.name ?? args.name ?? payload.snapshotId
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
snapshotId,
|
|
59
|
+
name: args.name ?? snapshotId
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const payload = isCapturePayload(reply.payload) ? reply.payload : null;
|
|
63
|
+
if (payload?.kind === "skipped") return yield* Effect.fail(new CliUnavailableError({
|
|
64
|
+
service: "snapshot capture",
|
|
65
|
+
message: "another snapshot capture is already running",
|
|
66
|
+
hint: "wait for the current snapshot to finish and try again"
|
|
67
|
+
}));
|
|
68
|
+
if (payload?.kind === "failed") return yield* Effect.fail(new CliInternalError({ message: `snapshot capture failed: ${payload.summary ?? reply.message}` }));
|
|
69
|
+
if (/already running/i.test(reply.message)) return yield* Effect.fail(new CliUnavailableError({
|
|
70
|
+
service: "snapshot capture",
|
|
71
|
+
message: "another snapshot capture is already running",
|
|
72
|
+
hint: "wait for the current snapshot to finish and try again"
|
|
73
|
+
}));
|
|
74
|
+
return yield* Effect.fail(new CliUnavailableError({
|
|
75
|
+
service: "devstack supervisor",
|
|
76
|
+
message: reply.message,
|
|
77
|
+
hint: "check the attached `devstack up` session and try again"
|
|
78
|
+
}));
|
|
79
|
+
}));
|
|
80
|
+
});
|
|
81
|
+
const snapshotIdentityParticipants = (meta) => Object.entries(meta.identity).map(([plugin, value]) => ({
|
|
82
|
+
plugin,
|
|
83
|
+
liveIdentity: Effect.succeed({ [plugin]: value })
|
|
84
|
+
}));
|
|
85
|
+
const runSnapshotRestoreDirect = (identity, snapshotId) => {
|
|
86
|
+
const restored = Effect.gen(function* () {
|
|
87
|
+
const snapshot = yield* SnapshotOrchestratorService;
|
|
88
|
+
const fs = yield* FileSystem.FileSystem;
|
|
89
|
+
const meta = (yield* provideFileSystem(fs, snapshot.list)).find((entry) => entry.id === snapshotId)?.metadata ?? null;
|
|
90
|
+
const participants = meta === null ? [] : snapshotIdentityParticipants(meta);
|
|
91
|
+
yield* provideFileSystem(fs, snapshot.restore({
|
|
92
|
+
id: snapshotId,
|
|
93
|
+
participants
|
|
94
|
+
}));
|
|
95
|
+
}).pipe(Effect.provide(buildDirectSnapshotLayers({
|
|
96
|
+
identity: identityValueFor(identity),
|
|
97
|
+
runtimeRoot: identity.runtimeRoot
|
|
98
|
+
})), Effect.provide(Logger.layer([Logger.consolePretty()])));
|
|
99
|
+
return ensureNoLiveSupervisor(identity, "shut down the attached `devstack up` session before restoring a snapshot").pipe(Effect.andThen(restored));
|
|
100
|
+
};
|
|
101
|
+
const runSnapshotDeleteDirect = (identity, snapshotId) => {
|
|
102
|
+
return Effect.gen(function* () {
|
|
103
|
+
const snapshot = yield* SnapshotOrchestratorService;
|
|
104
|
+
yield* provideFileSystem(yield* FileSystem.FileSystem, snapshot.delete(snapshotId));
|
|
105
|
+
}).pipe(Effect.provide(buildDirectSnapshotLayers({
|
|
106
|
+
identity: identityValueFor(identity),
|
|
107
|
+
runtimeRoot: identity.runtimeRoot
|
|
108
|
+
})), Effect.provide(Logger.layer([Logger.consolePretty()])));
|
|
109
|
+
};
|
|
110
|
+
const runSnapshotCaptureDirect = (identity, args) => {
|
|
111
|
+
const loader = makeConfigLoader();
|
|
112
|
+
return Effect.gen(function* () {
|
|
113
|
+
return yield* runSnapshotCaptureDirectLoaded(identity, yield* loader.load(args.configPath), args);
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
const runSnapshotCaptureDirectLoaded = (identity, loaded, args) => Effect.gen(function* () {
|
|
117
|
+
const stack = loaded.stack;
|
|
118
|
+
const effectiveIdentity = resolvedIdentityForStack(identity, stack);
|
|
119
|
+
const identityValue = identityValueFor(effectiveIdentity);
|
|
120
|
+
const substrateLayers = buildVerbLayers({
|
|
121
|
+
identity: identityValue,
|
|
122
|
+
stack,
|
|
123
|
+
appRoot: dirname(loaded.resolvedConfigPath),
|
|
124
|
+
runtimeRoot: effectiveIdentity.runtimeRoot
|
|
125
|
+
});
|
|
126
|
+
const program = Effect.gen(function* () {
|
|
127
|
+
const state = yield* makeProjectionRef();
|
|
128
|
+
const orchestratorSinks = yield* buildProductionOrchestratorSinks();
|
|
129
|
+
const postAcquireHook = yield* buildProductionPostAcquireHook({ extras: stack.options.extras });
|
|
130
|
+
let captureExit = Exit.succeed(void 0);
|
|
131
|
+
const capturedMeta = { current: null };
|
|
132
|
+
yield* superviseStackEffect({
|
|
133
|
+
_tag: "Stack",
|
|
134
|
+
members: stack.members,
|
|
135
|
+
options: stack.options
|
|
136
|
+
}, identityValue, state, {
|
|
137
|
+
orchestratorSinks,
|
|
138
|
+
postAcquireHook,
|
|
139
|
+
lifetime: "one-shot",
|
|
140
|
+
extendContext: extendBuiltInPluginContext,
|
|
141
|
+
withinScope: () => captureSnapshot({
|
|
142
|
+
snapshotId: args.snapshotId,
|
|
143
|
+
name: args.name
|
|
144
|
+
}).pipe(Effect.tap((meta) => Effect.sync(() => {
|
|
145
|
+
capturedMeta.current = meta;
|
|
146
|
+
})), Effect.asVoid, Effect.exit, Effect.tap((exit) => Effect.sync(() => {
|
|
147
|
+
captureExit = exit;
|
|
148
|
+
})), Effect.asVoid)
|
|
149
|
+
}).pipe(Effect.provide(layerBuiltInPluginRuntime(orchestratorSinks)));
|
|
150
|
+
if (Exit.isFailure(captureExit)) yield* Effect.failCause(captureExit.cause);
|
|
151
|
+
if (capturedMeta.current === null) return yield* Effect.die("snapshot capture completed without metadata");
|
|
152
|
+
const meta = capturedMeta.current;
|
|
153
|
+
yield* writeProjectionSnapshot((yield* StackPathsService).stackRoot, yield* SubscriptionRef.get(state));
|
|
154
|
+
return {
|
|
155
|
+
snapshotId: meta.id,
|
|
156
|
+
name: meta.label ?? meta.id
|
|
157
|
+
};
|
|
158
|
+
});
|
|
159
|
+
return yield* ensureNoLiveSupervisor(effectiveIdentity, "shut down the attached `devstack up` session before saving a snapshot").pipe(Effect.andThen(program.pipe(Effect.provide(substrateLayers), Effect.provide(Logger.layer([Logger.consolePretty()])))));
|
|
160
|
+
});
|
|
161
|
+
const runSnapshotCaptureLiveAware = (identity, args) => Effect.gen(function* () {
|
|
162
|
+
if (args.configPath === void 0 && resolveConfigPath(void 0) === null) {
|
|
163
|
+
const live = yield* runSnapshotCaptureAgainstLiveSupervisor(identity, args);
|
|
164
|
+
if (live !== null) return live;
|
|
165
|
+
return yield* runSnapshotCaptureDirect(identity, args);
|
|
166
|
+
}
|
|
167
|
+
const loaded = yield* makeConfigLoader().load(args.configPath);
|
|
168
|
+
const stack = loaded.stack;
|
|
169
|
+
const effectiveIdentity = resolvedIdentityForStack(identity, stack);
|
|
170
|
+
const live = yield* runSnapshotCaptureAgainstLiveSupervisor(effectiveIdentity, args);
|
|
171
|
+
if (live !== null) return live;
|
|
172
|
+
return yield* runSnapshotCaptureDirectLoaded(effectiveIdentity, loaded, args);
|
|
173
|
+
});
|
|
174
|
+
//#endregion
|
|
175
|
+
export { runSnapshotCaptureLiveAware, runSnapshotDeleteDirect, runSnapshotRestoreDirect };
|
|
176
|
+
|
|
177
|
+
//# sourceMappingURL=snapshot.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.mjs","names":[],"sources":["../../../src/cli/wirings/snapshot.ts"],"sourcesContent":["// `devstack snapshot save / restore / delete` verb wirings.\n//\n// `save` is live-aware: when a supervisor owns the stack, publish a\n// `snapshot.capture` command and read the structured result from the\n// command-channel reply payload (no tail-fiber). `restore` and\n// `delete` are direct/offline only; they refuse to run when a\n// supervisor is live.\n\nimport { dirname } from 'node:path';\n\nimport { Effect, Exit, FileSystem, Logger, SubscriptionRef } from 'effect';\n\nimport type { Identity } from '../../substrate/identity.ts';\nimport { StackPathsService } from '../../substrate/runtime/paths.ts';\nimport { mintRandomSuffix } from '../../substrate/runtime/random-suffix.ts';\nimport {\n\tcommandChannelPaths,\n\tmakeCommandChannelPublisher,\n\tmakeProjectionRef,\n\ttype SupervisedStack,\n\twriteProjectionSnapshot,\n} from '../../substrate/runtime/index.ts';\nimport { superviseStackEffect } from '../../orchestrators/run.ts';\nimport {\n\tbuildProductionOrchestratorSinks,\n\tbuildProductionPostAcquireHook,\n} from '../../orchestrators/runtime-composition.ts';\nimport {\n\textendBuiltInPluginContext,\n\tlayerBuiltInPluginRuntime,\n} from '../../orchestrators/built-in-plugin-layers.ts';\nimport {\n\tcaptureSnapshot,\n\tSnapshotOrchestratorService,\n\ttype RestoreParticipant,\n\ttype SnapshotMetadata,\n} from '../../orchestrators/snapshot/index.ts';\nimport {\n\tCliInternalError,\n\tCliUnavailableError,\n} from '../../surfaces/cli/index.ts';\nimport { probeSupervisorPresence } from '../../surfaces/cli/commands/index.ts';\nimport type { LoadedConfig } from '../../surfaces/cli/commands/config-loader.ts';\n\nimport { makeConfigLoader, resolveConfigPath } from './config-loader.ts';\nimport {\n\tensureNoLiveSupervisor,\n\tidentityValueFor,\n\tresolvedIdentityForStack,\n\ttype ResolvedIdentity,\n} from './identity.ts';\nimport { buildDirectSnapshotLayers, buildVerbLayers } from './build-verb-layers.ts';\nimport { provideFileSystem } from './provide-file-system.ts';\n\nconst LIVE_SNAPSHOT_CAPTURE_TIMEOUT_MILLIS = 60 * 60 * 1000;\n\nconst mintCliSnapshotId = (): string => `snap-${Date.now()}-${mintRandomSuffix(8)}`;\n\n/** Structured payload that the supervisor's command-channel bridge\n * attaches to the ack/error reply for `snapshot.capture`. Mirrors the\n * shape produced by `cli/wirings/up.ts:snapshotCaptureAckFromEvent`. */\ninterface SnapshotCaptureAckPayload {\n\treadonly kind: 'captured' | 'failed' | 'skipped';\n\treadonly snapshotId?: string;\n\treadonly name?: string;\n\treadonly summary?: string;\n\treadonly reason?: string;\n}\n\nconst isCapturePayload = (value: unknown): value is SnapshotCaptureAckPayload => {\n\tif (typeof value !== 'object' || value === null) return false;\n\tconst kind = (value as { readonly kind?: unknown }).kind;\n\treturn kind === 'captured' || kind === 'failed' || kind === 'skipped';\n};\n\n/** Publish `snapshot.capture` to a live supervisor and surface its\n * structured ack/error payload. The reply payload carries the\n * captured metadata (success) or failure summary (failure) — no\n * side-channel event tail required. Returns `null` if no supervisor\n * is live so the caller can fall through to the direct path. */\nexport const runSnapshotCaptureAgainstLiveSupervisor = (\n\tidentity: ResolvedIdentity,\n\targs: { readonly snapshotId?: string; readonly name?: string },\n): Effect.Effect<{ readonly snapshotId: string; readonly name: string } | null, unknown> =>\n\tEffect.gen(function* () {\n\t\tconst presence = yield* probeSupervisorPresence(identity.rosterFile).pipe(\n\t\t\tEffect.catch(() => Effect.succeed({ live: false, pid: null, hostname: null })),\n\t\t);\n\t\tif (!presence.live) return null;\n\n\t\tconst snapshotId = args.snapshotId ?? mintCliSnapshotId();\n\t\treturn yield* Effect.scoped(\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst publisher = yield* makeCommandChannelPublisher(\n\t\t\t\t\tcommandChannelPaths(identity.stackRoot),\n\t\t\t\t);\n\t\t\t\tconst published = yield* publisher.publish({\n\t\t\t\t\ttag: 'snapshot.capture',\n\t\t\t\t\tsnapshotId,\n\t\t\t\t\t...(args.name === undefined ? {} : { name: args.name }),\n\t\t\t\t});\n\t\t\t\tconst reply = yield* publisher.awaitCompletion(published, {\n\t\t\t\t\ttimeoutMillis: LIVE_SNAPSHOT_CAPTURE_TIMEOUT_MILLIS,\n\t\t\t\t});\n\n\t\t\t\tif (reply.ok) {\n\t\t\t\t\tconst payload = isCapturePayload(reply.payload) ? reply.payload : null;\n\t\t\t\t\tif (payload?.kind === 'captured' && typeof payload.snapshotId === 'string') {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tsnapshotId: payload.snapshotId,\n\t\t\t\t\t\t\tname: payload.name ?? args.name ?? payload.snapshotId,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\t// Older supervisor without structured payload (or a peer mock\n\t\t\t\t\t// in tests): synthesize from the request — the supervisor\n\t\t\t\t\t// already accepted our snapshotId, so it's authoritative.\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsnapshotId,\n\t\t\t\t\t\tname: args.name ?? snapshotId,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst payload = isCapturePayload(reply.payload) ? reply.payload : null;\n\t\t\t\tif (payload?.kind === 'skipped') {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tnew CliUnavailableError({\n\t\t\t\t\t\t\tservice: 'snapshot capture',\n\t\t\t\t\t\t\tmessage: 'another snapshot capture is already running',\n\t\t\t\t\t\t\thint: 'wait for the current snapshot to finish and try again',\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (payload?.kind === 'failed') {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tnew CliInternalError({\n\t\t\t\t\t\t\tmessage: `snapshot capture failed: ${payload.summary ?? reply.message}`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// No structured payload — surface the raw reply.message.\n\t\t\t\tif (/already running/i.test(reply.message)) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tnew CliUnavailableError({\n\t\t\t\t\t\t\tservice: 'snapshot capture',\n\t\t\t\t\t\t\tmessage: 'another snapshot capture is already running',\n\t\t\t\t\t\t\thint: 'wait for the current snapshot to finish and try again',\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\tnew CliUnavailableError({\n\t\t\t\t\t\tservice: 'devstack supervisor',\n\t\t\t\t\t\tmessage: reply.message,\n\t\t\t\t\t\thint: 'check the attached `devstack up` session and try again',\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}),\n\t\t);\n\t});\n\nconst snapshotIdentityParticipants = (\n\tmeta: SnapshotMetadata,\n): ReadonlyArray<RestoreParticipant> =>\n\tObject.entries(meta.identity).map(([plugin, value]) => ({\n\t\tplugin,\n\t\tliveIdentity: Effect.succeed({ [plugin]: value }),\n\t}));\n\nexport const runSnapshotRestoreDirect = (\n\tidentity: ResolvedIdentity,\n\tsnapshotId: string,\n): Effect.Effect<void, unknown> => {\n\tconst program = Effect.gen(function* () {\n\t\tconst snapshot = yield* SnapshotOrchestratorService;\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst entries = yield* provideFileSystem(fs, snapshot.list);\n\t\tconst meta = entries.find((entry) => entry.id === snapshotId)?.metadata ?? null;\n\t\tconst participants = meta === null ? [] : snapshotIdentityParticipants(meta);\n\t\tyield* provideFileSystem(fs, snapshot.restore({ id: snapshotId, participants }));\n\t});\n\tconst restored = program.pipe(\n\t\tEffect.provide(\n\t\t\tbuildDirectSnapshotLayers({\n\t\t\t\tidentity: identityValueFor(identity),\n\t\t\t\truntimeRoot: identity.runtimeRoot,\n\t\t\t}),\n\t\t),\n\t\tEffect.provide(Logger.layer([Logger.consolePretty()])),\n\t);\n\treturn ensureNoLiveSupervisor(\n\t\tidentity,\n\t\t'shut down the attached `devstack up` session before restoring a snapshot',\n\t).pipe(Effect.andThen(restored));\n};\n\nexport const runSnapshotDeleteDirect = (\n\tidentity: ResolvedIdentity,\n\tsnapshotId: string,\n): Effect.Effect<void, unknown> => {\n\tconst program = Effect.gen(function* () {\n\t\tconst snapshot = yield* SnapshotOrchestratorService;\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tyield* provideFileSystem(fs, snapshot.delete(snapshotId));\n\t});\n\treturn program.pipe(\n\t\tEffect.provide(\n\t\t\tbuildDirectSnapshotLayers({\n\t\t\t\tidentity: identityValueFor(identity),\n\t\t\t\truntimeRoot: identity.runtimeRoot,\n\t\t\t}),\n\t\t),\n\t\tEffect.provide(Logger.layer([Logger.consolePretty()])),\n\t);\n};\n\nconst runSnapshotCaptureDirect = (\n\tidentity: ResolvedIdentity,\n\targs: { readonly snapshotId?: string; readonly name?: string; readonly configPath?: string },\n): Effect.Effect<{ readonly snapshotId: string; readonly name: string }, unknown> => {\n\tconst loader = makeConfigLoader();\n\treturn Effect.gen(function* () {\n\t\tconst loaded = yield* loader.load(args.configPath);\n\t\treturn yield* runSnapshotCaptureDirectLoaded(identity, loaded, args);\n\t});\n};\n\nexport const runSnapshotCaptureDirectLoaded = (\n\tidentity: ResolvedIdentity,\n\tloaded: LoadedConfig,\n\targs: { readonly snapshotId?: string; readonly name?: string },\n): Effect.Effect<{ readonly snapshotId: string; readonly name: string }, unknown> =>\n\tEffect.gen(function* () {\n\t\tconst stack = (loaded as LoadedConfig & { readonly stack: SupervisedStack }).stack;\n\t\tconst effectiveIdentity = resolvedIdentityForStack(identity, stack);\n\t\tconst identityValue: Identity = identityValueFor(effectiveIdentity);\n\t\tconst appRoot = dirname(loaded.resolvedConfigPath);\n\t\tconst substrateLayers = buildVerbLayers({\n\t\t\tidentity: identityValue,\n\t\t\tstack,\n\t\t\tappRoot,\n\t\t\truntimeRoot: effectiveIdentity.runtimeRoot,\n\t\t});\n\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst state = yield* makeProjectionRef();\n\t\t\tconst orchestratorSinks = yield* buildProductionOrchestratorSinks();\n\t\t\tconst postAcquireHook = yield* buildProductionPostAcquireHook({\n\t\t\t\textras: stack.options.extras,\n\t\t\t});\n\t\t\tlet captureExit: Exit.Exit<void, unknown> = Exit.succeed(undefined);\n\t\t\tconst capturedMeta: { current: SnapshotMetadata | null } = { current: null };\n\t\t\tyield* superviseStackEffect(\n\t\t\t\t{ _tag: 'Stack', members: stack.members, options: stack.options },\n\t\t\t\tidentityValue,\n\t\t\t\tstate,\n\t\t\t\t{\n\t\t\t\t\torchestratorSinks,\n\t\t\t\t\tpostAcquireHook,\n\t\t\t\t\tlifetime: 'one-shot',\n\t\t\t\t\textendContext: extendBuiltInPluginContext,\n\t\t\t\t\twithinScope: () =>\n\t\t\t\t\t\tcaptureSnapshot({ snapshotId: args.snapshotId, name: args.name }).pipe(\n\t\t\t\t\t\t\tEffect.tap((meta) =>\n\t\t\t\t\t\t\t\tEffect.sync(() => {\n\t\t\t\t\t\t\t\t\tcapturedMeta.current = meta;\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tEffect.asVoid,\n\t\t\t\t\t\t\tEffect.exit,\n\t\t\t\t\t\t\tEffect.tap((exit) =>\n\t\t\t\t\t\t\t\tEffect.sync(() => {\n\t\t\t\t\t\t\t\t\tcaptureExit = exit;\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tEffect.asVoid,\n\t\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t).pipe(Effect.provide(layerBuiltInPluginRuntime(orchestratorSinks)));\n\t\t\tif (Exit.isFailure(captureExit)) {\n\t\t\t\tyield* Effect.failCause(captureExit.cause);\n\t\t\t}\n\t\t\tif (capturedMeta.current === null) {\n\t\t\t\treturn yield* Effect.die('snapshot capture completed without metadata');\n\t\t\t}\n\t\t\tconst meta = capturedMeta.current;\n\t\t\tconst stackPaths = yield* StackPathsService;\n\t\t\tyield* writeProjectionSnapshot(stackPaths.stackRoot, yield* SubscriptionRef.get(state));\n\t\t\treturn { snapshotId: meta.id, name: meta.label ?? meta.id };\n\t\t});\n\n\t\treturn yield* ensureNoLiveSupervisor(\n\t\t\teffectiveIdentity,\n\t\t\t'shut down the attached `devstack up` session before saving a snapshot',\n\t\t).pipe(\n\t\t\tEffect.andThen(\n\t\t\t\tprogram.pipe(\n\t\t\t\t\tEffect.provide(substrateLayers),\n\t\t\t\t\tEffect.provide(Logger.layer([Logger.consolePretty()])),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\t});\n\nexport const runSnapshotCaptureLiveAware = (\n\tidentity: ResolvedIdentity,\n\targs: { readonly snapshotId?: string; readonly name?: string; readonly configPath?: string },\n): Effect.Effect<{ readonly snapshotId: string; readonly name: string }, unknown> =>\n\tEffect.gen(function* () {\n\t\tif (args.configPath === undefined && resolveConfigPath(undefined) === null) {\n\t\t\tconst live = yield* runSnapshotCaptureAgainstLiveSupervisor(identity, args);\n\t\t\tif (live !== null) return live;\n\t\t\treturn yield* runSnapshotCaptureDirect(identity, args);\n\t\t}\n\t\tconst loaded = yield* makeConfigLoader().load(args.configPath);\n\t\tconst stack = (loaded as LoadedConfig & { readonly stack: SupervisedStack }).stack;\n\t\tconst effectiveIdentity = resolvedIdentityForStack(identity, stack);\n\t\tconst live = yield* runSnapshotCaptureAgainstLiveSupervisor(effectiveIdentity, args);\n\t\tif (live !== null) return live;\n\t\treturn yield* runSnapshotCaptureDirectLoaded(effectiveIdentity, loaded, args);\n\t});\n"],"mappings":"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"}
|