@mysten-incubation/devstack 0.0.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/LICENSE +189 -0
- package/README.md +94 -0
- package/dist/_virtual/_rolldown/runtime.mjs +13 -0
- package/dist/api/define-capabilities.d.mts +25 -0
- package/dist/api/define-capabilities.mjs +19 -0
- package/dist/api/define-capabilities.mjs.map +1 -0
- package/dist/api/define-devstack-with.d.mts +41 -0
- package/dist/api/define-devstack-with.mjs +24 -0
- package/dist/api/define-devstack-with.mjs.map +1 -0
- package/dist/api/define-devstack.d.mts +62 -0
- package/dist/api/define-devstack.mjs +108 -0
- package/dist/api/define-devstack.mjs.map +1 -0
- package/dist/api/define-plugin.d.mts +1 -0
- package/dist/api/inference-network.mjs +122 -0
- package/dist/api/inference-network.mjs.map +1 -0
- package/dist/api/mode-narrowed-factory.d.mts +26 -0
- package/dist/api/mode-narrowed-factory.mjs +8 -0
- package/dist/api/mode-narrowed-factory.mjs.map +1 -0
- package/dist/api/plugin-errors.mjs +10 -0
- package/dist/api/plugin-errors.mjs.map +1 -0
- package/dist/api/run-stack.d.mts +82 -0
- package/dist/api/run-stack.mjs +127 -0
- package/dist/api/run-stack.mjs.map +1 -0
- package/dist/build-integrations/playwright/config.d.mts +92 -0
- package/dist/build-integrations/playwright/config.mjs +71 -0
- package/dist/build-integrations/playwright/config.mjs.map +1 -0
- package/dist/build-integrations/playwright/errors.d.mts +82 -0
- package/dist/build-integrations/playwright/errors.mjs +43 -0
- package/dist/build-integrations/playwright/errors.mjs.map +1 -0
- package/dist/build-integrations/playwright/global-setup.d.mts +64 -0
- package/dist/build-integrations/playwright/global-setup.mjs +44 -0
- package/dist/build-integrations/playwright/global-setup.mjs.map +1 -0
- package/dist/build-integrations/playwright/index.d.mts +6 -0
- package/dist/build-integrations/playwright/index.mjs +6 -0
- package/dist/build-integrations/playwright/stack-context.d.mts +95 -0
- package/dist/build-integrations/playwright/stack-context.mjs +277 -0
- package/dist/build-integrations/playwright/stack-context.mjs.map +1 -0
- package/dist/build-integrations/playwright/wallet-context.d.mts +87 -0
- package/dist/build-integrations/playwright/wallet-context.mjs +148 -0
- package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -0
- package/dist/build-integrations/runtime/cold-start-url.d.mts +67 -0
- package/dist/build-integrations/runtime/cold-start-url.mjs +56 -0
- package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -0
- package/dist/build-integrations/runtime/dapp-kit-slot.mjs +10 -0
- package/dist/build-integrations/runtime/dapp-kit-slot.mjs.map +1 -0
- package/dist/build-integrations/runtime/discover.d.mts +78 -0
- package/dist/build-integrations/runtime/discover.mjs +124 -0
- package/dist/build-integrations/runtime/discover.mjs.map +1 -0
- package/dist/build-integrations/runtime/endpoint-registry.d.mts +26 -0
- package/dist/build-integrations/runtime/endpoint-registry.mjs +41 -0
- package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -0
- package/dist/build-integrations/runtime/errors.d.mts +64 -0
- package/dist/build-integrations/runtime/errors.mjs +51 -0
- package/dist/build-integrations/runtime/errors.mjs.map +1 -0
- package/dist/build-integrations/runtime/index.d.mts +7 -0
- package/dist/build-integrations/runtime/index.mjs +6 -0
- package/dist/build-integrations/runtime/read-stack-context.d.mts +38 -0
- package/dist/build-integrations/runtime/read-stack-context.mjs +130 -0
- package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -0
- package/dist/build-integrations/runtime/stack-context.d.mts +53 -0
- package/dist/build-integrations/vitest/config.d.mts +62 -0
- package/dist/build-integrations/vitest/config.mjs +80 -0
- package/dist/build-integrations/vitest/config.mjs.map +1 -0
- package/dist/build-integrations/vitest/env.d.mts +48 -0
- package/dist/build-integrations/vitest/env.mjs +50 -0
- package/dist/build-integrations/vitest/env.mjs.map +1 -0
- package/dist/build-integrations/vitest/errors.d.mts +44 -0
- package/dist/build-integrations/vitest/errors.mjs +18 -0
- package/dist/build-integrations/vitest/errors.mjs.map +1 -0
- package/dist/build-integrations/vitest/index.d.mts +6 -0
- package/dist/build-integrations/vitest/index.mjs +6 -0
- package/dist/build-integrations/vitest/setup.d.mts +53 -0
- package/dist/build-integrations/vitest/setup.mjs +56 -0
- package/dist/build-integrations/vitest/setup.mjs.map +1 -0
- package/dist/build-integrations/vitest/stack-context.d.mts +58 -0
- package/dist/build-integrations/vitest/stack-context.mjs +67 -0
- package/dist/build-integrations/vitest/stack-context.mjs.map +1 -0
- package/dist/cli/main.d.mts +5 -0
- package/dist/cli/main.mjs +586 -0
- package/dist/cli/main.mjs.map +1 -0
- package/dist/cli/prune-direct.mjs +216 -0
- package/dist/cli/prune-direct.mjs.map +1 -0
- package/dist/cli/snapshot-reader.mjs +73 -0
- package/dist/cli/snapshot-reader.mjs.map +1 -0
- package/dist/cli/up-lifecycle.mjs +28 -0
- package/dist/cli/up-lifecycle.mjs.map +1 -0
- package/dist/contracts/capability-decl.d.mts +42 -0
- package/dist/contracts/chain-probe.d.mts +26 -0
- package/dist/contracts/chain-probe.mjs +8 -0
- package/dist/contracts/chain-probe.mjs.map +1 -0
- package/dist/contracts/codegenable.d.mts +43 -0
- package/dist/contracts/container-runtime.d.mts +245 -0
- package/dist/contracts/liveness-classifier.d.mts +19 -0
- package/dist/contracts/network-resolver.d.mts +15 -0
- package/dist/contracts/network-resolver.mjs +7 -0
- package/dist/contracts/network-resolver.mjs.map +1 -0
- package/dist/contracts/projection.d.mts +15 -0
- package/dist/contracts/routable.d.mts +53 -0
- package/dist/contracts/snapshotable.d.mts +39 -0
- package/dist/contracts/strategy-contributor.d.mts +26 -0
- package/dist/index.d.mts +89 -0
- package/dist/index.mjs +37 -0
- package/dist/orchestrators/codegen/bindings.d.mts +2 -0
- package/dist/orchestrators/codegen/bindings.mjs +340 -0
- package/dist/orchestrators/codegen/bindings.mjs.map +1 -0
- package/dist/orchestrators/codegen/emit.mjs +56 -0
- package/dist/orchestrators/codegen/emit.mjs.map +1 -0
- package/dist/orchestrators/codegen/errors.d.mts +1 -0
- package/dist/orchestrators/codegen/errors.mjs +66 -0
- package/dist/orchestrators/codegen/errors.mjs.map +1 -0
- package/dist/orchestrators/codegen/extras.mjs +16 -0
- package/dist/orchestrators/codegen/extras.mjs.map +1 -0
- package/dist/orchestrators/codegen/format.mjs +109 -0
- package/dist/orchestrators/codegen/format.mjs.map +1 -0
- package/dist/orchestrators/codegen/gitignore.mjs +67 -0
- package/dist/orchestrators/codegen/gitignore.mjs.map +1 -0
- package/dist/orchestrators/codegen/paths.d.mts +1 -0
- package/dist/orchestrators/codegen/paths.mjs +33 -0
- package/dist/orchestrators/codegen/paths.mjs.map +1 -0
- package/dist/orchestrators/codegen/permissions.mjs +6 -0
- package/dist/orchestrators/codegen/permissions.mjs.map +1 -0
- package/dist/orchestrators/codegen/service.d.mts +1 -0
- package/dist/orchestrators/codegen/service.mjs +276 -0
- package/dist/orchestrators/codegen/service.mjs.map +1 -0
- package/dist/orchestrators/router/cleanup.mjs +58 -0
- package/dist/orchestrators/router/cleanup.mjs.map +1 -0
- package/dist/orchestrators/router/cors.mjs +31 -0
- package/dist/orchestrators/router/cors.mjs.map +1 -0
- package/dist/orchestrators/router/entrypoints.d.mts +1 -0
- package/dist/orchestrators/router/entrypoints.mjs +80 -0
- package/dist/orchestrators/router/entrypoints.mjs.map +1 -0
- package/dist/orchestrators/router/errors.d.mts +1 -0
- package/dist/orchestrators/router/errors.mjs +103 -0
- package/dist/orchestrators/router/errors.mjs.map +1 -0
- package/dist/orchestrators/router/file-provider.d.mts +1 -0
- package/dist/orchestrators/router/file-provider.mjs +320 -0
- package/dist/orchestrators/router/file-provider.mjs.map +1 -0
- package/dist/orchestrators/router/hostname.d.mts +1 -0
- package/dist/orchestrators/router/hostname.mjs +107 -0
- package/dist/orchestrators/router/hostname.mjs.map +1 -0
- package/dist/orchestrators/router/index.d.mts +1 -0
- package/dist/orchestrators/router/profile.d.mts +1 -0
- package/dist/orchestrators/router/profile.mjs +109 -0
- package/dist/orchestrators/router/profile.mjs.map +1 -0
- package/dist/orchestrators/router/service.d.mts +3 -0
- package/dist/orchestrators/router/service.mjs +421 -0
- package/dist/orchestrators/router/service.mjs.map +1 -0
- package/dist/orchestrators/router/traefik-container.d.mts +1 -0
- package/dist/orchestrators/router/traefik-container.mjs +229 -0
- package/dist/orchestrators/router/traefik-container.mjs.map +1 -0
- package/dist/orchestrators/runtime-composition.d.mts +10 -0
- package/dist/orchestrators/runtime-composition.mjs +168 -0
- package/dist/orchestrators/runtime-composition.mjs.map +1 -0
- package/dist/orchestrators/snapshot/capture.d.mts +1 -0
- package/dist/orchestrators/snapshot/capture.mjs +350 -0
- package/dist/orchestrators/snapshot/capture.mjs.map +1 -0
- package/dist/orchestrators/snapshot/descriptor.d.mts +1 -0
- package/dist/orchestrators/snapshot/descriptor.mjs +109 -0
- package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -0
- package/dist/orchestrators/snapshot/identity-guard.d.mts +1 -0
- package/dist/orchestrators/snapshot/identity-guard.mjs +132 -0
- package/dist/orchestrators/snapshot/identity-guard.mjs.map +1 -0
- package/dist/orchestrators/snapshot/image-bundle-tags.mjs +207 -0
- package/dist/orchestrators/snapshot/image-bundle-tags.mjs.map +1 -0
- package/dist/orchestrators/snapshot/index.d.mts +1 -0
- package/dist/orchestrators/snapshot/integrity.d.mts +1 -0
- package/dist/orchestrators/snapshot/integrity.mjs +74 -0
- package/dist/orchestrators/snapshot/integrity.mjs.map +1 -0
- package/dist/orchestrators/snapshot/prune.d.mts +1 -0
- package/dist/orchestrators/snapshot/prune.mjs +110 -0
- package/dist/orchestrators/snapshot/prune.mjs.map +1 -0
- package/dist/orchestrators/snapshot/restore.d.mts +1 -0
- package/dist/orchestrators/snapshot/restore.mjs +404 -0
- package/dist/orchestrators/snapshot/restore.mjs.map +1 -0
- package/dist/orchestrators/snapshot/service.d.mts +1 -0
- package/dist/orchestrators/snapshot/service.mjs +296 -0
- package/dist/orchestrators/snapshot/service.mjs.map +1 -0
- package/dist/orchestrators/snapshot/state-document.mjs +18 -0
- package/dist/orchestrators/snapshot/state-document.mjs.map +1 -0
- package/dist/orchestrators/snapshot/wipe.d.mts +1 -0
- package/dist/orchestrators/snapshot/wipe.mjs +59 -0
- package/dist/orchestrators/snapshot/wipe.mjs.map +1 -0
- package/dist/plugins/account/codegen.d.mts +12 -0
- package/dist/plugins/account/codegen.mjs +22 -0
- package/dist/plugins/account/codegen.mjs.map +1 -0
- package/dist/plugins/account/errors.d.mts +44 -0
- package/dist/plugins/account/errors.mjs +16 -0
- package/dist/plugins/account/errors.mjs.map +1 -0
- package/dist/plugins/account/funding.d.mts +94 -0
- package/dist/plugins/account/funding.mjs +199 -0
- package/dist/plugins/account/funding.mjs.map +1 -0
- package/dist/plugins/account/index.d.mts +54 -0
- package/dist/plugins/account/index.mjs +151 -0
- package/dist/plugins/account/index.mjs.map +1 -0
- package/dist/plugins/account/keypair.d.mts +32 -0
- package/dist/plugins/account/keypair.mjs +99 -0
- package/dist/plugins/account/keypair.mjs.map +1 -0
- package/dist/plugins/account/lease.mjs +21 -0
- package/dist/plugins/account/lease.mjs.map +1 -0
- package/dist/plugins/account/registry.d.mts +33 -0
- package/dist/plugins/account/registry.mjs +36 -0
- package/dist/plugins/account/registry.mjs.map +1 -0
- package/dist/plugins/account/service.d.mts +104 -0
- package/dist/plugins/account/service.mjs +405 -0
- package/dist/plugins/account/service.mjs.map +1 -0
- package/dist/plugins/account/snapshot.mjs +33 -0
- package/dist/plugins/account/snapshot.mjs.map +1 -0
- package/dist/plugins/account/variants/env.mjs +24 -0
- package/dist/plugins/account/variants/env.mjs.map +1 -0
- package/dist/plugins/account/variants/ephemeral.mjs +72 -0
- package/dist/plugins/account/variants/ephemeral.mjs.map +1 -0
- package/dist/plugins/account/variants/impersonate.d.mts +16 -0
- package/dist/plugins/account/variants/impersonate.mjs +48 -0
- package/dist/plugins/account/variants/impersonate.mjs.map +1 -0
- package/dist/plugins/account/variants/inline.mjs +13 -0
- package/dist/plugins/account/variants/inline.mjs.map +1 -0
- package/dist/plugins/account/variants/keystore.mjs +93 -0
- package/dist/plugins/account/variants/keystore.mjs.map +1 -0
- package/dist/plugins/account/variants/signer.mjs +31 -0
- package/dist/plugins/account/variants/signer.mjs.map +1 -0
- package/dist/plugins/action/build-context.d.mts +41 -0
- package/dist/plugins/action/discriminator.d.mts +20 -0
- package/dist/plugins/action/discriminator.mjs +13 -0
- package/dist/plugins/action/discriminator.mjs.map +1 -0
- package/dist/plugins/action/errors.d.mts +31 -0
- package/dist/plugins/action/errors.mjs +13 -0
- package/dist/plugins/action/errors.mjs.map +1 -0
- package/dist/plugins/action/execute.d.mts +2 -0
- package/dist/plugins/action/execute.mjs +145 -0
- package/dist/plugins/action/execute.mjs.map +1 -0
- package/dist/plugins/action/index.d.mts +56 -0
- package/dist/plugins/action/index.mjs +82 -0
- package/dist/plugins/action/index.mjs.map +1 -0
- package/dist/plugins/action/service.d.mts +26 -0
- package/dist/plugins/action/service.mjs +84 -0
- package/dist/plugins/action/service.mjs.map +1 -0
- package/dist/plugins/coin/address-resolution.d.mts +34 -0
- package/dist/plugins/coin/address-resolution.mjs +80 -0
- package/dist/plugins/coin/address-resolution.mjs.map +1 -0
- package/dist/plugins/coin/codegen.d.mts +16 -0
- package/dist/plugins/coin/codegen.mjs +21 -0
- package/dist/plugins/coin/codegen.mjs.map +1 -0
- package/dist/plugins/coin/discovery.d.mts +26 -0
- package/dist/plugins/coin/discovery.mjs +112 -0
- package/dist/plugins/coin/discovery.mjs.map +1 -0
- package/dist/plugins/coin/errors.d.mts +48 -0
- package/dist/plugins/coin/errors.mjs +13 -0
- package/dist/plugins/coin/errors.mjs.map +1 -0
- package/dist/plugins/coin/index.d.mts +95 -0
- package/dist/plugins/coin/index.mjs +172 -0
- package/dist/plugins/coin/index.mjs.map +1 -0
- package/dist/plugins/coin/metadata.d.mts +15 -0
- package/dist/plugins/coin/metadata.mjs +99 -0
- package/dist/plugins/coin/metadata.mjs.map +1 -0
- package/dist/plugins/coin/mint.d.mts +34 -0
- package/dist/plugins/coin/mint.mjs +164 -0
- package/dist/plugins/coin/mint.mjs.map +1 -0
- package/dist/plugins/coin/registry.d.mts +1 -0
- package/dist/plugins/coin/registry.mjs +37 -0
- package/dist/plugins/coin/registry.mjs.map +1 -0
- package/dist/plugins/coin/service.d.mts +47 -0
- package/dist/plugins/coin/service.mjs +51 -0
- package/dist/plugins/coin/service.mjs.map +1 -0
- package/dist/plugins/coin/snapshot.mjs +19 -0
- package/dist/plugins/coin/snapshot.mjs.map +1 -0
- package/dist/plugins/coin/type-strings.mjs +49 -0
- package/dist/plugins/coin/type-strings.mjs.map +1 -0
- package/dist/plugins/deepbook/codegen.d.mts +39 -0
- package/dist/plugins/deepbook/codegen.mjs +15 -0
- package/dist/plugins/deepbook/codegen.mjs.map +1 -0
- package/dist/plugins/deepbook/deploy.mjs +437 -0
- package/dist/plugins/deepbook/deploy.mjs.map +1 -0
- package/dist/plugins/deepbook/errors.d.mts +29 -0
- package/dist/plugins/deepbook/errors.mjs +26 -0
- package/dist/plugins/deepbook/errors.mjs.map +1 -0
- package/dist/plugins/deepbook/faucet-strategy.d.mts +8 -0
- package/dist/plugins/deepbook/faucet-strategy.mjs +81 -0
- package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -0
- package/dist/plugins/deepbook/index.d.mts +171 -0
- package/dist/plugins/deepbook/index.mjs +359 -0
- package/dist/plugins/deepbook/index.mjs.map +1 -0
- package/dist/plugins/deepbook/plugin-key.mjs +7 -0
- package/dist/plugins/deepbook/plugin-key.mjs.map +1 -0
- package/dist/plugins/deepbook/pyth/index.mjs +226 -0
- package/dist/plugins/deepbook/pyth/index.mjs.map +1 -0
- package/dist/plugins/deepbook/routable.mjs +21 -0
- package/dist/plugins/deepbook/routable.mjs.map +1 -0
- package/dist/plugins/deepbook/snapshot.mjs +49 -0
- package/dist/plugins/deepbook/snapshot.mjs.map +1 -0
- package/dist/plugins/deepbook/types.d.mts +125 -0
- package/dist/plugins/deepbook/types.mjs +12 -0
- package/dist/plugins/deepbook/types.mjs.map +1 -0
- package/dist/plugins/faucet/dispatcher.d.mts +9 -0
- package/dist/plugins/faucet/dispatcher.mjs +13 -0
- package/dist/plugins/faucet/dispatcher.mjs.map +1 -0
- package/dist/plugins/faucet/errors.d.mts +86 -0
- package/dist/plugins/faucet/errors.mjs +19 -0
- package/dist/plugins/faucet/errors.mjs.map +1 -0
- package/dist/plugins/faucet/http.mjs +127 -0
- package/dist/plugins/faucet/http.mjs.map +1 -0
- package/dist/plugins/faucet/index.d.mts +43 -0
- package/dist/plugins/faucet/index.mjs +42 -0
- package/dist/plugins/faucet/index.mjs.map +1 -0
- package/dist/plugins/faucet/service.d.mts +20 -0
- package/dist/plugins/faucet/strategies/sui-local.d.mts +23 -0
- package/dist/plugins/faucet/strategies/sui-local.mjs +29 -0
- package/dist/plugins/faucet/strategies/sui-local.mjs.map +1 -0
- package/dist/plugins/host-service/errors.d.mts +27 -0
- package/dist/plugins/host-service/errors.mjs +14 -0
- package/dist/plugins/host-service/errors.mjs.map +1 -0
- package/dist/plugins/host-service/index.d.mts +10 -0
- package/dist/plugins/host-service/index.mjs +48 -0
- package/dist/plugins/host-service/index.mjs.map +1 -0
- package/dist/plugins/host-service/routable.mjs +24 -0
- package/dist/plugins/host-service/routable.mjs.map +1 -0
- package/dist/plugins/host-service/service.d.mts +49 -0
- package/dist/plugins/host-service/service.mjs +375 -0
- package/dist/plugins/host-service/service.mjs.map +1 -0
- package/dist/plugins/package/build.d.mts +1 -0
- package/dist/plugins/package/build.mjs +24 -0
- package/dist/plugins/package/build.mjs.map +1 -0
- package/dist/plugins/package/codegen.d.mts +19 -0
- package/dist/plugins/package/codegen.mjs +41 -0
- package/dist/plugins/package/codegen.mjs.map +1 -0
- package/dist/plugins/package/dep-resolution.mjs +10 -0
- package/dist/plugins/package/dep-resolution.mjs.map +1 -0
- package/dist/plugins/package/errors.d.mts +34 -0
- package/dist/plugins/package/errors.mjs +13 -0
- package/dist/plugins/package/errors.mjs.map +1 -0
- package/dist/plugins/package/index.d.mts +109 -0
- package/dist/plugins/package/index.mjs +207 -0
- package/dist/plugins/package/index.mjs.map +1 -0
- package/dist/plugins/package/mode-known.mjs +41 -0
- package/dist/plugins/package/mode-known.mjs.map +1 -0
- package/dist/plugins/package/mode-local.d.mts +1 -0
- package/dist/plugins/package/mode-local.mjs +183 -0
- package/dist/plugins/package/mode-local.mjs.map +1 -0
- package/dist/plugins/package/publish-executor.mjs +202 -0
- package/dist/plugins/package/publish-executor.mjs.map +1 -0
- package/dist/plugins/package/publish-output.d.mts +28 -0
- package/dist/plugins/package/publish-output.mjs +45 -0
- package/dist/plugins/package/publish-output.mjs.map +1 -0
- package/dist/plugins/package/registry.d.mts +25 -0
- package/dist/plugins/package/registry.mjs +30 -0
- package/dist/plugins/package/registry.mjs.map +1 -0
- package/dist/plugins/package/service.mjs +20 -0
- package/dist/plugins/package/service.mjs.map +1 -0
- package/dist/plugins/package/snapshot.mjs +25 -0
- package/dist/plugins/package/snapshot.mjs.map +1 -0
- package/dist/plugins/postgres/codegen.mjs +42 -0
- package/dist/plugins/postgres/codegen.mjs.map +1 -0
- package/dist/plugins/postgres/connection.d.mts +33 -0
- package/dist/plugins/postgres/connection.mjs +19 -0
- package/dist/plugins/postgres/connection.mjs.map +1 -0
- package/dist/plugins/postgres/db-ensure.mjs +100 -0
- package/dist/plugins/postgres/db-ensure.mjs.map +1 -0
- package/dist/plugins/postgres/errors.d.mts +55 -0
- package/dist/plugins/postgres/errors.mjs +29 -0
- package/dist/plugins/postgres/errors.mjs.map +1 -0
- package/dist/plugins/postgres/index.d.mts +37 -0
- package/dist/plugins/postgres/index.mjs +75 -0
- package/dist/plugins/postgres/index.mjs.map +1 -0
- package/dist/plugins/postgres/routable.mjs +33 -0
- package/dist/plugins/postgres/routable.mjs.map +1 -0
- package/dist/plugins/postgres/service.d.mts +50 -0
- package/dist/plugins/postgres/service.mjs +145 -0
- package/dist/plugins/postgres/service.mjs.map +1 -0
- package/dist/plugins/postgres/snapshot.d.mts +1 -0
- package/dist/plugins/postgres/snapshot.mjs +32 -0
- package/dist/plugins/postgres/snapshot.mjs.map +1 -0
- package/dist/plugins/router-entrypoints.mjs +21 -0
- package/dist/plugins/router-entrypoints.mjs.map +1 -0
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +59 -0
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -0
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +132 -0
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -0
- package/dist/plugins/seal/codegen.d.mts +19 -0
- package/dist/plugins/seal/codegen.mjs +16 -0
- package/dist/plugins/seal/codegen.mjs.map +1 -0
- package/dist/plugins/seal/config-render.mjs +82 -0
- package/dist/plugins/seal/config-render.mjs.map +1 -0
- package/dist/plugins/seal/deploy.mjs +198 -0
- package/dist/plugins/seal/deploy.mjs.map +1 -0
- package/dist/plugins/seal/errors.d.mts +52 -0
- package/dist/plugins/seal/errors.mjs +19 -0
- package/dist/plugins/seal/errors.mjs.map +1 -0
- package/dist/plugins/seal/index.d.mts +161 -0
- package/dist/plugins/seal/index.mjs +235 -0
- package/dist/plugins/seal/index.mjs.map +1 -0
- package/dist/plugins/seal/key-manager.d.mts +22 -0
- package/dist/plugins/seal/key-manager.mjs +22 -0
- package/dist/plugins/seal/key-manager.mjs.map +1 -0
- package/dist/plugins/seal/key-server.mjs +175 -0
- package/dist/plugins/seal/key-server.mjs.map +1 -0
- package/dist/plugins/seal/keygen.mjs +96 -0
- package/dist/plugins/seal/keygen.mjs.map +1 -0
- package/dist/plugins/seal/mode/fork-known.d.mts +8 -0
- package/dist/plugins/seal/mode/fork-known.mjs +23 -0
- package/dist/plugins/seal/mode/fork-known.mjs.map +1 -0
- package/dist/plugins/seal/mode/live.d.mts +18 -0
- package/dist/plugins/seal/mode/live.mjs +64 -0
- package/dist/plugins/seal/mode/live.mjs.map +1 -0
- package/dist/plugins/seal/mode/local-keygen.mjs +180 -0
- package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -0
- package/dist/plugins/seal/plugin-key.mjs +7 -0
- package/dist/plugins/seal/plugin-key.mjs.map +1 -0
- package/dist/plugins/seal/registry-publish.d.mts +43 -0
- package/dist/plugins/seal/registry-publish.mjs +9 -0
- package/dist/plugins/seal/registry-publish.mjs.map +1 -0
- package/dist/plugins/seal/routable.mjs +57 -0
- package/dist/plugins/seal/routable.mjs.map +1 -0
- package/dist/plugins/seal/service.mjs +17 -0
- package/dist/plugins/seal/service.mjs.map +1 -0
- package/dist/plugins/seal/snapshot.mjs +51 -0
- package/dist/plugins/seal/snapshot.mjs.map +1 -0
- package/dist/plugins/sui/auto-tick.mjs +45 -0
- package/dist/plugins/sui/auto-tick.mjs.map +1 -0
- package/dist/plugins/sui/chain-build-container.d.mts +1 -0
- package/dist/plugins/sui/chain-probe.d.mts +85 -0
- package/dist/plugins/sui/chain-probe.mjs +104 -0
- package/dist/plugins/sui/chain-probe.mjs.map +1 -0
- package/dist/plugins/sui/codegen.d.mts +14 -0
- package/dist/plugins/sui/codegen.mjs +26 -0
- package/dist/plugins/sui/codegen.mjs.map +1 -0
- package/dist/plugins/sui/errors.d.mts +74 -0
- package/dist/plugins/sui/errors.mjs +28 -0
- package/dist/plugins/sui/errors.mjs.map +1 -0
- package/dist/plugins/sui/fork-orchestration.mjs +24 -0
- package/dist/plugins/sui/fork-orchestration.mjs.map +1 -0
- package/dist/plugins/sui/fork-transaction.mjs +96 -0
- package/dist/plugins/sui/fork-transaction.mjs.map +1 -0
- package/dist/plugins/sui/index.d.mts +318 -0
- package/dist/plugins/sui/index.mjs +182 -0
- package/dist/plugins/sui/index.mjs.map +1 -0
- package/dist/plugins/sui/mode/external.mjs +60 -0
- package/dist/plugins/sui/mode/external.mjs.map +1 -0
- package/dist/plugins/sui/mode/fork.mjs +283 -0
- package/dist/plugins/sui/mode/fork.mjs.map +1 -0
- package/dist/plugins/sui/mode/live.mjs +103 -0
- package/dist/plugins/sui/mode/live.mjs.map +1 -0
- package/dist/plugins/sui/mode/local.mjs +293 -0
- package/dist/plugins/sui/mode/local.mjs.map +1 -0
- package/dist/plugins/sui/mode/shared-boot.mjs +254 -0
- package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -0
- package/dist/plugins/sui/mode/shared.d.mts +103 -0
- package/dist/plugins/sui/mode/shared.mjs +12 -0
- package/dist/plugins/sui/mode/shared.mjs.map +1 -0
- package/dist/plugins/sui/mode/spec.d.mts +94 -0
- package/dist/plugins/sui/network-resolver.d.mts +23 -0
- package/dist/plugins/sui/routable.mjs +88 -0
- package/dist/plugins/sui/routable.mjs.map +1 -0
- package/dist/plugins/sui/seed-objects.d.mts +18 -0
- package/dist/plugins/sui/seed-objects.mjs +25 -0
- package/dist/plugins/sui/seed-objects.mjs.map +1 -0
- package/dist/plugins/sui/service.mjs +38 -0
- package/dist/plugins/sui/service.mjs.map +1 -0
- package/dist/plugins/sui/snapshot.mjs +53 -0
- package/dist/plugins/sui/snapshot.mjs.map +1 -0
- package/dist/plugins/wallet/codegen.d.mts +33 -0
- package/dist/plugins/wallet/codegen.mjs +34 -0
- package/dist/plugins/wallet/codegen.mjs.map +1 -0
- package/dist/plugins/wallet/errors.d.mts +66 -0
- package/dist/plugins/wallet/errors.mjs +16 -0
- package/dist/plugins/wallet/errors.mjs.map +1 -0
- package/dist/plugins/wallet/index.d.mts +63 -0
- package/dist/plugins/wallet/index.mjs +126 -0
- package/dist/plugins/wallet/index.mjs.map +1 -0
- package/dist/plugins/wallet/origin-policy.d.mts +1 -0
- package/dist/plugins/wallet/origin-policy.mjs +65 -0
- package/dist/plugins/wallet/origin-policy.mjs.map +1 -0
- package/dist/plugins/wallet/pairing.d.mts +11 -0
- package/dist/plugins/wallet/pairing.mjs +125 -0
- package/dist/plugins/wallet/pairing.mjs.map +1 -0
- package/dist/plugins/wallet/protocol.d.mts +1 -0
- package/dist/plugins/wallet/protocol.mjs +96 -0
- package/dist/plugins/wallet/protocol.mjs.map +1 -0
- package/dist/plugins/wallet/routable.mjs +32 -0
- package/dist/plugins/wallet/routable.mjs.map +1 -0
- package/dist/plugins/wallet/server.d.mts +12 -0
- package/dist/plugins/wallet/server.mjs +317 -0
- package/dist/plugins/wallet/server.mjs.map +1 -0
- package/dist/plugins/wallet/service.d.mts +68 -0
- package/dist/plugins/wallet/service.mjs +97 -0
- package/dist/plugins/wallet/service.mjs.map +1 -0
- package/dist/plugins/wallet/snapshot.d.mts +1 -0
- package/dist/plugins/wallet/snapshot.mjs +14 -0
- package/dist/plugins/wallet/snapshot.mjs.map +1 -0
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +42 -0
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -0
- package/dist/plugins/walrus/codegen.d.mts +38 -0
- package/dist/plugins/walrus/codegen.mjs +34 -0
- package/dist/plugins/walrus/codegen.mjs.map +1 -0
- package/dist/plugins/walrus/deploy-paths.mjs +14 -0
- package/dist/plugins/walrus/deploy-paths.mjs.map +1 -0
- package/dist/plugins/walrus/deploy.d.mts +1 -0
- package/dist/plugins/walrus/deploy.mjs +224 -0
- package/dist/plugins/walrus/deploy.mjs.map +1 -0
- package/dist/plugins/walrus/errors.d.mts +38 -0
- package/dist/plugins/walrus/errors.mjs +26 -0
- package/dist/plugins/walrus/errors.mjs.map +1 -0
- package/dist/plugins/walrus/faucet-strategy.d.mts +12 -0
- package/dist/plugins/walrus/faucet-strategy.mjs +62 -0
- package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -0
- package/dist/plugins/walrus/index.d.mts +177 -0
- package/dist/plugins/walrus/index.mjs +284 -0
- package/dist/plugins/walrus/index.mjs.map +1 -0
- package/dist/plugins/walrus/mode/known-deploy.d.mts +25 -0
- package/dist/plugins/walrus/mode/known-deploy.mjs +71 -0
- package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -0
- package/dist/plugins/walrus/mode/local-cluster.d.mts +34 -0
- package/dist/plugins/walrus/mode/local-cluster.mjs +153 -0
- package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -0
- package/dist/plugins/walrus/plugin-key.mjs +7 -0
- package/dist/plugins/walrus/plugin-key.mjs.map +1 -0
- package/dist/plugins/walrus/registry-publish.d.mts +24 -0
- package/dist/plugins/walrus/registry-publish.mjs +7 -0
- package/dist/plugins/walrus/registry-publish.mjs.map +1 -0
- package/dist/plugins/walrus/routable.mjs +99 -0
- package/dist/plugins/walrus/routable.mjs.map +1 -0
- package/dist/plugins/walrus/service.mjs +20 -0
- package/dist/plugins/walrus/service.mjs.map +1 -0
- package/dist/plugins/walrus/snapshot.mjs +53 -0
- package/dist/plugins/walrus/snapshot.mjs.map +1 -0
- package/dist/plugins/walrus/storage-nodes.d.mts +15 -0
- package/dist/plugins/walrus/storage-nodes.mjs +154 -0
- package/dist/plugins/walrus/storage-nodes.mjs.map +1 -0
- package/dist/plugins/walrus/wal-swap.d.mts +2 -0
- package/dist/plugins/walrus/wal-swap.mjs +58 -0
- package/dist/plugins/walrus/wal-swap.mjs.map +1 -0
- package/dist/primitives/artifact-publisher.d.mts +12 -0
- package/dist/primitives/cache.d.mts +1 -0
- package/dist/runtime/built-in-plugin-layers.mjs +49 -0
- package/dist/runtime/built-in-plugin-layers.mjs.map +1 -0
- package/dist/runtime/docker/client.d.mts +2 -0
- package/dist/runtime/docker/client.mjs +54 -0
- package/dist/runtime/docker/client.mjs.map +1 -0
- package/dist/runtime/docker/container.d.mts +1 -0
- package/dist/runtime/docker/container.mjs +562 -0
- package/dist/runtime/docker/container.mjs.map +1 -0
- package/dist/runtime/docker/errors.d.mts +1 -0
- package/dist/runtime/docker/errors.mjs +187 -0
- package/dist/runtime/docker/errors.mjs.map +1 -0
- package/dist/runtime/docker/exec.d.mts +1 -0
- package/dist/runtime/docker/exec.mjs +63 -0
- package/dist/runtime/docker/exec.mjs.map +1 -0
- package/dist/runtime/docker/image.d.mts +1 -0
- package/dist/runtime/docker/image.mjs +278 -0
- package/dist/runtime/docker/image.mjs.map +1 -0
- package/dist/runtime/docker/index.d.mts +1 -0
- package/dist/runtime/docker/inventory.d.mts +1 -0
- package/dist/runtime/docker/inventory.mjs +167 -0
- package/dist/runtime/docker/inventory.mjs.map +1 -0
- package/dist/runtime/docker/labels.d.mts +1 -0
- package/dist/runtime/docker/labels.mjs +97 -0
- package/dist/runtime/docker/labels.mjs.map +1 -0
- package/dist/runtime/docker/logs.d.mts +1 -0
- package/dist/runtime/docker/logs.mjs +34 -0
- package/dist/runtime/docker/logs.mjs.map +1 -0
- package/dist/runtime/docker/network.d.mts +1 -0
- package/dist/runtime/docker/network.mjs +168 -0
- package/dist/runtime/docker/network.mjs.map +1 -0
- package/dist/runtime/docker/service.d.mts +9 -0
- package/dist/runtime/docker/service.mjs +266 -0
- package/dist/runtime/docker/service.mjs.map +1 -0
- package/dist/runtime/docker/sweep.d.mts +1 -0
- package/dist/runtime/docker/sweep.mjs +220 -0
- package/dist/runtime/docker/sweep.mjs.map +1 -0
- package/dist/runtime/docker/volume.d.mts +1 -0
- package/dist/runtime/docker/volume.mjs +24 -0
- package/dist/runtime/docker/volume.mjs.map +1 -0
- package/dist/runtime/docker/wrap.d.mts +1 -0
- package/dist/runtime/docker/wrap.mjs +131 -0
- package/dist/runtime/docker/wrap.mjs.map +1 -0
- package/dist/substrate/brand.d.mts +24 -0
- package/dist/substrate/brand.mjs +14 -0
- package/dist/substrate/brand.mjs.map +1 -0
- package/dist/substrate/cross-process.d.mts +1 -0
- package/dist/substrate/cross-process.mjs +28 -0
- package/dist/substrate/cross-process.mjs.map +1 -0
- package/dist/substrate/events.d.mts +117 -0
- package/dist/substrate/identity.d.mts +13 -0
- package/dist/substrate/lifecycle.d.mts +12 -0
- package/dist/substrate/manifest.d.mts +39 -0
- package/dist/substrate/manifest.mjs +33 -0
- package/dist/substrate/manifest.mjs.map +1 -0
- package/dist/substrate/network.d.mts +34 -0
- package/dist/substrate/options.d.mts +23 -0
- package/dist/substrate/plugin.d.mts +101 -0
- package/dist/substrate/plugin.mjs +61 -0
- package/dist/substrate/plugin.mjs.map +1 -0
- package/dist/substrate/projection.d.mts +100 -0
- package/dist/substrate/runtime/artifact-publisher/index.mjs +76 -0
- package/dist/substrate/runtime/artifact-publisher/index.mjs.map +1 -0
- package/dist/substrate/runtime/atomic-write.mjs +106 -0
- package/dist/substrate/runtime/atomic-write.mjs.map +1 -0
- package/dist/substrate/runtime/cache/index.d.mts +1 -0
- package/dist/substrate/runtime/cache/schema.d.mts +1 -0
- package/dist/substrate/runtime/cache/schema.mjs +22 -0
- package/dist/substrate/runtime/cache/schema.mjs.map +1 -0
- package/dist/substrate/runtime/cache/service.d.mts +1 -0
- package/dist/substrate/runtime/cache/service.mjs +89 -0
- package/dist/substrate/runtime/cache/service.mjs.map +1 -0
- package/dist/substrate/runtime/capability-sinks/index.d.mts +1 -0
- package/dist/substrate/runtime/capability-sinks/layer.d.mts +1 -0
- package/dist/substrate/runtime/capability-sinks/layer.mjs +31 -0
- package/dist/substrate/runtime/capability-sinks/layer.mjs.map +1 -0
- package/dist/substrate/runtime/capability-sinks/service.d.mts +36 -0
- package/dist/substrate/runtime/capability-sinks/service.mjs +74 -0
- package/dist/substrate/runtime/capability-sinks/service.mjs.map +1 -0
- package/dist/substrate/runtime/config-validation.d.mts +38 -0
- package/dist/substrate/runtime/config-validation.mjs +137 -0
- package/dist/substrate/runtime/config-validation.mjs.map +1 -0
- package/dist/substrate/runtime/context-helpers.mjs +32 -0
- package/dist/substrate/runtime/context-helpers.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +128 -0
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs +136 -0
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs +49 -0
- package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs +9 -0
- package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/liveness.mjs +119 -0
- package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/roster.mjs +275 -0
- package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/snapshot-reservation.d.mts +1 -0
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +117 -0
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/stack-lock.d.mts +1 -0
- package/dist/substrate/runtime/cross-process/stack-lock.mjs +142 -0
- package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -0
- package/dist/substrate/runtime/current-plugin.mjs +15 -0
- package/dist/substrate/runtime/current-plugin.mjs.map +1 -0
- package/dist/substrate/runtime/errors.d.mts +1 -0
- package/dist/substrate/runtime/errors.mjs +76 -0
- package/dist/substrate/runtime/errors.mjs.map +1 -0
- package/dist/substrate/runtime/host-tree-tar/index.mjs +364 -0
- package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -0
- package/dist/substrate/runtime/http-probe.d.mts +35 -0
- package/dist/substrate/runtime/http-probe.mjs +65 -0
- package/dist/substrate/runtime/http-probe.mjs.map +1 -0
- package/dist/substrate/runtime/lease-broker/index.d.mts +1 -0
- package/dist/substrate/runtime/lease-broker/service.d.mts +64 -0
- package/dist/substrate/runtime/lease-broker/service.mjs +155 -0
- package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/dep-graph.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs +138 -0
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/index.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs +31 -0
- package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/plugin-registry.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +133 -0
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/ready-gate.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/ready-gate.mjs +34 -0
- package/dist/substrate/runtime/lifecycle/ready-gate.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/selective-restart.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/selective-restart.mjs +43 -0
- package/dist/substrate/runtime/lifecycle/selective-restart.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/signals.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/signals.mjs +64 -0
- package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/state-machine.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/state-machine.mjs +38 -0
- package/dist/substrate/runtime/lifecycle/state-machine.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/watch-attribution.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/watch-attribution.mjs +27 -0
- package/dist/substrate/runtime/lifecycle/watch-attribution.mjs.map +1 -0
- package/dist/substrate/runtime/managed-container.d.mts +30 -0
- package/dist/substrate/runtime/managed-container.mjs +32 -0
- package/dist/substrate/runtime/managed-container.mjs.map +1 -0
- package/dist/substrate/runtime/manifest/manifest.mjs +73 -0
- package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -0
- package/dist/substrate/runtime/mode-errors.d.mts +36 -0
- package/dist/substrate/runtime/observability/cascade-formatter.d.mts +1 -0
- package/dist/substrate/runtime/observability/cascade-formatter.mjs +135 -0
- package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -0
- package/dist/substrate/runtime/observability/formatter-registry.d.mts +1 -0
- package/dist/substrate/runtime/observability/formatter-registry.mjs +65 -0
- package/dist/substrate/runtime/observability/formatter-registry.mjs.map +1 -0
- package/dist/substrate/runtime/observability/index.d.mts +3 -0
- package/dist/substrate/runtime/observability/logger.d.mts +58 -0
- package/dist/substrate/runtime/observability/logger.mjs +89 -0
- package/dist/substrate/runtime/observability/logger.mjs.map +1 -0
- package/dist/substrate/runtime/observability/pretty-error.d.mts +1 -0
- package/dist/substrate/runtime/observability/pretty-error.mjs +119 -0
- package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -0
- package/dist/substrate/runtime/observability/process-lines.d.mts +31 -0
- package/dist/substrate/runtime/observability/process-lines.mjs +40 -0
- package/dist/substrate/runtime/observability/process-lines.mjs.map +1 -0
- package/dist/substrate/runtime/observability/redaction.d.mts +28 -0
- package/dist/substrate/runtime/observability/redaction.mjs +45 -0
- package/dist/substrate/runtime/observability/redaction.mjs.map +1 -0
- package/dist/substrate/runtime/observability/spans.d.mts +1 -0
- package/dist/substrate/runtime/observability/spans.mjs +87 -0
- package/dist/substrate/runtime/observability/spans.mjs.map +1 -0
- package/dist/substrate/runtime/observability/subprocess-capture.d.mts +2 -0
- package/dist/substrate/runtime/observability/subprocess-capture.mjs +82 -0
- package/dist/substrate/runtime/observability/subprocess-capture.mjs.map +1 -0
- package/dist/substrate/runtime/paths.d.mts +17 -0
- package/dist/substrate/runtime/paths.mjs +61 -0
- package/dist/substrate/runtime/paths.mjs.map +1 -0
- package/dist/substrate/runtime/port-broker/index.d.mts +1 -0
- package/dist/substrate/runtime/port-broker/service.d.mts +1 -0
- package/dist/substrate/runtime/port-broker/service.mjs +319 -0
- package/dist/substrate/runtime/port-broker/service.mjs.map +1 -0
- package/dist/substrate/runtime/post-acquire-tasks.d.mts +1 -0
- package/dist/substrate/runtime/post-acquire-tasks.mjs +34 -0
- package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -0
- package/dist/substrate/runtime/probes.d.mts +51 -0
- package/dist/substrate/runtime/probes.mjs +84 -0
- package/dist/substrate/runtime/probes.mjs.map +1 -0
- package/dist/substrate/runtime/process-supervisor.d.mts +57 -0
- package/dist/substrate/runtime/process-supervisor.mjs +73 -0
- package/dist/substrate/runtime/process-supervisor.mjs.map +1 -0
- package/dist/substrate/runtime/projection/operational-endpoints.mjs +44 -0
- package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -0
- package/dist/substrate/runtime/projection/persisted.mjs +195 -0
- package/dist/substrate/runtime/projection/persisted.mjs.map +1 -0
- package/dist/substrate/runtime/projection/state-ref.mjs +48 -0
- package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -0
- package/dist/substrate/runtime/projection/update.mjs +200 -0
- package/dist/substrate/runtime/projection/update.mjs.map +1 -0
- package/dist/substrate/runtime/retry-policy.d.mts +18 -0
- package/dist/substrate/runtime/retry-policy.mjs +16 -0
- package/dist/substrate/runtime/retry-policy.mjs.map +1 -0
- package/dist/substrate/runtime/run.mjs +86 -0
- package/dist/substrate/runtime/run.mjs.map +1 -0
- package/dist/substrate/runtime/runtime-decode.d.mts +32 -0
- package/dist/substrate/runtime/runtime-decode.mjs +53 -0
- package/dist/substrate/runtime/runtime-decode.mjs.map +1 -0
- package/dist/substrate/runtime/scoped-http-server.mjs +36 -0
- package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -0
- package/dist/substrate/runtime/scoped-ref-map/service.mjs +83 -0
- package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +1 -0
- package/dist/substrate/runtime/stage-and-swap/index.d.mts +1 -0
- package/dist/substrate/runtime/stage-and-swap/index.mjs +131 -0
- package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -0
- package/dist/substrate/runtime/state-store/schema.mjs +36 -0
- package/dist/substrate/runtime/state-store/schema.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.d.mts +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs +22 -0
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.d.mts +1 -0
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs +30 -0
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/index.d.mts +1 -0
- package/dist/substrate/runtime/strategy-registry/service.d.mts +1 -0
- package/dist/substrate/runtime/strategy-registry/service.mjs +67 -0
- package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -0
- package/dist/substrate/runtime/sui-execute/index.d.mts +11 -0
- package/dist/substrate/runtime/sui-execute/index.mjs +144 -0
- package/dist/substrate/runtime/sui-execute/index.mjs.map +1 -0
- package/dist/substrate/runtime/sui-move-build/index.d.mts +1 -0
- package/dist/substrate/runtime/sui-move-build/index.mjs +283 -0
- package/dist/substrate/runtime/sui-move-build/index.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor.d.mts +1 -0
- package/dist/substrate/runtime/supervisor.mjs +831 -0
- package/dist/substrate/runtime/supervisor.mjs.map +1 -0
- package/dist/surfaces/cli/command-tree.mjs +276 -0
- package/dist/surfaces/cli/command-tree.mjs.map +1 -0
- package/dist/surfaces/cli/commands/config.mjs +31 -0
- package/dist/surfaces/cli/commands/config.mjs.map +1 -0
- package/dist/surfaces/cli/commands/confirm-node.mjs +26 -0
- package/dist/surfaces/cli/commands/confirm-node.mjs.map +1 -0
- package/dist/surfaces/cli/commands/confirm.mjs +26 -0
- package/dist/surfaces/cli/commands/confirm.mjs.map +1 -0
- package/dist/surfaces/cli/commands/doctor-probes.mjs +452 -0
- package/dist/surfaces/cli/commands/doctor-probes.mjs.map +1 -0
- package/dist/surfaces/cli/commands/doctor.mjs +38 -0
- package/dist/surfaces/cli/commands/doctor.mjs.map +1 -0
- package/dist/surfaces/cli/commands/prune-picker.mjs +347 -0
- package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -0
- package/dist/surfaces/cli/commands/prune.mjs +178 -0
- package/dist/surfaces/cli/commands/prune.mjs.map +1 -0
- package/dist/surfaces/cli/commands/snapshot.mjs +141 -0
- package/dist/surfaces/cli/commands/snapshot.mjs.map +1 -0
- package/dist/surfaces/cli/commands/status.mjs +95 -0
- package/dist/surfaces/cli/commands/status.mjs.map +1 -0
- package/dist/surfaces/cli/commands/supervisor-presence.mjs +33 -0
- package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -0
- package/dist/surfaces/cli/commands/wipe.mjs +28 -0
- package/dist/surfaces/cli/commands/wipe.mjs.map +1 -0
- package/dist/surfaces/cli/envelope.mjs +43 -0
- package/dist/surfaces/cli/envelope.mjs.map +1 -0
- package/dist/surfaces/cli/errors.mjs +110 -0
- package/dist/surfaces/cli/errors.mjs.map +1 -0
- package/dist/surfaces/cli/flags.mjs +56 -0
- package/dist/surfaces/cli/flags.mjs.map +1 -0
- package/dist/surfaces/cli/index.mjs +418 -0
- package/dist/surfaces/cli/index.mjs.map +1 -0
- package/dist/surfaces/cli/output.mjs +115 -0
- package/dist/surfaces/cli/output.mjs.map +1 -0
- package/dist/surfaces/cli/sysexits.mjs +139 -0
- package/dist/surfaces/cli/sysexits.mjs.map +1 -0
- package/dist/surfaces/tui/app.mjs +104 -0
- package/dist/surfaces/tui/app.mjs.map +1 -0
- package/dist/surfaces/tui/dashboard.mjs +261 -0
- package/dist/surfaces/tui/dashboard.mjs.map +1 -0
- package/dist/surfaces/tui/display-derivation.mjs +395 -0
- package/dist/surfaces/tui/display-derivation.mjs.map +1 -0
- package/dist/surfaces/tui/errors.mjs +11 -0
- package/dist/surfaces/tui/errors.mjs.map +1 -0
- package/dist/surfaces/tui/event-log.mjs +155 -0
- package/dist/surfaces/tui/event-log.mjs.map +1 -0
- package/dist/surfaces/tui/heartbeat.mjs +33 -0
- package/dist/surfaces/tui/heartbeat.mjs.map +1 -0
- package/dist/surfaces/tui/index.mjs +50 -0
- package/dist/surfaces/tui/index.mjs.map +1 -0
- package/dist/surfaces/tui/input.mjs +104 -0
- package/dist/surfaces/tui/input.mjs.map +1 -0
- package/dist/surfaces/tui/mode-detect.mjs +32 -0
- package/dist/surfaces/tui/mode-detect.mjs.map +1 -0
- package/dist/surfaces/tui/mount-ink.mjs +31 -0
- package/dist/surfaces/tui/mount-ink.mjs.map +1 -0
- package/dist/surfaces/tui/plain-renderer.mjs +170 -0
- package/dist/surfaces/tui/plain-renderer.mjs.map +1 -0
- package/dist/surfaces/tui/resource-table.mjs +507 -0
- package/dist/surfaces/tui/resource-table.mjs.map +1 -0
- package/images/_shared/signal-forward.sh +77 -0
- package/images/postgres/Dockerfile +32 -0
- package/images/seal/Dockerfile +68 -0
- package/images/seal/entrypoint.sh +65 -0
- package/images/sui/Dockerfile +73 -0
- package/images/sui/entrypoint.sh +244 -0
- package/images/sui-fork/Dockerfile +53 -0
- package/images/sui-fork/entrypoint.sh +51 -0
- package/images/walrus/Dockerfile +122 -0
- package/images/walrus/deploy-walrus.sh +305 -0
- package/images/walrus/run-walrus.sh +53 -0
- package/package.json +94 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.mjs","names":[],"sources":["../../../../src/substrate/runtime/projection/update.ts"],"sourcesContent":["// Projection updater.\n//\n// Architecture § Renderer § \"Subscribable projection — exact field\n// enumeration\" (G2). The updater is a typed event-handler: each\n// `EngineEvent` produces a structurally-typed projection mutation.\n// Renderers never see the event taxonomy here; they only see the\n// resulting state.\n//\n// The updater is *pure data*: it takes the old state + an event,\n// returns the new state. Atomicity comes from\n// `SubscriptionRef.update` at the call site.\n//\n// Discipline:\n// - No display vocabulary (`title`, `primary`, `extras`) anywhere\n// in the produced state.\n// - All fields the architecture enumerates are reachable; new\n// event tags are picked up via exhaustive `tag` match (the\n// `_exhaustive: never` line will fail to type-check if a new\n// tag is added without a handler here).\n\nimport { Effect, SubscriptionRef } from 'effect';\n\nimport type { PluginKey } from '../../brand.ts';\nimport type { EngineEvent } from '../../events.ts';\nimport type { LifecycleStatus } from '../../lifecycle.ts';\nimport type {\n\tAccountProjection,\n\tBuildEntry,\n\tEndpoint,\n\tPackageProjection,\n\tRow,\n\tStructuredError,\n\tSubscribableState,\n} from '../../projection.ts';\nimport { applyLifecycleFact, factFromEvent } from '../lifecycle/lifecycle-fact.ts';\n\n// -----------------------------------------------------------------------------\n// Capacity policy\n// -----------------------------------------------------------------------------\n\n/** Bounded buffer for the top-level errors list. */\nconst MAX_ERRORS_KEPT = 100;\n/** Bounded buffer for the top-level build-entries list. */\nconst MAX_BUILD_ENTRIES_KEPT = 200;\n/** Per-row bounded log-tail length. Architecture: default 100 lines. */\nconst MAX_ROW_LOG_LINES = 100;\n\n// -----------------------------------------------------------------------------\n// Pure reducer\n// -----------------------------------------------------------------------------\n\n/**\n * Pure projection reducer. One event in, one new state out. All field\n * writes preserve `readonly` invariants by constructing fresh\n * objects/arrays rather than mutating.\n *\n * The `tag` switch is exhaustive against `EngineEvent['tag']`; the\n * trailing `_exhaustive: never` causes TS to flag any new tag that\n * isn't handled here.\n */\nexport const applyEvent = (state: SubscribableState, event: EngineEvent): SubscribableState => {\n\t// Every event advances `lastEvent.at`. `lastEvent.seq` is bumped at\n\t// the `updateRef` wrapper, not here — this reducer is pure data.\n\tconst withTouched = (next: Partial<SubscribableState>): SubscribableState => ({\n\t\t...state,\n\t\t...next,\n\t\tlastEvent: { seq: state.lastEvent.seq, at: eventAt(event) ?? state.lastEvent.at },\n\t});\n\n\t// Lifecycle-shaped events flow through the typed `LifecycleFact`\n\t// bridge — the projection consumes the merge-not-replace fact\n\t// instead of writing each lifecycle field independently. Non-\n\t// lifecycle events take their original specialised paths below.\n\tconst fact = factFromEvent(event);\n\tif (fact !== null) {\n\t\treturn withTouched({\n\t\t\trows: upsertRow(state.rows, fact.pluginKey as PluginKey, (row) =>\n\t\t\t\tapplyLifecycleFact(row, fact.delta),\n\t\t\t),\n\t\t});\n\t}\n\n\tswitch (event.tag) {\n\t\tcase 'lifecycle.statusChanged':\n\t\tcase 'lifecycle.phaseSet':\n\t\t\t// Handled above via `factFromEvent` — kept in the switch for\n\t\t\t// `_exhaustive` discipline.\n\t\t\treturn withTouched({});\n\n\t\tcase 'log.appended':\n\t\t\treturn withTouched({\n\t\t\t\trows: upsertRow(state.rows, event.pluginKey, (row) =>\n\t\t\t\t\tappendLogLine(row, event.line, event.level),\n\t\t\t\t),\n\t\t\t});\n\n\t\tcase 'endpoint.registered':\n\t\t\treturn withTouched({\n\t\t\t\tendpoints: upsertEndpoint(state.endpoints, event.endpoint),\n\t\t\t\trows: attachEndpoint(state.rows, event.endpoint),\n\t\t\t});\n\n\t\tcase 'account.updated':\n\t\t\treturn withTouched({\n\t\t\t\taccounts: upsertAccount(state.accounts, event.account),\n\t\t\t});\n\n\t\tcase 'package.updated':\n\t\t\treturn withTouched({\n\t\t\t\tpackages: upsertPackage(state.packages, event.package),\n\t\t\t});\n\n\t\tcase 'endpoint.released':\n\t\t\t// Renderer projection keeps endpoint history as last-known\n\t\t\t// operator affordance. A released service may no longer be\n\t\t\t// reachable, but hiding the URL during shutdown/restart makes\n\t\t\t// the TUI lose the most useful debugging handle.\n\t\t\treturn withTouched({});\n\n\t\tcase 'strategy.registered':\n\t\tcase 'strategy.unregistered':\n\t\tcase 'manifest.flushed':\n\t\tcase 'codegen.emitted':\n\t\tcase 'snapshot.captureStarted':\n\t\tcase 'snapshot.captureProgress':\n\t\tcase 'snapshot.captureSkipped':\n\t\tcase 'snapshot.captureFailed':\n\t\tcase 'snapshot.captured':\n\t\tcase 'snapshot.restored':\n\t\t\t// Engine-internal events that don't carry a projection slice\n\t\t\t// — surfaced on the live event stream for renderers that care,\n\t\t\t// but contribute no field to the subscribable state. (Adding\n\t\t\t// a projection field for any of these requires an architecture\n\t\t\t// revision per G2.)\n\t\t\treturn withTouched({});\n\n\t\tcase 'shutdown.escalated':\n\t\t\treturn withTouched({\n\t\t\t\tcycle: { ...state.cycle, phase: 'shutting-down' },\n\t\t\t});\n\n\t\tcase 'error.reported':\n\t\t\treturn withTouched({\n\t\t\t\terrors: pushBounded(state.errors, event.error, MAX_ERRORS_KEPT),\n\t\t\t\trows: event.error.pluginKey\n\t\t\t\t\t? upsertRow(state.rows, event.error.pluginKey, (row) => ({\n\t\t\t\t\t\t\t...row,\n\t\t\t\t\t\t\tlastError: event.error,\n\t\t\t\t\t\t}))\n\t\t\t\t\t: state.rows,\n\t\t\t});\n\n\t\tcase 'build.statusChanged':\n\t\t\treturn withTouched({\n\t\t\t\tstackBuild: pushBounded(state.stackBuild, event.entry, MAX_BUILD_ENTRIES_KEPT),\n\t\t\t});\n\n\t\tcase 'restart.requested':\n\t\t\treturn withTouched({\n\t\t\t\tcycle: { ...state.cycle, phase: 'restarting' },\n\t\t\t\trows:\n\t\t\t\t\tevent.target === 'stack'\n\t\t\t\t\t\t? state.rows.map((r) => ({ ...r, selectiveRestartHighlight: false }))\n\t\t\t\t\t\t: state.rows.map((r) =>\n\t\t\t\t\t\t\t\tr.key === (event.target as { pluginKey: PluginKey }).pluginKey\n\t\t\t\t\t\t\t\t\t? { ...r, selectiveRestartHighlight: true }\n\t\t\t\t\t\t\t\t\t: r,\n\t\t\t\t\t\t\t),\n\t\t\t});\n\n\t\tcase 'restart.completed':\n\t\t\treturn withTouched({\n\t\t\t\tcycle: { ...state.cycle, phase: 'running' },\n\t\t\t\trows: state.rows.map((r) => ({ ...r, selectiveRestartHighlight: false })),\n\t\t\t});\n\n\t\tdefault: {\n\t\t\tconst _exhaustive: never = event;\n\t\t\tvoid _exhaustive;\n\t\t\treturn state;\n\t\t}\n\t}\n};\n\n// -----------------------------------------------------------------------------\n// Engine-side mutators (not driven by EngineEvent)\n// -----------------------------------------------------------------------------\n\n/**\n * Replace `identity` on the projection. Called once at boot per cycle;\n * does NOT change on hot-restart.\n */\nexport const setIdentity = (\n\tstate: SubscribableState,\n\tidentity: SubscribableState['identity'],\n): SubscribableState => ({ ...state, identity });\n\n/**\n * Bump the cycle counter. Called at the start of each engine cycle.\n * Resets only fields the architecture says are per-cycle:\n * - `cycle.id`, `cycle.startedAt`, `cycle.phase`\n * - per-row `selectiveRestartHighlight`\n * The error log, endpoints, build log, and `lastEvent.seq` are\n * intentionally preserved across cycles so the renderer sees\n * continuous history.\n */\nexport const bumpCycle = (\n\tstate: SubscribableState,\n\tnow: number,\n\tphase: SubscribableState['cycle']['phase'] = 'booting',\n): SubscribableState => ({\n\t...state,\n\tcycle: { id: state.cycle.id + 1, startedAt: now, phase },\n\trows: state.rows.map((r) => ({ ...r, selectiveRestartHighlight: false })),\n});\n\n/**\n * Register (or replace) a row in the projection. The supervisor wires\n * the call in.\n */\nexport const declareRow = (state: SubscribableState, row: Row): SubscribableState => {\n\tconst idx = state.rows.findIndex((r) => r.key === row.key);\n\tif (idx === -1) return { ...state, rows: [...state.rows, row] };\n\tconst next = state.rows.slice();\n\tnext[idx] = row;\n\treturn { ...state, rows: next };\n};\n\n/**\n * Drop a row. Used during selective-restart when a plugin is being\n * removed (rare; most restarts replay the same row).\n */\nexport const dropRow = (state: SubscribableState, key: PluginKey): SubscribableState => ({\n\t...state,\n\trows: state.rows.filter((r) => r.key !== key),\n});\n\nexport const declareAccount = (\n\tstate: SubscribableState,\n\taccount: AccountProjection,\n): SubscribableState => ({\n\t...state,\n\taccounts: upsertAccount(state.accounts, account),\n});\n\nexport const declarePackage = (\n\tstate: SubscribableState,\n\tpkg: PackageProjection,\n): SubscribableState => ({\n\t...state,\n\tpackages: upsertPackage(state.packages, pkg),\n});\n\n// -----------------------------------------------------------------------------\n// SubscriptionRef-driven updaters\n// -----------------------------------------------------------------------------\n\n/**\n * Apply an `EngineEvent` to the ref, bumping the sequence number\n * atomically. The seq is monotonic per process and survives cycle\n * boundaries.\n *\n * Uses `state.lastEvent.seq + 1` for monotonic per-process counts.\n */\nexport const updateRef = (\n\tref: SubscriptionRef.SubscriptionRef<SubscribableState>,\n\tevent: EngineEvent,\n): Effect.Effect<void> =>\n\tSubscriptionRef.update(ref, (state) => {\n\t\tconst next = applyEvent(state, event);\n\t\treturn {\n\t\t\t...next,\n\t\t\tlastEvent: { seq: state.lastEvent.seq + 1, at: next.lastEvent.at },\n\t\t};\n\t});\n\n// -----------------------------------------------------------------------------\n// Internals\n// -----------------------------------------------------------------------------\n\nconst eventAt = (event: EngineEvent): number | null => {\n\tif ('at' in event) return event.at;\n\t// Events whose payload nests `at` (endpoint, error, build): pull it\n\t// up. Discriminating purely on `tag` keeps this exhaustive.\n\tswitch (event.tag) {\n\t\tcase 'endpoint.registered':\n\t\t\treturn event.endpoint.registeredAt;\n\t\tcase 'error.reported':\n\t\t\treturn event.error.at;\n\t\tcase 'build.statusChanged':\n\t\t\treturn event.entry.startedAt;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n};\n\nconst upsertRow = (\n\trows: ReadonlyArray<Row>,\n\tkey: PluginKey,\n\tupdate: (row: Row) => Row,\n): ReadonlyArray<Row> => {\n\tconst idx = rows.findIndex((r) => r.key === key);\n\tif (idx === -1) {\n\t\t// Row was never declared. We do NOT auto-create — declaration is\n\t\t// the plugin's job. Drop the event silently; the renderer can't\n\t\t// render a row it doesn't know about.\n\t\treturn rows;\n\t}\n\tconst next = rows.slice();\n\tnext[idx] = update(rows[idx]!);\n\treturn next;\n};\n\nconst appendLogLine = (row: Row, line: string, level: 'info' | 'warn' | 'error'): Row => {\n\tconst nextLines = [...row.logTail.lines, line];\n\tconst truncated = nextLines.length > MAX_ROW_LOG_LINES;\n\tconst trimmed = truncated ? nextLines.slice(-MAX_ROW_LOG_LINES) : nextLines;\n\treturn {\n\t\t...row,\n\t\tlogTail: {\n\t\t\tlines: trimmed,\n\t\t\tlevel: maxLevel(row.logTail.level, level),\n\t\t\ttruncated: row.logTail.truncated || truncated,\n\t\t},\n\t};\n};\n\nconst maxLevel = (\n\ta: 'info' | 'warn' | 'error',\n\tb: 'info' | 'warn' | 'error',\n): 'info' | 'warn' | 'error' => {\n\tconst rank = { info: 0, warn: 1, error: 2 } as const;\n\treturn rank[a] >= rank[b] ? a : b;\n};\n\nconst upsertEndpoint = (\n\tendpoints: ReadonlyArray<Endpoint>,\n\tendpoint: Endpoint,\n): ReadonlyArray<Endpoint> => {\n\tconst idx = endpoints.findIndex((e) => e.endpointKey === endpoint.endpointKey);\n\tif (idx === -1) return [...endpoints, endpoint];\n\tconst next = endpoints.slice();\n\tnext[idx] = endpoint;\n\treturn next;\n};\n\nconst upsertAccount = (\n\taccounts: ReadonlyArray<AccountProjection>,\n\taccount: AccountProjection,\n): ReadonlyArray<AccountProjection> => {\n\tconst idx = accounts.findIndex((entry) => entry.key === account.key);\n\tif (idx === -1) return [...accounts, account];\n\tconst next = accounts.slice();\n\tnext[idx] = {\n\t\t...accounts[idx]!,\n\t\t...account,\n\t\tfunding: {\n\t\t\t...accounts[idx]!.funding,\n\t\t\t...account.funding,\n\t\t},\n\t};\n\treturn next;\n};\n\nconst upsertPackage = (\n\tpackages: ReadonlyArray<PackageProjection>,\n\tpkg: PackageProjection,\n): ReadonlyArray<PackageProjection> => {\n\tconst idx = packages.findIndex((entry) => entry.key === pkg.key);\n\tif (idx === -1) return [...packages, pkg];\n\tconst next = packages.slice();\n\tnext[idx] = {\n\t\t...packages[idx]!,\n\t\t...pkg,\n\t};\n\treturn next;\n};\n\nconst attachEndpoint = (rows: ReadonlyArray<Row>, endpoint: Endpoint): ReadonlyArray<Row> => {\n\t// Endpoint -> Row link is `endpointKey` derived from `pluginKey` + dispatchId.\n\t// The plugin that owns the endpoint must have a row; we look it up by\n\t// the endpoint's pluginKey via a structured field. The current\n\t// `Endpoint` shape (from projection.ts) doesn't carry pluginKey in\n\t// the projection slice — it's derivable from `endpointKey` (prefix match).\n\tconst probableKey = endpoint.endpointKey;\n\treturn rows.map((row) =>\n\t\tprobableKey.startsWith(row.key)\n\t\t\t? row.endpoints.includes(probableKey)\n\t\t\t\t? row\n\t\t\t\t: { ...row, endpoints: [...row.endpoints, probableKey] }\n\t\t\t: row,\n\t);\n};\n\nconst pushBounded = <T>(xs: ReadonlyArray<T>, value: T, max: number): ReadonlyArray<T> => {\n\tconst next = [...xs, value];\n\treturn next.length > max ? next.slice(-max) : next;\n};\n\n// Re-export the bounded-capacity constants for tests / docs.\nexport const __capacities = {\n\tMAX_ERRORS_KEPT,\n\tMAX_BUILD_ENTRIES_KEPT,\n\tMAX_ROW_LOG_LINES,\n} as const;\n\n// Re-export referenced sub-types for downstream consumers (tests,\n// renderer-side wrappers) so they don't reach into substrate/\n// directly.\nexport type {\n\tAccountProjection,\n\tBuildEntry,\n\tEndpoint,\n\tLifecycleStatus,\n\tPackageProjection,\n\tRow,\n\tStructuredError,\n};\n"],"mappings":";;;;AAyCA,MAAM,kBAAkB;;AAExB,MAAM,yBAAyB;;AAE/B,MAAM,oBAAoB;;;;;;;;;;AAe1B,MAAa,cAAc,OAA0B,UAA0C;CAG9F,MAAM,eAAe,UAAyD;EAC7E,GAAG;EACH,GAAG;EACH,WAAW;GAAE,KAAK,MAAM,UAAU;GAAK,IAAI,QAAQ,MAAM,IAAI,MAAM,UAAU;GAAI;EACjF;CAMD,MAAM,OAAO,cAAc,MAAM;AACjC,KAAI,SAAS,KACZ,QAAO,YAAY,EAClB,MAAM,UAAU,MAAM,MAAM,KAAK,YAAyB,QACzD,mBAAmB,KAAK,KAAK,MAAM,CACnC,EACD,CAAC;AAGH,SAAQ,MAAM,KAAd;EACC,KAAK;EACL,KAAK,qBAGJ,QAAO,YAAY,EAAE,CAAC;EAEvB,KAAK,eACJ,QAAO,YAAY,EAClB,MAAM,UAAU,MAAM,MAAM,MAAM,YAAY,QAC7C,cAAc,KAAK,MAAM,MAAM,MAAM,MAAM,CAC3C,EACD,CAAC;EAEH,KAAK,sBACJ,QAAO,YAAY;GAClB,WAAW,eAAe,MAAM,WAAW,MAAM,SAAS;GAC1D,MAAM,eAAe,MAAM,MAAM,MAAM,SAAS;GAChD,CAAC;EAEH,KAAK,kBACJ,QAAO,YAAY,EAClB,UAAU,cAAc,MAAM,UAAU,MAAM,QAAQ,EACtD,CAAC;EAEH,KAAK,kBACJ,QAAO,YAAY,EAClB,UAAU,cAAc,MAAM,UAAU,MAAM,QAAQ,EACtD,CAAC;EAEH,KAAK,oBAKJ,QAAO,YAAY,EAAE,CAAC;EAEvB,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,oBAMJ,QAAO,YAAY,EAAE,CAAC;EAEvB,KAAK,qBACJ,QAAO,YAAY,EAClB,OAAO;GAAE,GAAG,MAAM;GAAO,OAAO;GAAiB,EACjD,CAAC;EAEH,KAAK,iBACJ,QAAO,YAAY;GAClB,QAAQ,YAAY,MAAM,QAAQ,MAAM,OAAO,gBAAgB;GAC/D,MAAM,MAAM,MAAM,YACf,UAAU,MAAM,MAAM,MAAM,MAAM,YAAY,SAAS;IACvD,GAAG;IACH,WAAW,MAAM;IACjB,EAAE,GACF,MAAM;GACT,CAAC;EAEH,KAAK,sBACJ,QAAO,YAAY,EAClB,YAAY,YAAY,MAAM,YAAY,MAAM,OAAO,uBAAuB,EAC9E,CAAC;EAEH,KAAK,oBACJ,QAAO,YAAY;GAClB,OAAO;IAAE,GAAG,MAAM;IAAO,OAAO;IAAc;GAC9C,MACC,MAAM,WAAW,UACd,MAAM,KAAK,KAAK,OAAO;IAAE,GAAG;IAAG,2BAA2B;IAAO,EAAE,GACnE,MAAM,KAAK,KAAK,MAChB,EAAE,QAAS,MAAM,OAAoC,YAClD;IAAE,GAAG;IAAG,2BAA2B;IAAM,GACzC,EACH;GACJ,CAAC;EAEH,KAAK,oBACJ,QAAO,YAAY;GAClB,OAAO;IAAE,GAAG,MAAM;IAAO,OAAO;IAAW;GAC3C,MAAM,MAAM,KAAK,KAAK,OAAO;IAAE,GAAG;IAAG,2BAA2B;IAAO,EAAE;GACzE,CAAC;EAEH,QAGC,QAAO;;;;;;;AAaV,MAAa,eACZ,OACA,cACwB;CAAE,GAAG;CAAO;CAAU;AA0C/C,MAAa,kBACZ,OACA,aACwB;CACxB,GAAG;CACH,UAAU,cAAc,MAAM,UAAU,QAAQ;CAChD;;;;;;;;AAqBD,MAAa,aACZ,KACA,UAEA,gBAAgB,OAAO,MAAM,UAAU;CACtC,MAAM,OAAO,WAAW,OAAO,MAAM;AACrC,QAAO;EACN,GAAG;EACH,WAAW;GAAE,KAAK,MAAM,UAAU,MAAM;GAAG,IAAI,KAAK,UAAU;GAAI;EAClE;EACA;AAMH,MAAM,WAAW,UAAsC;AACtD,KAAI,QAAQ,MAAO,QAAO,MAAM;AAGhC,SAAQ,MAAM,KAAd;EACC,KAAK,sBACJ,QAAO,MAAM,SAAS;EACvB,KAAK,iBACJ,QAAO,MAAM,MAAM;EACpB,KAAK,sBACJ,QAAO,MAAM,MAAM;EACpB,QACC,QAAO;;;AAIV,MAAM,aACL,MACA,KACA,WACwB;CACxB,MAAM,MAAM,KAAK,WAAW,MAAM,EAAE,QAAQ,IAAI;AAChD,KAAI,QAAQ,GAIX,QAAO;CAER,MAAM,OAAO,KAAK,OAAO;AACzB,MAAK,OAAO,OAAO,KAAK,KAAM;AAC9B,QAAO;;AAGR,MAAM,iBAAiB,KAAU,MAAc,UAA0C;CACxF,MAAM,YAAY,CAAC,GAAG,IAAI,QAAQ,OAAO,KAAK;CAC9C,MAAM,YAAY,UAAU,SAAS;CACrC,MAAM,UAAU,YAAY,UAAU,MAAM,CAAC,kBAAkB,GAAG;AAClE,QAAO;EACN,GAAG;EACH,SAAS;GACR,OAAO;GACP,OAAO,SAAS,IAAI,QAAQ,OAAO,MAAM;GACzC,WAAW,IAAI,QAAQ,aAAa;GACpC;EACD;;AAGF,MAAM,YACL,GACA,MAC+B;CAC/B,MAAM,OAAO;EAAE,MAAM;EAAG,MAAM;EAAG,OAAO;EAAG;AAC3C,QAAO,KAAK,MAAM,KAAK,KAAK,IAAI;;AAGjC,MAAM,kBACL,WACA,aAC6B;CAC7B,MAAM,MAAM,UAAU,WAAW,MAAM,EAAE,gBAAgB,SAAS,YAAY;AAC9E,KAAI,QAAQ,GAAI,QAAO,CAAC,GAAG,WAAW,SAAS;CAC/C,MAAM,OAAO,UAAU,OAAO;AAC9B,MAAK,OAAO;AACZ,QAAO;;AAGR,MAAM,iBACL,UACA,YACsC;CACtC,MAAM,MAAM,SAAS,WAAW,UAAU,MAAM,QAAQ,QAAQ,IAAI;AACpE,KAAI,QAAQ,GAAI,QAAO,CAAC,GAAG,UAAU,QAAQ;CAC7C,MAAM,OAAO,SAAS,OAAO;AAC7B,MAAK,OAAO;EACX,GAAG,SAAS;EACZ,GAAG;EACH,SAAS;GACR,GAAG,SAAS,KAAM;GAClB,GAAG,QAAQ;GACX;EACD;AACD,QAAO;;AAGR,MAAM,iBACL,UACA,QACsC;CACtC,MAAM,MAAM,SAAS,WAAW,UAAU,MAAM,QAAQ,IAAI,IAAI;AAChE,KAAI,QAAQ,GAAI,QAAO,CAAC,GAAG,UAAU,IAAI;CACzC,MAAM,OAAO,SAAS,OAAO;AAC7B,MAAK,OAAO;EACX,GAAG,SAAS;EACZ,GAAG;EACH;AACD,QAAO;;AAGR,MAAM,kBAAkB,MAA0B,aAA2C;CAM5F,MAAM,cAAc,SAAS;AAC7B,QAAO,KAAK,KAAK,QAChB,YAAY,WAAW,IAAI,IAAI,GAC5B,IAAI,UAAU,SAAS,YAAY,GAClC,MACA;EAAE,GAAG;EAAK,WAAW,CAAC,GAAG,IAAI,WAAW,YAAY;EAAE,GACvD,IACH;;AAGF,MAAM,eAAkB,IAAsB,OAAU,QAAkC;CACzF,MAAM,OAAO,CAAC,GAAG,IAAI,MAAM;AAC3B,QAAO,KAAK,SAAS,MAAM,KAAK,MAAM,CAAC,IAAI,GAAG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Schedule } from "effect";
|
|
2
|
+
import * as _$effect_Duration0 from "effect/Duration";
|
|
3
|
+
|
|
4
|
+
//#region src/substrate/runtime/retry-policy.d.ts
|
|
5
|
+
declare namespace retry_policy_d_exports {
|
|
6
|
+
export { ExponentialRetryOptions, makeExponentialRetrySchedule, makeSpacedRetrySchedule };
|
|
7
|
+
}
|
|
8
|
+
interface ExponentialRetryOptions {
|
|
9
|
+
readonly initialDelayMs: number;
|
|
10
|
+
readonly maxRetries: number;
|
|
11
|
+
readonly factor?: number;
|
|
12
|
+
readonly jitter?: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare const makeExponentialRetrySchedule: (options: ExponentialRetryOptions) => Schedule.Schedule<[_$effect_Duration0.Duration, number], unknown, never, never>;
|
|
15
|
+
declare const makeSpacedRetrySchedule: (delayMs: number, maxRetries: number) => Schedule.Schedule<[number, number], unknown, never, never>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { retry_policy_d_exports };
|
|
18
|
+
//# sourceMappingURL=retry-policy.d.mts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { Schedule } from "effect";
|
|
3
|
+
//#region src/substrate/runtime/retry-policy.ts
|
|
4
|
+
var retry_policy_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
makeExponentialRetrySchedule: () => makeExponentialRetrySchedule,
|
|
6
|
+
makeSpacedRetrySchedule: () => makeSpacedRetrySchedule
|
|
7
|
+
});
|
|
8
|
+
const makeExponentialRetrySchedule = (options) => {
|
|
9
|
+
const schedule = Schedule.exponential(`${options.initialDelayMs} millis`, options.factor ?? 2);
|
|
10
|
+
return (options.jitter === false ? schedule : schedule.pipe(Schedule.jittered)).pipe(Schedule.both(Schedule.recurs(options.maxRetries)));
|
|
11
|
+
};
|
|
12
|
+
const makeSpacedRetrySchedule = (delayMs, maxRetries) => Schedule.spaced(`${delayMs} millis`).pipe(Schedule.both(Schedule.recurs(maxRetries)));
|
|
13
|
+
//#endregion
|
|
14
|
+
export { makeExponentialRetrySchedule, makeSpacedRetrySchedule, retry_policy_exports };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=retry-policy.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry-policy.mjs","names":[],"sources":["../../../src/substrate/runtime/retry-policy.ts"],"sourcesContent":["import { Schedule } from 'effect';\n\nexport interface ExponentialRetryOptions {\n\treadonly initialDelayMs: number;\n\treadonly maxRetries: number;\n\treadonly factor?: number;\n\treadonly jitter?: boolean;\n}\n\nexport const makeExponentialRetrySchedule = (options: ExponentialRetryOptions) => {\n\tconst schedule = Schedule.exponential(`${options.initialDelayMs} millis`, options.factor ?? 2);\n\tconst jittered = options.jitter === false ? schedule : schedule.pipe(Schedule.jittered);\n\treturn jittered.pipe(Schedule.both(Schedule.recurs(options.maxRetries)));\n};\n\nexport const makeSpacedRetrySchedule = (delayMs: number, maxRetries: number) =>\n\tSchedule.spaced(`${delayMs} millis`).pipe(Schedule.both(Schedule.recurs(maxRetries)));\n"],"mappings":";;;;;;;AASA,MAAa,gCAAgC,YAAqC;CACjF,MAAM,WAAW,SAAS,YAAY,GAAG,QAAQ,eAAe,UAAU,QAAQ,UAAU,EAAE;AAE9F,SADiB,QAAQ,WAAW,QAAQ,WAAW,SAAS,KAAK,SAAS,SAAS,EACvE,KAAK,SAAS,KAAK,SAAS,OAAO,QAAQ,WAAW,CAAC,CAAC;;AAGzE,MAAa,2BAA2B,SAAiB,eACxD,SAAS,OAAO,GAAG,QAAQ,SAAS,CAAC,KAAK,SAAS,KAAK,SAAS,OAAO,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { IdentityContext, RuntimeRoot, StackPathsService, layerIdentity, layerRuntimeRoot, layerStackPaths } from "./paths.mjs";
|
|
2
|
+
import { PortBrokerService, layerPortBroker } from "./port-broker/service.mjs";
|
|
3
|
+
import { CacheService, layerCache } from "./cache/service.mjs";
|
|
4
|
+
import { DockerSpawner, layerDockerHostDefault } from "../../runtime/docker/client.mjs";
|
|
5
|
+
import { ContainerRuntimeService, layerContainerRuntimeDocker, layerDockerCycleInitial } from "../../runtime/docker/service.mjs";
|
|
6
|
+
import { LeaseBrokerService, layerLeaseBroker } from "./lease-broker/service.mjs";
|
|
7
|
+
import { Redactor, layerRedactor } from "./observability/redaction.mjs";
|
|
8
|
+
import { Logger as Logger$1, layerLogger } from "./observability/logger.mjs";
|
|
9
|
+
import { ArtifactPublisherService, layerArtifactPublisher } from "./artifact-publisher/index.mjs";
|
|
10
|
+
import { StrategyRegistryService, layerStrategyRegistry } from "./strategy-registry/service.mjs";
|
|
11
|
+
import { awaitAll } from "./lifecycle/ready-gate.mjs";
|
|
12
|
+
import { PostAcquireTasksService, layerPostAcquireTasks } from "./post-acquire-tasks.mjs";
|
|
13
|
+
import { startSupervisor } from "./supervisor.mjs";
|
|
14
|
+
import { Context, Effect, Layer } from "effect";
|
|
15
|
+
import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem";
|
|
16
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
17
|
+
import * as NodeChildProcessSpawner from "@effect/platform-node/NodeChildProcessSpawner";
|
|
18
|
+
import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
|
|
19
|
+
//#region src/substrate/runtime/run.ts
|
|
20
|
+
/** Substrate Layer stack for a single supervised run. Composes every L0
|
|
21
|
+
* service the supervisor yields from its R-channel, plus the L1 Docker
|
|
22
|
+
* `ContainerRuntime`. Built-in plugin services are layered outside
|
|
23
|
+
* substrate and added through `extendContext`. */
|
|
24
|
+
const buildSubstrateLayers = (identity, runtimeRoot) => {
|
|
25
|
+
const layerDockerSpawnerFromNode = Layer.effect(DockerSpawner, Effect.gen(function* () {
|
|
26
|
+
return yield* ChildProcessSpawner;
|
|
27
|
+
}));
|
|
28
|
+
const platformBase = Layer.mergeAll(layerIdentity(identity), layerRuntimeRoot(runtimeRoot), NodePath.layer, NodeFileSystem.layer, layerDockerHostDefault, layerDockerCycleInitial, layerStrategyRegistry);
|
|
29
|
+
const childProcessSpawnerWired = NodeChildProcessSpawner.layer.pipe(Layer.provideMerge(platformBase));
|
|
30
|
+
const withStackPaths = layerStackPaths.pipe(Layer.provideMerge(childProcessSpawnerWired));
|
|
31
|
+
const withCache = layerCache.pipe(Layer.provideMerge(withStackPaths));
|
|
32
|
+
const withArtifactPublisher = layerArtifactPublisher.pipe(Layer.provideMerge(withCache));
|
|
33
|
+
const withPortBroker = layerPortBroker.pipe(Layer.provideMerge(withArtifactPublisher));
|
|
34
|
+
const withLeaseBroker = layerLeaseBroker.pipe(Layer.provideMerge(withPortBroker));
|
|
35
|
+
const withSpawnerAdapter = layerDockerSpawnerFromNode.pipe(Layer.provideMerge(withLeaseBroker));
|
|
36
|
+
const withContainerRuntime = layerContainerRuntimeDocker.pipe(Layer.provideMerge(withSpawnerAdapter));
|
|
37
|
+
const withPostAcquireTasks = layerPostAcquireTasks.pipe(Layer.provideMerge(withContainerRuntime));
|
|
38
|
+
const withRedactor = layerRedactor.pipe(Layer.provideMerge(withPostAcquireTasks));
|
|
39
|
+
return layerLogger.pipe(Layer.provideMerge(withRedactor));
|
|
40
|
+
};
|
|
41
|
+
/** Build the opaque `Context.Context<never>` the supervisor hands to
|
|
42
|
+
* every plugin's `acquire` body. Yields every substrate service the
|
|
43
|
+
* Docker-backed substrate layer stack provides; downstream callers
|
|
44
|
+
* may extend the context (e.g. layering a Logger or a
|
|
45
|
+
* `CapabilitySinksService`) before passing it to `supervise()`. */
|
|
46
|
+
const buildPluginContext = () => Effect.gen(function* () {
|
|
47
|
+
const identityCtx = yield* IdentityContext;
|
|
48
|
+
const runtimeRootResolved = yield* RuntimeRoot;
|
|
49
|
+
const stackPaths = yield* StackPathsService;
|
|
50
|
+
const cache = yield* CacheService;
|
|
51
|
+
const registry = yield* StrategyRegistryService;
|
|
52
|
+
const containerRuntime = yield* ContainerRuntimeService;
|
|
53
|
+
const publisher = yield* ArtifactPublisherService;
|
|
54
|
+
const portBroker = yield* PortBrokerService;
|
|
55
|
+
const leaseBroker = yield* LeaseBrokerService;
|
|
56
|
+
const postAcquireTasks = yield* PostAcquireTasksService;
|
|
57
|
+
const logger = yield* Logger$1;
|
|
58
|
+
const redactor = yield* Redactor;
|
|
59
|
+
return Context.empty().pipe(Context.add(IdentityContext, identityCtx), Context.add(RuntimeRoot, runtimeRootResolved), Context.add(StackPathsService, stackPaths), Context.add(CacheService, cache), Context.add(StrategyRegistryService, registry), Context.add(ContainerRuntimeService, containerRuntime), Context.add(ArtifactPublisherService, publisher), Context.add(PortBrokerService, portBroker), Context.add(LeaseBrokerService, leaseBroker), Context.add(PostAcquireTasksService, postAcquireTasks), Context.add(Logger$1, logger), Context.add(Redactor, redactor));
|
|
60
|
+
});
|
|
61
|
+
/** Effect that boots the supervisor for `stack` and blocks on the
|
|
62
|
+
* supervisor's shutdown latch. Returns the final `SubscribableState`
|
|
63
|
+
* snapshot so callers (CLI, library handle) can inspect post-shutdown
|
|
64
|
+
* state. */
|
|
65
|
+
const superviseStackEffect = (stack, identity, state, opts = {}) => Effect.gen(function* () {
|
|
66
|
+
const baseContext = yield* buildPluginContext();
|
|
67
|
+
const pluginContext = opts.extendContext === void 0 ? baseContext : yield* opts.extendContext(baseContext);
|
|
68
|
+
return yield* Effect.scoped(Effect.gen(function* () {
|
|
69
|
+
const startup = yield* startSupervisor(stack, identity, state, pluginContext, opts.orchestratorSinks ?? [], opts.commandHandler, opts.postAcquireHook, { commandLoop: opts.lifetime !== "one-shot" });
|
|
70
|
+
const { handle } = startup;
|
|
71
|
+
if (opts.beforeInitialAcquire !== void 0) yield* opts.beforeInitialAcquire(handle);
|
|
72
|
+
if (opts.lifetime === "one-shot") {
|
|
73
|
+
yield* startup.runInitialAcquire;
|
|
74
|
+
yield* awaitAll(startup.handle.registry, [...startup.handle.graph.nodes.keys()]);
|
|
75
|
+
if (opts.withinScope !== void 0) yield* opts.withinScope(handle);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if ((yield* Effect.raceFirst(startup.runInitialAcquire.pipe(Effect.as("booted")), handle.awaitShutdown.pipe(Effect.as("shutdown")))) === "shutdown") return;
|
|
79
|
+
if (opts.withinScope !== void 0) yield* opts.withinScope(handle);
|
|
80
|
+
yield* handle.awaitShutdown;
|
|
81
|
+
}));
|
|
82
|
+
});
|
|
83
|
+
//#endregion
|
|
84
|
+
export { buildSubstrateLayers, superviseStackEffect };
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=run.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.mjs","names":["Logger"],"sources":["../../../src/substrate/runtime/run.ts"],"sourcesContent":["// Shared substrate-Layer composition + supervise() entrypoint.\n//\n// Single seam consumed by both the CLI bin entry (`cli/main.ts`) and the\n// library-facing programmatic surface (`api/run-stack.ts`). Composes the\n// substrate Layer stack, yields the substrate services into a\n// `Context.Context<never>` pluginContext, builds the projection ref,\n// and runs `supervise()` inside a scope.\n//\n// The CLI augments the supervised body with cross-process command\n// channel forwarding; the library surface passes a no-op augmentation\n// and exposes the handle's events / state / awaitShutdown directly.\n//\n// Architecture: this is L0 substrate. It names no plugin and no\n// capability declaration. Built-in plugin services are composed by the\n// higher-level runtime composition layer before the supervisor starts.\n\nimport { Context, Effect, Layer, Logger as EffectLogger, Scope, SubscriptionRef } from 'effect';\nimport * as NodeFileSystem from '@effect/platform-node/NodeFileSystem';\nimport * as NodePath from '@effect/platform-node/NodePath';\nimport * as NodeChildProcessSpawner from '@effect/platform-node/NodeChildProcessSpawner';\nimport { ChildProcessSpawner } from 'effect/unstable/process/ChildProcessSpawner';\n\nimport type { Identity } from '../identity.ts';\nimport { CacheService, layerCache } from './cache/index.ts';\nimport { LeaseBrokerService, layerLeaseBroker } from './lease-broker/index.ts';\nimport { ArtifactPublisherService, layerArtifactPublisher } from './artifact-publisher/index.ts';\nimport {\n\tIdentityContext,\n\tRuntimeRoot,\n\tStackPathsService,\n\tlayerIdentity,\n\tlayerRuntimeRoot,\n\tlayerStackPaths,\n} from './paths.ts';\nimport { PortBrokerService, layerPortBroker } from './port-broker/index.ts';\nimport { StrategyRegistryService, layerStrategyRegistry } from './strategy-registry/index.ts';\nimport {\n\tContainerRuntimeService,\n\tDockerSpawner,\n\tlayerContainerRuntimeDocker,\n\tlayerDockerCycleInitial,\n\tlayerDockerHostDefault,\n} from '../../runtime/docker/index.ts';\nimport { awaitAll } from './lifecycle/index.ts';\nimport { makeProjectionRef } from './projection/index.ts';\nimport { Logger, Redactor, layerLogger, layerRedactor } from './observability/index.ts';\nimport { PostAcquireTasksService, layerPostAcquireTasks } from './post-acquire-tasks.ts';\nimport {\n\tstartSupervisor,\n\ttype OrchestratorSinks,\n\ttype SupervisedStack,\n\ttype SupervisorCommandHandler,\n\ttype SupervisorHandle,\n\ttype SupervisorPostAcquireHook,\n} from './supervisor.ts';\n\n/** Substrate Layer stack for a single supervised run. Composes every L0\n * service the supervisor yields from its R-channel, plus the L1 Docker\n * `ContainerRuntime`. Built-in plugin services are layered outside\n * substrate and added through `extendContext`. */\nexport const buildSubstrateLayers = (identity: Identity, runtimeRoot: string) => {\n\t// DockerSpawner adapts platform-node's ChildProcessSpawner tag onto\n\t// the docker subsystem's local DockerSpawner tag (same shape; the\n\t// indirection only lets tests inject a stub).\n\tconst layerDockerSpawnerFromNode: Layer.Layer<DockerSpawner, never, ChildProcessSpawner> =\n\t\tLayer.effect(\n\t\t\tDockerSpawner,\n\t\t\tEffect.gen(function* () {\n\t\t\t\treturn yield* ChildProcessSpawner;\n\t\t\t}),\n\t\t);\n\n\tconst platformBase = Layer.mergeAll(\n\t\tlayerIdentity(identity),\n\t\tlayerRuntimeRoot(runtimeRoot),\n\t\tNodePath.layer,\n\t\tNodeFileSystem.layer,\n\t\tlayerDockerHostDefault,\n\t\tlayerDockerCycleInitial,\n\t\tlayerStrategyRegistry,\n\t);\n\n\tconst childProcessSpawnerWired = NodeChildProcessSpawner.layer.pipe(\n\t\tLayer.provideMerge(platformBase),\n\t);\n\tconst withStackPaths = layerStackPaths.pipe(Layer.provideMerge(childProcessSpawnerWired));\n\tconst withCache = layerCache.pipe(Layer.provideMerge(withStackPaths));\n\tconst withArtifactPublisher = layerArtifactPublisher.pipe(Layer.provideMerge(withCache));\n\tconst withPortBroker = layerPortBroker.pipe(Layer.provideMerge(withArtifactPublisher));\n\tconst withLeaseBroker = layerLeaseBroker.pipe(Layer.provideMerge(withPortBroker));\n\tconst withSpawnerAdapter = layerDockerSpawnerFromNode.pipe(Layer.provideMerge(withLeaseBroker));\n\tconst withContainerRuntime = layerContainerRuntimeDocker.pipe(\n\t\tLayer.provideMerge(withSpawnerAdapter),\n\t);\n\tconst withPostAcquireTasks = layerPostAcquireTasks.pipe(Layer.provideMerge(withContainerRuntime));\n\tconst withRedactor = layerRedactor.pipe(Layer.provideMerge(withPostAcquireTasks));\n\treturn layerLogger.pipe(Layer.provideMerge(withRedactor));\n};\n\n/** Build the opaque `Context.Context<never>` the supervisor hands to\n * every plugin's `acquire` body. Yields every substrate service the\n * Docker-backed substrate layer stack provides; downstream callers\n * may extend the context (e.g. layering a Logger or a\n * `CapabilitySinksService`) before passing it to `supervise()`. */\nconst buildPluginContext = (): Effect.Effect<\n\tContext.Context<never>,\n\tnever,\n\t| IdentityContext\n\t| RuntimeRoot\n\t| StackPathsService\n\t| CacheService\n\t| StrategyRegistryService\n\t| ContainerRuntimeService\n\t| ArtifactPublisherService\n\t| PortBrokerService\n\t| LeaseBrokerService\n\t| PostAcquireTasksService\n\t| Logger\n\t| Redactor\n> =>\n\tEffect.gen(function* () {\n\t\tconst identityCtx = yield* IdentityContext;\n\t\tconst runtimeRootResolved = yield* RuntimeRoot;\n\t\tconst stackPaths = yield* StackPathsService;\n\t\tconst cache = yield* CacheService;\n\t\tconst registry = yield* StrategyRegistryService;\n\t\tconst containerRuntime = yield* ContainerRuntimeService;\n\t\tconst publisher = yield* ArtifactPublisherService;\n\t\tconst portBroker = yield* PortBrokerService;\n\t\tconst leaseBroker = yield* LeaseBrokerService;\n\t\tconst postAcquireTasks = yield* PostAcquireTasksService;\n\t\tconst logger = yield* Logger;\n\t\tconst redactor = yield* Redactor;\n\n\t\treturn Context.empty().pipe(\n\t\t\tContext.add(IdentityContext, identityCtx),\n\t\t\tContext.add(RuntimeRoot, runtimeRootResolved),\n\t\t\tContext.add(StackPathsService, stackPaths),\n\t\t\tContext.add(CacheService, cache),\n\t\t\tContext.add(StrategyRegistryService, registry),\n\t\t\tContext.add(ContainerRuntimeService, containerRuntime),\n\t\t\tContext.add(ArtifactPublisherService, publisher),\n\t\t\tContext.add(PortBrokerService, portBroker),\n\t\t\tContext.add(LeaseBrokerService, leaseBroker),\n\t\t\tContext.add(PostAcquireTasksService, postAcquireTasks),\n\t\t\tContext.add(Logger, logger),\n\t\t\tContext.add(Redactor, redactor),\n\t\t) as Context.Context<never>;\n\t});\n\n/** Options accepted by the supervised-run entrypoint. `lifetime`\n * selects long-running supervision versus a one-shot acquire/codegen\n * cycle. The `beforeInitialAcquire` hook runs inside the supervised\n * scope before the first acquire starts; live renderers use it to\n * subscribe to startup projection changes. The `withinScope` hook\n * runs after the first acquire completes.\n *\n * Generic `R` widens the hook R-channel so callers can yield\n * substrate services (e.g. `StackPathsService`) that are in scope at\n * the supervisor-boot site. */\nexport interface SuperviseStackOptions<R = Scope.Scope, ExtendR = never, HookE = never> {\n\treadonly lifetime?: 'long-running' | 'one-shot';\n\treadonly beforeInitialAcquire?: (handle: SupervisorHandle) => Effect.Effect<void, HookE, R>;\n\treadonly withinScope?: (handle: SupervisorHandle) => Effect.Effect<void, HookE, R>;\n\treadonly commandHandler?: SupervisorCommandHandler;\n\treadonly orchestratorSinks?: OrchestratorSinks;\n\treadonly postAcquireHook?: SupervisorPostAcquireHook;\n\t/** Caller-supplied extension layered into `pluginContext` after the\n\t * default substrate context is built. Used by plugin-author Layer\n\t * composition (ARCHITECTURE.md § Plugin-author extension) and by\n\t * the CLI when it wants to inject a custom Logger / CapabilitySinks\n\t * override. */\n\treadonly extendContext?: (\n\t\tctx: Context.Context<never>,\n\t) => Effect.Effect<Context.Context<never>, never, ExtendR>;\n}\n\n/** Effect that boots the supervisor for `stack` and blocks on the\n * supervisor's shutdown latch. Returns the final `SubscribableState`\n * snapshot so callers (CLI, library handle) can inspect post-shutdown\n * state. */\nexport const superviseStackEffect = <R = Scope.Scope, ExtendR = never, HookE = never>(\n\tstack: SupervisedStack,\n\tidentity: Identity,\n\tstate: SubscriptionRef.SubscriptionRef<import('../projection.ts').SubscribableState>,\n\topts: SuperviseStackOptions<R, ExtendR, HookE> = {},\n) =>\n\tEffect.gen(function* () {\n\t\tconst baseContext = yield* buildPluginContext();\n\t\tconst pluginContext =\n\t\t\topts.extendContext === undefined ? baseContext : yield* opts.extendContext(baseContext);\n\n\t\treturn yield* Effect.scoped(\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst startup = yield* startSupervisor(\n\t\t\t\t\tstack,\n\t\t\t\t\tidentity,\n\t\t\t\t\tstate,\n\t\t\t\t\tpluginContext,\n\t\t\t\t\topts.orchestratorSinks ?? [],\n\t\t\t\t\topts.commandHandler,\n\t\t\t\t\topts.postAcquireHook,\n\t\t\t\t\t{ commandLoop: opts.lifetime !== 'one-shot' },\n\t\t\t\t);\n\t\t\t\tconst { handle } = startup;\n\t\t\t\tif (opts.beforeInitialAcquire !== undefined) {\n\t\t\t\t\tyield* opts.beforeInitialAcquire(handle);\n\t\t\t\t}\n\t\t\t\tif (opts.lifetime === 'one-shot') {\n\t\t\t\t\tyield* startup.runInitialAcquire;\n\t\t\t\t\tyield* awaitAll(startup.handle.registry, [...startup.handle.graph.nodes.keys()]);\n\t\t\t\t\tif (opts.withinScope !== undefined) {\n\t\t\t\t\t\tyield* opts.withinScope(handle);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst outcome = yield* Effect.raceFirst(\n\t\t\t\t\tstartup.runInitialAcquire.pipe(Effect.as('booted' as const)),\n\t\t\t\t\thandle.awaitShutdown.pipe(Effect.as('shutdown' as const)),\n\t\t\t\t);\n\t\t\t\tif (outcome === 'shutdown') {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (opts.withinScope !== undefined) {\n\t\t\t\t\tyield* opts.withinScope(handle);\n\t\t\t\t}\n\t\t\t\tyield* handle.awaitShutdown;\n\t\t\t}),\n\t\t);\n\t});\n\n/** End-to-end run: builds the substrate Layer stack, provides it to\n * `superviseStackEffect`, applies a quiet Logger by default unless the\n * caller passes one in `opts.loggerLayer`. The returned Effect has\n * type `Effect<void, ..., never>` — all requirements are discharged\n * by the layer stack composed here.\n *\n * Callers that need to capture intermediate state (errors, terminal\n * snapshot, etc.) supply `opts.withinScope` and read off the\n * supervisor handle directly. */\nexport interface RunStackEffectOptions<\n\tR = Scope.Scope,\n\tExtendR = never,\n\tHookE = never,\n> extends SuperviseStackOptions<R, ExtendR, HookE> {\n\treadonly runtimeRoot: string;\n\treadonly loggerLayer?: Layer.Layer<never>;\n}\n\nexport const runStackEffect = <R = Scope.Scope, ExtendR = never, HookE = never>(\n\tstack: SupervisedStack,\n\tidentity: Identity,\n\topts: RunStackEffectOptions<R, ExtendR, HookE>,\n) => {\n\tconst substrate = buildSubstrateLayers(identity, opts.runtimeRoot);\n\tconst program = Effect.gen(function* () {\n\t\tconst state = yield* makeProjectionRef();\n\t\tyield* superviseStackEffect(stack, identity, state, opts);\n\t});\n\n\treturn program.pipe(\n\t\tEffect.provide(substrate),\n\t\tEffect.provide(opts.loggerLayer ?? EffectLogger.layer([])),\n\t);\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
|
|
3
|
+
//#region src/substrate/runtime/runtime-decode.d.ts
|
|
4
|
+
declare namespace runtime_decode_d_exports {
|
|
5
|
+
export { DecodeOptions, JsonArrayElementDecodeOptions, RuntimeDecodeErrorFactory, RuntimeDecodeIssue, decodeJsonArrayElementSync, decodeJsonLines, decodeJsonText, decodeJsonTextSync, decodeUnknown, decodeUnknownSync, parseJsonText, parseJsonTextSync };
|
|
6
|
+
}
|
|
7
|
+
interface RuntimeDecodeIssue {
|
|
8
|
+
readonly source: string;
|
|
9
|
+
readonly message: string;
|
|
10
|
+
readonly cause?: unknown;
|
|
11
|
+
}
|
|
12
|
+
type RuntimeDecodeErrorFactory<E> = (issue: RuntimeDecodeIssue) => E;
|
|
13
|
+
interface DecodeOptions<E> {
|
|
14
|
+
readonly source: string;
|
|
15
|
+
readonly mkError: RuntimeDecodeErrorFactory<E>;
|
|
16
|
+
readonly message?: string;
|
|
17
|
+
}
|
|
18
|
+
interface JsonArrayElementDecodeOptions<E> extends DecodeOptions<E> {
|
|
19
|
+
readonly index?: number;
|
|
20
|
+
readonly missingMessage?: string;
|
|
21
|
+
}
|
|
22
|
+
declare const parseJsonText: <E>(text: string, options: DecodeOptions<E>) => Effect.Effect<unknown, E>;
|
|
23
|
+
declare const parseJsonTextSync: <E>(text: string, options: DecodeOptions<E>) => unknown;
|
|
24
|
+
declare const decodeUnknown: <S extends Schema.Decoder<unknown>, E>(schema: S, value: unknown, options: DecodeOptions<E>) => Effect.Effect<S["Type"], E>;
|
|
25
|
+
declare const decodeUnknownSync: <S extends Schema.Decoder<unknown>, E>(schema: S, value: unknown, options: DecodeOptions<E>) => S["Type"];
|
|
26
|
+
declare const decodeJsonText: <S extends Schema.Decoder<unknown>, E>(schema: S, text: string, options: DecodeOptions<E>) => Effect.Effect<S["Type"], E>;
|
|
27
|
+
declare const decodeJsonTextSync: <S extends Schema.Decoder<unknown>, E>(schema: S, text: string, options: DecodeOptions<E>) => S["Type"];
|
|
28
|
+
declare const decodeJsonArrayElementSync: <S extends Schema.Decoder<unknown>, E>(schema: S, text: string, options: JsonArrayElementDecodeOptions<E>) => S["Type"];
|
|
29
|
+
declare const decodeJsonLines: <S extends Schema.Decoder<unknown>, E>(schema: S, text: string, options: DecodeOptions<E>) => Effect.Effect<ReadonlyArray<S["Type"]>, E>;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { runtime_decode_d_exports };
|
|
32
|
+
//# sourceMappingURL=runtime-decode.d.mts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { Effect, Schema } from "effect";
|
|
3
|
+
//#region src/substrate/runtime/runtime-decode.ts
|
|
4
|
+
var runtime_decode_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
decodeJsonArrayElementSync: () => decodeJsonArrayElementSync,
|
|
6
|
+
decodeJsonLines: () => decodeJsonLines,
|
|
7
|
+
decodeJsonText: () => decodeJsonText,
|
|
8
|
+
decodeJsonTextSync: () => decodeJsonTextSync,
|
|
9
|
+
decodeUnknown: () => decodeUnknown,
|
|
10
|
+
decodeUnknownSync: () => decodeUnknownSync,
|
|
11
|
+
parseJsonText: () => parseJsonText,
|
|
12
|
+
parseJsonTextSync: () => parseJsonTextSync
|
|
13
|
+
});
|
|
14
|
+
const issue = (options, message, cause) => ({
|
|
15
|
+
source: options.source,
|
|
16
|
+
message: options.message ?? message,
|
|
17
|
+
...cause === void 0 ? {} : { cause }
|
|
18
|
+
});
|
|
19
|
+
const parseJsonText = (text, options) => Effect.try({
|
|
20
|
+
try: () => JSON.parse(text),
|
|
21
|
+
catch: (cause) => options.mkError(issue(options, "failed to parse JSON", cause))
|
|
22
|
+
});
|
|
23
|
+
const parseJsonTextSync = (text, options) => {
|
|
24
|
+
try {
|
|
25
|
+
return JSON.parse(text);
|
|
26
|
+
} catch (cause) {
|
|
27
|
+
throw options.mkError(issue(options, "failed to parse JSON", cause));
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const decodeUnknown = (schema, value, options) => Schema.decodeUnknownEffect(schema)(value).pipe(Effect.mapError((cause) => options.mkError(issue(options, "failed to decode value", cause))));
|
|
31
|
+
const decodeUnknownSync = (schema, value, options) => {
|
|
32
|
+
try {
|
|
33
|
+
return Schema.decodeUnknownSync(schema)(value);
|
|
34
|
+
} catch (cause) {
|
|
35
|
+
throw options.mkError(issue(options, "failed to decode value", cause));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const decodeJsonText = (schema, text, options) => parseJsonText(text, options).pipe(Effect.flatMap((value) => decodeUnknown(schema, value, options)));
|
|
39
|
+
const decodeJsonTextSync = (schema, text, options) => decodeUnknownSync(schema, parseJsonTextSync(text, options), options);
|
|
40
|
+
const decodeJsonArrayElementSync = (schema, text, options) => {
|
|
41
|
+
const index = options.index ?? 0;
|
|
42
|
+
const value = parseJsonTextSync(text, options);
|
|
43
|
+
if (!Array.isArray(value) || value[index] === void 0) throw options.mkError(issue(options, options.missingMessage ?? `expected JSON array element at index ${index}`, value));
|
|
44
|
+
return decodeUnknownSync(schema, value[index], options);
|
|
45
|
+
};
|
|
46
|
+
const decodeJsonLines = (schema, text, options) => Effect.forEach(text.split(/\r?\n/u).map((line) => line.trim()).filter((line) => line.length > 0), (line, index) => decodeJsonText(schema, line, {
|
|
47
|
+
...options,
|
|
48
|
+
source: `${options.source}:${index + 1}`
|
|
49
|
+
}));
|
|
50
|
+
//#endregion
|
|
51
|
+
export { decodeJsonArrayElementSync, decodeJsonText, decodeJsonTextSync, decodeUnknown, decodeUnknownSync, parseJsonText, parseJsonTextSync, runtime_decode_exports };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=runtime-decode.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-decode.mjs","names":[],"sources":["../../../src/substrate/runtime/runtime-decode.ts"],"sourcesContent":["import { Effect, Schema } from 'effect';\n\nexport interface RuntimeDecodeIssue {\n\treadonly source: string;\n\treadonly message: string;\n\treadonly cause?: unknown;\n}\n\nexport type RuntimeDecodeErrorFactory<E> = (issue: RuntimeDecodeIssue) => E;\n\nexport interface DecodeOptions<E> {\n\treadonly source: string;\n\treadonly mkError: RuntimeDecodeErrorFactory<E>;\n\treadonly message?: string;\n}\n\nexport interface JsonArrayElementDecodeOptions<E> extends DecodeOptions<E> {\n\treadonly index?: number;\n\treadonly missingMessage?: string;\n}\n\nconst issue = <E>(\n\toptions: DecodeOptions<E>,\n\tmessage: string,\n\tcause?: unknown,\n): RuntimeDecodeIssue => ({\n\tsource: options.source,\n\tmessage: options.message ?? message,\n\t...(cause === undefined ? {} : { cause }),\n});\n\nexport const parseJsonText = <E>(\n\ttext: string,\n\toptions: DecodeOptions<E>,\n): Effect.Effect<unknown, E> =>\n\tEffect.try({\n\t\ttry: () => JSON.parse(text) as unknown,\n\t\tcatch: (cause) => options.mkError(issue(options, 'failed to parse JSON', cause)),\n\t});\n\nexport const parseJsonTextSync = <E>(text: string, options: DecodeOptions<E>): unknown => {\n\ttry {\n\t\treturn JSON.parse(text) as unknown;\n\t} catch (cause) {\n\t\tthrow options.mkError(issue(options, 'failed to parse JSON', cause));\n\t}\n};\n\nexport const decodeUnknown = <S extends Schema.Decoder<unknown>, E>(\n\tschema: S,\n\tvalue: unknown,\n\toptions: DecodeOptions<E>,\n): Effect.Effect<S['Type'], E> =>\n\tSchema.decodeUnknownEffect(schema)(value).pipe(\n\t\tEffect.mapError((cause) => options.mkError(issue(options, 'failed to decode value', cause))),\n\t);\n\nexport const decodeUnknownSync = <S extends Schema.Decoder<unknown>, E>(\n\tschema: S,\n\tvalue: unknown,\n\toptions: DecodeOptions<E>,\n): S['Type'] => {\n\ttry {\n\t\treturn Schema.decodeUnknownSync(schema)(value);\n\t} catch (cause) {\n\t\tthrow options.mkError(issue(options, 'failed to decode value', cause));\n\t}\n};\n\nexport const decodeJsonText = <S extends Schema.Decoder<unknown>, E>(\n\tschema: S,\n\ttext: string,\n\toptions: DecodeOptions<E>,\n): Effect.Effect<S['Type'], E> =>\n\tparseJsonText(text, options).pipe(\n\t\tEffect.flatMap((value) => decodeUnknown(schema, value, options)),\n\t);\n\nexport const decodeJsonTextSync = <S extends Schema.Decoder<unknown>, E>(\n\tschema: S,\n\ttext: string,\n\toptions: DecodeOptions<E>,\n): S['Type'] => decodeUnknownSync(schema, parseJsonTextSync(text, options), options);\n\nexport const decodeJsonArrayElementSync = <S extends Schema.Decoder<unknown>, E>(\n\tschema: S,\n\ttext: string,\n\toptions: JsonArrayElementDecodeOptions<E>,\n): S['Type'] => {\n\tconst index = options.index ?? 0;\n\tconst value = parseJsonTextSync(text, options);\n\tif (!Array.isArray(value) || value[index] === undefined) {\n\t\tthrow options.mkError(\n\t\t\tissue(\n\t\t\t\toptions,\n\t\t\t\toptions.missingMessage ?? `expected JSON array element at index ${index}`,\n\t\t\t\tvalue,\n\t\t\t),\n\t\t);\n\t}\n\treturn decodeUnknownSync(schema, value[index], options);\n};\n\nexport const decodeJsonLines = <S extends Schema.Decoder<unknown>, E>(\n\tschema: S,\n\ttext: string,\n\toptions: DecodeOptions<E>,\n): Effect.Effect<ReadonlyArray<S['Type']>, E> =>\n\tEffect.forEach(\n\t\ttext\n\t\t\t.split(/\\r?\\n/u)\n\t\t\t.map((line) => line.trim())\n\t\t\t.filter((line) => line.length > 0),\n\t\t(line, index) =>\n\t\t\tdecodeJsonText(schema, line, {\n\t\t\t\t...options,\n\t\t\t\tsource: `${options.source}:${index + 1}`,\n\t\t\t}),\n\t);\n"],"mappings":";;;;;;;;;;;;;AAqBA,MAAM,SACL,SACA,SACA,WACyB;CACzB,QAAQ,QAAQ;CAChB,SAAS,QAAQ,WAAW;CAC5B,GAAI,UAAU,KAAA,IAAY,EAAE,GAAG,EAAE,OAAO;CACxC;AAED,MAAa,iBACZ,MACA,YAEA,OAAO,IAAI;CACV,WAAW,KAAK,MAAM,KAAK;CAC3B,QAAQ,UAAU,QAAQ,QAAQ,MAAM,SAAS,wBAAwB,MAAM,CAAC;CAChF,CAAC;AAEH,MAAa,qBAAwB,MAAc,YAAuC;AACzF,KAAI;AACH,SAAO,KAAK,MAAM,KAAK;UACf,OAAO;AACf,QAAM,QAAQ,QAAQ,MAAM,SAAS,wBAAwB,MAAM,CAAC;;;AAItE,MAAa,iBACZ,QACA,OACA,YAEA,OAAO,oBAAoB,OAAO,CAAC,MAAM,CAAC,KACzC,OAAO,UAAU,UAAU,QAAQ,QAAQ,MAAM,SAAS,0BAA0B,MAAM,CAAC,CAAC,CAC5F;AAEF,MAAa,qBACZ,QACA,OACA,YACe;AACf,KAAI;AACH,SAAO,OAAO,kBAAkB,OAAO,CAAC,MAAM;UACtC,OAAO;AACf,QAAM,QAAQ,QAAQ,MAAM,SAAS,0BAA0B,MAAM,CAAC;;;AAIxE,MAAa,kBACZ,QACA,MACA,YAEA,cAAc,MAAM,QAAQ,CAAC,KAC5B,OAAO,SAAS,UAAU,cAAc,QAAQ,OAAO,QAAQ,CAAC,CAChE;AAEF,MAAa,sBACZ,QACA,MACA,YACe,kBAAkB,QAAQ,kBAAkB,MAAM,QAAQ,EAAE,QAAQ;AAEpF,MAAa,8BACZ,QACA,MACA,YACe;CACf,MAAM,QAAQ,QAAQ,SAAS;CAC/B,MAAM,QAAQ,kBAAkB,MAAM,QAAQ;AAC9C,KAAI,CAAC,MAAM,QAAQ,MAAM,IAAI,MAAM,WAAW,KAAA,EAC7C,OAAM,QAAQ,QACb,MACC,SACA,QAAQ,kBAAkB,wCAAwC,SAClE,MACA,CACD;AAEF,QAAO,kBAAkB,QAAQ,MAAM,QAAQ,QAAQ;;AAGxD,MAAa,mBACZ,QACA,MACA,YAEA,OAAO,QACN,KACE,MAAM,SAAS,CACf,KAAK,SAAS,KAAK,MAAM,CAAC,CAC1B,QAAQ,SAAS,KAAK,SAAS,EAAE,GAClC,MAAM,UACN,eAAe,QAAQ,MAAM;CAC5B,GAAG;CACH,QAAQ,GAAG,QAAQ,OAAO,GAAG,QAAQ;CACrC,CAAC,CACH"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { createServer } from "node:http";
|
|
3
|
+
//#region src/substrate/runtime/scoped-http-server.ts
|
|
4
|
+
/** Best-effort graceful close. `closeAllConnections()` drops idle
|
|
5
|
+
* keepalive sockets so `close()` resolves; older Node versions
|
|
6
|
+
* without `closeAllConnections` rely on `close()` alone. */
|
|
7
|
+
const gracefulCloseHttpServer = (server) => Effect.callback((resume) => {
|
|
8
|
+
try {
|
|
9
|
+
server.closeAllConnections();
|
|
10
|
+
} catch {}
|
|
11
|
+
server.close(() => resume(Effect.void));
|
|
12
|
+
});
|
|
13
|
+
const listenScopedHttpServer = (options) => Effect.gen(function* () {
|
|
14
|
+
const server = yield* Effect.tryPromise({
|
|
15
|
+
try: () => new Promise((resolve, reject) => {
|
|
16
|
+
const srv = createServer(options.listener);
|
|
17
|
+
const onError = (err) => reject(err);
|
|
18
|
+
srv.once("error", onError);
|
|
19
|
+
srv.listen(options.port, options.bindAddress, () => {
|
|
20
|
+
srv.removeListener("error", onError);
|
|
21
|
+
resolve(srv);
|
|
22
|
+
});
|
|
23
|
+
}),
|
|
24
|
+
catch: options.onListenError
|
|
25
|
+
});
|
|
26
|
+
yield* Effect.addFinalizer(() => gracefulCloseHttpServer(server).pipe(Effect.uninterruptible));
|
|
27
|
+
return {
|
|
28
|
+
url: `http://${options.bindAddress}:${options.port}`,
|
|
29
|
+
server,
|
|
30
|
+
close: () => gracefulCloseHttpServer(server)
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
//#endregion
|
|
34
|
+
export { listenScopedHttpServer };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=scoped-http-server.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scoped-http-server.mjs","names":[],"sources":["../../../src/substrate/runtime/scoped-http-server.ts"],"sourcesContent":["// Scoped host HTTP server primitive.\n//\n// Generic ownership for in-process host HTTP listeners: bind, surface\n// listen failures through a caller-owned error mapper, and install a\n// scope finalizer that drops idle keepalive sockets before awaiting\n// close. Domain routing stays with the plugin that supplies the\n// Node request listener.\n\nimport { Effect } from 'effect';\nimport type { Scope } from 'effect';\nimport { createServer, type IncomingMessage, type Server, type ServerResponse } from 'node:http';\n\nexport type HttpRequestListener = (req: IncomingMessage, res: ServerResponse) => void;\n\nexport interface ScopedHttpServerOptions<E> {\n\treadonly bindAddress: string;\n\treadonly port: number;\n\treadonly listener: HttpRequestListener;\n\treadonly onListenError: (cause: unknown) => E;\n}\n\nexport interface ScopedHttpServerHandle {\n\treadonly url: string;\n\treadonly server: Server;\n\treadonly close: () => Effect.Effect<void>;\n}\n\n/** Best-effort graceful close. `closeAllConnections()` drops idle\n * keepalive sockets so `close()` resolves; older Node versions\n * without `closeAllConnections` rely on `close()` alone. */\nexport const gracefulCloseHttpServer = (server: Server): Effect.Effect<void> =>\n\tEffect.callback<void>((resume) => {\n\t\ttry {\n\t\t\tserver.closeAllConnections();\n\t\t} catch {\n\t\t\t// Older Node versions don't expose closeAllConnections;\n\t\t\t// `close()` alone will still terminate.\n\t\t}\n\t\tserver.close(() => resume(Effect.void));\n\t});\n\nexport const listenScopedHttpServer = <E>(\n\toptions: ScopedHttpServerOptions<E>,\n): Effect.Effect<ScopedHttpServerHandle, E, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tconst server = yield* Effect.tryPromise({\n\t\t\ttry: () =>\n\t\t\t\tnew Promise<Server>((resolve, reject) => {\n\t\t\t\t\tconst srv = createServer(options.listener);\n\t\t\t\t\tconst onError = (err: Error) => reject(err);\n\t\t\t\t\tsrv.once('error', onError);\n\t\t\t\t\tsrv.listen(options.port, options.bindAddress, () => {\n\t\t\t\t\t\tsrv.removeListener('error', onError);\n\t\t\t\t\t\tresolve(srv);\n\t\t\t\t\t});\n\t\t\t\t}),\n\t\t\tcatch: options.onListenError,\n\t\t});\n\n\t\tyield* Effect.addFinalizer(() => gracefulCloseHttpServer(server).pipe(Effect.uninterruptible));\n\n\t\treturn {\n\t\t\turl: `http://${options.bindAddress}:${options.port}`,\n\t\t\tserver,\n\t\t\tclose: () => gracefulCloseHttpServer(server),\n\t\t};\n\t});\n"],"mappings":";;;;;;AA8BA,MAAa,2BAA2B,WACvC,OAAO,UAAgB,WAAW;AACjC,KAAI;AACH,SAAO,qBAAqB;SACrB;AAIR,QAAO,YAAY,OAAO,OAAO,KAAK,CAAC;EACtC;AAEH,MAAa,0BACZ,YAEA,OAAO,IAAI,aAAa;CACvB,MAAM,SAAS,OAAO,OAAO,WAAW;EACvC,WACC,IAAI,SAAiB,SAAS,WAAW;GACxC,MAAM,MAAM,aAAa,QAAQ,SAAS;GAC1C,MAAM,WAAW,QAAe,OAAO,IAAI;AAC3C,OAAI,KAAK,SAAS,QAAQ;AAC1B,OAAI,OAAO,QAAQ,MAAM,QAAQ,mBAAmB;AACnD,QAAI,eAAe,SAAS,QAAQ;AACpC,YAAQ,IAAI;KACX;IACD;EACH,OAAO,QAAQ;EACf,CAAC;AAEF,QAAO,OAAO,mBAAmB,wBAAwB,OAAO,CAAC,KAAK,OAAO,gBAAgB,CAAC;AAE9F,QAAO;EACN,KAAK,UAAU,QAAQ,YAAY,GAAG,QAAQ;EAC9C;EACA,aAAa,wBAAwB,OAAO;EAC5C;EACA"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Context, Effect, Layer, Schema, SubscriptionRef } from "effect";
|
|
2
|
+
//#region src/substrate/runtime/scoped-ref-map/service.ts
|
|
3
|
+
/** Lookup failure for a missing key. Schema-tagged so consumers
|
|
4
|
+
* may `Effect.catchTag('ScopedRefMapKeyMissingError', ...)` and
|
|
5
|
+
* the cascade-formatter can render it without importing the class. */
|
|
6
|
+
var ScopedRefMapKeyMissingError = class extends Schema.TaggedErrorClass()("ScopedRefMapKeyMissingError", {
|
|
7
|
+
registryName: Schema.String,
|
|
8
|
+
key: Schema.String
|
|
9
|
+
}) {};
|
|
10
|
+
/**
|
|
11
|
+
* Factory: declare a typed `K -> V` scoped ref-map service.
|
|
12
|
+
*
|
|
13
|
+
* The `name` becomes both the human-readable registry name (used
|
|
14
|
+
* in `ScopedRefMapKeyMissingError.registryName`) and the
|
|
15
|
+
* Context.Service identifier (prefixed with the substrate
|
|
16
|
+
* namespace). Each call returns a fresh Service class; calling
|
|
17
|
+
* twice with the same name produces two distinct services
|
|
18
|
+
* (Context.Service identity is per-class, not per-id-string —
|
|
19
|
+
* the id string is a debugging aid).
|
|
20
|
+
*
|
|
21
|
+
* Return shape — typed via inference so the inner Service class's
|
|
22
|
+
* identity flows through to callers:
|
|
23
|
+
* - `Service` — the `Context.Service` tag class. Plugin authors
|
|
24
|
+
* yield this from their `acquire` body via `yield* MyRegistry.Service`.
|
|
25
|
+
* - `layer` — scope-bound Layer constructing one ref-map per
|
|
26
|
+
* stack scope.
|
|
27
|
+
* - `changes` — stream helper mirroring `routesStream(router)`.
|
|
28
|
+
*
|
|
29
|
+
* Example (in an L2 plugin):
|
|
30
|
+
*
|
|
31
|
+
* ```ts
|
|
32
|
+
* const PackageRegistry = defineScopedRefMap<PackageKey, PackageRecord>('PackageRegistry');
|
|
33
|
+
*
|
|
34
|
+
* // In the plugin's acquire body:
|
|
35
|
+
* const registry = yield* PackageRegistry.Service;
|
|
36
|
+
* yield* registry.set(name, resolved);
|
|
37
|
+
*
|
|
38
|
+
* // In the boot Layer:
|
|
39
|
+
* Layer.mergeAll(PackageRegistry.layer, ...)
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
const defineScopedRefMap = (name) => {
|
|
43
|
+
const serviceId = `@devstack-rewrite/substrate/ScopedRefMap/${name}`;
|
|
44
|
+
class Service extends Context.Service()(serviceId) {}
|
|
45
|
+
const layer = Layer.effect(Service, Effect.gen(function* () {
|
|
46
|
+
const ref = yield* SubscriptionRef.make([]);
|
|
47
|
+
const set = (key, value) => SubscriptionRef.update(ref, (current) => {
|
|
48
|
+
return [...current.filter(([k]) => k !== key), [key, value]];
|
|
49
|
+
});
|
|
50
|
+
const find = (key) => SubscriptionRef.get(ref).pipe(Effect.map((current) => {
|
|
51
|
+
const hit = current.find(([k]) => k === key);
|
|
52
|
+
return hit ? hit[1] : null;
|
|
53
|
+
}));
|
|
54
|
+
const get = (key) => Effect.gen(function* () {
|
|
55
|
+
const value = yield* find(key);
|
|
56
|
+
if (value === null) return yield* new ScopedRefMapKeyMissingError({
|
|
57
|
+
registryName: name,
|
|
58
|
+
key
|
|
59
|
+
});
|
|
60
|
+
return value;
|
|
61
|
+
});
|
|
62
|
+
const has = (key) => SubscriptionRef.get(ref).pipe(Effect.map((current) => current.some(([k]) => k === key)));
|
|
63
|
+
const entries = () => SubscriptionRef.get(ref);
|
|
64
|
+
return Service.of({
|
|
65
|
+
set,
|
|
66
|
+
get,
|
|
67
|
+
find,
|
|
68
|
+
has,
|
|
69
|
+
entries,
|
|
70
|
+
changes: SubscriptionRef.changes(ref)
|
|
71
|
+
});
|
|
72
|
+
}));
|
|
73
|
+
const changes = (svc) => svc.changes;
|
|
74
|
+
return {
|
|
75
|
+
Service,
|
|
76
|
+
layer,
|
|
77
|
+
changes
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
//#endregion
|
|
81
|
+
export { defineScopedRefMap };
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=service.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.mjs","names":[],"sources":["../../../../src/substrate/runtime/scoped-ref-map/service.ts"],"sourcesContent":["// Generic scoped Ref-Map registry primitive.\n//\n// Architecture (ARCHITECTURE.md § Substrate primitives roster /\n// § Substrate name-blindness): a name-blind, per-stack-scoped\n// in-memory `K -> V` lookup table. Substrate exposes ONLY the\n// generic primitive; L2 plugins (Sui-coin, Move-package, future\n// chain plugins) instantiate it with their domain-specific\n// `K` and `V` shapes to author their own typed Context.Service.\n//\n// Why the factory `defineScopedRefMap<K, V>(name)` shape rather\n// than a single `ScopedRefMapService` tag:\n//\n// - One service per plugin domain — `PackageRegistry`,\n// `CoinRegistry`, etc. — gives each plugin its own typed\n// tag instead of every consumer reaching into a single map\n// and narrowing.\n// - Substrate stays name-blind: it doesn't know `coin` or\n// `package`; it only knows \"give me a Layer + Service for\n// `<K, V>`\". The plugin chooses the name.\n// - The substrate Service-class identity is the namespace —\n// two `defineScopedRefMap('Foo')` and `defineScopedRefMap('Bar')`\n// calls return distinct services that can coexist in the\n// same scope.\n//\n// Lifetime: each instantiated service is materialized by a\n// Layer that lives for the stack scope. When the scope closes,\n// the in-memory `SubscriptionRef` drops with it — the ref is\n// closure-private to the Layer's build effect, so the GC\n// reclaims it once no subscribers hold the stream.\n\nimport { Context, Effect, Layer, Schema, Stream, SubscriptionRef } from 'effect';\n\n/** Lookup failure for a missing key. Schema-tagged so consumers\n * may `Effect.catchTag('ScopedRefMapKeyMissingError', ...)` and\n * the cascade-formatter can render it without importing the class. */\nexport class ScopedRefMapKeyMissingError extends Schema.TaggedErrorClass<ScopedRefMapKeyMissingError>()(\n\t'ScopedRefMapKeyMissingError',\n\t{\n\t\tregistryName: Schema.String,\n\t\tkey: Schema.String,\n\t},\n) {}\n\n/** Operations on a scoped `K -> V` ref-map. Generic over `K`\n * (constrained to `string`-shaped brands so it can be used as\n * a Map key) and `V` (fully opaque to substrate). */\nexport interface ScopedRefMap<K extends string, V> {\n\t/** Insert / overwrite. Last-write-wins on `K`. */\n\treadonly set: (key: K, value: V) => Effect.Effect<void>;\n\t/** Strict lookup. Fails with `ScopedRefMapKeyMissingError`\n\t * when the key isn't present. */\n\treadonly get: (key: K) => Effect.Effect<V, ScopedRefMapKeyMissingError>;\n\t/** Non-failing lookup — `null` when absent. */\n\treadonly find: (key: K) => Effect.Effect<V | null>;\n\t/** Presence check without an error projection. */\n\treadonly has: (key: K) => Effect.Effect<boolean>;\n\t/** Snapshot of all `(key, value)` pairs. Iteration order is\n\t * insertion order. */\n\treadonly entries: () => Effect.Effect<ReadonlyArray<readonly [K, V]>>;\n\t/** Stream of full-snapshot states. Each emission is the\n\t * current `entries` array; consumers diff if they need\n\t * incremental updates. */\n\treadonly changes: Stream.Stream<ReadonlyArray<readonly [K, V]>>;\n}\n\n/**\n * Factory: declare a typed `K -> V` scoped ref-map service.\n *\n * The `name` becomes both the human-readable registry name (used\n * in `ScopedRefMapKeyMissingError.registryName`) and the\n * Context.Service identifier (prefixed with the substrate\n * namespace). Each call returns a fresh Service class; calling\n * twice with the same name produces two distinct services\n * (Context.Service identity is per-class, not per-id-string —\n * the id string is a debugging aid).\n *\n * Return shape — typed via inference so the inner Service class's\n * identity flows through to callers:\n * - `Service` — the `Context.Service` tag class. Plugin authors\n * yield this from their `acquire` body via `yield* MyRegistry.Service`.\n * - `layer` — scope-bound Layer constructing one ref-map per\n * stack scope.\n * - `changes` — stream helper mirroring `routesStream(router)`.\n *\n * Example (in an L2 plugin):\n *\n * ```ts\n * const PackageRegistry = defineScopedRefMap<PackageKey, PackageRecord>('PackageRegistry');\n *\n * // In the plugin's acquire body:\n * const registry = yield* PackageRegistry.Service;\n * yield* registry.set(name, resolved);\n *\n * // In the boot Layer:\n * Layer.mergeAll(PackageRegistry.layer, ...)\n * ```\n */\nexport const defineScopedRefMap = <K extends string, V>(name: string) => {\n\tconst serviceId = `@devstack-rewrite/substrate/ScopedRefMap/${name}`;\n\n\tclass Service extends Context.Service<Service, ScopedRefMap<K, V>>()(serviceId) {}\n\n\tconst layer: Layer.Layer<Service> = Layer.effect(\n\t\tService,\n\t\tEffect.gen(function* () {\n\t\t\tconst ref = yield* SubscriptionRef.make<ReadonlyArray<readonly [K, V]>>([]);\n\n\t\t\tconst set: ScopedRefMap<K, V>['set'] = (key, value) =>\n\t\t\t\tSubscriptionRef.update(ref, (current) => {\n\t\t\t\t\tconst filtered = current.filter(([k]) => k !== key);\n\t\t\t\t\treturn [...filtered, [key, value] as const];\n\t\t\t\t});\n\n\t\t\tconst find: ScopedRefMap<K, V>['find'] = (key) =>\n\t\t\t\tSubscriptionRef.get(ref).pipe(\n\t\t\t\t\tEffect.map((current) => {\n\t\t\t\t\t\tconst hit = current.find(([k]) => k === key);\n\t\t\t\t\t\treturn hit ? hit[1] : null;\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\tconst get: ScopedRefMap<K, V>['get'] = (key) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst value = yield* find(key);\n\t\t\t\t\tif (value === null) {\n\t\t\t\t\t\treturn yield* new ScopedRefMapKeyMissingError({\n\t\t\t\t\t\t\tregistryName: name,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\treturn value;\n\t\t\t\t});\n\n\t\t\tconst has: ScopedRefMap<K, V>['has'] = (key) =>\n\t\t\t\tSubscriptionRef.get(ref).pipe(Effect.map((current) => current.some(([k]) => k === key)));\n\n\t\t\tconst entries: ScopedRefMap<K, V>['entries'] = () => SubscriptionRef.get(ref);\n\n\t\t\treturn Service.of({\n\t\t\t\tset,\n\t\t\t\tget,\n\t\t\t\tfind,\n\t\t\t\thas,\n\t\t\t\tentries,\n\t\t\t\tchanges: SubscriptionRef.changes(ref),\n\t\t\t});\n\t\t}),\n\t);\n\n\tconst changes = (svc: ScopedRefMap<K, V>): Stream.Stream<ReadonlyArray<readonly [K, V]>> =>\n\t\tsvc.changes;\n\n\treturn {\n\t\tService,\n\t\tlayer,\n\t\tchanges,\n\t} as const;\n};\n"],"mappings":";;;;;AAmCA,IAAa,8BAAb,cAAiD,OAAO,kBAA+C,CACtG,+BACA;CACC,cAAc,OAAO;CACrB,KAAK,OAAO;CACZ,CACD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDF,MAAa,sBAA2C,SAAiB;CACxE,MAAM,YAAY,4CAA4C;CAE9D,MAAM,gBAAgB,QAAQ,SAAsC,CAAC,UAAU,CAAC;CAEhF,MAAM,QAA8B,MAAM,OACzC,SACA,OAAO,IAAI,aAAa;EACvB,MAAM,MAAM,OAAO,gBAAgB,KAAqC,EAAE,CAAC;EAE3E,MAAM,OAAkC,KAAK,UAC5C,gBAAgB,OAAO,MAAM,YAAY;AAExC,UAAO,CAAC,GADS,QAAQ,QAAQ,CAAC,OAAO,MAAM,IAC5B,EAAE,CAAC,KAAK,MAAM,CAAU;IAC1C;EAEH,MAAM,QAAoC,QACzC,gBAAgB,IAAI,IAAI,CAAC,KACxB,OAAO,KAAK,YAAY;GACvB,MAAM,MAAM,QAAQ,MAAM,CAAC,OAAO,MAAM,IAAI;AAC5C,UAAO,MAAM,IAAI,KAAK;IACrB,CACF;EAEF,MAAM,OAAkC,QACvC,OAAO,IAAI,aAAa;GACvB,MAAM,QAAQ,OAAO,KAAK,IAAI;AAC9B,OAAI,UAAU,KACb,QAAO,OAAO,IAAI,4BAA4B;IAC7C,cAAc;IACd;IACA,CAAC;AAEH,UAAO;IACN;EAEH,MAAM,OAAkC,QACvC,gBAAgB,IAAI,IAAI,CAAC,KAAK,OAAO,KAAK,YAAY,QAAQ,MAAM,CAAC,OAAO,MAAM,IAAI,CAAC,CAAC;EAEzF,MAAM,gBAA+C,gBAAgB,IAAI,IAAI;AAE7E,SAAO,QAAQ,GAAG;GACjB;GACA;GACA;GACA;GACA;GACA,SAAS,gBAAgB,QAAQ,IAAI;GACrC,CAAC;GACD,CACF;CAED,MAAM,WAAW,QAChB,IAAI;AAEL,QAAO;EACN;EACA;EACA;EACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Effect, FileSystem, Schema } from "effect";
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { SpanAttr } from "../observability/spans.mjs";
|
|
2
|
+
import { acquireStackLock } from "../cross-process/stack-lock.mjs";
|
|
3
|
+
import { Effect, FileSystem, Schema } from "effect";
|
|
4
|
+
import { dirname, isAbsolute, join, normalize, sep } from "node:path";
|
|
5
|
+
//#region src/substrate/runtime/stage-and-swap/index.ts
|
|
6
|
+
/** Tagged failure during a stage-and-swap step. `stage` discriminates
|
|
7
|
+
* the precise failing step; the caller's underlying tag is preserved
|
|
8
|
+
* via `cause` (the primitive does NOT wrap the user's error). */
|
|
9
|
+
var StageAndSwapError = class extends Schema.TaggedErrorClass()("StageAndSwapError", {
|
|
10
|
+
stage: Schema.Literals([
|
|
11
|
+
"mkdir-staging",
|
|
12
|
+
"mkdir-backup",
|
|
13
|
+
"build",
|
|
14
|
+
"acquire-publish-lock",
|
|
15
|
+
"backup-current",
|
|
16
|
+
"preserve-target-paths",
|
|
17
|
+
"rename-into-target",
|
|
18
|
+
"restore-backup",
|
|
19
|
+
"cleanup-staging",
|
|
20
|
+
"cross-filesystem-fallback"
|
|
21
|
+
]),
|
|
22
|
+
targetPath: Schema.String,
|
|
23
|
+
stagingPath: Schema.String,
|
|
24
|
+
cause: Schema.optional(Schema.Defect)
|
|
25
|
+
}) {};
|
|
26
|
+
const failStage = (stage, targetPath, stagingPath) => (cause) => Effect.fail(new StageAndSwapError({
|
|
27
|
+
stage,
|
|
28
|
+
targetPath,
|
|
29
|
+
stagingPath,
|
|
30
|
+
cause
|
|
31
|
+
}));
|
|
32
|
+
const normalizePreservedRelativePath = (relativePath) => {
|
|
33
|
+
const normalized = normalize(relativePath);
|
|
34
|
+
if (relativePath.length === 0 || isAbsolute(relativePath) || normalized === "." || normalized === ".." || normalized.startsWith(`..${sep}`)) return null;
|
|
35
|
+
return normalized;
|
|
36
|
+
};
|
|
37
|
+
const preserveTargetPaths = (args) => Effect.gen(function* () {
|
|
38
|
+
const fs = yield* FileSystem.FileSystem;
|
|
39
|
+
for (const preserved of args.preservedPaths) {
|
|
40
|
+
const relativePath = normalizePreservedRelativePath(preserved.relativePath);
|
|
41
|
+
if (relativePath === null) return yield* failStage("preserve-target-paths", args.targetPath, args.stagingPath)(/* @__PURE__ */ new Error(`unsafe preserved path: ${preserved.relativePath}`));
|
|
42
|
+
const source = join(args.backupPath, relativePath);
|
|
43
|
+
if (!(yield* fs.exists(source).pipe(Effect.catch(() => Effect.succeed(false))))) continue;
|
|
44
|
+
const target = join(args.stagingPath, relativePath);
|
|
45
|
+
yield* fs.makeDirectory(dirname(target), { recursive: true }).pipe(Effect.catch(failStage("preserve-target-paths", args.targetPath, args.stagingPath)));
|
|
46
|
+
yield* fs.copy(source, target, { overwrite: true }).pipe(Effect.catch(failStage("preserve-target-paths", args.targetPath, args.stagingPath)));
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Build-then-swap. `build` is a user effect that populates `stagingPath`;
|
|
51
|
+
* on success the helper:
|
|
52
|
+
*
|
|
53
|
+
* - backs up the current `targetPath` (if any) to `<targetPath>.bak.<pid>`,
|
|
54
|
+
* - copies any selected `preserveFromTarget` paths from that backup
|
|
55
|
+
* into staging,
|
|
56
|
+
* - renames `stagingPath` → `targetPath`,
|
|
57
|
+
* - removes the backup.
|
|
58
|
+
*
|
|
59
|
+
* On any failure the helper removes `stagingPath` and, if the backup
|
|
60
|
+
* was taken, renames it back to `targetPath` so the world looks
|
|
61
|
+
* exactly as it did at entry.
|
|
62
|
+
*
|
|
63
|
+
* The build effect's error type passes through unchanged — the
|
|
64
|
+
* primitive returns `E | StageAndSwapError`. This is the
|
|
65
|
+
* "preserve the caller's error tag" rule from distilled §17.
|
|
66
|
+
*
|
|
67
|
+
* IMPORTANT: stagingPath MUST be on the same filesystem as
|
|
68
|
+
* targetPath. The helper picks it as a sibling under the same parent
|
|
69
|
+
* (caller passes `parentDir`, we mint the names) — this is enforced
|
|
70
|
+
* by the helper's signature shape.
|
|
71
|
+
*/
|
|
72
|
+
const stageAndSwap = (args) => Effect.gen(function* () {
|
|
73
|
+
const fs = yield* FileSystem.FileSystem;
|
|
74
|
+
const { targetPath, stagingPath, backupPath, build, preserveFromTarget = [], publishLockPath } = args;
|
|
75
|
+
yield* Effect.annotateCurrentSpan({
|
|
76
|
+
"devstack.stage-and-swap.target": targetPath,
|
|
77
|
+
"devstack.stage-and-swap.staging": stagingPath
|
|
78
|
+
});
|
|
79
|
+
yield* fs.remove(stagingPath, {
|
|
80
|
+
recursive: true,
|
|
81
|
+
force: true
|
|
82
|
+
}).pipe(Effect.ignore);
|
|
83
|
+
yield* fs.makeDirectory(stagingPath, { recursive: true }).pipe(Effect.catch(failStage("mkdir-staging", targetPath, stagingPath)));
|
|
84
|
+
const result = yield* build.pipe(Effect.onError(() => fs.remove(stagingPath, {
|
|
85
|
+
recursive: true,
|
|
86
|
+
force: true
|
|
87
|
+
}).pipe(Effect.ignore)));
|
|
88
|
+
if (yield* Effect.scoped(Effect.gen(function* () {
|
|
89
|
+
if (publishLockPath !== void 0) yield* acquireStackLock(publishLockPath).pipe(Effect.catch(failStage("acquire-publish-lock", targetPath, stagingPath)));
|
|
90
|
+
const targetExists = yield* fs.exists(targetPath).pipe(Effect.catch(() => Effect.succeed(false)));
|
|
91
|
+
if (targetExists) {
|
|
92
|
+
yield* fs.rename(targetPath, backupPath).pipe(Effect.catch(failStage("backup-current", targetPath, stagingPath)));
|
|
93
|
+
yield* preserveTargetPaths({
|
|
94
|
+
backupPath,
|
|
95
|
+
targetPath,
|
|
96
|
+
stagingPath,
|
|
97
|
+
preservedPaths: preserveFromTarget
|
|
98
|
+
}).pipe(Effect.catch((error) => Effect.gen(function* () {
|
|
99
|
+
yield* fs.rename(backupPath, targetPath).pipe(Effect.catch(failStage("restore-backup", targetPath, stagingPath)));
|
|
100
|
+
return yield* Effect.fail(error);
|
|
101
|
+
})));
|
|
102
|
+
}
|
|
103
|
+
yield* fs.rename(stagingPath, targetPath).pipe(Effect.catch((cause) => {
|
|
104
|
+
if (cause.code === "EXDEV") return Effect.gen(function* () {
|
|
105
|
+
yield* Effect.logWarning("stage-and-swap cross-filesystem fallback").pipe(Effect.annotateLogs({
|
|
106
|
+
[SpanAttr.stageAndSwapTargetPath]: targetPath,
|
|
107
|
+
[SpanAttr.stageAndSwapStagingPath]: stagingPath,
|
|
108
|
+
[SpanAttr.errorCode]: "EXDEV"
|
|
109
|
+
}));
|
|
110
|
+
yield* fs.copy(stagingPath, targetPath, { overwrite: false }).pipe(Effect.catch(failStage("cross-filesystem-fallback", targetPath, stagingPath)));
|
|
111
|
+
yield* fs.remove(stagingPath, {
|
|
112
|
+
recursive: true,
|
|
113
|
+
force: true
|
|
114
|
+
}).pipe(Effect.ignore);
|
|
115
|
+
});
|
|
116
|
+
return Effect.gen(function* () {
|
|
117
|
+
if (targetExists) yield* fs.rename(backupPath, targetPath).pipe(Effect.catch(failStage("restore-backup", targetPath, stagingPath)));
|
|
118
|
+
return yield* failStage("rename-into-target", targetPath, stagingPath)(cause);
|
|
119
|
+
});
|
|
120
|
+
}));
|
|
121
|
+
return targetExists;
|
|
122
|
+
}))) yield* fs.remove(backupPath, {
|
|
123
|
+
recursive: true,
|
|
124
|
+
force: true
|
|
125
|
+
}).pipe(Effect.ignore);
|
|
126
|
+
return result;
|
|
127
|
+
}).pipe(Effect.withSpan("substrate.stage-and-swap"));
|
|
128
|
+
//#endregion
|
|
129
|
+
export { stageAndSwap };
|
|
130
|
+
|
|
131
|
+
//# sourceMappingURL=index.mjs.map
|