@mysten-incubation/devstack 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +189 -0
- package/README.md +94 -0
- package/dist/_virtual/_rolldown/runtime.mjs +13 -0
- package/dist/api/define-capabilities.d.mts +25 -0
- package/dist/api/define-capabilities.mjs +19 -0
- package/dist/api/define-capabilities.mjs.map +1 -0
- package/dist/api/define-devstack-with.d.mts +41 -0
- package/dist/api/define-devstack-with.mjs +24 -0
- package/dist/api/define-devstack-with.mjs.map +1 -0
- package/dist/api/define-devstack.d.mts +62 -0
- package/dist/api/define-devstack.mjs +108 -0
- package/dist/api/define-devstack.mjs.map +1 -0
- package/dist/api/define-plugin.d.mts +1 -0
- package/dist/api/inference-network.mjs +122 -0
- package/dist/api/inference-network.mjs.map +1 -0
- package/dist/api/mode-narrowed-factory.d.mts +26 -0
- package/dist/api/mode-narrowed-factory.mjs +8 -0
- package/dist/api/mode-narrowed-factory.mjs.map +1 -0
- package/dist/api/plugin-errors.mjs +10 -0
- package/dist/api/plugin-errors.mjs.map +1 -0
- package/dist/api/run-stack.d.mts +82 -0
- package/dist/api/run-stack.mjs +127 -0
- package/dist/api/run-stack.mjs.map +1 -0
- package/dist/build-integrations/playwright/config.d.mts +92 -0
- package/dist/build-integrations/playwright/config.mjs +71 -0
- package/dist/build-integrations/playwright/config.mjs.map +1 -0
- package/dist/build-integrations/playwright/errors.d.mts +82 -0
- package/dist/build-integrations/playwright/errors.mjs +43 -0
- package/dist/build-integrations/playwright/errors.mjs.map +1 -0
- package/dist/build-integrations/playwright/global-setup.d.mts +64 -0
- package/dist/build-integrations/playwright/global-setup.mjs +44 -0
- package/dist/build-integrations/playwright/global-setup.mjs.map +1 -0
- package/dist/build-integrations/playwright/index.d.mts +6 -0
- package/dist/build-integrations/playwright/index.mjs +6 -0
- package/dist/build-integrations/playwright/stack-context.d.mts +95 -0
- package/dist/build-integrations/playwright/stack-context.mjs +277 -0
- package/dist/build-integrations/playwright/stack-context.mjs.map +1 -0
- package/dist/build-integrations/playwright/wallet-context.d.mts +87 -0
- package/dist/build-integrations/playwright/wallet-context.mjs +148 -0
- package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -0
- package/dist/build-integrations/runtime/cold-start-url.d.mts +67 -0
- package/dist/build-integrations/runtime/cold-start-url.mjs +56 -0
- package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -0
- package/dist/build-integrations/runtime/dapp-kit-slot.mjs +10 -0
- package/dist/build-integrations/runtime/dapp-kit-slot.mjs.map +1 -0
- package/dist/build-integrations/runtime/discover.d.mts +78 -0
- package/dist/build-integrations/runtime/discover.mjs +124 -0
- package/dist/build-integrations/runtime/discover.mjs.map +1 -0
- package/dist/build-integrations/runtime/endpoint-registry.d.mts +26 -0
- package/dist/build-integrations/runtime/endpoint-registry.mjs +41 -0
- package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -0
- package/dist/build-integrations/runtime/errors.d.mts +64 -0
- package/dist/build-integrations/runtime/errors.mjs +51 -0
- package/dist/build-integrations/runtime/errors.mjs.map +1 -0
- package/dist/build-integrations/runtime/index.d.mts +7 -0
- package/dist/build-integrations/runtime/index.mjs +6 -0
- package/dist/build-integrations/runtime/read-stack-context.d.mts +38 -0
- package/dist/build-integrations/runtime/read-stack-context.mjs +130 -0
- package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -0
- package/dist/build-integrations/runtime/stack-context.d.mts +53 -0
- package/dist/build-integrations/vitest/config.d.mts +62 -0
- package/dist/build-integrations/vitest/config.mjs +80 -0
- package/dist/build-integrations/vitest/config.mjs.map +1 -0
- package/dist/build-integrations/vitest/env.d.mts +48 -0
- package/dist/build-integrations/vitest/env.mjs +50 -0
- package/dist/build-integrations/vitest/env.mjs.map +1 -0
- package/dist/build-integrations/vitest/errors.d.mts +44 -0
- package/dist/build-integrations/vitest/errors.mjs +18 -0
- package/dist/build-integrations/vitest/errors.mjs.map +1 -0
- package/dist/build-integrations/vitest/index.d.mts +6 -0
- package/dist/build-integrations/vitest/index.mjs +6 -0
- package/dist/build-integrations/vitest/setup.d.mts +53 -0
- package/dist/build-integrations/vitest/setup.mjs +56 -0
- package/dist/build-integrations/vitest/setup.mjs.map +1 -0
- package/dist/build-integrations/vitest/stack-context.d.mts +58 -0
- package/dist/build-integrations/vitest/stack-context.mjs +67 -0
- package/dist/build-integrations/vitest/stack-context.mjs.map +1 -0
- package/dist/cli/main.d.mts +5 -0
- package/dist/cli/main.mjs +586 -0
- package/dist/cli/main.mjs.map +1 -0
- package/dist/cli/prune-direct.mjs +216 -0
- package/dist/cli/prune-direct.mjs.map +1 -0
- package/dist/cli/snapshot-reader.mjs +73 -0
- package/dist/cli/snapshot-reader.mjs.map +1 -0
- package/dist/cli/up-lifecycle.mjs +28 -0
- package/dist/cli/up-lifecycle.mjs.map +1 -0
- package/dist/contracts/capability-decl.d.mts +42 -0
- package/dist/contracts/chain-probe.d.mts +26 -0
- package/dist/contracts/chain-probe.mjs +8 -0
- package/dist/contracts/chain-probe.mjs.map +1 -0
- package/dist/contracts/codegenable.d.mts +43 -0
- package/dist/contracts/container-runtime.d.mts +245 -0
- package/dist/contracts/liveness-classifier.d.mts +19 -0
- package/dist/contracts/network-resolver.d.mts +15 -0
- package/dist/contracts/network-resolver.mjs +7 -0
- package/dist/contracts/network-resolver.mjs.map +1 -0
- package/dist/contracts/projection.d.mts +15 -0
- package/dist/contracts/routable.d.mts +53 -0
- package/dist/contracts/snapshotable.d.mts +39 -0
- package/dist/contracts/strategy-contributor.d.mts +26 -0
- package/dist/index.d.mts +89 -0
- package/dist/index.mjs +37 -0
- package/dist/orchestrators/codegen/bindings.d.mts +2 -0
- package/dist/orchestrators/codegen/bindings.mjs +340 -0
- package/dist/orchestrators/codegen/bindings.mjs.map +1 -0
- package/dist/orchestrators/codegen/emit.mjs +56 -0
- package/dist/orchestrators/codegen/emit.mjs.map +1 -0
- package/dist/orchestrators/codegen/errors.d.mts +1 -0
- package/dist/orchestrators/codegen/errors.mjs +66 -0
- package/dist/orchestrators/codegen/errors.mjs.map +1 -0
- package/dist/orchestrators/codegen/extras.mjs +16 -0
- package/dist/orchestrators/codegen/extras.mjs.map +1 -0
- package/dist/orchestrators/codegen/format.mjs +109 -0
- package/dist/orchestrators/codegen/format.mjs.map +1 -0
- package/dist/orchestrators/codegen/gitignore.mjs +67 -0
- package/dist/orchestrators/codegen/gitignore.mjs.map +1 -0
- package/dist/orchestrators/codegen/paths.d.mts +1 -0
- package/dist/orchestrators/codegen/paths.mjs +33 -0
- package/dist/orchestrators/codegen/paths.mjs.map +1 -0
- package/dist/orchestrators/codegen/permissions.mjs +6 -0
- package/dist/orchestrators/codegen/permissions.mjs.map +1 -0
- package/dist/orchestrators/codegen/service.d.mts +1 -0
- package/dist/orchestrators/codegen/service.mjs +276 -0
- package/dist/orchestrators/codegen/service.mjs.map +1 -0
- package/dist/orchestrators/router/cleanup.mjs +58 -0
- package/dist/orchestrators/router/cleanup.mjs.map +1 -0
- package/dist/orchestrators/router/cors.mjs +31 -0
- package/dist/orchestrators/router/cors.mjs.map +1 -0
- package/dist/orchestrators/router/entrypoints.d.mts +1 -0
- package/dist/orchestrators/router/entrypoints.mjs +80 -0
- package/dist/orchestrators/router/entrypoints.mjs.map +1 -0
- package/dist/orchestrators/router/errors.d.mts +1 -0
- package/dist/orchestrators/router/errors.mjs +103 -0
- package/dist/orchestrators/router/errors.mjs.map +1 -0
- package/dist/orchestrators/router/file-provider.d.mts +1 -0
- package/dist/orchestrators/router/file-provider.mjs +320 -0
- package/dist/orchestrators/router/file-provider.mjs.map +1 -0
- package/dist/orchestrators/router/hostname.d.mts +1 -0
- package/dist/orchestrators/router/hostname.mjs +107 -0
- package/dist/orchestrators/router/hostname.mjs.map +1 -0
- package/dist/orchestrators/router/index.d.mts +1 -0
- package/dist/orchestrators/router/profile.d.mts +1 -0
- package/dist/orchestrators/router/profile.mjs +109 -0
- package/dist/orchestrators/router/profile.mjs.map +1 -0
- package/dist/orchestrators/router/service.d.mts +3 -0
- package/dist/orchestrators/router/service.mjs +421 -0
- package/dist/orchestrators/router/service.mjs.map +1 -0
- package/dist/orchestrators/router/traefik-container.d.mts +1 -0
- package/dist/orchestrators/router/traefik-container.mjs +229 -0
- package/dist/orchestrators/router/traefik-container.mjs.map +1 -0
- package/dist/orchestrators/runtime-composition.d.mts +10 -0
- package/dist/orchestrators/runtime-composition.mjs +168 -0
- package/dist/orchestrators/runtime-composition.mjs.map +1 -0
- package/dist/orchestrators/snapshot/capture.d.mts +1 -0
- package/dist/orchestrators/snapshot/capture.mjs +350 -0
- package/dist/orchestrators/snapshot/capture.mjs.map +1 -0
- package/dist/orchestrators/snapshot/descriptor.d.mts +1 -0
- package/dist/orchestrators/snapshot/descriptor.mjs +109 -0
- package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -0
- package/dist/orchestrators/snapshot/identity-guard.d.mts +1 -0
- package/dist/orchestrators/snapshot/identity-guard.mjs +132 -0
- package/dist/orchestrators/snapshot/identity-guard.mjs.map +1 -0
- package/dist/orchestrators/snapshot/image-bundle-tags.mjs +207 -0
- package/dist/orchestrators/snapshot/image-bundle-tags.mjs.map +1 -0
- package/dist/orchestrators/snapshot/index.d.mts +1 -0
- package/dist/orchestrators/snapshot/integrity.d.mts +1 -0
- package/dist/orchestrators/snapshot/integrity.mjs +74 -0
- package/dist/orchestrators/snapshot/integrity.mjs.map +1 -0
- package/dist/orchestrators/snapshot/prune.d.mts +1 -0
- package/dist/orchestrators/snapshot/prune.mjs +110 -0
- package/dist/orchestrators/snapshot/prune.mjs.map +1 -0
- package/dist/orchestrators/snapshot/restore.d.mts +1 -0
- package/dist/orchestrators/snapshot/restore.mjs +404 -0
- package/dist/orchestrators/snapshot/restore.mjs.map +1 -0
- package/dist/orchestrators/snapshot/service.d.mts +1 -0
- package/dist/orchestrators/snapshot/service.mjs +296 -0
- package/dist/orchestrators/snapshot/service.mjs.map +1 -0
- package/dist/orchestrators/snapshot/state-document.mjs +18 -0
- package/dist/orchestrators/snapshot/state-document.mjs.map +1 -0
- package/dist/orchestrators/snapshot/wipe.d.mts +1 -0
- package/dist/orchestrators/snapshot/wipe.mjs +59 -0
- package/dist/orchestrators/snapshot/wipe.mjs.map +1 -0
- package/dist/plugins/account/codegen.d.mts +12 -0
- package/dist/plugins/account/codegen.mjs +22 -0
- package/dist/plugins/account/codegen.mjs.map +1 -0
- package/dist/plugins/account/errors.d.mts +44 -0
- package/dist/plugins/account/errors.mjs +16 -0
- package/dist/plugins/account/errors.mjs.map +1 -0
- package/dist/plugins/account/funding.d.mts +94 -0
- package/dist/plugins/account/funding.mjs +199 -0
- package/dist/plugins/account/funding.mjs.map +1 -0
- package/dist/plugins/account/index.d.mts +54 -0
- package/dist/plugins/account/index.mjs +151 -0
- package/dist/plugins/account/index.mjs.map +1 -0
- package/dist/plugins/account/keypair.d.mts +32 -0
- package/dist/plugins/account/keypair.mjs +99 -0
- package/dist/plugins/account/keypair.mjs.map +1 -0
- package/dist/plugins/account/lease.mjs +21 -0
- package/dist/plugins/account/lease.mjs.map +1 -0
- package/dist/plugins/account/registry.d.mts +33 -0
- package/dist/plugins/account/registry.mjs +36 -0
- package/dist/plugins/account/registry.mjs.map +1 -0
- package/dist/plugins/account/service.d.mts +104 -0
- package/dist/plugins/account/service.mjs +405 -0
- package/dist/plugins/account/service.mjs.map +1 -0
- package/dist/plugins/account/snapshot.mjs +33 -0
- package/dist/plugins/account/snapshot.mjs.map +1 -0
- package/dist/plugins/account/variants/env.mjs +24 -0
- package/dist/plugins/account/variants/env.mjs.map +1 -0
- package/dist/plugins/account/variants/ephemeral.mjs +72 -0
- package/dist/plugins/account/variants/ephemeral.mjs.map +1 -0
- package/dist/plugins/account/variants/impersonate.d.mts +16 -0
- package/dist/plugins/account/variants/impersonate.mjs +48 -0
- package/dist/plugins/account/variants/impersonate.mjs.map +1 -0
- package/dist/plugins/account/variants/inline.mjs +13 -0
- package/dist/plugins/account/variants/inline.mjs.map +1 -0
- package/dist/plugins/account/variants/keystore.mjs +93 -0
- package/dist/plugins/account/variants/keystore.mjs.map +1 -0
- package/dist/plugins/account/variants/signer.mjs +31 -0
- package/dist/plugins/account/variants/signer.mjs.map +1 -0
- package/dist/plugins/action/build-context.d.mts +41 -0
- package/dist/plugins/action/discriminator.d.mts +20 -0
- package/dist/plugins/action/discriminator.mjs +13 -0
- package/dist/plugins/action/discriminator.mjs.map +1 -0
- package/dist/plugins/action/errors.d.mts +31 -0
- package/dist/plugins/action/errors.mjs +13 -0
- package/dist/plugins/action/errors.mjs.map +1 -0
- package/dist/plugins/action/execute.d.mts +2 -0
- package/dist/plugins/action/execute.mjs +145 -0
- package/dist/plugins/action/execute.mjs.map +1 -0
- package/dist/plugins/action/index.d.mts +56 -0
- package/dist/plugins/action/index.mjs +82 -0
- package/dist/plugins/action/index.mjs.map +1 -0
- package/dist/plugins/action/service.d.mts +26 -0
- package/dist/plugins/action/service.mjs +84 -0
- package/dist/plugins/action/service.mjs.map +1 -0
- package/dist/plugins/coin/address-resolution.d.mts +34 -0
- package/dist/plugins/coin/address-resolution.mjs +80 -0
- package/dist/plugins/coin/address-resolution.mjs.map +1 -0
- package/dist/plugins/coin/codegen.d.mts +16 -0
- package/dist/plugins/coin/codegen.mjs +21 -0
- package/dist/plugins/coin/codegen.mjs.map +1 -0
- package/dist/plugins/coin/discovery.d.mts +26 -0
- package/dist/plugins/coin/discovery.mjs +112 -0
- package/dist/plugins/coin/discovery.mjs.map +1 -0
- package/dist/plugins/coin/errors.d.mts +48 -0
- package/dist/plugins/coin/errors.mjs +13 -0
- package/dist/plugins/coin/errors.mjs.map +1 -0
- package/dist/plugins/coin/index.d.mts +95 -0
- package/dist/plugins/coin/index.mjs +172 -0
- package/dist/plugins/coin/index.mjs.map +1 -0
- package/dist/plugins/coin/metadata.d.mts +15 -0
- package/dist/plugins/coin/metadata.mjs +99 -0
- package/dist/plugins/coin/metadata.mjs.map +1 -0
- package/dist/plugins/coin/mint.d.mts +34 -0
- package/dist/plugins/coin/mint.mjs +164 -0
- package/dist/plugins/coin/mint.mjs.map +1 -0
- package/dist/plugins/coin/registry.d.mts +1 -0
- package/dist/plugins/coin/registry.mjs +37 -0
- package/dist/plugins/coin/registry.mjs.map +1 -0
- package/dist/plugins/coin/service.d.mts +47 -0
- package/dist/plugins/coin/service.mjs +51 -0
- package/dist/plugins/coin/service.mjs.map +1 -0
- package/dist/plugins/coin/snapshot.mjs +19 -0
- package/dist/plugins/coin/snapshot.mjs.map +1 -0
- package/dist/plugins/coin/type-strings.mjs +49 -0
- package/dist/plugins/coin/type-strings.mjs.map +1 -0
- package/dist/plugins/deepbook/codegen.d.mts +39 -0
- package/dist/plugins/deepbook/codegen.mjs +15 -0
- package/dist/plugins/deepbook/codegen.mjs.map +1 -0
- package/dist/plugins/deepbook/deploy.mjs +437 -0
- package/dist/plugins/deepbook/deploy.mjs.map +1 -0
- package/dist/plugins/deepbook/errors.d.mts +29 -0
- package/dist/plugins/deepbook/errors.mjs +26 -0
- package/dist/plugins/deepbook/errors.mjs.map +1 -0
- package/dist/plugins/deepbook/faucet-strategy.d.mts +8 -0
- package/dist/plugins/deepbook/faucet-strategy.mjs +81 -0
- package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -0
- package/dist/plugins/deepbook/index.d.mts +171 -0
- package/dist/plugins/deepbook/index.mjs +359 -0
- package/dist/plugins/deepbook/index.mjs.map +1 -0
- package/dist/plugins/deepbook/plugin-key.mjs +7 -0
- package/dist/plugins/deepbook/plugin-key.mjs.map +1 -0
- package/dist/plugins/deepbook/pyth/index.mjs +226 -0
- package/dist/plugins/deepbook/pyth/index.mjs.map +1 -0
- package/dist/plugins/deepbook/routable.mjs +21 -0
- package/dist/plugins/deepbook/routable.mjs.map +1 -0
- package/dist/plugins/deepbook/snapshot.mjs +49 -0
- package/dist/plugins/deepbook/snapshot.mjs.map +1 -0
- package/dist/plugins/deepbook/types.d.mts +125 -0
- package/dist/plugins/deepbook/types.mjs +12 -0
- package/dist/plugins/deepbook/types.mjs.map +1 -0
- package/dist/plugins/faucet/dispatcher.d.mts +9 -0
- package/dist/plugins/faucet/dispatcher.mjs +13 -0
- package/dist/plugins/faucet/dispatcher.mjs.map +1 -0
- package/dist/plugins/faucet/errors.d.mts +86 -0
- package/dist/plugins/faucet/errors.mjs +19 -0
- package/dist/plugins/faucet/errors.mjs.map +1 -0
- package/dist/plugins/faucet/http.mjs +127 -0
- package/dist/plugins/faucet/http.mjs.map +1 -0
- package/dist/plugins/faucet/index.d.mts +43 -0
- package/dist/plugins/faucet/index.mjs +42 -0
- package/dist/plugins/faucet/index.mjs.map +1 -0
- package/dist/plugins/faucet/service.d.mts +20 -0
- package/dist/plugins/faucet/strategies/sui-local.d.mts +23 -0
- package/dist/plugins/faucet/strategies/sui-local.mjs +29 -0
- package/dist/plugins/faucet/strategies/sui-local.mjs.map +1 -0
- package/dist/plugins/host-service/errors.d.mts +27 -0
- package/dist/plugins/host-service/errors.mjs +14 -0
- package/dist/plugins/host-service/errors.mjs.map +1 -0
- package/dist/plugins/host-service/index.d.mts +10 -0
- package/dist/plugins/host-service/index.mjs +48 -0
- package/dist/plugins/host-service/index.mjs.map +1 -0
- package/dist/plugins/host-service/routable.mjs +24 -0
- package/dist/plugins/host-service/routable.mjs.map +1 -0
- package/dist/plugins/host-service/service.d.mts +49 -0
- package/dist/plugins/host-service/service.mjs +375 -0
- package/dist/plugins/host-service/service.mjs.map +1 -0
- package/dist/plugins/package/build.d.mts +1 -0
- package/dist/plugins/package/build.mjs +24 -0
- package/dist/plugins/package/build.mjs.map +1 -0
- package/dist/plugins/package/codegen.d.mts +19 -0
- package/dist/plugins/package/codegen.mjs +41 -0
- package/dist/plugins/package/codegen.mjs.map +1 -0
- package/dist/plugins/package/dep-resolution.mjs +10 -0
- package/dist/plugins/package/dep-resolution.mjs.map +1 -0
- package/dist/plugins/package/errors.d.mts +34 -0
- package/dist/plugins/package/errors.mjs +13 -0
- package/dist/plugins/package/errors.mjs.map +1 -0
- package/dist/plugins/package/index.d.mts +109 -0
- package/dist/plugins/package/index.mjs +207 -0
- package/dist/plugins/package/index.mjs.map +1 -0
- package/dist/plugins/package/mode-known.mjs +41 -0
- package/dist/plugins/package/mode-known.mjs.map +1 -0
- package/dist/plugins/package/mode-local.d.mts +1 -0
- package/dist/plugins/package/mode-local.mjs +183 -0
- package/dist/plugins/package/mode-local.mjs.map +1 -0
- package/dist/plugins/package/publish-executor.mjs +202 -0
- package/dist/plugins/package/publish-executor.mjs.map +1 -0
- package/dist/plugins/package/publish-output.d.mts +28 -0
- package/dist/plugins/package/publish-output.mjs +45 -0
- package/dist/plugins/package/publish-output.mjs.map +1 -0
- package/dist/plugins/package/registry.d.mts +25 -0
- package/dist/plugins/package/registry.mjs +30 -0
- package/dist/plugins/package/registry.mjs.map +1 -0
- package/dist/plugins/package/service.mjs +20 -0
- package/dist/plugins/package/service.mjs.map +1 -0
- package/dist/plugins/package/snapshot.mjs +25 -0
- package/dist/plugins/package/snapshot.mjs.map +1 -0
- package/dist/plugins/postgres/codegen.mjs +42 -0
- package/dist/plugins/postgres/codegen.mjs.map +1 -0
- package/dist/plugins/postgres/connection.d.mts +33 -0
- package/dist/plugins/postgres/connection.mjs +19 -0
- package/dist/plugins/postgres/connection.mjs.map +1 -0
- package/dist/plugins/postgres/db-ensure.mjs +100 -0
- package/dist/plugins/postgres/db-ensure.mjs.map +1 -0
- package/dist/plugins/postgres/errors.d.mts +55 -0
- package/dist/plugins/postgres/errors.mjs +29 -0
- package/dist/plugins/postgres/errors.mjs.map +1 -0
- package/dist/plugins/postgres/index.d.mts +37 -0
- package/dist/plugins/postgres/index.mjs +75 -0
- package/dist/plugins/postgres/index.mjs.map +1 -0
- package/dist/plugins/postgres/routable.mjs +33 -0
- package/dist/plugins/postgres/routable.mjs.map +1 -0
- package/dist/plugins/postgres/service.d.mts +50 -0
- package/dist/plugins/postgres/service.mjs +145 -0
- package/dist/plugins/postgres/service.mjs.map +1 -0
- package/dist/plugins/postgres/snapshot.d.mts +1 -0
- package/dist/plugins/postgres/snapshot.mjs +32 -0
- package/dist/plugins/postgres/snapshot.mjs.map +1 -0
- package/dist/plugins/router-entrypoints.mjs +21 -0
- package/dist/plugins/router-entrypoints.mjs.map +1 -0
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +59 -0
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -0
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +132 -0
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -0
- package/dist/plugins/seal/codegen.d.mts +19 -0
- package/dist/plugins/seal/codegen.mjs +16 -0
- package/dist/plugins/seal/codegen.mjs.map +1 -0
- package/dist/plugins/seal/config-render.mjs +82 -0
- package/dist/plugins/seal/config-render.mjs.map +1 -0
- package/dist/plugins/seal/deploy.mjs +198 -0
- package/dist/plugins/seal/deploy.mjs.map +1 -0
- package/dist/plugins/seal/errors.d.mts +52 -0
- package/dist/plugins/seal/errors.mjs +19 -0
- package/dist/plugins/seal/errors.mjs.map +1 -0
- package/dist/plugins/seal/index.d.mts +161 -0
- package/dist/plugins/seal/index.mjs +235 -0
- package/dist/plugins/seal/index.mjs.map +1 -0
- package/dist/plugins/seal/key-manager.d.mts +22 -0
- package/dist/plugins/seal/key-manager.mjs +22 -0
- package/dist/plugins/seal/key-manager.mjs.map +1 -0
- package/dist/plugins/seal/key-server.mjs +175 -0
- package/dist/plugins/seal/key-server.mjs.map +1 -0
- package/dist/plugins/seal/keygen.mjs +96 -0
- package/dist/plugins/seal/keygen.mjs.map +1 -0
- package/dist/plugins/seal/mode/fork-known.d.mts +8 -0
- package/dist/plugins/seal/mode/fork-known.mjs +23 -0
- package/dist/plugins/seal/mode/fork-known.mjs.map +1 -0
- package/dist/plugins/seal/mode/live.d.mts +18 -0
- package/dist/plugins/seal/mode/live.mjs +64 -0
- package/dist/plugins/seal/mode/live.mjs.map +1 -0
- package/dist/plugins/seal/mode/local-keygen.mjs +180 -0
- package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -0
- package/dist/plugins/seal/plugin-key.mjs +7 -0
- package/dist/plugins/seal/plugin-key.mjs.map +1 -0
- package/dist/plugins/seal/registry-publish.d.mts +43 -0
- package/dist/plugins/seal/registry-publish.mjs +9 -0
- package/dist/plugins/seal/registry-publish.mjs.map +1 -0
- package/dist/plugins/seal/routable.mjs +57 -0
- package/dist/plugins/seal/routable.mjs.map +1 -0
- package/dist/plugins/seal/service.mjs +17 -0
- package/dist/plugins/seal/service.mjs.map +1 -0
- package/dist/plugins/seal/snapshot.mjs +51 -0
- package/dist/plugins/seal/snapshot.mjs.map +1 -0
- package/dist/plugins/sui/auto-tick.mjs +45 -0
- package/dist/plugins/sui/auto-tick.mjs.map +1 -0
- package/dist/plugins/sui/chain-build-container.d.mts +1 -0
- package/dist/plugins/sui/chain-probe.d.mts +85 -0
- package/dist/plugins/sui/chain-probe.mjs +104 -0
- package/dist/plugins/sui/chain-probe.mjs.map +1 -0
- package/dist/plugins/sui/codegen.d.mts +14 -0
- package/dist/plugins/sui/codegen.mjs +26 -0
- package/dist/plugins/sui/codegen.mjs.map +1 -0
- package/dist/plugins/sui/errors.d.mts +74 -0
- package/dist/plugins/sui/errors.mjs +28 -0
- package/dist/plugins/sui/errors.mjs.map +1 -0
- package/dist/plugins/sui/fork-orchestration.mjs +24 -0
- package/dist/plugins/sui/fork-orchestration.mjs.map +1 -0
- package/dist/plugins/sui/fork-transaction.mjs +96 -0
- package/dist/plugins/sui/fork-transaction.mjs.map +1 -0
- package/dist/plugins/sui/index.d.mts +318 -0
- package/dist/plugins/sui/index.mjs +182 -0
- package/dist/plugins/sui/index.mjs.map +1 -0
- package/dist/plugins/sui/mode/external.mjs +60 -0
- package/dist/plugins/sui/mode/external.mjs.map +1 -0
- package/dist/plugins/sui/mode/fork.mjs +283 -0
- package/dist/plugins/sui/mode/fork.mjs.map +1 -0
- package/dist/plugins/sui/mode/live.mjs +103 -0
- package/dist/plugins/sui/mode/live.mjs.map +1 -0
- package/dist/plugins/sui/mode/local.mjs +293 -0
- package/dist/plugins/sui/mode/local.mjs.map +1 -0
- package/dist/plugins/sui/mode/shared-boot.mjs +254 -0
- package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -0
- package/dist/plugins/sui/mode/shared.d.mts +103 -0
- package/dist/plugins/sui/mode/shared.mjs +12 -0
- package/dist/plugins/sui/mode/shared.mjs.map +1 -0
- package/dist/plugins/sui/mode/spec.d.mts +94 -0
- package/dist/plugins/sui/network-resolver.d.mts +23 -0
- package/dist/plugins/sui/routable.mjs +88 -0
- package/dist/plugins/sui/routable.mjs.map +1 -0
- package/dist/plugins/sui/seed-objects.d.mts +18 -0
- package/dist/plugins/sui/seed-objects.mjs +25 -0
- package/dist/plugins/sui/seed-objects.mjs.map +1 -0
- package/dist/plugins/sui/service.mjs +38 -0
- package/dist/plugins/sui/service.mjs.map +1 -0
- package/dist/plugins/sui/snapshot.mjs +53 -0
- package/dist/plugins/sui/snapshot.mjs.map +1 -0
- package/dist/plugins/wallet/codegen.d.mts +33 -0
- package/dist/plugins/wallet/codegen.mjs +34 -0
- package/dist/plugins/wallet/codegen.mjs.map +1 -0
- package/dist/plugins/wallet/errors.d.mts +66 -0
- package/dist/plugins/wallet/errors.mjs +16 -0
- package/dist/plugins/wallet/errors.mjs.map +1 -0
- package/dist/plugins/wallet/index.d.mts +63 -0
- package/dist/plugins/wallet/index.mjs +126 -0
- package/dist/plugins/wallet/index.mjs.map +1 -0
- package/dist/plugins/wallet/origin-policy.d.mts +1 -0
- package/dist/plugins/wallet/origin-policy.mjs +65 -0
- package/dist/plugins/wallet/origin-policy.mjs.map +1 -0
- package/dist/plugins/wallet/pairing.d.mts +11 -0
- package/dist/plugins/wallet/pairing.mjs +125 -0
- package/dist/plugins/wallet/pairing.mjs.map +1 -0
- package/dist/plugins/wallet/protocol.d.mts +1 -0
- package/dist/plugins/wallet/protocol.mjs +96 -0
- package/dist/plugins/wallet/protocol.mjs.map +1 -0
- package/dist/plugins/wallet/routable.mjs +32 -0
- package/dist/plugins/wallet/routable.mjs.map +1 -0
- package/dist/plugins/wallet/server.d.mts +12 -0
- package/dist/plugins/wallet/server.mjs +317 -0
- package/dist/plugins/wallet/server.mjs.map +1 -0
- package/dist/plugins/wallet/service.d.mts +68 -0
- package/dist/plugins/wallet/service.mjs +97 -0
- package/dist/plugins/wallet/service.mjs.map +1 -0
- package/dist/plugins/wallet/snapshot.d.mts +1 -0
- package/dist/plugins/wallet/snapshot.mjs +14 -0
- package/dist/plugins/wallet/snapshot.mjs.map +1 -0
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +42 -0
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -0
- package/dist/plugins/walrus/codegen.d.mts +38 -0
- package/dist/plugins/walrus/codegen.mjs +34 -0
- package/dist/plugins/walrus/codegen.mjs.map +1 -0
- package/dist/plugins/walrus/deploy-paths.mjs +14 -0
- package/dist/plugins/walrus/deploy-paths.mjs.map +1 -0
- package/dist/plugins/walrus/deploy.d.mts +1 -0
- package/dist/plugins/walrus/deploy.mjs +224 -0
- package/dist/plugins/walrus/deploy.mjs.map +1 -0
- package/dist/plugins/walrus/errors.d.mts +38 -0
- package/dist/plugins/walrus/errors.mjs +26 -0
- package/dist/plugins/walrus/errors.mjs.map +1 -0
- package/dist/plugins/walrus/faucet-strategy.d.mts +12 -0
- package/dist/plugins/walrus/faucet-strategy.mjs +62 -0
- package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -0
- package/dist/plugins/walrus/index.d.mts +177 -0
- package/dist/plugins/walrus/index.mjs +284 -0
- package/dist/plugins/walrus/index.mjs.map +1 -0
- package/dist/plugins/walrus/mode/known-deploy.d.mts +25 -0
- package/dist/plugins/walrus/mode/known-deploy.mjs +71 -0
- package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -0
- package/dist/plugins/walrus/mode/local-cluster.d.mts +34 -0
- package/dist/plugins/walrus/mode/local-cluster.mjs +153 -0
- package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -0
- package/dist/plugins/walrus/plugin-key.mjs +7 -0
- package/dist/plugins/walrus/plugin-key.mjs.map +1 -0
- package/dist/plugins/walrus/registry-publish.d.mts +24 -0
- package/dist/plugins/walrus/registry-publish.mjs +7 -0
- package/dist/plugins/walrus/registry-publish.mjs.map +1 -0
- package/dist/plugins/walrus/routable.mjs +99 -0
- package/dist/plugins/walrus/routable.mjs.map +1 -0
- package/dist/plugins/walrus/service.mjs +20 -0
- package/dist/plugins/walrus/service.mjs.map +1 -0
- package/dist/plugins/walrus/snapshot.mjs +53 -0
- package/dist/plugins/walrus/snapshot.mjs.map +1 -0
- package/dist/plugins/walrus/storage-nodes.d.mts +15 -0
- package/dist/plugins/walrus/storage-nodes.mjs +154 -0
- package/dist/plugins/walrus/storage-nodes.mjs.map +1 -0
- package/dist/plugins/walrus/wal-swap.d.mts +2 -0
- package/dist/plugins/walrus/wal-swap.mjs +58 -0
- package/dist/plugins/walrus/wal-swap.mjs.map +1 -0
- package/dist/primitives/artifact-publisher.d.mts +12 -0
- package/dist/primitives/cache.d.mts +1 -0
- package/dist/runtime/built-in-plugin-layers.mjs +49 -0
- package/dist/runtime/built-in-plugin-layers.mjs.map +1 -0
- package/dist/runtime/docker/client.d.mts +2 -0
- package/dist/runtime/docker/client.mjs +54 -0
- package/dist/runtime/docker/client.mjs.map +1 -0
- package/dist/runtime/docker/container.d.mts +1 -0
- package/dist/runtime/docker/container.mjs +562 -0
- package/dist/runtime/docker/container.mjs.map +1 -0
- package/dist/runtime/docker/errors.d.mts +1 -0
- package/dist/runtime/docker/errors.mjs +187 -0
- package/dist/runtime/docker/errors.mjs.map +1 -0
- package/dist/runtime/docker/exec.d.mts +1 -0
- package/dist/runtime/docker/exec.mjs +63 -0
- package/dist/runtime/docker/exec.mjs.map +1 -0
- package/dist/runtime/docker/image.d.mts +1 -0
- package/dist/runtime/docker/image.mjs +278 -0
- package/dist/runtime/docker/image.mjs.map +1 -0
- package/dist/runtime/docker/index.d.mts +1 -0
- package/dist/runtime/docker/inventory.d.mts +1 -0
- package/dist/runtime/docker/inventory.mjs +167 -0
- package/dist/runtime/docker/inventory.mjs.map +1 -0
- package/dist/runtime/docker/labels.d.mts +1 -0
- package/dist/runtime/docker/labels.mjs +97 -0
- package/dist/runtime/docker/labels.mjs.map +1 -0
- package/dist/runtime/docker/logs.d.mts +1 -0
- package/dist/runtime/docker/logs.mjs +34 -0
- package/dist/runtime/docker/logs.mjs.map +1 -0
- package/dist/runtime/docker/network.d.mts +1 -0
- package/dist/runtime/docker/network.mjs +168 -0
- package/dist/runtime/docker/network.mjs.map +1 -0
- package/dist/runtime/docker/service.d.mts +9 -0
- package/dist/runtime/docker/service.mjs +266 -0
- package/dist/runtime/docker/service.mjs.map +1 -0
- package/dist/runtime/docker/sweep.d.mts +1 -0
- package/dist/runtime/docker/sweep.mjs +220 -0
- package/dist/runtime/docker/sweep.mjs.map +1 -0
- package/dist/runtime/docker/volume.d.mts +1 -0
- package/dist/runtime/docker/volume.mjs +24 -0
- package/dist/runtime/docker/volume.mjs.map +1 -0
- package/dist/runtime/docker/wrap.d.mts +1 -0
- package/dist/runtime/docker/wrap.mjs +131 -0
- package/dist/runtime/docker/wrap.mjs.map +1 -0
- package/dist/substrate/brand.d.mts +24 -0
- package/dist/substrate/brand.mjs +14 -0
- package/dist/substrate/brand.mjs.map +1 -0
- package/dist/substrate/cross-process.d.mts +1 -0
- package/dist/substrate/cross-process.mjs +28 -0
- package/dist/substrate/cross-process.mjs.map +1 -0
- package/dist/substrate/events.d.mts +117 -0
- package/dist/substrate/identity.d.mts +13 -0
- package/dist/substrate/lifecycle.d.mts +12 -0
- package/dist/substrate/manifest.d.mts +39 -0
- package/dist/substrate/manifest.mjs +33 -0
- package/dist/substrate/manifest.mjs.map +1 -0
- package/dist/substrate/network.d.mts +34 -0
- package/dist/substrate/options.d.mts +23 -0
- package/dist/substrate/plugin.d.mts +101 -0
- package/dist/substrate/plugin.mjs +61 -0
- package/dist/substrate/plugin.mjs.map +1 -0
- package/dist/substrate/projection.d.mts +100 -0
- package/dist/substrate/runtime/artifact-publisher/index.mjs +76 -0
- package/dist/substrate/runtime/artifact-publisher/index.mjs.map +1 -0
- package/dist/substrate/runtime/atomic-write.mjs +106 -0
- package/dist/substrate/runtime/atomic-write.mjs.map +1 -0
- package/dist/substrate/runtime/cache/index.d.mts +1 -0
- package/dist/substrate/runtime/cache/schema.d.mts +1 -0
- package/dist/substrate/runtime/cache/schema.mjs +22 -0
- package/dist/substrate/runtime/cache/schema.mjs.map +1 -0
- package/dist/substrate/runtime/cache/service.d.mts +1 -0
- package/dist/substrate/runtime/cache/service.mjs +89 -0
- package/dist/substrate/runtime/cache/service.mjs.map +1 -0
- package/dist/substrate/runtime/capability-sinks/index.d.mts +1 -0
- package/dist/substrate/runtime/capability-sinks/layer.d.mts +1 -0
- package/dist/substrate/runtime/capability-sinks/layer.mjs +31 -0
- package/dist/substrate/runtime/capability-sinks/layer.mjs.map +1 -0
- package/dist/substrate/runtime/capability-sinks/service.d.mts +36 -0
- package/dist/substrate/runtime/capability-sinks/service.mjs +74 -0
- package/dist/substrate/runtime/capability-sinks/service.mjs.map +1 -0
- package/dist/substrate/runtime/config-validation.d.mts +38 -0
- package/dist/substrate/runtime/config-validation.mjs +137 -0
- package/dist/substrate/runtime/config-validation.mjs.map +1 -0
- package/dist/substrate/runtime/context-helpers.mjs +32 -0
- package/dist/substrate/runtime/context-helpers.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +128 -0
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs +136 -0
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs +49 -0
- package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs +9 -0
- package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/liveness.mjs +119 -0
- package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/roster.mjs +275 -0
- package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/snapshot-reservation.d.mts +1 -0
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +117 -0
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/stack-lock.d.mts +1 -0
- package/dist/substrate/runtime/cross-process/stack-lock.mjs +142 -0
- package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -0
- package/dist/substrate/runtime/current-plugin.mjs +15 -0
- package/dist/substrate/runtime/current-plugin.mjs.map +1 -0
- package/dist/substrate/runtime/errors.d.mts +1 -0
- package/dist/substrate/runtime/errors.mjs +76 -0
- package/dist/substrate/runtime/errors.mjs.map +1 -0
- package/dist/substrate/runtime/host-tree-tar/index.mjs +364 -0
- package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -0
- package/dist/substrate/runtime/http-probe.d.mts +35 -0
- package/dist/substrate/runtime/http-probe.mjs +65 -0
- package/dist/substrate/runtime/http-probe.mjs.map +1 -0
- package/dist/substrate/runtime/lease-broker/index.d.mts +1 -0
- package/dist/substrate/runtime/lease-broker/service.d.mts +64 -0
- package/dist/substrate/runtime/lease-broker/service.mjs +155 -0
- package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/dep-graph.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs +138 -0
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/index.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs +31 -0
- package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/plugin-registry.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +133 -0
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/ready-gate.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/ready-gate.mjs +34 -0
- package/dist/substrate/runtime/lifecycle/ready-gate.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/selective-restart.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/selective-restart.mjs +43 -0
- package/dist/substrate/runtime/lifecycle/selective-restart.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/signals.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/signals.mjs +64 -0
- package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/state-machine.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/state-machine.mjs +38 -0
- package/dist/substrate/runtime/lifecycle/state-machine.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/watch-attribution.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/watch-attribution.mjs +27 -0
- package/dist/substrate/runtime/lifecycle/watch-attribution.mjs.map +1 -0
- package/dist/substrate/runtime/managed-container.d.mts +30 -0
- package/dist/substrate/runtime/managed-container.mjs +32 -0
- package/dist/substrate/runtime/managed-container.mjs.map +1 -0
- package/dist/substrate/runtime/manifest/manifest.mjs +73 -0
- package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -0
- package/dist/substrate/runtime/mode-errors.d.mts +36 -0
- package/dist/substrate/runtime/observability/cascade-formatter.d.mts +1 -0
- package/dist/substrate/runtime/observability/cascade-formatter.mjs +135 -0
- package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -0
- package/dist/substrate/runtime/observability/formatter-registry.d.mts +1 -0
- package/dist/substrate/runtime/observability/formatter-registry.mjs +65 -0
- package/dist/substrate/runtime/observability/formatter-registry.mjs.map +1 -0
- package/dist/substrate/runtime/observability/index.d.mts +3 -0
- package/dist/substrate/runtime/observability/logger.d.mts +58 -0
- package/dist/substrate/runtime/observability/logger.mjs +89 -0
- package/dist/substrate/runtime/observability/logger.mjs.map +1 -0
- package/dist/substrate/runtime/observability/pretty-error.d.mts +1 -0
- package/dist/substrate/runtime/observability/pretty-error.mjs +119 -0
- package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -0
- package/dist/substrate/runtime/observability/process-lines.d.mts +31 -0
- package/dist/substrate/runtime/observability/process-lines.mjs +40 -0
- package/dist/substrate/runtime/observability/process-lines.mjs.map +1 -0
- package/dist/substrate/runtime/observability/redaction.d.mts +28 -0
- package/dist/substrate/runtime/observability/redaction.mjs +45 -0
- package/dist/substrate/runtime/observability/redaction.mjs.map +1 -0
- package/dist/substrate/runtime/observability/spans.d.mts +1 -0
- package/dist/substrate/runtime/observability/spans.mjs +87 -0
- package/dist/substrate/runtime/observability/spans.mjs.map +1 -0
- package/dist/substrate/runtime/observability/subprocess-capture.d.mts +2 -0
- package/dist/substrate/runtime/observability/subprocess-capture.mjs +82 -0
- package/dist/substrate/runtime/observability/subprocess-capture.mjs.map +1 -0
- package/dist/substrate/runtime/paths.d.mts +17 -0
- package/dist/substrate/runtime/paths.mjs +61 -0
- package/dist/substrate/runtime/paths.mjs.map +1 -0
- package/dist/substrate/runtime/port-broker/index.d.mts +1 -0
- package/dist/substrate/runtime/port-broker/service.d.mts +1 -0
- package/dist/substrate/runtime/port-broker/service.mjs +319 -0
- package/dist/substrate/runtime/port-broker/service.mjs.map +1 -0
- package/dist/substrate/runtime/post-acquire-tasks.d.mts +1 -0
- package/dist/substrate/runtime/post-acquire-tasks.mjs +34 -0
- package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -0
- package/dist/substrate/runtime/probes.d.mts +51 -0
- package/dist/substrate/runtime/probes.mjs +84 -0
- package/dist/substrate/runtime/probes.mjs.map +1 -0
- package/dist/substrate/runtime/process-supervisor.d.mts +57 -0
- package/dist/substrate/runtime/process-supervisor.mjs +73 -0
- package/dist/substrate/runtime/process-supervisor.mjs.map +1 -0
- package/dist/substrate/runtime/projection/operational-endpoints.mjs +44 -0
- package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -0
- package/dist/substrate/runtime/projection/persisted.mjs +195 -0
- package/dist/substrate/runtime/projection/persisted.mjs.map +1 -0
- package/dist/substrate/runtime/projection/state-ref.mjs +48 -0
- package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -0
- package/dist/substrate/runtime/projection/update.mjs +200 -0
- package/dist/substrate/runtime/projection/update.mjs.map +1 -0
- package/dist/substrate/runtime/retry-policy.d.mts +18 -0
- package/dist/substrate/runtime/retry-policy.mjs +16 -0
- package/dist/substrate/runtime/retry-policy.mjs.map +1 -0
- package/dist/substrate/runtime/run.mjs +86 -0
- package/dist/substrate/runtime/run.mjs.map +1 -0
- package/dist/substrate/runtime/runtime-decode.d.mts +32 -0
- package/dist/substrate/runtime/runtime-decode.mjs +53 -0
- package/dist/substrate/runtime/runtime-decode.mjs.map +1 -0
- package/dist/substrate/runtime/scoped-http-server.mjs +36 -0
- package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -0
- package/dist/substrate/runtime/scoped-ref-map/service.mjs +83 -0
- package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +1 -0
- package/dist/substrate/runtime/stage-and-swap/index.d.mts +1 -0
- package/dist/substrate/runtime/stage-and-swap/index.mjs +131 -0
- package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -0
- package/dist/substrate/runtime/state-store/schema.mjs +36 -0
- package/dist/substrate/runtime/state-store/schema.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.d.mts +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs +22 -0
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.d.mts +1 -0
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs +30 -0
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/index.d.mts +1 -0
- package/dist/substrate/runtime/strategy-registry/service.d.mts +1 -0
- package/dist/substrate/runtime/strategy-registry/service.mjs +67 -0
- package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -0
- package/dist/substrate/runtime/sui-execute/index.d.mts +11 -0
- package/dist/substrate/runtime/sui-execute/index.mjs +144 -0
- package/dist/substrate/runtime/sui-execute/index.mjs.map +1 -0
- package/dist/substrate/runtime/sui-move-build/index.d.mts +1 -0
- package/dist/substrate/runtime/sui-move-build/index.mjs +283 -0
- package/dist/substrate/runtime/sui-move-build/index.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor.d.mts +1 -0
- package/dist/substrate/runtime/supervisor.mjs +831 -0
- package/dist/substrate/runtime/supervisor.mjs.map +1 -0
- package/dist/surfaces/cli/command-tree.mjs +276 -0
- package/dist/surfaces/cli/command-tree.mjs.map +1 -0
- package/dist/surfaces/cli/commands/config.mjs +31 -0
- package/dist/surfaces/cli/commands/config.mjs.map +1 -0
- package/dist/surfaces/cli/commands/confirm-node.mjs +26 -0
- package/dist/surfaces/cli/commands/confirm-node.mjs.map +1 -0
- package/dist/surfaces/cli/commands/confirm.mjs +26 -0
- package/dist/surfaces/cli/commands/confirm.mjs.map +1 -0
- package/dist/surfaces/cli/commands/doctor-probes.mjs +452 -0
- package/dist/surfaces/cli/commands/doctor-probes.mjs.map +1 -0
- package/dist/surfaces/cli/commands/doctor.mjs +38 -0
- package/dist/surfaces/cli/commands/doctor.mjs.map +1 -0
- package/dist/surfaces/cli/commands/prune-picker.mjs +347 -0
- package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -0
- package/dist/surfaces/cli/commands/prune.mjs +178 -0
- package/dist/surfaces/cli/commands/prune.mjs.map +1 -0
- package/dist/surfaces/cli/commands/snapshot.mjs +141 -0
- package/dist/surfaces/cli/commands/snapshot.mjs.map +1 -0
- package/dist/surfaces/cli/commands/status.mjs +95 -0
- package/dist/surfaces/cli/commands/status.mjs.map +1 -0
- package/dist/surfaces/cli/commands/supervisor-presence.mjs +33 -0
- package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -0
- package/dist/surfaces/cli/commands/wipe.mjs +28 -0
- package/dist/surfaces/cli/commands/wipe.mjs.map +1 -0
- package/dist/surfaces/cli/envelope.mjs +43 -0
- package/dist/surfaces/cli/envelope.mjs.map +1 -0
- package/dist/surfaces/cli/errors.mjs +110 -0
- package/dist/surfaces/cli/errors.mjs.map +1 -0
- package/dist/surfaces/cli/flags.mjs +56 -0
- package/dist/surfaces/cli/flags.mjs.map +1 -0
- package/dist/surfaces/cli/index.mjs +418 -0
- package/dist/surfaces/cli/index.mjs.map +1 -0
- package/dist/surfaces/cli/output.mjs +115 -0
- package/dist/surfaces/cli/output.mjs.map +1 -0
- package/dist/surfaces/cli/sysexits.mjs +139 -0
- package/dist/surfaces/cli/sysexits.mjs.map +1 -0
- package/dist/surfaces/tui/app.mjs +104 -0
- package/dist/surfaces/tui/app.mjs.map +1 -0
- package/dist/surfaces/tui/dashboard.mjs +261 -0
- package/dist/surfaces/tui/dashboard.mjs.map +1 -0
- package/dist/surfaces/tui/display-derivation.mjs +395 -0
- package/dist/surfaces/tui/display-derivation.mjs.map +1 -0
- package/dist/surfaces/tui/errors.mjs +11 -0
- package/dist/surfaces/tui/errors.mjs.map +1 -0
- package/dist/surfaces/tui/event-log.mjs +155 -0
- package/dist/surfaces/tui/event-log.mjs.map +1 -0
- package/dist/surfaces/tui/heartbeat.mjs +33 -0
- package/dist/surfaces/tui/heartbeat.mjs.map +1 -0
- package/dist/surfaces/tui/index.mjs +50 -0
- package/dist/surfaces/tui/index.mjs.map +1 -0
- package/dist/surfaces/tui/input.mjs +104 -0
- package/dist/surfaces/tui/input.mjs.map +1 -0
- package/dist/surfaces/tui/mode-detect.mjs +32 -0
- package/dist/surfaces/tui/mode-detect.mjs.map +1 -0
- package/dist/surfaces/tui/mount-ink.mjs +31 -0
- package/dist/surfaces/tui/mount-ink.mjs.map +1 -0
- package/dist/surfaces/tui/plain-renderer.mjs +170 -0
- package/dist/surfaces/tui/plain-renderer.mjs.map +1 -0
- package/dist/surfaces/tui/resource-table.mjs +507 -0
- package/dist/surfaces/tui/resource-table.mjs.map +1 -0
- package/images/_shared/signal-forward.sh +77 -0
- package/images/postgres/Dockerfile +32 -0
- package/images/seal/Dockerfile +68 -0
- package/images/seal/entrypoint.sh +65 -0
- package/images/sui/Dockerfile +73 -0
- package/images/sui/entrypoint.sh +244 -0
- package/images/sui-fork/Dockerfile +53 -0
- package/images/sui-fork/entrypoint.sh +51 -0
- package/images/walrus/Dockerfile +122 -0
- package/images/walrus/deploy-walrus.sh +305 -0
- package/images/walrus/run-walrus.sh +53 -0
- package/package.json +94 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","names":[],"sources":["../../../src/plugins/deepbook/types.ts"],"sourcesContent":["// Deepbook plugin — public user-facing types.\n//\n// This file declares the DeepBook resolved-value and helper shapes.\n// The local factory in `index.ts` only accepts options that acquire\n// real behavior in the current implementation.\n//\n// Substrate-blindness rule: nothing here references a specific\n// account / coin / package member's resolved value — the references\n// flow in as Direct Member Refs (the locked Decision per\n// `feedback_no_inline_validation_in_parallel_agents` /\n// `project_devstack_api_design_locked_decisions`).\n\nimport type { AccountValue } from '../account/index.ts';\nimport type { CoinValue } from '../coin/index.ts';\nimport type { LocalPackageResolved } from '../package/index.ts';\nimport type { ResourceRef } from '../../api/define-plugin.ts';\n\n// ---------------------------------------------------------------------------\n// Pyth — internal sub-module shapes (NOT a top-level plugin per memory\n// `project_pyth_inside_deepbook`).\n// ---------------------------------------------------------------------------\n\n/** A Pyth price feed id — opaque 64-character hex string. */\nexport type PythPriceFeedId = string & { readonly __pythPriceFeedId: unique symbol };\n\nexport const pythPriceFeedId = (s: string): PythPriceFeedId => s as PythPriceFeedId;\n\n/** Pyth feed binding — symbol + feed id + initial price. */\nexport interface PythFeed {\n\treadonly symbol: string;\n\treadonly feedId: PythPriceFeedId;\n\t/** Initial price expressed in feed-native scale (Pyth conf is the\n\t * signed-int representation; bigint avoids float precision drift). */\n\treadonly initialPrice: bigint;\n\t/** Feed exponent. Defaults to -8, matching the DeepBook sandbox. */\n\treadonly expo?: number;\n\t/** Optional confidence interval. Defaults to 0 for deterministic local feeds. */\n\treadonly confidence?: bigint;\n\t/** Optional EMA price. Defaults to `initialPrice`. */\n\treadonly emaPrice?: bigint;\n}\n\n/** Pyth options. `package` and `pusher` are member refs, not magic strings. */\nexport interface PythOptions<\n\tPackage extends PythPackageMember = PythPackageMember,\n\tPusher extends AccountMemberAlias = AccountMemberAlias,\n> {\n\treadonly package: Package;\n\treadonly pusher: Pusher;\n\treadonly feeds: ReadonlyArray<PythFeed>;\n}\n\n/** Resolved Pyth handle exposed inside the deepbook resolved value. */\nexport interface PythHandle {\n\t/** Local sandbox Pyth has no Wormhole state; known deployments do. */\n\treadonly packageId: string | null;\n\treadonly stateId: string | null;\n\treadonly wormholeStateId: string | null;\n\treadonly feeds: ReadonlyArray<{\n\t\treadonly symbol: string;\n\t\treadonly feedId: PythPriceFeedId;\n\t\treadonly priceInfoObjectId: string;\n\t\treadonly price: bigint;\n\t\treadonly expo: number;\n\t}>;\n}\n\n/** Common Pyth price feed ids (subset; users pass their own as\n * needed). These are the well-known Pyth hex feed ids, NOT\n * per-stack derived. */\nexport const SUI_PRICE_FEED_ID: PythPriceFeedId = pythPriceFeedId(\n\t'23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',\n);\nexport const USDC_PRICE_FEED_ID: PythPriceFeedId = pythPriceFeedId(\n\t'eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',\n);\nexport const DEEP_PRICE_FEED_ID: PythPriceFeedId = pythPriceFeedId(\n\t'29bdd5248234e33bd93d3b81100b5fa32eaa5997843847e2c2cb16d7c6d9f7ff',\n);\n\n// ---------------------------------------------------------------------------\n// Pool spec\n// ---------------------------------------------------------------------------\n\n/** Coin handle used by local DeepBook pool specs. `key` is the SDK-facing\n * coin key (for example `DEEP` or `SUI`); `coin` is the devstack member ref\n * whose resolved value supplies the full Move coin type. */\nexport interface DeepbookPoolCoin<Coin extends CoinMemberAlias = CoinMemberAlias> {\n\treadonly key: string;\n\treadonly coin: Coin;\n\t/** SDK scalar for this coin. Defaults to the resolved coin decimals. */\n\treadonly scalar?: number;\n\t/** SDK address column. Defaults to the package id for package coins, or\n\t * the address portion of the resolved full coin type. */\n\treadonly address?: string;\n}\n\n/** Seed order placed after a local pool is created. Price and quantity use\n * DeepBook's on-chain units: `price` is quote-unit price and `quantity` is\n * base-asset quantity. */\nexport interface DeepbookPoolSeedOrder {\n\treadonly side: 'ask' | 'bid';\n\treadonly price: bigint;\n\treadonly quantity: bigint;\n\treadonly clientOrderId?: bigint;\n\treadonly payWithDeep?: boolean;\n}\n\n/** Optional local liquidity seed. Package coins with a generic funding\n * strategy are minted to the publisher before the seed transaction; otherwise\n * the publisher must already own the deposited coins. */\nexport interface DeepbookPoolSeedLiquidity {\n\treadonly baseAmount?: bigint;\n\treadonly quoteAmount?: bigint;\n\treadonly orders: ReadonlyArray<DeepbookPoolSeedOrder>;\n}\n\n/** Whitelisted pool to create at deploy time. `base` / `quote` are real coin\n * member refs so pool creation cannot race package/coin resolution. */\nexport interface DeepbookPoolSpec<\n\tBase extends CoinMemberAlias = CoinMemberAlias,\n\tQuote extends CoinMemberAlias = CoinMemberAlias,\n> {\n\treadonly name: string;\n\treadonly base: DeepbookPoolCoin<Base>;\n\treadonly quote: DeepbookPoolCoin<Quote>;\n\treadonly tickSize: bigint;\n\treadonly lotSize: bigint;\n\treadonly minSize: bigint;\n\t/** Whitelisted? Defaults true for local deploy (no DEEP-burn). */\n\treadonly whitelisted?: boolean;\n\t/** Stable pool? Defaults false. */\n\treadonly stablePool?: boolean;\n\t/** Optional publisher-owned BalanceManager + seed orders for local demos. */\n\treadonly seed?: DeepbookPoolSeedLiquidity;\n}\n\n/** A resolved pool record on chain. */\nexport interface DeepbookPool {\n\treadonly name: string;\n\treadonly poolId: string;\n\treadonly base: string;\n\treadonly baseCoinType: string;\n\treadonly quote: string;\n\treadonly quoteCoinType: string;\n\treadonly tickSize: bigint;\n\treadonly lotSize: bigint;\n\treadonly minSize: bigint;\n}\n\n// ---------------------------------------------------------------------------\n// Margin\n// ---------------------------------------------------------------------------\n\n/** Per-asset margin parameters (matches deepbook-v3 margin module). */\nexport interface DeepbookMarginAssetConfig {\n\treadonly label: string;\n\treadonly coinType: string;\n\treadonly scalar: number;\n\treadonly feed: PythPriceFeedId;\n\treadonly maxConfBps: number;\n\treadonly maxEwmaDifferenceBps: number;\n\treadonly supplyCap: number;\n\treadonly maxUtilizationRate: number;\n\treadonly referralSpread: number;\n\treadonly minBorrow: number;\n\treadonly rateLimitCapacity: number;\n\treadonly rateLimitRefillRatePerMs: number;\n\treadonly rateLimitEnabled: boolean;\n\treadonly baseRate: number;\n\treadonly baseSlope: number;\n\treadonly optimalUtilization: number;\n\treadonly excessSlope: number;\n}\n\n/** Per-pool risk parameters. */\nexport interface DeepbookMarginPoolRiskConfig {\n\treadonly minWithdrawRiskRatio: number;\n\treadonly minBorrowRiskRatio: number;\n\treadonly liquidationRiskRatio: number;\n\treadonly targetLiquidationRiskRatio: number;\n\treadonly userLiquidationReward: number;\n\treadonly poolLiquidationReward: number;\n}\n\nexport interface DeepbookMarginPoolRegistration {\n\treadonly pool: string;\n\treadonly risk?: DeepbookMarginPoolRiskConfig;\n}\n\nexport interface DeepbookMarginOptions {\n\treadonly assets: ReadonlyArray<\n\t\tOmit<DeepbookMarginAssetConfig, 'coinType'> & {\n\t\t\treadonly coinType?: string;\n\t\t}\n\t>;\n\treadonly pools: ReadonlyArray<DeepbookMarginPoolRegistration>;\n\treadonly maxAgeSeconds?: bigint;\n}\n\nexport interface DeepbookMargin {\n\treadonly packageId: string;\n\treadonly registryId: string;\n\treadonly adminCapId: string;\n\treadonly marginPools: ReadonlyArray<{\n\t\treadonly label: string;\n\t\treadonly coinType: string;\n\t\treadonly marginPoolId: string;\n\t}>;\n\treadonly registeredPools: ReadonlyArray<string>;\n}\n\n/** Sensible defaults for the common assets. The user passes\n * `{ ...USDC_MARGIN_DEFAULTS, coinType: '0x...::usdc::USDC' }`. */\nexport const USDC_MARGIN_DEFAULTS: Omit<DeepbookMarginAssetConfig, 'coinType'> = {\n\tlabel: 'USDC',\n\tscalar: 1_000_000,\n\tfeed: USDC_PRICE_FEED_ID,\n\tmaxConfBps: 100,\n\tmaxEwmaDifferenceBps: 500,\n\tsupplyCap: 1_000_000,\n\tmaxUtilizationRate: 0.8,\n\treferralSpread: 0.2,\n\tminBorrow: 0.1,\n\trateLimitCapacity: 200_000,\n\trateLimitRefillRatePerMs: 0.009259,\n\trateLimitEnabled: true,\n\tbaseRate: 0.1,\n\tbaseSlope: 0.15,\n\toptimalUtilization: 0.8,\n\texcessSlope: 5,\n};\n\nexport const SUI_MARGIN_DEFAULTS: Omit<DeepbookMarginAssetConfig, 'coinType'> = {\n\tlabel: 'SUI',\n\tscalar: 1_000_000_000,\n\tfeed: SUI_PRICE_FEED_ID,\n\tmaxConfBps: 300,\n\tmaxEwmaDifferenceBps: 1500,\n\tsupplyCap: 500_000,\n\tmaxUtilizationRate: 0.8,\n\treferralSpread: 0.2,\n\tminBorrow: 0.1,\n\trateLimitCapacity: 100_000,\n\trateLimitRefillRatePerMs: 0.00462963,\n\trateLimitEnabled: true,\n\tbaseRate: 0.1,\n\tbaseSlope: 0.2,\n\toptimalUtilization: 0.8,\n\texcessSlope: 5,\n};\n\nexport const DEFAULT_POOL_RISK_CONFIG: DeepbookMarginPoolRiskConfig = {\n\tminWithdrawRiskRatio: 2,\n\tminBorrowRiskRatio: 1.2499,\n\tliquidationRiskRatio: 1.1,\n\ttargetLiquidationRiskRatio: 1.25,\n\tuserLiquidationReward: 0.02,\n\tpoolLiquidationReward: 0.03,\n};\n\n// ---------------------------------------------------------------------------\n// Market maker\n// ---------------------------------------------------------------------------\n\n/** Strategy descriptor — narrow union; deepbook bps-grid is the\n * reference. */\nexport type DeepbookMarketMakerStrategy = {\n\treadonly kind: 'bps';\n\treadonly spreadBps: number;\n\treadonly levelSpacingBps: number;\n\treadonly levels: number;\n};\n\nexport interface DeepbookMarketMakerOptions {\n\treadonly signer: AccountMemberAlias;\n\treadonly strategy: DeepbookMarketMakerStrategy;\n\t/** Optional cadence; defaults to 5s. */\n\treadonly tickIntervalMillis?: number;\n\t/** Optional pool filter; defaults to all pools. */\n\treadonly pools?: ReadonlyArray<string>;\n}\n\nexport interface DeepbookMarketMaker {\n\treadonly signer: string;\n\treadonly running: boolean;\n\treadonly pools: ReadonlyArray<string>;\n}\n\n// ---------------------------------------------------------------------------\n// Member ref aliases — Direct Member Refs surface (locked API decision)\n// ---------------------------------------------------------------------------\n\n/** Account ref alias — the user passes the value returned by\n * `account('name')`. Resource-typed at the factory boundary so a\n * package-shaped ref is a TS error while preserving the literal\n * `account/<name>` id. */\nexport type AccountMemberAlias<Name extends string = string> = ResourceRef<\n\t`account/${Name}`,\n\tAccountValue\n>;\n\n/** Coin ref alias — the user passes `coin.fromPackage(...)`, `coin.known(...)`,\n * or `coin.builtin(...)`. */\nexport type CoinMemberAlias<Name extends string = string> = ResourceRef<`coin:${Name}`, CoinValue>;\n\n/** Local package ref alias for the published DeepBook package. The package\n * should capture `registryId` and `adminCapId` from its publish output. */\nexport type DeepbookPackageMember<Name extends string = string> = ResourceRef<\n\t`package:${Name}`,\n\tLocalPackageResolved\n>;\n\n/** Local package ref alias for the mock Pyth package used by local DeepBook. */\nexport type PythPackageMember<Name extends string = string> = ResourceRef<\n\t`package:${Name}`,\n\tLocalPackageResolved\n>;\n"],"mappings":";AAyBA,MAAa,mBAAmB,MAA+B;;;;AA6C/D,MAAa,oBAAqC,gBACjD,mEACA;AACD,MAAa,qBAAsC,gBAClD,mEACA;AACD,MAAa,qBAAsC,gBAClD,mEACA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/faucet/dispatcher.d.ts
|
|
4
|
+
/** Capability key prefix for a faucet request strategy. The full
|
|
5
|
+
* key is `faucet:request:<chainId>`. */
|
|
6
|
+
declare const FAUCET_CAPABILITY_KEY_PREFIX: "faucet:request";
|
|
7
|
+
//#endregion
|
|
8
|
+
export { FAUCET_CAPABILITY_KEY_PREFIX };
|
|
9
|
+
//# sourceMappingURL=dispatcher.d.mts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "effect";
|
|
2
|
+
//#region src/plugins/faucet/dispatcher.ts
|
|
3
|
+
/** Capability key prefix for a faucet request strategy. The full
|
|
4
|
+
* key is `faucet:request:<chainId>`. */
|
|
5
|
+
const FAUCET_CAPABILITY_KEY_PREFIX = "faucet:request";
|
|
6
|
+
/** Build the full capability key for a chain. Literal-typed so the
|
|
7
|
+
* downstream `StrategyFor<Caps, Key>` lookup picks the strategy
|
|
8
|
+
* shape out of a tuple by name. */
|
|
9
|
+
const faucetCapabilityKey = (chainId) => `${FAUCET_CAPABILITY_KEY_PREFIX}:${chainId}`;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { faucetCapabilityKey };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=dispatcher.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatcher.mjs","names":[],"sources":["../../../src/plugins/faucet/dispatcher.ts"],"sourcesContent":["// Faucet dispatcher.\n//\n// Architecture (distilled doc §Selection rule): dispatch by\n// capability key ONLY. The user's network mode (local vs testnet vs\n// mainnet vs fork) does NOT branch at dispatch time — mode shapes\n// the POPULATION of the registry; the dispatcher itself is mode-\n// agnostic.\n//\n// Capability key shape: `faucet:request:<chainId>`. The chain id is\n// the substrate-level `NetworkConfig.chain` value (e.g. `'sui:localnet'`,\n// `'sui:testnet'`, `'sui:mainnet-fork@123'`). Future per-coin\n// dispatch (WAL exchange, treasury-cap-mint) extends this with a\n// `:<coinType>` suffix; today the dispatcher only handles the\n// SUI-side coin flow. (Open question in the distilled doc §Open\n// questions #3.)\n\nimport { Effect } from 'effect';\n\nimport type { StrategyRegistry } from '../../contracts/strategy-contributor.ts';\nimport { faucetStrategyMissing } from './errors.ts';\nimport type {\n\tFaucetBodyError,\n\tFaucetExhausted,\n\tFaucetStrategyMissing,\n\tFaucetUnreachable,\n} from './errors.ts';\nimport type { FaucetStrategy } from './strategies/sui-local.ts';\n\n/** Capability key prefix for a faucet request strategy. The full\n * key is `faucet:request:<chainId>`. */\nexport const FAUCET_CAPABILITY_KEY_PREFIX = 'faucet:request' as const;\n\n/** Build the full capability key for a chain. Literal-typed so the\n * downstream `StrategyFor<Caps, Key>` lookup picks the strategy\n * shape out of a tuple by name. */\nexport const faucetCapabilityKey = <ChainId extends string>(\n\tchainId: ChainId,\n): `${typeof FAUCET_CAPABILITY_KEY_PREFIX}:${ChainId}` =>\n\t`${FAUCET_CAPABILITY_KEY_PREFIX}:${chainId}` as const;\n\n/** A single funding request. */\nexport interface FaucetRequest {\n\t/** Chain id (`'sui:localnet'`, `'sui:testnet'`, etc.). Selects\n\t * the strategy via capability-key lookup. */\n\treadonly chainId: string;\n\t/** Destination address. */\n\treadonly address: string;\n\t/** Amount in the chain-native smallest unit (MIST for sui). The\n\t * SUI HTTP faucet binary itself ignores `amount` and grants a\n\t * fixed value per request; the field is the dispatcher-level\n\t * unit and carries through to error payloads. */\n\treadonly amount: bigint;\n}\n\n/** Dispatcher view exposed by the plugin's resolved value. */\nexport interface FaucetDispatcher {\n\t/** Dispatch a funding request to the matching strategy. */\n\treadonly request: (\n\t\treq: FaucetRequest,\n\t) => Effect.Effect<\n\t\tvoid,\n\t\tFaucetStrategyMissing | FaucetUnreachable | FaucetBodyError | FaucetExhausted\n\t>;\n\t/** List the capability keys currently registered for faucet\n\t * requests. Used by surfaces that want to render \"what chains\n\t * can this stack hand out coins to right now.\" */\n\treadonly listFundableChains: Effect.Effect<ReadonlyArray<string>>;\n}\n\n/** Build a dispatcher closure over the substrate's\n * `StrategyRegistry`. The dispatcher is created at the plugin's\n * acquire and stored on the resolved value. */\nexport const makeDispatcher = (registry: StrategyRegistry): FaucetDispatcher => ({\n\trequest: (req) =>\n\t\tEffect.gen(function* () {\n\t\t\tconst key = faucetCapabilityKey(req.chainId);\n\t\t\t// Convert the substrate-level `StrategyNotFoundError` into\n\t\t\t// the faucet-flavored `FaucetStrategyMissing` (carries\n\t\t\t// amount + address) at the plugin boundary.\n\t\t\tconst strategy = yield* registry.get<typeof key, FaucetStrategy>(key).pipe(\n\t\t\t\tEffect.catchTag('StrategyNotFoundError', (err) =>\n\t\t\t\t\tEffect.fail(\n\t\t\t\t\t\tfaucetStrategyMissing({\n\t\t\t\t\t\t\tcapabilityKey: key,\n\t\t\t\t\t\t\taddress: req.address,\n\t\t\t\t\t\t\tamount: req.amount,\n\t\t\t\t\t\t\tregisteredKeys: err.registeredKeys,\n\t\t\t\t\t\t\thint:\n\t\t\t\t\t\t\t\t`no faucet strategy registered for '${req.chainId}'. ` +\n\t\t\t\t\t\t\t\t`Registered keys: [${err.registeredKeys.join(', ')}]. ` +\n\t\t\t\t\t\t\t\t`Check that the corresponding sui() plugin is in the stack ` +\n\t\t\t\t\t\t\t\t`AND its mode has a faucet (mainnet has none).`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\t\t\tyield* strategy.request({ address: req.address, amount: req.amount });\n\t\t}).pipe(\n\t\t\tEffect.withSpan('faucet.dispatch', {\n\t\t\t\tattributes: {\n\t\t\t\t\t'faucet.chainId': req.chainId,\n\t\t\t\t\t'faucet.address': req.address,\n\t\t\t\t\t'faucet.amount': req.amount.toString(),\n\t\t\t\t},\n\t\t\t}),\n\t\t),\n\n\tlistFundableChains: Effect.gen(function* () {\n\t\tconst keys = yield* registry.list();\n\t\t// Surface only the chain ids — strip the capability prefix.\n\t\treturn keys\n\t\t\t.filter((k) => k.startsWith(`${FAUCET_CAPABILITY_KEY_PREFIX}:`))\n\t\t\t.map((k) => k.slice(FAUCET_CAPABILITY_KEY_PREFIX.length + 1));\n\t}),\n});\n"],"mappings":";;;;AA8BA,MAAa,+BAA+B;;;;AAK5C,MAAa,uBACZ,YAEA,GAAG,6BAA6B,GAAG"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ConfigIssue } from "../../substrate/runtime/config-validation.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/faucet/errors.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Transport-level reachability failure. Raised when `fetch` itself
|
|
6
|
+
* rejects (ECONNREFUSED, DNS failure, TLS failure, AbortSignal
|
|
7
|
+
* timeout). Typical during cold boot before the faucet HTTP server
|
|
8
|
+
* binds.
|
|
9
|
+
*
|
|
10
|
+
* The retry loop catches this; it surfaces to the caller only after
|
|
11
|
+
* the wall-clock budget elapses.
|
|
12
|
+
*/
|
|
13
|
+
interface FaucetUnreachable {
|
|
14
|
+
readonly _tag: 'FaucetUnreachable';
|
|
15
|
+
readonly url: string;
|
|
16
|
+
readonly address: string;
|
|
17
|
+
readonly amount: bigint;
|
|
18
|
+
readonly message: string;
|
|
19
|
+
readonly cause?: unknown;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Retry-budget exhaustion. The wall-clock budget elapsed before any
|
|
23
|
+
* attempt succeeded, OR the attempt count cap was hit first. Both
|
|
24
|
+
* paths land here; `kind` discriminates so renderers can distinguish
|
|
25
|
+
* "we ran out of time" from "we ran out of attempts".
|
|
26
|
+
*
|
|
27
|
+
* Carries the last underlying cause so pretty-error rendering can
|
|
28
|
+
* show what was actually failing instead of just the budget message.
|
|
29
|
+
*/
|
|
30
|
+
interface FaucetExhausted {
|
|
31
|
+
readonly _tag: 'FaucetExhausted';
|
|
32
|
+
readonly kind: 'wall-clock' | 'attempts';
|
|
33
|
+
readonly url: string;
|
|
34
|
+
readonly address: string;
|
|
35
|
+
readonly amount: bigint;
|
|
36
|
+
readonly attempts: number;
|
|
37
|
+
readonly message: string;
|
|
38
|
+
readonly lastCause?: unknown;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Body-level Failure on a 200 OK. The load-bearing invariant: the
|
|
42
|
+
* Sui faucet returns `{ status: { Failure: ... } }` when it accepted
|
|
43
|
+
* the request but couldn't execute the underlying tx (gas object
|
|
44
|
+
* stale, mid-genesis, consensus hiccup).
|
|
45
|
+
*
|
|
46
|
+
* Also covers JSON-parse failures on a 200 body and other malformed-
|
|
47
|
+
* response cases — anything that means "the HTTP layer says OK but
|
|
48
|
+
* the body does not confirm a successful transfer". Caller code MUST
|
|
49
|
+
* treat this as a failed funding, not a silent success.
|
|
50
|
+
*/
|
|
51
|
+
interface FaucetBodyError {
|
|
52
|
+
readonly _tag: 'FaucetBodyError';
|
|
53
|
+
readonly url: string;
|
|
54
|
+
readonly address: string;
|
|
55
|
+
readonly amount: bigint;
|
|
56
|
+
readonly status: number;
|
|
57
|
+
readonly reason: 'failure-status' | 'malformed-body' | 'invalid-json';
|
|
58
|
+
readonly message: string;
|
|
59
|
+
/** The raw body payload (truncated where necessary) for diagnostics. */
|
|
60
|
+
readonly bodySnippet?: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Unknown coin / chain id at dispatch. The strategy registry held
|
|
64
|
+
* no contributor matching `capabilityKey`. The error names the
|
|
65
|
+
* registered set so users can see "I asked for X, only Y is wired".
|
|
66
|
+
*
|
|
67
|
+
* Distinct from substrate-level `StrategyNotFoundError` — this one
|
|
68
|
+
* is faucet-flavored (carries amount + address) and lives at the
|
|
69
|
+
* plugin's public boundary.
|
|
70
|
+
*/
|
|
71
|
+
interface FaucetStrategyMissing {
|
|
72
|
+
readonly _tag: 'FaucetStrategyMissing';
|
|
73
|
+
readonly capabilityKey: string;
|
|
74
|
+
readonly address: string;
|
|
75
|
+
readonly amount: bigint;
|
|
76
|
+
readonly registeredKeys: ReadonlyArray<string>;
|
|
77
|
+
readonly hint: string;
|
|
78
|
+
}
|
|
79
|
+
interface FaucetConfigError extends ConfigIssue {
|
|
80
|
+
readonly _tag: 'FaucetConfigError';
|
|
81
|
+
}
|
|
82
|
+
/** Union of every error a faucet caller may encounter. */
|
|
83
|
+
type FaucetError = FaucetUnreachable | FaucetExhausted | FaucetBodyError | FaucetStrategyMissing | FaucetConfigError;
|
|
84
|
+
//#endregion
|
|
85
|
+
export { FaucetBodyError, FaucetConfigError, FaucetError, FaucetExhausted, FaucetUnreachable };
|
|
86
|
+
//# sourceMappingURL=errors.d.mts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineConfigError } from "../../substrate/runtime/config-validation.mjs";
|
|
2
|
+
//#region src/plugins/faucet/errors.ts
|
|
3
|
+
const faucetUnreachable = (parts) => ({
|
|
4
|
+
_tag: "FaucetUnreachable",
|
|
5
|
+
...parts
|
|
6
|
+
});
|
|
7
|
+
const faucetExhausted = (parts) => ({
|
|
8
|
+
_tag: "FaucetExhausted",
|
|
9
|
+
...parts
|
|
10
|
+
});
|
|
11
|
+
const faucetBodyError = (parts) => ({
|
|
12
|
+
_tag: "FaucetBodyError",
|
|
13
|
+
...parts
|
|
14
|
+
});
|
|
15
|
+
defineConfigError("FaucetConfigError");
|
|
16
|
+
//#endregion
|
|
17
|
+
export { faucetBodyError, faucetExhausted, faucetUnreachable };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=errors.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/plugins/faucet/errors.ts"],"sourcesContent":["// Faucet plugin — typed errors.\n//\n// Architecture (distilled doc §Invariants / §Edge cases):\n// - A non-2xx HTTP status MUST raise (NOT be silently treated as\n// success). The Sui faucet binary binds its socket before its\n// validator can transfer coins → the warm-up window returns 5xx.\n// - A 200 OK body carrying `{ status: { Failure: ... } }` MUST\n// raise. The most load-bearing wire-level invariant: during\n// warm-up the faucet accepts requests it cannot execute, and\n// treating those bodies as success marks accounts funded when\n// no coins moved.\n// - A wall-clock budget exhaustion is distinct from a retry-count\n// exhaustion; both surface through the same `FaucetExhausted`\n// class but carry the discriminating field.\n//\n// Effect v4: tagged errors are plain interfaces; `Effect.catchTag` /\n// `catchTags` match on the `_tag` literal. The error tags this\n// plugin contributes are surfaced via `FAUCET_ERROR_TAGS` for the\n// substrate cause walker.\n\nimport { defineConfigError, type ConfigIssue } from '../../substrate/runtime/config-validation.ts';\n\n/**\n * Transport-level reachability failure. Raised when `fetch` itself\n * rejects (ECONNREFUSED, DNS failure, TLS failure, AbortSignal\n * timeout). Typical during cold boot before the faucet HTTP server\n * binds.\n *\n * The retry loop catches this; it surfaces to the caller only after\n * the wall-clock budget elapses.\n */\nexport interface FaucetUnreachable {\n\treadonly _tag: 'FaucetUnreachable';\n\treadonly url: string;\n\treadonly address: string;\n\treadonly amount: bigint;\n\treadonly message: string;\n\treadonly cause?: unknown;\n}\n\nexport const faucetUnreachable = (parts: Omit<FaucetUnreachable, '_tag'>): FaucetUnreachable => ({\n\t_tag: 'FaucetUnreachable',\n\t...parts,\n});\n\n/**\n * Retry-budget exhaustion. The wall-clock budget elapsed before any\n * attempt succeeded, OR the attempt count cap was hit first. Both\n * paths land here; `kind` discriminates so renderers can distinguish\n * \"we ran out of time\" from \"we ran out of attempts\".\n *\n * Carries the last underlying cause so pretty-error rendering can\n * show what was actually failing instead of just the budget message.\n */\nexport interface FaucetExhausted {\n\treadonly _tag: 'FaucetExhausted';\n\treadonly kind: 'wall-clock' | 'attempts';\n\treadonly url: string;\n\treadonly address: string;\n\treadonly amount: bigint;\n\treadonly attempts: number;\n\treadonly message: string;\n\treadonly lastCause?: unknown;\n}\n\nexport const faucetExhausted = (parts: Omit<FaucetExhausted, '_tag'>): FaucetExhausted => ({\n\t_tag: 'FaucetExhausted',\n\t...parts,\n});\n\n/**\n * Body-level Failure on a 200 OK. The load-bearing invariant: the\n * Sui faucet returns `{ status: { Failure: ... } }` when it accepted\n * the request but couldn't execute the underlying tx (gas object\n * stale, mid-genesis, consensus hiccup).\n *\n * Also covers JSON-parse failures on a 200 body and other malformed-\n * response cases — anything that means \"the HTTP layer says OK but\n * the body does not confirm a successful transfer\". Caller code MUST\n * treat this as a failed funding, not a silent success.\n */\nexport interface FaucetBodyError {\n\treadonly _tag: 'FaucetBodyError';\n\treadonly url: string;\n\treadonly address: string;\n\treadonly amount: bigint;\n\treadonly status: number;\n\treadonly reason: 'failure-status' | 'malformed-body' | 'invalid-json';\n\treadonly message: string;\n\t/** The raw body payload (truncated where necessary) for diagnostics. */\n\treadonly bodySnippet?: string;\n}\n\nexport const faucetBodyError = (parts: Omit<FaucetBodyError, '_tag'>): FaucetBodyError => ({\n\t_tag: 'FaucetBodyError',\n\t...parts,\n});\n\n/**\n * Unknown coin / chain id at dispatch. The strategy registry held\n * no contributor matching `capabilityKey`. The error names the\n * registered set so users can see \"I asked for X, only Y is wired\".\n *\n * Distinct from substrate-level `StrategyNotFoundError` — this one\n * is faucet-flavored (carries amount + address) and lives at the\n * plugin's public boundary.\n */\nexport interface FaucetStrategyMissing {\n\treadonly _tag: 'FaucetStrategyMissing';\n\treadonly capabilityKey: string;\n\treadonly address: string;\n\treadonly amount: bigint;\n\treadonly registeredKeys: ReadonlyArray<string>;\n\treadonly hint: string;\n}\n\nexport const faucetStrategyMissing = (\n\tparts: Omit<FaucetStrategyMissing, '_tag'>,\n): FaucetStrategyMissing => ({\n\t_tag: 'FaucetStrategyMissing',\n\t...parts,\n});\n\nexport interface FaucetConfigError extends ConfigIssue {\n\treadonly _tag: 'FaucetConfigError';\n}\n\nexport const faucetConfigError = defineConfigError('FaucetConfigError');\n\n/** Union of every error a faucet caller may encounter. */\nexport type FaucetError =\n\t| FaucetUnreachable\n\t| FaucetExhausted\n\t| FaucetBodyError\n\t| FaucetStrategyMissing\n\t| FaucetConfigError;\n\n/** Error tags this plugin contributes — surfaced to the substrate's\n * cause walker via `PluginErrorContribution`. */\nexport const FAUCET_ERROR_TAGS: ReadonlyArray<FaucetError['_tag']> = [\n\t'FaucetUnreachable',\n\t'FaucetExhausted',\n\t'FaucetBodyError',\n\t'FaucetStrategyMissing',\n\t'FaucetConfigError',\n] as const;\n"],"mappings":";;AAwCA,MAAa,qBAAqB,WAA+D;CAChG,MAAM;CACN,GAAG;CACH;AAsBD,MAAa,mBAAmB,WAA2D;CAC1F,MAAM;CACN,GAAG;CACH;AAyBD,MAAa,mBAAmB,WAA2D;CAC1F,MAAM;CACN,GAAG;CACH;AA+BgC,kBAAkB,oBAAoB"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { faucetBodyError, faucetExhausted, faucetUnreachable } from "./errors.mjs";
|
|
2
|
+
import { makeExponentialRetrySchedule } from "../../substrate/runtime/retry-policy.mjs";
|
|
3
|
+
import { Effect, Ref } from "effect";
|
|
4
|
+
/** Exponential growth factor between retries. */
|
|
5
|
+
const BACKOFF_FACTOR = 1.5;
|
|
6
|
+
/**
|
|
7
|
+
* One-shot POST: send + check status + parse body + check body
|
|
8
|
+
* status. Exported so tests can pin the body-Failure detection
|
|
9
|
+
* without paying the retry / wall-clock cost of the wrapper. Production
|
|
10
|
+
* callers go through `requestFundsWithRetry`.
|
|
11
|
+
*
|
|
12
|
+
* Failure modes raised:
|
|
13
|
+
* - `FaucetUnreachable` on transport failure (fetch reject, abort
|
|
14
|
+
* timeout, network error).
|
|
15
|
+
* - `FaucetBodyError` on non-2xx, body Failure status, or
|
|
16
|
+
* unparseable JSON. The doc-load-bearing distinction.
|
|
17
|
+
*/
|
|
18
|
+
const requestFundsOnce = (opts) => Effect.gen(function* () {
|
|
19
|
+
const path = opts.path ?? "/v2/gas";
|
|
20
|
+
const endpoint = `${opts.faucetUrl}${path}`;
|
|
21
|
+
const deadlineMs = opts.fetchDeadlineMs ?? 5e3;
|
|
22
|
+
const response = yield* Effect.tryPromise({
|
|
23
|
+
try: () => fetch(endpoint, {
|
|
24
|
+
method: "POST",
|
|
25
|
+
headers: { "content-type": "application/json" },
|
|
26
|
+
body: JSON.stringify({ FixedAmountRequest: { recipient: opts.address } }),
|
|
27
|
+
signal: AbortSignal.timeout(deadlineMs)
|
|
28
|
+
}),
|
|
29
|
+
catch: (cause) => faucetUnreachable({
|
|
30
|
+
url: opts.faucetUrl,
|
|
31
|
+
address: opts.address,
|
|
32
|
+
amount: opts.amount,
|
|
33
|
+
message: `faucet POST to ${endpoint} failed (transport)`,
|
|
34
|
+
cause
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
if (!response.ok) {
|
|
38
|
+
const body = yield* Effect.tryPromise({
|
|
39
|
+
try: () => response.text(),
|
|
40
|
+
catch: () => void 0
|
|
41
|
+
}).pipe(Effect.orElseSucceed(() => void 0));
|
|
42
|
+
return yield* Effect.fail(faucetBodyError({
|
|
43
|
+
url: opts.faucetUrl,
|
|
44
|
+
address: opts.address,
|
|
45
|
+
amount: opts.amount,
|
|
46
|
+
status: response.status,
|
|
47
|
+
reason: "failure-status",
|
|
48
|
+
message: `faucet returned ${response.status} ${response.statusText}`,
|
|
49
|
+
...body !== void 0 && body.length > 0 ? { bodySnippet: body } : {}
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
const status = (yield* Effect.tryPromise({
|
|
53
|
+
try: () => response.json(),
|
|
54
|
+
catch: (cause) => faucetBodyError({
|
|
55
|
+
url: opts.faucetUrl,
|
|
56
|
+
address: opts.address,
|
|
57
|
+
amount: opts.amount,
|
|
58
|
+
status: response.status,
|
|
59
|
+
reason: "invalid-json",
|
|
60
|
+
message: "faucet response was not valid JSON",
|
|
61
|
+
...cause !== void 0 ? { bodySnippet: String(cause) } : {}
|
|
62
|
+
})
|
|
63
|
+
})).status;
|
|
64
|
+
if (typeof status === "object" && status !== null && "Failure" in status) {
|
|
65
|
+
const payload = JSON.stringify(status.Failure);
|
|
66
|
+
return yield* Effect.fail(faucetBodyError({
|
|
67
|
+
url: opts.faucetUrl,
|
|
68
|
+
address: opts.address,
|
|
69
|
+
amount: opts.amount,
|
|
70
|
+
status: response.status,
|
|
71
|
+
reason: "failure-status",
|
|
72
|
+
message: `faucet body reported Failure: ${payload}`,
|
|
73
|
+
bodySnippet: payload
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
}).pipe(Effect.withSpan("faucet.requestFundsOnce"));
|
|
77
|
+
/**
|
|
78
|
+
* Retry-wrapped POST. Combines `requestFundsOnce` with a jittered
|
|
79
|
+
* exponential schedule and a wall-clock budget; on exhaustion raises
|
|
80
|
+
* `FaucetExhausted` carrying the last underlying cause.
|
|
81
|
+
*
|
|
82
|
+
* Invariant #4 (jitter): handled by the schedule above. Invariant #3
|
|
83
|
+
* (per-fetch deadline): handled by `requestFundsOnce`'s
|
|
84
|
+
* `AbortSignal.timeout`.
|
|
85
|
+
*/
|
|
86
|
+
const requestFundsWithRetry = (opts) => Effect.gen(function* () {
|
|
87
|
+
const timeoutMs = opts.timeoutMs ?? 9e4;
|
|
88
|
+
const maxAttempts = opts.maxAttempts ?? 15;
|
|
89
|
+
const initialDelayMs = opts.initialDelayMs ?? 500;
|
|
90
|
+
yield* Effect.annotateCurrentSpan({
|
|
91
|
+
"faucet.url": opts.faucetUrl,
|
|
92
|
+
"faucet.address": opts.address,
|
|
93
|
+
"faucet.amount": opts.amount.toString(),
|
|
94
|
+
"faucet.budget_ms": timeoutMs,
|
|
95
|
+
"faucet.max_attempts": maxAttempts
|
|
96
|
+
});
|
|
97
|
+
const attempts = yield* Ref.make(0);
|
|
98
|
+
const lastError = yield* Ref.make(void 0);
|
|
99
|
+
yield* requestFundsOnce(opts).pipe(Effect.tapError((err) => Effect.gen(function* () {
|
|
100
|
+
const n = yield* Ref.updateAndGet(attempts, (x) => x + 1);
|
|
101
|
+
yield* Ref.set(lastError, err);
|
|
102
|
+
if (opts.onAttempt !== void 0) yield* opts.onAttempt(n, err);
|
|
103
|
+
}))).pipe(Effect.retry(makeExponentialRetrySchedule({
|
|
104
|
+
initialDelayMs,
|
|
105
|
+
maxRetries: maxAttempts,
|
|
106
|
+
factor: BACKOFF_FACTOR
|
|
107
|
+
})), Effect.timeoutOrElse({
|
|
108
|
+
duration: `${timeoutMs} millis`,
|
|
109
|
+
orElse: () => Effect.gen(function* () {
|
|
110
|
+
const n = yield* Ref.get(attempts);
|
|
111
|
+
const last = yield* Ref.get(lastError);
|
|
112
|
+
return yield* Effect.fail(faucetExhausted({
|
|
113
|
+
kind: "wall-clock",
|
|
114
|
+
url: opts.faucetUrl,
|
|
115
|
+
address: opts.address,
|
|
116
|
+
amount: opts.amount,
|
|
117
|
+
attempts: n,
|
|
118
|
+
message: `faucet did not accept request within ${timeoutMs}ms (${n} attempts; last: ${last?.message ?? "unknown"})`,
|
|
119
|
+
lastCause: last
|
|
120
|
+
}));
|
|
121
|
+
})
|
|
122
|
+
}));
|
|
123
|
+
}).pipe(Effect.withSpan("faucet.requestFundsWithRetry"));
|
|
124
|
+
//#endregion
|
|
125
|
+
export { requestFundsWithRetry };
|
|
126
|
+
|
|
127
|
+
//# sourceMappingURL=http.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.mjs","names":[],"sources":["../../../src/plugins/faucet/http.ts"],"sourcesContent":["// Faucet HTTP wrapper.\n//\n// One module per the distilled-doc \"collapse engine/service split\"\n// guidance — the HTTP helper is the only wire-level path for any\n// HTTP-based faucet strategy, and it lives WITH the plugin instead\n// of in a sibling engine module.\n//\n// Wire-level invariants (distilled doc §Invariants):\n//\n// 1. A non-2xx HTTP status MUST raise (NOT be treated as success).\n// The Sui faucet binds its TCP socket before its validator can\n// transfer coins — the warm-up window returns 5xx and must be\n// retried, not silently absorbed.\n//\n// 2. A 200 OK body with `{ status: { Failure: ... } }` MUST raise.\n// The single most load-bearing invariant in this module: during\n// warm-up the faucet ACCEPTS requests it cannot execute (gas\n// object stale, consensus hiccup, mid-genesis). Treating those\n// bodies as success marks accounts funded when no coins moved.\n//\n// 3. Per-fetch deadline is short relative to wall-clock budget\n// (5s vs 90s). The faucet's internal retries can block one POST\n// for ~60s; capping each POST lets the outer retry loop hammer\n// quickly and land on the first attempt after the chain catches\n// up.\n//\n// 4. Retry MUST jitter. Pre-jitter, parallel-account retries\n// synchronized on the wall-clock tick and thundering-herded the\n// faucet.\n//\n// The shared funds-transferable barrier (invariant #5 in the doc)\n// is owned by Sui and surfaced via the `gate:funds-ready` strategy\n// in `contracts/network-resolver.ts`; consumers call it before the\n// FIRST POST. This module is barrier-agnostic: it assumes callers\n// gate themselves.\n//\n// HTTP transport: `globalThis.fetch` + `AbortSignal.timeout`. Kept\n// direct rather than going through `@effect/platform-node`'s\n// `HttpClient`: this body owns the wire-level contract (status,\n// body-Failure detection, per-fetch deadline) and adding the Effect\n// HttpClient layer here would not change behaviour at any of the\n// invariants above.\n\nimport { Effect, Ref } from 'effect';\n\nimport { makeExponentialRetrySchedule } from '../../substrate/runtime/retry-policy.ts';\nimport {\n\tfaucetBodyError,\n\tfaucetExhausted,\n\tfaucetUnreachable,\n\ttype FaucetBodyError,\n\ttype FaucetExhausted,\n\ttype FaucetUnreachable,\n} from './errors.ts';\n\n// ---------------------------------------------------------------------------\n// Default retry profile\n// ---------------------------------------------------------------------------\n\n/** Retry attempts cap. Paired with the wall-clock budget below: at\n * 500ms initial × 1.5 backoff × jitter, 15 attempts saturates well\n * before 90s, so the wall-clock check is the dominant exit. */\nexport const DEFAULT_MAX_ATTEMPTS = 15;\n\n/** Initial delay between retries (ms). Subsequent delays grow by\n * the `BACKOFF_FACTOR`. */\nexport const DEFAULT_INITIAL_DELAY_MS = 500;\n\n/** Wall-clock budget for the WHOLE request including all retries.\n * Sized for a cold sui-localnet boot — the validator binary needs\n * ~30–60s after its HTTP socket opens before it can submit txs. */\nexport const DEFAULT_TIMEOUT_MS = 90_000;\n\n/** Exponential growth factor between retries. */\nexport const BACKOFF_FACTOR = 1.5;\n\n/** Per-POST hard deadline. The sui-faucet binary internally retries\n * the underlying SUI transfer tx twice with ~30s timeouts; a single\n * cold-chain request blocks ~60s before returning 500. Capping each\n * POST at 5s lets the outer retry loop hammer quickly — when the\n * chain catches up the next attempt lands in <1s. Successful\n * warm-faucet calls return well under 1s, so 5s is a safe ceiling. */\nexport const DEFAULT_FETCH_DEADLINE_MS = 5_000;\n\n// ---------------------------------------------------------------------------\n// Single-shot POST + body parser\n// ---------------------------------------------------------------------------\n\n/** Configuration for a single faucet POST. */\nexport interface FaucetPostOptions {\n\t/** Base URL — e.g. `http://localhost:9123` or\n\t * `https://faucet.testnet.sui.io`. Path is appended internally. */\n\treadonly faucetUrl: string;\n\t/** Recipient address. */\n\treadonly address: string;\n\t/** Amount in the strategy-native unit (carried through to error\n\t * payloads). The Sui HTTP faucet itself ignores `amount` and\n\t * funds a fixed grant per request; the field is here so\n\t * exhaustion errors carry the unit-correct value. */\n\treadonly amount: bigint;\n\t/** Endpoint path (default `/v2/gas`). Live faucets sometimes\n\t * diverge — `/gas` on older endpoints. */\n\treadonly path?: string;\n\t/** Per-fetch deadline in ms (default `DEFAULT_FETCH_DEADLINE_MS`). */\n\treadonly fetchDeadlineMs?: number;\n}\n\n/**\n * One-shot POST: send + check status + parse body + check body\n * status. Exported so tests can pin the body-Failure detection\n * without paying the retry / wall-clock cost of the wrapper. Production\n * callers go through `requestFundsWithRetry`.\n *\n * Failure modes raised:\n * - `FaucetUnreachable` on transport failure (fetch reject, abort\n * timeout, network error).\n * - `FaucetBodyError` on non-2xx, body Failure status, or\n * unparseable JSON. The doc-load-bearing distinction.\n */\nexport const requestFundsOnce = (\n\topts: FaucetPostOptions,\n): Effect.Effect<void, FaucetUnreachable | FaucetBodyError> =>\n\tEffect.gen(function* () {\n\t\tconst path = opts.path ?? '/v2/gas';\n\t\tconst endpoint = `${opts.faucetUrl}${path}`;\n\t\tconst deadlineMs = opts.fetchDeadlineMs ?? DEFAULT_FETCH_DEADLINE_MS;\n\n\t\tconst response = yield* Effect.tryPromise({\n\t\t\ttry: () =>\n\t\t\t\tfetch(endpoint, {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\theaders: { 'content-type': 'application/json' },\n\t\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\t\tFixedAmountRequest: { recipient: opts.address },\n\t\t\t\t\t}),\n\t\t\t\t\tsignal: AbortSignal.timeout(deadlineMs),\n\t\t\t\t}),\n\t\t\tcatch: (cause) =>\n\t\t\t\tfaucetUnreachable({\n\t\t\t\t\turl: opts.faucetUrl,\n\t\t\t\t\taddress: opts.address,\n\t\t\t\t\tamount: opts.amount,\n\t\t\t\t\tmessage: `faucet POST to ${endpoint} failed (transport)`,\n\t\t\t\t\tcause,\n\t\t\t\t}),\n\t\t});\n\n\t\t// Invariant #1: non-2xx MUST raise. We read the body\n\t\t// best-effort so the diagnostic carries the upstream reason\n\t\t// instead of just a numeric status.\n\t\tif (!response.ok) {\n\t\t\tconst body = yield* Effect.tryPromise({\n\t\t\t\ttry: () => response.text(),\n\t\t\t\tcatch: () => undefined,\n\t\t\t}).pipe(Effect.orElseSucceed(() => undefined as string | undefined));\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tfaucetBodyError({\n\t\t\t\t\turl: opts.faucetUrl,\n\t\t\t\t\taddress: opts.address,\n\t\t\t\t\tamount: opts.amount,\n\t\t\t\t\tstatus: response.status,\n\t\t\t\t\treason: 'failure-status',\n\t\t\t\t\tmessage: `faucet returned ${response.status} ${response.statusText}`,\n\t\t\t\t\t...(body !== undefined && body.length > 0 ? { bodySnippet: body } : {}),\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\t// Invariant #2: 200 OK with body-level Failure MUST raise.\n\t\t// We treat JSON-parse failure as a `malformed-body` raise too —\n\t\t// during cold boot the faucet very occasionally writes an empty\n\t\t// or truncated body before it's ready, and silently accepting\n\t\t// that mirrors the bug we're explicitly guarding against.\n\t\tconst body = (yield* Effect.tryPromise({\n\t\t\ttry: () => response.json() as Promise<unknown>,\n\t\t\tcatch: (cause) =>\n\t\t\t\tfaucetBodyError({\n\t\t\t\t\turl: opts.faucetUrl,\n\t\t\t\t\taddress: opts.address,\n\t\t\t\t\tamount: opts.amount,\n\t\t\t\t\tstatus: response.status,\n\t\t\t\t\treason: 'invalid-json',\n\t\t\t\t\tmessage: 'faucet response was not valid JSON',\n\t\t\t\t\t...(cause !== undefined ? { bodySnippet: String(cause) } : {}),\n\t\t\t\t}),\n\t\t})) as { status?: unknown };\n\n\t\tconst status = body.status;\n\t\tif (typeof status === 'object' && status !== null && 'Failure' in status) {\n\t\t\tconst payload = JSON.stringify((status as { Failure: unknown }).Failure);\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tfaucetBodyError({\n\t\t\t\t\turl: opts.faucetUrl,\n\t\t\t\t\taddress: opts.address,\n\t\t\t\t\tamount: opts.amount,\n\t\t\t\t\tstatus: response.status,\n\t\t\t\t\treason: 'failure-status',\n\t\t\t\t\tmessage: `faucet body reported Failure: ${payload}`,\n\t\t\t\t\tbodySnippet: payload,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t}).pipe(Effect.withSpan('faucet.requestFundsOnce'));\n\n// ---------------------------------------------------------------------------\n// Retry wrapper\n// ---------------------------------------------------------------------------\n\n/** Configuration for a retry-wrapped faucet POST. */\nexport interface RetryOptions extends FaucetPostOptions {\n\t/** Wall-clock budget for the WHOLE request including retries.\n\t * Default `DEFAULT_TIMEOUT_MS`. CI configs pointing at a clearly\n\t * broken faucet can lower this to fail-fast. */\n\treadonly timeoutMs?: number;\n\t/** Max attempts cap. Default `DEFAULT_MAX_ATTEMPTS`. */\n\treadonly maxAttempts?: number;\n\t/** Initial inter-attempt delay (ms). Default\n\t * `DEFAULT_INITIAL_DELAY_MS`. */\n\treadonly initialDelayMs?: number;\n\t/** Optional per-attempt callback. Lets callers surface \"waiting\n\t * on faucet (attempt N)\" in a TUI row so cold-start doesn't look\n\t * like a hang. */\n\treadonly onAttempt?: (\n\t\tattempt: number,\n\t\terror: FaucetUnreachable | FaucetBodyError,\n\t) => Effect.Effect<void>;\n}\n\n/**\n * Retry-wrapped POST. Combines `requestFundsOnce` with a jittered\n * exponential schedule and a wall-clock budget; on exhaustion raises\n * `FaucetExhausted` carrying the last underlying cause.\n *\n * Invariant #4 (jitter): handled by the schedule above. Invariant #3\n * (per-fetch deadline): handled by `requestFundsOnce`'s\n * `AbortSignal.timeout`.\n */\nexport const requestFundsWithRetry = (\n\topts: RetryOptions,\n): Effect.Effect<void, FaucetExhausted | FaucetUnreachable | FaucetBodyError> =>\n\tEffect.gen(function* () {\n\t\tconst timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n\t\tconst maxAttempts = opts.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;\n\t\tconst initialDelayMs = opts.initialDelayMs ?? DEFAULT_INITIAL_DELAY_MS;\n\n\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t'faucet.url': opts.faucetUrl,\n\t\t\t'faucet.address': opts.address,\n\t\t\t'faucet.amount': opts.amount.toString(),\n\t\t\t'faucet.budget_ms': timeoutMs,\n\t\t\t'faucet.max_attempts': maxAttempts,\n\t\t});\n\n\t\tconst attempts = yield* Ref.make(0);\n\t\tconst lastError = yield* Ref.make<FaucetUnreachable | FaucetBodyError | undefined>(undefined);\n\n\t\tconst wrapped = requestFundsOnce(opts).pipe(\n\t\t\tEffect.tapError((err) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst n = yield* Ref.updateAndGet(attempts, (x) => x + 1);\n\t\t\t\t\tyield* Ref.set(lastError, err);\n\t\t\t\t\tif (opts.onAttempt !== undefined) {\n\t\t\t\t\t\tyield* opts.onAttempt(n, err);\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\n\t\tyield* wrapped.pipe(\n\t\t\tEffect.retry(\n\t\t\t\tmakeExponentialRetrySchedule({\n\t\t\t\t\tinitialDelayMs,\n\t\t\t\t\tmaxRetries: maxAttempts,\n\t\t\t\t\tfactor: BACKOFF_FACTOR,\n\t\t\t\t}),\n\t\t\t),\n\t\t\tEffect.timeoutOrElse({\n\t\t\t\tduration: `${timeoutMs} millis`,\n\t\t\t\torElse: () =>\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tconst n = yield* Ref.get(attempts);\n\t\t\t\t\t\tconst last = yield* Ref.get(lastError);\n\t\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\t\tfaucetExhausted({\n\t\t\t\t\t\t\t\tkind: 'wall-clock',\n\t\t\t\t\t\t\t\turl: opts.faucetUrl,\n\t\t\t\t\t\t\t\taddress: opts.address,\n\t\t\t\t\t\t\t\tamount: opts.amount,\n\t\t\t\t\t\t\t\tattempts: n,\n\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t`faucet did not accept request within ${timeoutMs}ms ` +\n\t\t\t\t\t\t\t\t\t`(${n} attempts; last: ${last?.message ?? 'unknown'})`,\n\t\t\t\t\t\t\t\tlastCause: last,\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}),\n\t\t);\n\t}).pipe(Effect.withSpan('faucet.requestFundsWithRetry'));\n"],"mappings":";;;;AA0EA,MAAa,iBAAiB;;;;;;;;;;;;;AA6C9B,MAAa,oBACZ,SAEA,OAAO,IAAI,aAAa;CACvB,MAAM,OAAO,KAAK,QAAQ;CAC1B,MAAM,WAAW,GAAG,KAAK,YAAY;CACrC,MAAM,aAAa,KAAK,mBAAA;CAExB,MAAM,WAAW,OAAO,OAAO,WAAW;EACzC,WACC,MAAM,UAAU;GACf,QAAQ;GACR,SAAS,EAAE,gBAAgB,oBAAoB;GAC/C,MAAM,KAAK,UAAU,EACpB,oBAAoB,EAAE,WAAW,KAAK,SAAS,EAC/C,CAAC;GACF,QAAQ,YAAY,QAAQ,WAAW;GACvC,CAAC;EACH,QAAQ,UACP,kBAAkB;GACjB,KAAK,KAAK;GACV,SAAS,KAAK;GACd,QAAQ,KAAK;GACb,SAAS,kBAAkB,SAAS;GACpC;GACA,CAAC;EACH,CAAC;AAKF,KAAI,CAAC,SAAS,IAAI;EACjB,MAAM,OAAO,OAAO,OAAO,WAAW;GACrC,WAAW,SAAS,MAAM;GAC1B,aAAa,KAAA;GACb,CAAC,CAAC,KAAK,OAAO,oBAAoB,KAAA,EAAgC,CAAC;AACpE,SAAO,OAAO,OAAO,KACpB,gBAAgB;GACf,KAAK,KAAK;GACV,SAAS,KAAK;GACd,QAAQ,KAAK;GACb,QAAQ,SAAS;GACjB,QAAQ;GACR,SAAS,mBAAmB,SAAS,OAAO,GAAG,SAAS;GACxD,GAAI,SAAS,KAAA,KAAa,KAAK,SAAS,IAAI,EAAE,aAAa,MAAM,GAAG,EAAE;GACtE,CAAC,CACF;;CAsBF,MAAM,UAAS,OAdM,OAAO,WAAW;EACtC,WAAW,SAAS,MAAM;EAC1B,QAAQ,UACP,gBAAgB;GACf,KAAK,KAAK;GACV,SAAS,KAAK;GACd,QAAQ,KAAK;GACb,QAAQ,SAAS;GACjB,QAAQ;GACR,SAAS;GACT,GAAI,UAAU,KAAA,IAAY,EAAE,aAAa,OAAO,MAAM,EAAE,GAAG,EAAE;GAC7D,CAAC;EACH,CAAC,EAEkB;AACpB,KAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,aAAa,QAAQ;EACzE,MAAM,UAAU,KAAK,UAAW,OAAgC,QAAQ;AACxE,SAAO,OAAO,OAAO,KACpB,gBAAgB;GACf,KAAK,KAAK;GACV,SAAS,KAAK;GACd,QAAQ,KAAK;GACb,QAAQ,SAAS;GACjB,QAAQ;GACR,SAAS,iCAAiC;GAC1C,aAAa;GACb,CAAC,CACF;;EAED,CAAC,KAAK,OAAO,SAAS,0BAA0B,CAAC;;;;;;;;;;AAmCpD,MAAa,yBACZ,SAEA,OAAO,IAAI,aAAa;CACvB,MAAM,YAAY,KAAK,aAAA;CACvB,MAAM,cAAc,KAAK,eAAA;CACzB,MAAM,iBAAiB,KAAK,kBAAA;AAE5B,QAAO,OAAO,oBAAoB;EACjC,cAAc,KAAK;EACnB,kBAAkB,KAAK;EACvB,iBAAiB,KAAK,OAAO,UAAU;EACvC,oBAAoB;EACpB,uBAAuB;EACvB,CAAC;CAEF,MAAM,WAAW,OAAO,IAAI,KAAK,EAAE;CACnC,MAAM,YAAY,OAAO,IAAI,KAAsD,KAAA,EAAU;AAc7F,QAZgB,iBAAiB,KAAK,CAAC,KACtC,OAAO,UAAU,QAChB,OAAO,IAAI,aAAa;EACvB,MAAM,IAAI,OAAO,IAAI,aAAa,WAAW,MAAM,IAAI,EAAE;AACzD,SAAO,IAAI,IAAI,WAAW,IAAI;AAC9B,MAAI,KAAK,cAAc,KAAA,EACtB,QAAO,KAAK,UAAU,GAAG,IAAI;GAE7B,CACF,CAGY,CAAC,KACd,OAAO,MACN,6BAA6B;EAC5B;EACA,YAAY;EACZ,QAAQ;EACR,CAAC,CACF,EACD,OAAO,cAAc;EACpB,UAAU,GAAG,UAAU;EACvB,cACC,OAAO,IAAI,aAAa;GACvB,MAAM,IAAI,OAAO,IAAI,IAAI,SAAS;GAClC,MAAM,OAAO,OAAO,IAAI,IAAI,UAAU;AACtC,UAAO,OAAO,OAAO,KACpB,gBAAgB;IACf,MAAM;IACN,KAAK,KAAK;IACV,SAAS,KAAK;IACd,QAAQ,KAAK;IACb,UAAU;IACV,SACC,wCAAwC,UAAU,MAC9C,EAAE,mBAAmB,MAAM,WAAW,UAAU;IACrD,WAAW;IACX,CAAC,CACF;IACA;EACH,CAAC,CACF;EACA,CAAC,KAAK,OAAO,SAAS,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { StrategyContributorDecl } from "../../contracts/strategy-contributor.mjs";
|
|
2
|
+
import { FaucetBodyError, FaucetConfigError, FaucetError, FaucetExhausted, FaucetUnreachable } from "./errors.mjs";
|
|
3
|
+
import { FAUCET_CAPABILITY_KEY_PREFIX } from "./dispatcher.mjs";
|
|
4
|
+
import { FaucetStrategy } from "./strategies/sui-local.mjs";
|
|
5
|
+
import { FaucetStrategyContribution } from "./service.mjs";
|
|
6
|
+
|
|
7
|
+
//#region src/plugins/faucet/index.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Build a `StrategyContributorDecl` for a faucet request strategy.
|
|
10
|
+
* Use from a sibling plugin's `capabilities` array so the
|
|
11
|
+
* substrate auto-registers the strategy as the plugin acquires:
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* definePlugin({
|
|
15
|
+
* id: 'my-faucet-strategy',
|
|
16
|
+
* role: 'service',
|
|
17
|
+
* start: () => Effect.succeed({}),
|
|
18
|
+
* capabilities: [
|
|
19
|
+
* defineFaucetStrategy({
|
|
20
|
+
* chainId: 'sui:my-net',
|
|
21
|
+
* strategy: makeMyFaucetStrategy(opts),
|
|
22
|
+
* }),
|
|
23
|
+
* ],
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* The capability key is computed from the chain id so the dispatcher
|
|
28
|
+
* picks the contribution up automatically — no extra wiring on the
|
|
29
|
+
* faucet-plugin side.
|
|
30
|
+
*
|
|
31
|
+
* `autoMounted` defaults to `false` (third-party contributions show
|
|
32
|
+
* up in the dashboard). Pass `autoMounted: true` for built-ins that
|
|
33
|
+
* the orchestrator includes automatically.
|
|
34
|
+
*/
|
|
35
|
+
declare function defineFaucetStrategy<ChainId extends string>(decl: {
|
|
36
|
+
readonly chainId: ChainId;
|
|
37
|
+
readonly strategy: FaucetStrategy;
|
|
38
|
+
readonly autoMounted?: boolean;
|
|
39
|
+
readonly priority?: number;
|
|
40
|
+
}): StrategyContributorDecl<`${typeof FAUCET_CAPABILITY_KEY_PREFIX}:${ChainId}`, FaucetStrategy>;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { defineFaucetStrategy };
|
|
43
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { faucetCapabilityKey } from "./dispatcher.mjs";
|
|
2
|
+
//#region src/plugins/faucet/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* Build a `StrategyContributorDecl` for a faucet request strategy.
|
|
5
|
+
* Use from a sibling plugin's `capabilities` array so the
|
|
6
|
+
* substrate auto-registers the strategy as the plugin acquires:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* definePlugin({
|
|
10
|
+
* id: 'my-faucet-strategy',
|
|
11
|
+
* role: 'service',
|
|
12
|
+
* start: () => Effect.succeed({}),
|
|
13
|
+
* capabilities: [
|
|
14
|
+
* defineFaucetStrategy({
|
|
15
|
+
* chainId: 'sui:my-net',
|
|
16
|
+
* strategy: makeMyFaucetStrategy(opts),
|
|
17
|
+
* }),
|
|
18
|
+
* ],
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* The capability key is computed from the chain id so the dispatcher
|
|
23
|
+
* picks the contribution up automatically — no extra wiring on the
|
|
24
|
+
* faucet-plugin side.
|
|
25
|
+
*
|
|
26
|
+
* `autoMounted` defaults to `false` (third-party contributions show
|
|
27
|
+
* up in the dashboard). Pass `autoMounted: true` for built-ins that
|
|
28
|
+
* the orchestrator includes automatically.
|
|
29
|
+
*/
|
|
30
|
+
function defineFaucetStrategy(decl) {
|
|
31
|
+
return {
|
|
32
|
+
kind: "strategy-contributor",
|
|
33
|
+
capabilityKey: faucetCapabilityKey(decl.chainId),
|
|
34
|
+
strategy: decl.strategy,
|
|
35
|
+
autoMounted: decl.autoMounted ?? false,
|
|
36
|
+
...decl.priority !== void 0 ? { priority: decl.priority } : {}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { defineFaucetStrategy };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugins/faucet/index.ts"],"sourcesContent":["// Faucet plugin-author helpers.\n//\n// Author-side helper: `defineFaucetStrategy(...)` packages a\n// `{ chainId, strategy }` pair into a `StrategyContributorDecl` so\n// third-party plugins can contribute strategies declaratively. The\n// helper threads the literal `chainId` through the type so the\n// downstream consumer's `StrategyFor<...>` lookup recovers the\n// strategy's shape. Built-in account funding reads the strategy\n// registry directly; there is no public `faucet()` stack member.\n\nimport type { StrategyContributorDecl } from '../../contracts/strategy-contributor.ts';\nimport { FAUCET_CAPABILITY_KEY_PREFIX, faucetCapabilityKey } from './dispatcher.ts';\nimport type { FaucetStrategy } from './strategies/sui-local.ts';\n\n// ---------------------------------------------------------------------------\n// Author-side: helper for third-party strategy contributions.\n// ---------------------------------------------------------------------------\n\n/**\n * Build a `StrategyContributorDecl` for a faucet request strategy.\n * Use from a sibling plugin's `capabilities` array so the\n * substrate auto-registers the strategy as the plugin acquires:\n *\n * ```ts\n * definePlugin({\n * id: 'my-faucet-strategy',\n * role: 'service',\n * start: () => Effect.succeed({}),\n * capabilities: [\n * defineFaucetStrategy({\n * chainId: 'sui:my-net',\n * strategy: makeMyFaucetStrategy(opts),\n * }),\n * ],\n * });\n * ```\n *\n * The capability key is computed from the chain id so the dispatcher\n * picks the contribution up automatically — no extra wiring on the\n * faucet-plugin side.\n *\n * `autoMounted` defaults to `false` (third-party contributions show\n * up in the dashboard). Pass `autoMounted: true` for built-ins that\n * the orchestrator includes automatically.\n */\nexport function defineFaucetStrategy<ChainId extends string>(decl: {\n\treadonly chainId: ChainId;\n\treadonly strategy: FaucetStrategy;\n\treadonly autoMounted?: boolean;\n\treadonly priority?: number;\n}): StrategyContributorDecl<`${typeof FAUCET_CAPABILITY_KEY_PREFIX}:${ChainId}`, FaucetStrategy> {\n\treturn {\n\t\tkind: 'strategy-contributor',\n\t\tcapabilityKey: faucetCapabilityKey(decl.chainId),\n\t\tstrategy: decl.strategy,\n\t\tautoMounted: decl.autoMounted ?? false,\n\t\t...(decl.priority !== undefined ? { priority: decl.priority } : {}),\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Re-exports\n// ---------------------------------------------------------------------------\n\nexport type { FaucetStrategyContribution } from './service.ts';\nexport type {\n\tFaucetError,\n\tFaucetUnreachable,\n\tFaucetExhausted,\n\tFaucetBodyError,\n\tFaucetConfigError,\n} from './errors.ts';\nexport type { FaucetStrategy } from './strategies/sui-local.ts';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,qBAA6C,MAKoC;AAChG,QAAO;EACN,MAAM;EACN,eAAe,oBAAoB,KAAK,QAAQ;EAChD,UAAU,KAAK;EACf,aAAa,KAAK,eAAe;EACjC,GAAI,KAAK,aAAa,KAAA,IAAY,EAAE,UAAU,KAAK,UAAU,GAAG,EAAE;EAClE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FaucetStrategy } from "./strategies/sui-local.mjs";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/faucet/service.d.ts
|
|
5
|
+
/** A registered strategy contribution. The faucet plugin accepts
|
|
6
|
+
* these from the factory's options so callers can add per-chain
|
|
7
|
+
* faucets (custom fork admins, alt-network strategies) without
|
|
8
|
+
* authoring a sibling plugin. */
|
|
9
|
+
interface FaucetStrategyContribution {
|
|
10
|
+
/** Capability-key chain id (`'sui:localnet'`, `'sui:testnet'`, etc.). */
|
|
11
|
+
readonly chainId: string;
|
|
12
|
+
/** The strategy value — closes over its own dependencies. */
|
|
13
|
+
readonly strategy: FaucetStrategy;
|
|
14
|
+
/** Optional priority. Defaults to `1` so user strategies win
|
|
15
|
+
* over the built-in's `0`. */
|
|
16
|
+
readonly priority?: number;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { FaucetStrategyContribution };
|
|
20
|
+
//# sourceMappingURL=service.d.mts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FaucetBodyError, FaucetExhausted, FaucetUnreachable } from "../errors.mjs";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/faucet/strategies/sui-local.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Faucet strategy value. The dispatch surface is uniform across
|
|
7
|
+
* strategies — the dispatcher doesn't know how a strategy delivers
|
|
8
|
+
* coins, only how to invoke it.
|
|
9
|
+
*
|
|
10
|
+
* `amount` is in MIST (1 SUI = 10^9 MIST), the chain's smallest unit.
|
|
11
|
+
* The local faucet binary itself ignores this and grants a fixed
|
|
12
|
+
* amount per request; the parameter is here for type uniformity and
|
|
13
|
+
* to land correctly-denominated values in `FaucetExhausted`.
|
|
14
|
+
*/
|
|
15
|
+
interface FaucetStrategy {
|
|
16
|
+
readonly request: (req: {
|
|
17
|
+
readonly address: string;
|
|
18
|
+
readonly amount: bigint;
|
|
19
|
+
}) => Effect.Effect<void, FaucetExhausted | FaucetUnreachable | FaucetBodyError>;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { FaucetStrategy };
|
|
23
|
+
//# sourceMappingURL=sui-local.d.mts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { leaseKey } from "../../../substrate/runtime/lease-broker/service.mjs";
|
|
2
|
+
import { requestFundsWithRetry } from "../http.mjs";
|
|
3
|
+
import { Effect } from "effect";
|
|
4
|
+
//#region src/plugins/faucet/strategies/sui-local.ts
|
|
5
|
+
const withSerialization = (serialization, effect) => {
|
|
6
|
+
if (serialization === void 0) return effect;
|
|
7
|
+
return Effect.scoped(Effect.gen(function* () {
|
|
8
|
+
yield* serialization.broker.acquire(leaseKey(serialization.key), serialization.owner);
|
|
9
|
+
yield* effect;
|
|
10
|
+
})).pipe(Effect.withSpan("faucet.suiLocal.serializedRequest", { attributes: {
|
|
11
|
+
"faucet.lease.key": serialization.key,
|
|
12
|
+
"faucet.lease.owner": serialization.owner
|
|
13
|
+
} }));
|
|
14
|
+
};
|
|
15
|
+
/** Build a SUI local-faucet HTTP strategy. */
|
|
16
|
+
const suiLocalStrategy = (opts) => ({ request: ({ address, amount }) => {
|
|
17
|
+
const retryOpts = {
|
|
18
|
+
faucetUrl: opts.faucetUrl,
|
|
19
|
+
address,
|
|
20
|
+
amount,
|
|
21
|
+
...opts.timeoutMs !== void 0 ? { timeoutMs: opts.timeoutMs } : {},
|
|
22
|
+
...opts.maxAttempts !== void 0 ? { maxAttempts: opts.maxAttempts } : {}
|
|
23
|
+
};
|
|
24
|
+
return withSerialization(opts.serialization, requestFundsWithRetry(retryOpts));
|
|
25
|
+
} });
|
|
26
|
+
//#endregion
|
|
27
|
+
export { suiLocalStrategy };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=sui-local.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sui-local.mjs","names":[],"sources":["../../../../src/plugins/faucet/strategies/sui-local.ts"],"sourcesContent":["// SUI local-faucet HTTP strategy.\n//\n// Wraps the in-stack `sui-faucet` HTTP server hosted by the local\n// (or external) Sui container. The faucet URL comes from Sui's\n// resolver (`ResolvedSuiNetwork.faucet`) at acquire time; the\n// strategy CLOSES OVER the URL at construction, so the dispatch\n// site never sees Sui context.\n//\n// Amount semantics: the local faucet returns a fixed-amount grant\n// per request (the binary doesn't honor a variable amount today).\n// We carry `amount` through to error payloads so exhaustion errors\n// match the strategy-native unit (MIST), but the wire request\n// itself does not include it.\n//\n// Distilled-doc opportunity #1 (`Generalize the strategy-registry\n// pattern`): this file is the canonical small example. The whole\n// strategy is 30-ish lines because everything wire-level lives in\n// the shared `http.ts` helper.\n\nimport { Effect } from 'effect';\n\nimport { leaseKey, type LeaseBroker } from '../../../substrate/runtime/lease-broker/index.ts';\nimport { requestFundsWithRetry, type RetryOptions } from '../http.ts';\nimport type { FaucetBodyError, FaucetExhausted, FaucetUnreachable } from '../errors.ts';\n\n/** Optional serialization for faucet backends that spend a shared funding coin. */\nexport interface SuiLocalFaucetSerialization {\n\t/** Stack-local broker; callers choose the resource key shape. */\n\treadonly broker: LeaseBroker;\n\t/** Opaque lease key, typically scoped by chain id. */\n\treadonly key: string;\n\t/** Diagnostic owner reported by the lease broker. */\n\treadonly owner: string;\n}\n\n/** Per-strategy options. */\nexport interface SuiLocalStrategyOptions {\n\t/** Faucet base URL — e.g. `http://localhost:9123`. The strategy\n\t * appends `/v2/gas` internally. */\n\treadonly faucetUrl: string;\n\t/** Wall-clock budget; forwarded to `requestFundsWithRetry`. */\n\treadonly timeoutMs?: number;\n\t/** Max retry attempts; forwarded to `requestFundsWithRetry`. */\n\treadonly maxAttempts?: number;\n\t/** Serialize requests when the faucet backend shares one funding coin. */\n\treadonly serialization?: SuiLocalFaucetSerialization;\n}\n\n/**\n * Faucet strategy value. The dispatch surface is uniform across\n * strategies — the dispatcher doesn't know how a strategy delivers\n * coins, only how to invoke it.\n *\n * `amount` is in MIST (1 SUI = 10^9 MIST), the chain's smallest unit.\n * The local faucet binary itself ignores this and grants a fixed\n * amount per request; the parameter is here for type uniformity and\n * to land correctly-denominated values in `FaucetExhausted`.\n */\nexport interface FaucetStrategy {\n\treadonly request: (req: {\n\t\treadonly address: string;\n\t\treadonly amount: bigint;\n\t}) => Effect.Effect<void, FaucetExhausted | FaucetUnreachable | FaucetBodyError>;\n}\n\nconst withSerialization = <E>(\n\tserialization: SuiLocalFaucetSerialization | undefined,\n\teffect: Effect.Effect<void, E>,\n): Effect.Effect<void, E> => {\n\tif (serialization === undefined) {\n\t\treturn effect;\n\t}\n\treturn Effect.scoped(\n\t\tEffect.gen(function* () {\n\t\t\tyield* serialization.broker.acquire(leaseKey(serialization.key), serialization.owner);\n\t\t\tyield* effect;\n\t\t}),\n\t).pipe(\n\t\tEffect.withSpan('faucet.suiLocal.serializedRequest', {\n\t\t\tattributes: {\n\t\t\t\t'faucet.lease.key': serialization.key,\n\t\t\t\t'faucet.lease.owner': serialization.owner,\n\t\t\t},\n\t\t}),\n\t);\n};\n\n/** Build a SUI local-faucet HTTP strategy. */\nexport const suiLocalStrategy = (opts: SuiLocalStrategyOptions): FaucetStrategy => ({\n\trequest: ({ address, amount }) => {\n\t\tconst retryOpts: RetryOptions = {\n\t\t\tfaucetUrl: opts.faucetUrl,\n\t\t\taddress,\n\t\t\tamount,\n\t\t\t...(opts.timeoutMs !== undefined ? { timeoutMs: opts.timeoutMs } : {}),\n\t\t\t...(opts.maxAttempts !== undefined ? { maxAttempts: opts.maxAttempts } : {}),\n\t\t};\n\t\treturn withSerialization(opts.serialization, requestFundsWithRetry(retryOpts));\n\t},\n});\n"],"mappings":";;;;AAiEA,MAAM,qBACL,eACA,WAC4B;AAC5B,KAAI,kBAAkB,KAAA,EACrB,QAAO;AAER,QAAO,OAAO,OACb,OAAO,IAAI,aAAa;AACvB,SAAO,cAAc,OAAO,QAAQ,SAAS,cAAc,IAAI,EAAE,cAAc,MAAM;AACrF,SAAO;GACN,CACF,CAAC,KACD,OAAO,SAAS,qCAAqC,EACpD,YAAY;EACX,oBAAoB,cAAc;EAClC,sBAAsB,cAAc;EACpC,EACD,CAAC,CACF;;;AAIF,MAAa,oBAAoB,UAAmD,EACnF,UAAU,EAAE,SAAS,aAAa;CACjC,MAAM,YAA0B;EAC/B,WAAW,KAAK;EAChB;EACA;EACA,GAAI,KAAK,cAAc,KAAA,IAAY,EAAE,WAAW,KAAK,WAAW,GAAG,EAAE;EACrE,GAAI,KAAK,gBAAgB,KAAA,IAAY,EAAE,aAAa,KAAK,aAAa,GAAG,EAAE;EAC3E;AACD,QAAO,kBAAkB,KAAK,eAAe,sBAAsB,UAAU,CAAC;GAE/E"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ConfigIssue } from "../../substrate/runtime/config-validation.mjs";
|
|
2
|
+
import * as _$effect_Types0 from "effect/Types";
|
|
3
|
+
import * as _$effect_Cause0 from "effect/Cause";
|
|
4
|
+
|
|
5
|
+
//#region src/plugins/host-service/errors.d.ts
|
|
6
|
+
interface HostServiceConfigError extends ConfigIssue {
|
|
7
|
+
readonly _tag: 'HostServiceConfigError';
|
|
8
|
+
readonly serviceName: string;
|
|
9
|
+
}
|
|
10
|
+
declare const HostServiceAcquireError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
|
|
11
|
+
readonly _tag: "HostServiceAcquireError";
|
|
12
|
+
} & Readonly<A>;
|
|
13
|
+
declare class HostServiceAcquireError extends HostServiceAcquireError_base<{
|
|
14
|
+
readonly serviceName: string;
|
|
15
|
+
readonly cwd: string;
|
|
16
|
+
readonly command: string;
|
|
17
|
+
readonly args: ReadonlyArray<string>;
|
|
18
|
+
readonly phase: 'allocate-port' | 'spawn' | 'ready' | 'exit';
|
|
19
|
+
readonly message: string;
|
|
20
|
+
readonly exitCode?: number | null;
|
|
21
|
+
readonly signal?: NodeJS.Signals | null;
|
|
22
|
+
readonly cause?: unknown;
|
|
23
|
+
}> {}
|
|
24
|
+
type HostServiceError = HostServiceConfigError | HostServiceAcquireError;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { HostServiceAcquireError, HostServiceConfigError, HostServiceError };
|
|
27
|
+
//# sourceMappingURL=errors.d.mts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineConfigError } from "../../substrate/runtime/config-validation.mjs";
|
|
2
|
+
import { Data } from "effect";
|
|
3
|
+
//#region src/plugins/host-service/errors.ts
|
|
4
|
+
const makeHostServiceConfigError = defineConfigError("HostServiceConfigError");
|
|
5
|
+
const hostServiceConfigError = (serviceName, issue) => ({
|
|
6
|
+
...makeHostServiceConfigError(issue),
|
|
7
|
+
serviceName
|
|
8
|
+
});
|
|
9
|
+
var HostServiceAcquireError = class extends Data.TaggedError("HostServiceAcquireError") {};
|
|
10
|
+
const HOST_SERVICE_ERROR_TAGS = ["HostServiceConfigError", "HostServiceAcquireError"];
|
|
11
|
+
//#endregion
|
|
12
|
+
export { HOST_SERVICE_ERROR_TAGS, HostServiceAcquireError, hostServiceConfigError };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=errors.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/plugins/host-service/errors.ts"],"sourcesContent":["import { Data } from 'effect';\n\nimport { defineConfigError, type ConfigIssue } from '../../substrate/runtime/config-validation.ts';\n\nexport interface HostServiceConfigError extends ConfigIssue {\n\treadonly _tag: 'HostServiceConfigError';\n\treadonly serviceName: string;\n}\n\nconst makeHostServiceConfigError = defineConfigError('HostServiceConfigError');\n\nexport const hostServiceConfigError = (\n\tserviceName: string,\n\tissue: ConfigIssue,\n): HostServiceConfigError => ({\n\t...makeHostServiceConfigError(issue),\n\tserviceName,\n});\n\nexport class HostServiceAcquireError extends Data.TaggedError('HostServiceAcquireError')<{\n\treadonly serviceName: string;\n\treadonly cwd: string;\n\treadonly command: string;\n\treadonly args: ReadonlyArray<string>;\n\treadonly phase: 'allocate-port' | 'spawn' | 'ready' | 'exit';\n\treadonly message: string;\n\treadonly exitCode?: number | null;\n\treadonly signal?: NodeJS.Signals | null;\n\treadonly cause?: unknown;\n}> {}\n\nexport type HostServiceError = HostServiceConfigError | HostServiceAcquireError;\n\nexport const HOST_SERVICE_ERROR_TAGS = [\n\t'HostServiceConfigError',\n\t'HostServiceAcquireError',\n] as const;\n"],"mappings":";;;AASA,MAAM,6BAA6B,kBAAkB,yBAAyB;AAE9E,MAAa,0BACZ,aACA,WAC6B;CAC7B,GAAG,2BAA2B,MAAM;CACpC;CACA;AAED,IAAa,0BAAb,cAA6C,KAAK,YAAY,0BAA0B,CAUrF;AAIH,MAAa,0BAA0B,CACtC,0BACA,0BACA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RoutableDecl } from "../../contracts/routable.mjs";
|
|
2
|
+
import { AnyResourceRef, Plugin } from "../../substrate/plugin.mjs";
|
|
3
|
+
import { HostServiceAcquireError, HostServiceConfigError, HostServiceError } from "./errors.mjs";
|
|
4
|
+
import { HOST_SERVICE_PORT_TOKEN, HostServiceOptions, HostServiceReadyProbe, HostServiceValue } from "./service.mjs";
|
|
5
|
+
//#region src/plugins/host-service/index.d.ts
|
|
6
|
+
type HostServiceAfter = ReadonlyArray<AnyResourceRef>;
|
|
7
|
+
declare const hostService: <const After extends HostServiceAfter = readonly []>(options: HostServiceOptions<After>) => Plugin<`host-service/${string}`, HostServiceValue, After, readonly [RoutableDecl]>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { hostService };
|
|
10
|
+
//# sourceMappingURL=index.d.mts.map
|