@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
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { readStackEngine } from "./define-devstack.mjs";
|
|
2
|
+
import { Data, Effect } from "effect";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { isAbsolute, resolve } from "node:path";
|
|
5
|
+
import { pathToFileURL } from "node:url";
|
|
6
|
+
//#region src/api/load-config.ts
|
|
7
|
+
const DEFAULT_CONFIG_PATH = "./devstack.config.ts";
|
|
8
|
+
/** Resolve a `--config <path>` argument to an absolute path, falling
|
|
9
|
+
* through to a parent-directory search when the default value is
|
|
10
|
+
* used. Returns `null` when no candidate exists. */
|
|
11
|
+
const resolveConfigPath = (configPath) => {
|
|
12
|
+
const target = configPath ?? "./devstack.config.ts";
|
|
13
|
+
const explicit = isAbsolute(target) ? target : resolve(process.cwd(), target);
|
|
14
|
+
if (existsSync(explicit)) return explicit;
|
|
15
|
+
if (configPath !== void 0 && configPath !== "./devstack.config.ts") return null;
|
|
16
|
+
let dir = process.cwd();
|
|
17
|
+
for (;;) {
|
|
18
|
+
const candidate = resolve(dir, "devstack.config.ts");
|
|
19
|
+
if (existsSync(candidate)) return candidate;
|
|
20
|
+
const parent = resolve(dir, "..");
|
|
21
|
+
if (parent === dir) return null;
|
|
22
|
+
dir = parent;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
/** Typed failure of {@link loadDevstackConfig}. `kind` distinguishes a
|
|
26
|
+
* missing config from an invalid one so CLI wrappers can map it to the
|
|
27
|
+
* right exit code. */
|
|
28
|
+
var DevstackConfigError = class extends Data.TaggedError("DevstackConfigError") {};
|
|
29
|
+
const validate = (resolvedConfigPath, mod) => {
|
|
30
|
+
const def = mod.default;
|
|
31
|
+
if (def === null || typeof def !== "object" || def._tag !== "Stack") throw new DevstackConfigError({
|
|
32
|
+
kind: "invalid",
|
|
33
|
+
message: `config at ${resolvedConfigPath} does not default-export a Stack value (got _tag=${String(def?._tag)})`
|
|
34
|
+
});
|
|
35
|
+
const publicStack = def;
|
|
36
|
+
let engine;
|
|
37
|
+
try {
|
|
38
|
+
engine = readStackEngine(publicStack);
|
|
39
|
+
} catch (cause) {
|
|
40
|
+
throw new DevstackConfigError({
|
|
41
|
+
kind: "invalid",
|
|
42
|
+
message: `config at ${resolvedConfigPath} default-exported an invalid Stack handle: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
43
|
+
cause
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
stack: publicStack,
|
|
48
|
+
engine,
|
|
49
|
+
resolvedConfigPath
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Resolve, import, and validate a `devstack.config.ts`. Returns the
|
|
54
|
+
* public stack handle (for `runStack`) plus the engine stack and the
|
|
55
|
+
* resolved config path. Fails with a {@link DevstackConfigError}.
|
|
56
|
+
*/
|
|
57
|
+
const loadDevstackConfig = (configPath) => Effect.gen(function* () {
|
|
58
|
+
const abs = resolveConfigPath(configPath);
|
|
59
|
+
if (abs === null) {
|
|
60
|
+
const attempted = configPath !== void 0 ? resolve(process.cwd(), configPath) : resolve(process.cwd(), DEFAULT_CONFIG_PATH);
|
|
61
|
+
return yield* Effect.fail(new DevstackConfigError({
|
|
62
|
+
kind: "not-found",
|
|
63
|
+
message: `devstack config not found at ${attempted}`,
|
|
64
|
+
searchedPaths: [attempted]
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
const url = pathToFileURL(abs).href;
|
|
68
|
+
const mod = yield* Effect.tryPromise({
|
|
69
|
+
try: () => import(url),
|
|
70
|
+
catch: (cause) => new DevstackConfigError({
|
|
71
|
+
kind: "invalid",
|
|
72
|
+
message: `failed to import ${abs}: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
73
|
+
cause
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
return yield* Effect.try({
|
|
77
|
+
try: () => validate(abs, mod),
|
|
78
|
+
catch: (cause) => cause instanceof DevstackConfigError ? cause : new DevstackConfigError({
|
|
79
|
+
kind: "invalid",
|
|
80
|
+
message: `invalid config at ${abs}`,
|
|
81
|
+
cause
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
//#endregion
|
|
86
|
+
export { DEFAULT_CONFIG_PATH, loadDevstackConfig, resolveConfigPath };
|
|
87
|
+
|
|
88
|
+
//# sourceMappingURL=load-config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-config.mjs","names":["resolvePath"],"sources":["../../src/api/load-config.ts"],"sourcesContent":["// CLI-free config loader. Resolves and imports a `devstack.config.ts`,\n// validates its default-exported `Stack`, and returns the public stack\n// handle plus the erased engine stack.\n//\n// This is the single source of truth for config path resolution +\n// loading. The CLI wrapper (`cli/wirings/config-loader.ts`) re-exports\n// `resolveConfigPath`/`DEFAULT_CONFIG_PATH` and translates this module's\n// `DevstackConfigError` into the CLI-flavored `CliConfig*` errors.\n//\n// Why it lives under `api/` and avoids `cli/`/`surfaces/`: build\n// integrations (the vitest `globalSetup`) need to load a config to boot\n// a stack, but must NOT pull the CLI/TUI graph into their bundle. This\n// module depends only on node built-ins, `effect`, and the api/substrate\n// types.\n\nimport { existsSync } from 'node:fs';\nimport { isAbsolute, resolve as resolvePath } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\nimport { Data, Effect } from 'effect';\n\nimport { readStackEngine, type Stack } from './define-devstack.ts';\nimport type { SupervisedStack } from '../substrate/runtime/index.ts';\n\nexport const DEFAULT_CONFIG_PATH = './devstack.config.ts';\n\n/** Resolve a `--config <path>` argument to an absolute path, falling\n * through to a parent-directory search when the default value is\n * used. Returns `null` when no candidate exists. */\nexport const resolveConfigPath = (configPath: string | undefined): string | null => {\n\tconst target = configPath ?? DEFAULT_CONFIG_PATH;\n\tconst explicit = isAbsolute(target) ? target : resolvePath(process.cwd(), target);\n\tif (existsSync(explicit)) return explicit;\n\tif (configPath !== undefined && configPath !== DEFAULT_CONFIG_PATH) return null;\n\tlet dir = process.cwd();\n\tfor (;;) {\n\t\tconst candidate = resolvePath(dir, 'devstack.config.ts');\n\t\tif (existsSync(candidate)) return candidate;\n\t\tconst parent = resolvePath(dir, '..');\n\t\tif (parent === dir) return null;\n\t\tdir = parent;\n\t}\n};\n\n/** Typed failure of {@link loadDevstackConfig}. `kind` distinguishes a\n * missing config from an invalid one so CLI wrappers can map it to the\n * right exit code. */\nexport class DevstackConfigError extends Data.TaggedError('DevstackConfigError')<{\n\treadonly kind: 'not-found' | 'invalid';\n\treadonly message: string;\n\treadonly searchedPaths?: ReadonlyArray<string>;\n\treadonly cause?: unknown;\n}> {}\n\nexport interface LoadedDevstackConfig {\n\t/** The public stack handle exactly as the config default-exported it\n\t * — the value to feed `runStack`. */\n\treadonly stack: Stack<SupervisedStack['members']>;\n\t/** The validated internal engine stack (erased runtime boundary\n\t * shape) — exposes `options.codegen`/`options.stateDir`. */\n\treadonly engine: SupervisedStack;\n\t/** Absolute path of the config file that was loaded. */\n\treadonly resolvedConfigPath: string;\n}\n\nconst validate = (\n\tresolvedConfigPath: string,\n\tmod: { readonly default?: unknown },\n): LoadedDevstackConfig => {\n\tconst def = mod.default;\n\tif (def === null || typeof def !== 'object' || (def as { _tag?: unknown })._tag !== 'Stack') {\n\t\tthrow new DevstackConfigError({\n\t\t\tkind: 'invalid',\n\t\t\tmessage: `config at ${resolvedConfigPath} does not default-export a Stack value (got _tag=${String((def as { _tag?: unknown })?._tag)})`,\n\t\t});\n\t}\n\tconst publicStack = def as Stack<SupervisedStack['members']>;\n\tlet engine: SupervisedStack;\n\ttry {\n\t\tengine = readStackEngine(publicStack);\n\t} catch (cause) {\n\t\tthrow new DevstackConfigError({\n\t\t\tkind: 'invalid',\n\t\t\tmessage: `config at ${resolvedConfigPath} default-exported an invalid Stack handle: ${cause instanceof Error ? cause.message : String(cause)}`,\n\t\t\tcause,\n\t\t});\n\t}\n\treturn { stack: publicStack, engine, resolvedConfigPath };\n};\n\n/**\n * Resolve, import, and validate a `devstack.config.ts`. Returns the\n * public stack handle (for `runStack`) plus the engine stack and the\n * resolved config path. Fails with a {@link DevstackConfigError}.\n */\nexport const loadDevstackConfig = (\n\tconfigPath?: string,\n): Effect.Effect<LoadedDevstackConfig, DevstackConfigError> =>\n\tEffect.gen(function* () {\n\t\tconst abs = resolveConfigPath(configPath);\n\t\tif (abs === null) {\n\t\t\tconst attempted =\n\t\t\t\tconfigPath !== undefined\n\t\t\t\t\t? resolvePath(process.cwd(), configPath)\n\t\t\t\t\t: resolvePath(process.cwd(), DEFAULT_CONFIG_PATH);\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tnew DevstackConfigError({\n\t\t\t\t\tkind: 'not-found',\n\t\t\t\t\tmessage: `devstack config not found at ${attempted}`,\n\t\t\t\t\tsearchedPaths: [attempted],\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\tconst url = pathToFileURL(abs).href;\n\t\tconst mod = yield* Effect.tryPromise({\n\t\t\ttry: () => import(url) as Promise<{ readonly default?: unknown }>,\n\t\t\tcatch: (cause) =>\n\t\t\t\tnew DevstackConfigError({\n\t\t\t\t\tkind: 'invalid',\n\t\t\t\t\tmessage: `failed to import ${abs}: ${cause instanceof Error ? cause.message : String(cause)}`,\n\t\t\t\t\tcause,\n\t\t\t\t}),\n\t\t});\n\t\treturn yield* Effect.try({\n\t\t\ttry: () => validate(abs, mod),\n\t\t\tcatch: (cause) =>\n\t\t\t\tcause instanceof DevstackConfigError\n\t\t\t\t\t? cause\n\t\t\t\t\t: new DevstackConfigError({\n\t\t\t\t\t\t\tkind: 'invalid',\n\t\t\t\t\t\t\tmessage: `invalid config at ${abs}`,\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t}),\n\t\t});\n\t});\n"],"mappings":";;;;;;AAwBA,MAAa,sBAAsB;;;;AAKnC,MAAa,qBAAqB,eAAkD;CACnF,MAAM,SAAS,cAAA;CACf,MAAM,WAAW,WAAW,MAAM,IAAI,SAASA,QAAY,QAAQ,IAAI,GAAG,MAAM;CAChF,IAAI,WAAW,QAAQ,GAAG,OAAO;CACjC,IAAI,eAAe,KAAA,KAAa,eAAA,wBAAoC,OAAO;CAC3E,IAAI,MAAM,QAAQ,IAAI;CACtB,SAAS;EACR,MAAM,YAAYA,QAAY,KAAK,oBAAoB;EACvD,IAAI,WAAW,SAAS,GAAG,OAAO;EAClC,MAAM,SAASA,QAAY,KAAK,IAAI;EACpC,IAAI,WAAW,KAAK,OAAO;EAC3B,MAAM;CACP;AACD;;;;AAKA,IAAa,sBAAb,cAAyC,KAAK,YAAY,qBAAqB,CAAC,CAK7E,CAAC;AAaJ,MAAM,YACL,oBACA,QAC0B;CAC1B,MAAM,MAAM,IAAI;CAChB,IAAI,QAAQ,QAAQ,OAAO,QAAQ,YAAa,IAA2B,SAAS,SACnF,MAAM,IAAI,oBAAoB;EAC7B,MAAM;EACN,SAAS,aAAa,mBAAmB,mDAAmD,OAAQ,KAA4B,IAAI,EAAE;CACvI,CAAC;CAEF,MAAM,cAAc;CACpB,IAAI;CACJ,IAAI;EACH,SAAS,gBAAgB,WAAW;CACrC,SAAS,OAAO;EACf,MAAM,IAAI,oBAAoB;GAC7B,MAAM;GACN,SAAS,aAAa,mBAAmB,6CAA6C,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAC3I;EACD,CAAC;CACF;CACA,OAAO;EAAE,OAAO;EAAa;EAAQ;CAAmB;AACzD;;;;;;AAOA,MAAa,sBACZ,eAEA,OAAO,IAAI,aAAa;CACvB,MAAM,MAAM,kBAAkB,UAAU;CACxC,IAAI,QAAQ,MAAM;EACjB,MAAM,YACL,eAAe,KAAA,IACZA,QAAY,QAAQ,IAAI,GAAG,UAAU,IACrCA,QAAY,QAAQ,IAAI,GAAG,mBAAmB;EAClD,OAAO,OAAO,OAAO,KACpB,IAAI,oBAAoB;GACvB,MAAM;GACN,SAAS,gCAAgC;GACzC,eAAe,CAAC,SAAS;EAC1B,CAAC,CACF;CACD;CACA,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC;CAC/B,MAAM,MAAM,OAAO,OAAO,WAAW;EACpC,WAAW,OAAO;EAClB,QAAQ,UACP,IAAI,oBAAoB;GACvB,MAAM;GACN,SAAS,oBAAoB,IAAI,IAAI,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAC1F;EACD,CAAC;CACH,CAAC;CACD,OAAO,OAAO,OAAO,IAAI;EACxB,WAAW,SAAS,KAAK,GAAG;EAC5B,QAAQ,UACP,iBAAiB,sBACd,QACA,IAAI,oBAAoB;GACxB,MAAM;GACN,SAAS,qBAAqB;GAC9B;EACD,CAAC;CACL,CAAC;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mode-narrowed-factory.mjs","names":[],"sources":["../../src/api/mode-narrowed-factory.ts"],"sourcesContent":["// Mode-narrowed factory helper.\n//\n// Architecture Tension 11 + type-prototype finding #4: a plugin's\n// factories are exposed as an object indexed by `NetworkMode`. When a\n// stack passes a typed-narrow network through `defineDevstackWith`, the\n// callback receives a namespace whose accessible properties are exactly\n// those present in the network's mode branch. Asking for the wrong\n// branch is a compile error at the call site.\n//\n// Two surfaces:\n//\n// - `defineModeNamespace({ local, live, fork })` — plugin authors\n// declare their per-mode factories once; the helper hands back a\n// callable namespace that does the narrowing.\n\nimport type { NetworkConfig, NetworkMode } from '../
|
|
1
|
+
{"version":3,"file":"mode-narrowed-factory.mjs","names":[],"sources":["../../src/api/mode-narrowed-factory.ts"],"sourcesContent":["// Mode-narrowed factory helper.\n//\n// Architecture Tension 11 + type-prototype finding #4: a plugin's\n// factories are exposed as an object indexed by `NetworkMode`. When a\n// stack passes a typed-narrow network through `defineDevstackWith`, the\n// callback receives a namespace whose accessible properties are exactly\n// those present in the network's mode branch. Asking for the wrong\n// branch is a compile error at the call site.\n//\n// Two surfaces:\n//\n// - `defineModeNamespace({ local, live, fork })` — plugin authors\n// declare their per-mode factories once; the helper hands back a\n// callable namespace that does the narrowing.\n\nimport type { NetworkConfig, NetworkMode } from '../plugins/sui/network-config.ts';\n\n/** A factories record keyed by network mode. Each branch is an\n * arbitrary record of factory functions. */\nexport type FactoriesByMode<F extends Partial<Record<NetworkMode, unknown>>> = F;\n\n/** Project the factories record to the branch that matches a network's\n * mode. Branches that aren't present collapse to `never`, which makes\n * the property access fail at compile time. */\nexport type FactoriesFor<\n\tF extends Partial<Record<NetworkMode, unknown>>,\n\tMode extends NetworkMode,\n> = Mode extends keyof F ? F[Mode] : never;\n\n/**\n * Plugin-author entry point. Pass a per-mode factories record; receive\n * a callable namespace. The returned value type is\n * narrowed to the matching mode branch — illegal-mode property access\n * is a compile error.\n *\n * Two casts here are the boundary between runtime breadth and type-level\n * narrowness (type-prototype results §\"Where I had to use any/casts\"):\n * - The runtime returns the full factories record.\n * - The type system projects it down to the matching branch.\n */\nexport type ModeNamespace<F extends Partial<Record<NetworkMode, unknown>>> = <\n\tN extends NetworkConfig,\n>(\n\tnetwork: N,\n) => FactoriesFor<F, N['mode']>;\n\nexport function defineModeNamespace<F extends Partial<Record<NetworkMode, unknown>>>(\n\tfactoriesPerMode: F,\n): ModeNamespace<F> {\n\treturn (<N extends NetworkConfig>(network: N) =>\n\t\tfactoriesPerMode[network.mode as keyof F] as FactoriesFor<F, N['mode']>) as ModeNamespace<F>;\n}\n"],"mappings":";AA8CA,SAAgB,oBACf,kBACmB;CACnB,SAAkC,YACjC,iBAAiB,QAAQ;AAC3B"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { readStackEngine } from "./define-devstack.mjs";
|
|
2
|
+
import { appName, stackName } from "../substrate/brand.mjs";
|
|
3
|
+
import { makeProjectionRefSync } from "../substrate/runtime/projection/state-ref.mjs";
|
|
4
|
+
import "../substrate/runtime/index.mjs";
|
|
5
|
+
import { buildSubstrateLayers, layerProductionOrchestrators, resolveProductionCodegenOptions, superviseStackWithProductionBoot } from "../orchestrators/boot.mjs";
|
|
6
|
+
import { resolveAppName, resolveNetworkSync, resolveStackName, resolveStateDir } from "./inference-network.mjs";
|
|
7
|
+
import { Cause, Deferred, Effect, Exit, Fiber, Layer, Logger, Queue, Ref, Stream } from "effect";
|
|
8
|
+
//#region src/api/run-stack-internal.ts
|
|
9
|
+
const resolveIdentity = (stack, opts, cwd) => {
|
|
10
|
+
const app = resolveAppName({
|
|
11
|
+
explicit: opts?.app,
|
|
12
|
+
cwd
|
|
13
|
+
});
|
|
14
|
+
const stackNameStr = resolveStackName({
|
|
15
|
+
explicit: opts?.stack ?? stack.options.stackName,
|
|
16
|
+
cwd
|
|
17
|
+
});
|
|
18
|
+
const resolved = resolveNetworkSync({
|
|
19
|
+
explicit: opts?.network,
|
|
20
|
+
env: process.env.DEVSTACK_NETWORK,
|
|
21
|
+
explicitSource: "runStack({ identity.network })"
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
app: appName(app),
|
|
25
|
+
stack: stackName(stackNameStr),
|
|
26
|
+
network: resolved.parsed.name
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
const toBootError = (cause) => ({
|
|
30
|
+
_tag: "BootError",
|
|
31
|
+
cause
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Allocate every boot-time handle slot in ONE place.
|
|
35
|
+
*
|
|
36
|
+
* SYNC-SAFETY CONTRACT (the reason this is a sync constructor, not an
|
|
37
|
+
* `Effect`): the handle must expose a real `state` / `commands` queue and
|
|
38
|
+
* be subscribable BEFORE `start` forks the supervisor. `Deferred.make`,
|
|
39
|
+
* `Queue.unbounded`, and `Ref.make` are pure sync effects (no side effects,
|
|
40
|
+
* no async), so `Effect.runSync` is safe for all of them. The projection ref
|
|
41
|
+
* goes through the explicit `makeProjectionRefSync` so the sync contract is
|
|
42
|
+
* pinned at the substrate constructor — if `makeProjectionRef` ever picks up
|
|
43
|
+
* an async/Layer wrapper (`withSpan`, annotation), `makeProjectionRefSync`
|
|
44
|
+
* must stay sync-only or this whole allocation must move behind a
|
|
45
|
+
* Deferred-handoff seam.
|
|
46
|
+
*/
|
|
47
|
+
const makeRunHandleSlots = () => ({
|
|
48
|
+
state: makeProjectionRefSync(),
|
|
49
|
+
bootDeferred: Effect.runSync(Deferred.make()),
|
|
50
|
+
stopRequested: Effect.runSync(Deferred.make()),
|
|
51
|
+
eventQueueRef: Effect.runSync(Deferred.make()),
|
|
52
|
+
commandQueue: Effect.runSync(Queue.unbounded()),
|
|
53
|
+
runCommandRef: Effect.runSync(Deferred.make()),
|
|
54
|
+
fiberRef: Effect.runSync(Deferred.make()),
|
|
55
|
+
startClaim: Effect.runSync(Ref.make(false)),
|
|
56
|
+
midRunCauseRef: Effect.runSync(Ref.make(null))
|
|
57
|
+
});
|
|
58
|
+
/** Compose the public handle + the live `SupervisorHandle` into the
|
|
59
|
+
* `InternalRunHandle` the caller boot hooks receive. The two composed hooks
|
|
60
|
+
* build it identically; factored here so the closure-soundness note (the
|
|
61
|
+
* hooks only deref `publicHandle` at boot, after the body assigns it) lives
|
|
62
|
+
* in one place. */
|
|
63
|
+
const buildInternalHandle = (publicHandle, supervisor) => ({
|
|
64
|
+
...publicHandle,
|
|
65
|
+
supervisor
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* The implementation behind `runStack`. Boots a `Stack` for programmatic
|
|
69
|
+
* embedding and returns a `RunHandle` synchronously; the supervisor fiber
|
|
70
|
+
* is forked on `start`.
|
|
71
|
+
*
|
|
72
|
+
* Lifecycle (identical to `runStack`'s documented contract):
|
|
73
|
+
*
|
|
74
|
+
* 1. `runStackWithBoot(stack, opts)` — synchronous; no fiber forked yet.
|
|
75
|
+
* 2. `await Effect.runPromise(handle.start)` — forks the supervisor,
|
|
76
|
+
* blocks until every plugin reaches `ready` (or fails with
|
|
77
|
+
* `BootError`).
|
|
78
|
+
* 3. Use `handle.events` / `handle.state` to observe.
|
|
79
|
+
* 4. `await Effect.runPromise(handle.stop)` — graceful shutdown.
|
|
80
|
+
* 5. `handle.awaitShutdown` resolves once finalizers complete.
|
|
81
|
+
*
|
|
82
|
+
* Internal architecture: the handle stores a `Deferred` for boot
|
|
83
|
+
* completion. The supervised body resolves it from the SUPERVISOR-OWNED
|
|
84
|
+
* readiness signal — `superviseStackEffect`'s `withinScope` hook fires
|
|
85
|
+
* only after `runInitialAcquire` wins its `raceFirst` against
|
|
86
|
+
* `awaitShutdown` (i.e. once `allReadyOrTerminal` — `ready || done` — is
|
|
87
|
+
* true). This is the same `done`-tolerant gate the long-running CLI path
|
|
88
|
+
* uses; it does NOT watch per-node ready-gates (a non-failed terminal
|
|
89
|
+
* `done` node need never resolve its `awaitReady` gate). Initial-acquire
|
|
90
|
+
* failures surface through the supervised body's `catchCause` tee, which
|
|
91
|
+
* fails the deferred with a `BootError`. `start` awaits it.
|
|
92
|
+
*
|
|
93
|
+
* `opts.commandHandler` threads straight into `superviseStackEffect`'s
|
|
94
|
+
* `commandHandler` slot. `opts.boot` injects caller hooks that run AFTER
|
|
95
|
+
* their built-in counterpart (the PR#21 ordering); their failures fold
|
|
96
|
+
* into `BootError` via the same `catchCause` tee, so `start` keeps its
|
|
97
|
+
* `Effect<void, BootError, never>` type.
|
|
98
|
+
*/
|
|
99
|
+
const runStackWithBoot = (stack, opts = {}) => {
|
|
100
|
+
const engineStack = readStackEngine(stack);
|
|
101
|
+
const runtimeRoot = resolveStateDir({
|
|
102
|
+
runtimeRoot: opts.runtimeRoot,
|
|
103
|
+
stateDir: opts.stateDir ?? engineStack.options.stateDir,
|
|
104
|
+
env: process.env.DEVSTACK_STATE_DIR,
|
|
105
|
+
cwd: process.cwd()
|
|
106
|
+
});
|
|
107
|
+
const appRoot = opts.appRoot ?? process.cwd();
|
|
108
|
+
const identity = resolveIdentity(stack, opts.identity, appRoot);
|
|
109
|
+
const codegen = opts.codegen ?? engineStack.options.codegen;
|
|
110
|
+
const supervisedStack = {
|
|
111
|
+
_tag: "Stack",
|
|
112
|
+
members: engineStack.members,
|
|
113
|
+
options: engineStack.options
|
|
114
|
+
};
|
|
115
|
+
const { state, bootDeferred, stopRequested, eventQueueRef, commandQueue, runCommandRef, fiberRef, startClaim, midRunCauseRef } = makeRunHandleSlots();
|
|
116
|
+
const substrate = layerProductionOrchestrators({ codegen: resolveProductionCodegenOptions({
|
|
117
|
+
appRoot,
|
|
118
|
+
effectiveStack: String(identity.stack),
|
|
119
|
+
codegen
|
|
120
|
+
}) }).pipe(Layer.provideMerge(buildSubstrateLayers(identity, runtimeRoot)));
|
|
121
|
+
const runCommand = (command) => Effect.flatMap(Deferred.await(runCommandRef), (dispatch) => dispatch(command));
|
|
122
|
+
const events = Stream.unwrap(Effect.gen(function* () {
|
|
123
|
+
const queue = yield* Deferred.await(eventQueueRef);
|
|
124
|
+
return Stream.fromQueue(queue);
|
|
125
|
+
}));
|
|
126
|
+
let publicHandle;
|
|
127
|
+
const supervised = Effect.gen(function* () {
|
|
128
|
+
const commandHandler = opts.commandHandler === void 0 ? void 0 : yield* opts.commandHandler;
|
|
129
|
+
yield* superviseStackWithProductionBoot(supervisedStack, identity, state, {
|
|
130
|
+
extras: stack.options.extras,
|
|
131
|
+
networkOptions: stack.options.networkOptions,
|
|
132
|
+
...opts.boot?.devstackVersion === void 0 ? {} : { devstackVersion: opts.boot.devstackVersion },
|
|
133
|
+
...commandHandler === void 0 ? {} : { commandHandler },
|
|
134
|
+
...opts.extendContext === void 0 ? {} : { extendContextAfterBuiltIn: opts.extendContext },
|
|
135
|
+
beforeInitialAcquire: (handle) => Effect.gen(function* () {
|
|
136
|
+
yield* Deferred.succeed(eventQueueRef, handle.events).pipe(Effect.catch(() => Effect.void));
|
|
137
|
+
yield* Deferred.succeed(runCommandRef, handle.runCommand).pipe(Effect.catch(() => Effect.void));
|
|
138
|
+
yield* Effect.forkScoped(Effect.gen(function* () {
|
|
139
|
+
while (true) {
|
|
140
|
+
const command = yield* Queue.take(commandQueue);
|
|
141
|
+
yield* Queue.offer(handle.commands, command);
|
|
142
|
+
}
|
|
143
|
+
}));
|
|
144
|
+
yield* Effect.forkScoped(Effect.gen(function* () {
|
|
145
|
+
yield* Deferred.await(stopRequested);
|
|
146
|
+
yield* Queue.offer(handle.commands, { tag: "shutdown.requested" });
|
|
147
|
+
}));
|
|
148
|
+
if (opts.boot?.beforeInitialAcquire !== void 0) yield* opts.boot.beforeInitialAcquire(buildInternalHandle(publicHandle, handle));
|
|
149
|
+
}),
|
|
150
|
+
withinScope: (handle) => Effect.gen(function* () {
|
|
151
|
+
let firstFailure = null;
|
|
152
|
+
for (const [key] of handle.graph.nodes) if ((yield* handle.registry.getStatus(key).pipe(Effect.catch(() => Effect.succeed("failed")))) === "failed") {
|
|
153
|
+
const failureExit = yield* Effect.exit(handle.registry.awaitReady(key));
|
|
154
|
+
firstFailure = toBootError(Exit.isFailure(failureExit) ? failureExit.cause : Cause.empty);
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
if (firstFailure === null) yield* Deferred.succeed(bootDeferred, void 0).pipe(Effect.asVoid);
|
|
158
|
+
else yield* Deferred.fail(bootDeferred, firstFailure).pipe(Effect.asVoid);
|
|
159
|
+
if (opts.boot?.withinScope !== void 0) yield* opts.boot.withinScope(buildInternalHandle(publicHandle, handle));
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
const loggerLayer = Logger.layer([]);
|
|
164
|
+
const supervisedProgram = supervised.pipe(Effect.provide(substrate), Effect.provide(loggerLayer)).pipe(Effect.catchCause((cause) => Effect.gen(function* () {
|
|
165
|
+
const bootAlreadyCompleted = yield* Deferred.isDone(bootDeferred);
|
|
166
|
+
yield* Deferred.fail(bootDeferred, toBootError(cause)).pipe(Effect.asVoid, Effect.catch(() => Effect.void));
|
|
167
|
+
if (bootAlreadyCompleted) yield* Ref.set(midRunCauseRef, cause);
|
|
168
|
+
yield* Effect.logError(`devstack runStack: supervisor died\n${Cause.pretty(cause)}`);
|
|
169
|
+
})));
|
|
170
|
+
publicHandle = {
|
|
171
|
+
start: Effect.uninterruptibleMask((restore) => Effect.gen(function* () {
|
|
172
|
+
if (yield* Ref.modify(startClaim, (started) => started ? [false, true] : [true, true])) {
|
|
173
|
+
const fiber = yield* Effect.forkDetach(supervisedProgram);
|
|
174
|
+
yield* Deferred.succeed(fiberRef, fiber);
|
|
175
|
+
}
|
|
176
|
+
yield* restore(Deferred.await(bootDeferred));
|
|
177
|
+
})),
|
|
178
|
+
stop: Effect.gen(function* () {
|
|
179
|
+
yield* Deferred.succeed(stopRequested, void 0).pipe(Effect.catch(() => Effect.void));
|
|
180
|
+
if (!(yield* Deferred.isDone(fiberRef))) return;
|
|
181
|
+
const fiber = yield* Deferred.await(fiberRef);
|
|
182
|
+
yield* Fiber.await(fiber);
|
|
183
|
+
}),
|
|
184
|
+
awaitShutdown: Effect.gen(function* () {
|
|
185
|
+
if (!(yield* Deferred.isDone(fiberRef))) return;
|
|
186
|
+
const fiber = yield* Deferred.await(fiberRef);
|
|
187
|
+
yield* Fiber.await(fiber);
|
|
188
|
+
const midRunCause = yield* Ref.get(midRunCauseRef);
|
|
189
|
+
if (midRunCause !== null) return yield* Effect.failCause(midRunCause);
|
|
190
|
+
}),
|
|
191
|
+
events,
|
|
192
|
+
state,
|
|
193
|
+
commands: commandQueue,
|
|
194
|
+
runCommand,
|
|
195
|
+
identity
|
|
196
|
+
};
|
|
197
|
+
return publicHandle;
|
|
198
|
+
};
|
|
199
|
+
//#endregion
|
|
200
|
+
export { runStackWithBoot };
|
|
201
|
+
|
|
202
|
+
//# sourceMappingURL=run-stack-internal.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-stack-internal.mjs","names":[],"sources":["../../src/api/run-stack-internal.ts"],"sourcesContent":["// `runStackWithBoot(stack, optsWithBoot)` — the NON-PUBLIC seam under\n// `runStack`.\n//\n// `api/run-stack.ts` is the thin PUBLIC facade: `runStack` delegates here\n// with a zero-`boot` bag, so the public surface (`RunHandle`,\n// `RunStackOptions`, `BootError`) and the zero-`boot` path stay\n// byte-identical. This module owns the supervised-body construction and\n// the caller-injectable boot hook seam the CLI `up` verb routes through.\n//\n// Why a seam at all: the CLI `up` verb needs the SAME substrate Layer\n// composition + supervised body `runStack` builds, but wrapped with extra\n// `beforeInitialAcquire`/`withinScope` work (interrupted-restore recovery,\n// the roster lock, the command-channel IPC bridge, and the TUI surface).\n// `runStackWithBoot` threads those as CALLER-INJECTED hooks so\n// the CLI consumes ONE boot core instead of forking it. Because the bag is\n// non-public, its hooks receive an `InternalRunHandle` that additionally\n// carries the live `SupervisorHandle` (the seam the CLI hooks drain) —\n// substrate detail that NEVER reaches the public `RunHandle`.\n//\n// PR#21 boot-ordering invariant (do not reorder): the composed hooks run\n// the BUILT-IN work FIRST, then the caller's. For `beforeInitialAcquire`\n// this means the event-queue handoff + stop-bridge + command-pump are armed\n// before any caller hook runs (so a `stop()` during a caller hook always\n// has a bridge) AND before the first acquire (`superviseStackEffect` runs\n// the whole composed `beforeInitialAcquire` ahead of `runInitialAcquire`).\n// For `withinScope` the built-in readiness-gate resolution (the status\n// scan that resolves `bootDeferred`) runs first, so a caller `withinScope`\n// can never delay `handle.start`.\n\nimport {\n\tCause,\n\tDeferred,\n\tEffect,\n\tExit,\n\tFiber,\n\ttype FileSystem,\n\tLayer,\n\tLogger,\n\tQueue,\n\tRef,\n\ttype Scope,\n\tStream,\n\ttype SubscriptionRef,\n} from 'effect';\n\nimport { appName, stackName } from '../substrate/brand.ts';\nimport type { Identity } from '../substrate/identity.ts';\nimport type { EngineCommand, EngineEvent } from '../substrate/events.ts';\nimport { makeProjectionRefSync } from '../substrate/runtime/index.ts';\nimport type { StackPathsService } from '../substrate/runtime/paths.ts';\nimport type { SnapshotOrchestratorService } from '../orchestrators/snapshot/index.ts';\nimport type {\n\tSupervisorCommandHandler,\n\tSupervisorHandle,\n} from '../substrate/runtime/supervisor/index.ts';\nimport {\n\tbuildSubstrateLayers,\n\tlayerProductionOrchestrators,\n\tresolveProductionCodegenOptions,\n\tsuperviseStackWithProductionBoot,\n} from '../orchestrators/boot.ts';\nimport { readStackEngine, type Stack } from './define-devstack.ts';\nimport type { AnyPlugin } from '../substrate/plugin.ts';\nimport {\n\tresolveAppName,\n\tresolveNetworkSync,\n\tresolveStackName,\n\tresolveStateDir,\n} from './inference-network.ts';\nimport type {\n\tBootError,\n\tRunHandle,\n\tRunStackIdentityOptions,\n\tRunStackOptions,\n} from './run-stack.ts';\n\n// -----------------------------------------------------------------------------\n// Internal handle + boot bag\n// -----------------------------------------------------------------------------\n\n/** The handle the caller-injected `boot` hooks receive. It is the public\n * `RunHandle` PLUS the live `SupervisorHandle` — the substrate seam the\n * CLI `up` hooks drain (roster lock keys off it, the IPC bridge tails\n * `supervisor.events` / pumps `supervisor.commands`, the TUI mounts\n * `supervisor.state`). NON-PUBLIC: `index.ts` never re-exports it, so the\n * `SupervisorHandle` substrate type stays off the public surface. */\nexport interface InternalRunHandle extends RunHandle {\n\t/** The live supervisor handle for this boot. Available inside both\n\t * composed hooks; carries `events`/`commands`/`runCommand`/`state`/\n\t * `graph`/`registry` the CLI hooks consume directly. */\n\treadonly supervisor: SupervisorHandle;\n}\n\n/** The substrate services the seam already has in scope when it runs the\n * caller hooks (the composed `beforeInitialAcquire`/`withinScope` run\n * inside `superviseStackEffect`, which is `Effect.provide(substrate)`).\n * The bag hooks may yield these directly — the CLI `up` hooks drive the\n * ONE `SnapshotOrchestratorService` instance the supervisor's contribution\n * dispatcher registers participants on (so an operator `snapshot save`\n * captures the LIVE participant set, not an empty one off a sibling\n * orchestrator), plus `FileSystem`/`StackPathsService` for the\n * interrupted-restore + roster paths. `Scope.Scope` lets a hook fork\n * scoped fibers (the IPC pump, the TUI mount) onto the supervised scope.\n * NON-PUBLIC: like `InternalRunHandle`, this never reaches the public\n * `runStack` facade. */\nexport type BootHookServices =\n\t| Scope.Scope\n\t| SnapshotOrchestratorService\n\t| FileSystem.FileSystem\n\t| StackPathsService;\n\n/** Caller-injected boot hooks. Both run AFTER their built-in counterpart\n * (see the PR#21 ordering note at the top of this file). Their failures\n * fold into `BootError.cause` via the same `catchCause` tee the built-in\n * work uses, so `handle.start` stays `Effect<void, BootError, never>` —\n * the bag does NOT widen the public error channel. The R-channel is\n * `BootHookServices` (substrate services the seam already provides), NOT\n * `never`: the hooks run inside the supervised scope and may drive the\n * seam's live substrate (notably the supervisor's snapshot orchestrator). */\nexport interface RunStackBootBag {\n\treadonly devstackVersion?: string;\n\treadonly beforeInitialAcquire?: (\n\t\thandle: InternalRunHandle,\n\t) => Effect.Effect<void, unknown, BootHookServices>;\n\treadonly withinScope?: (\n\t\thandle: InternalRunHandle,\n\t) => Effect.Effect<void, unknown, BootHookServices>;\n}\n\n/** The substrate services a {@link CommandHandlerFactory} may yield — the\n * same singletons the contribution dispatcher + boot hooks see, minus\n * `Scope.Scope` (the factory runs before the supervised scope opens, so it\n * forks nothing). A handler closes over `SnapshotOrchestratorService` to\n * capture the LIVE participant set and `FileSystem` to thread it into the\n * snapshot I/O. */\ntype CommandHandlerServices =\n\t| SnapshotOrchestratorService\n\t| FileSystem.FileSystem\n\t| StackPathsService;\n\n/** A FACTORY for the supervisor command handler. The seam runs it ONCE,\n * inside the supervised body (so `CommandHandlerServices` — notably the live\n * `SnapshotOrchestratorService` + `FileSystem` — are in scope), BEFORE it\n * hands `startSupervisor` the resolved handler. So the resulting handler\n * (whose own R-channel is `never`, as the supervisor command loop requires)\n * closes over the seam's REAL substrate instances directly — no Deferred\n * hand-off. Resolving the snapshot orchestrator here yields the SAME\n * instance the contribution dispatcher registers live participants on, so an\n * operator `snapshot save` captures the LIVE chain/blob/db state, not an\n * empty set off a sibling orchestrator. */\nexport type CommandHandlerFactory = Effect.Effect<\n\tSupervisorCommandHandler,\n\tnever,\n\tCommandHandlerServices\n>;\n\n/** `RunStackOptions` plus the non-public injection points. `commandHandler`\n * is a FACTORY the seam resolves against its live substrate (see\n * {@link CommandHandlerFactory}); `boot` carries the caller-injected hooks. */\nexport interface RunStackOptionsWithBoot extends RunStackOptions {\n\treadonly commandHandler?: CommandHandlerFactory;\n\treadonly boot?: RunStackBootBag;\n}\n\n// -----------------------------------------------------------------------------\n// Identity resolution\n// -----------------------------------------------------------------------------\n\nconst resolveIdentity = (\n\tstack: Stack<ReadonlyArray<AnyPlugin>>,\n\topts: RunStackIdentityOptions | undefined,\n\tcwd: string,\n): Identity => {\n\tconst app = resolveAppName({\n\t\texplicit: opts?.app,\n\t\tcwd,\n\t});\n\tconst stackNameStr = resolveStackName({\n\t\texplicit: opts?.stack ?? stack.options.stackName,\n\t\tcwd,\n\t});\n\t// Parse + validate up-front so a malformed value fails here rather\n\t// than downstream when a plugin probes the network. The identity's\n\t// network is the canonical name (`localnet`, `testnet`, …) — never the\n\t// `sui:`-prefixed wallet-standard form, which devstack does not use\n\t// internally — so plugin checks and on-disk cache namespaces key on one\n\t// stable name regardless of how it was spelled on the CLI.\n\tconst resolved = resolveNetworkSync({\n\t\texplicit: opts?.network,\n\t\tenv: process.env.DEVSTACK_NETWORK,\n\t\texplicitSource: 'runStack({ identity.network })',\n\t});\n\treturn {\n\t\tapp: appName(app),\n\t\tstack: stackName(stackNameStr),\n\t\tnetwork: resolved.parsed.name,\n\t};\n};\n\nconst toBootError = (cause: Cause.Cause<unknown>): BootError => ({\n\t_tag: 'BootError',\n\tcause,\n});\n\n// -----------------------------------------------------------------------------\n// Boot-time handle slots\n// -----------------------------------------------------------------------------\n\n/** The mutable cells + ref the handle's lifecycle effects close over. Every\n * field is allocated SYNCHRONOUSLY in `makeRunHandleSlots` (see its\n * sync-safety contract) so the public handle can expose a live `state` /\n * `commands` queue and let callers subscribe to `state.changes` BEFORE\n * `start` ever forks the supervisor fiber. */\ninterface RunHandleSlots {\n\t/** The supervisor's live projection. Seeded sync; populated by the\n\t * supervised body once it boots. */\n\treadonly state: SubscriptionRef.SubscriptionRef<\n\t\timport('../substrate/projection.ts').SubscribableState\n\t>;\n\t/** Resolved (or failed with `BootError`) by the readiness gate; `start`\n\t * awaits it. */\n\treadonly bootDeferred: Deferred.Deferred<void, BootError>;\n\t/** Set by `stop`; the built-in stop-bridge awaits it and offers\n\t * `shutdown.requested` onto the supervisor's command channel. */\n\treadonly stopRequested: Deferred.Deferred<void>;\n\t/** Handed the supervisor's event dequeue by `beforeInitialAcquire`; the\n\t * public `events` stream unwraps it. */\n\treadonly eventQueueRef: Deferred.Deferred<Queue.Dequeue<EngineEvent>>;\n\t/** Public command channel, pumped onto the supervisor's own queue once it\n\t * boots — the TUI/IPC publish target. */\n\treadonly commandQueue: Queue.Queue<EngineCommand>;\n\t/** Handed the supervisor's submit-and-await dispatch by\n\t * `beforeInitialAcquire`; the public `runCommand` awaits it. */\n\treadonly runCommandRef: Deferred.Deferred<\n\t\t(command: EngineCommand) => Effect.Effect<void, unknown, never>\n\t>;\n\t/** Holds the forked supervisor fiber; `stop`/`awaitShutdown` await it. */\n\treadonly fiberRef: Deferred.Deferred<Fiber.Fiber<void, never>>;\n\t/** Single-fire guard so a second `start` is a no-op. */\n\treadonly startClaim: Ref.Ref<boolean>;\n\t/** Tee for a mid-run defect/failure raised AFTER boot completed, so\n\t * `awaitShutdown` can re-surface it (a post-boot `Deferred.fail` is a\n\t * no-op). */\n\treadonly midRunCauseRef: Ref.Ref<Cause.Cause<unknown> | null>;\n}\n\n/**\n * Allocate every boot-time handle slot in ONE place.\n *\n * SYNC-SAFETY CONTRACT (the reason this is a sync constructor, not an\n * `Effect`): the handle must expose a real `state` / `commands` queue and\n * be subscribable BEFORE `start` forks the supervisor. `Deferred.make`,\n * `Queue.unbounded`, and `Ref.make` are pure sync effects (no side effects,\n * no async), so `Effect.runSync` is safe for all of them. The projection ref\n * goes through the explicit `makeProjectionRefSync` so the sync contract is\n * pinned at the substrate constructor — if `makeProjectionRef` ever picks up\n * an async/Layer wrapper (`withSpan`, annotation), `makeProjectionRefSync`\n * must stay sync-only or this whole allocation must move behind a\n * Deferred-handoff seam.\n */\nconst makeRunHandleSlots = (): RunHandleSlots => ({\n\tstate: makeProjectionRefSync(),\n\tbootDeferred: Effect.runSync(Deferred.make<void, BootError>()),\n\tstopRequested: Effect.runSync(Deferred.make<void>()),\n\teventQueueRef: Effect.runSync(Deferred.make<Queue.Dequeue<EngineEvent>>()),\n\tcommandQueue: Effect.runSync(Queue.unbounded<EngineCommand>()),\n\trunCommandRef: Effect.runSync(\n\t\tDeferred.make<(command: EngineCommand) => Effect.Effect<void, unknown, never>>(),\n\t),\n\tfiberRef: Effect.runSync(Deferred.make<Fiber.Fiber<void, never>>()),\n\tstartClaim: Effect.runSync(Ref.make(false)),\n\tmidRunCauseRef: Effect.runSync(Ref.make<Cause.Cause<unknown> | null>(null)),\n});\n\n/** Compose the public handle + the live `SupervisorHandle` into the\n * `InternalRunHandle` the caller boot hooks receive. The two composed hooks\n * build it identically; factored here so the closure-soundness note (the\n * hooks only deref `publicHandle` at boot, after the body assigns it) lives\n * in one place. */\nconst buildInternalHandle = (\n\tpublicHandle: RunHandle,\n\tsupervisor: SupervisorHandle,\n): InternalRunHandle => ({ ...publicHandle, supervisor });\n\n// -----------------------------------------------------------------------------\n// runStackWithBoot\n// -----------------------------------------------------------------------------\n\n/**\n * The implementation behind `runStack`. Boots a `Stack` for programmatic\n * embedding and returns a `RunHandle` synchronously; the supervisor fiber\n * is forked on `start`.\n *\n * Lifecycle (identical to `runStack`'s documented contract):\n *\n * 1. `runStackWithBoot(stack, opts)` — synchronous; no fiber forked yet.\n * 2. `await Effect.runPromise(handle.start)` — forks the supervisor,\n * blocks until every plugin reaches `ready` (or fails with\n * `BootError`).\n * 3. Use `handle.events` / `handle.state` to observe.\n * 4. `await Effect.runPromise(handle.stop)` — graceful shutdown.\n * 5. `handle.awaitShutdown` resolves once finalizers complete.\n *\n * Internal architecture: the handle stores a `Deferred` for boot\n * completion. The supervised body resolves it from the SUPERVISOR-OWNED\n * readiness signal — `superviseStackEffect`'s `withinScope` hook fires\n * only after `runInitialAcquire` wins its `raceFirst` against\n * `awaitShutdown` (i.e. once `allReadyOrTerminal` — `ready || done` — is\n * true). This is the same `done`-tolerant gate the long-running CLI path\n * uses; it does NOT watch per-node ready-gates (a non-failed terminal\n * `done` node need never resolve its `awaitReady` gate). Initial-acquire\n * failures surface through the supervised body's `catchCause` tee, which\n * fails the deferred with a `BootError`. `start` awaits it.\n *\n * `opts.commandHandler` threads straight into `superviseStackEffect`'s\n * `commandHandler` slot. `opts.boot` injects caller hooks that run AFTER\n * their built-in counterpart (the PR#21 ordering); their failures fold\n * into `BootError` via the same `catchCause` tee, so `start` keeps its\n * `Effect<void, BootError, never>` type.\n */\nexport const runStackWithBoot = (\n\tstack: Stack<ReadonlyArray<AnyPlugin>>,\n\topts: RunStackOptionsWithBoot = {},\n): RunHandle => {\n\tconst engineStack = readStackEngine(stack);\n\tconst runtimeRoot = resolveStateDir({\n\t\truntimeRoot: opts.runtimeRoot,\n\t\tstateDir: opts.stateDir ?? engineStack.options.stateDir,\n\t\tenv: process.env.DEVSTACK_STATE_DIR,\n\t\tcwd: process.cwd(),\n\t});\n\tconst appRoot = opts.appRoot ?? process.cwd();\n\tconst identity = resolveIdentity(stack, opts.identity, appRoot);\n\tconst codegen = opts.codegen ?? engineStack.options.codegen;\n\n\tconst supervisedStack = {\n\t\t_tag: 'Stack' as const,\n\t\tmembers: engineStack.members,\n\t\toptions: engineStack.options,\n\t};\n\n\t// Every boot-time handle slot is allocated in ONE place (the sync-safety\n\t// contract lives on `makeRunHandleSlots`): the handle must expose a live\n\t// `state` / `commands` queue and be subscribable BEFORE `start` forks the\n\t// supervisor fiber.\n\tconst {\n\t\tstate,\n\t\tbootDeferred,\n\t\tstopRequested,\n\t\teventQueueRef,\n\t\tcommandQueue,\n\t\trunCommandRef,\n\t\tfiberRef,\n\t\tstartClaim,\n\t\tmidRunCauseRef,\n\t} = makeRunHandleSlots();\n\n\t// Resolve the per-stack LIVE codegen output location through the ONE\n\t// shared boot seam: EVERY live run emits into\n\t// `.devstack/stacks/<stack>/generated/` (gitignored), so the id-bearing\n\t// tree never lands in committed source. The committed `src/generated`\n\t// tree is owned solely by the stack-free `codegen` verb. An explicit\n\t// `opts.codegen` (or the stack's own `codegen`) is honored verbatim by\n\t// the resolver. The effective stack (the resolved `identity.stack`) is\n\t// in scope here, exactly as in the CLI's `buildVerbLayers` seam — both\n\t// route through `resolveProductionCodegenOptions`.\n\tconst substrate = layerProductionOrchestrators({\n\t\tcodegen: resolveProductionCodegenOptions({\n\t\t\tappRoot,\n\t\t\teffectiveStack: String(identity.stack),\n\t\t\tcodegen,\n\t\t}),\n\t}).pipe(Layer.provideMerge(buildSubstrateLayers(identity, runtimeRoot)));\n\n\t// The submit-and-await dispatch surfaced on the public handle. Awaits\n\t// the supervisor's `runCommand` (wired in the built-in\n\t// `beforeInitialAcquire`), then delegates.\n\tconst runCommand = (command: EngineCommand): Effect.Effect<void, unknown, never> =>\n\t\tEffect.flatMap(Deferred.await(runCommandRef), (dispatch) => dispatch(command));\n\n\tconst events: Stream.Stream<EngineEvent, never, never> = Stream.unwrap(\n\t\tEffect.gen(function* () {\n\t\t\tconst queue = yield* Deferred.await(eventQueueRef);\n\t\t\treturn Stream.fromQueue(queue);\n\t\t}),\n\t);\n\n\t// The PUBLIC handle is assigned exactly once at the end of this body\n\t// (after the lifecycle effects exist) and returned. The composed boot\n\t// hooks below close over `publicHandle` to build an `InternalRunHandle`\n\t// (the public handle + the live `SupervisorHandle`), but they only\n\t// deref it at BOOT time — long after this synchronous body finishes and\n\t// assigns it — so the closure is sound. Declared with a forward `let`\n\t// rather than mutated readonly fields so `RunHandle` stays immutable.\n\tlet publicHandle: RunHandle;\n\n\tconst supervised = Effect.gen(function* () {\n\t\t// Resolve the command-handler FACTORY against the seam's live\n\t\t// substrate (in scope here via `Effect.provide(substrate)` below)\n\t\t// BEFORE `startSupervisor` consumes the handler. The factory closes\n\t\t// over the same `SnapshotOrchestratorService` the contribution\n\t\t// dispatcher registers participants on, so the resulting handler\n\t\t// (R = `never`, as the command loop requires) drives the LIVE state.\n\t\tconst commandHandler =\n\t\t\topts.commandHandler === undefined ? undefined : yield* opts.commandHandler;\n\t\t// The shared production-boot assembly (contribution dispatcher +\n\t\t// post-acquire hook + built-in plugin-context extension, then\n\t\t// `layerBuiltInPluginRuntime`) lives in ONE place\n\t\t// (`orchestrators/boot.ts superviseStackWithProductionBoot`). This\n\t\t// seam supplies only the LONG-RUNNING-specific wrapping: the\n\t\t// resolved command handler, the public `runStack({ extendContext })`\n\t\t// chained after the built-in, and the composed boot hooks below.\n\t\tyield* superviseStackWithProductionBoot(supervisedStack, identity, state, {\n\t\t\textras: stack.options.extras,\n\t\t\tnetworkOptions: stack.options.networkOptions,\n\t\t\t...(opts.boot?.devstackVersion === undefined\n\t\t\t\t? {}\n\t\t\t\t: { devstackVersion: opts.boot.devstackVersion }),\n\t\t\t...(commandHandler === undefined ? {} : { commandHandler }),\n\t\t\t...(opts.extendContext === undefined\n\t\t\t\t? {}\n\t\t\t\t: { extendContextAfterBuiltIn: opts.extendContext }),\n\t\t\t// ── COMPOSED `beforeInitialAcquire` (ONE ordered gen) ──────────\n\t\t\t// ORDER (PR#21-load-bearing): BUILT-IN work first, THEN caller.\n\t\t\t// 1. built-in: event-queue handoff + runCommand surface +\n\t\t\t// command-pump fork + stop-bridge fork.\n\t\t\t// 2. caller: `opts.boot?.beforeInitialAcquire(...)`.\n\t\t\t// `superviseStackEffect` runs this whole composed effect BEFORE\n\t\t\t// `runInitialAcquire`, so the caller hook (the CLI's recover/\n\t\t\t// roster/IPC/TUI bundle) runs before first acquire too; and because\n\t\t\t// the built-in stop-bridge is armed first, a `stop()` raised during\n\t\t\t// a caller hook always has a command bridge.\n\t\t\tbeforeInitialAcquire: (handle) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tyield* Deferred.succeed(eventQueueRef, handle.events).pipe(\n\t\t\t\t\t\tEffect.catch(() => Effect.void),\n\t\t\t\t\t);\n\t\t\t\t\t// Surface the supervisor's submit-and-await dispatch onto the\n\t\t\t\t\t// public handle BEFORE acquire so a boot failure can't leave\n\t\t\t\t\t// the handle without a command bridge.\n\t\t\t\t\tyield* Deferred.succeed(runCommandRef, handle.runCommand).pipe(\n\t\t\t\t\t\tEffect.catch(() => Effect.void),\n\t\t\t\t\t);\n\t\t\t\t\t// Pump the eager public command queue onto the supervisor's\n\t\t\t\t\t// own command queue (`handle.commands` — the seam the signal\n\t\t\t\t\t// handler + command loop drain). A publish on the public\n\t\t\t\t\t// queue therefore always reaches the supervisor's drain.\n\t\t\t\t\tyield* Effect.forkScoped(\n\t\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\t\twhile (true) {\n\t\t\t\t\t\t\t\tconst command = yield* Queue.take(commandQueue);\n\t\t\t\t\t\t\t\tyield* Queue.offer(handle.commands, command);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\n\t\t\t\t\t// Bridge `stop` requests onto the supervisor's command\n\t\t\t\t\t// channel before acquire starts so a boot failure cannot\n\t\t\t\t\t// leave the public handle without an event/command bridge.\n\t\t\t\t\tyield* Effect.forkScoped(\n\t\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\t\tyield* Deferred.await(stopRequested);\n\t\t\t\t\t\t\tyield* Queue.offer(handle.commands, {\n\t\t\t\t\t\t\t\ttag: 'shutdown.requested',\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\n\t\t\t\t\t// Caller-injected work runs AFTER the built-in bridges are\n\t\t\t\t\t// armed. Its failures fold into the supervised body's\n\t\t\t\t\t// `catchCause` below (and thence into `BootError`).\n\t\t\t\t\tif (opts.boot?.beforeInitialAcquire !== undefined) {\n\t\t\t\t\t\tyield* opts.boot.beforeInitialAcquire(buildInternalHandle(publicHandle, handle));\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t// ── COMPOSED `withinScope` (ONE ordered gen) ───────────────────\n\t\t\t// ORDER: BUILT-IN readiness-gate resolution first, THEN caller.\n\t\t\t// 1. built-in: the status scan that resolves `bootDeferred`.\n\t\t\t// 2. caller: `opts.boot?.withinScope(...)`.\n\t\t\t// Resolving the gate first means a caller `withinScope` can never\n\t\t\t// delay `handle.start`.\n\t\t\twithinScope: (handle) =>\n\t\t\t\t// Resolve the boot gate from the SUPERVISOR-OWNED readiness\n\t\t\t\t// signal. `superviseStackEffect` only calls `withinScope`\n\t\t\t\t// after `runInitialAcquire` wins its `raceFirst` against\n\t\t\t\t// `awaitShutdown` and yields `'booted'` (boot.ts) — i.e. once\n\t\t\t\t// `allReadyOrTerminal` is true (`ready || done`). This is the\n\t\t\t\t// SAME `done`-tolerant gate the long-running CLI path uses,\n\t\t\t\t// not a per-node `awaitReady` watcher (whose ready-gate a\n\t\t\t\t// non-failed terminal `done` node need never resolve, so it\n\t\t\t\t// would hang here).\n\t\t\t\t//\n\t\t\t\t// `runInitialAcquire` does NOT itself fail on a per-PLUGIN\n\t\t\t\t// acquire failure: `acquireFullGraph` swallows node failures\n\t\t\t\t// into the registry's `failed` status (the CLI surfaces them as\n\t\t\t\t// red TUI rows and keeps the stack up). runStack's contract is\n\t\t\t\t// stricter — `start` FAILS with `BootError` if any node failed\n\t\t\t\t// initial acquire. So gate on the STATUS contract here: succeed\n\t\t\t\t// iff every node is `ready`/`done`, else fail with the first\n\t\t\t\t// `failed` node's `PluginAcquireFailed` cause. A failed node's\n\t\t\t\t// ready-gate IS resolved (markFailed failed it), so reading it\n\t\t\t\t// is hang-free — the `done`-tolerant equivalent of the old\n\t\t\t\t// watcher's failure detection. (Post-acquire HOOK failures —\n\t\t\t\t// codegen / manifest — fail `runInitialAcquire` directly and\n\t\t\t\t// tee through the supervised body's `catchCause` below; we\n\t\t\t\t// never reach here on that path.)\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tlet firstFailure: BootError | null = null;\n\t\t\t\t\tfor (const [key] of handle.graph.nodes) {\n\t\t\t\t\t\tconst status = yield* handle.registry\n\t\t\t\t\t\t\t.getStatus(key)\n\t\t\t\t\t\t\t.pipe(Effect.catch(() => Effect.succeed('failed' as const)));\n\t\t\t\t\t\tif (status === 'failed') {\n\t\t\t\t\t\t\tconst failureExit = yield* Effect.exit(handle.registry.awaitReady(key));\n\t\t\t\t\t\t\tfirstFailure = toBootError(\n\t\t\t\t\t\t\t\tExit.isFailure(failureExit) ? failureExit.cause : Cause.empty,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (firstFailure === null) {\n\t\t\t\t\t\tyield* Deferred.succeed(bootDeferred, undefined).pipe(Effect.asVoid);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tyield* Deferred.fail(bootDeferred, firstFailure).pipe(Effect.asVoid);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Caller-injected work runs AFTER the boot gate is resolved,\n\t\t\t\t\t// so it can never delay `handle.start`. Its failures fold\n\t\t\t\t\t// into the supervised body's `catchCause` below; since the\n\t\t\t\t\t// boot gate already succeeded by this point, such a failure\n\t\t\t\t\t// surfaces on `awaitShutdown` (mid-run), not `start` — the\n\t\t\t\t\t// same place a built-in `withinScope` failure would land.\n\t\t\t\t\tif (opts.boot?.withinScope !== undefined) {\n\t\t\t\t\t\tyield* opts.boot.withinScope(buildInternalHandle(publicHandle, handle));\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t});\n\t});\n\n\tconst loggerLayer = Logger.layer([]);\n\tconst layered = supervised.pipe(Effect.provide(substrate), Effect.provide(loggerLayer));\n\n\t// Convert any uncaught cause into a boot failure if the deferred\n\t// hasn't completed. If `bootDeferred` HAS already succeeded then\n\t// `Deferred.fail` is a no-op — the cause is a mid-run failure\n\t// (e.g. a plugin scope finalizer defect) and would otherwise be\n\t// silently dropped: the fiber exits `Success(void)` and\n\t// `awaitShutdown` resolves clean. Tee the cause into\n\t// `midRunCauseRef` so `awaitShutdown` can re-surface it, AND emit\n\t// `Effect.logError(Cause.pretty(cause))` so observability stays\n\t// loud regardless of whether anyone awaits. Boot failures (still in\n\t// the bootDeferred-pending window) only surface via `start`, not\n\t// here — we'd otherwise re-raise them on `awaitShutdown` after\n\t// `start` already rejected. NOTE: a CALLER `boot` hook failure folds\n\t// through this SAME tee, so its failure surfaces as `BootError` on\n\t// `start` (when raised before the gate resolves) or re-raises on\n\t// `awaitShutdown` (after) — never widening `start`'s error channel.\n\tconst supervisedProgram: Effect.Effect<void, never, never> = layered.pipe(\n\t\tEffect.catchCause((cause) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst bootAlreadyCompleted = yield* Deferred.isDone(bootDeferred);\n\t\t\t\tyield* Deferred.fail(bootDeferred, toBootError(cause)).pipe(\n\t\t\t\t\tEffect.asVoid,\n\t\t\t\t\tEffect.catch(() => Effect.void),\n\t\t\t\t);\n\t\t\t\tif (bootAlreadyCompleted) {\n\t\t\t\t\tyield* Ref.set(midRunCauseRef, cause);\n\t\t\t\t}\n\t\t\t\tyield* Effect.logError(`devstack runStack: supervisor died\\n${Cause.pretty(cause)}`);\n\t\t\t}),\n\t\t),\n\t);\n\n\tconst start: Effect.Effect<void, BootError, never> = Effect.uninterruptibleMask((restore) =>\n\t\tEffect.gen(function* () {\n\t\t\tconst shouldStart = yield* Ref.modify(startClaim, (started) =>\n\t\t\t\tstarted ? [false, true] : [true, true],\n\t\t\t);\n\t\t\tif (shouldStart) {\n\t\t\t\t// `forkDetach` decouples the supervisor fiber from the `start`\n\t\t\t\t// fiber's scope. `forkChild`\n\t\t\t\t// would tie the supervisor to whatever fiber runs `start`, and\n\t\t\t\t// once `start` resolves (after `bootDeferred` succeeds) the\n\t\t\t\t// runtime would interrupt the supervisor — transitioning every\n\t\t\t\t// plugin `ready → stopping → stopped` before the caller can\n\t\t\t\t// read post-ready state or call `handle.stop`. The handle's\n\t\t\t\t// explicit `stop` + `awaitShutdown` paths are the only\n\t\t\t\t// shutdown signals; the captured `Fiber` reference is how the\n\t\t\t\t// daemon stays releasable.\n\t\t\t\tconst fiber = yield* Effect.forkDetach(supervisedProgram);\n\t\t\t\tyield* Deferred.succeed(fiberRef, fiber);\n\t\t\t}\n\t\t\tyield* restore(Deferred.await(bootDeferred));\n\t\t}),\n\t);\n\n\tconst stop: Effect.Effect<void, never, never> = Effect.gen(function* () {\n\t\tyield* Deferred.succeed(stopRequested, undefined).pipe(Effect.catch(() => Effect.void));\n\t\tconst alreadyStarted = yield* Deferred.isDone(fiberRef);\n\t\tif (!alreadyStarted) {\n\t\t\treturn;\n\t\t}\n\t\tconst fiber = yield* Deferred.await(fiberRef);\n\t\t// `Fiber.await` returns an `Exit` without raising — handles both\n\t\t// success and interrupt-cause cases (the supervisor's\n\t\t// graceful-shutdown path closes the scope, which surfaces as an\n\t\t// interrupt cause if the fiber was mid-await on the latch poll).\n\t\tyield* Fiber.await(fiber);\n\t});\n\n\tconst awaitShutdown: Effect.Effect<void, unknown, never> = Effect.gen(function* () {\n\t\tconst alreadyStarted = yield* Deferred.isDone(fiberRef);\n\t\tif (!alreadyStarted) {\n\t\t\treturn;\n\t\t}\n\t\tconst fiber = yield* Deferred.await(fiberRef);\n\t\tyield* Fiber.await(fiber);\n\t\t// Re-surface any mid-run defect/failure captured by the\n\t\t// supervised body's `catchCause` (boot failures are already\n\t\t// surfaced via `start`). Without this re-raise a plugin scope\n\t\t// finalizer defect would silently drop and operators get no\n\t\t// signal — see the comment on `midRunCauseRef` above.\n\t\tconst midRunCause = yield* Ref.get(midRunCauseRef);\n\t\tif (midRunCause !== null) {\n\t\t\treturn yield* Effect.failCause(midRunCause);\n\t\t}\n\t});\n\n\t// Assign the handle the composed boot hooks close over (they only deref\n\t// it at boot, after this assignment) and return it.\n\tpublicHandle = {\n\t\tstart,\n\t\tstop,\n\t\tawaitShutdown,\n\t\tevents,\n\t\tstate,\n\t\tcommands: commandQueue,\n\t\trunCommand,\n\t\tidentity,\n\t};\n\n\treturn publicHandle;\n};\n"],"mappings":";;;;;;;;AAwKA,MAAM,mBACL,OACA,MACA,QACc;CACd,MAAM,MAAM,eAAe;EAC1B,UAAU,MAAM;EAChB;CACD,CAAC;CACD,MAAM,eAAe,iBAAiB;EACrC,UAAU,MAAM,SAAS,MAAM,QAAQ;EACvC;CACD,CAAC;CAOD,MAAM,WAAW,mBAAmB;EACnC,UAAU,MAAM;EAChB,KAAK,QAAQ,IAAI;EACjB,gBAAgB;CACjB,CAAC;CACD,OAAO;EACN,KAAK,QAAQ,GAAG;EAChB,OAAO,UAAU,YAAY;EAC7B,SAAS,SAAS,OAAO;CAC1B;AACD;AAEA,MAAM,eAAe,WAA4C;CAChE,MAAM;CACN;AACD;;;;;;;;;;;;;;;AA0DA,MAAM,4BAA4C;CACjD,OAAO,sBAAsB;CAC7B,cAAc,OAAO,QAAQ,SAAS,KAAsB,CAAC;CAC7D,eAAe,OAAO,QAAQ,SAAS,KAAW,CAAC;CACnD,eAAe,OAAO,QAAQ,SAAS,KAAiC,CAAC;CACzE,cAAc,OAAO,QAAQ,MAAM,UAAyB,CAAC;CAC7D,eAAe,OAAO,QACrB,SAAS,KAAsE,CAChF;CACA,UAAU,OAAO,QAAQ,SAAS,KAA+B,CAAC;CAClE,YAAY,OAAO,QAAQ,IAAI,KAAK,KAAK,CAAC;CAC1C,gBAAgB,OAAO,QAAQ,IAAI,KAAkC,IAAI,CAAC;AAC3E;;;;;;AAOA,MAAM,uBACL,cACA,gBACwB;CAAE,GAAG;CAAc;AAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCvD,MAAa,oBACZ,OACA,OAAgC,CAAC,MAClB;CACf,MAAM,cAAc,gBAAgB,KAAK;CACzC,MAAM,cAAc,gBAAgB;EACnC,aAAa,KAAK;EAClB,UAAU,KAAK,YAAY,YAAY,QAAQ;EAC/C,KAAK,QAAQ,IAAI;EACjB,KAAK,QAAQ,IAAI;CAClB,CAAC;CACD,MAAM,UAAU,KAAK,WAAW,QAAQ,IAAI;CAC5C,MAAM,WAAW,gBAAgB,OAAO,KAAK,UAAU,OAAO;CAC9D,MAAM,UAAU,KAAK,WAAW,YAAY,QAAQ;CAEpD,MAAM,kBAAkB;EACvB,MAAM;EACN,SAAS,YAAY;EACrB,SAAS,YAAY;CACtB;CAMA,MAAM,EACL,OACA,cACA,eACA,eACA,cACA,eACA,UACA,YACA,mBACG,mBAAmB;CAWvB,MAAM,YAAY,6BAA6B,EAC9C,SAAS,gCAAgC;EACxC;EACA,gBAAgB,OAAO,SAAS,KAAK;EACrC;CACD,CAAC,EACF,CAAC,CAAC,CAAC,KAAK,MAAM,aAAa,qBAAqB,UAAU,WAAW,CAAC,CAAC;CAKvE,MAAM,cAAc,YACnB,OAAO,QAAQ,SAAS,MAAM,aAAa,IAAI,aAAa,SAAS,OAAO,CAAC;CAE9E,MAAM,SAAmD,OAAO,OAC/D,OAAO,IAAI,aAAa;EACvB,MAAM,QAAQ,OAAO,SAAS,MAAM,aAAa;EACjD,OAAO,OAAO,UAAU,KAAK;CAC9B,CAAC,CACF;CASA,IAAI;CAEJ,MAAM,aAAa,OAAO,IAAI,aAAa;EAO1C,MAAM,iBACL,KAAK,mBAAmB,KAAA,IAAY,KAAA,IAAY,OAAO,KAAK;EAQ7D,OAAO,iCAAiC,iBAAiB,UAAU,OAAO;GACzE,QAAQ,MAAM,QAAQ;GACtB,gBAAgB,MAAM,QAAQ;GAC9B,GAAI,KAAK,MAAM,oBAAoB,KAAA,IAChC,CAAC,IACD,EAAE,iBAAiB,KAAK,KAAK,gBAAgB;GAChD,GAAI,mBAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,eAAe;GACzD,GAAI,KAAK,kBAAkB,KAAA,IACxB,CAAC,IACD,EAAE,2BAA2B,KAAK,cAAc;GAWnD,uBAAuB,WACtB,OAAO,IAAI,aAAa;IACvB,OAAO,SAAS,QAAQ,eAAe,OAAO,MAAM,CAAC,CAAC,KACrD,OAAO,YAAY,OAAO,IAAI,CAC/B;IAIA,OAAO,SAAS,QAAQ,eAAe,OAAO,UAAU,CAAC,CAAC,KACzD,OAAO,YAAY,OAAO,IAAI,CAC/B;IAKA,OAAO,OAAO,WACb,OAAO,IAAI,aAAa;KACvB,OAAO,MAAM;MACZ,MAAM,UAAU,OAAO,MAAM,KAAK,YAAY;MAC9C,OAAO,MAAM,MAAM,OAAO,UAAU,OAAO;KAC5C;IACD,CAAC,CACF;IAKA,OAAO,OAAO,WACb,OAAO,IAAI,aAAa;KACvB,OAAO,SAAS,MAAM,aAAa;KACnC,OAAO,MAAM,MAAM,OAAO,UAAU,EACnC,KAAK,qBACN,CAAC;IACF,CAAC,CACF;IAKA,IAAI,KAAK,MAAM,yBAAyB,KAAA,GACvC,OAAO,KAAK,KAAK,qBAAqB,oBAAoB,cAAc,MAAM,CAAC;GAEjF,CAAC;GAOF,cAAc,WAyBb,OAAO,IAAI,aAAa;IACvB,IAAI,eAAiC;IACrC,KAAK,MAAM,CAAC,QAAQ,OAAO,MAAM,OAIhC,KAAI,OAHkB,OAAO,SAC3B,UAAU,GAAG,CAAC,CACd,KAAK,OAAO,YAAY,OAAO,QAAQ,QAAiB,CAAC,CAAC,OAC7C,UAAU;KACxB,MAAM,cAAc,OAAO,OAAO,KAAK,OAAO,SAAS,WAAW,GAAG,CAAC;KACtE,eAAe,YACd,KAAK,UAAU,WAAW,IAAI,YAAY,QAAQ,MAAM,KACzD;KACA;IACD;IAED,IAAI,iBAAiB,MACpB,OAAO,SAAS,QAAQ,cAAc,KAAA,CAAS,CAAC,CAAC,KAAK,OAAO,MAAM;SAEnE,OAAO,SAAS,KAAK,cAAc,YAAY,CAAC,CAAC,KAAK,OAAO,MAAM;IASpE,IAAI,KAAK,MAAM,gBAAgB,KAAA,GAC9B,OAAO,KAAK,KAAK,YAAY,oBAAoB,cAAc,MAAM,CAAC;GAExE,CAAC;EACH,CAAC;CACF,CAAC;CAED,MAAM,cAAc,OAAO,MAAM,CAAC,CAAC;CAkBnC,MAAM,oBAjBU,WAAW,KAAK,OAAO,QAAQ,SAAS,GAAG,OAAO,QAAQ,WAAW,CAiBlB,CAAC,CAAC,KACpE,OAAO,YAAY,UAClB,OAAO,IAAI,aAAa;EACvB,MAAM,uBAAuB,OAAO,SAAS,OAAO,YAAY;EAChE,OAAO,SAAS,KAAK,cAAc,YAAY,KAAK,CAAC,CAAC,CAAC,KACtD,OAAO,QACP,OAAO,YAAY,OAAO,IAAI,CAC/B;EACA,IAAI,sBACH,OAAO,IAAI,IAAI,gBAAgB,KAAK;EAErC,OAAO,OAAO,SAAS,uCAAuC,MAAM,OAAO,KAAK,GAAG;CACpF,CAAC,CACF,CACD;CA2DA,eAAe;EACd,OA1DoD,OAAO,qBAAqB,YAChF,OAAO,IAAI,aAAa;GAIvB,IAAI,OAHuB,IAAI,OAAO,aAAa,YAClD,UAAU,CAAC,OAAO,IAAI,IAAI,CAAC,MAAM,IAAI,CACtC,GACiB;IAWhB,MAAM,QAAQ,OAAO,OAAO,WAAW,iBAAiB;IACxD,OAAO,SAAS,QAAQ,UAAU,KAAK;GACxC;GACA,OAAO,QAAQ,SAAS,MAAM,YAAY,CAAC;EAC5C,CAAC,CAsCG;EACJ,MApC+C,OAAO,IAAI,aAAa;GACvE,OAAO,SAAS,QAAQ,eAAe,KAAA,CAAS,CAAC,CAAC,KAAK,OAAO,YAAY,OAAO,IAAI,CAAC;GAEtF,IAAI,EAAC,OADyB,SAAS,OAAO,QAAQ,IAErD;GAED,MAAM,QAAQ,OAAO,SAAS,MAAM,QAAQ;GAK5C,OAAO,MAAM,MAAM,KAAK;EACzB,CAwBI;EACH,eAvB0D,OAAO,IAAI,aAAa;GAElF,IAAI,EAAC,OADyB,SAAS,OAAO,QAAQ,IAErD;GAED,MAAM,QAAQ,OAAO,SAAS,MAAM,QAAQ;GAC5C,OAAO,MAAM,MAAM,KAAK;GAMxB,MAAM,cAAc,OAAO,IAAI,IAAI,cAAc;GACjD,IAAI,gBAAgB,MACnB,OAAO,OAAO,OAAO,UAAU,WAAW;EAE5C,CAOa;EACZ;EACA;EACA,UAAU;EACV;EACA;CACD;CAEA,OAAO;AACR"}
|
package/dist/api/run-stack.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { SubscribableState } from "../substrate/projection.mjs";
|
|
2
|
-
import { EngineEvent } from "../substrate/events.mjs";
|
|
3
2
|
import { AnyPlugin } from "../substrate/plugin.mjs";
|
|
4
3
|
import { Stack } from "./define-devstack.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { Identity } from "../substrate/identity.mjs";
|
|
5
|
+
import { EngineCommand, EngineEvent } from "../substrate/events.mjs";
|
|
6
|
+
import { ProductionCodegenOptions } from "../orchestrators/boot.mjs";
|
|
7
|
+
import { Cause, Context, Effect, Queue, Scope, Stream, SubscriptionRef } from "effect";
|
|
8
8
|
|
|
9
9
|
//#region src/api/run-stack.d.ts
|
|
10
10
|
/** Identity overrides for `runStack`. App and stack fall back through
|
|
@@ -36,8 +36,8 @@ interface RunStackOptions {
|
|
|
36
36
|
readonly stateDir?: string;
|
|
37
37
|
/** Extend the plugin execution context after built-in plugin
|
|
38
38
|
* services are installed. Use this for custom plugin-author
|
|
39
|
-
* services
|
|
40
|
-
readonly extendContext?: (ctx: Context.Context<never>) => Effect.Effect<Context.Context<never>, never, Scope.Scope
|
|
39
|
+
* services or logger overrides. */
|
|
40
|
+
readonly extendContext?: (ctx: Context.Context<never>) => Effect.Effect<Context.Context<never>, never, Scope.Scope>;
|
|
41
41
|
}
|
|
42
42
|
/** Boot error surfaced by `RunHandle.start`. Wraps the supervisor's
|
|
43
43
|
* startup failure tree for cascade-formatter rendering. */
|
|
@@ -45,47 +45,98 @@ interface BootError {
|
|
|
45
45
|
readonly _tag: 'BootError';
|
|
46
46
|
readonly cause: Cause.Cause<unknown>;
|
|
47
47
|
}
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
48
|
+
/**
|
|
49
|
+
* The programmatic handle `runStack` returns. It is a small bag of Effect
|
|
50
|
+
* values + readable refs — a functional surface, not an object with methods:
|
|
51
|
+
* each lifecycle action (`start` / `stop` / `awaitShutdown`) is an
|
|
52
|
+
* `Effect` you run, and each observation channel (`events` / `state`) is a
|
|
53
|
+
* value you read. Returned synchronously, BEFORE any fiber is forked, so a
|
|
54
|
+
* caller can subscribe to `state` / `events` ahead of `start`.
|
|
55
|
+
*
|
|
56
|
+
* Symmetric with the attached CLI surface: `events`, `state`, and
|
|
57
|
+
* `awaitShutdown` are the SAME in-process primitives the TUI consumes.
|
|
58
|
+
*
|
|
59
|
+
* Typical use:
|
|
60
|
+
*
|
|
61
|
+
* const handle = runStack(stack, opts);
|
|
62
|
+
* await Effect.runPromise(handle.start); // boot → all ready
|
|
63
|
+
* const snapshot = await Effect.runPromise(SubscriptionRef.get(handle.state));
|
|
64
|
+
* await Effect.runPromise(handle.stop); // graceful shutdown
|
|
65
|
+
* await Effect.runPromise(handle.awaitShutdown); // finalizers done
|
|
66
|
+
*/
|
|
51
67
|
interface RunHandle {
|
|
52
|
-
/**
|
|
53
|
-
* `ready
|
|
54
|
-
* fails.
|
|
68
|
+
/** Fork the supervisor fiber and resolve once EVERY plugin reaches
|
|
69
|
+
* `ready` (or a terminal `done`). Fails with `BootError` if any
|
|
70
|
+
* plugin's initial-acquire path fails. Idempotent: a second `start`
|
|
71
|
+
* is a no-op that just awaits the same boot gate. */
|
|
55
72
|
readonly start: Effect.Effect<void, BootError, never>;
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
73
|
+
/** Request graceful shutdown: publishes `shutdown.requested` onto the
|
|
74
|
+
* supervisor's command channel (driving scope finalizers), then awaits
|
|
75
|
+
* the fiber. Safe to call before `start` (returns immediately) and
|
|
76
|
+
* more than once. */
|
|
58
77
|
readonly stop: Effect.Effect<void, never, never>;
|
|
59
78
|
/** Resolve when the supervisor fiber exits. Succeeds on a clean
|
|
60
79
|
* shutdown; fails with the captured `Cause` if the supervisor died
|
|
61
|
-
* mid-run
|
|
62
|
-
*
|
|
80
|
+
* mid-run AFTER boot completed (e.g. a plugin scope-finalizer defect).
|
|
81
|
+
* Boot-time failures surface via `start`, not here — so a host that
|
|
82
|
+
* blocks the process on this Effect stays up for the supervisor's
|
|
83
|
+
* whole lifetime and learns of a post-boot death. */
|
|
63
84
|
readonly awaitShutdown: Effect.Effect<void, unknown, never>;
|
|
64
|
-
/** Tail of typed engine events
|
|
65
|
-
* upstream is a `Queue.Dequeue
|
|
85
|
+
/** Tail of typed engine events off the supervisor's hub. SINGLE
|
|
86
|
+
* CONSUMER: the upstream is a `Queue.Dequeue`, so taking an event
|
|
87
|
+
* removes it — running this stream from two places SPLITS the events
|
|
88
|
+
* between them rather than fanning out. Consume it once (e.g. via
|
|
89
|
+
* `Stream.runForEach`) and tee downstream if you need multiple sinks.
|
|
90
|
+
* Empty until `start` wires the hub. */
|
|
66
91
|
readonly events: Stream.Stream<EngineEvent, never, never>;
|
|
67
|
-
/** The supervisor's live projection
|
|
68
|
-
*
|
|
92
|
+
/** The supervisor's live projection — the single read-model of stack
|
|
93
|
+
* state (identity, per-plugin lifecycle, cycle phase, log tail). Live
|
|
94
|
+
* for the supervisor's whole process lifetime: snapshot it with
|
|
95
|
+
* `SubscriptionRef.get`, or observe updates via `SubscriptionRef.changes`.
|
|
96
|
+
* Renderers + tests read it directly; nothing writes through it. */
|
|
69
97
|
readonly state: SubscriptionRef.SubscriptionRef<SubscribableState>;
|
|
98
|
+
/** Fire-and-forget publish side of the supervisor's command channel —
|
|
99
|
+
* enqueue an `EngineCommand` (`shutdown.requested`,
|
|
100
|
+
* `selective-restart.requested`, snapshot/wipe/prune verbs, …) and
|
|
101
|
+
* return immediately. The same queue the supervisor drains; the signal
|
|
102
|
+
* handler and the `stop` bridge publish here too. Use `runCommand` when
|
|
103
|
+
* you need to await the command's outcome. */
|
|
104
|
+
readonly commands: Queue.Enqueue<EngineCommand>;
|
|
105
|
+
/** Submit-and-AWAIT dispatch: publishes `command` in-band on the
|
|
106
|
+
* supervisor's command loop and resolves when the loop finishes
|
|
107
|
+
* handling it, re-failing with the handler's cause. Use this (over
|
|
108
|
+
* `commands`) when the caller must know the command succeeded —
|
|
109
|
+
* e.g. a destructive `snapshot.restore`. (The cross-process IPC bridge
|
|
110
|
+
* layers ack-correlation on top of this.) */
|
|
111
|
+
readonly runCommand: (command: EngineCommand) => Effect.Effect<void, unknown, never>;
|
|
112
|
+
/** The resolved `Identity` — app / stack / network — this handle booted
|
|
113
|
+
* with, after all option > env > inference resolution. Available
|
|
114
|
+
* synchronously, BEFORE `start`. */
|
|
115
|
+
readonly identity: Identity;
|
|
70
116
|
}
|
|
71
117
|
/**
|
|
72
118
|
* Boot a `Stack` for programmatic embedding. Returns a `RunHandle`
|
|
73
119
|
* synchronously; the supervisor fiber is forked on `start`.
|
|
74
120
|
*
|
|
75
|
-
*
|
|
121
|
+
* Programmatic contract — call, then drive the returned handle's Effects:
|
|
76
122
|
*
|
|
77
|
-
* 1. `runStack(stack, opts)` — synchronous;
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
123
|
+
* 1. `runStack(stack, opts)` — synchronous; NO fiber forked yet. Safe to
|
|
124
|
+
* read `handle.identity` and subscribe to `handle.state` /
|
|
125
|
+
* `handle.events` right away.
|
|
126
|
+
* 2. `await Effect.runPromise(handle.start)` — forks the supervisor and
|
|
127
|
+
* blocks until every plugin reaches `ready` (or fails with `BootError`).
|
|
128
|
+
* 3. Observe via `handle.state` (snapshot / changes) and `handle.events`
|
|
129
|
+
* (single-consumer tail); drive via `handle.commands` /
|
|
130
|
+
* `handle.runCommand`.
|
|
82
131
|
* 4. `await Effect.runPromise(handle.stop)` — graceful shutdown.
|
|
83
|
-
* 5. `handle.awaitShutdown` resolves once
|
|
132
|
+
* 5. `await Effect.runPromise(handle.awaitShutdown)` — resolves once scope
|
|
133
|
+
* finalizers complete (or re-raises a post-boot supervisor death).
|
|
84
134
|
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
135
|
+
* Thin facade: delegates to `runStackWithBoot` (in `run-stack-internal.ts`)
|
|
136
|
+
* with a zero-`boot` bag and no `commandHandler`, so this public path is
|
|
137
|
+
* byte-identical to the pre-seam `runStack` body. The boot-injection seam
|
|
138
|
+
* the CLI `up` verb consumes is non-public — it is NOT re-exported from
|
|
139
|
+
* `index.ts`, and its substrate types never appear on `RunHandle`.
|
|
89
140
|
*/
|
|
90
141
|
declare const runStack: (stack: Stack<ReadonlyArray<AnyPlugin>>, opts?: RunStackOptions) => RunHandle;
|
|
91
142
|
//#endregion
|