@mysten-incubation/devstack 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dashboard-ui/assets/grpc-a4usE3Nk.js +3 -0
- package/dashboard-ui/assets/index-B82Bh84P.css +1 -0
- package/dashboard-ui/assets/index-CRYJ4pru.js +1277 -0
- package/dashboard-ui/index.html +2 -2
- package/dist/api/define-capabilities.d.mts +1 -20
- package/dist/api/define-capabilities.mjs +15 -22
- package/dist/api/define-capabilities.mjs.map +1 -1
- package/dist/api/define-devstack-with.d.mts +7 -1
- package/dist/api/define-devstack-with.mjs.map +1 -1
- package/dist/api/define-devstack.mjs.map +1 -1
- package/dist/api/define-plugin.d.mts +2 -1
- package/dist/api/inference-network.d.mts +31 -17
- package/dist/api/inference-network.mjs +40 -43
- package/dist/api/inference-network.mjs.map +1 -1
- package/dist/api/load-config.mjs +88 -0
- package/dist/api/load-config.mjs.map +1 -0
- package/dist/api/mode-narrowed-factory.d.mts +1 -1
- package/dist/api/mode-narrowed-factory.mjs.map +1 -1
- package/dist/api/run-stack-internal.mjs +202 -0
- package/dist/api/run-stack-internal.mjs.map +1 -0
- package/dist/api/run-stack.d.mts +82 -31
- package/dist/api/run-stack.mjs +22 -141
- package/dist/api/run-stack.mjs.map +1 -1
- package/dist/build-integrations/dapp-kit/index.d.mts +61 -0
- package/dist/build-integrations/dapp-kit/index.mjs +58 -0
- package/dist/build-integrations/dapp-kit/index.mjs.map +1 -0
- package/dist/build-integrations/playwright/config.d.mts +1 -30
- package/dist/build-integrations/playwright/config.mjs +1 -27
- package/dist/build-integrations/playwright/config.mjs.map +1 -1
- package/dist/build-integrations/playwright/errors.d.mts +4 -7
- package/dist/build-integrations/playwright/errors.mjs.map +1 -1
- package/dist/build-integrations/playwright/global-setup.d.mts +42 -71
- package/dist/build-integrations/playwright/global-setup.mjs +142 -218
- package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
- package/dist/build-integrations/playwright/index.d.mts +2 -2
- package/dist/build-integrations/playwright/index.mjs +2 -2
- package/dist/build-integrations/playwright/stack-context.d.mts +3 -1
- package/dist/build-integrations/playwright/stack-context.mjs +4 -2
- package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
- package/dist/build-integrations/playwright/wallet-context.mjs +44 -19
- package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
- package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
- package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -1
- package/dist/build-integrations/runtime/dapp-kit-slot.mjs.map +1 -1
- package/dist/build-integrations/runtime/discover.d.mts +6 -4
- package/dist/build-integrations/runtime/discover.mjs +15 -4
- package/dist/build-integrations/runtime/discover.mjs.map +1 -1
- package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
- package/dist/build-integrations/runtime/errors.mjs.map +1 -1
- package/dist/build-integrations/runtime/read-stack-context.mjs +3 -3
- package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
- package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +23 -7
- package/dist/build-integrations/runtime/resolve-discovery-env.mjs +25 -12
- package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -1
- package/dist/build-integrations/runtime/stack-context.d.mts +2 -2
- package/dist/build-integrations/vite/index.d.mts +84 -19
- package/dist/build-integrations/vite/index.mjs +203 -28
- package/dist/build-integrations/vite/index.mjs.map +1 -1
- package/dist/build-integrations/vitest/config.d.mts +20 -2
- package/dist/build-integrations/vitest/config.mjs +16 -4
- package/dist/build-integrations/vitest/config.mjs.map +1 -1
- package/dist/build-integrations/vitest/env.d.mts +18 -10
- package/dist/build-integrations/vitest/env.mjs +11 -10
- package/dist/build-integrations/vitest/env.mjs.map +1 -1
- package/dist/build-integrations/vitest/errors.d.mts +7 -11
- package/dist/build-integrations/vitest/errors.mjs +3 -4
- package/dist/build-integrations/vitest/errors.mjs.map +1 -1
- package/dist/build-integrations/vitest/global-setup.d.mts +35 -0
- package/dist/build-integrations/vitest/global-setup.mjs +156 -0
- package/dist/build-integrations/vitest/global-setup.mjs.map +1 -0
- package/dist/build-integrations/vitest/index.d.mts +3 -2
- package/dist/build-integrations/vitest/index.mjs +3 -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 +5 -3
- package/dist/build-integrations/vitest/stack-context.mjs +3 -2
- package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
- package/dist/cli/bail.mjs.map +1 -1
- package/dist/cli/doctor-probes.mjs +1 -3
- package/dist/cli/doctor-probes.mjs.map +1 -1
- package/dist/cli/main.d.mts +23 -1
- package/dist/cli/main.mjs +63 -8
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/prune-direct.mjs.map +1 -1
- package/dist/cli/snapshot-reader.mjs.map +1 -1
- package/dist/cli/up-lifecycle.mjs.map +1 -1
- package/dist/cli/wirings/apply.mjs +28 -21
- package/dist/cli/wirings/apply.mjs.map +1 -1
- package/dist/cli/wirings/codegen.mjs +108 -0
- package/dist/cli/wirings/codegen.mjs.map +1 -0
- package/dist/cli/wirings/config-loader.mjs +12 -62
- package/dist/cli/wirings/config-loader.mjs.map +1 -1
- package/dist/cli/wirings/dump-ids.mjs +86 -0
- package/dist/cli/wirings/dump-ids.mjs.map +1 -0
- package/dist/cli/wirings/engine-command.mjs +1 -1
- package/dist/cli/wirings/engine-command.mjs.map +1 -1
- package/dist/cli/wirings/identity.mjs +2 -2
- package/dist/cli/wirings/identity.mjs.map +1 -1
- package/dist/cli/wirings/provide-file-system.mjs.map +1 -1
- package/dist/cli/wirings/read-devstack-version.mjs +17 -0
- package/dist/cli/wirings/read-devstack-version.mjs.map +1 -0
- package/dist/cli/wirings/snapshot.mjs +27 -34
- package/dist/cli/wirings/snapshot.mjs.map +1 -1
- package/dist/cli/wirings/up-ipc.mjs +147 -0
- package/dist/cli/wirings/up-ipc.mjs.map +1 -0
- package/dist/cli/wirings/up.mjs +218 -198
- package/dist/cli/wirings/up.mjs.map +1 -1
- package/dist/cli/wirings/wipe.mjs +1 -1
- package/dist/cli/wirings/wipe.mjs.map +1 -1
- package/dist/contracts/chain-probe.d.mts +1 -1
- package/dist/contracts/chain-probe.mjs +1 -1
- package/dist/contracts/chain-probe.mjs.map +1 -1
- package/dist/contracts/codegenable.d.mts +60 -6
- package/dist/contracts/codegenable.mjs +28 -0
- package/dist/contracts/codegenable.mjs.map +1 -0
- package/dist/contracts/config-bindings.mjs +162 -0
- package/dist/contracts/config-bindings.mjs.map +1 -0
- package/dist/contracts/container-runtime.d.mts +23 -17
- package/dist/contracts/plugin-expander.mjs.map +1 -1
- package/dist/contracts/snapshotable.d.mts +5 -7
- package/dist/contracts/wallet-protocol.d.mts +2 -5
- package/dist/contracts/wallet-protocol.mjs +2 -5
- package/dist/contracts/wallet-protocol.mjs.map +1 -1
- package/dist/index.d.mts +21 -26
- package/dist/index.mjs +8 -9
- package/dist/orchestrators/boot.d.mts +28 -0
- package/dist/orchestrators/boot.mjs +440 -0
- package/dist/orchestrators/boot.mjs.map +1 -0
- package/dist/orchestrators/codegen/bindings.d.mts +13 -1
- package/dist/orchestrators/codegen/bindings.mjs +23 -9
- package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
- package/dist/orchestrators/codegen/config-runtime.mjs +208 -0
- package/dist/orchestrators/codegen/config-runtime.mjs.map +1 -0
- package/dist/orchestrators/codegen/emit.mjs +1 -1
- package/dist/orchestrators/codegen/emit.mjs.map +1 -1
- package/dist/orchestrators/codegen/errors.mjs +21 -1
- package/dist/orchestrators/codegen/errors.mjs.map +1 -1
- package/dist/orchestrators/codegen/format.mjs +2 -0
- package/dist/orchestrators/codegen/format.mjs.map +1 -1
- package/dist/orchestrators/codegen/gitignore.mjs +30 -11
- package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
- package/dist/orchestrators/codegen/id-config.mjs +107 -0
- package/dist/orchestrators/codegen/id-config.mjs.map +1 -0
- package/dist/orchestrators/codegen/output-location.mjs +23 -32
- package/dist/orchestrators/codegen/output-location.mjs.map +1 -1
- package/dist/orchestrators/codegen/paths.mjs +8 -1
- package/dist/orchestrators/codegen/paths.mjs.map +1 -1
- package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
- package/dist/orchestrators/codegen/service.mjs +286 -58
- package/dist/orchestrators/codegen/service.mjs.map +1 -1
- package/dist/orchestrators/layers.mjs +31 -0
- package/dist/orchestrators/layers.mjs.map +1 -0
- package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -1
- package/dist/orchestrators/lifecycle-prune/index.mjs +8 -10
- package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -1
- package/dist/orchestrators/network-options.d.mts +52 -0
- package/dist/orchestrators/network-options.mjs +43 -0
- package/dist/orchestrators/network-options.mjs.map +1 -0
- package/dist/orchestrators/router/cleanup.mjs.map +1 -1
- package/dist/orchestrators/router/cors.mjs.map +1 -1
- package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
- package/dist/orchestrators/router/errors.mjs.map +1 -1
- package/dist/orchestrators/router/file-provider.mjs.map +1 -1
- package/dist/orchestrators/router/hostname.mjs.map +1 -1
- package/dist/orchestrators/router/profile.mjs +1 -1
- package/dist/orchestrators/router/profile.mjs.map +1 -1
- package/dist/orchestrators/router/service.d.mts +2 -2
- package/dist/orchestrators/router/service.mjs +12 -27
- package/dist/orchestrators/router/service.mjs.map +1 -1
- package/dist/orchestrators/router/traefik-container.mjs +1 -1
- package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
- package/dist/orchestrators/snapshot/capture.mjs +171 -195
- package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
- package/dist/orchestrators/snapshot/descriptor.d.mts +1 -1
- package/dist/orchestrators/snapshot/descriptor.mjs +53 -11
- package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
- package/dist/orchestrators/snapshot/identity-guard.mjs +3 -5
- package/dist/orchestrators/snapshot/identity-guard.mjs.map +1 -1
- package/dist/orchestrators/snapshot/image-bundle-tags.mjs +32 -101
- package/dist/orchestrators/snapshot/image-bundle-tags.mjs.map +1 -1
- package/dist/orchestrators/snapshot/index.mjs +1 -4
- package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
- package/dist/orchestrators/snapshot/interrupted-restore.mjs +116 -0
- package/dist/orchestrators/snapshot/interrupted-restore.mjs.map +1 -0
- package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -1
- package/dist/orchestrators/snapshot/prune.mjs +40 -31
- package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
- package/dist/orchestrators/snapshot/restore.mjs +221 -196
- package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
- package/dist/orchestrators/snapshot/service.mjs +72 -62
- package/dist/orchestrators/snapshot/service.mjs.map +1 -1
- package/dist/orchestrators/snapshot/wipe.mjs +67 -56
- package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
- package/dist/plugins/account/codegen.mjs +3 -0
- package/dist/plugins/account/codegen.mjs.map +1 -1
- package/dist/plugins/account/errors.d.mts +2 -2
- package/dist/plugins/account/errors.mjs +1 -4
- package/dist/plugins/account/errors.mjs.map +1 -1
- package/dist/plugins/account/funding.mjs +3 -27
- package/dist/plugins/account/funding.mjs.map +1 -1
- package/dist/plugins/account/index.d.mts +3 -8
- package/dist/plugins/account/index.mjs +71 -35
- package/dist/plugins/account/index.mjs.map +1 -1
- package/dist/plugins/account/keypair.d.mts +8 -7
- package/dist/plugins/account/keypair.mjs +5 -18
- package/dist/plugins/account/keypair.mjs.map +1 -1
- package/dist/plugins/account/lease.mjs.map +1 -1
- package/dist/plugins/account/registry.d.mts +1 -46
- package/dist/plugins/account/registry.mjs.map +1 -1
- package/dist/plugins/account/service.d.mts +43 -34
- package/dist/plugins/account/service.mjs +9 -54
- package/dist/plugins/account/service.mjs.map +1 -1
- package/dist/plugins/account/snapshot.mjs.map +1 -1
- package/dist/plugins/account/variants/ephemeral.mjs.map +1 -1
- package/dist/plugins/account/variants/impersonate.mjs.map +1 -1
- package/dist/plugins/account/variants/signer.mjs.map +1 -1
- package/dist/plugins/action/discriminator.mjs.map +1 -1
- package/dist/plugins/action/errors.mjs +1 -4
- package/dist/plugins/action/errors.mjs.map +1 -1
- package/dist/plugins/action/execute.mjs +3 -4
- package/dist/plugins/action/execute.mjs.map +1 -1
- package/dist/plugins/action/index.d.mts +2 -2
- package/dist/plugins/action/index.mjs +7 -11
- package/dist/plugins/action/index.mjs.map +1 -1
- package/dist/plugins/action/service.d.mts +5 -7
- package/dist/plugins/action/service.mjs +2 -16
- package/dist/plugins/action/service.mjs.map +1 -1
- package/dist/plugins/coin/address-resolution.mjs.map +1 -1
- package/dist/plugins/coin/codegen.mjs +97 -16
- package/dist/plugins/coin/codegen.mjs.map +1 -1
- package/dist/plugins/coin/discovery.mjs.map +1 -1
- package/dist/plugins/coin/errors.mjs +1 -4
- package/dist/plugins/coin/errors.mjs.map +1 -1
- package/dist/plugins/coin/index.d.mts +4 -34
- package/dist/plugins/coin/index.mjs +47 -28
- package/dist/plugins/coin/index.mjs.map +1 -1
- package/dist/plugins/coin/metadata.d.mts +1 -0
- package/dist/plugins/coin/metadata.mjs +8 -9
- package/dist/plugins/coin/metadata.mjs.map +1 -1
- package/dist/plugins/coin/mint.mjs +7 -21
- package/dist/plugins/coin/mint.mjs.map +1 -1
- package/dist/plugins/coin/registry.mjs +33 -20
- package/dist/plugins/coin/registry.mjs.map +1 -1
- package/dist/plugins/coin/service.d.mts +1 -1
- package/dist/plugins/coin/service.mjs +1 -8
- package/dist/plugins/coin/service.mjs.map +1 -1
- package/dist/plugins/coin/snapshot.mjs.map +1 -1
- package/dist/plugins/coin/type-strings.mjs.map +1 -1
- package/dist/plugins/dashboard/domain.mjs +106 -167
- package/dist/plugins/dashboard/domain.mjs.map +1 -1
- package/dist/plugins/dashboard/index.mjs +13 -13
- package/dist/plugins/dashboard/index.mjs.map +1 -1
- package/dist/plugins/dashboard/origin-policy.mjs +3 -3
- package/dist/plugins/dashboard/origin-policy.mjs.map +1 -1
- package/dist/plugins/dashboard/routable.mjs.map +1 -1
- package/dist/plugins/dashboard/schema/builder.mjs.map +1 -1
- package/dist/plugins/dashboard/schema/enums.mjs.map +1 -1
- package/dist/plugins/dashboard/schema/root.mjs +23 -44
- package/dist/plugins/dashboard/schema/root.mjs.map +1 -1
- package/dist/plugins/dashboard/schema/types.mjs +37 -91
- package/dist/plugins/dashboard/schema/types.mjs.map +1 -1
- package/dist/plugins/dashboard/schema.mjs.map +1 -1
- package/dist/plugins/dashboard/server.mjs.map +1 -1
- package/dist/plugins/deepbook/codegen.d.mts +12 -11
- package/dist/plugins/deepbook/codegen.mjs +108 -11
- package/dist/plugins/deepbook/codegen.mjs.map +1 -1
- package/dist/plugins/deepbook/deploy.mjs +7 -14
- package/dist/plugins/deepbook/deploy.mjs.map +1 -1
- package/dist/plugins/deepbook/errors.mjs +4 -2
- package/dist/plugins/deepbook/errors.mjs.map +1 -1
- package/dist/plugins/deepbook/faucet-strategy.mjs +4 -10
- package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
- package/dist/plugins/deepbook/hash.mjs.map +1 -1
- package/dist/plugins/deepbook/index.d.mts +38 -34
- package/dist/plugins/deepbook/index.mjs +133 -64
- package/dist/plugins/deepbook/index.mjs.map +1 -1
- package/dist/plugins/deepbook/plugin-key.mjs.map +1 -1
- package/dist/plugins/deepbook/pyth/index.mjs +4 -8
- package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
- package/dist/plugins/deepbook/snapshot.mjs +0 -1
- package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
- package/dist/plugins/deepbook/type-strings.mjs.map +1 -1
- package/dist/plugins/deepbook/types.d.mts +2 -1
- package/dist/plugins/deepbook/types.mjs.map +1 -1
- package/dist/plugins/faucet/dispatcher.d.mts +3 -3
- package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
- package/dist/plugins/faucet/errors.mjs.map +1 -1
- package/dist/plugins/faucet/http.mjs +2 -10
- package/dist/plugins/faucet/http.mjs.map +1 -1
- package/dist/plugins/faucet/index.mjs +0 -1
- package/dist/plugins/faucet/index.mjs.map +1 -1
- package/dist/plugins/host-service/errors.d.mts +1 -3
- package/dist/plugins/host-service/errors.mjs +1 -2
- package/dist/plugins/host-service/errors.mjs.map +1 -1
- package/dist/plugins/host-service/index.d.mts +1 -2
- package/dist/plugins/host-service/index.mjs +11 -11
- package/dist/plugins/host-service/index.mjs.map +1 -1
- package/dist/plugins/host-service/routable.mjs.map +1 -1
- package/dist/plugins/host-service/service.mjs +13 -13
- package/dist/plugins/host-service/service.mjs.map +1 -1
- package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -1
- package/dist/plugins/internal/codegen-helpers.mjs +2 -0
- package/dist/plugins/internal/codegen-helpers.mjs.map +1 -1
- package/dist/plugins/internal/funding-failure-error.mjs.map +1 -1
- package/dist/plugins/{postgres → internal/postgres-sidecar}/connection.mjs +1 -1
- package/dist/plugins/internal/postgres-sidecar/connection.mjs.map +1 -0
- package/dist/plugins/{postgres → internal/postgres-sidecar}/db-ensure.mjs +30 -16
- package/dist/plugins/internal/postgres-sidecar/db-ensure.mjs.map +1 -0
- package/dist/plugins/internal/postgres-sidecar/errors.mjs +21 -0
- package/dist/plugins/internal/postgres-sidecar/errors.mjs.map +1 -0
- package/dist/{substrate/runtime/scoped-multimap → plugins/internal/postgres-sidecar}/index.mjs +1 -0
- package/dist/plugins/internal/postgres-sidecar/service.mjs +121 -0
- package/dist/plugins/internal/postgres-sidecar/service.mjs.map +1 -0
- package/dist/plugins/package/build.mjs +2 -2
- package/dist/plugins/package/build.mjs.map +1 -1
- package/dist/plugins/package/codegen.d.mts +7 -14
- package/dist/plugins/package/codegen.mjs +187 -59
- package/dist/plugins/package/codegen.mjs.map +1 -1
- package/dist/plugins/package/dep-resolution.mjs +51 -3
- package/dist/plugins/package/dep-resolution.mjs.map +1 -1
- package/dist/plugins/package/errors.mjs +1 -4
- package/dist/plugins/package/errors.mjs.map +1 -1
- package/dist/plugins/package/git-source.d.mts +18 -0
- package/dist/plugins/package/git-source.mjs +119 -0
- package/dist/plugins/package/git-source.mjs.map +1 -0
- package/dist/plugins/package/index.d.mts +28 -19
- package/dist/plugins/package/index.mjs +107 -32
- package/dist/plugins/package/index.mjs.map +1 -1
- package/dist/plugins/package/mode-known.mjs +2 -2
- package/dist/plugins/package/mode-known.mjs.map +1 -1
- package/dist/plugins/package/mode-local.mjs +18 -35
- package/dist/plugins/package/mode-local.mjs.map +1 -1
- package/dist/plugins/package/publish-executor.mjs +13 -8
- package/dist/plugins/package/publish-executor.mjs.map +1 -1
- package/dist/plugins/package/publish-output.d.mts +1 -11
- package/dist/plugins/package/publish-output.mjs +1 -9
- package/dist/plugins/package/publish-output.mjs.map +1 -1
- package/dist/plugins/package/registry.d.mts +1 -1
- package/dist/plugins/package/registry.mjs +26 -14
- package/dist/plugins/package/registry.mjs.map +1 -1
- package/dist/plugins/package/service.mjs.map +1 -1
- package/dist/plugins/package/snapshot.mjs.map +1 -1
- package/dist/plugins/router-entrypoints.mjs +1 -3
- package/dist/plugins/router-entrypoints.mjs.map +1 -1
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +1 -2
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +1 -6
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
- package/dist/plugins/seal/codegen.d.mts +1 -5
- package/dist/plugins/seal/codegen.mjs +83 -12
- package/dist/plugins/seal/codegen.mjs.map +1 -1
- package/dist/plugins/seal/config-render.mjs +2 -6
- package/dist/plugins/seal/config-render.mjs.map +1 -1
- package/dist/plugins/seal/deploy.mjs +18 -29
- package/dist/plugins/seal/deploy.mjs.map +1 -1
- package/dist/plugins/seal/errors.d.mts +4 -5
- package/dist/plugins/seal/errors.mjs +1 -8
- package/dist/plugins/seal/errors.mjs.map +1 -1
- package/dist/plugins/seal/index.d.mts +7 -28
- package/dist/plugins/seal/index.mjs +69 -47
- package/dist/plugins/seal/index.mjs.map +1 -1
- package/dist/plugins/seal/key-manager.mjs.map +1 -1
- package/dist/plugins/seal/key-server.mjs +1 -6
- package/dist/plugins/seal/key-server.mjs.map +1 -1
- package/dist/plugins/seal/keygen.mjs +2 -3
- package/dist/plugins/seal/keygen.mjs.map +1 -1
- package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
- package/dist/plugins/seal/mode/live.mjs +1 -1
- package/dist/plugins/seal/mode/live.mjs.map +1 -1
- package/dist/plugins/seal/mode/local-keygen.mjs +4 -10
- package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
- package/dist/plugins/seal/plugin-key.mjs.map +1 -1
- 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/snapshot.mjs +1 -2
- package/dist/plugins/seal/snapshot.mjs.map +1 -1
- package/dist/plugins/sui/auto-tick.mjs +5 -5
- package/dist/plugins/sui/auto-tick.mjs.map +1 -1
- package/dist/plugins/sui/chain-build-container.mjs +2 -2
- package/dist/plugins/sui/chain-build-container.mjs.map +1 -1
- package/dist/plugins/sui/chain-probe.mjs +4 -4
- package/dist/plugins/sui/chain-probe.mjs.map +1 -1
- package/dist/plugins/sui/codegen.d.mts +9 -7
- package/dist/plugins/sui/codegen.mjs +49 -46
- package/dist/plugins/sui/codegen.mjs.map +1 -1
- package/dist/plugins/sui/errors.d.mts +1 -1
- package/dist/plugins/sui/errors.mjs +1 -9
- package/dist/plugins/sui/errors.mjs.map +1 -1
- package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/index.d.mts +1 -1
- package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/index.mjs +3 -7
- package/dist/plugins/sui/exec/index.mjs.map +1 -0
- package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.mjs +1 -1
- package/dist/plugins/sui/exec/sign-and-dispatch.mjs.map +1 -0
- package/dist/plugins/sui/fork-faucet-strategy.mjs +2 -6
- package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -1
- package/dist/plugins/sui/fork-orchestration.mjs +13 -23
- package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
- package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
- package/dist/plugins/sui/index.d.mts +34 -83
- package/dist/plugins/sui/index.mjs +200 -68
- package/dist/plugins/sui/index.mjs.map +1 -1
- package/dist/{substrate/runtime/sui-ledger → plugins/sui/ledger}/object-ref.mjs +1 -1
- package/dist/plugins/sui/ledger/object-ref.mjs.map +1 -0
- package/dist/plugins/sui/local-faucet-strategy.mjs +1 -5
- package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -1
- package/dist/plugins/sui/log-attrs.mjs +11 -0
- package/dist/plugins/sui/log-attrs.mjs.map +1 -0
- package/dist/plugins/sui/mode/external.mjs +4 -12
- package/dist/plugins/sui/mode/external.mjs.map +1 -1
- package/dist/plugins/sui/mode/fork.mjs +19 -16
- package/dist/plugins/sui/mode/fork.mjs.map +1 -1
- package/dist/plugins/sui/mode/live.mjs +4 -17
- package/dist/plugins/sui/mode/live.mjs.map +1 -1
- package/dist/plugins/sui/mode/local.d.mts +1 -0
- package/dist/plugins/sui/mode/local.mjs +203 -61
- package/dist/plugins/sui/mode/local.mjs.map +1 -1
- package/dist/plugins/sui/mode/shared-boot.mjs +18 -23
- package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
- package/dist/plugins/sui/mode/shared.d.mts +6 -7
- package/dist/plugins/sui/mode/shared.mjs.map +1 -1
- package/dist/plugins/sui/mode/spec.d.mts +23 -6
- package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.mjs +28 -30
- package/dist/plugins/sui/move/index.mjs.map +1 -0
- package/dist/plugins/sui/move-summary-runner.mjs +8 -4
- package/dist/plugins/sui/move-summary-runner.mjs.map +1 -1
- package/dist/{substrate/network.d.mts → plugins/sui/network-config.d.mts} +11 -10
- package/dist/plugins/sui/network-resolver.d.mts +6 -6
- package/dist/plugins/sui/routable.mjs.map +1 -1
- package/dist/plugins/sui/service.mjs +10 -6
- package/dist/plugins/sui/service.mjs.map +1 -1
- package/dist/plugins/sui/snapshot.mjs +10 -5
- package/dist/plugins/sui/snapshot.mjs.map +1 -1
- package/dist/plugins/wallet/codegen.d.mts +8 -6
- package/dist/plugins/wallet/codegen.mjs +4 -10
- package/dist/plugins/wallet/codegen.mjs.map +1 -1
- package/dist/plugins/wallet/errors.mjs +1 -4
- package/dist/plugins/wallet/errors.mjs.map +1 -1
- package/dist/plugins/wallet/index.d.mts +3 -6
- package/dist/plugins/wallet/index.mjs +16 -21
- package/dist/plugins/wallet/index.mjs.map +1 -1
- package/dist/plugins/wallet/origin-policy.mjs +3 -3
- package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
- package/dist/plugins/wallet/pairing.mjs +6 -24
- package/dist/plugins/wallet/pairing.mjs.map +1 -1
- package/dist/plugins/wallet/protocol.mjs.map +1 -1
- package/dist/plugins/wallet/routable.mjs.map +1 -1
- package/dist/plugins/wallet/server.mjs +17 -24
- package/dist/plugins/wallet/server.mjs.map +1 -1
- package/dist/plugins/wallet/service.d.mts +2 -2
- package/dist/plugins/wallet/service.mjs +4 -15
- package/dist/plugins/wallet/service.mjs.map +1 -1
- package/dist/plugins/wallet/snapshot.mjs.map +1 -1
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +1 -5
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
- package/dist/plugins/walrus/codegen.d.mts +2 -13
- package/dist/plugins/walrus/codegen.mjs +93 -28
- package/dist/plugins/walrus/codegen.mjs.map +1 -1
- package/dist/plugins/walrus/deploy-paths.mjs +2 -3
- package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
- package/dist/plugins/walrus/deploy.mjs +26 -19
- package/dist/plugins/walrus/deploy.mjs.map +1 -1
- package/dist/plugins/walrus/errors.mjs +1 -8
- package/dist/plugins/walrus/errors.mjs.map +1 -1
- package/dist/plugins/walrus/faucet-strategy.mjs +15 -1
- package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
- package/dist/plugins/walrus/index.d.mts +13 -44
- package/dist/plugins/walrus/index.mjs +119 -122
- package/dist/plugins/walrus/index.mjs.map +1 -1
- package/dist/plugins/walrus/mode/known-deploy.mjs +6 -6
- package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
- package/dist/plugins/walrus/mode/local-cluster.d.mts +2 -2
- package/dist/plugins/walrus/mode/local-cluster.mjs +2 -10
- package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
- package/dist/plugins/walrus/plugin-key.mjs.map +1 -1
- package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
- package/dist/plugins/walrus/routable.mjs.map +1 -1
- package/dist/plugins/walrus/service.mjs.map +1 -1
- package/dist/plugins/walrus/snapshot.mjs +3 -3
- package/dist/plugins/walrus/snapshot.mjs.map +1 -1
- package/dist/plugins/walrus/storage-nodes.mjs +53 -14
- package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
- package/dist/plugins/walrus/wal-swap.mjs +4 -8
- package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
- package/dist/primitives/artifact-publisher.mjs.map +1 -1
- package/dist/primitives/cache.d.mts +1 -1
- package/dist/runtime/docker/client.mjs +47 -3
- package/dist/runtime/docker/client.mjs.map +1 -1
- package/dist/runtime/docker/container.mjs +37 -57
- package/dist/runtime/docker/container.mjs.map +1 -1
- package/dist/runtime/docker/errors.mjs.map +1 -1
- package/dist/runtime/docker/exec.mjs +2 -2
- package/dist/runtime/docker/exec.mjs.map +1 -1
- package/dist/runtime/docker/image.mjs +10 -11
- package/dist/runtime/docker/image.mjs.map +1 -1
- package/dist/runtime/docker/index.mjs +0 -1
- package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -1
- package/dist/runtime/docker/inventory.mjs +9 -9
- package/dist/runtime/docker/inventory.mjs.map +1 -1
- package/dist/runtime/docker/labels.mjs +12 -1
- package/dist/runtime/docker/labels.mjs.map +1 -1
- package/dist/runtime/docker/network.mjs +6 -6
- package/dist/runtime/docker/network.mjs.map +1 -1
- package/dist/runtime/docker/render-run-args.mjs.map +1 -1
- package/dist/runtime/docker/service.mjs +31 -45
- package/dist/runtime/docker/service.mjs.map +1 -1
- package/dist/runtime/docker/sweep.mjs +14 -64
- package/dist/runtime/docker/sweep.mjs.map +1 -1
- package/dist/runtime/docker/volume.mjs +1 -1
- package/dist/runtime/docker/volume.mjs.map +1 -1
- package/dist/runtime/docker/wrap.mjs +14 -2
- package/dist/runtime/docker/wrap.mjs.map +1 -1
- package/dist/substrate/brand.d.mts +2 -5
- package/dist/substrate/brand.mjs +3 -2
- package/dist/substrate/brand.mjs.map +1 -1
- package/dist/substrate/cross-process.mjs +2 -16
- package/dist/substrate/cross-process.mjs.map +1 -1
- package/dist/substrate/event-time.mjs +0 -2
- package/dist/substrate/event-time.mjs.map +1 -1
- package/dist/substrate/events.d.mts +46 -16
- package/dist/substrate/identity.d.mts +11 -5
- package/dist/substrate/manifest.d.mts +33 -26
- package/dist/substrate/manifest.mjs +8 -3
- package/dist/substrate/manifest.mjs.map +1 -1
- package/dist/substrate/options.d.mts +33 -4
- package/dist/substrate/plugin-ctx.d.mts +70 -0
- package/dist/substrate/plugin-ctx.mjs +66 -0
- package/dist/substrate/plugin-ctx.mjs.map +1 -0
- package/dist/substrate/plugin.d.mts +46 -38
- package/dist/substrate/plugin.mjs +13 -9
- package/dist/substrate/plugin.mjs.map +1 -1
- package/dist/substrate/projection.d.mts +1 -1
- package/dist/substrate/runtime/atomic-write.mjs +3 -4
- package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
- package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
- package/dist/substrate/runtime/cache/service.mjs +50 -20
- package/dist/substrate/runtime/cache/service.mjs.map +1 -1
- package/dist/substrate/runtime/config-validation.mjs.map +1 -1
- package/dist/substrate/runtime/control-plane/domain.mjs +34 -12
- package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -1
- package/dist/substrate/runtime/control-plane/service.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +14 -17
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
- 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.map +1 -1
- package/dist/substrate/runtime/cross-process/index.mjs +0 -2
- package/dist/substrate/runtime/cross-process/live-clock.mjs +1 -1
- package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/liveness.mjs +11 -18
- package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +2 -2
- package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/roster.mjs +17 -127
- package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/stack-lock.mjs +29 -28
- package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
- package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
- package/dist/substrate/runtime/errors.mjs +1 -13
- package/dist/substrate/runtime/errors.mjs.map +1 -1
- package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -1
- package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -1
- package/dist/substrate/runtime/host-gateway.mjs.map +1 -1
- package/dist/substrate/runtime/host-tree-tar/index.mjs +15 -163
- package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
- package/dist/substrate/runtime/http-probe.d.mts +1 -3
- package/dist/substrate/runtime/http-probe.mjs.map +1 -1
- package/dist/substrate/runtime/index.mjs +1 -6
- package/dist/substrate/runtime/lease-broker/service.mjs +5 -23
- package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs +3 -3
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/graph-input-id.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/graph-input-id.mjs +133 -0
- package/dist/substrate/runtime/lifecycle/graph-input-id.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/index.mjs +2 -2
- package/dist/substrate/runtime/lifecycle/plugin-registry.d.mts +1 -1
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +22 -1
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/ready-gate.mjs +2 -15
- package/dist/substrate/runtime/lifecycle/ready-gate.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/selective-restart.mjs +29 -25
- package/dist/substrate/runtime/lifecycle/selective-restart.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/signals.mjs +1 -1
- package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/state-machine.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/watch-attribution.d.mts +1 -1
- package/dist/substrate/runtime/lifecycle/watch-attribution.mjs +0 -1
- package/dist/substrate/runtime/lifecycle/watch-attribution.mjs.map +1 -1
- package/dist/substrate/runtime/managed-container.d.mts +5 -1
- package/dist/substrate/runtime/managed-container.mjs +8 -10
- package/dist/substrate/runtime/managed-container.mjs.map +1 -1
- package/dist/substrate/runtime/manifest/manifest.mjs +8 -30
- package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
- package/dist/substrate/runtime/mode-errors.d.mts +1 -2
- package/dist/substrate/runtime/mode-errors.mjs.map +1 -1
- package/dist/substrate/runtime/observability/cascade-formatter.mjs +1 -11
- package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
- package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -1
- package/dist/substrate/runtime/observability/index.d.mts +1 -1
- package/dist/substrate/runtime/observability/index.mjs +4 -6
- package/dist/substrate/runtime/observability/log-attrs.mjs +46 -0
- package/dist/substrate/runtime/observability/log-attrs.mjs.map +1 -0
- package/dist/substrate/runtime/observability/log-store.mjs.map +1 -1
- package/dist/substrate/runtime/observability/logger.mjs +3 -3
- package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
- package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -1
- package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
- package/dist/substrate/runtime/observability/process-lines.mjs.map +1 -1
- package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
- package/dist/substrate/runtime/observability/subprocess-capture.mjs +2 -2
- package/dist/substrate/runtime/observability/subprocess-capture.mjs.map +1 -1
- package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -1
- package/dist/substrate/runtime/paths.mjs +27 -9
- package/dist/substrate/runtime/paths.mjs.map +1 -1
- package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -1
- package/dist/substrate/runtime/port-broker/service.mjs +10 -27
- package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
- package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
- package/dist/substrate/runtime/probes.d.mts +2 -3
- package/dist/substrate/runtime/probes.mjs.map +1 -1
- package/dist/substrate/runtime/process-supervisor.mjs.map +1 -1
- package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
- package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
- package/dist/substrate/runtime/projection/update.mjs +87 -11
- package/dist/substrate/runtime/projection/update.mjs.map +1 -1
- package/dist/substrate/runtime/random-suffix.mjs.map +1 -1
- package/dist/substrate/runtime/reconcile/fs-plan.mjs +146 -0
- package/dist/substrate/runtime/reconcile/fs-plan.mjs.map +1 -0
- package/dist/substrate/runtime/reconcile/graph.mjs +19 -0
- package/dist/substrate/runtime/reconcile/graph.mjs.map +1 -0
- package/dist/substrate/runtime/reconcile/index.mjs +5 -0
- package/dist/substrate/runtime/reconcile/label.mjs +41 -0
- package/dist/substrate/runtime/reconcile/label.mjs.map +1 -0
- package/dist/substrate/runtime/reconcile/spec.mjs +15 -0
- package/dist/substrate/runtime/reconcile/spec.mjs.map +1 -0
- package/dist/substrate/runtime/retry-policy.d.mts +2 -3
- package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
- package/dist/substrate/runtime/routed-url.mjs.map +1 -1
- package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
- package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
- package/dist/substrate/runtime/stage-and-swap/index.mjs +49 -12
- package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
- package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -1
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
- package/dist/substrate/runtime/strategy-registry/service.mjs +29 -17
- package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
- package/dist/substrate/runtime/subnet-broker.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/acquire-node.mjs +188 -56
- package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/background-tasks.mjs +79 -65
- package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/command-loop.mjs +82 -23
- package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs +16 -0
- package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/errors.mjs +11 -2
- package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/index.mjs +2 -0
- package/dist/substrate/runtime/supervisor/shutdown.mjs +6 -6
- package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/start-supervisor.mjs +60 -70
- package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/state.d.mts +1 -1
- package/dist/substrate/runtime/supervisor/state.mjs +1 -1
- package/dist/substrate/runtime/supervisor/state.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/teardown.mjs +10 -9
- package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/wiring.mjs +6 -20
- package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -1
- package/dist/substrate/runtime/tar/reader.mjs +216 -0
- package/dist/substrate/runtime/tar/reader.mjs.map +1 -0
- package/dist/substrate/runtime/typed-env.mjs.map +1 -1
- package/dist/substrate/versioned-doc-schema.mjs.map +1 -1
- package/dist/substrate/versioned-doc-sync.mjs +5 -5
- package/dist/substrate/versioned-doc-sync.mjs.map +1 -1
- package/dist/surfaces/cli/command-tree.mjs +49 -7
- package/dist/surfaces/cli/command-tree.mjs.map +1 -1
- package/dist/surfaces/cli/commands/config.mjs +1 -1
- package/dist/surfaces/cli/commands/config.mjs.map +1 -1
- package/dist/surfaces/cli/commands/confirm-node.mjs.map +1 -1
- package/dist/surfaces/cli/commands/confirm.mjs.map +1 -1
- package/dist/surfaces/cli/commands/doctor.mjs +1 -1
- package/dist/surfaces/cli/commands/doctor.mjs.map +1 -1
- package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -1
- package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
- package/dist/surfaces/cli/commands/prune.mjs +1 -1
- package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
- package/dist/surfaces/cli/commands/snapshot.mjs +1 -1
- package/dist/surfaces/cli/commands/snapshot.mjs.map +1 -1
- package/dist/surfaces/cli/commands/status.mjs +1 -1
- package/dist/surfaces/cli/commands/status.mjs.map +1 -1
- package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
- package/dist/surfaces/cli/commands/wipe.mjs +3 -4
- package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
- package/dist/surfaces/cli/envelope.mjs.map +1 -1
- package/dist/surfaces/cli/errors.mjs.map +1 -1
- package/dist/surfaces/cli/flags.mjs.map +1 -1
- package/dist/surfaces/cli/index.mjs +45 -14
- package/dist/surfaces/cli/index.mjs.map +1 -1
- package/dist/surfaces/cli/output.mjs.map +1 -1
- package/dist/surfaces/cli/sysexits.mjs.map +1 -1
- package/dist/surfaces/tui/app.mjs +0 -21
- package/dist/surfaces/tui/app.mjs.map +1 -1
- package/dist/surfaces/tui/dashboard.mjs +0 -48
- package/dist/surfaces/tui/dashboard.mjs.map +1 -1
- package/dist/surfaces/tui/display-derivation.mjs +80 -16
- package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
- package/dist/surfaces/tui/errors.mjs.map +1 -1
- package/dist/surfaces/tui/event-log.mjs +0 -9
- package/dist/surfaces/tui/event-log.mjs.map +1 -1
- package/dist/surfaces/tui/heartbeat.mjs.map +1 -1
- package/dist/surfaces/tui/index.mjs +2 -2
- package/dist/surfaces/tui/index.mjs.map +1 -1
- package/dist/surfaces/tui/input.mjs.map +1 -1
- package/dist/surfaces/tui/mode-detect.mjs.map +1 -1
- package/dist/surfaces/tui/mount-ink.mjs.map +1 -1
- package/dist/surfaces/tui/plain-renderer.mjs +26 -19
- package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
- package/dist/surfaces/tui/resource-table.mjs +8 -10
- package/dist/surfaces/tui/resource-table.mjs.map +1 -1
- package/images/postgres/Dockerfile +0 -1
- package/images/sui/Dockerfile +27 -54
- package/images/sui/entrypoint.sh +17 -179
- package/package.json +23 -15
- package/dashboard-ui/assets/index-Bmi1UtAg.js +0 -1356
- package/dashboard-ui/assets/index-D5EShVt4.js +0 -3
- package/dashboard-ui/assets/index-Deml9drg.css +0 -1
- package/dist/api/plugin-errors.d.mts +0 -7
- package/dist/api/plugin-errors.mjs +0 -10
- package/dist/api/plugin-errors.mjs.map +0 -1
- package/dist/cli/wirings/build-verb-layers.mjs +0 -42
- package/dist/cli/wirings/build-verb-layers.mjs.map +0 -1
- package/dist/contracts/capability-decl.d.mts +0 -40
- package/dist/orchestrators/built-in-plugin-layers.mjs +0 -54
- package/dist/orchestrators/built-in-plugin-layers.mjs.map +0 -1
- package/dist/orchestrators/run.mjs +0 -91
- package/dist/orchestrators/run.mjs.map +0 -1
- package/dist/orchestrators/runtime-composition.d.mts +0 -10
- package/dist/orchestrators/runtime-composition.mjs +0 -252
- package/dist/orchestrators/runtime-composition.mjs.map +0 -1
- package/dist/orchestrators/snapshot/capture-command.d.mts +0 -1
- package/dist/orchestrators/snapshot/capture-command.mjs +0 -25
- package/dist/orchestrators/snapshot/capture-command.mjs.map +0 -1
- package/dist/orchestrators/snapshot/pending-marker.mjs +0 -99
- package/dist/orchestrators/snapshot/pending-marker.mjs.map +0 -1
- package/dist/orchestrators/snapshot/recover-pending.mjs +0 -223
- package/dist/orchestrators/snapshot/recover-pending.mjs.map +0 -1
- package/dist/orchestrators/snapshot/state-document.d.mts +0 -1
- package/dist/orchestrators/snapshot/state-document.mjs +0 -58
- package/dist/orchestrators/snapshot/state-document.mjs.map +0 -1
- package/dist/plugins/account/spans.mjs +0 -16
- package/dist/plugins/account/spans.mjs.map +0 -1
- package/dist/plugins/account/variants/env.mjs +0 -24
- package/dist/plugins/account/variants/env.mjs.map +0 -1
- package/dist/plugins/account/variants/inline.mjs +0 -13
- package/dist/plugins/account/variants/inline.mjs.map +0 -1
- package/dist/plugins/account/variants/keystore.mjs +0 -91
- package/dist/plugins/account/variants/keystore.mjs.map +0 -1
- package/dist/plugins/action/spans.mjs +0 -11
- package/dist/plugins/action/spans.mjs.map +0 -1
- package/dist/plugins/coin/spans.mjs +0 -20
- package/dist/plugins/coin/spans.mjs.map +0 -1
- package/dist/plugins/deepbook/spans.mjs +0 -18
- package/dist/plugins/deepbook/spans.mjs.map +0 -1
- package/dist/plugins/faucet/spans.mjs +0 -12
- package/dist/plugins/faucet/spans.mjs.map +0 -1
- package/dist/plugins/package/spans.mjs +0 -14
- package/dist/plugins/package/spans.mjs.map +0 -1
- package/dist/plugins/postgres/codegen.mjs +0 -42
- package/dist/plugins/postgres/codegen.mjs.map +0 -1
- package/dist/plugins/postgres/connection.d.mts +0 -33
- package/dist/plugins/postgres/connection.mjs.map +0 -1
- package/dist/plugins/postgres/db-ensure.mjs.map +0 -1
- package/dist/plugins/postgres/errors.d.mts +0 -60
- package/dist/plugins/postgres/errors.mjs +0 -29
- package/dist/plugins/postgres/errors.mjs.map +0 -1
- package/dist/plugins/postgres/index.d.mts +0 -37
- package/dist/plugins/postgres/index.mjs +0 -68
- package/dist/plugins/postgres/index.mjs.map +0 -1
- package/dist/plugins/postgres/routable.mjs +0 -33
- package/dist/plugins/postgres/routable.mjs.map +0 -1
- package/dist/plugins/postgres/service.d.mts +0 -50
- package/dist/plugins/postgres/service.mjs +0 -179
- package/dist/plugins/postgres/service.mjs.map +0 -1
- package/dist/plugins/postgres/snapshot.mjs +0 -32
- package/dist/plugins/postgres/snapshot.mjs.map +0 -1
- package/dist/plugins/postgres/spans.mjs +0 -11
- package/dist/plugins/postgres/spans.mjs.map +0 -1
- package/dist/plugins/seal/spans.mjs +0 -18
- package/dist/plugins/seal/spans.mjs.map +0 -1
- package/dist/plugins/sui/spans.mjs +0 -17
- package/dist/plugins/sui/spans.mjs.map +0 -1
- package/dist/plugins/wallet/spans.mjs +0 -22
- package/dist/plugins/wallet/spans.mjs.map +0 -1
- package/dist/plugins/walrus/registry-publish.d.mts +0 -24
- package/dist/plugins/walrus/spans.mjs +0 -18
- package/dist/plugins/walrus/spans.mjs.map +0 -1
- package/dist/runtime/docker/logs.d.mts +0 -1
- package/dist/runtime/docker/logs.mjs +0 -34
- package/dist/runtime/docker/logs.mjs.map +0 -1
- package/dist/substrate/runtime/artifact-publisher/index.mjs +0 -86
- package/dist/substrate/runtime/artifact-publisher/index.mjs.map +0 -1
- package/dist/substrate/runtime/capability-sinks/index.d.mts +0 -1
- package/dist/substrate/runtime/capability-sinks/index.mjs +0 -3
- package/dist/substrate/runtime/capability-sinks/layer.d.mts +0 -1
- package/dist/substrate/runtime/capability-sinks/layer.mjs +0 -31
- package/dist/substrate/runtime/capability-sinks/layer.mjs.map +0 -1
- package/dist/substrate/runtime/capability-sinks/service.d.mts +0 -95
- package/dist/substrate/runtime/capability-sinks/service.mjs +0 -69
- package/dist/substrate/runtime/capability-sinks/service.mjs.map +0 -1
- package/dist/substrate/runtime/cross-process/lock.d.mts +0 -1
- package/dist/substrate/runtime/cross-process/lock.mjs +0 -23
- package/dist/substrate/runtime/cross-process/lock.mjs.map +0 -1
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +0 -113
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +0 -1
- package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs +0 -31
- package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +0 -1
- package/dist/substrate/runtime/observability/formatter-registry.d.mts +0 -1
- package/dist/substrate/runtime/observability/formatter-registry.mjs +0 -48
- package/dist/substrate/runtime/observability/formatter-registry.mjs.map +0 -1
- package/dist/substrate/runtime/observability/span-store.d.mts +0 -1
- package/dist/substrate/runtime/observability/span-store.mjs +0 -110
- package/dist/substrate/runtime/observability/span-store.mjs.map +0 -1
- package/dist/substrate/runtime/observability/spans.d.mts +0 -1
- package/dist/substrate/runtime/observability/spans.mjs +0 -87
- package/dist/substrate/runtime/observability/spans.mjs.map +0 -1
- package/dist/substrate/runtime/projection/index.mjs +0 -4
- package/dist/substrate/runtime/projection/persisted.mjs +0 -213
- package/dist/substrate/runtime/projection/persisted.mjs.map +0 -1
- package/dist/substrate/runtime/scoped-multimap/service.mjs +0 -52
- package/dist/substrate/runtime/scoped-multimap/service.mjs.map +0 -1
- package/dist/substrate/runtime/scoped-ref-map/index.mjs +0 -2
- package/dist/substrate/runtime/scoped-ref-map/service.mjs +0 -83
- package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +0 -1
- package/dist/substrate/runtime/state-store/index.mjs +0 -3
- package/dist/substrate/runtime/state-store/schema.d.mts +0 -1
- package/dist/substrate/runtime/state-store/schema.mjs +0 -41
- package/dist/substrate/runtime/state-store/schema.mjs.map +0 -1
- package/dist/substrate/runtime/state-store/service.d.mts +0 -1
- package/dist/substrate/runtime/state-store/service.mjs +0 -145
- package/dist/substrate/runtime/state-store/service.mjs.map +0 -1
- package/dist/substrate/runtime/sui-execute/index.mjs.map +0 -1
- package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +0 -1
- package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +0 -1
- package/dist/substrate/runtime/sui-move-build/index.mjs.map +0 -1
- package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +0 -151
- package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +0 -1
- package/dist/substrate/state-store.d.mts +0 -1
- /package/dist/orchestrators/{snapshot/pending-marker.d.mts → codegen/id-config.d.mts} +0 -0
- /package/dist/orchestrators/snapshot/{recover-pending.d.mts → interrupted-restore.d.mts} +0 -0
- /package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.d.mts +0 -0
- /package/dist/plugins/{postgres/snapshot.d.mts → sui/ledger/object-ref.d.mts} +0 -0
- /package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.d.mts +0 -0
- /package/dist/substrate/runtime/{state-store/index.d.mts → reconcile/graph.d.mts} +0 -0
- /package/dist/substrate/runtime/{cross-process/snapshot-reservation.d.mts → supervisor/contribution-dispatcher.d.mts} +0 -0
|
@@ -1,17 +1,142 @@
|
|
|
1
1
|
import { resolvePluginDependencies } from "../../plugin.mjs";
|
|
2
|
-
import { annotateOp, annotatePhase, withPluginSpan } from "../observability/spans.mjs";
|
|
3
|
-
import "../capability-sinks/index.mjs";
|
|
4
|
-
import { prettyErrorStructured } from "../observability/pretty-error.mjs";
|
|
5
|
-
import "../observability/index.mjs";
|
|
6
2
|
import { buildDependencyReaderFor, makeEntry, makeRegistry } from "../lifecycle/plugin-registry.mjs";
|
|
7
3
|
import { awaitUpstreams } from "../lifecycle/ready-gate.mjs";
|
|
8
4
|
import "../lifecycle/index.mjs";
|
|
5
|
+
import { prettyErrorStructured } from "../observability/pretty-error.mjs";
|
|
6
|
+
import "../observability/index.mjs";
|
|
9
7
|
import { CurrentPluginKey, CurrentPluginProgress } from "../current-plugin.mjs";
|
|
8
|
+
import { PluginContext } from "../../plugin-ctx.mjs";
|
|
9
|
+
import { StrategyRegistryService } from "../strategy-registry/service.mjs";
|
|
10
10
|
import { operationalEndpointEventsFromResolvedValue } from "../projection/operational-endpoints.mjs";
|
|
11
|
-
import { bestEffort, publish } from "./wiring.mjs";
|
|
12
|
-
import {
|
|
13
|
-
import { Cause, Context, Effect, Exit, Scope } from "effect";
|
|
11
|
+
import { OptionalService, bestEffort, noopStrategyRegistry, publish } from "./wiring.mjs";
|
|
12
|
+
import { Cause, Context, Deferred, Effect, Exit, Fiber, Scope } from "effect";
|
|
14
13
|
//#region src/substrate/runtime/supervisor/acquire-node.ts
|
|
14
|
+
/**
|
|
15
|
+
* Thrown (as a DEFECT, not a typed failure) when a plugin emits a ctx
|
|
16
|
+
* contribution AFTER its `start` returned and the buffer was sealed
|
|
17
|
+
* (PR#3). The buffer is the SOLE source of post-start contributions and
|
|
18
|
+
* is read exactly once after `start`; a late async emission — e.g. a verb
|
|
19
|
+
* called from a fiber the plugin forked but did not await — would
|
|
20
|
+
* otherwise be silently dropped (a route that never registers, a codegen
|
|
21
|
+
* file that never emits, with the plugin still `ready`). Sealing turns
|
|
22
|
+
* that silent loss into a loud, attributable crash on the OFFENDING
|
|
23
|
+
* fiber. The verb signatures return `void`, so this surfaces as a thrown
|
|
24
|
+
* defect rather than an Effect failure. */
|
|
25
|
+
var ContributionBufferSealedError = class extends Error {
|
|
26
|
+
_tag = "ContributionBufferSealedError";
|
|
27
|
+
constructor(pluginKey, kind) {
|
|
28
|
+
super(`plugin${pluginKey === null ? "" : ` '${pluginKey}'`} emitted a '${kind}' contribution after start() returned (the contribution buffer is sealed). Emit all ctx.* contributions synchronously within start(); a late async emission would be silently dropped.`);
|
|
29
|
+
this.name = "ContributionBufferSealedError";
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const strategyRegistryAccess = OptionalService(StrategyRegistryService);
|
|
33
|
+
/**
|
|
34
|
+
* Build the per-plugin `PluginCtx` + its replay buffer. The four
|
|
35
|
+
* declarative verbs (`codegen`/`endpoint`/`snapshotExtra`/`publish`) and
|
|
36
|
+
* the strategy-bus writer (`provides`) PUSH a typed `BufferedContribution`
|
|
37
|
+
* into `buffer` IN EMIT ORDER; the supervisor replays that buffer through
|
|
38
|
+
* the closed `ContributionDispatcher` after a successful `start`. The
|
|
39
|
+
* buffer is the SOLE source of post-start contributions.
|
|
40
|
+
*/
|
|
41
|
+
const makePluginCtx = (pluginKey) => {
|
|
42
|
+
const buffer = [];
|
|
43
|
+
let frozen = false;
|
|
44
|
+
const pushOrThrow = (kind, decl) => {
|
|
45
|
+
if (frozen) throw new ContributionBufferSealedError(pluginKey, kind);
|
|
46
|
+
buffer.push(decl);
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
ctx: {
|
|
50
|
+
codegen: (decl) => {
|
|
51
|
+
pushOrThrow("codegenable", decl);
|
|
52
|
+
},
|
|
53
|
+
endpoint: (decl) => {
|
|
54
|
+
pushOrThrow("routable", decl);
|
|
55
|
+
},
|
|
56
|
+
snapshotExtra: (decl) => {
|
|
57
|
+
pushOrThrow("snapshotable", decl);
|
|
58
|
+
},
|
|
59
|
+
publish: (decl) => {
|
|
60
|
+
pushOrThrow("projection", decl);
|
|
61
|
+
},
|
|
62
|
+
provides: (decl) => {
|
|
63
|
+
pushOrThrow("strategy-contributor", decl);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
buffer,
|
|
67
|
+
sealBuffer: () => {
|
|
68
|
+
frozen = true;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Render the underlying cause of a contribution-dispatch failure to a
|
|
74
|
+
* single operator-facing string. A failing dispatch body (e.g. a router
|
|
75
|
+
* route collision) may reject with an Effect `Cause`, a tagged domain
|
|
76
|
+
* error (carrying a spec-mismatch `detail`), a plain `Error`, or an
|
|
77
|
+
* arbitrary value. The plugin stays `ready`, so without this the
|
|
78
|
+
* operator would see a healthy-looking stack with dead routing.
|
|
79
|
+
*/
|
|
80
|
+
const formatCause = (cause) => {
|
|
81
|
+
if (Cause.isCause(cause)) return Cause.pretty(cause);
|
|
82
|
+
if (cause instanceof Error) return cause.stack ?? cause.message;
|
|
83
|
+
if (typeof cause === "string") return cause;
|
|
84
|
+
try {
|
|
85
|
+
return JSON.stringify(cause) ?? String(cause);
|
|
86
|
+
} catch {
|
|
87
|
+
return String(cause);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
/** Best-effort `_tag` of the failing cause for the additive `causeType`
|
|
91
|
+
* on the `dispatchFailed` event. */
|
|
92
|
+
const causeTagOf = (cause) => {
|
|
93
|
+
if (typeof cause === "object" && cause !== null && "_tag" in cause && typeof cause._tag === "string") return cause._tag;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Replay one plugin's buffered contributions through the closed
|
|
97
|
+
* `ContributionDispatcher` after a successful `start`.
|
|
98
|
+
*
|
|
99
|
+
* Failure semantics: a dispatch BODY failure is an orchestrator-fault —
|
|
100
|
+
* the supervisor publishes
|
|
101
|
+
* `engine.orchestrator.dispatchFailed` + logs a warning, and the plugin
|
|
102
|
+
* stays `ready` (NOT `markFailed`). The contribution kinds are a CLOSED
|
|
103
|
+
* union, so the dispatch is an exhaustive switch on the decl
|
|
104
|
+
* discriminant (no UnknownContributionKind arm).
|
|
105
|
+
*
|
|
106
|
+
* Runs on the plugin's scope (`pluginScope`) so any finalizer a dispatch
|
|
107
|
+
* body arms (e.g. `strategy.unregistered`) reaps on plugin teardown.
|
|
108
|
+
*/
|
|
109
|
+
const dispatchBufferedContributions = (pluginKey, buffer, pluginContext, pluginScope, dispatcher, ref, hub) => Effect.gen(function* () {
|
|
110
|
+
const dispatchCtx = {
|
|
111
|
+
pluginKey,
|
|
112
|
+
publish: (event) => publish(ref, hub, event),
|
|
113
|
+
strategyRegistry: strategyRegistryAccess.read(pluginContext, noopStrategyRegistry)
|
|
114
|
+
};
|
|
115
|
+
for (const decl of buffer) {
|
|
116
|
+
const guarded = (() => {
|
|
117
|
+
switch (decl.kind) {
|
|
118
|
+
case "snapshotable": return dispatcher.snapshotable(decl, dispatchCtx);
|
|
119
|
+
case "codegenable": return dispatcher.codegenable(decl, dispatchCtx);
|
|
120
|
+
case "routable": return dispatcher.routable(decl, dispatchCtx);
|
|
121
|
+
case "projection": return dispatcher.projection(decl, dispatchCtx);
|
|
122
|
+
case "strategy-contributor": return dispatcher.strategyContributor(decl, dispatchCtx);
|
|
123
|
+
default: return Effect.void;
|
|
124
|
+
}
|
|
125
|
+
})().pipe(Effect.catch((cause) => Effect.gen(function* () {
|
|
126
|
+
const causeType = causeTagOf(cause);
|
|
127
|
+
yield* publish(ref, hub, {
|
|
128
|
+
tag: "engine.orchestrator.dispatchFailed",
|
|
129
|
+
pluginKey,
|
|
130
|
+
kind: decl.kind,
|
|
131
|
+
message: `routing/contribution sink '${decl.kind}' failed`,
|
|
132
|
+
...causeType === void 0 ? {} : { causeType },
|
|
133
|
+
at: Date.now()
|
|
134
|
+
});
|
|
135
|
+
yield* Effect.logWarning(`routing/contribution sink '${decl.kind}' failed for plugin '${pluginKey}': ${formatCause(cause)}`);
|
|
136
|
+
})));
|
|
137
|
+
yield* Scope.provide(guarded, pluginScope);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
15
140
|
const buildRegistry = (graph, parentScope, emit) => Effect.gen(function* () {
|
|
16
141
|
const entries = /* @__PURE__ */ new Map();
|
|
17
142
|
for (const [key, node] of graph.nodes) {
|
|
@@ -40,7 +165,7 @@ const buildRegistry = (graph, parentScope, emit) => Effect.gen(function* () {
|
|
|
40
165
|
* fiber surfaces the union via `Fiber.join` when the user asks for
|
|
41
166
|
* "stack ready or err".
|
|
42
167
|
*/
|
|
43
|
-
const acquireNode = (registry, key, ref, hub, pluginContext,
|
|
168
|
+
const acquireNode = (registry, key, ref, hub, pluginContext, dispatcher, logger, _identity) => Effect.gen(function* () {
|
|
44
169
|
const entry = registry.entries.get(key);
|
|
45
170
|
if (entry === void 0) return;
|
|
46
171
|
if ((yield* awaitUpstreams(registry, entry.node).pipe(Effect.matchEffect({
|
|
@@ -56,7 +181,6 @@ const acquireNode = (registry, key, ref, hub, pluginContext, sinks, logger, iden
|
|
|
56
181
|
});
|
|
57
182
|
return;
|
|
58
183
|
}
|
|
59
|
-
yield* annotatePhase("acquire");
|
|
60
184
|
yield* logger.log(`supervisor/${key}`, key, {
|
|
61
185
|
level: "debug",
|
|
62
186
|
message: "plugin acquire start",
|
|
@@ -66,7 +190,8 @@ const acquireNode = (registry, key, ref, hub, pluginContext, sinks, logger, iden
|
|
|
66
190
|
const readDependency = buildDependencyReaderFor(registry, entry.node);
|
|
67
191
|
const deps = resolvePluginDependencies(entry.node.member, readDependency);
|
|
68
192
|
const start = entry.node.member.start;
|
|
69
|
-
const
|
|
193
|
+
const { ctx: pluginCtx, buffer, sealBuffer } = makePluginCtx(key);
|
|
194
|
+
const currentPluginContext = pluginContext.pipe(Context.add(CurrentPluginKey, { key }), Context.add(PluginContext, pluginCtx), Context.add(CurrentPluginProgress, { setPhase: (phase) => publish(ref, hub, {
|
|
70
195
|
tag: "lifecycle.phaseSet",
|
|
71
196
|
pluginKey: key,
|
|
72
197
|
phase,
|
|
@@ -91,33 +216,10 @@ const acquireNode = (registry, key, ref, hub, pluginContext, sinks, logger, iden
|
|
|
91
216
|
value
|
|
92
217
|
})
|
|
93
218
|
}));
|
|
219
|
+
sealBuffer();
|
|
94
220
|
if (result.ok) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
chain: identity.chain,
|
|
98
|
-
runtimeRoot
|
|
99
|
-
};
|
|
100
|
-
const capsExit = yield* Effect.exit(resolveCapabilities(key, entry.node.member.capabilities, result.value, acquireContext));
|
|
101
|
-
if (Exit.isFailure(capsExit)) {
|
|
102
|
-
yield* bestEffort(registry.markFailed(key, capsExit.cause));
|
|
103
|
-
yield* publish(ref, hub, {
|
|
104
|
-
tag: "error.reported",
|
|
105
|
-
error: prettyErrorStructured(capsExit.cause, {
|
|
106
|
-
pluginKey: key,
|
|
107
|
-
severity: "error",
|
|
108
|
-
at: Date.now()
|
|
109
|
-
})
|
|
110
|
-
});
|
|
111
|
-
yield* logger.log(`supervisor/${key}`, key, {
|
|
112
|
-
level: "error",
|
|
113
|
-
message: "plugin capability factory failed"
|
|
114
|
-
});
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const caps = capsExit.value;
|
|
118
|
-
const errorContributions = entry.node.member.errorContributions ?? [];
|
|
119
|
-
if (caps.length > 0 || errorContributions.length > 0) {
|
|
120
|
-
const dispatchExit = yield* Effect.exit(dispatchContributions(key, caps, errorContributions, entry.node.member.role, identity, pluginContext, entry.scope, sinks, ref, hub));
|
|
221
|
+
if (buffer.length > 0) {
|
|
222
|
+
const dispatchExit = yield* Effect.exit(dispatchBufferedContributions(key, buffer, pluginContext, entry.scope, dispatcher, ref, hub));
|
|
121
223
|
if (Exit.isFailure(dispatchExit)) {
|
|
122
224
|
yield* bestEffort(registry.markFailed(key, dispatchExit.cause));
|
|
123
225
|
yield* publish(ref, hub, {
|
|
@@ -135,7 +237,7 @@ const acquireNode = (registry, key, ref, hub, pluginContext, sinks, logger, iden
|
|
|
135
237
|
return;
|
|
136
238
|
}
|
|
137
239
|
}
|
|
138
|
-
const routablesPresent =
|
|
240
|
+
const routablesPresent = buffer.some((decl) => decl.kind === "routable");
|
|
139
241
|
for (const event of operationalEndpointEventsFromResolvedValue(key, result.value, Date.now(), { routablesPresent })) yield* publish(ref, hub, event);
|
|
140
242
|
yield* publish(ref, hub, {
|
|
141
243
|
tag: "lifecycle.phaseSet",
|
|
@@ -148,33 +250,63 @@ const acquireNode = (registry, key, ref, hub, pluginContext, sinks, logger, iden
|
|
|
148
250
|
yield* logger.log(`supervisor/${key}`, key, {
|
|
149
251
|
level: "debug",
|
|
150
252
|
message: entry.node.member.role === "task" ? "plugin done" : "plugin ready",
|
|
151
|
-
fields: {
|
|
152
|
-
capabilities: caps.length,
|
|
153
|
-
errorContributions: errorContributions.length
|
|
154
|
-
}
|
|
253
|
+
fields: { contributions: buffer.length }
|
|
155
254
|
});
|
|
156
255
|
} else yield* logger.log(`supervisor/${key}`, key, {
|
|
157
256
|
level: "debug",
|
|
158
257
|
message: "plugin acquire failed"
|
|
159
258
|
});
|
|
160
|
-
})
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
pluginKey
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
259
|
+
});
|
|
260
|
+
var PluginAcquireInterruptedBeforeReady = class extends Error {
|
|
261
|
+
pluginKey;
|
|
262
|
+
_tag = "PluginAcquireInterruptedBeforeReady";
|
|
263
|
+
constructor(pluginKey) {
|
|
264
|
+
super(`plugin '${pluginKey}' acquire was interrupted before readiness`);
|
|
265
|
+
this.pluginKey = pluginKey;
|
|
266
|
+
this.name = "PluginAcquireInterruptedBeforeReady";
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
const failIfAcquireInterruptedBeforeReady = (registry, key, entry) => Effect.gen(function* () {
|
|
270
|
+
if (registry.entries.get(key) !== entry) return;
|
|
271
|
+
const status = yield* registry.getStatus(key).pipe(Effect.catch(() => Effect.succeed(null)));
|
|
272
|
+
if (registry.entries.get(key) !== entry) return;
|
|
273
|
+
if (status !== "pending" && status !== "acquiring") return;
|
|
274
|
+
yield* bestEffort(registry.markFailed(key, new PluginAcquireInterruptedBeforeReady(key)));
|
|
275
|
+
});
|
|
276
|
+
const acquireKeys = (registry, keys, ref, hub, pluginContext, dispatcher, logger, identity, parentScope) => Effect.gen(function* () {
|
|
277
|
+
const fibers = yield* Effect.all(keys.map((key) => Effect.gen(function* () {
|
|
278
|
+
const entry = registry.entries.get(key);
|
|
279
|
+
if (entry === void 0) return yield* Effect.forkIn(Effect.void, parentScope);
|
|
280
|
+
const registeredGate = yield* Deferred.make();
|
|
281
|
+
const readyToRegister = yield* Deferred.make();
|
|
282
|
+
const guarded = Effect.gen(function* () {
|
|
283
|
+
const selfId = yield* Effect.fiberId;
|
|
284
|
+
yield* Effect.gen(function* () {
|
|
285
|
+
yield* Deferred.succeed(readyToRegister, void 0);
|
|
286
|
+
yield* Deferred.await(registeredGate);
|
|
287
|
+
yield* acquireNode(registry, key, ref, hub, pluginContext, dispatcher, logger, identity);
|
|
288
|
+
}).pipe(Effect.onInterrupt(() => failIfAcquireInterruptedBeforeReady(registry, key, entry)), Effect.ensuring(registry.clearAcquireFiberIfEntry(key, entry, selfId).pipe(Effect.catch(() => Effect.void))));
|
|
289
|
+
});
|
|
290
|
+
const fiber = yield* Effect.forkIn(Scope.provide(guarded, parentScope), parentScope);
|
|
291
|
+
yield* Deferred.await(readyToRegister);
|
|
292
|
+
if (!(yield* registry.setAcquireFiberIfEntry(key, entry, fiber).pipe(Effect.catch(() => Effect.succeed(false))))) {
|
|
293
|
+
yield* Fiber.interrupt(fiber).pipe(Effect.asVoid);
|
|
294
|
+
return fiber;
|
|
295
|
+
}
|
|
296
|
+
yield* Deferred.succeed(registeredGate, void 0);
|
|
297
|
+
return fiber;
|
|
298
|
+
})), { concurrency: "unbounded" });
|
|
299
|
+
yield* Effect.all(fibers.map((fiber) => Fiber.await(fiber).pipe(Effect.flatMap((exit) => {
|
|
300
|
+
if (Exit.isSuccess(exit) || Cause.hasInterruptsOnly(exit.cause)) return Effect.void;
|
|
301
|
+
return Effect.failCause(exit.cause);
|
|
302
|
+
}))), {
|
|
170
303
|
concurrency: "unbounded",
|
|
171
304
|
discard: true
|
|
172
305
|
});
|
|
173
|
-
})
|
|
174
|
-
const acquireFullGraph = (graph, registry, ref, hub, pluginContext,
|
|
175
|
-
yield*
|
|
176
|
-
|
|
177
|
-
}).pipe(Effect.withSpan("lifecycle.supervisor.acquireFullGraph"));
|
|
306
|
+
});
|
|
307
|
+
const acquireFullGraph = (graph, registry, ref, hub, pluginContext, dispatcher, logger, identity, parentScope) => Effect.gen(function* () {
|
|
308
|
+
yield* acquireKeys(registry, [...graph.nodes.keys()], ref, hub, pluginContext, dispatcher, logger, identity, parentScope);
|
|
309
|
+
});
|
|
178
310
|
//#endregion
|
|
179
311
|
export { acquireFullGraph, acquireKeys, buildRegistry };
|
|
180
312
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acquire-node.mjs","names":[],"sources":["../../../../src/substrate/runtime/supervisor/acquire-node.ts"],"sourcesContent":["// Per-plugin acquire pipeline.\n//\n// Three entrypoints:\n// - `buildRegistry(graph, parentScope, emit)` — boots the plugin\n// registry from a resolved graph; each plugin's scope is parented\n// to the supervisor's outer scope.\n// - `acquireNode(...)` — runs one plugin's `start` body inside its\n// entry scope; on success harvests `capabilities` +\n// `errorContributions` and registers them through `CapabilitySinks`.\n// - `acquireKeys` / `acquireFullGraph` — fan out per-node acquires\n// in parallel; each node waits on its own upstream ready gate.\n\nimport { Cause, Context, Effect, Exit, Queue, Scope, SubscriptionRef } from 'effect';\n\nimport type { CapabilityDecl } from '../../../contracts/capability-decl.ts';\nimport type { PluginKey } from '../../brand.ts';\nimport type { EngineEvent } from '../../events.ts';\nimport type { Identity } from '../../identity.ts';\nimport type { LifecycleStatus } from '../../lifecycle.ts';\nimport { resolvePluginDependencies, type AcquireContext } from '../../plugin.ts';\nimport type { SubscribableState } from '../../projection.ts';\nimport { type CapabilitySinksShape } from '../capability-sinks/index.ts';\nimport { CurrentPluginKey, CurrentPluginProgress } from '../current-plugin.ts';\nimport {\n\tannotateOp,\n\tannotatePhase,\n\tprettyErrorStructured,\n\twithPluginSpan,\n\ttype LoggerShape,\n} from '../observability/index.ts';\nimport {\n\tawaitUpstreams,\n\tbuildDependencyReaderFor,\n\tmakeEntry,\n\tmakeRegistry,\n\ttype PluginEntry,\n\ttype PluginRegistry,\n\ttype ResolvedGraph,\n} from '../lifecycle/index.ts';\nimport { operationalEndpointEventsFromResolvedValue } from '../projection/operational-endpoints.ts';\nimport { dispatchContributions, resolveCapabilities } from './dispatch-contributions.ts';\nimport { bestEffort, publish } from './wiring.ts';\n\n// -----------------------------------------------------------------------------\n// Boot the registry from a graph\n// -----------------------------------------------------------------------------\n\nexport const buildRegistry = (\n\tgraph: ResolvedGraph,\n\tparentScope: Scope.Scope,\n\temit: (key: PluginKey, from: LifecycleStatus, to: LifecycleStatus) => Effect.Effect<void>,\n): Effect.Effect<PluginRegistry, never, never> =>\n\tEffect.gen(function* () {\n\t\tconst entries = new Map<PluginKey, PluginEntry>();\n\t\tfor (const [key, node] of graph.nodes) {\n\t\t\tconst entry = yield* makeEntry(node, parentScope);\n\t\t\tentries.set(key, entry);\n\t\t}\n\t\treturn makeRegistry(entries, emit);\n\t});\n\n// -----------------------------------------------------------------------------\n// Acquire one node\n// -----------------------------------------------------------------------------\n\n/**\n * Run one node's `start` under its own scope. Steps:\n * 1. Await upstreams (their ready-gates).\n * 2. Transition `pending → acquiring` (publishes the event).\n * 3. Build resolved dependency values from declared resource refs.\n * 4. Run the plugin's `start` Effect inside the entry's Scope,\n * after providing the substrate-context services bundle so the\n * plugin's R-channel yields (`IdentityContext`,\n * `ContainerRuntimeService`, etc.) resolve to live instances.\n * 5. On success: stash the resolved value + `markReady` (publishes\n * the `ready` transition).\n * 6. On failure: `markFailed` (publishes the `failed` transition, fails\n * the deferred so downstream consumers short-circuit).\n *\n * Errors are caught and stashed onto the registry entry — the outer\n * scheduler doesn't propagate per-plugin failures; ready-gate failure\n * propagation handles the downstream blocking. The supervisor's outer\n * fiber surfaces the union via `Fiber.join` when the user asks for\n * \"stack ready or err\".\n */\nexport const acquireNode = (\n\tregistry: PluginRegistry,\n\tkey: PluginKey,\n\tref: SubscriptionRef.SubscriptionRef<SubscribableState>,\n\thub: Queue.Enqueue<EngineEvent>,\n\tpluginContext: Context.Context<never>,\n\tsinks: CapabilitySinksShape,\n\tlogger: LoggerShape,\n\tidentity: Identity,\n\truntimeRoot: string,\n): Effect.Effect<void, never, never> =>\n\tEffect.gen(function* () {\n\t\tconst entry = registry.entries.get(key);\n\t\tif (entry === undefined) return;\n\t\tconst upstreamWait = awaitUpstreams(registry, entry.node).pipe(\n\t\t\tEffect.matchEffect({\n\t\t\t\tonFailure: (cause) =>\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tyield* bestEffort(registry.markFailed(key, cause));\n\t\t\t\t\t\treturn false as const;\n\t\t\t\t\t}),\n\t\t\t\tonSuccess: () => Effect.succeed(true as const),\n\t\t\t}),\n\t\t);\n\t\tconst ok = yield* upstreamWait;\n\t\tif (ok !== true) {\n\t\t\tyield* logger.log(`supervisor/${key}`, key, {\n\t\t\t\tlevel: 'warn',\n\t\t\t\tmessage: 'plugin acquire skipped — upstream failed',\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tyield* annotatePhase('acquire');\n\t\tyield* logger.log(`supervisor/${key}`, key, {\n\t\t\tlevel: 'debug',\n\t\t\tmessage: 'plugin acquire start',\n\t\t\tfields: { role: entry.node.member.role },\n\t\t});\n\t\t// Best-effort claim. `transition` `Effect.die`s on an off-table move,\n\t\t// which a concurrent acquire can trigger: an in-flight initial\n\t\t// `acquireNode` racing a selective-restart re-acquire of the same key\n\t\t// hits `acquiring → acquiring`. `Effect.catch` (used originally here)\n\t\t// cannot catch that DEFECT, so it would escape and kill the\n\t\t// command-loop fiber (supervisor wedge — same class as the lifecycle\n\t\t// reset fix). `Effect.exit` swallows BOTH failure and defect, keeping\n\t\t// this the best-effort transition it was always meant to be.\n\t\t// NOTE: this prevents the wedge but not the underlying double-acquire\n\t\t// (two fibers running one node's `start`). A complete fix must\n\t\t// interrupt a node's in-flight acquire fiber before a restart\n\t\t// re-acquires it — tracked as a follow-up (needs per-node acquire-fiber\n\t\t// handles, which `acquireKeys`' `Effect.all` does not retain today).\n\t\tyield* Effect.exit(registry.transition(key, 'acquiring'));\n\t\tconst readDependency = buildDependencyReaderFor(registry, entry.node);\n\t\tconst deps = resolvePluginDependencies(entry.node.member, readDependency);\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst start = entry.node.member.start as (\n\t\t\tdeps: unknown,\n\t\t) => Effect.Effect<unknown, unknown, any>;\n\t\tconst currentPluginContext = pluginContext.pipe(\n\t\t\tContext.add(CurrentPluginKey, { key }),\n\t\t\tContext.add(CurrentPluginProgress, {\n\t\t\t\tsetPhase: (phase) =>\n\t\t\t\t\tpublish(ref, hub, {\n\t\t\t\t\t\ttag: 'lifecycle.phaseSet',\n\t\t\t\t\t\tpluginKey: key,\n\t\t\t\t\t\tphase,\n\t\t\t\t\t\tat: Date.now(),\n\t\t\t\t\t}),\n\t\t\t}),\n\t\t);\n\t\tconst providedAcquire = Effect.provide(start(deps), currentPluginContext) as Effect.Effect<\n\t\t\tunknown,\n\t\t\tunknown,\n\t\t\tScope.Scope\n\t\t>;\n\t\tconst result = yield* Scope.provide(providedAcquire, entry.scope).pipe(\n\t\t\tEffect.matchEffect({\n\t\t\t\tonFailure: (cause) =>\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tyield* bestEffort(registry.markFailed(key, cause));\n\t\t\t\t\t\tyield* publish(ref, hub, {\n\t\t\t\t\t\t\ttag: 'error.reported',\n\t\t\t\t\t\t\terror: prettyErrorStructured(Cause.fail(cause), {\n\t\t\t\t\t\t\t\tpluginKey: key,\n\t\t\t\t\t\t\t\tseverity: 'error',\n\t\t\t\t\t\t\t\tat: Date.now(),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn { ok: false as const };\n\t\t\t\t\t}),\n\t\t\t\tonSuccess: (value: unknown) =>\n\t\t\t\t\tEffect.succeed({ ok: true as const, value: value as unknown }),\n\t\t\t}),\n\t\t);\n\t\tif (result.ok) {\n\t\t\tconst acquireContext: AcquireContext = {\n\t\t\t\tidentity,\n\t\t\t\tchain: identity.chain,\n\t\t\t\truntimeRoot,\n\t\t\t};\n\t\t\tconst capsExit = yield* Effect.exit(\n\t\t\t\tresolveCapabilities(\n\t\t\t\t\tkey,\n\t\t\t\t\tentry.node.member.capabilities as\n\t\t\t\t\t\t| ReadonlyArray<CapabilityDecl>\n\t\t\t\t\t\t| ((r: unknown, c: AcquireContext) => ReadonlyArray<CapabilityDecl>)\n\t\t\t\t\t\t| undefined,\n\t\t\t\t\tresult.value,\n\t\t\t\t\tacquireContext,\n\t\t\t\t),\n\t\t\t);\n\t\t\tif (Exit.isFailure(capsExit)) {\n\t\t\t\tyield* bestEffort(registry.markFailed(key, capsExit.cause));\n\t\t\t\tyield* publish(ref, hub, {\n\t\t\t\t\ttag: 'error.reported',\n\t\t\t\t\terror: prettyErrorStructured(capsExit.cause, {\n\t\t\t\t\t\tpluginKey: key,\n\t\t\t\t\t\tseverity: 'error',\n\t\t\t\t\t\tat: Date.now(),\n\t\t\t\t\t}),\n\t\t\t\t});\n\t\t\t\tyield* logger.log(`supervisor/${key}`, key, {\n\t\t\t\t\tlevel: 'error',\n\t\t\t\t\tmessage: 'plugin capability factory failed',\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst caps = capsExit.value;\n\t\t\tconst errorContributions = entry.node.member.errorContributions ?? [];\n\t\t\tif (caps.length > 0 || errorContributions.length > 0) {\n\t\t\t\tconst dispatchExit = yield* Effect.exit(\n\t\t\t\t\tdispatchContributions(\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tcaps,\n\t\t\t\t\t\terrorContributions,\n\t\t\t\t\t\tentry.node.member.role,\n\t\t\t\t\t\tidentity,\n\t\t\t\t\t\tpluginContext,\n\t\t\t\t\t\tentry.scope,\n\t\t\t\t\t\tsinks,\n\t\t\t\t\t\tref,\n\t\t\t\t\t\thub,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tif (Exit.isFailure(dispatchExit)) {\n\t\t\t\t\t// dispatchContributions catches both UnknownContributionKind\n\t\t\t\t\t// (no-op) and ContributionSinkFailed (orchestrator event +\n\t\t\t\t\t// warning) internally. A surfaced failure here therefore\n\t\t\t\t\t// reflects an unexpected defect — keep the legacy\n\t\t\t\t\t// markFailed projection so the unknown shape doesn't\n\t\t\t\t\t// silently degrade the plugin.\n\t\t\t\t\tyield* bestEffort(registry.markFailed(key, dispatchExit.cause));\n\t\t\t\t\tyield* publish(ref, hub, {\n\t\t\t\t\t\ttag: 'error.reported',\n\t\t\t\t\t\terror: prettyErrorStructured(dispatchExit.cause, {\n\t\t\t\t\t\t\tpluginKey: key,\n\t\t\t\t\t\t\tseverity: 'error',\n\t\t\t\t\t\t\tat: Date.now(),\n\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t\tyield* logger.log(`supervisor/${key}`, key, {\n\t\t\t\t\t\tlevel: 'error',\n\t\t\t\t\t\tmessage: 'plugin capability dispatch failed',\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst routablesPresent = caps.some((capability) => capability.kind === 'routable');\n\t\t\tfor (const event of operationalEndpointEventsFromResolvedValue(\n\t\t\t\tkey,\n\t\t\t\tresult.value,\n\t\t\t\tDate.now(),\n\t\t\t\t{\n\t\t\t\t\troutablesPresent,\n\t\t\t\t},\n\t\t\t)) {\n\t\t\t\tyield* publish(ref, hub, event);\n\t\t\t}\n\t\t\tyield* publish(ref, hub, {\n\t\t\t\ttag: 'lifecycle.phaseSet',\n\t\t\t\tpluginKey: key,\n\t\t\t\tphase: null,\n\t\t\t\tat: Date.now(),\n\t\t\t});\n\t\t\tyield* bestEffort(registry.markReady(key, result.value));\n\t\t\tif (entry.node.member.role === 'task') {\n\t\t\t\tyield* bestEffort(registry.transition(key, 'done'));\n\t\t\t}\n\t\t\tyield* logger.log(`supervisor/${key}`, key, {\n\t\t\t\tlevel: 'debug',\n\t\t\t\tmessage: entry.node.member.role === 'task' ? 'plugin done' : 'plugin ready',\n\t\t\t\tfields: {\n\t\t\t\t\tcapabilities: caps.length,\n\t\t\t\t\terrorContributions: errorContributions.length,\n\t\t\t\t},\n\t\t\t});\n\t\t} else {\n\t\t\tyield* logger.log(`supervisor/${key}`, key, {\n\t\t\t\tlevel: 'debug',\n\t\t\t\tmessage: 'plugin acquire failed',\n\t\t\t});\n\t\t}\n\t}).pipe(\n\t\twithPluginSpan('lifecycle.supervisor.acquireNode', {\n\t\t\tapp: identity.app,\n\t\t\tstack: identity.stack,\n\t\t\tnetwork: identity.chain,\n\t\t\tpluginKey: key,\n\t\t\trole: registry.entries.get(key)?.node.member.role ?? 'service',\n\t\t}),\n\t);\n\n// -----------------------------------------------------------------------------\n// Acquire a key set in parallel. Each node waits on its own upstreams,\n// so downstream nodes begin as soon as their dependencies are ready\n// instead of waiting for unrelated nodes in the same topological level.\n// -----------------------------------------------------------------------------\n\nexport const acquireKeys = (\n\tregistry: PluginRegistry,\n\tkeys: ReadonlyArray<PluginKey>,\n\tref: SubscriptionRef.SubscriptionRef<SubscribableState>,\n\thub: Queue.Enqueue<EngineEvent>,\n\tpluginContext: Context.Context<never>,\n\tsinks: CapabilitySinksShape,\n\tlogger: LoggerShape,\n\tidentity: Identity,\n\truntimeRoot: string,\n): Effect.Effect<void, never, never> =>\n\tEffect.gen(function* () {\n\t\tyield* Effect.annotateCurrentSpan({ 'devstack.level.size': keys.length });\n\t\tyield* Effect.all(\n\t\t\tkeys.map((key) =>\n\t\t\t\tacquireNode(registry, key, ref, hub, pluginContext, sinks, logger, identity, runtimeRoot),\n\t\t\t),\n\t\t\t{ concurrency: 'unbounded', discard: true },\n\t\t);\n\t}).pipe(Effect.withSpan('lifecycle.supervisor.acquireKeys'));\n\nexport const acquireFullGraph = (\n\tgraph: ResolvedGraph,\n\tregistry: PluginRegistry,\n\tref: SubscriptionRef.SubscriptionRef<SubscribableState>,\n\thub: Queue.Enqueue<EngineEvent>,\n\tpluginContext: Context.Context<never>,\n\tsinks: CapabilitySinksShape,\n\tlogger: LoggerShape,\n\tidentity: Identity,\n\truntimeRoot: string,\n): Effect.Effect<void, never, never> =>\n\tEffect.gen(function* () {\n\t\tyield* annotateOp('acquireFullGraph');\n\t\tyield* acquireKeys(\n\t\t\tregistry,\n\t\t\t[...graph.nodes.keys()],\n\t\t\tref,\n\t\t\thub,\n\t\t\tpluginContext,\n\t\t\tsinks,\n\t\t\tlogger,\n\t\t\tidentity,\n\t\t\truntimeRoot,\n\t\t);\n\t}).pipe(Effect.withSpan('lifecycle.supervisor.acquireFullGraph'));\n"],"mappings":";;;;;;;;;;;;;;AA+CA,MAAa,iBACZ,OACA,aACA,SAEA,OAAO,IAAI,aAAa;CACvB,MAAM,0BAAU,IAAI,KAA6B;AACjD,MAAK,MAAM,CAAC,KAAK,SAAS,MAAM,OAAO;EACtC,MAAM,QAAQ,OAAO,UAAU,MAAM,YAAY;AACjD,UAAQ,IAAI,KAAK,MAAM;;AAExB,QAAO,aAAa,SAAS,KAAK;EACjC;;;;;;;;;;;;;;;;;;;;;AA0BH,MAAa,eACZ,UACA,KACA,KACA,KACA,eACA,OACA,QACA,UACA,gBAEA,OAAO,IAAI,aAAa;CACvB,MAAM,QAAQ,SAAS,QAAQ,IAAI,IAAI;AACvC,KAAI,UAAU,KAAA,EAAW;AAYzB,MAAI,OAXiB,eAAe,UAAU,MAAM,KAAK,CAAC,KACzD,OAAO,YAAY;EAClB,YAAY,UACX,OAAO,IAAI,aAAa;AACvB,UAAO,WAAW,SAAS,WAAW,KAAK,MAAM,CAAC;AAClD,UAAO;IACN;EACH,iBAAiB,OAAO,QAAQ,KAAc;EAC9C,CAAC,CAE2B,MACnB,M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ACF,SAAO,WAAW,SAAS,UAAU,KAAK,OAAO,MAAM,CAAC;AACxD,MAAI,MAAM,KAAK,OAAO,SAAS,OAC9B,QAAO,WAAW,SAAS,WAAW,KAAK,OAAO,CAAC;AAEpD,SAAO,OAAO,IAAI,cAAc,OAAO,KAAK;GAC3C,OAAO;GACP,SAAS,MAAM,KAAK,OAAO,SAAS,SAAS,gBAAgB;GAC7D,QAAQ;IACP,cAAc,KAAK;IACnB,oBAAoB,mBAAmB;IACvC;GACD,CAAC;OAEF,QAAO,OAAO,IAAI,cAAc,OAAO,KAAK;EAC3C,OAAO;EACP,SAAS;EACT,CAAC;EAEF,CAAC,KACF,eAAe,oCAAoC;CAClD,KAAK,SAAS;CACd,OAAO,SAAS;CAChB,SAAS,SAAS;CAClB,WAAW;CACX,MAAM,SAAS,QAAQ,IAAI,IAAI,EAAE,KAAK,OAAO,QAAQ;CACrD,CAAC,CACF;AAQF,MAAa,eACZ,UACA,MACA,KACA,KACA,eACA,OACA,QACA,UACA,gBAEA,OAAO,IAAI,aAAa;AACvB,QAAO,OAAO,oBAAoB,EAAE,uBAAuB,KAAK,QAAQ,CAAC;AACzE,QAAO,OAAO,IACb,KAAK,KAAK,QACT,YAAY,UAAU,KAAK,KAAK,KAAK,eAAe,OAAO,QAAQ,UAAU,YAAY,CACzF,EACD;EAAE,aAAa;EAAa,SAAS;EAAM,CAC3C;EACA,CAAC,KAAK,OAAO,SAAS,mCAAmC,CAAC;AAE7D,MAAa,oBACZ,OACA,UACA,KACA,KACA,eACA,OACA,QACA,UACA,gBAEA,OAAO,IAAI,aAAa;AACvB,QAAO,WAAW,mBAAmB;AACrC,QAAO,YACN,UACA,CAAC,GAAG,MAAM,MAAM,MAAM,CAAC,EACvB,KACA,KACA,eACA,OACA,QACA,UACA,YACA;EACA,CAAC,KAAK,OAAO,SAAS,wCAAwC,CAAC"}
|
|
1
|
+
{"version":3,"file":"acquire-node.mjs","names":[],"sources":["../../../../src/substrate/runtime/supervisor/acquire-node.ts"],"sourcesContent":["// Per-plugin acquire pipeline.\n//\n// Three entrypoints:\n// - `buildRegistry(graph, parentScope, emit)` — boots the plugin\n// registry from a resolved graph; each plugin's scope is parented\n// to the supervisor's outer scope.\n// - `acquireNode(...)` — runs one plugin's `start` body inside its\n// entry scope; on success replays the ctx-buffered contributions\n// through the closed `ContributionDispatcher`.\n// - `acquireKeys` / `acquireFullGraph` — fan out per-node acquires\n// in parallel; each node waits on its own upstream ready gate.\n\nimport {\n\tCause,\n\tContext,\n\tDeferred,\n\tEffect,\n\tExit,\n\tFiber,\n\tQueue,\n\tScope,\n\tSubscriptionRef,\n} from 'effect';\n\nimport type { CodegenableDecl } from '../../../contracts/codegenable.ts';\nimport type { ProjectionDecl } from '../../../contracts/projection.ts';\nimport type { RoutableDecl } from '../../../contracts/routable.ts';\nimport type { SnapshotableDecl } from '../../../contracts/snapshotable.ts';\nimport type { StrategyContributorDecl } from '../../../contracts/strategy-contributor.ts';\nimport type { PluginKey } from '../../brand.ts';\nimport type { EngineEvent } from '../../events.ts';\nimport type { Identity } from '../../identity.ts';\nimport type { LifecycleStatus } from '../../lifecycle.ts';\nimport type { PluginCtx } from '../../plugin-ctx.ts';\nimport { PluginContext } from '../../plugin-ctx.ts';\nimport { resolvePluginDependencies } from '../../plugin.ts';\nimport type { SubscribableState } from '../../projection.ts';\nimport { StrategyRegistryService } from '../strategy-registry/service.ts';\nimport { CurrentPluginKey, CurrentPluginProgress } from '../current-plugin.ts';\nimport { prettyErrorStructured, type LoggerShape } from '../observability/index.ts';\nimport {\n\tawaitUpstreams,\n\tbuildDependencyReaderFor,\n\tmakeEntry,\n\tmakeRegistry,\n\ttype PluginEntry,\n\ttype PluginRegistry,\n\ttype ResolvedGraph,\n} from '../lifecycle/index.ts';\nimport { operationalEndpointEventsFromResolvedValue } from '../projection/operational-endpoints.ts';\nimport type {\n\tContributionDispatcher,\n\tContributionDispatchContext,\n} from './contribution-dispatcher.ts';\nimport { bestEffort, noopStrategyRegistry, OptionalService, publish } from './wiring.ts';\n\n// A single buffered contribution — a discriminated union over the five\n// closed decl kinds, in the order the plugin's `start` emitted them.\ntype BufferedContribution =\n\t| SnapshotableDecl\n\t| CodegenableDecl<string>\n\t| RoutableDecl\n\t| ProjectionDecl\n\t| StrategyContributorDecl<string, unknown>;\n\n/**\n * Thrown (as a DEFECT, not a typed failure) when a plugin emits a ctx\n * contribution AFTER its `start` returned and the buffer was sealed\n * (PR#3). The buffer is the SOLE source of post-start contributions and\n * is read exactly once after `start`; a late async emission — e.g. a verb\n * called from a fiber the plugin forked but did not await — would\n * otherwise be silently dropped (a route that never registers, a codegen\n * file that never emits, with the plugin still `ready`). Sealing turns\n * that silent loss into a loud, attributable crash on the OFFENDING\n * fiber. The verb signatures return `void`, so this surfaces as a thrown\n * defect rather than an Effect failure. */\nexport class ContributionBufferSealedError extends Error {\n\treadonly _tag = 'ContributionBufferSealedError' as const;\n\tconstructor(pluginKey: PluginKey | null, kind: string) {\n\t\tsuper(\n\t\t\t`plugin${pluginKey === null ? '' : ` '${pluginKey}'`} emitted a '${kind}' contribution ` +\n\t\t\t\t`after start() returned (the contribution buffer is sealed). Emit all ctx.* ` +\n\t\t\t\t`contributions synchronously within start(); a late async emission would be ` +\n\t\t\t\t`silently dropped.`,\n\t\t);\n\t\tthis.name = 'ContributionBufferSealedError';\n\t}\n}\n\n// -----------------------------------------------------------------------------\n// Per-plugin PluginCtx\n// -----------------------------------------------------------------------------\n\nconst strategyRegistryAccess = OptionalService(StrategyRegistryService);\n\n/**\n * Build the per-plugin `PluginCtx` + its replay buffer. The four\n * declarative verbs (`codegen`/`endpoint`/`snapshotExtra`/`publish`) and\n * the strategy-bus writer (`provides`) PUSH a typed `BufferedContribution`\n * into `buffer` IN EMIT ORDER; the supervisor replays that buffer through\n * the closed `ContributionDispatcher` after a successful `start`. The\n * buffer is the SOLE source of post-start contributions.\n */\nconst makePluginCtx = (\n\tpluginKey: PluginKey,\n): {\n\treadonly ctx: PluginCtx;\n\treadonly buffer: BufferedContribution[];\n\treadonly sealBuffer: () => void;\n} => {\n\tconst buffer: BufferedContribution[] = [];\n\t// PR#3: the buffer is read exactly once after `start` returns, then\n\t// frozen. A push afterwards is a late async emission that would be\n\t// silently dropped — throw a loud, attributable defect instead.\n\tlet frozen = false;\n\tconst pushOrThrow = (kind: string, decl: BufferedContribution): void => {\n\t\tif (frozen) throw new ContributionBufferSealedError(pluginKey, kind);\n\t\tbuffer.push(decl);\n\t};\n\tconst ctx: PluginCtx = {\n\t\tcodegen: <E extends string>(decl: CodegenableDecl<E>): void => {\n\t\t\tpushOrThrow('codegenable', decl);\n\t\t},\n\t\tendpoint: (decl: RoutableDecl): void => {\n\t\t\tpushOrThrow('routable', decl);\n\t\t},\n\t\tsnapshotExtra: (decl: SnapshotableDecl): void => {\n\t\t\tpushOrThrow('snapshotable', decl);\n\t\t},\n\t\tpublish: (decl: ProjectionDecl): void => {\n\t\t\tpushOrThrow('projection', decl);\n\t\t},\n\t\tprovides: <K extends string, S>(decl: StrategyContributorDecl<K, S>): void => {\n\t\t\tpushOrThrow('strategy-contributor', decl);\n\t\t},\n\t};\n\treturn {\n\t\tctx,\n\t\tbuffer,\n\t\tsealBuffer: () => {\n\t\t\tfrozen = true;\n\t\t},\n\t};\n};\n\n// -----------------------------------------------------------------------------\n// Static post-start dispatch\n// -----------------------------------------------------------------------------\n\n/**\n * Render the underlying cause of a contribution-dispatch failure to a\n * single operator-facing string. A failing dispatch body (e.g. a router\n * route collision) may reject with an Effect `Cause`, a tagged domain\n * error (carrying a spec-mismatch `detail`), a plain `Error`, or an\n * arbitrary value. The plugin stays `ready`, so without this the\n * operator would see a healthy-looking stack with dead routing.\n */\nconst formatCause = (cause: unknown): string => {\n\tif (Cause.isCause(cause)) return Cause.pretty(cause);\n\tif (cause instanceof Error) return cause.stack ?? cause.message;\n\tif (typeof cause === 'string') return cause;\n\ttry {\n\t\treturn JSON.stringify(cause) ?? String(cause);\n\t} catch {\n\t\treturn String(cause);\n\t}\n};\n\n/** Best-effort `_tag` of the failing cause for the additive `causeType`\n * on the `dispatchFailed` event. */\nconst causeTagOf = (cause: unknown): string | undefined => {\n\tif (\n\t\ttypeof cause === 'object' &&\n\t\tcause !== null &&\n\t\t'_tag' in cause &&\n\t\ttypeof (cause as { _tag: unknown })._tag === 'string'\n\t) {\n\t\treturn (cause as { _tag: string })._tag;\n\t}\n\treturn undefined;\n};\n\n/**\n * Replay one plugin's buffered contributions through the closed\n * `ContributionDispatcher` after a successful `start`.\n *\n * Failure semantics: a dispatch BODY failure is an orchestrator-fault —\n * the supervisor publishes\n * `engine.orchestrator.dispatchFailed` + logs a warning, and the plugin\n * stays `ready` (NOT `markFailed`). The contribution kinds are a CLOSED\n * union, so the dispatch is an exhaustive switch on the decl\n * discriminant (no UnknownContributionKind arm).\n *\n * Runs on the plugin's scope (`pluginScope`) so any finalizer a dispatch\n * body arms (e.g. `strategy.unregistered`) reaps on plugin teardown.\n */\nconst dispatchBufferedContributions = (\n\tpluginKey: PluginKey,\n\tbuffer: ReadonlyArray<BufferedContribution>,\n\tpluginContext: Context.Context<never>,\n\tpluginScope: Scope.Scope,\n\tdispatcher: ContributionDispatcher,\n\tref: SubscriptionRef.SubscriptionRef<SubscribableState>,\n\thub: Queue.Enqueue<EngineEvent>,\n): Effect.Effect<void, never, never> =>\n\tEffect.gen(function* () {\n\t\tconst strategyRegistry = strategyRegistryAccess.read(pluginContext, noopStrategyRegistry);\n\t\tconst dispatchCtx: ContributionDispatchContext = {\n\t\t\tpluginKey,\n\t\t\tpublish: (event) => publish(ref, hub, event),\n\t\t\tstrategyRegistry,\n\t\t};\n\n\t\tfor (const decl of buffer) {\n\t\t\tconst body = ((): Effect.Effect<void, unknown, Scope.Scope> => {\n\t\t\t\tswitch (decl.kind) {\n\t\t\t\t\tcase 'snapshotable':\n\t\t\t\t\t\treturn dispatcher.snapshotable(decl, dispatchCtx);\n\t\t\t\t\tcase 'codegenable':\n\t\t\t\t\t\treturn dispatcher.codegenable(decl, dispatchCtx);\n\t\t\t\t\tcase 'routable':\n\t\t\t\t\t\treturn dispatcher.routable(decl, dispatchCtx);\n\t\t\t\t\tcase 'projection':\n\t\t\t\t\t\treturn dispatcher.projection(decl, dispatchCtx);\n\t\t\t\t\tcase 'strategy-contributor':\n\t\t\t\t\t\treturn dispatcher.strategyContributor(decl, dispatchCtx);\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tconst _exhaustive: never = decl;\n\t\t\t\t\t\tvoid _exhaustive;\n\t\t\t\t\t\treturn Effect.void;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})();\n\t\t\t// Orchestrator-fault path: a dispatch body failure surfaces the\n\t\t\t// typed `dispatchFailed` event + warning WITHOUT marking the\n\t\t\t// plugin failed (the plugin already reached a good `start`).\n\t\t\tconst guarded = body.pipe(\n\t\t\t\tEffect.catch((cause) =>\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tconst causeType = causeTagOf(cause);\n\t\t\t\t\t\tyield* publish(ref, hub, {\n\t\t\t\t\t\t\ttag: 'engine.orchestrator.dispatchFailed',\n\t\t\t\t\t\t\tpluginKey,\n\t\t\t\t\t\t\tkind: decl.kind,\n\t\t\t\t\t\t\tmessage: `routing/contribution sink '${decl.kind}' failed`,\n\t\t\t\t\t\t\t...(causeType === undefined ? {} : { causeType }),\n\t\t\t\t\t\t\tat: Date.now(),\n\t\t\t\t\t\t});\n\t\t\t\t\t\tyield* Effect.logWarning(\n\t\t\t\t\t\t\t`routing/contribution sink '${decl.kind}' failed for plugin '${pluginKey}': ${formatCause(cause)}`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t);\n\t\t\tyield* Scope.provide(guarded, pluginScope);\n\t\t}\n\t});\n\n// -----------------------------------------------------------------------------\n// Boot the registry from a graph\n// -----------------------------------------------------------------------------\n\nexport const buildRegistry = (\n\tgraph: ResolvedGraph,\n\tparentScope: Scope.Scope,\n\temit: (key: PluginKey, from: LifecycleStatus, to: LifecycleStatus) => Effect.Effect<void>,\n): Effect.Effect<PluginRegistry, never, never> =>\n\tEffect.gen(function* () {\n\t\tconst entries = new Map<PluginKey, PluginEntry>();\n\t\tfor (const [key, node] of graph.nodes) {\n\t\t\tconst entry = yield* makeEntry(node, parentScope);\n\t\t\tentries.set(key, entry);\n\t\t}\n\t\treturn makeRegistry(entries, emit);\n\t});\n\n// -----------------------------------------------------------------------------\n// Acquire one node\n// -----------------------------------------------------------------------------\n\n/**\n * Run one node's `start` under its own scope. Steps:\n * 1. Await upstreams (their ready-gates).\n * 2. Transition `pending → acquiring` (publishes the event).\n * 3. Build resolved dependency values from declared resource refs.\n * 4. Run the plugin's `start` Effect inside the entry's Scope,\n * after providing the substrate-context services bundle so the\n * plugin's R-channel yields (`IdentityContext`,\n * `ContainerRuntimeService`, etc.) resolve to live instances.\n * 5. On success: stash the resolved value + `markReady` (publishes\n * the `ready` transition).\n * 6. On failure: `markFailed` (publishes the `failed` transition, fails\n * the deferred so downstream consumers short-circuit).\n *\n * Errors are caught and stashed onto the registry entry — the outer\n * scheduler doesn't propagate per-plugin failures; ready-gate failure\n * propagation handles the downstream blocking. The supervisor's outer\n * fiber surfaces the union via `Fiber.join` when the user asks for\n * \"stack ready or err\".\n */\nexport const acquireNode = (\n\tregistry: PluginRegistry,\n\tkey: PluginKey,\n\tref: SubscriptionRef.SubscriptionRef<SubscribableState>,\n\thub: Queue.Enqueue<EngineEvent>,\n\tpluginContext: Context.Context<never>,\n\tdispatcher: ContributionDispatcher,\n\tlogger: LoggerShape,\n\t// Threaded through the acquire path for parity with acquireKeys/\n\t// acquireFullGraph; no longer read here (only the removed span used it).\n\t_identity: Identity,\n): Effect.Effect<void, never, never> =>\n\tEffect.gen(function* () {\n\t\tconst entry = registry.entries.get(key);\n\t\tif (entry === undefined) return;\n\t\tconst upstreamWait = awaitUpstreams(registry, entry.node).pipe(\n\t\t\tEffect.matchEffect({\n\t\t\t\tonFailure: (cause) =>\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tyield* bestEffort(registry.markFailed(key, cause));\n\t\t\t\t\t\treturn false as const;\n\t\t\t\t\t}),\n\t\t\t\tonSuccess: () => Effect.succeed(true as const),\n\t\t\t}),\n\t\t);\n\t\tconst ok = yield* upstreamWait;\n\t\tif (ok !== true) {\n\t\t\tyield* logger.log(`supervisor/${key}`, key, {\n\t\t\t\tlevel: 'warn',\n\t\t\t\tmessage: 'plugin acquire skipped — upstream failed',\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tyield* logger.log(`supervisor/${key}`, key, {\n\t\t\tlevel: 'debug',\n\t\t\tmessage: 'plugin acquire start',\n\t\t\tfields: { role: entry.node.member.role },\n\t\t});\n\t\t// Best-effort claim. `transition` `Effect.die`s on an off-table move,\n\t\t// which a concurrent acquire can trigger: an in-flight initial\n\t\t// `acquireNode` racing a selective-restart re-acquire of the same key\n\t\t// hits `acquiring → acquiring`. `Effect.catch` (used originally here)\n\t\t// cannot catch that DEFECT, so it would escape and kill the\n\t\t// command-loop fiber (supervisor wedge — same class as the lifecycle\n\t\t// reset fix). `Effect.exit` swallows BOTH failure and defect, keeping\n\t\t// this the best-effort transition it was always meant to be.\n\t\t// NOTE: this prevents the wedge but not the underlying double-acquire\n\t\t// (two fibers running one node's `start`). A complete fix must\n\t\t// interrupt a node's in-flight acquire fiber before a restart\n\t\t// re-acquires it — tracked as a follow-up (needs per-node acquire-fiber\n\t\t// handles, which `acquireKeys`' `Effect.all` does not retain today).\n\t\tyield* Effect.exit(registry.transition(key, 'acquiring'));\n\t\tconst readDependency = buildDependencyReaderFor(registry, entry.node);\n\t\tconst deps = resolvePluginDependencies(entry.node.member, readDependency);\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst start = entry.node.member.start as (\n\t\t\tdeps: unknown,\n\t\t) => Effect.Effect<unknown, unknown, any>;\n\t\t// Build the per-plugin ctx + replay buffer. Every plugin emits its\n\t\t// contributions inline via the typed `ctx` verbs during `start`; the\n\t\t// buffer is the SOLE source of the post-start dispatch.\n\t\t// The ctx is delivered through the `PluginContext` service tag (a\n\t\t// plugin reaches it with `yield* PluginContext`), provided into the\n\t\t// start Effect's requirement channel below — NOT as a 2nd positional\n\t\t// argument — which keeps `start` single-arg and `deps` auto-inferred.\n\t\tconst { ctx: pluginCtx, buffer, sealBuffer } = makePluginCtx(key);\n\t\tconst currentPluginContext = pluginContext.pipe(\n\t\t\tContext.add(CurrentPluginKey, { key }),\n\t\t\tContext.add(PluginContext, pluginCtx),\n\t\t\tContext.add(CurrentPluginProgress, {\n\t\t\t\tsetPhase: (phase) =>\n\t\t\t\t\tpublish(ref, hub, {\n\t\t\t\t\t\ttag: 'lifecycle.phaseSet',\n\t\t\t\t\t\tpluginKey: key,\n\t\t\t\t\t\tphase,\n\t\t\t\t\t\tat: Date.now(),\n\t\t\t\t\t}),\n\t\t\t}),\n\t\t);\n\t\tconst providedAcquire = Effect.provide(start(deps), currentPluginContext) as Effect.Effect<\n\t\t\tunknown,\n\t\t\tunknown,\n\t\t\tScope.Scope\n\t\t>;\n\t\tconst result = yield* Scope.provide(providedAcquire, entry.scope).pipe(\n\t\t\tEffect.matchEffect({\n\t\t\t\tonFailure: (cause) =>\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tyield* bestEffort(registry.markFailed(key, cause));\n\t\t\t\t\t\tyield* publish(ref, hub, {\n\t\t\t\t\t\t\ttag: 'error.reported',\n\t\t\t\t\t\t\terror: prettyErrorStructured(Cause.fail(cause), {\n\t\t\t\t\t\t\t\tpluginKey: key,\n\t\t\t\t\t\t\t\tseverity: 'error',\n\t\t\t\t\t\t\t\tat: Date.now(),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn { ok: false as const };\n\t\t\t\t\t}),\n\t\t\t\tonSuccess: (value: unknown) =>\n\t\t\t\t\tEffect.succeed({ ok: true as const, value: value as unknown }),\n\t\t\t}),\n\t\t);\n\t\t// PR#3: `start` has resolved — the contribution buffer is now FINAL and\n\t\t// is read exactly once below. Freeze it so any late async `ctx.*`\n\t\t// emission (a verb called from a fiber the plugin forked but did not\n\t\t// await) crashes the OFFENDING fiber with a typed defect instead of\n\t\t// being silently dropped.\n\t\tsealBuffer();\n\t\tif (result.ok) {\n\t\t\t// The ctx buffer (decls the 5 verbs pushed during `start`, in\n\t\t\t// emit order) is the SOLE source of post-start contributions.\n\t\t\t// The dispatch is a closed exhaustive switch on the decl\n\t\t\t// discriminant — its internal dual-catch keeps an\n\t\t\t// orchestrator-fault (a failing dispatch body) off the plugin's\n\t\t\t// `markFailed` path, so a surfaced failure here would be an\n\t\t\t// unexpected defect only.\n\t\t\tif (buffer.length > 0) {\n\t\t\t\tconst dispatchExit = yield* Effect.exit(\n\t\t\t\t\tdispatchBufferedContributions(\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tbuffer,\n\t\t\t\t\t\tpluginContext,\n\t\t\t\t\t\tentry.scope,\n\t\t\t\t\t\tdispatcher,\n\t\t\t\t\t\tref,\n\t\t\t\t\t\thub,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tif (Exit.isFailure(dispatchExit)) {\n\t\t\t\t\tyield* bestEffort(registry.markFailed(key, dispatchExit.cause));\n\t\t\t\t\tyield* publish(ref, hub, {\n\t\t\t\t\t\ttag: 'error.reported',\n\t\t\t\t\t\terror: prettyErrorStructured(dispatchExit.cause, {\n\t\t\t\t\t\t\tpluginKey: key,\n\t\t\t\t\t\t\tseverity: 'error',\n\t\t\t\t\t\t\tat: Date.now(),\n\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t\tyield* logger.log(`supervisor/${key}`, key, {\n\t\t\t\t\t\tlevel: 'error',\n\t\t\t\t\t\tmessage: 'plugin capability dispatch failed',\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst routablesPresent = buffer.some((decl) => decl.kind === 'routable');\n\t\t\tfor (const event of operationalEndpointEventsFromResolvedValue(\n\t\t\t\tkey,\n\t\t\t\tresult.value,\n\t\t\t\tDate.now(),\n\t\t\t\t{\n\t\t\t\t\troutablesPresent,\n\t\t\t\t},\n\t\t\t)) {\n\t\t\t\tyield* publish(ref, hub, event);\n\t\t\t}\n\t\t\tyield* publish(ref, hub, {\n\t\t\t\ttag: 'lifecycle.phaseSet',\n\t\t\t\tpluginKey: key,\n\t\t\t\tphase: null,\n\t\t\t\tat: Date.now(),\n\t\t\t});\n\t\t\tyield* bestEffort(registry.markReady(key, result.value));\n\t\t\tif (entry.node.member.role === 'task') {\n\t\t\t\tyield* bestEffort(registry.transition(key, 'done'));\n\t\t\t}\n\t\t\tyield* logger.log(`supervisor/${key}`, key, {\n\t\t\t\tlevel: 'debug',\n\t\t\t\tmessage: entry.node.member.role === 'task' ? 'plugin done' : 'plugin ready',\n\t\t\t\tfields: {\n\t\t\t\t\tcontributions: buffer.length,\n\t\t\t\t},\n\t\t\t});\n\t\t} else {\n\t\t\tyield* logger.log(`supervisor/${key}`, key, {\n\t\t\t\tlevel: 'debug',\n\t\t\t\tmessage: 'plugin acquire failed',\n\t\t\t});\n\t\t}\n\t});\n\nclass PluginAcquireInterruptedBeforeReady extends Error {\n\treadonly _tag = 'PluginAcquireInterruptedBeforeReady' as const;\n\tconstructor(readonly pluginKey: PluginKey) {\n\t\tsuper(`plugin '${pluginKey}' acquire was interrupted before readiness`);\n\t\tthis.name = 'PluginAcquireInterruptedBeforeReady';\n\t}\n}\n\nconst failIfAcquireInterruptedBeforeReady = (\n\tregistry: PluginRegistry,\n\tkey: PluginKey,\n\tentry: PluginEntry,\n): Effect.Effect<void, never, never> =>\n\tEffect.gen(function* () {\n\t\tif (registry.entries.get(key) !== entry) return;\n\t\tconst status = yield* registry\n\t\t\t.getStatus(key)\n\t\t\t.pipe(Effect.catch(() => Effect.succeed<LifecycleStatus | null>(null)));\n\t\tif (registry.entries.get(key) !== entry) return;\n\t\tif (status !== 'pending' && status !== 'acquiring') return;\n\t\tyield* bestEffort(registry.markFailed(key, new PluginAcquireInterruptedBeforeReady(key)));\n\t});\n\n// -----------------------------------------------------------------------------\n// Acquire a key set in parallel. Each node waits on its own upstreams,\n// so downstream nodes begin as soon as their dependencies are ready\n// instead of waiting for unrelated nodes in the same topological level.\n// -----------------------------------------------------------------------------\n\nexport const acquireKeys = (\n\tregistry: PluginRegistry,\n\tkeys: ReadonlyArray<PluginKey>,\n\tref: SubscriptionRef.SubscriptionRef<SubscribableState>,\n\thub: Queue.Enqueue<EngineEvent>,\n\tpluginContext: Context.Context<never>,\n\tdispatcher: ContributionDispatcher,\n\tlogger: LoggerShape,\n\tidentity: Identity,\n\tparentScope: Scope.Scope,\n): Effect.Effect<void, never, never> =>\n\tEffect.gen(function* () {\n\t\tconst fibers = yield* Effect.all(\n\t\t\tkeys.map((key) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst entry = registry.entries.get(key);\n\t\t\t\t\tif (entry === undefined) return yield* Effect.forkIn(Effect.void, parentScope);\n\t\t\t\t\tconst registeredGate = yield* Deferred.make<void, never>();\n\t\t\t\t\tconst readyToRegister = yield* Deferred.make<void, never>();\n\t\t\t\t\tconst guarded = Effect.gen(function* () {\n\t\t\t\t\t\tconst selfId = yield* Effect.fiberId;\n\t\t\t\t\t\tyield* Effect.gen(function* () {\n\t\t\t\t\t\t\tyield* Deferred.succeed(readyToRegister, void 0);\n\t\t\t\t\t\t\tyield* Deferred.await(registeredGate);\n\t\t\t\t\t\t\tyield* acquireNode(\n\t\t\t\t\t\t\t\tregistry,\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t\thub,\n\t\t\t\t\t\t\t\tpluginContext,\n\t\t\t\t\t\t\t\tdispatcher,\n\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\tidentity,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}).pipe(\n\t\t\t\t\t\t\tEffect.onInterrupt(() => failIfAcquireInterruptedBeforeReady(registry, key, entry)),\n\t\t\t\t\t\t\tEffect.ensuring(\n\t\t\t\t\t\t\t\tregistry\n\t\t\t\t\t\t\t\t\t.clearAcquireFiberIfEntry(key, entry, selfId)\n\t\t\t\t\t\t\t\t\t.pipe(Effect.catch(() => Effect.void)),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t});\n\t\t\t\t\tconst fiber = yield* Effect.forkIn(Scope.provide(guarded, parentScope), parentScope);\n\t\t\t\t\tyield* Deferred.await(readyToRegister);\n\t\t\t\t\tconst registered = yield* registry\n\t\t\t\t\t\t.setAcquireFiberIfEntry(key, entry, fiber)\n\t\t\t\t\t\t.pipe(Effect.catch(() => Effect.succeed(false)));\n\t\t\t\t\tif (!registered) {\n\t\t\t\t\t\tyield* Fiber.interrupt(fiber).pipe(Effect.asVoid);\n\t\t\t\t\t\treturn fiber;\n\t\t\t\t\t}\n\t\t\t\t\tyield* Deferred.succeed(registeredGate, void 0);\n\t\t\t\t\treturn fiber;\n\t\t\t\t}),\n\t\t\t),\n\t\t\t{ concurrency: 'unbounded' },\n\t\t);\n\t\tyield* Effect.all(\n\t\t\tfibers.map((fiber) =>\n\t\t\t\tFiber.await(fiber).pipe(\n\t\t\t\t\tEffect.flatMap((exit) => {\n\t\t\t\t\t\tif (Exit.isSuccess(exit) || Cause.hasInterruptsOnly(exit.cause)) {\n\t\t\t\t\t\t\treturn Effect.void;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn Effect.failCause(exit.cause);\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t\t{ concurrency: 'unbounded', discard: true },\n\t\t);\n\t});\n\nexport const acquireFullGraph = (\n\tgraph: ResolvedGraph,\n\tregistry: PluginRegistry,\n\tref: SubscriptionRef.SubscriptionRef<SubscribableState>,\n\thub: Queue.Enqueue<EngineEvent>,\n\tpluginContext: Context.Context<never>,\n\tdispatcher: ContributionDispatcher,\n\tlogger: LoggerShape,\n\tidentity: Identity,\n\tparentScope: Scope.Scope,\n): Effect.Effect<void, never, never> =>\n\tEffect.gen(function* () {\n\t\tyield* acquireKeys(\n\t\t\tregistry,\n\t\t\t[...graph.nodes.keys()],\n\t\t\tref,\n\t\t\thub,\n\t\t\tpluginContext,\n\t\t\tdispatcher,\n\t\t\tlogger,\n\t\t\tidentity,\n\t\t\tparentScope,\n\t\t);\n\t});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA4EA,IAAa,gCAAb,cAAmD,MAAM;CACxD,OAAgB;CAChB,YAAY,WAA6B,MAAc;EACtD,MACC,SAAS,cAAc,OAAO,KAAK,KAAK,UAAU,GAAG,cAAc,KAAK,uLAIzE;EACA,KAAK,OAAO;CACb;AACD;AAMA,MAAM,yBAAyB,gBAAgB,uBAAuB;;;;;;;;;AAUtE,MAAM,iBACL,cAKI;CACJ,MAAM,SAAiC,CAAC;CAIxC,IAAI,SAAS;CACb,MAAM,eAAe,MAAc,SAAqC;EACvE,IAAI,QAAQ,MAAM,IAAI,8BAA8B,WAAW,IAAI;EACnE,OAAO,KAAK,IAAI;CACjB;CAkBA,OAAO;EACN,KAAA;GAjBA,UAA4B,SAAmC;IAC9D,YAAY,eAAe,IAAI;GAChC;GACA,WAAW,SAA6B;IACvC,YAAY,YAAY,IAAI;GAC7B;GACA,gBAAgB,SAAiC;IAChD,YAAY,gBAAgB,IAAI;GACjC;GACA,UAAU,SAA+B;IACxC,YAAY,cAAc,IAAI;GAC/B;GACA,WAAgC,SAA8C;IAC7E,YAAY,wBAAwB,IAAI;GACzC;EAGE;EACF;EACA,kBAAkB;GACjB,SAAS;EACV;CACD;AACD;;;;;;;;;AAcA,MAAM,eAAe,UAA2B;CAC/C,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,OAAO,KAAK;CACnD,IAAI,iBAAiB,OAAO,OAAO,MAAM,SAAS,MAAM;CACxD,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI;EACH,OAAO,KAAK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C,CAAC,CACF,CACD,GACA;EAAE,aAAa;EAAa,SAAS;CAAK,CAC3C;AACD,CAAC;AAEF,MAAa,oBACZ,OACA,UACA,KACA,KACA,eACA,YACA,QACA,UACA,gBAEA,OAAO,IAAI,aAAa;CACvB,OAAO,YACN,UACA,CAAC,GAAG,MAAM,MAAM,KAAK,CAAC,GACtB,KACA,KACA,eACA,YACA,QACA,UACA,WACD;AACD,CAAC"}
|
|
@@ -3,26 +3,40 @@ import { prettyErrorStructured } from "../observability/pretty-error.mjs";
|
|
|
3
3
|
import "../observability/index.mjs";
|
|
4
4
|
import { bestEffort, publish } from "./wiring.mjs";
|
|
5
5
|
import { PostAcquireTaskFailed } from "../post-acquire-tasks.mjs";
|
|
6
|
-
import { Cause, Effect, Exit, Fiber, Ref } from "effect";
|
|
6
|
+
import { Cause, Effect, Exit, Fiber, Ref, Scope } from "effect";
|
|
7
7
|
//#region src/substrate/runtime/supervisor/background-tasks.ts
|
|
8
8
|
/** `snapshot.captureFailed` / `snapshot.captureSkipped` carry a REQUIRED
|
|
9
9
|
* `snapshotId`. When the originating command carried an id, surfaces
|
|
10
10
|
* correlate the outcome with it (the CLI's pending-capture map keys on
|
|
11
11
|
* it). When the command omitted an id there is nothing to correlate
|
|
12
12
|
* against — the CLI's bridge does NOT register a pending-capture entry
|
|
13
|
-
* for an id-less capture (`cli/wirings/up.ts` falls through to a
|
|
14
|
-
*
|
|
13
|
+
* for an id-less capture (`cli/wirings/up.ts` falls through to a plain
|
|
14
|
+
* auto-ack and never keys this synthetic id) — so the minted
|
|
15
15
|
* `snap-<ts>` here only satisfies the event's required field. */
|
|
16
16
|
const effectiveSnapshotId = (cmd) => cmd.snapshotId ?? `snap-${Date.now()}`;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Run the injected L3 command handler and report the typed outcome.
|
|
19
|
+
*
|
|
20
|
+
* On success the handler's events are published and `ok: true` is
|
|
21
|
+
* returned. On failure the failure is surfaced on the event stream
|
|
22
|
+
* (`snapshot.captureFailed` for a capture, plus `error.reported`) AND
|
|
23
|
+
* the cause is returned to the caller so a command that must NOT
|
|
24
|
+
* proceed on a half-applied handler (e.g. `snapshot.restore`, which
|
|
25
|
+
* otherwise drains + re-acquires every service off a half-restored
|
|
26
|
+
* tree) can short-circuit and propagate the failure to `submitCommand`.
|
|
27
|
+
*
|
|
28
|
+
* Interrupt-only causes return `ok: true` (the interrupting sibling
|
|
29
|
+
* owns the lifecycle decision) — same as the void runner below.
|
|
30
|
+
*/
|
|
31
|
+
const runInjectedCommandHandlerExit = (deps, cmd) => Effect.gen(function* () {
|
|
32
|
+
if (deps.commandHandler === void 0) return { ok: true };
|
|
19
33
|
const publishFromHandler = (event) => publish(deps.ref, deps.hub, event);
|
|
20
34
|
const exit = yield* Effect.exit(deps.commandHandler(cmd, { publish: publishFromHandler }));
|
|
21
35
|
if (Exit.isSuccess(exit)) {
|
|
22
36
|
for (const event of exit.value) yield* publish(deps.ref, deps.hub, event);
|
|
23
|
-
return;
|
|
37
|
+
return { ok: true };
|
|
24
38
|
}
|
|
25
|
-
if (Cause.hasInterruptsOnly(exit.cause)) return;
|
|
39
|
+
if (Cause.hasInterruptsOnly(exit.cause)) return { ok: true };
|
|
26
40
|
if (cmd.tag === "snapshot.capture") yield* publish(deps.ref, deps.hub, {
|
|
27
41
|
tag: "snapshot.captureFailed",
|
|
28
42
|
snapshotId: effectiveSnapshotId(cmd),
|
|
@@ -42,65 +56,65 @@ const runInjectedCommandHandler = (deps, cmd) => Effect.gen(function* () {
|
|
|
42
56
|
level: "error",
|
|
43
57
|
message: `command handler failed for ${cmd.tag}`
|
|
44
58
|
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
return {
|
|
60
|
+
ok: false,
|
|
61
|
+
cause: exit.cause
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
/**
|
|
65
|
+
* Fire-and-forget wrapper over {@link runInjectedCommandHandlerExit}:
|
|
66
|
+
* the handler's failure is already surfaced on the event stream, so the
|
|
67
|
+
* void channel suffices for capture / list / delete / wipe / prune,
|
|
68
|
+
* whose callers don't branch on the outcome.
|
|
69
|
+
*/
|
|
70
|
+
const runInjectedCommandHandler = (deps, cmd) => Effect.asVoid(runInjectedCommandHandlerExit(deps, cmd));
|
|
71
|
+
/**
|
|
72
|
+
* Fork `body` into the supervisor-lifetime scope and claim a background
|
|
73
|
+
* task slot atomically.
|
|
74
|
+
*
|
|
75
|
+
* `Effect.forkIn(supervisorScope)` parents the fiber to the supervisor's
|
|
76
|
+
* lifetime — NOT the command-loop fiber that triggered it — so a
|
|
77
|
+
* long-running capture/restart does not block the command loop and
|
|
78
|
+
* cannot wedge a subsequent `shutdown.requested` (Bug #13). The forked
|
|
79
|
+
* fiber is created suspended (`forkIn`'s default `startImmediately`), so
|
|
80
|
+
* the CAS below runs before it executes a single step.
|
|
81
|
+
*
|
|
82
|
+
* Skip-dedup: the slot is the running state. If it is already occupied
|
|
83
|
+
* the just-forked fiber is interrupted (it never ran) and the function
|
|
84
|
+
* returns `'skipped'` so the caller can publish/log the skip. Otherwise
|
|
85
|
+
* the fiber is installed, its `ensuring` clears the slot on completion,
|
|
86
|
+
* and the function returns `'started'`.
|
|
87
|
+
*/
|
|
88
|
+
const forkIntoSlot = (supervisorScope, slot, body) => Effect.gen(function* () {
|
|
89
|
+
const guarded = Effect.gen(function* () {
|
|
90
|
+
const selfId = yield* Effect.fiberId;
|
|
91
|
+
yield* body.pipe(Effect.ensuring(Ref.update(slot, (current) => current !== null && current.id === selfId ? null : current)));
|
|
67
92
|
});
|
|
68
|
-
const fiber = yield*
|
|
69
|
-
yield* Ref.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
snapshotId: cmd.snapshotId ?? null,
|
|
73
|
-
fiber
|
|
74
|
-
} : state);
|
|
75
|
-
}).pipe(Effect.withSpan("lifecycle.supervisor.backgroundSnapshotCapture"));
|
|
76
|
-
const requestBackgroundSnapshotInterrupt = (deps) => Effect.gen(function* () {
|
|
77
|
-
const fiber = yield* Ref.modify(deps.snapshotCaptureTask, (state) => state.tag === "running" ? [state.fiber, { tag: "idle" }] : [null, state]);
|
|
78
|
-
if (fiber !== null) yield* Fiber.interrupt(fiber);
|
|
79
|
-
}).pipe(Effect.withSpan("lifecycle.supervisor.interruptSnapshotCapture"));
|
|
80
|
-
const startBackgroundStackRestart = (deps, handleCommand) => Effect.gen(function* () {
|
|
81
|
-
const token = yield* Ref.updateAndGet(deps.stackRestartSeq, (n) => n + 1);
|
|
82
|
-
if (!(yield* Ref.modify(deps.stackRestartTask, (state) => state.tag === "idle" ? [true, {
|
|
83
|
-
tag: "starting",
|
|
84
|
-
token
|
|
85
|
-
}] : [false, state]))) {
|
|
86
|
-
yield* deps.logger.log("supervisor", null, {
|
|
87
|
-
level: "debug",
|
|
88
|
-
message: "stack restart skipped because one is already running"
|
|
89
|
-
});
|
|
90
|
-
return;
|
|
93
|
+
const fiber = yield* Effect.forkIn(Scope.provide(guarded, supervisorScope), supervisorScope);
|
|
94
|
+
if (!(yield* Ref.modify(slot, (current) => current === null ? [true, fiber] : [false, current]))) {
|
|
95
|
+
yield* Fiber.interrupt(fiber);
|
|
96
|
+
return "skipped";
|
|
91
97
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
return "started";
|
|
99
|
+
});
|
|
100
|
+
/**
|
|
101
|
+
* Read-and-clear a background task slot, then await the fiber's
|
|
102
|
+
* interrupt. Awaiting matters: a follow-up snapshot capture must not
|
|
103
|
+
* begin while the previous fiber is still inside `pauseAndCommit` /
|
|
104
|
+
* `saveImages`, and shutdown must not race a half-torn-down restart.
|
|
105
|
+
*/
|
|
106
|
+
const interruptSlot = (slot) => Effect.gen(function* () {
|
|
107
|
+
const fiber = yield* Ref.getAndSet(slot, null);
|
|
101
108
|
if (fiber !== null) yield* Fiber.interrupt(fiber);
|
|
102
|
-
})
|
|
103
|
-
const
|
|
109
|
+
});
|
|
110
|
+
const startBackgroundStackRestart = (deps, handleCommand) => Effect.gen(function* () {
|
|
111
|
+
if ((yield* forkIntoSlot(deps.supervisorScope, deps.stackRestartTask, handleCommand(deps, { tag: "stack.restart" }).pipe(Effect.catch(() => Effect.void)))) === "skipped") yield* deps.logger.log("supervisor", null, {
|
|
112
|
+
level: "debug",
|
|
113
|
+
message: "stack restart skipped because one is already running"
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
const requestBackgroundStackRestartInterrupt = (deps) => interruptSlot(deps.stackRestartTask);
|
|
117
|
+
const publishHookFailure = (deps, cause, message, pluginKey) => Effect.gen(function* () {
|
|
104
118
|
yield* publish(deps.ref, deps.hub, {
|
|
105
119
|
tag: "error.reported",
|
|
106
120
|
error: prettyErrorStructured(cause, {
|
|
@@ -137,8 +151,8 @@ const runPostAcquireHook = (deps) => Effect.gen(function* () {
|
|
|
137
151
|
if (taskFailure !== null) yield* bestEffort(deps.registry.markFailed(taskFailure.pluginKey, taskFailure.cause));
|
|
138
152
|
yield* publishHookFailure(deps, exit.cause, taskFailure === null ? "post-acquire hook failed" : `post-acquire task failed: ${taskFailure.label}`, taskFailure?.pluginKey ?? null);
|
|
139
153
|
return yield* Effect.fail(new SupervisorPostAcquireFailed({ cause: exit.cause }));
|
|
140
|
-
})
|
|
154
|
+
});
|
|
141
155
|
//#endregion
|
|
142
|
-
export {
|
|
156
|
+
export { requestBackgroundStackRestartInterrupt, runInjectedCommandHandler, runInjectedCommandHandlerExit, runPostAcquireHook, startBackgroundStackRestart };
|
|
143
157
|
|
|
144
158
|
//# sourceMappingURL=background-tasks.mjs.map
|