@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,76 @@
|
|
|
1
|
+
import { parseJsonTextSync } from "../runtime-decode.mjs";
|
|
2
|
+
import { CacheService } from "../cache/service.mjs";
|
|
3
|
+
import { Context, Effect, Layer } from "effect";
|
|
4
|
+
//#region src/substrate/runtime/artifact-publisher/index.ts
|
|
5
|
+
/**
|
|
6
|
+
* Substrate-level service projecting the
|
|
7
|
+
* `ArtifactPublisher` primitive. Plugins yield this tag in
|
|
8
|
+
* their acquire body; the supervisor's `pluginContext` carries it.
|
|
9
|
+
*
|
|
10
|
+
* The service is constructed once per stack (Layer-driven) and
|
|
11
|
+
* closes over the per-stack Cache + StrategyRegistry. Parallel
|
|
12
|
+
* stacks isolate by construction — each stack's Layer build is
|
|
13
|
+
* independent.
|
|
14
|
+
*/
|
|
15
|
+
var ArtifactPublisherService = class extends Context.Service()("@devstack-rewrite/substrate/ArtifactPublisher") {};
|
|
16
|
+
const encode = (value) => new TextEncoder().encode(JSON.stringify(value));
|
|
17
|
+
const decode = (bytes) => {
|
|
18
|
+
try {
|
|
19
|
+
return parseJsonTextSync(new TextDecoder().decode(bytes), {
|
|
20
|
+
source: "artifact-publisher cache payload",
|
|
21
|
+
mkError: (issue) => issue
|
|
22
|
+
});
|
|
23
|
+
} catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const makePublisher = (cache) => ({ publish: (spec) => Effect.gen(function* () {
|
|
28
|
+
yield* Effect.annotateCurrentSpan({
|
|
29
|
+
"artifactPublisher.namespace": spec.namespace,
|
|
30
|
+
"artifactPublisher.chain": spec.chain,
|
|
31
|
+
"artifactPublisher.contentHash": spec.contentHash
|
|
32
|
+
});
|
|
33
|
+
const hit = yield* cache.lookup({
|
|
34
|
+
namespace: spec.namespace,
|
|
35
|
+
chain: spec.chain,
|
|
36
|
+
contentHash: spec.contentHash
|
|
37
|
+
}).pipe(Effect.catch(() => Effect.succeed(null)));
|
|
38
|
+
if (hit !== null) {
|
|
39
|
+
const cached = decode(hit.bytes);
|
|
40
|
+
if (cached !== null) {
|
|
41
|
+
if ((yield* spec.verify(cached)) !== null) {
|
|
42
|
+
const payload = cached;
|
|
43
|
+
yield* spec.register(payload);
|
|
44
|
+
yield* Effect.annotateCurrentSpan({ "artifactPublisher.path": "hit" });
|
|
45
|
+
return payload;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
yield* Effect.annotateCurrentSpan({ "artifactPublisher.path": hit === null ? "miss" : "verify-failed" });
|
|
50
|
+
const produced = yield* spec.produce;
|
|
51
|
+
yield* cache.write({
|
|
52
|
+
namespace: spec.namespace,
|
|
53
|
+
chain: spec.chain,
|
|
54
|
+
contentHash: spec.contentHash
|
|
55
|
+
}, encode(produced)).pipe(Effect.catch(() => Effect.void));
|
|
56
|
+
yield* spec.register(produced);
|
|
57
|
+
return produced;
|
|
58
|
+
}).pipe(Effect.withSpan("substrate.artifactPublisher.publish")) });
|
|
59
|
+
/**
|
|
60
|
+
* Layer that materializes the publisher from the substrate's
|
|
61
|
+
* Cache service. Plugins yield `ArtifactPublisherService`;
|
|
62
|
+
* the supervisor provides it via `pluginContext`.
|
|
63
|
+
*
|
|
64
|
+
* The publisher is service-name-blind: it reaches `CacheService`
|
|
65
|
+
* via the Context, NOT through a hard-coded import edge with any
|
|
66
|
+
* plugin. Chain-probe lookup is the caller's concern — the spec's
|
|
67
|
+
* `verify` Effect closes over the probe.
|
|
68
|
+
*/
|
|
69
|
+
const layerArtifactPublisher = Layer.effect(ArtifactPublisherService, Effect.gen(function* () {
|
|
70
|
+
const cache = yield* CacheService;
|
|
71
|
+
return ArtifactPublisherService.of(makePublisher(cache));
|
|
72
|
+
}));
|
|
73
|
+
//#endregion
|
|
74
|
+
export { ArtifactPublisherService, layerArtifactPublisher };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/substrate/runtime/artifact-publisher/index.ts"],"sourcesContent":["// ArtifactPublisher — substrate-level service.\n//\n// Architecture §10: substrate primitive that orchestrates the\n// `cache → verify → produce → register` cycle every on-chain\n// produce/verify plugin (package, coin, walrus deploy, seal deploy,\n// deepbook deploy, etc.) flows through.\n//\n// Plugins call `publisher.publish(spec)` with their per-cycle\n// `ArtifactSpec<Produced, Verified>` (namespace, chain,\n// contentHash, verifySchema, verify, produce, register). The\n// substrate handles:\n//\n// 1. `cache.lookup({namespace, chain, contentHash})`. Hit AND\n// `spec.verify` returns a non-null value → `register`(decoded\n// cached payload) and return.\n// 2. Miss OR verify-returned-null → run `spec.produce` under the\n// caller's Scope; on success, write the produced payload to\n// the cache (best-effort, errors logged but not propagated);\n// then `register(produced)`.\n//\n// The substrate carries the cache + chain-probe seams via Layers\n// (CacheService, StrategyRegistryService). Plugins yield this\n// service from their acquire body; the supervisor injects it via\n// pluginContext.\n//\n// Cache payload codec: we serialize `Produced` as JSON. The artifact publisher\n// spec doesn't bake a codec in (`Produced` is generic); JSON\n// round-trip matches existing plugin call sites\n// (`CachedPackageEntry`, `CachedMint`, etc. are JSON-shaped).\n\nimport { Context, Effect, Layer, Scope } from 'effect';\n\nimport type {\n\tArtifactPublishError,\n\tArtifactPublisher,\n\tArtifactSpec,\n} from '../../../primitives/artifact-publisher.ts';\nimport { CacheService } from '../cache/index.ts';\nimport { parseJsonTextSync } from '../runtime-decode.ts';\n\n// Re-export the ChainOperation typed seam — plugin authors compose\n// produce bodies via `compileChainOperation({...})` rather than\n// hand-rolling the `Effect<Produced, ArtifactPublishError, Scope>`.\n//\n// `ResolvedSigner` is intentionally NOT re-exported here — it is\n// owned by `sui-execute/` and reached via that module's barrel; both\n// modules share the single canonical shape.\nexport {\n\tcompileChainOperation,\n\ttype ChainOperation,\n\ttype OneShotRunner,\n\ttype OneShotSpec,\n\ttype SuiEffects,\n\ttype SuiTxBuilder,\n} from './chain-operation.ts';\n\n// ---------------------------------------------------------------------------\n// Service tag\n// ---------------------------------------------------------------------------\n\n/**\n * Substrate-level service projecting the\n * `ArtifactPublisher` primitive. Plugins yield this tag in\n * their acquire body; the supervisor's `pluginContext` carries it.\n *\n * The service is constructed once per stack (Layer-driven) and\n * closes over the per-stack Cache + StrategyRegistry. Parallel\n * stacks isolate by construction — each stack's Layer build is\n * independent.\n */\nexport class ArtifactPublisherService extends Context.Service<\n\tArtifactPublisherService,\n\tArtifactPublisher\n>()('@devstack-rewrite/substrate/ArtifactPublisher') {}\n\n// ---------------------------------------------------------------------------\n// Encode / decode the cached payload\n// ---------------------------------------------------------------------------\n\nconst encode = (value: unknown): Uint8Array => new TextEncoder().encode(JSON.stringify(value));\n\nconst decode = <Produced>(bytes: Uint8Array): Produced | null => {\n\ttry {\n\t\treturn parseJsonTextSync(new TextDecoder().decode(bytes), {\n\t\t\tsource: 'artifact-publisher cache payload',\n\t\t\tmkError: (issue) => issue,\n\t\t}) as Produced;\n\t} catch {\n\t\treturn null;\n\t}\n};\n\n// ---------------------------------------------------------------------------\n// Publish: cache → verify → produce → register\n// ---------------------------------------------------------------------------\n\nconst makePublisher = (cache: typeof CacheService.Service): ArtifactPublisher => ({\n\tpublish: <Produced, Verified>(\n\t\tspec: ArtifactSpec<Produced, Verified>,\n\t): Effect.Effect<Produced | Verified, ArtifactPublishError, Scope.Scope> =>\n\t\tEffect.gen(function* () {\n\t\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t\t'artifactPublisher.namespace': spec.namespace,\n\t\t\t\t'artifactPublisher.chain': spec.chain,\n\t\t\t\t'artifactPublisher.contentHash': spec.contentHash,\n\t\t\t});\n\n\t\t\t// 1. Cache lookup. Best-effort: a CacheError on lookup\n\t\t\t// surfaces as `cache-corrupt`; the substrate's contract\n\t\t\t// is \"re-produce is always safe\", so we coerce read\n\t\t\t// failures to a miss rather than abort the cycle.\n\t\t\tconst hit = yield* cache\n\t\t\t\t.lookup({\n\t\t\t\t\tnamespace: spec.namespace,\n\t\t\t\t\tchain: spec.chain,\n\t\t\t\t\tcontentHash: spec.contentHash,\n\t\t\t\t})\n\t\t\t\t.pipe(Effect.catch(() => Effect.succeed(null)));\n\n\t\t\tif (hit !== null) {\n\t\t\t\t// Decode the cached `Produced` BEFORE verify so the\n\t\t\t\t// plugin's verify Effect can key its on-chain probe\n\t\t\t\t// off a field of the cached payload (e.g. action's\n\t\t\t\t// `digest`, package's `packageId`). A decode failure\n\t\t\t\t// here is \"cache corruption\" — drop through to\n\t\t\t\t// re-produce so the cycle is still safe.\n\t\t\t\tconst cached = decode<Produced>(hit.bytes);\n\t\t\t\tif (cached !== null) {\n\t\t\t\t\t// 2. Verify (lenient — returns null on transient\n\t\t\t\t\t// failure or not-found). Architecture §10:\n\t\t\t\t\t// verify-on-hit covers chain-state drift.\n\t\t\t\t\tconst verified = yield* spec.verify(cached);\n\t\t\t\t\tif (verified !== null) {\n\t\t\t\t\t\tconst payload: Produced | Verified = cached;\n\t\t\t\t\t\tyield* spec.register(payload);\n\t\t\t\t\t\tyield* Effect.annotateCurrentSpan({ 'artifactPublisher.path': 'hit' });\n\t\t\t\t\t\treturn payload;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// 3. Miss or verify-failed → produce.\n\t\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t\t'artifactPublisher.path': hit === null ? 'miss' : 'verify-failed',\n\t\t\t});\n\t\t\tconst produced = yield* spec.produce;\n\n\t\t\t// 4. Cache write — best-effort. Architecture: a write\n\t\t\t// failure must NOT roll back the on-chain effect.\n\t\t\tyield* cache\n\t\t\t\t.write(\n\t\t\t\t\t{\n\t\t\t\t\t\tnamespace: spec.namespace,\n\t\t\t\t\t\tchain: spec.chain,\n\t\t\t\t\t\tcontentHash: spec.contentHash,\n\t\t\t\t\t},\n\t\t\t\t\tencode(produced),\n\t\t\t\t)\n\t\t\t\t.pipe(Effect.catch(() => Effect.void));\n\n\t\t\t// 5. Register — fires on EVERY cycle (architecture §10).\n\t\t\tyield* spec.register(produced);\n\t\t\treturn produced;\n\t\t}).pipe(Effect.withSpan('substrate.artifactPublisher.publish')),\n});\n\n// ---------------------------------------------------------------------------\n// Layer\n// ---------------------------------------------------------------------------\n\n/**\n * Layer that materializes the publisher from the substrate's\n * Cache service. Plugins yield `ArtifactPublisherService`;\n * the supervisor provides it via `pluginContext`.\n *\n * The publisher is service-name-blind: it reaches `CacheService`\n * via the Context, NOT through a hard-coded import edge with any\n * plugin. Chain-probe lookup is the caller's concern — the spec's\n * `verify` Effect closes over the probe.\n */\nexport const layerArtifactPublisher: Layer.Layer<ArtifactPublisherService, never, CacheService> =\n\tLayer.effect(\n\t\tArtifactPublisherService,\n\t\tEffect.gen(function* () {\n\t\t\tconst cache = yield* CacheService;\n\t\t\treturn ArtifactPublisherService.of(makePublisher(cache));\n\t\t}),\n\t);\n"],"mappings":";;;;;;;;;;;;;;AAsEA,IAAa,2BAAb,cAA8C,QAAQ,SAGnD,CAAC,gDAAgD,CAAC;AAMrD,MAAM,UAAU,UAA+B,IAAI,aAAa,CAAC,OAAO,KAAK,UAAU,MAAM,CAAC;AAE9F,MAAM,UAAoB,UAAuC;AAChE,KAAI;AACH,SAAO,kBAAkB,IAAI,aAAa,CAAC,OAAO,MAAM,EAAE;GACzD,QAAQ;GACR,UAAU,UAAU;GACpB,CAAC;SACK;AACP,SAAO;;;AAQT,MAAM,iBAAiB,WAA2D,EACjF,UACC,SAEA,OAAO,IAAI,aAAa;AACvB,QAAO,OAAO,oBAAoB;EACjC,+BAA+B,KAAK;EACpC,2BAA2B,KAAK;EAChC,iCAAiC,KAAK;EACtC,CAAC;CAMF,MAAM,MAAM,OAAO,MACjB,OAAO;EACP,WAAW,KAAK;EAChB,OAAO,KAAK;EACZ,aAAa,KAAK;EAClB,CAAC,CACD,KAAK,OAAO,YAAY,OAAO,QAAQ,KAAK,CAAC,CAAC;AAEhD,KAAI,QAAQ,MAAM;EAOjB,MAAM,SAAS,OAAiB,IAAI,MAAM;AAC1C,MAAI,WAAW;QAKV,OADoB,KAAK,OAAO,OAAO,MAC1B,MAAM;IACtB,MAAM,UAA+B;AACrC,WAAO,KAAK,SAAS,QAAQ;AAC7B,WAAO,OAAO,oBAAoB,EAAE,0BAA0B,OAAO,CAAC;AACtE,WAAO;;;;AAMV,QAAO,OAAO,oBAAoB,EACjC,0BAA0B,QAAQ,OAAO,SAAS,iBAClD,CAAC;CACF,MAAM,WAAW,OAAO,KAAK;AAI7B,QAAO,MACL,MACA;EACC,WAAW,KAAK;EAChB,OAAO,KAAK;EACZ,aAAa,KAAK;EAClB,EACD,OAAO,SAAS,CAChB,CACA,KAAK,OAAO,YAAY,OAAO,KAAK,CAAC;AAGvC,QAAO,KAAK,SAAS,SAAS;AAC9B,QAAO;EACN,CAAC,KAAK,OAAO,SAAS,sCAAsC,CAAC,EAChE;;;;;;;;;;;AAgBD,MAAa,yBACZ,MAAM,OACL,0BACA,OAAO,IAAI,aAAa;CACvB,MAAM,QAAQ,OAAO;AACrB,QAAO,yBAAyB,GAAG,cAAc,MAAM,CAAC;EACvD,CACF"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { AtomicWriteFailed } from "./errors.mjs";
|
|
2
|
+
import { Effect, FileSystem, Schema } from "effect";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
import { closeSync, fsyncSync, mkdirSync, openSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
|
+
//#region src/substrate/runtime/atomic-write.ts
|
|
6
|
+
/** 8-hex tempfile suffix. `crypto.randomUUID()` is collision-safe under
|
|
7
|
+
* parallel callers within the same pid — replaces the
|
|
8
|
+
* `Math.random()`-based suffix flagged in STYLE_GUIDE §17. */
|
|
9
|
+
const tempSuffix = () => randomUUID().replace(/-/g, "").slice(0, 8);
|
|
10
|
+
const failStage = (path, stage) => (cause) => Effect.fail(new AtomicWriteFailed({
|
|
11
|
+
path,
|
|
12
|
+
stage,
|
|
13
|
+
cause
|
|
14
|
+
}));
|
|
15
|
+
/**
|
|
16
|
+
* Atomically write `bytes` to `path`. The helper ensures
|
|
17
|
+
* `dirname(path)` exists (recursive mkdir, idempotent).
|
|
18
|
+
*
|
|
19
|
+
* `mode` is the final file mode bits (default 0o600 — secret-safe
|
|
20
|
+
* default; cache callers may bump to 0o644 if they want world-read).
|
|
21
|
+
*/
|
|
22
|
+
const atomicWriteFile = (path, bytes, options = {}) => Effect.gen(function* () {
|
|
23
|
+
const fs = yield* FileSystem.FileSystem;
|
|
24
|
+
const mode = options.mode ?? 384;
|
|
25
|
+
const parentMode = options.parentMode ?? 448;
|
|
26
|
+
const tmp = `${path}.tmp.${process.pid}.${tempSuffix()}`;
|
|
27
|
+
yield* fs.makeDirectory(dirname(path), {
|
|
28
|
+
recursive: true,
|
|
29
|
+
mode: parentMode
|
|
30
|
+
}).pipe(Effect.catch(failStage(path, "mkdir-parent")));
|
|
31
|
+
yield* Effect.scoped(Effect.gen(function* () {
|
|
32
|
+
const file = yield* fs.open(tmp, {
|
|
33
|
+
flag: "wx",
|
|
34
|
+
mode
|
|
35
|
+
}).pipe(Effect.catch(failStage(path, "open-temp")));
|
|
36
|
+
yield* file.writeAll(bytes).pipe(Effect.catch(failStage(path, "write")));
|
|
37
|
+
yield* file.sync.pipe(Effect.catch(failStage(path, "fsync")));
|
|
38
|
+
}));
|
|
39
|
+
yield* fs.rename(tmp, path).pipe(Effect.catch((cause) => fs.remove(tmp, { force: true }).pipe(Effect.ignore, Effect.andThen(failStage(path, "rename")(cause)))));
|
|
40
|
+
}).pipe(Effect.withSpan("substrate.atomicWriteFile", { attributes: { path } }));
|
|
41
|
+
/**
|
|
42
|
+
* Atomically write a JSON value. Encodes via Schema (so the on-disk
|
|
43
|
+
* shape is the schema's `Encoded` form, not the rich `Type`). Caller
|
|
44
|
+
* supplies a schema whose `Type` matches `value`.
|
|
45
|
+
*/
|
|
46
|
+
const atomicWriteJson = (path, schema, value, options) => Effect.gen(function* () {
|
|
47
|
+
const encoded = yield* Schema.encodeUnknownEffect(schema)(value).pipe(Effect.catch(failStage(path, "encode")));
|
|
48
|
+
const json = JSON.stringify(encoded, null, 2);
|
|
49
|
+
yield* atomicWriteFile(path, new TextEncoder().encode(json), options);
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Synchronous atomic write. Same disk-side contract as
|
|
53
|
+
* `atomicWriteFile` (mkdir-parent → O_EXCL temp → write → fsync →
|
|
54
|
+
* rename). Returns `void` on success; throws on any failure with
|
|
55
|
+
* `cause` set to the underlying `NodeJS.ErrnoException`.
|
|
56
|
+
*
|
|
57
|
+
* Used inside `Effect.try` by the cross-process modules; the caller
|
|
58
|
+
* maps the thrown error to a typed plugin/runtime error
|
|
59
|
+
* (`RosterIoError` / `SnapshotReservationIoError` / etc.).
|
|
60
|
+
*/
|
|
61
|
+
const atomicWriteFileSync = (path, bytes, options = {}) => {
|
|
62
|
+
const mode = options.mode ?? 384;
|
|
63
|
+
const parentMode = options.parentMode ?? 448;
|
|
64
|
+
const tmp = `${path}.tmp.${process.pid}.${tempSuffix()}`;
|
|
65
|
+
mkdirSync(dirname(path), {
|
|
66
|
+
recursive: true,
|
|
67
|
+
mode: parentMode
|
|
68
|
+
});
|
|
69
|
+
writeFileSync(tmp, bytes, {
|
|
70
|
+
flag: "wx",
|
|
71
|
+
mode
|
|
72
|
+
});
|
|
73
|
+
let fd = null;
|
|
74
|
+
try {
|
|
75
|
+
fd = openSync(tmp, "r");
|
|
76
|
+
fsyncSync(fd);
|
|
77
|
+
} finally {
|
|
78
|
+
if (fd !== null) closeSync(fd);
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
renameSync(tmp, path);
|
|
82
|
+
} catch (cause) {
|
|
83
|
+
try {
|
|
84
|
+
unlinkSync(tmp);
|
|
85
|
+
} catch {}
|
|
86
|
+
throw cause;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Synchronous atomic JSON write. Stringifies `value` and routes
|
|
91
|
+
* through `atomicWriteFileSync`. No Schema encoding here — the
|
|
92
|
+
* cross-process modules round-trip plain JSON (their schemas are
|
|
93
|
+
* Schema.Struct of primitives; `JSON.stringify` is sufficient and
|
|
94
|
+
* keeps the sync path dependency-free of Effect's Schema effects).
|
|
95
|
+
*/
|
|
96
|
+
const atomicWriteJsonSync = (path, value, options) => {
|
|
97
|
+
atomicWriteFileSync(path, JSON.stringify(value), options);
|
|
98
|
+
};
|
|
99
|
+
const dirname = (p) => {
|
|
100
|
+
const i = p.lastIndexOf("/");
|
|
101
|
+
return i <= 0 ? "/" : p.slice(0, i);
|
|
102
|
+
};
|
|
103
|
+
//#endregion
|
|
104
|
+
export { atomicWriteFile, atomicWriteJson, atomicWriteJsonSync };
|
|
105
|
+
|
|
106
|
+
//# sourceMappingURL=atomic-write.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atomic-write.mjs","names":[],"sources":["../../../src/substrate/runtime/atomic-write.ts"],"sourcesContent":["// Atomic write primitive — ONE canonical implementation.\n//\n// Architecture § \"What's collapsed\" — three tempfile+rename impls\n// (atomic-write, state-store, global registry) collapse to one. This\n// is that one.\n//\n// Contract:\n// 1. Ensure parent directory exists.\n// 2. Open `<final>.tmp.<pid>.<rand>` with `wx` (O_EXCL) — refuse\n// to clobber a half-written sibling from a crashed earlier\n// writer in the same pid.\n// 3. Write bytes.\n// 4. `fsync` the file.\n// 5. Rename tempfile → final. Rename on POSIX is atomic w.r.t.\n// `open` of the final path.\n// 6. On any failure mid-flight, unlink the tempfile. Best-effort:\n// a tempfile-cleanup failure does NOT mask the original error.\n//\n// Two surfaces:\n// - `atomicWriteFile` / `atomicWriteJson` — Effect/FileSystem-based,\n// used by every async write site (manifest, state-store, cache).\n// - `atomicWriteFileSync` / `atomicWriteJsonSync` — node:fs-sync,\n// used by the cross-process modules (roster, snapshot-reservation,\n// stack-lock) that hold `stack.lock` and must keep their critical\n// section non-yielding. Substrate-fix-plan #11 tracks unifying\n// these onto Effect FS once we lift the cross-process modules off\n// `node:fs`; until then both surfaces share THIS file (and only\n// this file) so the tempfile dance has ONE owner.\n//\n// What we do NOT do here:\n// - fsync the parent directory. Linux's man fsync(2) suggests it\n// for full durability after rename(); the Effect platform layer\n// does not expose dir-fsync. Documented limitation — recoverable\n// on crash because the state-store rewrites on every change and\n// cache misses re-produce.\n\nimport {\n\tcloseSync,\n\tfsyncSync,\n\tmkdirSync,\n\topenSync,\n\trenameSync,\n\tunlinkSync,\n\twriteFileSync,\n} from 'node:fs';\nimport { randomUUID } from 'node:crypto';\n\nimport { Effect, FileSystem, Schema } from 'effect';\n\nimport { AtomicWriteFailed } from './errors.ts';\n\n/** 8-hex tempfile suffix. `crypto.randomUUID()` is collision-safe under\n * parallel callers within the same pid — replaces the\n * `Math.random()`-based suffix flagged in STYLE_GUIDE §17. */\nconst tempSuffix = (): string => randomUUID().replace(/-/g, '').slice(0, 8);\n\nconst failStage =\n\t(\n\t\tpath: string,\n\t\tstage: AtomicWriteFailed['stage'],\n\t): ((cause: unknown) => Effect.Effect<never, AtomicWriteFailed>) =>\n\t(cause) =>\n\t\tEffect.fail(new AtomicWriteFailed({ path, stage, cause }));\n\n/**\n * Atomically write `bytes` to `path`. The helper ensures\n * `dirname(path)` exists (recursive mkdir, idempotent).\n *\n * `mode` is the final file mode bits (default 0o600 — secret-safe\n * default; cache callers may bump to 0o644 if they want world-read).\n */\nexport const atomicWriteFile = (\n\tpath: string,\n\tbytes: Uint8Array,\n\toptions: { readonly mode?: number; readonly parentMode?: number } = {},\n): Effect.Effect<void, AtomicWriteFailed, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst mode = options.mode ?? 0o600;\n\t\tconst parentMode = options.parentMode ?? 0o700;\n\t\tconst tmp = `${path}.tmp.${process.pid}.${tempSuffix()}`;\n\t\t// 1. Ensure parent. recursive: true is idempotent under\n\t\t// concurrent callers — `mkdir -p` semantics.\n\t\tyield* fs\n\t\t\t.makeDirectory(dirname(path), { recursive: true, mode: parentMode })\n\t\t\t.pipe(Effect.catch(failStage(path, 'mkdir-parent')));\n\t\t// 2-4. Open tempfile with `wx` (O_EXCL), write, fsync, all\n\t\t// inside a Scope so the file handle closes on any path.\n\t\tyield* Effect.scoped(\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst file = yield* fs\n\t\t\t\t\t.open(tmp, { flag: 'wx', mode })\n\t\t\t\t\t.pipe(Effect.catch(failStage(path, 'open-temp')));\n\t\t\t\tyield* file.writeAll(bytes).pipe(Effect.catch(failStage(path, 'write')));\n\t\t\t\t// fsync — durability boundary. Without this the\n\t\t\t\t// rename can land but bytes can stay in the page\n\t\t\t\t// cache through a power loss.\n\t\t\t\tyield* file.sync.pipe(Effect.catch(failStage(path, 'fsync')));\n\t\t\t}),\n\t\t);\n\t\t// 5. Atomic rename. On failure unlink the tempfile so we\n\t\t// don't leak; unlink failure is ignored (the original\n\t\t// rename failure is the one that matters).\n\t\tyield* fs\n\t\t\t.rename(tmp, path)\n\t\t\t.pipe(\n\t\t\t\tEffect.catch((cause) =>\n\t\t\t\t\tfs\n\t\t\t\t\t\t.remove(tmp, { force: true })\n\t\t\t\t\t\t.pipe(Effect.ignore, Effect.andThen(failStage(path, 'rename')(cause))),\n\t\t\t\t),\n\t\t\t);\n\t}).pipe(Effect.withSpan('substrate.atomicWriteFile', { attributes: { path } }));\n\n/**\n * Atomically write a JSON value. Encodes via Schema (so the on-disk\n * shape is the schema's `Encoded` form, not the rich `Type`). Caller\n * supplies a schema whose `Type` matches `value`.\n */\nexport const atomicWriteJson = <A, I>(\n\tpath: string,\n\tschema: Schema.Codec<A, I>,\n\tvalue: A,\n\toptions?: { readonly mode?: number; readonly parentMode?: number },\n): Effect.Effect<void, AtomicWriteFailed, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst encoded = yield* Schema.encodeUnknownEffect(schema)(value).pipe(\n\t\t\tEffect.catch(failStage(path, 'encode')),\n\t\t);\n\t\tconst json = JSON.stringify(encoded, null, 2);\n\t\tconst bytes = new TextEncoder().encode(json);\n\t\tyield* atomicWriteFile(path, bytes, options);\n\t});\n\n// -----------------------------------------------------------------------------\n// Sync surface — for the cross-process modules that hold `stack.lock`\n// and must keep their critical section non-yielding. Same contract as\n// the Effect surface above.\n// -----------------------------------------------------------------------------\n\n/**\n * Synchronous atomic write. Same disk-side contract as\n * `atomicWriteFile` (mkdir-parent → O_EXCL temp → write → fsync →\n * rename). Returns `void` on success; throws on any failure with\n * `cause` set to the underlying `NodeJS.ErrnoException`.\n *\n * Used inside `Effect.try` by the cross-process modules; the caller\n * maps the thrown error to a typed plugin/runtime error\n * (`RosterIoError` / `SnapshotReservationIoError` / etc.).\n */\nexport const atomicWriteFileSync = (\n\tpath: string,\n\tbytes: Uint8Array | string,\n\toptions: { readonly mode?: number; readonly parentMode?: number } = {},\n): void => {\n\tconst mode = options.mode ?? 0o600;\n\tconst parentMode = options.parentMode ?? 0o700;\n\tconst tmp = `${path}.tmp.${process.pid}.${tempSuffix()}`;\n\tmkdirSync(dirname(path), { recursive: true, mode: parentMode });\n\t// O_EXCL via `flag: 'wx'`. writeFileSync handles open + write +\n\t// close in one call but does NOT fsync; do it manually so we\n\t// preserve the durability boundary the Effect surface has.\n\twriteFileSync(tmp, bytes, { flag: 'wx', mode });\n\t// fsync — open the file just to fsync the bytes through the page\n\t// cache. `writeFileSync` already closed the original fd.\n\tlet fd: number | null = null;\n\ttry {\n\t\tfd = openSync(tmp, 'r');\n\t\tfsyncSync(fd);\n\t} finally {\n\t\tif (fd !== null) closeSync(fd);\n\t}\n\ttry {\n\t\trenameSync(tmp, path);\n\t} catch (cause) {\n\t\t// Best-effort tempfile cleanup; the original rename failure is\n\t\t// the one we re-throw to the caller.\n\t\ttry {\n\t\t\tunlinkSync(tmp);\n\t\t} catch {\n\t\t\t// ignore\n\t\t}\n\t\tthrow cause;\n\t}\n};\n\n/**\n * Synchronous atomic JSON write. Stringifies `value` and routes\n * through `atomicWriteFileSync`. No Schema encoding here — the\n * cross-process modules round-trip plain JSON (their schemas are\n * Schema.Struct of primitives; `JSON.stringify` is sufficient and\n * keeps the sync path dependency-free of Effect's Schema effects).\n */\nexport const atomicWriteJsonSync = (\n\tpath: string,\n\tvalue: unknown,\n\toptions?: { readonly mode?: number; readonly parentMode?: number },\n): void => {\n\tconst json = JSON.stringify(value);\n\tatomicWriteFileSync(path, json, options);\n};\n\n// Local dirname — we don't yield Path service here because\n// atomic-write may be called outside of a path-service-having\n// context (tests, recovery scripts). Posix-only; devstack is\n// posix-only in practice.\nconst dirname = (p: string): string => {\n\tconst i = p.lastIndexOf('/');\n\treturn i <= 0 ? '/' : p.slice(0, i);\n};\n"],"mappings":";;;;;;;;AAsDA,MAAM,mBAA2B,YAAY,CAAC,QAAQ,MAAM,GAAG,CAAC,MAAM,GAAG,EAAE;AAE3E,MAAM,aAEJ,MACA,WAEA,UACA,OAAO,KAAK,IAAI,kBAAkB;CAAE;CAAM;CAAO;CAAO,CAAC,CAAC;;;;;;;;AAS5D,MAAa,mBACZ,MACA,OACA,UAAoE,EAAE,KAEtE,OAAO,IAAI,aAAa;CACvB,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,QAAQ,QAAQ;CAC7B,MAAM,aAAa,QAAQ,cAAc;CACzC,MAAM,MAAM,GAAG,KAAK,OAAO,QAAQ,IAAI,GAAG,YAAY;AAGtD,QAAO,GACL,cAAc,QAAQ,KAAK,EAAE;EAAE,WAAW;EAAM,MAAM;EAAY,CAAC,CACnE,KAAK,OAAO,MAAM,UAAU,MAAM,eAAe,CAAC,CAAC;AAGrD,QAAO,OAAO,OACb,OAAO,IAAI,aAAa;EACvB,MAAM,OAAO,OAAO,GAClB,KAAK,KAAK;GAAE,MAAM;GAAM;GAAM,CAAC,CAC/B,KAAK,OAAO,MAAM,UAAU,MAAM,YAAY,CAAC,CAAC;AAClD,SAAO,KAAK,SAAS,MAAM,CAAC,KAAK,OAAO,MAAM,UAAU,MAAM,QAAQ,CAAC,CAAC;AAIxE,SAAO,KAAK,KAAK,KAAK,OAAO,MAAM,UAAU,MAAM,QAAQ,CAAC,CAAC;GAC5D,CACF;AAID,QAAO,GACL,OAAO,KAAK,KAAK,CACjB,KACA,OAAO,OAAO,UACb,GACE,OAAO,KAAK,EAAE,OAAO,MAAM,CAAC,CAC5B,KAAK,OAAO,QAAQ,OAAO,QAAQ,UAAU,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC,CACvE,CACD;EACD,CAAC,KAAK,OAAO,SAAS,6BAA6B,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC;;;;;;AAOhF,MAAa,mBACZ,MACA,QACA,OACA,YAEA,OAAO,IAAI,aAAa;CACvB,MAAM,UAAU,OAAO,OAAO,oBAAoB,OAAO,CAAC,MAAM,CAAC,KAChE,OAAO,MAAM,UAAU,MAAM,SAAS,CAAC,CACvC;CACD,MAAM,OAAO,KAAK,UAAU,SAAS,MAAM,EAAE;AAE7C,QAAO,gBAAgB,MADT,IAAI,aAAa,CAAC,OAAO,KACL,EAAE,QAAQ;EAC3C;;;;;;;;;;;AAkBH,MAAa,uBACZ,MACA,OACA,UAAoE,EAAE,KAC5D;CACV,MAAM,OAAO,QAAQ,QAAQ;CAC7B,MAAM,aAAa,QAAQ,cAAc;CACzC,MAAM,MAAM,GAAG,KAAK,OAAO,QAAQ,IAAI,GAAG,YAAY;AACtD,WAAU,QAAQ,KAAK,EAAE;EAAE,WAAW;EAAM,MAAM;EAAY,CAAC;AAI/D,eAAc,KAAK,OAAO;EAAE,MAAM;EAAM;EAAM,CAAC;CAG/C,IAAI,KAAoB;AACxB,KAAI;AACH,OAAK,SAAS,KAAK,IAAI;AACvB,YAAU,GAAG;WACJ;AACT,MAAI,OAAO,KAAM,WAAU,GAAG;;AAE/B,KAAI;AACH,aAAW,KAAK,KAAK;UACb,OAAO;AAGf,MAAI;AACH,cAAW,IAAI;UACR;AAGR,QAAM;;;;;;;;;;AAWR,MAAa,uBACZ,MACA,OACA,YACU;AAEV,qBAAoB,MADP,KAAK,UAAU,MACE,EAAE,QAAQ;;AAOzC,MAAM,WAAW,MAAsB;CACtC,MAAM,IAAI,EAAE,YAAY,IAAI;AAC5B,QAAO,KAAK,IAAI,MAAM,EAAE,MAAM,GAAG,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
//#region src/substrate/runtime/cache/schema.ts
|
|
3
|
+
/** Versioned envelope. Schema-decode failure on read is treated as
|
|
4
|
+
* a cache MISS (best-effort cache contract — corruption recovers
|
|
5
|
+
* by re-producing the artifact). */
|
|
6
|
+
const CacheEntryDoc = Schema.Struct({
|
|
7
|
+
version: Schema.Literal(1),
|
|
8
|
+
/** Bytes, base64-encoded. Chosen over hex because typical
|
|
9
|
+
* artifacts are larger (image manifests, package digests) and
|
|
10
|
+
* base64 is 33% overhead vs hex's 100%. */
|
|
11
|
+
bytes: Schema.String,
|
|
12
|
+
/** Unix millis of the write. Renderers may show "produced 5s
|
|
13
|
+
* ago"; substrate uses it only for diagnostics. */
|
|
14
|
+
writtenAt: Schema.Number,
|
|
15
|
+
/** Optional namespace-private hint (e.g. "image-tag the cached
|
|
16
|
+
* blob refers to"). Substrate stores opaquely. */
|
|
17
|
+
hint: Schema.optional(Schema.String)
|
|
18
|
+
});
|
|
19
|
+
//#endregion
|
|
20
|
+
export { CacheEntryDoc };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=schema.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.mjs","names":[],"sources":["../../../../src/substrate/runtime/cache/schema.ts"],"sourcesContent":["// On-disk shape for one cache entry.\n//\n// One file per `(namespace, chain, contentHash)` triple, at\n// `<runtime-root>/stacks/<stack>/cache/<namespace>/<chain>/<contentHash>.json`.\n//\n// The entry envelope wraps the bytes (base64-encoded — JSON has no\n// binary literal) and the metadata renderer / verify needs. Cache\n// callers don't see the envelope; they only see `CacheEntry` from\n// `primitives/cache.ts` (bytes + writtenAt).\n\nimport { Schema } from 'effect';\n\n/** Versioned envelope. Schema-decode failure on read is treated as\n * a cache MISS (best-effort cache contract — corruption recovers\n * by re-producing the artifact). */\nexport const CacheEntryDoc = Schema.Struct({\n\tversion: Schema.Literal(1),\n\t/** Bytes, base64-encoded. Chosen over hex because typical\n\t * artifacts are larger (image manifests, package digests) and\n\t * base64 is 33% overhead vs hex's 100%. */\n\tbytes: Schema.String,\n\t/** Unix millis of the write. Renderers may show \"produced 5s\n\t * ago\"; substrate uses it only for diagnostics. */\n\twrittenAt: Schema.Number,\n\t/** Optional namespace-private hint (e.g. \"image-tag the cached\n\t * blob refers to\"). Substrate stores opaquely. */\n\thint: Schema.optional(Schema.String),\n});\nexport type CacheEntryDoc = typeof CacheEntryDoc.Type;\n"],"mappings":";;;;;AAeA,MAAa,gBAAgB,OAAO,OAAO;CAC1C,SAAS,OAAO,QAAQ,EAAE;;;;CAI1B,OAAO,OAAO;;;CAGd,WAAW,OAAO;;;CAGlB,MAAM,OAAO,SAAS,OAAO,OAAO;CACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Context, FileSystem, Layer } from "effect";
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { StackPathsService } from "../paths.mjs";
|
|
2
|
+
import { CacheError } from "../errors.mjs";
|
|
3
|
+
import { decodeJsonText } from "../runtime-decode.mjs";
|
|
4
|
+
import { CacheEntryDoc } from "./schema.mjs";
|
|
5
|
+
import { atomicWriteJson } from "../atomic-write.mjs";
|
|
6
|
+
import { Context, Effect, FileSystem, Layer } from "effect";
|
|
7
|
+
//#region src/substrate/runtime/cache/service.ts
|
|
8
|
+
const base64Encode = (bytes) => Buffer.from(bytes).toString("base64");
|
|
9
|
+
const base64Decode = (s) => new Uint8Array(Buffer.from(s, "base64"));
|
|
10
|
+
var CacheService = class extends Context.Service()("@devstack-rewrite/substrate/Cache") {};
|
|
11
|
+
/**
|
|
12
|
+
* Cache Layer. Stateless beyond the path resolver and the platform
|
|
13
|
+
* FileSystem — every read goes to disk (no in-memory hot cache; the
|
|
14
|
+
* OS page cache is enough). If a future perf pass shows the
|
|
15
|
+
* substrate is hot-path-reading the same entries repeatedly, fold
|
|
16
|
+
* an LRU in here; today's call-sites read once at acquire and never
|
|
17
|
+
* again.
|
|
18
|
+
*/
|
|
19
|
+
const layerCache = Layer.effect(CacheService, Effect.gen(function* () {
|
|
20
|
+
const fs = yield* FileSystem.FileSystem;
|
|
21
|
+
const paths = yield* StackPathsService;
|
|
22
|
+
const lookup = (key) => Effect.gen(function* () {
|
|
23
|
+
const { file } = paths.cacheEntry(key.namespace, key.chain, key.contentHash);
|
|
24
|
+
if (!(yield* fs.exists(file).pipe(Effect.catch((cause) => Effect.fail(new CacheError({
|
|
25
|
+
reason: "io-failed",
|
|
26
|
+
detail: `failed to stat cache entry: ${file}`,
|
|
27
|
+
cause
|
|
28
|
+
})))))) return null;
|
|
29
|
+
const text = yield* fs.readFileString(file).pipe(Effect.catch((cause) => Effect.fail(new CacheError({
|
|
30
|
+
reason: "io-failed",
|
|
31
|
+
detail: `failed to read cache entry: ${file}`,
|
|
32
|
+
cause
|
|
33
|
+
}))));
|
|
34
|
+
const annotateCorruption = Effect.annotateCurrentSpan({ "cache.corruption": true });
|
|
35
|
+
const doc = yield* decodeJsonText(CacheEntryDoc, text, {
|
|
36
|
+
source: file,
|
|
37
|
+
mkError: (issue) => issue
|
|
38
|
+
}).pipe(Effect.catch(() => annotateCorruption.pipe(Effect.as(null))));
|
|
39
|
+
if (doc === null) return null;
|
|
40
|
+
return {
|
|
41
|
+
bytes: base64Decode(doc.bytes),
|
|
42
|
+
writtenAt: doc.writtenAt
|
|
43
|
+
};
|
|
44
|
+
}).pipe(Effect.withSpan("substrate.cache.lookup", { attributes: {
|
|
45
|
+
namespace: key.namespace,
|
|
46
|
+
chain: key.chain,
|
|
47
|
+
contentHash: key.contentHash
|
|
48
|
+
} }));
|
|
49
|
+
const write = (key, bytes) => Effect.gen(function* () {
|
|
50
|
+
const { file } = paths.cacheEntry(key.namespace, key.chain, key.contentHash);
|
|
51
|
+
yield* atomicWriteJson(file, CacheEntryDoc, {
|
|
52
|
+
version: 1,
|
|
53
|
+
bytes: base64Encode(bytes),
|
|
54
|
+
writtenAt: Date.now()
|
|
55
|
+
}, {
|
|
56
|
+
mode: 420,
|
|
57
|
+
parentMode: 493
|
|
58
|
+
}).pipe(Effect.catch((cause) => Effect.fail(new CacheError({
|
|
59
|
+
reason: "io-failed",
|
|
60
|
+
detail: `cache write failed: ${file}`,
|
|
61
|
+
cause
|
|
62
|
+
}))), Effect.provideService(FileSystem.FileSystem, fs));
|
|
63
|
+
}).pipe(Effect.withSpan("substrate.cache.write", { attributes: {
|
|
64
|
+
namespace: key.namespace,
|
|
65
|
+
chain: key.chain,
|
|
66
|
+
contentHash: key.contentHash
|
|
67
|
+
} }));
|
|
68
|
+
const remove = (key) => Effect.gen(function* () {
|
|
69
|
+
const { file } = paths.cacheEntry(key.namespace, key.chain, key.contentHash);
|
|
70
|
+
yield* fs.remove(file, { force: true }).pipe(Effect.catch((cause) => Effect.fail(new CacheError({
|
|
71
|
+
reason: "io-failed",
|
|
72
|
+
detail: `cache delete failed: ${file}`,
|
|
73
|
+
cause
|
|
74
|
+
}))));
|
|
75
|
+
}).pipe(Effect.withSpan("substrate.cache.delete", { attributes: {
|
|
76
|
+
namespace: key.namespace,
|
|
77
|
+
chain: key.chain,
|
|
78
|
+
contentHash: key.contentHash
|
|
79
|
+
} }));
|
|
80
|
+
return CacheService.of({
|
|
81
|
+
lookup,
|
|
82
|
+
write,
|
|
83
|
+
delete: remove
|
|
84
|
+
});
|
|
85
|
+
}));
|
|
86
|
+
//#endregion
|
|
87
|
+
export { CacheService, layerCache };
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=service.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.mjs","names":[],"sources":["../../../../src/substrate/runtime/cache/service.ts"],"sourcesContent":["// Cache implementation.\n//\n// Universal artifact cache, content-addressed by\n// `(namespace, chainId, contentHash)`. Per-plugin namespace; the\n// substrate folds chainId in.\n//\n// Semantics:\n//\n// - `lookup` is the precise \"is the entry present?\" query. Hit\n// returns `CacheEntry`; miss returns `null`. Schema-decode\n// failure (corruption) is treated as a MISS, not an error —\n// re-producing the artifact is always safe; surfacing decode\n// failures would force every caller to handle a recovery path\n// they don't need. The corruption is logged via the span.\n// - `write` is best-effort. The architecture is explicit: an\n// ArtifactPublisher commits the on-chain effect, THEN\n// writes the cache; a cache-write IO failure must NOT roll back\n// the on-chain effect. We surface write failures via the\n// `CacheError` channel so callers can opt into reporting them,\n// but the typical caller pipes `Effect.ignore` over the write.\n// - `delete` is a best-effort sweep.\n//\n// Tombstones: the cache does NOT use tombstones. Missing-vs-deleted\n// is meaningless for a content-addressed best-effort store —\n// re-producing the artifact has the same effect either way.\n\nimport { Context, Effect, FileSystem, Layer } from 'effect';\n\nimport type { Cache, CacheEntry, CacheKey } from '../../../primitives/cache.ts';\nimport { atomicWriteJson } from '../atomic-write.ts';\nimport { CacheError } from '../errors.ts';\nimport { StackPathsService } from '../paths.ts';\nimport { decodeJsonText } from '../runtime-decode.ts';\nimport { CacheEntryDoc } from './schema.ts';\n\nconst base64Encode = (bytes: Uint8Array): string => Buffer.from(bytes).toString('base64');\nconst base64Decode = (s: string): Uint8Array => new Uint8Array(Buffer.from(s, 'base64'));\n\nexport class CacheService extends Context.Service<CacheService, Cache>()(\n\t'@devstack-rewrite/substrate/Cache',\n) {}\n\n/**\n * Cache Layer. Stateless beyond the path resolver and the platform\n * FileSystem — every read goes to disk (no in-memory hot cache; the\n * OS page cache is enough). If a future perf pass shows the\n * substrate is hot-path-reading the same entries repeatedly, fold\n * an LRU in here; today's call-sites read once at acquire and never\n * again.\n */\nexport const layerCache: Layer.Layer<\n\tCacheService,\n\tnever,\n\tFileSystem.FileSystem | StackPathsService\n> = Layer.effect(\n\tCacheService,\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst paths = yield* StackPathsService;\n\n\t\tconst lookup = (key: CacheKey): Effect.Effect<CacheEntry | null, CacheError> =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst { file } = paths.cacheEntry(key.namespace, key.chain, key.contentHash);\n\t\t\t\tconst exists = yield* fs.exists(file).pipe(\n\t\t\t\t\tEffect.catch((cause) =>\n\t\t\t\t\t\tEffect.fail(\n\t\t\t\t\t\t\tnew CacheError({\n\t\t\t\t\t\t\t\treason: 'io-failed',\n\t\t\t\t\t\t\t\tdetail: `failed to stat cache entry: ${file}`,\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tif (!exists) return null;\n\t\t\t\tconst text = yield* fs.readFileString(file).pipe(\n\t\t\t\t\tEffect.catch((cause) =>\n\t\t\t\t\t\tEffect.fail(\n\t\t\t\t\t\t\tnew CacheError({\n\t\t\t\t\t\t\t\treason: 'io-failed',\n\t\t\t\t\t\t\t\tdetail: `failed to read cache entry: ${file}`,\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\t// Corruption = miss. The cache contract is\n\t\t\t\t// best-effort; surfacing decode failures would force\n\t\t\t\t// every caller to handle a recovery path that's\n\t\t\t\t// already implicit (re-produce). We do annotate the\n\t\t\t\t// span so the substrate's observability still\n\t\t\t\t// surfaces the rare corruption.\n\t\t\t\tconst annotateCorruption = Effect.annotateCurrentSpan({\n\t\t\t\t\t'cache.corruption': true,\n\t\t\t\t});\n\t\t\t\tconst doc = yield* decodeJsonText(CacheEntryDoc, text, {\n\t\t\t\t\tsource: file,\n\t\t\t\t\tmkError: (issue) => issue,\n\t\t\t\t}).pipe(\n\t\t\t\t\tEffect.catch(() => annotateCorruption.pipe(Effect.as(null as CacheEntryDoc | null))),\n\t\t\t\t);\n\t\t\t\tif (doc === null) return null;\n\t\t\t\treturn {\n\t\t\t\t\tbytes: base64Decode(doc.bytes),\n\t\t\t\t\twrittenAt: doc.writtenAt,\n\t\t\t\t};\n\t\t\t}).pipe(\n\t\t\t\tEffect.withSpan('substrate.cache.lookup', {\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\tnamespace: key.namespace,\n\t\t\t\t\t\tchain: key.chain,\n\t\t\t\t\t\tcontentHash: key.contentHash,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t);\n\n\t\tconst write = (key: CacheKey, bytes: Uint8Array): Effect.Effect<void, CacheError> =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst { file } = paths.cacheEntry(key.namespace, key.chain, key.contentHash);\n\t\t\t\tconst doc: CacheEntryDoc = {\n\t\t\t\t\tversion: 1,\n\t\t\t\t\tbytes: base64Encode(bytes),\n\t\t\t\t\twrittenAt: Date.now(),\n\t\t\t\t};\n\t\t\t\tyield* atomicWriteJson(file, CacheEntryDoc, doc, {\n\t\t\t\t\tmode: 0o644,\n\t\t\t\t\tparentMode: 0o755,\n\t\t\t\t}).pipe(\n\t\t\t\t\tEffect.catch((cause) =>\n\t\t\t\t\t\tEffect.fail(\n\t\t\t\t\t\t\tnew CacheError({\n\t\t\t\t\t\t\t\treason: 'io-failed',\n\t\t\t\t\t\t\t\tdetail: `cache write failed: ${file}`,\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\tEffect.provideService(FileSystem.FileSystem, fs),\n\t\t\t\t);\n\t\t\t}).pipe(\n\t\t\t\tEffect.withSpan('substrate.cache.write', {\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\tnamespace: key.namespace,\n\t\t\t\t\t\tchain: key.chain,\n\t\t\t\t\t\tcontentHash: key.contentHash,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t);\n\n\t\tconst remove = (key: CacheKey): Effect.Effect<void, CacheError> =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst { file } = paths.cacheEntry(key.namespace, key.chain, key.contentHash);\n\t\t\t\tyield* fs.remove(file, { force: true }).pipe(\n\t\t\t\t\tEffect.catch((cause) =>\n\t\t\t\t\t\tEffect.fail(\n\t\t\t\t\t\t\tnew CacheError({\n\t\t\t\t\t\t\t\treason: 'io-failed',\n\t\t\t\t\t\t\t\tdetail: `cache delete failed: ${file}`,\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}).pipe(\n\t\t\t\tEffect.withSpan('substrate.cache.delete', {\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\tnamespace: key.namespace,\n\t\t\t\t\t\tchain: key.chain,\n\t\t\t\t\t\tcontentHash: key.contentHash,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t);\n\n\t\treturn CacheService.of({\n\t\t\tlookup,\n\t\t\twrite,\n\t\t\tdelete: remove,\n\t\t});\n\t}),\n);\n"],"mappings":";;;;;;;AAmCA,MAAM,gBAAgB,UAA8B,OAAO,KAAK,MAAM,CAAC,SAAS,SAAS;AACzF,MAAM,gBAAgB,MAA0B,IAAI,WAAW,OAAO,KAAK,GAAG,SAAS,CAAC;AAExF,IAAa,eAAb,cAAkC,QAAQ,SAA8B,CACvE,oCACA,CAAC;;;;;;;;;AAUF,MAAa,aAIT,MAAM,OACT,cACA,OAAO,IAAI,aAAa;CACvB,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,QAAQ,OAAO;CAErB,MAAM,UAAU,QACf,OAAO,IAAI,aAAa;EACvB,MAAM,EAAE,SAAS,MAAM,WAAW,IAAI,WAAW,IAAI,OAAO,IAAI,YAAY;AAY5E,MAAI,EAAC,OAXiB,GAAG,OAAO,KAAK,CAAC,KACrC,OAAO,OAAO,UACb,OAAO,KACN,IAAI,WAAW;GACd,QAAQ;GACR,QAAQ,+BAA+B;GACvC;GACA,CAAC,CACF,CACD,CACD,EACY,QAAO;EACpB,MAAM,OAAO,OAAO,GAAG,eAAe,KAAK,CAAC,KAC3C,OAAO,OAAO,UACb,OAAO,KACN,IAAI,WAAW;GACd,QAAQ;GACR,QAAQ,+BAA+B;GACvC;GACA,CAAC,CACF,CACD,CACD;EAOD,MAAM,qBAAqB,OAAO,oBAAoB,EACrD,oBAAoB,MACpB,CAAC;EACF,MAAM,MAAM,OAAO,eAAe,eAAe,MAAM;GACtD,QAAQ;GACR,UAAU,UAAU;GACpB,CAAC,CAAC,KACF,OAAO,YAAY,mBAAmB,KAAK,OAAO,GAAG,KAA6B,CAAC,CAAC,CACpF;AACD,MAAI,QAAQ,KAAM,QAAO;AACzB,SAAO;GACN,OAAO,aAAa,IAAI,MAAM;GAC9B,WAAW,IAAI;GACf;GACA,CAAC,KACF,OAAO,SAAS,0BAA0B,EACzC,YAAY;EACX,WAAW,IAAI;EACf,OAAO,IAAI;EACX,aAAa,IAAI;EACjB,EACD,CAAC,CACF;CAEF,MAAM,SAAS,KAAe,UAC7B,OAAO,IAAI,aAAa;EACvB,MAAM,EAAE,SAAS,MAAM,WAAW,IAAI,WAAW,IAAI,OAAO,IAAI,YAAY;AAM5E,SAAO,gBAAgB,MAAM,eAAe;GAJ3C,SAAS;GACT,OAAO,aAAa,MAAM;GAC1B,WAAW,KAAK,KAAK;GAEyB,EAAE;GAChD,MAAM;GACN,YAAY;GACZ,CAAC,CAAC,KACF,OAAO,OAAO,UACb,OAAO,KACN,IAAI,WAAW;GACd,QAAQ;GACR,QAAQ,uBAAuB;GAC/B;GACA,CAAC,CACF,CACD,EACD,OAAO,eAAe,WAAW,YAAY,GAAG,CAChD;GACA,CAAC,KACF,OAAO,SAAS,yBAAyB,EACxC,YAAY;EACX,WAAW,IAAI;EACf,OAAO,IAAI;EACX,aAAa,IAAI;EACjB,EACD,CAAC,CACF;CAEF,MAAM,UAAU,QACf,OAAO,IAAI,aAAa;EACvB,MAAM,EAAE,SAAS,MAAM,WAAW,IAAI,WAAW,IAAI,OAAO,IAAI,YAAY;AAC5E,SAAO,GAAG,OAAO,MAAM,EAAE,OAAO,MAAM,CAAC,CAAC,KACvC,OAAO,OAAO,UACb,OAAO,KACN,IAAI,WAAW;GACd,QAAQ;GACR,QAAQ,wBAAwB;GAChC;GACA,CAAC,CACF,CACD,CACD;GACA,CAAC,KACF,OAAO,SAAS,0BAA0B,EACzC,YAAY;EACX,WAAW,IAAI;EACf,OAAO,IAAI;EACX,aAAa,IAAI;EACjB,EACD,CAAC,CACF;AAEF,QAAO,aAAa,GAAG;EACtB;EACA;EACA,QAAQ;EACR,CAAC;EACD,CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { CapabilitySink, ContributionKind, HarvestContext } from "./service.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Context, Layer } from "effect";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FormatterRegistryService, layerFormatterRegistry } from "../observability/formatter-registry.mjs";
|
|
2
|
+
import { CapabilitySinksService, layerCapabilitySinks } from "./service.mjs";
|
|
3
|
+
import { Effect, Layer } from "effect";
|
|
4
|
+
//#region src/substrate/runtime/capability-sinks/layer.ts
|
|
5
|
+
const errorContributionSink = (formatters) => ({
|
|
6
|
+
kind: "error-contribution",
|
|
7
|
+
accept: (contribution, _ctx) => formatters.register(contribution)
|
|
8
|
+
});
|
|
9
|
+
/**
|
|
10
|
+
* Build the substrate's default CapabilitySinks layer. It supplies the
|
|
11
|
+
* error-contribution sink and registers the caller's capability sinks
|
|
12
|
+
* by kind. Unknown contribution kinds remain no-ops at the supervisor
|
|
13
|
+
* call site unless a sink is registered.
|
|
14
|
+
*
|
|
15
|
+
* Plugin-author extension: provide an additional Layer that yields
|
|
16
|
+
* `CapabilitySinksService` and calls `registerSink({ kind: 'my-kind', ... })`
|
|
17
|
+
* before the supervisor starts harvesting. Last-write-wins on duplicate
|
|
18
|
+
* kinds, with scope-bound restore — the built-in sink comes back when
|
|
19
|
+
* the override's scope closes.
|
|
20
|
+
*/
|
|
21
|
+
const layerCapabilitySinksDefault = (orchestrator = []) => {
|
|
22
|
+
return Layer.effectDiscard(Effect.gen(function* () {
|
|
23
|
+
const sinks = yield* CapabilitySinksService;
|
|
24
|
+
const defaults = [errorContributionSink(yield* FormatterRegistryService), ...orchestrator];
|
|
25
|
+
for (const sink of defaults) yield* sinks.registerSink(sink);
|
|
26
|
+
})).pipe(Layer.provideMerge(layerCapabilitySinks), Layer.provideMerge(layerFormatterRegistry));
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { layerCapabilitySinksDefault };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=layer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer.mjs","names":[],"sources":["../../../../src/substrate/runtime/capability-sinks/layer.ts"],"sourcesContent":["// CapabilitySinks default layer.\n//\n// Composes the empty registry from `service.ts` with the substrate's\n// error-contribution sink and caller-supplied capability sinks. The\n// substrate does not name built-in capability contracts here; L3\n// orchestrator composition owns those registrations.\n\nimport { Context, Effect, Layer, Scope } from 'effect';\n\nimport type { PluginErrorContribution } from '../../plugin.ts';\nimport {\n\tFormatterRegistryService,\n\tlayerFormatterRegistry,\n} from '../observability/formatter-registry.ts';\nimport {\n\tCapabilitySinksService,\n\tlayerCapabilitySinks,\n\ttype CapabilitySink,\n\ttype ContributionKind,\n} from './service.ts';\n\n// -----------------------------------------------------------------------------\n// Orchestrator-supplied capability-decl registrations\n// -----------------------------------------------------------------------------\n\n/**\n * Orchestrator-side sink registrations. The supervisor accepts these\n * at boot and registers them by `kind`; the substrate does not expose\n * one callback slot per built-in capability contract.\n */\nexport type OrchestratorSinks = ReadonlyArray<CapabilitySink<ContributionKind, never>>;\n\n// -----------------------------------------------------------------------------\n// Built-in sink construction\n// -----------------------------------------------------------------------------\n\nconst errorContributionSink = (formatters: {\n\treadonly register: (c: PluginErrorContribution) => Effect.Effect<void, never, Scope.Scope>;\n}): CapabilitySink<'error-contribution', PluginErrorContribution> => ({\n\tkind: 'error-contribution',\n\taccept: (contribution, _ctx) => formatters.register(contribution),\n});\n\n// -----------------------------------------------------------------------------\n// Public layer factory\n// -----------------------------------------------------------------------------\n\n/**\n * Build the substrate's default CapabilitySinks layer. It supplies the\n * error-contribution sink and registers the caller's capability sinks\n * by kind. Unknown contribution kinds remain no-ops at the supervisor\n * call site unless a sink is registered.\n *\n * Plugin-author extension: provide an additional Layer that yields\n * `CapabilitySinksService` and calls `registerSink({ kind: 'my-kind', ... })`\n * before the supervisor starts harvesting. Last-write-wins on duplicate\n * kinds, with scope-bound restore — the built-in sink comes back when\n * the override's scope closes.\n */\nexport const layerCapabilitySinksDefault = (\n\torchestrator: OrchestratorSinks = [],\n): Layer.Layer<CapabilitySinksService | FormatterRegistryService, never, never> => {\n\tconst registerDefaults = Layer.effectDiscard(\n\t\tEffect.gen(function* () {\n\t\t\tconst sinks = yield* CapabilitySinksService;\n\t\t\tconst fmt = yield* FormatterRegistryService;\n\t\t\tconst defaults = [errorContributionSink(fmt), ...orchestrator];\n\t\t\tfor (const sink of defaults) {\n\t\t\t\tyield* sinks.registerSink(sink);\n\t\t\t}\n\t\t}),\n\t);\n\treturn registerDefaults.pipe(\n\t\tLayer.provideMerge(layerCapabilitySinks),\n\t\tLayer.provideMerge(layerFormatterRegistry),\n\t);\n};\n\n/** Re-exposed dependency: callers that want the formatter registry\n * available downstream (e.g. CLI / TUI / cascade-formatter consumers)\n * pull it from the default layer. */\nexport type CapabilitySinksRequirements = Context.Context<\n\tCapabilitySinksService | FormatterRegistryService\n>;\n"],"mappings":";;;;AAoCA,MAAM,yBAAyB,gBAEuC;CACrE,MAAM;CACN,SAAS,cAAc,SAAS,WAAW,SAAS,aAAa;CACjE;;;;;;;;;;;;;AAkBD,MAAa,+BACZ,eAAkC,EAAE,KAC8C;AAWlF,QAVyB,MAAM,cAC9B,OAAO,IAAI,aAAa;EACvB,MAAM,QAAQ,OAAO;EAErB,MAAM,WAAW,CAAC,sBAAsB,OADrB,yBACyB,EAAE,GAAG,aAAa;AAC9D,OAAK,MAAM,QAAQ,SAClB,QAAO,MAAM,aAAa,KAAK;GAE/B,CAEoB,CAAC,KACvB,MAAM,aAAa,qBAAqB,EACxC,MAAM,aAAa,uBAAuB,CAC1C"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { PluginKey } from "../../brand.mjs";
|
|
2
|
+
import { EngineEvent } from "../../events.mjs";
|
|
3
|
+
import { StrategyContributorDecl } from "../../../contracts/strategy-contributor.mjs";
|
|
4
|
+
import { Identity } from "../../identity.mjs";
|
|
5
|
+
import { Context, Effect, Layer, Scope } from "effect";
|
|
6
|
+
//#region src/substrate/runtime/capability-sinks/service.d.ts
|
|
7
|
+
/** The discriminator the sinks register against. Substrate-owned
|
|
8
|
+
* literal vocabulary — plugins authoring a custom contract add a new
|
|
9
|
+
* literal and a sink. */
|
|
10
|
+
type ContributionKind = 'snapshotable' | 'routable' | 'codegenable' | 'projection' | 'strategy-contributor' | 'liveness-classifier' | 'error-contribution' | (string & {
|
|
11
|
+
readonly __extensionKind?: never;
|
|
12
|
+
});
|
|
13
|
+
/** Context the harvest loop supplies to each sink invocation. Carries
|
|
14
|
+
* the plugin's key + identity so sinks can attribute their work
|
|
15
|
+
* without naming the plugin. `publish` is the supervisor-owned event
|
|
16
|
+
* path, so sink-emitted events keep the same ordering/projection
|
|
17
|
+
* semantics as lifecycle/log/error events. The plugin scope is
|
|
18
|
+
* exposed via `Scope.Scope` in the sink's R-channel — sinks
|
|
19
|
+
* `addFinalizer` lands on the plugin's scope so registrations reap
|
|
20
|
+
* on plugin teardown. */
|
|
21
|
+
interface HarvestContext {
|
|
22
|
+
readonly pluginKey: PluginKey;
|
|
23
|
+
readonly identity: Identity;
|
|
24
|
+
readonly publish: (event: EngineEvent) => Effect.Effect<void, never, never>;
|
|
25
|
+
readonly registerStrategy: (decl: StrategyContributorDecl<string, unknown>) => Effect.Effect<void, never, Scope.Scope>;
|
|
26
|
+
}
|
|
27
|
+
/** A sink for a specific contribution kind. `accept` is the
|
|
28
|
+
* registration body — runs on the plugin's scope so its finalizers
|
|
29
|
+
* reap on plugin teardown. */
|
|
30
|
+
interface CapabilitySink<K extends ContributionKind, TDecl> {
|
|
31
|
+
readonly kind: K;
|
|
32
|
+
readonly accept: (decl: TDecl, ctx: HarvestContext) => Effect.Effect<void, unknown, Scope.Scope>;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { CapabilitySink, ContributionKind, HarvestContext };
|
|
36
|
+
//# sourceMappingURL=service.d.mts.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Context, Data, Effect, Layer, Ref } from "effect";
|
|
2
|
+
//#region src/substrate/runtime/capability-sinks/service.ts
|
|
3
|
+
/** Surfaced when `dispatch` receives a kind no sink is registered for.
|
|
4
|
+
* Substrate stays open by default — unknown kinds are no-ops at the
|
|
5
|
+
* supervisor's call site (see `dispatchOrIgnore`); but tests + custom
|
|
6
|
+
* callers can drive the strict surface via `dispatch`. */
|
|
7
|
+
var UnknownContributionKind = class extends Data.TaggedError("UnknownContributionKind") {};
|
|
8
|
+
/** Surfaced when a registered sink rejects while handling a known
|
|
9
|
+
* contribution kind. The original failure stays attached as `cause`
|
|
10
|
+
* so the supervisor's structured error renderer shows the domain
|
|
11
|
+
* error, such as `RouteCollision`, underneath the dispatch wrapper. */
|
|
12
|
+
var ContributionSinkFailed = class extends Data.TaggedError("ContributionSinkFailed") {};
|
|
13
|
+
var CapabilitySinksService = class extends Context.Service()("@devstack-rewrite/substrate/CapabilitySinks") {};
|
|
14
|
+
/** Derive the discriminator literal from a harvested contribution.
|
|
15
|
+
* Substrate name-blindness: this is the ONE place the substrate
|
|
16
|
+
* reads a `kind` off a decl — every other site routes through the
|
|
17
|
+
* registered sink, which interprets the payload. */
|
|
18
|
+
const kindOf = (contribution) => {
|
|
19
|
+
if (contribution.source === "error") return "error-contribution";
|
|
20
|
+
return contribution.decl.kind;
|
|
21
|
+
};
|
|
22
|
+
/** Layer constructing an empty registry. Built-in sinks ship via the
|
|
23
|
+
* composed `layerCapabilitySinksDefault` (see `layer.ts`); plugin-
|
|
24
|
+
* authored sinks compose by providing a Layer that yields the
|
|
25
|
+
* service and calls `registerSink`. */
|
|
26
|
+
const layerCapabilitySinks = Layer.effect(CapabilitySinksService, Effect.gen(function* () {
|
|
27
|
+
const sinksRef = yield* Ref.make(/* @__PURE__ */ new Map());
|
|
28
|
+
const registerSink = (sink) => Effect.gen(function* () {
|
|
29
|
+
const accept = sink.accept;
|
|
30
|
+
const prior = yield* Ref.modify(sinksRef, (current) => {
|
|
31
|
+
const next = new Map(current);
|
|
32
|
+
const had = next.get(sink.kind) ?? null;
|
|
33
|
+
next.set(sink.kind, accept);
|
|
34
|
+
return [had, next];
|
|
35
|
+
});
|
|
36
|
+
yield* Effect.addFinalizer((_exit) => Ref.update(sinksRef, (current) => {
|
|
37
|
+
const next = new Map(current);
|
|
38
|
+
if (prior === null) next.delete(sink.kind);
|
|
39
|
+
else next.set(sink.kind, prior);
|
|
40
|
+
return next;
|
|
41
|
+
}));
|
|
42
|
+
yield* Effect.annotateCurrentSpan({ "capability-sinks.kind": sink.kind });
|
|
43
|
+
}).pipe(Effect.withSpan("substrate.capabilitySinks.registerSink"));
|
|
44
|
+
const dispatch = (contribution, ctx) => Effect.gen(function* () {
|
|
45
|
+
const kind = kindOf(contribution);
|
|
46
|
+
const sinks = yield* Ref.get(sinksRef);
|
|
47
|
+
const accept = sinks.get(kind);
|
|
48
|
+
if (accept === void 0) return yield* new UnknownContributionKind({
|
|
49
|
+
kind,
|
|
50
|
+
known: [...sinks.keys()]
|
|
51
|
+
});
|
|
52
|
+
yield* accept(contribution.source === "error" ? contribution.contribution : contribution.decl, ctx).pipe(Effect.mapError((cause) => new ContributionSinkFailed({
|
|
53
|
+
kind,
|
|
54
|
+
message: `capability sink '${kind}' failed`,
|
|
55
|
+
cause
|
|
56
|
+
})));
|
|
57
|
+
yield* Effect.annotateCurrentSpan({
|
|
58
|
+
"capability-sinks.kind": kind,
|
|
59
|
+
"devstack.plugin": ctx.pluginKey
|
|
60
|
+
});
|
|
61
|
+
}).pipe(Effect.withSpan("substrate.capabilitySinks.dispatch"));
|
|
62
|
+
const knownKinds = Effect.gen(function* () {
|
|
63
|
+
return [...(yield* Ref.get(sinksRef)).keys()];
|
|
64
|
+
});
|
|
65
|
+
return CapabilitySinksService.of({
|
|
66
|
+
registerSink,
|
|
67
|
+
dispatch,
|
|
68
|
+
knownKinds
|
|
69
|
+
});
|
|
70
|
+
}));
|
|
71
|
+
//#endregion
|
|
72
|
+
export { CapabilitySinksService, layerCapabilitySinks };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=service.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.mjs","names":[],"sources":["../../../../src/substrate/runtime/capability-sinks/service.ts"],"sourcesContent":["// CapabilitySinks — kind→sink registry.\n//\n// Architecture § Substrate name-blindness (STYLE_GUIDE Open slot O6):\n// the supervisor used to import a hardcoded list of capability-decl\n// modules and dispatch by name on a switch. This module inverts that:\n// the substrate exposes an Effect.Service the supervisor consults\n// once per harvested contribution; plugin-authored kinds can be\n// registered via the same surface that ships the built-ins. Adding a\n// new capability contract is `registerSink({ kind, accept })` — no\n// supervisor edit required.\n//\n// The dispatch is structural on the `kind` literal of the contribution.\n// The substrate never inspects the contribution's payload; the sink's\n// `accept` body owns interpretation. The substrate never imports a\n// concrete plugin module.\n\nimport { Context, Data, Effect, Layer, Ref, Scope } from 'effect';\n\nimport type { CapabilityDecl } from '../../../contracts/capability-decl.ts';\nimport type { StrategyContributorDecl } from '../../../contracts/strategy-contributor.ts';\nimport type { PluginKey } from '../../brand.ts';\nimport type { EngineEvent } from '../../events.ts';\nimport type { Identity } from '../../identity.ts';\nimport type { PluginErrorContribution } from '../../plugin.ts';\n\n// -----------------------------------------------------------------------------\n// Contribution surface\n// -----------------------------------------------------------------------------\n\n/** A single harvested item — either a capability decl OR an error\n * contribution. Discriminated by the literal `kind`. The supervisor\n * produces one of these for each item it pulls off a plugin during\n * the harvest loop. */\nexport type AnyContribution =\n\t| { readonly source: 'capability'; readonly decl: CapabilityDecl }\n\t| { readonly source: 'error'; readonly contribution: PluginErrorContribution };\n\n/** The discriminator the sinks register against. Substrate-owned\n * literal vocabulary — plugins authoring a custom contract add a new\n * literal and a sink. */\nexport type ContributionKind =\n\t| 'snapshotable'\n\t| 'routable'\n\t| 'codegenable'\n\t| 'projection'\n\t| 'strategy-contributor'\n\t| 'liveness-classifier'\n\t| 'error-contribution'\n\t| (string & { readonly __extensionKind?: never });\n\n// -----------------------------------------------------------------------------\n// Harvest context\n// -----------------------------------------------------------------------------\n\n/** Context the harvest loop supplies to each sink invocation. Carries\n * the plugin's key + identity so sinks can attribute their work\n * without naming the plugin. `publish` is the supervisor-owned event\n * path, so sink-emitted events keep the same ordering/projection\n * semantics as lifecycle/log/error events. The plugin scope is\n * exposed via `Scope.Scope` in the sink's R-channel — sinks\n * `addFinalizer` lands on the plugin's scope so registrations reap\n * on plugin teardown. */\nexport interface HarvestContext {\n\treadonly pluginKey: PluginKey;\n\treadonly identity: Identity;\n\treadonly publish: (event: EngineEvent) => Effect.Effect<void, never, never>;\n\treadonly registerStrategy: (\n\t\tdecl: StrategyContributorDecl<string, unknown>,\n\t) => Effect.Effect<void, never, Scope.Scope>;\n}\n\n// -----------------------------------------------------------------------------\n// Sink shape\n// -----------------------------------------------------------------------------\n\n/** A sink for a specific contribution kind. `accept` is the\n * registration body — runs on the plugin's scope so its finalizers\n * reap on plugin teardown. */\nexport interface CapabilitySink<K extends ContributionKind, TDecl> {\n\treadonly kind: K;\n\treadonly accept: (decl: TDecl, ctx: HarvestContext) => Effect.Effect<void, unknown, Scope.Scope>;\n}\n\n// -----------------------------------------------------------------------------\n// Dispatch errors\n// -----------------------------------------------------------------------------\n\n/** Surfaced when `dispatch` receives a kind no sink is registered for.\n * Substrate stays open by default — unknown kinds are no-ops at the\n * supervisor's call site (see `dispatchOrIgnore`); but tests + custom\n * callers can drive the strict surface via `dispatch`. */\nexport class UnknownContributionKind extends Data.TaggedError('UnknownContributionKind')<{\n\treadonly kind: string;\n\treadonly known: ReadonlyArray<string>;\n}> {}\n\n/** Surfaced when a registered sink rejects while handling a known\n * contribution kind. The original failure stays attached as `cause`\n * so the supervisor's structured error renderer shows the domain\n * error, such as `RouteCollision`, underneath the dispatch wrapper. */\nexport class ContributionSinkFailed extends Data.TaggedError('ContributionSinkFailed')<{\n\treadonly kind: string;\n\treadonly message: string;\n\treadonly cause: unknown;\n}> {}\n\n// -----------------------------------------------------------------------------\n// Public service shape\n// -----------------------------------------------------------------------------\n\nexport interface CapabilitySinksShape {\n\t/** Register a sink for a contribution kind. Last-write-wins on\n\t * duplicate kinds: a plugin-author overlay replaces the built-in.\n\t * Scope-bound: registering inside a `Layer` and providing the\n\t * layer to the supervisor's scope reaps the sink on shutdown. */\n\treadonly registerSink: <K extends ContributionKind, TDecl>(\n\t\tsink: CapabilitySink<K, TDecl>,\n\t) => Effect.Effect<void, never, Scope.Scope>;\n\t/** Dispatch a contribution to its registered sink. Errors with\n\t * `UnknownContributionKind` when no sink matches; the supervisor's\n\t * loop catches and downgrades to a no-op (per the\n\t * substrate-open-by-default rule). */\n\treadonly dispatch: (\n\t\tcontribution: AnyContribution,\n\t\tctx: HarvestContext,\n\t) => Effect.Effect<void, UnknownContributionKind | ContributionSinkFailed, Scope.Scope>;\n\t/** Snapshot the kinds the registry currently knows. Diagnostic. */\n\treadonly knownKinds: Effect.Effect<ReadonlyArray<string>>;\n}\n\nexport class CapabilitySinksService extends Context.Service<\n\tCapabilitySinksService,\n\tCapabilitySinksShape\n>()('@devstack-rewrite/substrate/CapabilitySinks') {}\n\n// -----------------------------------------------------------------------------\n// Implementation helper — kind extraction\n// -----------------------------------------------------------------------------\n\n/** Derive the discriminator literal from a harvested contribution.\n * Substrate name-blindness: this is the ONE place the substrate\n * reads a `kind` off a decl — every other site routes through the\n * registered sink, which interprets the payload. */\nexport const kindOf = (contribution: AnyContribution): ContributionKind => {\n\tif (contribution.source === 'error') return 'error-contribution';\n\t// `decl.kind` is a literal on every CapabilityDecl variant; we\n\t// trust the substrate-owned contract here.\n\treturn contribution.decl.kind;\n};\n\n// -----------------------------------------------------------------------------\n// Layer\n// -----------------------------------------------------------------------------\n\ntype SinkAccept = (decl: unknown, ctx: HarvestContext) => Effect.Effect<void, unknown, Scope.Scope>;\n\n/** Layer constructing an empty registry. Built-in sinks ship via the\n * composed `layerCapabilitySinksDefault` (see `layer.ts`); plugin-\n * authored sinks compose by providing a Layer that yields the\n * service and calls `registerSink`. */\nexport const layerCapabilitySinks: Layer.Layer<CapabilitySinksService> = Layer.effect(\n\tCapabilitySinksService,\n\tEffect.gen(function* () {\n\t\tconst sinksRef = yield* Ref.make<ReadonlyMap<string, SinkAccept>>(new Map());\n\n\t\tconst registerSink = <K extends ContributionKind, TDecl>(\n\t\t\tsink: CapabilitySink<K, TDecl>,\n\t\t): Effect.Effect<void, never, Scope.Scope> =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst accept = sink.accept as SinkAccept;\n\t\t\t\tconst prior = yield* Ref.modify(sinksRef, (current) => {\n\t\t\t\t\tconst next = new Map(current);\n\t\t\t\t\tconst had = next.get(sink.kind) ?? null;\n\t\t\t\t\tnext.set(sink.kind, accept);\n\t\t\t\t\treturn [had, next];\n\t\t\t\t});\n\t\t\t\t// Scope finalizer: restore the prior sink (or remove\n\t\t\t\t// entirely) on scope close. Symmetric semantics — a\n\t\t\t\t// plugin-author overlay's scope close restores the\n\t\t\t\t// built-in.\n\t\t\t\tyield* Effect.addFinalizer((_exit) =>\n\t\t\t\t\tRef.update(sinksRef, (current) => {\n\t\t\t\t\t\tconst next = new Map(current);\n\t\t\t\t\t\tif (prior === null) next.delete(sink.kind);\n\t\t\t\t\t\telse next.set(sink.kind, prior);\n\t\t\t\t\t\treturn next;\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t\t\t'capability-sinks.kind': sink.kind,\n\t\t\t\t});\n\t\t\t}).pipe(Effect.withSpan('substrate.capabilitySinks.registerSink'));\n\n\t\tconst dispatch = (\n\t\t\tcontribution: AnyContribution,\n\t\t\tctx: HarvestContext,\n\t\t): Effect.Effect<void, UnknownContributionKind | ContributionSinkFailed, Scope.Scope> =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst kind = kindOf(contribution);\n\t\t\t\tconst sinks = yield* Ref.get(sinksRef);\n\t\t\t\tconst accept = sinks.get(kind);\n\t\t\t\tif (accept === undefined) {\n\t\t\t\t\treturn yield* new UnknownContributionKind({\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\tknown: [...sinks.keys()],\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst payload: unknown =\n\t\t\t\t\tcontribution.source === 'error' ? contribution.contribution : contribution.decl;\n\t\t\t\tyield* accept(payload, ctx).pipe(\n\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t(cause) =>\n\t\t\t\t\t\t\tnew ContributionSinkFailed({\n\t\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\t\tmessage: `capability sink '${kind}' failed`,\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t\t\t'capability-sinks.kind': kind,\n\t\t\t\t\t'devstack.plugin': ctx.pluginKey,\n\t\t\t\t});\n\t\t\t}).pipe(Effect.withSpan('substrate.capabilitySinks.dispatch'));\n\n\t\tconst knownKinds: Effect.Effect<ReadonlyArray<string>> = Effect.gen(function* () {\n\t\t\tconst sinks = yield* Ref.get(sinksRef);\n\t\t\treturn [...sinks.keys()];\n\t\t});\n\n\t\treturn CapabilitySinksService.of({ registerSink, dispatch, knownKinds });\n\t}),\n);\n"],"mappings":";;;;;;AA2FA,IAAa,0BAAb,cAA6C,KAAK,YAAY,0BAA0B,CAGrF;;;;;AAMH,IAAa,yBAAb,cAA4C,KAAK,YAAY,yBAAyB,CAInF;AA0BH,IAAa,yBAAb,cAA4C,QAAQ,SAGjD,CAAC,8CAA8C,CAAC;;;;;AAUnD,MAAa,UAAU,iBAAoD;AAC1E,KAAI,aAAa,WAAW,QAAS,QAAO;AAG5C,QAAO,aAAa,KAAK;;;;;;AAa1B,MAAa,uBAA4D,MAAM,OAC9E,wBACA,OAAO,IAAI,aAAa;CACvB,MAAM,WAAW,OAAO,IAAI,qBAAsC,IAAI,KAAK,CAAC;CAE5E,MAAM,gBACL,SAEA,OAAO,IAAI,aAAa;EACvB,MAAM,SAAS,KAAK;EACpB,MAAM,QAAQ,OAAO,IAAI,OAAO,WAAW,YAAY;GACtD,MAAM,OAAO,IAAI,IAAI,QAAQ;GAC7B,MAAM,MAAM,KAAK,IAAI,KAAK,KAAK,IAAI;AACnC,QAAK,IAAI,KAAK,MAAM,OAAO;AAC3B,UAAO,CAAC,KAAK,KAAK;IACjB;AAKF,SAAO,OAAO,cAAc,UAC3B,IAAI,OAAO,WAAW,YAAY;GACjC,MAAM,OAAO,IAAI,IAAI,QAAQ;AAC7B,OAAI,UAAU,KAAM,MAAK,OAAO,KAAK,KAAK;OACrC,MAAK,IAAI,KAAK,MAAM,MAAM;AAC/B,UAAO;IACN,CACF;AACD,SAAO,OAAO,oBAAoB,EACjC,yBAAyB,KAAK,MAC9B,CAAC;GACD,CAAC,KAAK,OAAO,SAAS,yCAAyC,CAAC;CAEnE,MAAM,YACL,cACA,QAEA,OAAO,IAAI,aAAa;EACvB,MAAM,OAAO,OAAO,aAAa;EACjC,MAAM,QAAQ,OAAO,IAAI,IAAI,SAAS;EACtC,MAAM,SAAS,MAAM,IAAI,KAAK;AAC9B,MAAI,WAAW,KAAA,EACd,QAAO,OAAO,IAAI,wBAAwB;GACzC;GACA,OAAO,CAAC,GAAG,MAAM,MAAM,CAAC;GACxB,CAAC;AAIH,SAAO,OADN,aAAa,WAAW,UAAU,aAAa,eAAe,aAAa,MACrD,IAAI,CAAC,KAC3B,OAAO,UACL,UACA,IAAI,uBAAuB;GAC1B;GACA,SAAS,oBAAoB,KAAK;GAClC;GACA,CAAC,CACH,CACD;AACD,SAAO,OAAO,oBAAoB;GACjC,yBAAyB;GACzB,mBAAmB,IAAI;GACvB,CAAC;GACD,CAAC,KAAK,OAAO,SAAS,qCAAqC,CAAC;CAE/D,MAAM,aAAmD,OAAO,IAAI,aAAa;AAEhF,SAAO,CAAC,IAAG,OADU,IAAI,IAAI,SAAS,EACrB,MAAM,CAAC;GACvB;AAEF,QAAO,uBAAuB,GAAG;EAAE;EAAc;EAAU;EAAY,CAAC;EACvE,CACF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
|
|
3
|
+
//#region src/substrate/runtime/config-validation.d.ts
|
|
4
|
+
declare namespace config_validation_d_exports {
|
|
5
|
+
export { ConfigErrorFactory, ConfigIssue, decodeConfig, decodeConfigSync, defineConfigError, expectNonEmptyArray, expectNonEmptyString, expectOneOf, expectOptionalNonEmptyString, expectOptionalPort, expectOptionalPositiveInteger, expectPattern, expectPort, expectPositiveFiniteNumber, expectPositiveInteger, expectStringRecord };
|
|
6
|
+
}
|
|
7
|
+
interface ConfigIssue {
|
|
8
|
+
readonly field: string;
|
|
9
|
+
readonly message: string;
|
|
10
|
+
readonly hint?: string;
|
|
11
|
+
readonly cause?: unknown;
|
|
12
|
+
}
|
|
13
|
+
type ConfigErrorFactory<E> = (issue: ConfigIssue) => E;
|
|
14
|
+
declare const defineConfigError: <const Tag extends string>(tag: Tag) => (issue: ConfigIssue) => ConfigIssue & {
|
|
15
|
+
readonly _tag: Tag;
|
|
16
|
+
};
|
|
17
|
+
interface ValidatorOptions<E> {
|
|
18
|
+
readonly field: string;
|
|
19
|
+
readonly mkError: ConfigErrorFactory<E>;
|
|
20
|
+
readonly message?: string;
|
|
21
|
+
readonly hint?: string;
|
|
22
|
+
}
|
|
23
|
+
declare const expectNonEmptyString: <E>(value: unknown, options: ValidatorOptions<E>) => string;
|
|
24
|
+
declare const expectOptionalNonEmptyString: <E>(value: unknown, options: ValidatorOptions<E>) => string | undefined;
|
|
25
|
+
declare const expectPositiveInteger: <E>(value: unknown, options: ValidatorOptions<E>) => number;
|
|
26
|
+
declare const expectOptionalPositiveInteger: <E>(value: unknown, options: ValidatorOptions<E>) => number | undefined;
|
|
27
|
+
declare const expectPositiveFiniteNumber: <E>(value: unknown, options: ValidatorOptions<E>) => number;
|
|
28
|
+
declare const expectPort: <E>(value: unknown, options: ValidatorOptions<E>) => number;
|
|
29
|
+
declare const expectOptionalPort: <E>(value: unknown, options: ValidatorOptions<E>) => number | undefined;
|
|
30
|
+
declare const expectStringRecord: <E>(value: unknown, options: ValidatorOptions<E>) => Readonly<Record<string, string>>;
|
|
31
|
+
declare const expectOneOf: <const Values extends ReadonlyArray<string>, E>(value: unknown, values: Values, options: ValidatorOptions<E>) => Values[number];
|
|
32
|
+
declare const expectNonEmptyArray: <T, E>(value: ReadonlyArray<T> | undefined, options: ValidatorOptions<E>) => ReadonlyArray<T>;
|
|
33
|
+
declare const expectPattern: <E>(value: string, pattern: RegExp, options: ValidatorOptions<E>) => string;
|
|
34
|
+
declare const decodeConfig: <S extends Schema.Decoder<unknown>, E>(schema: S, value: unknown, options: ValidatorOptions<E>) => Effect.Effect<S["Type"], E>;
|
|
35
|
+
declare const decodeConfigSync: <S extends Schema.Decoder<unknown>, E>(schema: S, value: unknown, options: ValidatorOptions<E>) => S["Type"];
|
|
36
|
+
//#endregion
|
|
37
|
+
export { ConfigIssue, config_validation_d_exports };
|
|
38
|
+
//# sourceMappingURL=config-validation.d.mts.map
|