@mysten-incubation/devstack 0.0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/dashboard-ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dashboard-ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dashboard-ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dashboard-ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-cyrillic-ext-wght-normal-I4S5GZfc.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-cyrillic-wght-normal-BmXc_FBt.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-latin-ext-wght-normal-DrnZ1wKl.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-latin-wght-normal-B_7UjwxQ.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-symbols2-wght-normal-GZpp1pK2.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-vietnamese-wght-normal-D8KDMBhC.woff2 +0 -0
- package/dashboard-ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dashboard-ui/assets/index-Bmi1UtAg.js +1356 -0
- package/dashboard-ui/assets/index-D5EShVt4.js +3 -0
- package/dashboard-ui/assets/index-Deml9drg.css +1 -0
- package/dashboard-ui/index.html +13 -0
- package/dist/api/define-capabilities.d.mts +14 -3
- package/dist/api/define-capabilities.mjs +18 -1
- package/dist/api/define-capabilities.mjs.map +1 -1
- package/dist/api/define-devstack.d.mts +1 -1
- package/dist/api/define-devstack.mjs +6 -26
- package/dist/api/define-devstack.mjs.map +1 -1
- package/dist/api/define-plugin.d.mts +1 -0
- package/dist/api/define-plugin.mjs +2 -0
- package/dist/api/inference-network.d.mts +132 -0
- package/dist/api/inference-network.mjs +105 -16
- package/dist/api/inference-network.mjs.map +1 -1
- package/dist/api/plugin-errors.d.mts +7 -0
- package/dist/api/run-stack.d.mts +20 -9
- package/dist/api/run-stack.mjs +56 -29
- package/dist/api/run-stack.mjs.map +1 -1
- package/dist/build-integrations/playwright/config.d.mts +6 -4
- package/dist/build-integrations/playwright/config.mjs +5 -3
- package/dist/build-integrations/playwright/config.mjs.map +1 -1
- package/dist/build-integrations/playwright/errors.d.mts +1 -1
- package/dist/build-integrations/playwright/global-setup.d.mts +43 -17
- package/dist/build-integrations/playwright/global-setup.mjs +250 -13
- package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
- package/dist/build-integrations/playwright/index.d.mts +5 -3
- package/dist/build-integrations/playwright/index.mjs +4 -2
- package/dist/build-integrations/playwright/stack-context.d.mts +0 -1
- package/dist/build-integrations/playwright/stack-context.mjs +24 -63
- package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
- package/dist/build-integrations/playwright/wallet-context.d.mts +7 -10
- package/dist/build-integrations/playwright/wallet-context.mjs +8 -13
- package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
- package/dist/build-integrations/runtime/cold-start-url.d.mts +5 -0
- package/dist/build-integrations/runtime/cold-start-url.mjs +4 -3
- package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
- package/dist/build-integrations/runtime/conventional-routes.d.mts +51 -0
- package/dist/build-integrations/runtime/conventional-routes.mjs +92 -0
- package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -0
- package/dist/build-integrations/runtime/discover.d.mts +38 -30
- package/dist/build-integrations/runtime/discover.mjs +73 -70
- package/dist/build-integrations/runtime/discover.mjs.map +1 -1
- package/dist/build-integrations/runtime/endpoint-registry.d.mts +3 -1
- package/dist/build-integrations/runtime/endpoint-registry.mjs +3 -1
- package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
- package/dist/build-integrations/runtime/index.d.mts +7 -2
- package/dist/build-integrations/runtime/index.mjs +9 -2
- package/dist/build-integrations/runtime/manifest-types.d.mts +2 -0
- package/dist/build-integrations/runtime/manifest-types.mjs +3 -0
- package/dist/build-integrations/runtime/playwright-stack-context-slot.d.mts +29 -0
- package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs +10 -0
- package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs.map +1 -0
- package/dist/build-integrations/runtime/read-stack-context.d.mts +1 -1
- package/dist/build-integrations/runtime/read-stack-context.mjs +10 -4
- package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
- package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +48 -0
- package/dist/build-integrations/runtime/resolve-discovery-env.mjs +42 -0
- package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -0
- package/dist/build-integrations/runtime/stack-context.d.mts +1 -1
- package/dist/build-integrations/runtime/wallet-paths.mjs +2 -0
- package/dist/build-integrations/vite/index.d.mts +51 -0
- package/dist/build-integrations/vite/index.mjs +73 -0
- package/dist/build-integrations/vite/index.mjs.map +1 -0
- package/dist/build-integrations/vitest/env.d.mts +4 -3
- package/dist/build-integrations/vitest/env.mjs +6 -4
- package/dist/build-integrations/vitest/env.mjs.map +1 -1
- package/dist/build-integrations/vitest/errors.d.mts +25 -4
- package/dist/build-integrations/vitest/errors.mjs +15 -2
- package/dist/build-integrations/vitest/errors.mjs.map +1 -1
- package/dist/build-integrations/vitest/index.d.mts +2 -2
- package/dist/build-integrations/vitest/index.mjs +3 -3
- package/dist/build-integrations/vitest/setup.d.mts +4 -2
- package/dist/build-integrations/vitest/setup.mjs +2 -2
- package/dist/build-integrations/vitest/setup.mjs.map +1 -1
- package/dist/build-integrations/vitest/stack-context.d.mts +0 -1
- package/dist/build-integrations/vitest/stack-context.mjs +33 -13
- package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
- package/dist/cli/bail.mjs +23 -0
- package/dist/cli/bail.mjs.map +1 -0
- package/dist/{surfaces/cli/commands → cli}/doctor-probes.mjs +26 -16
- package/dist/cli/doctor-probes.mjs.map +1 -0
- package/dist/cli/main.d.mts +15 -1
- package/dist/cli/main.mjs +166 -482
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/prune-direct.mjs +31 -201
- package/dist/cli/prune-direct.mjs.map +1 -1
- package/dist/cli/snapshot-reader.mjs +14 -11
- package/dist/cli/snapshot-reader.mjs.map +1 -1
- package/dist/cli/up-lifecycle.mjs +4 -1
- package/dist/cli/up-lifecycle.mjs.map +1 -1
- package/dist/cli/wirings/apply.mjs +95 -0
- package/dist/cli/wirings/apply.mjs.map +1 -0
- package/dist/cli/wirings/build-verb-layers.mjs +42 -0
- package/dist/cli/wirings/build-verb-layers.mjs.map +1 -0
- package/dist/cli/wirings/config-loader.mjs +69 -0
- package/dist/cli/wirings/config-loader.mjs.map +1 -0
- package/dist/cli/wirings/engine-command.mjs +30 -0
- package/dist/cli/wirings/engine-command.mjs.map +1 -0
- package/dist/cli/wirings/identity.mjs +72 -0
- package/dist/cli/wirings/identity.mjs.map +1 -0
- package/dist/cli/wirings/provide-file-system.mjs +7 -0
- package/dist/cli/wirings/provide-file-system.mjs.map +1 -0
- package/dist/cli/wirings/snapshot.mjs +177 -0
- package/dist/cli/wirings/snapshot.mjs.map +1 -0
- package/dist/cli/wirings/up.mjs +287 -0
- package/dist/cli/wirings/up.mjs.map +1 -0
- package/dist/cli/wirings/wipe.mjs +40 -0
- package/dist/cli/wirings/wipe.mjs.map +1 -0
- package/dist/contracts/capability-decl.d.mts +0 -2
- package/dist/contracts/codegenable.d.mts +43 -0
- package/dist/contracts/container-runtime.d.mts +26 -1
- package/dist/contracts/faucet-strategy.d.mts +25 -0
- package/dist/contracts/funding-strategy.d.mts +42 -0
- package/dist/contracts/plugin-expander.mjs +60 -0
- package/dist/contracts/plugin-expander.mjs.map +1 -0
- package/dist/contracts/projection.d.mts +5 -3
- package/dist/contracts/renderer.d.mts +23 -0
- package/dist/contracts/routable.d.mts +14 -1
- package/dist/contracts/snapshotable.d.mts +25 -3
- package/dist/contracts/wallet-protocol.d.mts +52 -0
- package/dist/contracts/wallet-protocol.mjs +52 -0
- package/dist/contracts/wallet-protocol.mjs.map +1 -0
- package/dist/index.d.mts +26 -25
- package/dist/index.mjs +20 -13
- package/dist/{runtime → orchestrators}/built-in-plugin-layers.mjs +10 -5
- package/dist/orchestrators/built-in-plugin-layers.mjs.map +1 -0
- package/dist/orchestrators/codegen/bindings.d.mts +1 -2
- package/dist/orchestrators/codegen/bindings.mjs +52 -186
- package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
- package/dist/orchestrators/codegen/emit.mjs +19 -1
- package/dist/orchestrators/codegen/emit.mjs.map +1 -1
- package/dist/orchestrators/codegen/errors.mjs +8 -3
- package/dist/orchestrators/codegen/errors.mjs.map +1 -1
- package/dist/orchestrators/codegen/format.mjs +47 -39
- package/dist/orchestrators/codegen/format.mjs.map +1 -1
- package/dist/orchestrators/codegen/gitignore.mjs +3 -1
- package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
- package/dist/orchestrators/codegen/output-location.mjs +41 -0
- package/dist/orchestrators/codegen/output-location.mjs.map +1 -0
- package/dist/orchestrators/codegen/paths.d.mts +1 -1
- package/dist/orchestrators/codegen/paths.mjs +40 -14
- package/dist/orchestrators/codegen/paths.mjs.map +1 -1
- package/dist/orchestrators/codegen/permissions.mjs +3 -1
- package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
- package/dist/orchestrators/codegen/service.mjs +157 -105
- package/dist/orchestrators/codegen/service.mjs.map +1 -1
- package/dist/orchestrators/lifecycle-prune/errors.mjs +31 -0
- package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -0
- package/dist/orchestrators/lifecycle-prune/index.mjs +350 -0
- package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -0
- package/dist/orchestrators/router/cleanup.mjs +26 -27
- package/dist/orchestrators/router/cleanup.mjs.map +1 -1
- package/dist/orchestrators/router/entrypoints.mjs +2 -2
- package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
- package/dist/orchestrators/router/file-provider.mjs +14 -5
- package/dist/orchestrators/router/file-provider.mjs.map +1 -1
- package/dist/orchestrators/router/hostname.mjs +19 -55
- package/dist/orchestrators/router/hostname.mjs.map +1 -1
- package/dist/orchestrators/router/index.mjs +11 -0
- package/dist/orchestrators/router/profile.mjs +2 -2
- package/dist/orchestrators/router/sentinels.mjs +26 -0
- package/dist/orchestrators/router/sentinels.mjs.map +1 -0
- package/dist/orchestrators/router/service.mjs +40 -37
- package/dist/orchestrators/router/service.mjs.map +1 -1
- package/dist/orchestrators/router/traefik-container.mjs +27 -16
- package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
- package/dist/{substrate/runtime → orchestrators}/run.mjs +26 -21
- package/dist/orchestrators/run.mjs.map +1 -0
- package/dist/orchestrators/runtime-composition.d.mts +1 -1
- package/dist/orchestrators/runtime-composition.mjs +123 -39
- package/dist/orchestrators/runtime-composition.mjs.map +1 -1
- package/dist/orchestrators/snapshot/capture-command.d.mts +1 -0
- package/dist/orchestrators/snapshot/capture-command.mjs +25 -0
- package/dist/orchestrators/snapshot/capture-command.mjs.map +1 -0
- package/dist/orchestrators/snapshot/capture.mjs +42 -28
- package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
- package/dist/orchestrators/snapshot/descriptor.mjs +35 -10
- package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
- package/dist/orchestrators/snapshot/identity-guard.mjs +1 -1
- package/dist/orchestrators/snapshot/index.mjs +13 -0
- package/dist/orchestrators/snapshot/integrity.d.mts +1 -1
- package/dist/orchestrators/snapshot/integrity.mjs +73 -17
- package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
- package/dist/orchestrators/snapshot/pending-marker.d.mts +1 -0
- package/dist/orchestrators/snapshot/pending-marker.mjs +99 -0
- package/dist/orchestrators/snapshot/pending-marker.mjs.map +1 -0
- package/dist/orchestrators/snapshot/phase-error.mjs +23 -0
- package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -0
- package/dist/orchestrators/snapshot/prune.mjs +20 -55
- package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
- package/dist/orchestrators/snapshot/recover-pending.d.mts +1 -0
- package/dist/orchestrators/snapshot/recover-pending.mjs +223 -0
- package/dist/orchestrators/snapshot/recover-pending.mjs.map +1 -0
- package/dist/orchestrators/snapshot/restore.mjs +118 -84
- package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
- package/dist/orchestrators/snapshot/service.mjs +53 -56
- package/dist/orchestrators/snapshot/service.mjs.map +1 -1
- package/dist/orchestrators/snapshot/state-document.d.mts +1 -0
- package/dist/orchestrators/snapshot/state-document.mjs +47 -7
- package/dist/orchestrators/snapshot/state-document.mjs.map +1 -1
- package/dist/orchestrators/snapshot/wipe.mjs +67 -10
- package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
- package/dist/plugins/account/codegen.mjs +9 -8
- package/dist/plugins/account/codegen.mjs.map +1 -1
- package/dist/plugins/account/errors.d.mts +33 -6
- package/dist/plugins/account/errors.mjs.map +1 -1
- package/dist/plugins/account/funding.d.mts +29 -19
- package/dist/plugins/account/funding.mjs +84 -66
- package/dist/plugins/account/funding.mjs.map +1 -1
- package/dist/plugins/account/index.d.mts +2 -4
- package/dist/plugins/account/index.mjs +64 -31
- package/dist/plugins/account/index.mjs.map +1 -1
- package/dist/plugins/account/keypair.mjs +6 -9
- package/dist/plugins/account/keypair.mjs.map +1 -1
- package/dist/plugins/account/lease.mjs +1 -0
- package/dist/plugins/account/lease.mjs.map +1 -1
- package/dist/plugins/account/registry.d.mts +14 -1
- package/dist/plugins/account/registry.mjs +18 -18
- package/dist/plugins/account/registry.mjs.map +1 -1
- package/dist/plugins/account/service.d.mts +23 -4
- package/dist/plugins/account/service.mjs +83 -45
- package/dist/plugins/account/service.mjs.map +1 -1
- package/dist/plugins/account/snapshot.mjs +2 -5
- package/dist/plugins/account/snapshot.mjs.map +1 -1
- package/dist/plugins/account/spans.mjs +16 -0
- package/dist/plugins/account/spans.mjs.map +1 -0
- package/dist/plugins/account/variants/keystore.mjs +6 -8
- package/dist/plugins/account/variants/keystore.mjs.map +1 -1
- package/dist/plugins/action/build-context.d.mts +3 -2
- package/dist/plugins/action/errors.d.mts +16 -12
- package/dist/plugins/action/errors.mjs.map +1 -1
- package/dist/plugins/action/execute.mjs +65 -103
- package/dist/plugins/action/execute.mjs.map +1 -1
- package/dist/plugins/action/index.d.mts +0 -2
- package/dist/plugins/action/index.mjs +17 -13
- package/dist/plugins/action/index.mjs.map +1 -1
- package/dist/plugins/action/service.mjs +38 -35
- package/dist/plugins/action/service.mjs.map +1 -1
- package/dist/plugins/action/spans.mjs +11 -0
- package/dist/plugins/action/spans.mjs.map +1 -0
- package/dist/plugins/coin/codegen.mjs +9 -8
- package/dist/plugins/coin/codegen.mjs.map +1 -1
- package/dist/plugins/coin/discovery.mjs +8 -4
- package/dist/plugins/coin/discovery.mjs.map +1 -1
- package/dist/plugins/coin/index.d.mts +11 -29
- package/dist/plugins/coin/index.mjs +56 -27
- package/dist/plugins/coin/index.mjs.map +1 -1
- package/dist/plugins/coin/metadata.mjs +8 -15
- package/dist/plugins/coin/metadata.mjs.map +1 -1
- package/dist/plugins/coin/mint.d.mts +30 -11
- package/dist/plugins/coin/mint.mjs +78 -74
- package/dist/plugins/coin/mint.mjs.map +1 -1
- package/dist/plugins/coin/registry.mjs +4 -7
- package/dist/plugins/coin/registry.mjs.map +1 -1
- package/dist/plugins/coin/service.d.mts +39 -1
- package/dist/plugins/coin/service.mjs +11 -4
- package/dist/plugins/coin/service.mjs.map +1 -1
- package/dist/plugins/coin/spans.mjs +20 -0
- package/dist/plugins/coin/spans.mjs.map +1 -0
- package/dist/plugins/dashboard/domain.mjs +402 -0
- package/dist/plugins/dashboard/domain.mjs.map +1 -0
- package/dist/plugins/dashboard/index.d.mts +29 -0
- package/dist/plugins/dashboard/index.mjs +91 -0
- package/dist/plugins/dashboard/index.mjs.map +1 -0
- package/dist/plugins/dashboard/origin-policy.mjs +36 -0
- package/dist/plugins/dashboard/origin-policy.mjs.map +1 -0
- package/dist/plugins/dashboard/routable.mjs +27 -0
- package/dist/plugins/dashboard/routable.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/builder.mjs +21 -0
- package/dist/plugins/dashboard/schema/builder.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/enums.mjs +72 -0
- package/dist/plugins/dashboard/schema/enums.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/root.mjs +351 -0
- package/dist/plugins/dashboard/schema/root.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/types.mjs +508 -0
- package/dist/plugins/dashboard/schema/types.mjs.map +1 -0
- package/dist/plugins/dashboard/schema.mjs +11 -0
- package/dist/plugins/dashboard/schema.mjs.map +1 -0
- package/dist/plugins/dashboard/server.mjs +166 -0
- package/dist/plugins/dashboard/server.mjs.map +1 -0
- package/dist/plugins/deepbook/deploy.mjs +53 -115
- package/dist/plugins/deepbook/deploy.mjs.map +1 -1
- package/dist/plugins/deepbook/errors.mjs +1 -0
- package/dist/plugins/deepbook/errors.mjs.map +1 -1
- package/dist/plugins/deepbook/faucet-strategy.mjs +47 -34
- package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
- package/dist/plugins/deepbook/hash.mjs +9 -0
- package/dist/plugins/deepbook/hash.mjs.map +1 -0
- package/dist/plugins/deepbook/index.d.mts +1 -10
- package/dist/plugins/deepbook/index.mjs +25 -22
- package/dist/plugins/deepbook/index.mjs.map +1 -1
- package/dist/plugins/deepbook/pyth/index.mjs +26 -55
- package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
- package/dist/plugins/deepbook/snapshot.mjs +17 -29
- package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
- package/dist/plugins/deepbook/spans.mjs +18 -0
- package/dist/plugins/deepbook/spans.mjs.map +1 -0
- package/dist/plugins/deepbook/type-strings.mjs +65 -0
- package/dist/plugins/deepbook/type-strings.mjs.map +1 -0
- package/dist/plugins/deepbook/types.d.mts +2 -3
- package/dist/plugins/deepbook/types.mjs.map +1 -1
- package/dist/plugins/faucet/dispatcher.d.mts +21 -2
- package/dist/plugins/faucet/dispatcher.mjs +1 -2
- package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
- package/dist/plugins/faucet/errors.d.mts +11 -24
- package/dist/plugins/faucet/errors.mjs.map +1 -1
- package/dist/plugins/faucet/http.mjs +33 -14
- package/dist/plugins/faucet/http.mjs.map +1 -1
- package/dist/plugins/faucet/index.d.mts +15 -5
- package/dist/plugins/faucet/index.mjs +3 -0
- package/dist/plugins/faucet/index.mjs.map +1 -1
- package/dist/plugins/faucet/spans.mjs +12 -0
- package/dist/plugins/faucet/spans.mjs.map +1 -0
- package/dist/plugins/host-service/errors.d.mts +1 -1
- package/dist/plugins/host-service/index.mjs +34 -8
- package/dist/plugins/host-service/index.mjs.map +1 -1
- package/dist/plugins/host-service/routable.mjs +2 -1
- package/dist/plugins/host-service/routable.mjs.map +1 -1
- package/dist/plugins/host-service/service.d.mts +21 -0
- package/dist/plugins/host-service/service.mjs +136 -81
- package/dist/plugins/host-service/service.mjs.map +1 -1
- package/dist/plugins/internal/acquire-on-chain-artifact.mjs +23 -0
- package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -0
- package/dist/plugins/internal/codegen-helpers.mjs +18 -0
- package/dist/plugins/internal/codegen-helpers.mjs.map +1 -0
- package/dist/plugins/internal/funding-failure-error.mjs +32 -0
- package/dist/plugins/internal/funding-failure-error.mjs.map +1 -0
- package/dist/plugins/package/build.mjs +1 -1
- package/dist/plugins/package/build.mjs.map +1 -1
- package/dist/plugins/package/codegen.mjs +26 -0
- package/dist/plugins/package/codegen.mjs.map +1 -1
- package/dist/plugins/package/errors.d.mts +16 -6
- package/dist/plugins/package/errors.mjs.map +1 -1
- package/dist/plugins/package/index.d.mts +0 -4
- package/dist/plugins/package/index.mjs +27 -21
- package/dist/plugins/package/index.mjs.map +1 -1
- package/dist/plugins/package/mode-known.mjs +26 -12
- package/dist/plugins/package/mode-known.mjs.map +1 -1
- package/dist/plugins/package/mode-local.mjs +47 -41
- package/dist/plugins/package/mode-local.mjs.map +1 -1
- package/dist/plugins/package/publish-executor.mjs +55 -114
- package/dist/plugins/package/publish-executor.mjs.map +1 -1
- package/dist/plugins/package/registry.mjs +2 -1
- package/dist/plugins/package/registry.mjs.map +1 -1
- package/dist/plugins/package/service.mjs.map +1 -1
- package/dist/plugins/package/spans.mjs +14 -0
- package/dist/plugins/package/spans.mjs.map +1 -0
- package/dist/plugins/postgres/db-ensure.mjs +19 -12
- package/dist/plugins/postgres/db-ensure.mjs.map +1 -1
- package/dist/plugins/postgres/errors.d.mts +5 -0
- package/dist/plugins/postgres/errors.mjs.map +1 -1
- package/dist/plugins/postgres/index.mjs +10 -17
- package/dist/plugins/postgres/index.mjs.map +1 -1
- package/dist/plugins/postgres/service.mjs +58 -24
- package/dist/plugins/postgres/service.mjs.map +1 -1
- package/dist/plugins/postgres/snapshot.mjs.map +1 -1
- package/dist/plugins/postgres/spans.mjs +11 -0
- package/dist/plugins/postgres/spans.mjs.map +1 -0
- package/dist/plugins/router-entrypoints.mjs +4 -4
- package/dist/plugins/router-entrypoints.mjs.map +1 -1
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +15 -13
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +15 -19
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
- package/dist/plugins/seal/codegen.d.mts +2 -3
- package/dist/plugins/seal/codegen.mjs.map +1 -1
- package/dist/plugins/seal/config-render.mjs +35 -8
- package/dist/plugins/seal/config-render.mjs.map +1 -1
- package/dist/plugins/seal/deploy.mjs +31 -39
- package/dist/plugins/seal/deploy.mjs.map +1 -1
- package/dist/plugins/seal/errors.d.mts +1 -3
- package/dist/plugins/seal/errors.mjs +7 -1
- package/dist/plugins/seal/errors.mjs.map +1 -1
- package/dist/plugins/seal/index.d.mts +1 -6
- package/dist/plugins/seal/index.mjs +40 -14
- package/dist/plugins/seal/index.mjs.map +1 -1
- package/dist/plugins/seal/key-manager.d.mts +1 -9
- package/dist/plugins/seal/key-manager.mjs +2 -18
- package/dist/plugins/seal/key-manager.mjs.map +1 -1
- package/dist/plugins/seal/key-server.mjs +37 -36
- package/dist/plugins/seal/key-server.mjs.map +1 -1
- package/dist/plugins/seal/keygen.mjs +16 -17
- package/dist/plugins/seal/keygen.mjs.map +1 -1
- package/dist/plugins/seal/mode/fork-known.mjs +36 -14
- package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
- package/dist/plugins/seal/mode/live.d.mts +6 -4
- package/dist/plugins/seal/mode/live.mjs +14 -21
- package/dist/plugins/seal/mode/live.mjs.map +1 -1
- package/dist/plugins/seal/mode/local-keygen.mjs +57 -21
- package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
- package/dist/plugins/seal/registry-publish.mjs +1 -0
- package/dist/plugins/seal/registry-publish.mjs.map +1 -1
- package/dist/plugins/seal/routable.mjs.map +1 -1
- package/dist/plugins/seal/service.mjs.map +1 -1
- package/dist/plugins/seal/spans.mjs +18 -0
- package/dist/plugins/seal/spans.mjs.map +1 -0
- package/dist/plugins/sui/auto-tick.mjs +17 -23
- package/dist/plugins/sui/auto-tick.mjs.map +1 -1
- package/dist/plugins/sui/chain-build-container.mjs +18 -0
- package/dist/plugins/sui/chain-build-container.mjs.map +1 -0
- package/dist/plugins/sui/chain-probe.d.mts +5 -5
- package/dist/plugins/sui/chain-probe.mjs +28 -58
- package/dist/plugins/sui/chain-probe.mjs.map +1 -1
- package/dist/plugins/sui/codegen.mjs +26 -0
- package/dist/plugins/sui/codegen.mjs.map +1 -1
- package/dist/plugins/sui/errors.d.mts +2 -29
- package/dist/plugins/sui/errors.mjs +1 -3
- package/dist/plugins/sui/errors.mjs.map +1 -1
- package/dist/plugins/sui/fork-faucet-strategy.d.mts +1 -0
- package/dist/plugins/sui/fork-faucet-strategy.mjs +55 -0
- package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -0
- package/dist/plugins/sui/fork-orchestration.d.mts +1 -0
- package/dist/plugins/sui/fork-orchestration.mjs +170 -2
- package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
- package/dist/plugins/sui/fork-transaction.d.mts +2 -0
- package/dist/plugins/sui/fork-transaction.mjs +92 -28
- package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
- package/dist/plugins/sui/index.d.mts +33 -70
- package/dist/plugins/sui/index.mjs +58 -35
- package/dist/plugins/sui/index.mjs.map +1 -1
- package/dist/plugins/{faucet/strategies/sui-local.mjs → sui/local-faucet-strategy.mjs} +10 -7
- package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -0
- package/dist/plugins/sui/mode/external.mjs +7 -13
- package/dist/plugins/sui/mode/external.mjs.map +1 -1
- package/dist/plugins/sui/mode/fork.mjs +136 -59
- package/dist/plugins/sui/mode/fork.mjs.map +1 -1
- package/dist/plugins/sui/mode/live.mjs +10 -16
- package/dist/plugins/sui/mode/live.mjs.map +1 -1
- package/dist/plugins/sui/mode/local.mjs +37 -36
- package/dist/plugins/sui/mode/local.mjs.map +1 -1
- package/dist/plugins/sui/mode/shared-boot.mjs +38 -115
- package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
- package/dist/plugins/sui/mode/shared.d.mts +1 -5
- package/dist/plugins/sui/mode/shared.mjs.map +1 -1
- package/dist/plugins/sui/mode/spec.d.mts +18 -0
- package/dist/plugins/sui/move-summary-runner.mjs +207 -0
- package/dist/plugins/sui/move-summary-runner.mjs.map +1 -0
- package/dist/plugins/sui/network-resolver.d.mts +4 -3
- package/dist/plugins/sui/service.mjs.map +1 -1
- package/dist/plugins/sui/snapshot.mjs +3 -0
- package/dist/plugins/sui/snapshot.mjs.map +1 -1
- package/dist/plugins/sui/spans.mjs +17 -0
- package/dist/plugins/sui/spans.mjs.map +1 -0
- package/dist/plugins/wallet/codegen.d.mts +0 -1
- package/dist/plugins/wallet/codegen.mjs +8 -9
- package/dist/plugins/wallet/codegen.mjs.map +1 -1
- package/dist/plugins/wallet/index.d.mts +6 -8
- package/dist/plugins/wallet/index.mjs +46 -35
- package/dist/plugins/wallet/index.mjs.map +1 -1
- package/dist/plugins/wallet/origin-policy.mjs +12 -28
- package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
- package/dist/plugins/wallet/pairing.mjs +6 -4
- package/dist/plugins/wallet/pairing.mjs.map +1 -1
- package/dist/plugins/wallet/protocol.d.mts +1 -0
- package/dist/plugins/wallet/protocol.mjs +5 -44
- package/dist/plugins/wallet/protocol.mjs.map +1 -1
- package/dist/plugins/wallet/routable.mjs +2 -8
- package/dist/plugins/wallet/routable.mjs.map +1 -1
- package/dist/plugins/wallet/server.mjs +36 -44
- package/dist/plugins/wallet/server.mjs.map +1 -1
- package/dist/plugins/wallet/service.d.mts +1 -5
- package/dist/plugins/wallet/service.mjs +22 -18
- package/dist/plugins/wallet/service.mjs.map +1 -1
- package/dist/plugins/wallet/spans.mjs +22 -0
- package/dist/plugins/wallet/spans.mjs.map +1 -0
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +33 -8
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
- package/dist/plugins/walrus/codegen.d.mts +3 -3
- package/dist/plugins/walrus/codegen.mjs.map +1 -1
- package/dist/plugins/walrus/deploy-paths.mjs +21 -5
- package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
- package/dist/plugins/walrus/deploy.mjs +67 -69
- package/dist/plugins/walrus/deploy.mjs.map +1 -1
- package/dist/plugins/walrus/errors.mjs +1 -0
- package/dist/plugins/walrus/errors.mjs.map +1 -1
- package/dist/plugins/walrus/faucet-strategy.mjs +12 -7
- package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
- package/dist/plugins/walrus/index.d.mts +2 -13
- package/dist/plugins/walrus/index.mjs +18 -23
- package/dist/plugins/walrus/index.mjs.map +1 -1
- package/dist/plugins/walrus/mode/known-deploy.mjs +7 -5
- package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
- package/dist/plugins/walrus/mode/local-cluster.mjs +26 -7
- package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
- package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
- package/dist/plugins/walrus/routable.mjs +7 -23
- package/dist/plugins/walrus/routable.mjs.map +1 -1
- package/dist/plugins/walrus/service.mjs.map +1 -1
- package/dist/plugins/walrus/spans.mjs +18 -0
- package/dist/plugins/walrus/spans.mjs.map +1 -0
- package/dist/plugins/walrus/storage-nodes.d.mts +6 -2
- package/dist/plugins/walrus/storage-nodes.mjs +15 -8
- package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
- package/dist/plugins/walrus/wal-swap.mjs +58 -15
- package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
- package/dist/primitives/artifact-publisher.d.mts +1 -1
- package/dist/primitives/artifact-publisher.mjs +15 -0
- package/dist/primitives/artifact-publisher.mjs.map +1 -0
- package/dist/runtime/docker/client.mjs +17 -4
- package/dist/runtime/docker/client.mjs.map +1 -1
- package/dist/runtime/docker/container.mjs +219 -132
- package/dist/runtime/docker/container.mjs.map +1 -1
- package/dist/runtime/docker/errors.mjs +0 -6
- package/dist/runtime/docker/errors.mjs.map +1 -1
- package/dist/runtime/docker/exec.mjs +21 -18
- package/dist/runtime/docker/exec.mjs.map +1 -1
- package/dist/runtime/docker/image.mjs +36 -13
- package/dist/runtime/docker/image.mjs.map +1 -1
- package/dist/runtime/docker/index.mjs +14 -0
- package/dist/runtime/docker/inspect-and-decode.mjs +51 -0
- package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -0
- package/dist/runtime/docker/inventory.mjs +14 -11
- package/dist/runtime/docker/inventory.mjs.map +1 -1
- package/dist/runtime/docker/labels.mjs +38 -5
- package/dist/runtime/docker/labels.mjs.map +1 -1
- package/dist/runtime/docker/logs.d.mts +1 -1
- package/dist/runtime/docker/logs.mjs.map +1 -1
- package/dist/runtime/docker/network.mjs +83 -47
- package/dist/runtime/docker/network.mjs.map +1 -1
- package/dist/runtime/docker/render-run-args.mjs +82 -0
- package/dist/runtime/docker/render-run-args.mjs.map +1 -0
- package/dist/runtime/docker/service.d.mts +1 -1
- package/dist/runtime/docker/service.mjs +12 -7
- package/dist/runtime/docker/service.mjs.map +1 -1
- package/dist/runtime/docker/sweep.mjs +118 -43
- package/dist/runtime/docker/sweep.mjs.map +1 -1
- package/dist/runtime/docker/volume.mjs +2 -0
- package/dist/runtime/docker/volume.mjs.map +1 -1
- package/dist/runtime/docker/wrap.mjs +30 -1
- package/dist/runtime/docker/wrap.mjs.map +1 -1
- package/dist/substrate/cross-process.mjs +14 -8
- package/dist/substrate/cross-process.mjs.map +1 -1
- package/dist/substrate/event-time.mjs +33 -0
- package/dist/substrate/event-time.mjs.map +1 -0
- package/dist/substrate/events.d.mts +28 -8
- package/dist/substrate/identity.d.mts +2 -1
- package/dist/substrate/manifest.d.mts +68 -5
- package/dist/substrate/manifest.mjs +34 -5
- package/dist/substrate/manifest.mjs.map +1 -1
- package/dist/substrate/network.d.mts +3 -5
- package/dist/substrate/options.d.mts +0 -2
- package/dist/substrate/plugin.d.mts +13 -0
- package/dist/substrate/plugin.mjs +4 -2
- package/dist/substrate/plugin.mjs.map +1 -1
- package/dist/substrate/projection.d.mts +35 -3
- package/dist/substrate/runtime/artifact-publisher/index.mjs +19 -9
- package/dist/substrate/runtime/artifact-publisher/index.mjs.map +1 -1
- package/dist/substrate/runtime/atomic-write.mjs +97 -32
- package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
- package/dist/substrate/runtime/cache/index.mjs +3 -0
- package/dist/substrate/runtime/cache/schema.mjs +2 -2
- package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
- package/dist/substrate/runtime/cache/service.mjs +9 -7
- package/dist/substrate/runtime/cache/service.mjs.map +1 -1
- package/dist/substrate/runtime/capability-sinks/index.d.mts +1 -1
- package/dist/substrate/runtime/capability-sinks/index.mjs +3 -0
- package/dist/substrate/runtime/capability-sinks/layer.mjs +1 -1
- package/dist/substrate/runtime/capability-sinks/service.d.mts +61 -2
- package/dist/substrate/runtime/capability-sinks/service.mjs +21 -26
- package/dist/substrate/runtime/capability-sinks/service.mjs.map +1 -1
- package/dist/substrate/runtime/config-validation.d.mts +1 -13
- package/dist/substrate/runtime/config-validation.mjs +2 -91
- package/dist/substrate/runtime/config-validation.mjs.map +1 -1
- package/dist/substrate/runtime/container-runtime.d.mts +1 -0
- package/dist/substrate/runtime/container-runtime.mjs +2 -0
- package/dist/substrate/runtime/control-plane/domain.mjs +101 -0
- package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -0
- package/dist/substrate/runtime/control-plane/service.mjs +7 -0
- package/dist/substrate/runtime/control-plane/service.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +46 -19
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs +30 -12
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/index.mjs +5 -0
- package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs +11 -2
- package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs +1 -1
- package/dist/substrate/runtime/cross-process/index.mjs +11 -0
- package/dist/substrate/runtime/cross-process/live-clock.mjs +34 -0
- package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/liveness.mjs +52 -10
- package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/lock.d.mts +1 -0
- package/dist/substrate/runtime/cross-process/lock.mjs +23 -0
- package/dist/substrate/runtime/cross-process/lock.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +64 -0
- package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/roster.mjs +97 -83
- package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/self-pid.mjs +8 -0
- package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +24 -28
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/stack-lock.mjs +41 -20
- package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
- package/dist/substrate/runtime/current-plugin.mjs +2 -2
- package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
- package/dist/substrate/runtime/errors.mjs +12 -6
- package/dist/substrate/runtime/errors.mjs.map +1 -1
- package/dist/substrate/runtime/format-unknown-error.mjs +30 -0
- package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -0
- package/dist/substrate/runtime/host-bind-mount-owner.mjs +10 -0
- package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -0
- package/dist/substrate/runtime/host-gateway.mjs +20 -0
- package/dist/substrate/runtime/host-gateway.mjs.map +1 -0
- package/dist/substrate/runtime/host-tree-tar/index.mjs +61 -50
- package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
- package/dist/substrate/runtime/http-probe.d.mts +1 -1
- package/dist/substrate/runtime/index.mjs +14 -0
- package/dist/substrate/runtime/lease-broker/index.d.mts +1 -1
- package/dist/substrate/runtime/lease-broker/index.mjs +2 -0
- package/dist/substrate/runtime/lease-broker/service.d.mts +1 -64
- package/dist/substrate/runtime/lease-broker/service.mjs +1 -1
- package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs +22 -3
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/index.mjs +9 -0
- package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +20 -3
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/selective-restart.mjs +1 -1
- package/dist/substrate/runtime/lifecycle/signals.mjs +5 -5
- package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/state-machine.mjs +1 -1
- package/dist/substrate/runtime/managed-container.d.mts +19 -1
- package/dist/substrate/runtime/managed-container.mjs +20 -1
- package/dist/substrate/runtime/managed-container.mjs.map +1 -1
- package/dist/substrate/runtime/manifest/index.mjs +3 -0
- package/dist/substrate/runtime/manifest/manifest.mjs +15 -11
- package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
- package/dist/substrate/runtime/mode-errors.mjs +20 -0
- package/dist/substrate/runtime/mode-errors.mjs.map +1 -0
- package/dist/substrate/runtime/observability/cascade-formatter.mjs +9 -13
- package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
- package/dist/substrate/runtime/observability/formatter-registry.mjs +19 -36
- package/dist/substrate/runtime/observability/formatter-registry.mjs.map +1 -1
- package/dist/substrate/runtime/observability/ignore-with-log.d.mts +1 -0
- package/dist/substrate/runtime/observability/ignore-with-log.mjs +17 -0
- package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -0
- package/dist/substrate/runtime/observability/index.d.mts +1 -1
- package/dist/substrate/runtime/observability/index.mjs +13 -0
- package/dist/substrate/runtime/observability/log-store.d.mts +1 -0
- package/dist/substrate/runtime/observability/log-store.mjs +175 -0
- package/dist/substrate/runtime/observability/log-store.mjs.map +1 -0
- package/dist/substrate/runtime/observability/logger.d.mts +2 -1
- package/dist/substrate/runtime/observability/logger.mjs +5 -9
- package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
- package/dist/substrate/runtime/observability/output-truncate.mjs +35 -0
- package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -0
- package/dist/substrate/runtime/observability/pretty-error.mjs +9 -12
- package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
- package/dist/substrate/runtime/observability/redaction.d.mts +2 -13
- package/dist/substrate/runtime/observability/redaction.mjs +8 -14
- package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
- package/dist/substrate/runtime/observability/span-store.d.mts +1 -0
- package/dist/substrate/runtime/observability/span-store.mjs +110 -0
- package/dist/substrate/runtime/observability/span-store.mjs.map +1 -0
- package/dist/substrate/runtime/observability/spans.mjs +14 -14
- package/dist/substrate/runtime/observability/spans.mjs.map +1 -1
- package/dist/substrate/runtime/observability/subprocess-capture.mjs +1 -1
- package/dist/substrate/runtime/passthrough-or-wrap.mjs +33 -0
- package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -0
- package/dist/substrate/runtime/paths.d.mts +1 -1
- package/dist/substrate/runtime/paths.mjs +4 -3
- package/dist/substrate/runtime/paths.mjs.map +1 -1
- package/dist/substrate/runtime/phase-preserving-produce.mjs +40 -0
- package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -0
- package/dist/substrate/runtime/port-broker/index.mjs +3 -0
- package/dist/substrate/runtime/port-broker/service.mjs +170 -126
- package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
- package/dist/substrate/runtime/post-acquire-tasks.mjs +1 -1
- package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
- package/dist/substrate/runtime/probes.d.mts +7 -5
- package/dist/substrate/runtime/probes.mjs +3 -1
- package/dist/substrate/runtime/probes.mjs.map +1 -1
- package/dist/substrate/runtime/projection/index.mjs +4 -0
- package/dist/substrate/runtime/projection/operational-endpoints.mjs +1 -2
- package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
- package/dist/substrate/runtime/projection/persisted.mjs +33 -15
- package/dist/substrate/runtime/projection/persisted.mjs.map +1 -1
- package/dist/substrate/runtime/projection/state-ref.mjs +26 -2
- package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
- package/dist/substrate/runtime/projection/update.mjs +88 -24
- package/dist/substrate/runtime/projection/update.mjs.map +1 -1
- package/dist/substrate/runtime/random-suffix.mjs +11 -0
- package/dist/substrate/runtime/random-suffix.mjs.map +1 -0
- package/dist/substrate/runtime/retry-policy.d.mts +59 -1
- package/dist/substrate/runtime/retry-policy.mjs +66 -1
- package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
- package/dist/substrate/runtime/routed-url.d.mts +1 -0
- package/dist/substrate/runtime/routed-url.mjs +79 -0
- package/dist/substrate/runtime/routed-url.mjs.map +1 -0
- package/dist/substrate/runtime/runtime-decode.d.mts +1 -1
- package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
- package/dist/substrate/runtime/scoped-http-server.mjs +2 -3
- package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
- package/dist/substrate/runtime/scoped-multimap/index.mjs +2 -0
- package/dist/substrate/runtime/scoped-multimap/service.mjs +52 -0
- package/dist/substrate/runtime/scoped-multimap/service.mjs.map +1 -0
- package/dist/substrate/runtime/scoped-ref-map/index.mjs +2 -0
- package/dist/substrate/runtime/scoped-ref-map/service.mjs +2 -2
- package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +1 -1
- package/dist/substrate/runtime/stage-and-swap/index.mjs +72 -4
- package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
- package/dist/substrate/runtime/state-store/index.d.mts +1 -0
- package/dist/substrate/runtime/state-store/index.mjs +3 -0
- package/dist/substrate/runtime/state-store/schema.d.mts +1 -0
- package/dist/substrate/runtime/state-store/schema.mjs +19 -14
- package/dist/substrate/runtime/state-store/schema.mjs.map +1 -1
- package/dist/substrate/runtime/state-store/service.d.mts +1 -0
- package/dist/substrate/runtime/state-store/service.mjs +145 -0
- package/dist/substrate/runtime/state-store/service.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.d.mts +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs +33 -0
- package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs +1 -1
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
- package/dist/substrate/runtime/strategy-registry/index.mjs +4 -0
- package/dist/substrate/runtime/strategy-registry/service.mjs +19 -33
- package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
- package/dist/substrate/runtime/subnet-broker.mjs +60 -0
- package/dist/substrate/runtime/subnet-broker.mjs.map +1 -0
- package/dist/substrate/runtime/sui-execute/index.d.mts +21 -1
- package/dist/substrate/runtime/sui-execute/index.mjs +84 -20
- package/dist/substrate/runtime/sui-execute/index.mjs.map +1 -1
- package/dist/substrate/runtime/sui-execute/sign-and-dispatch.d.mts +1 -0
- package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs +32 -0
- package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +1 -0
- package/dist/substrate/runtime/sui-ledger/object-ref.mjs +32 -0
- package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +1 -0
- package/dist/substrate/runtime/sui-move-build/index.mjs +93 -19
- package/dist/substrate/runtime/sui-move-build/index.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/acquire-node.mjs +181 -0
- package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/background-tasks.mjs +144 -0
- package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/command-loop.mjs +68 -0
- package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +151 -0
- package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/errors.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/errors.mjs +9 -0
- package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/index.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/index.mjs +3 -0
- package/dist/substrate/runtime/supervisor/shutdown.mjs +51 -0
- package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/start-supervisor.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/start-supervisor.mjs +250 -0
- package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/state.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/state.mjs +22 -0
- package/dist/substrate/runtime/supervisor/state.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/teardown.mjs +57 -0
- package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/types.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/wiring.mjs +133 -0
- package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -0
- package/dist/substrate/runtime/typed-env.mjs +8 -0
- package/dist/substrate/runtime/typed-env.mjs.map +1 -0
- package/dist/substrate/state-store.d.mts +1 -0
- package/dist/substrate/versioned-doc-schema.mjs +17 -0
- package/dist/substrate/versioned-doc-schema.mjs.map +1 -0
- package/dist/substrate/versioned-doc-sync.mjs +94 -0
- package/dist/substrate/versioned-doc-sync.mjs.map +1 -0
- package/dist/surfaces/cli/command-tree.mjs.map +1 -1
- package/dist/surfaces/cli/commands/index.mjs +9 -0
- package/dist/surfaces/cli/commands/prune-picker-entry.mjs +13 -0
- package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -0
- package/dist/surfaces/cli/commands/prune-picker.mjs +3 -2
- package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
- package/dist/surfaces/cli/commands/prune.mjs +34 -17
- package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
- package/dist/surfaces/cli/commands/status.mjs +2 -2
- package/dist/surfaces/cli/commands/status.mjs.map +1 -1
- package/dist/surfaces/cli/commands/supervisor-presence.mjs +5 -3
- package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
- package/dist/surfaces/cli/commands/wipe.mjs +38 -4
- package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
- package/dist/surfaces/cli/errors.mjs +1 -1
- package/dist/surfaces/cli/errors.mjs.map +1 -1
- package/dist/surfaces/cli/flags.mjs +0 -1
- package/dist/surfaces/cli/flags.mjs.map +1 -1
- package/dist/surfaces/cli/index.mjs +98 -18
- package/dist/surfaces/cli/index.mjs.map +1 -1
- package/dist/surfaces/cli/output.mjs +1 -0
- package/dist/surfaces/cli/output.mjs.map +1 -1
- package/dist/surfaces/cli/sysexits.mjs +2 -1
- package/dist/surfaces/cli/sysexits.mjs.map +1 -1
- package/dist/surfaces/tui/app.mjs +25 -3
- package/dist/surfaces/tui/app.mjs.map +1 -1
- package/dist/surfaces/tui/display-derivation.mjs +23 -74
- package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
- package/dist/surfaces/tui/event-log.mjs +35 -23
- package/dist/surfaces/tui/event-log.mjs.map +1 -1
- package/dist/surfaces/tui/input.mjs +5 -1
- package/dist/surfaces/tui/input.mjs.map +1 -1
- package/dist/surfaces/tui/plain-renderer.mjs +70 -34
- package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
- package/package.json +24 -4
- package/dist/contracts/liveness-classifier.d.mts +0 -19
- package/dist/contracts/network-resolver.d.mts +0 -15
- package/dist/contracts/network-resolver.mjs +0 -7
- package/dist/contracts/network-resolver.mjs.map +0 -1
- package/dist/orchestrators/codegen/extras.mjs +0 -16
- package/dist/orchestrators/codegen/extras.mjs.map +0 -1
- package/dist/plugins/deepbook/routable.mjs +0 -21
- package/dist/plugins/deepbook/routable.mjs.map +0 -1
- package/dist/plugins/faucet/service.d.mts +0 -20
- package/dist/plugins/faucet/strategies/sui-local.d.mts +0 -23
- package/dist/plugins/faucet/strategies/sui-local.mjs.map +0 -1
- package/dist/plugins/sui/seed-objects.d.mts +0 -18
- package/dist/plugins/sui/seed-objects.mjs +0 -25
- package/dist/plugins/sui/seed-objects.mjs.map +0 -1
- package/dist/runtime/built-in-plugin-layers.mjs.map +0 -1
- package/dist/substrate/runtime/context-helpers.mjs +0 -32
- package/dist/substrate/runtime/context-helpers.mjs.map +0 -1
- package/dist/substrate/runtime/run.mjs.map +0 -1
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs +0 -30
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs.map +0 -1
- package/dist/substrate/runtime/supervisor.d.mts +0 -1
- package/dist/substrate/runtime/supervisor.mjs +0 -831
- package/dist/substrate/runtime/supervisor.mjs.map +0 -1
- package/dist/surfaces/cli/commands/doctor-probes.mjs.map +0 -1
- /package/dist/{substrate/runtime/strategy-registry/faucet-capability-for.d.mts → plugins/faucet/http.d.mts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-strings.mjs","names":[],"sources":["../../../src/plugins/deepbook/type-strings.ts"],"sourcesContent":["// DeepBook type-string helpers.\n//\n// Mirrors `plugins/coin/type-strings.ts`: a position-aware matcher over\n// a fully-qualified Sui type string instead of substring sniffing.\n//\n// The coin helper is anchored to the framework `0x2::coin::<Wrapper><T>`\n// (single inner generic). A DeepBook pool object is\n// `<pkg>::pool::Pool<Base, Quote>` — a NON-framework package with TWO\n// positional generic arguments — so it needs its own parser. Both\n// arguments and the spec coin types are normalized with the shared SDK\n// `normalizeStructTag` (which recursively pads addresses) and compared\n// POSITIONALLY, so a reversed pair (`DEEP/SUI` vs `SUI/DEEP`) or a coin\n// type that is a substring of another can no longer cross-match.\n\nimport { normalizeStructTag } from '@mysten/sui/utils';\n\n/** Parse the two positional generic arguments out of a\n * `<pkg>::pool::Pool<Base, Quote>` object type. Returns `null` when the\n * type is not a `::pool::Pool<…>` with exactly two top-level arguments\n * (the SDK may pad the package address, so the module/wrapper suffix is\n * matched on the `::pool::Pool<` marker rather than the full prefix). */\nexport const parsePoolGenericArgs = (\n\tobjectType: string,\n): { readonly base: string; readonly quote: string } | null => {\n\tif (!objectType.endsWith('>')) return null;\n\tconst marker = '::pool::Pool<';\n\tconst markerIndex = objectType.indexOf(marker);\n\tif (markerIndex === -1) return null;\n\tconst inner = objectType.slice(markerIndex + marker.length, -1);\n\tconst args = splitTopLevelGenericArgs(inner);\n\tif (args.length !== 2) return null;\n\tconst [base, quote] = args;\n\tif (base === undefined || quote === undefined) return null;\n\treturn { base, quote };\n};\n\n/** Does `objectType` name a `Pool<Base, Quote>` whose generic arguments\n * match `(baseCoinType, quoteCoinType)` POSITIONALLY? Each side is\n * compared via `normalizeStructTag` so framework-address padding does\n * not defeat the match and a reversed pair does not collide. */\nexport const isPoolForPair = (\n\tobjectType: string,\n\tbaseCoinType: string,\n\tquoteCoinType: string,\n): boolean => {\n\tconst parsed = parsePoolGenericArgs(objectType);\n\tif (parsed === null) return false;\n\tconst base = normalizeStructTagSafe(parsed.base);\n\tconst quote = normalizeStructTagSafe(parsed.quote);\n\tconst wantBase = normalizeStructTagSafe(baseCoinType);\n\tconst wantQuote = normalizeStructTagSafe(quoteCoinType);\n\t// A malformed tag normalizes to `null`; never let two nulls compare\n\t// equal — a doubly-malformed side must NOT spuriously pair.\n\tif (base === null || quote === null || wantBase === null || wantQuote === null) return false;\n\treturn base === wantBase && quote === wantQuote;\n};\n\n/** Split a generic-argument list on top-level commas, respecting nested\n * `<…>` so a generic coin type argument is not split mid-bracket. */\nconst splitTopLevelGenericArgs = (inner: string): ReadonlyArray<string> => {\n\tconst args: string[] = [];\n\tlet depth = 0;\n\tlet start = 0;\n\tfor (let i = 0; i < inner.length; i += 1) {\n\t\tconst ch = inner[i];\n\t\tif (ch === '<') depth += 1;\n\t\telse if (ch === '>') depth -= 1;\n\t\telse if (ch === ',' && depth === 0) {\n\t\t\targs.push(inner.slice(start, i).trim());\n\t\t\tstart = i + 1;\n\t\t}\n\t}\n\targs.push(inner.slice(start).trim());\n\treturn args;\n};\n\n/** `normalizeStructTag` throws on a malformed tag; coerce to a sentinel\n * so a bad parse fails the positional compare rather than the caller. */\nconst normalizeStructTagSafe = (tag: string): string | null => {\n\ttry {\n\t\treturn normalizeStructTag(tag);\n\t} catch {\n\t\treturn null;\n\t}\n};\n"],"mappings":";;;;;;;AAqBA,MAAa,wBACZ,eAC8D;AAC9D,KAAI,CAAC,WAAW,SAAS,IAAI,CAAE,QAAO;CAEtC,MAAM,cAAc,WAAW,QAAQ,gBAAO;AAC9C,KAAI,gBAAgB,GAAI,QAAO;CAE/B,MAAM,OAAO,yBADC,WAAW,MAAM,cAAc,IAAe,GACjB,CAAC;AAC5C,KAAI,KAAK,WAAW,EAAG,QAAO;CAC9B,MAAM,CAAC,MAAM,SAAS;AACtB,KAAI,SAAS,KAAA,KAAa,UAAU,KAAA,EAAW,QAAO;AACtD,QAAO;EAAE;EAAM;EAAO;;;;;;AAOvB,MAAa,iBACZ,YACA,cACA,kBACa;CACb,MAAM,SAAS,qBAAqB,WAAW;AAC/C,KAAI,WAAW,KAAM,QAAO;CAC5B,MAAM,OAAO,uBAAuB,OAAO,KAAK;CAChD,MAAM,QAAQ,uBAAuB,OAAO,MAAM;CAClD,MAAM,WAAW,uBAAuB,aAAa;CACrD,MAAM,YAAY,uBAAuB,cAAc;AAGvD,KAAI,SAAS,QAAQ,UAAU,QAAQ,aAAa,QAAQ,cAAc,KAAM,QAAO;AACvF,QAAO,SAAS,YAAY,UAAU;;;;AAKvC,MAAM,4BAA4B,UAAyC;CAC1E,MAAM,OAAiB,EAAE;CACzB,IAAI,QAAQ;CACZ,IAAI,QAAQ;AACZ,MAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,GAAG;EACzC,MAAM,KAAK,MAAM;AACjB,MAAI,OAAO,IAAK,UAAS;WAChB,OAAO,IAAK,UAAS;WACrB,OAAO,OAAO,UAAU,GAAG;AACnC,QAAK,KAAK,MAAM,MAAM,OAAO,EAAE,CAAC,MAAM,CAAC;AACvC,WAAQ,IAAI;;;AAGd,MAAK,KAAK,MAAM,MAAM,MAAM,CAAC,MAAM,CAAC;AACpC,QAAO;;;;AAKR,MAAM,0BAA0B,QAA+B;AAC9D,KAAI;AACH,SAAO,mBAAmB,IAAI;SACvB;AACP,SAAO"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ResourceRef } from "../../substrate/plugin.mjs";
|
|
2
|
-
import { CoinValue } from "../coin/service.mjs";
|
|
3
2
|
import { AccountValue } from "../account/service.mjs";
|
|
4
3
|
import { LocalPackageResolved } from "../package/index.mjs";
|
|
5
|
-
|
|
4
|
+
import { CoinValue } from "../coin/service.mjs";
|
|
6
5
|
//#region src/plugins/deepbook/types.d.ts
|
|
7
6
|
/** A Pyth price feed id — opaque 64-character hex string. */
|
|
8
7
|
type PythPriceFeedId = string & {
|
|
@@ -121,5 +120,5 @@ type DeepbookPackageMember<Name extends string = string> = ResourceRef<`package:
|
|
|
121
120
|
/** Local package ref alias for the mock Pyth package used by local DeepBook. */
|
|
122
121
|
type PythPackageMember<Name extends string = string> = ResourceRef<`package:${Name}`, LocalPackageResolved>;
|
|
123
122
|
//#endregion
|
|
124
|
-
export { AccountMemberAlias, CoinMemberAlias, DEEP_PRICE_FEED_ID, DeepbookPackageMember, DeepbookPool, DeepbookPoolCoin, DeepbookPoolSeedLiquidity, DeepbookPoolSeedOrder, DeepbookPoolSpec,
|
|
123
|
+
export { AccountMemberAlias, CoinMemberAlias, DEEP_PRICE_FEED_ID, DeepbookPackageMember, DeepbookPool, DeepbookPoolCoin, DeepbookPoolSeedLiquidity, DeepbookPoolSeedOrder, DeepbookPoolSpec, PythHandle, PythOptions, SUI_PRICE_FEED_ID, USDC_PRICE_FEED_ID, pythPriceFeedId };
|
|
125
124
|
//# sourceMappingURL=types.d.mts.map
|
|
@@ -1 +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"}
|
|
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// 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"}
|
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FaucetStrategy as FaucetStrategy$1 } from "../../contracts/faucet-strategy.mjs";
|
|
2
|
+
import { FaucetBodyError, FaucetExhausted, FaucetUnreachable } from "./errors.mjs";
|
|
2
3
|
|
|
3
4
|
//#region src/plugins/faucet/dispatcher.d.ts
|
|
4
5
|
/** Capability key prefix for a faucet request strategy. The full
|
|
5
6
|
* key is `faucet:request:<chainId>`. */
|
|
6
7
|
declare const FAUCET_CAPABILITY_KEY_PREFIX: "faucet:request";
|
|
8
|
+
/**
|
|
9
|
+
* Faucet strategy value. The dispatch surface is uniform across
|
|
10
|
+
* strategies — the dispatcher doesn't know how a strategy delivers
|
|
11
|
+
* coins, only how to invoke it.
|
|
12
|
+
*
|
|
13
|
+
* The generic contract lives in `contracts/faucet-strategy.ts` and
|
|
14
|
+
* is parameterised over the strategy's error channel. The faucet
|
|
15
|
+
* plugin narrows the alias to its tagged-error union so existing
|
|
16
|
+
* dispatcher consumers (the strategy registry, request retry shim)
|
|
17
|
+
* see the historical type unchanged.
|
|
18
|
+
*
|
|
19
|
+
* `amount` is the chain-native smallest unit (MIST for SUI). Some
|
|
20
|
+
* backends (the local sui-faucet binary) grant a fixed amount per
|
|
21
|
+
* request and IGNORE this value; the parameter is here for type
|
|
22
|
+
* uniformity and to land correctly-denominated values in
|
|
23
|
+
* `FaucetExhausted`.
|
|
24
|
+
*/
|
|
25
|
+
type FaucetStrategy = FaucetStrategy$1<FaucetExhausted | FaucetUnreachable | FaucetBodyError>;
|
|
7
26
|
//#endregion
|
|
8
|
-
export { FAUCET_CAPABILITY_KEY_PREFIX };
|
|
27
|
+
export { FAUCET_CAPABILITY_KEY_PREFIX, FaucetStrategy };
|
|
9
28
|
//# sourceMappingURL=dispatcher.d.mts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "effect";
|
|
2
1
|
//#region src/plugins/faucet/dispatcher.ts
|
|
3
2
|
/** Capability key prefix for a faucet request strategy. The full
|
|
4
3
|
* key is `faucet:request:<chainId>`. */
|
|
@@ -8,6 +7,6 @@ const FAUCET_CAPABILITY_KEY_PREFIX = "faucet:request";
|
|
|
8
7
|
* shape out of a tuple by name. */
|
|
9
8
|
const faucetCapabilityKey = (chainId) => `${FAUCET_CAPABILITY_KEY_PREFIX}:${chainId}`;
|
|
10
9
|
//#endregion
|
|
11
|
-
export { faucetCapabilityKey };
|
|
10
|
+
export { FAUCET_CAPABILITY_KEY_PREFIX, faucetCapabilityKey };
|
|
12
11
|
|
|
13
12
|
//# sourceMappingURL=dispatcher.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatcher.mjs","names":[],"sources":["../../../src/plugins/faucet/dispatcher.ts"],"sourcesContent":["// Faucet
|
|
1
|
+
{"version":3,"file":"dispatcher.mjs","names":[],"sources":["../../../src/plugins/faucet/dispatcher.ts"],"sourcesContent":["// Faucet capability-key encoding + dispatch contract.\n//\n// Architecture (distilled doc §Selection rule): the faucet plugin's\n// substrate-side dispatch is by capability key only — `faucet:request:<chainId>`.\n// The chain id is the substrate-level `NetworkConfig.chain` value\n// (e.g. `'sui:localnet'`, `'sui:testnet'`, `'sui:mainnet-fork@123'`).\n//\n// Sibling plugins (currently `sui`) reach in for `faucetCapabilityKey`\n// to register a faucet strategy keyed by chain id. The previous\n// `FaucetDispatcher` / `makeDispatcher` shape was a dead acquire-time\n// closure with no callers; the substrate-level\n// `substrate/runtime/strategy-registry/faucet-capability-for.ts` is the\n// canonical lookup helper now.\n//\n// The generic `FaucetStrategy<E>` contract lives in\n// `contracts/faucet-strategy.ts` (substrate-neutral, name-blind). This\n// file narrows the alias to the faucet plugin's tagged-error union so\n// strategy implementations (sui-local, future user strategies) close\n// over their own wire surface and satisfy this shape; the dispatcher\n// is implementation-blind.\n\nimport type { FaucetStrategy as FaucetStrategyContract } from '../../contracts/faucet-strategy.ts';\n\nimport type { FaucetBodyError, FaucetExhausted, FaucetUnreachable } from './errors.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/**\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 * The generic contract lives in `contracts/faucet-strategy.ts` and\n * is parameterised over the strategy's error channel. The faucet\n * plugin narrows the alias to its tagged-error union so existing\n * dispatcher consumers (the strategy registry, request retry shim)\n * see the historical type unchanged.\n *\n * `amount` is the chain-native smallest unit (MIST for SUI). Some\n * backends (the local sui-faucet binary) grant a fixed amount per\n * request and IGNORE this value; the parameter is here for type\n * uniformity and to land correctly-denominated values in\n * `FaucetExhausted`.\n */\nexport type FaucetStrategy = FaucetStrategyContract<\n\tFaucetExhausted | FaucetUnreachable | FaucetBodyError\n>;\n"],"mappings":";;;AA2BA,MAAa,+BAA+B;;;;AAK5C,MAAa,uBACZ,YAEA,GAAG,6BAA6B,GAAG"}
|
|
@@ -19,17 +19,21 @@ interface FaucetUnreachable {
|
|
|
19
19
|
readonly cause?: unknown;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
* attempt
|
|
24
|
-
*
|
|
25
|
-
*
|
|
22
|
+
* Wall-clock budget exhaustion. The retry loop did not land a
|
|
23
|
+
* successful attempt within the configured `timeoutMs`.
|
|
24
|
+
*
|
|
25
|
+
* The attempt-count cap (`maxRetries` on the schedule) does NOT
|
|
26
|
+
* surface as `FaucetExhausted` — when the retry schedule exhausts,
|
|
27
|
+
* Effect re-raises the LAST `FaucetUnreachable | FaucetBodyError`
|
|
28
|
+
* verbatim, which is more informative than a wrapped budget message.
|
|
29
|
+
* Callers handling `FaucetUnreachable | FaucetBodyError` already see
|
|
30
|
+
* the right wire-level cause.
|
|
26
31
|
*
|
|
27
32
|
* Carries the last underlying cause so pretty-error rendering can
|
|
28
33
|
* show what was actually failing instead of just the budget message.
|
|
29
34
|
*/
|
|
30
35
|
interface FaucetExhausted {
|
|
31
36
|
readonly _tag: 'FaucetExhausted';
|
|
32
|
-
readonly kind: 'wall-clock' | 'attempts';
|
|
33
37
|
readonly url: string;
|
|
34
38
|
readonly address: string;
|
|
35
39
|
readonly amount: bigint;
|
|
@@ -54,33 +58,16 @@ interface FaucetBodyError {
|
|
|
54
58
|
readonly address: string;
|
|
55
59
|
readonly amount: bigint;
|
|
56
60
|
readonly status: number;
|
|
57
|
-
readonly reason: 'failure-status' | '
|
|
61
|
+
readonly reason: 'failure-status' | 'invalid-json';
|
|
58
62
|
readonly message: string;
|
|
59
63
|
/** The raw body payload (truncated where necessary) for diagnostics. */
|
|
60
64
|
readonly bodySnippet?: string;
|
|
61
65
|
}
|
|
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
66
|
interface FaucetConfigError extends ConfigIssue {
|
|
80
67
|
readonly _tag: 'FaucetConfigError';
|
|
81
68
|
}
|
|
82
69
|
/** Union of every error a faucet caller may encounter. */
|
|
83
|
-
type FaucetError = FaucetUnreachable | FaucetExhausted | FaucetBodyError |
|
|
70
|
+
type FaucetError = FaucetUnreachable | FaucetExhausted | FaucetBodyError | FaucetConfigError;
|
|
84
71
|
//#endregion
|
|
85
72
|
export { FaucetBodyError, FaucetConfigError, FaucetError, FaucetExhausted, FaucetUnreachable };
|
|
86
73
|
//# sourceMappingURL=errors.d.mts.map
|
|
@@ -1 +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// -
|
|
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// - Wall-clock budget exhaustion surfaces as `FaucetExhausted`. The\n// attempt-cap (`maxRetries` on the underlying retry schedule)\n// re-raises the LAST `FaucetUnreachable | FaucetBodyError` directly\n// — wrapping it in `FaucetExhausted` would just hide the wire-level\n// error the cap was triggered by. The wall-clock budget is the\n// dominant exit; the attempt cap exists as a safety net.\n//\n// Effect v4: tagged errors are plain interfaces; `Effect.catchTag` /\n// `catchTags` match on the `_tag` literal.\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 * Wall-clock budget exhaustion. The retry loop did not land a\n * successful attempt within the configured `timeoutMs`.\n *\n * The attempt-count cap (`maxRetries` on the schedule) does NOT\n * surface as `FaucetExhausted` — when the retry schedule exhausts,\n * Effect re-raises the LAST `FaucetUnreachable | FaucetBodyError`\n * verbatim, which is more informative than a wrapped budget message.\n * Callers handling `FaucetUnreachable | FaucetBodyError` already see\n * the right wire-level cause.\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 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' | '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\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| FaucetConfigError;\n"],"mappings":";;AAyCA,MAAa,qBAAqB,WAA+D;CAChG,MAAM;CACN,GAAG;CACH;AA0BD,MAAa,mBAAmB,WAA2D;CAC1F,MAAM;CACN,GAAG;CACH;AAyBD,MAAa,mBAAmB,WAA2D;CAC1F,MAAM;CACN,GAAG;CACH;AAMgC,kBAAkB,oBAAoB"}
|
|
@@ -1,8 +1,28 @@
|
|
|
1
|
+
import { FAUCET_HTTP_RETRY_PROFILE, makeExponentialRetrySchedule } from "../../substrate/runtime/retry-policy.mjs";
|
|
1
2
|
import { faucetBodyError, faucetExhausted, faucetUnreachable } from "./errors.mjs";
|
|
2
|
-
import {
|
|
3
|
+
import { FaucetSpans } from "./spans.mjs";
|
|
3
4
|
import { Effect, Ref } from "effect";
|
|
5
|
+
//#region src/plugins/faucet/http.ts
|
|
6
|
+
/** Retry attempts cap. Paired with the wall-clock budget below: at
|
|
7
|
+
* 500ms initial × 1.5 backoff × jitter, 15 attempts saturates well
|
|
8
|
+
* before 90s, so the wall-clock check is the dominant exit. */
|
|
9
|
+
const DEFAULT_MAX_ATTEMPTS = FAUCET_HTTP_RETRY_PROFILE.maxAttempts;
|
|
10
|
+
/** Initial delay between retries (ms). Subsequent delays grow by
|
|
11
|
+
* the `BACKOFF_FACTOR`. */
|
|
12
|
+
const DEFAULT_INITIAL_DELAY_MS = FAUCET_HTTP_RETRY_PROFILE.initialDelayMs;
|
|
13
|
+
/** Wall-clock budget for the WHOLE request including all retries.
|
|
14
|
+
* Sized for a cold sui-localnet boot — the validator binary needs
|
|
15
|
+
* ~30–60s after its HTTP socket opens before it can submit txs. */
|
|
16
|
+
const DEFAULT_TIMEOUT_MS = FAUCET_HTTP_RETRY_PROFILE.wallClockBudgetMs;
|
|
4
17
|
/** Exponential growth factor between retries. */
|
|
5
|
-
const BACKOFF_FACTOR =
|
|
18
|
+
const BACKOFF_FACTOR = FAUCET_HTTP_RETRY_PROFILE.backoffFactor;
|
|
19
|
+
/** Per-POST hard deadline. The sui-faucet binary internally retries
|
|
20
|
+
* the underlying SUI transfer tx twice with ~30s timeouts; a single
|
|
21
|
+
* cold-chain request blocks ~60s before returning 500. Capping each
|
|
22
|
+
* POST at 5s lets the outer retry loop hammer quickly — when the
|
|
23
|
+
* chain catches up the next attempt lands in <1s. Successful
|
|
24
|
+
* warm-faucet calls return well under 1s, so 5s is a safe ceiling. */
|
|
25
|
+
const DEFAULT_FETCH_DEADLINE_MS = FAUCET_HTTP_RETRY_PROFILE.perRequestDeadlineMs;
|
|
6
26
|
/**
|
|
7
27
|
* One-shot POST: send + check status + parse body + check body
|
|
8
28
|
* status. Exported so tests can pin the body-Failure detection
|
|
@@ -18,7 +38,7 @@ const BACKOFF_FACTOR = 1.5;
|
|
|
18
38
|
const requestFundsOnce = (opts) => Effect.gen(function* () {
|
|
19
39
|
const path = opts.path ?? "/v2/gas";
|
|
20
40
|
const endpoint = `${opts.faucetUrl}${path}`;
|
|
21
|
-
const deadlineMs = opts.fetchDeadlineMs ??
|
|
41
|
+
const deadlineMs = opts.fetchDeadlineMs ?? DEFAULT_FETCH_DEADLINE_MS;
|
|
22
42
|
const response = yield* Effect.tryPromise({
|
|
23
43
|
try: () => fetch(endpoint, {
|
|
24
44
|
method: "POST",
|
|
@@ -73,7 +93,7 @@ const requestFundsOnce = (opts) => Effect.gen(function* () {
|
|
|
73
93
|
bodySnippet: payload
|
|
74
94
|
}));
|
|
75
95
|
}
|
|
76
|
-
}).pipe(Effect.withSpan("faucet.requestFundsOnce"));
|
|
96
|
+
}).pipe(Effect.withSpan("devstack.plugin.faucet.requestFundsOnce"));
|
|
77
97
|
/**
|
|
78
98
|
* Retry-wrapped POST. Combines `requestFundsOnce` with a jittered
|
|
79
99
|
* exponential schedule and a wall-clock budget; on exhaustion raises
|
|
@@ -84,15 +104,15 @@ const requestFundsOnce = (opts) => Effect.gen(function* () {
|
|
|
84
104
|
* `AbortSignal.timeout`.
|
|
85
105
|
*/
|
|
86
106
|
const requestFundsWithRetry = (opts) => Effect.gen(function* () {
|
|
87
|
-
const timeoutMs = opts.timeoutMs ??
|
|
88
|
-
const maxAttempts = opts.maxAttempts ??
|
|
89
|
-
const initialDelayMs = opts.initialDelayMs ??
|
|
107
|
+
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
108
|
+
const maxAttempts = opts.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;
|
|
109
|
+
const initialDelayMs = opts.initialDelayMs ?? DEFAULT_INITIAL_DELAY_MS;
|
|
90
110
|
yield* Effect.annotateCurrentSpan({
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
111
|
+
[FaucetSpans.url]: opts.faucetUrl,
|
|
112
|
+
[FaucetSpans.address]: opts.address,
|
|
113
|
+
[FaucetSpans.amount]: opts.amount.toString(),
|
|
114
|
+
[FaucetSpans.budgetMs]: timeoutMs,
|
|
115
|
+
[FaucetSpans.maxAttempts]: maxAttempts
|
|
96
116
|
});
|
|
97
117
|
const attempts = yield* Ref.make(0);
|
|
98
118
|
const lastError = yield* Ref.make(void 0);
|
|
@@ -110,7 +130,6 @@ const requestFundsWithRetry = (opts) => Effect.gen(function* () {
|
|
|
110
130
|
const n = yield* Ref.get(attempts);
|
|
111
131
|
const last = yield* Ref.get(lastError);
|
|
112
132
|
return yield* Effect.fail(faucetExhausted({
|
|
113
|
-
kind: "wall-clock",
|
|
114
133
|
url: opts.faucetUrl,
|
|
115
134
|
address: opts.address,
|
|
116
135
|
amount: opts.amount,
|
|
@@ -120,7 +139,7 @@ const requestFundsWithRetry = (opts) => Effect.gen(function* () {
|
|
|
120
139
|
}));
|
|
121
140
|
})
|
|
122
141
|
}));
|
|
123
|
-
}).pipe(Effect.withSpan("faucet.requestFundsWithRetry"));
|
|
142
|
+
}).pipe(Effect.withSpan("devstack.plugin.faucet.requestFundsWithRetry"));
|
|
124
143
|
//#endregion
|
|
125
144
|
export { requestFundsWithRetry };
|
|
126
145
|
|
|
@@ -1 +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"}
|
|
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 directly via\n// `resolved.waitForTransactionsReady.wait`; consumers call it before\n// the 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//\n// The substrate's `HttpProbes.waitForHttpEndpoint(...)` is for *readiness probes*\n// (poll a GET until ready), not one-shot POST + body-shape validation.\n// The wire-level contract above (non-2xx raise, body-Failure raise,\n// short per-fetch deadline relative to retry budget) is owned here.\n// The retry SCHEDULE shape, however, IS substrate-supplied — it\n// composes `makeExponentialRetrySchedule` from `retry-policy.ts`\n// and reads its constants from `FAUCET_HTTP_RETRY_PROFILE`.\n\nimport { Effect, Ref } from 'effect';\n\nimport {\n\tFAUCET_HTTP_RETRY_PROFILE,\n\tmakeExponentialRetrySchedule,\n} 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';\nimport { FaucetSpans } from './spans.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 = FAUCET_HTTP_RETRY_PROFILE.maxAttempts;\n\n/** Initial delay between retries (ms). Subsequent delays grow by\n * the `BACKOFF_FACTOR`. */\nexport const DEFAULT_INITIAL_DELAY_MS = FAUCET_HTTP_RETRY_PROFILE.initialDelayMs;\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 = FAUCET_HTTP_RETRY_PROFILE.wallClockBudgetMs;\n\n/** Exponential growth factor between retries. */\nexport const BACKOFF_FACTOR = FAUCET_HTTP_RETRY_PROFILE.backoffFactor;\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 = FAUCET_HTTP_RETRY_PROFILE.perRequestDeadlineMs;\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 an `invalid-json` 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('devstack.plugin.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[FaucetSpans.url]: opts.faucetUrl,\n\t\t\t[FaucetSpans.address]: opts.address,\n\t\t\t[FaucetSpans.amount]: opts.amount.toString(),\n\t\t\t[FaucetSpans.budgetMs]: timeoutMs,\n\t\t\t[FaucetSpans.maxAttempts]: 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\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('devstack.plugin.faucet.requestFundsWithRetry'));\n"],"mappings":";;;;;;;;AA0EA,MAAa,uBAAuB,0BAA0B;;;AAI9D,MAAa,2BAA2B,0BAA0B;;;;AAKlE,MAAa,qBAAqB,0BAA0B;;AAG5D,MAAa,iBAAiB,0BAA0B;;;;;;;AAQxD,MAAa,4BAA4B,0BAA0B;;;;;;;;;;;;;AAqCnE,MAAa,oBACZ,SAEA,OAAO,IAAI,aAAa;CACvB,MAAM,OAAO,KAAK,QAAQ;CAC1B,MAAM,WAAW,GAAG,KAAK,YAAY;CACrC,MAAM,aAAa,KAAK,mBAAmB;CAE3C,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,0CAA0C,CAAC;;;;;;;;;;AAmCpE,MAAa,yBACZ,SAEA,OAAO,IAAI,aAAa;CACvB,MAAM,YAAY,KAAK,aAAa;CACpC,MAAM,cAAc,KAAK,eAAe;CACxC,MAAM,iBAAiB,KAAK,kBAAkB;AAE9C,QAAO,OAAO,oBAAoB;GAChC,YAAY,MAAM,KAAK;GACvB,YAAY,UAAU,KAAK;GAC3B,YAAY,SAAS,KAAK,OAAO,UAAU;GAC3C,YAAY,WAAW;GACvB,YAAY,cAAc;EAC3B,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,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,+CAA+C,CAAC"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { StrategyContributorDecl } from "../../contracts/strategy-contributor.mjs";
|
|
2
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
|
-
|
|
3
|
+
import { FAUCET_CAPABILITY_KEY_PREFIX, FaucetStrategy } from "./dispatcher.mjs";
|
|
7
4
|
//#region src/plugins/faucet/index.d.ts
|
|
8
5
|
/**
|
|
9
6
|
* Build a `StrategyContributorDecl` for a faucet request strategy.
|
|
@@ -38,6 +35,19 @@ declare function defineFaucetStrategy<ChainId extends string>(decl: {
|
|
|
38
35
|
readonly autoMounted?: boolean;
|
|
39
36
|
readonly priority?: number;
|
|
40
37
|
}): StrategyContributorDecl<`${typeof FAUCET_CAPABILITY_KEY_PREFIX}:${ChainId}`, FaucetStrategy>;
|
|
38
|
+
/** A registered strategy contribution. Plugin authors that batch
|
|
39
|
+
* multiple per-chain strategies (custom fork admins, alt-network
|
|
40
|
+
* faucets) shape their config arrays around this; the underlying
|
|
41
|
+
* registration mechanic is `defineFaucetStrategy`. */
|
|
42
|
+
interface FaucetStrategyContribution {
|
|
43
|
+
/** Capability-key chain id (`'sui:localnet'`, `'sui:testnet'`, etc.). */
|
|
44
|
+
readonly chainId: string;
|
|
45
|
+
/** The strategy value — closes over its own dependencies. */
|
|
46
|
+
readonly strategy: FaucetStrategy;
|
|
47
|
+
/** Optional priority. Defaults to `1` so user strategies win over
|
|
48
|
+
* the built-in's `0`. */
|
|
49
|
+
readonly priority?: number;
|
|
50
|
+
}
|
|
41
51
|
//#endregion
|
|
42
|
-
export { defineFaucetStrategy };
|
|
52
|
+
export { FaucetStrategyContribution, defineFaucetStrategy };
|
|
43
53
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +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 {
|
|
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 {\n\tFAUCET_CAPABILITY_KEY_PREFIX,\n\tfaucetCapabilityKey,\n\ttype FaucetStrategy,\n} from './dispatcher.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// Public types\n// ---------------------------------------------------------------------------\n\n/** A registered strategy contribution. Plugin authors that batch\n * multiple per-chain strategies (custom fork admins, alt-network\n * faucets) shape their config arrays around this; the underlying\n * registration mechanic is `defineFaucetStrategy`. */\nexport interface FaucetStrategyContribution {\n\t/** Capability-key chain id (`'sui:localnet'`, `'sui:testnet'`, etc.). */\n\treadonly chainId: string;\n\t/** The strategy value — closes over its own dependencies. */\n\treadonly strategy: FaucetStrategy;\n\t/** Optional priority. Defaults to `1` so user strategies win over\n\t * the built-in's `0`. */\n\treadonly priority?: number;\n}\n\nexport type {\n\tFaucetError,\n\tFaucetUnreachable,\n\tFaucetExhausted,\n\tFaucetBodyError,\n\tFaucetConfigError,\n} from './errors.ts';\nexport { faucetBodyError, faucetConfigError } from './errors.ts';\nexport { requestFundsWithRetry, type RetryOptions } from './http.ts';\nexport {\n\tFAUCET_CAPABILITY_KEY_PREFIX,\n\tfaucetCapabilityKey,\n\ttype FaucetStrategy,\n} from './dispatcher.ts';\nexport { FaucetSpans } from './spans.ts';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,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,12 @@
|
|
|
1
|
+
//#region src/plugins/faucet/spans.ts
|
|
2
|
+
const FaucetSpans = {
|
|
3
|
+
address: "faucet.address",
|
|
4
|
+
amount: "faucet.amount",
|
|
5
|
+
budgetMs: "faucet.budget_ms",
|
|
6
|
+
maxAttempts: "faucet.max_attempts",
|
|
7
|
+
url: "faucet.url"
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { FaucetSpans };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=spans.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spans.mjs","names":[],"sources":["../../../src/plugins/faucet/spans.ts"],"sourcesContent":["// Faucet plugin span-attribute vocabulary. Plugin-local — substrate's\n// `SpanAttr` carries only engine-dimensional + http/process generic\n// keys; plugin-domain keys live next to the plugin that owns them.\n//\n// Callsite pattern: `Effect.annotateCurrentSpan({ [FaucetSpans.url]:\n// value })`. Free-form string literals are a STYLE_GUIDE §16 violation.\n\nexport const FaucetSpans = {\n\taddress: 'faucet.address',\n\tamount: 'faucet.amount',\n\tbudgetMs: 'faucet.budget_ms',\n\tmaxAttempts: 'faucet.max_attempts',\n\turl: 'faucet.url',\n} as const;\n"],"mappings":";AAOA,MAAa,cAAc;CAC1B,SAAS;CACT,QAAQ;CACR,UAAU;CACV,aAAa;CACb,KAAK;CACL"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConfigIssue } from "../../substrate/runtime/config-validation.mjs";
|
|
2
|
-
import * as _$effect_Types0 from "effect/Types";
|
|
3
2
|
import * as _$effect_Cause0 from "effect/Cause";
|
|
3
|
+
import * as _$effect_Types0 from "effect/Types";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/host-service/errors.d.ts
|
|
6
6
|
interface HostServiceConfigError extends ConfigIssue {
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { definePlugin, resource } from "../../substrate/plugin.mjs";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { CurrentPluginKey } from "../../substrate/runtime/current-plugin.mjs";
|
|
5
|
-
import { makeHostServiceRoutable } from "./routable.mjs";
|
|
2
|
+
import "../../api/define-plugin.mjs";
|
|
3
|
+
import { IdentityContext, RuntimeRoot } from "../../substrate/runtime/paths.mjs";
|
|
6
4
|
import { Logger as Logger$1 } from "../../substrate/runtime/observability/logger.mjs";
|
|
5
|
+
import "../../substrate/runtime/observability/index.mjs";
|
|
6
|
+
import { CurrentPluginKey } from "../../substrate/runtime/current-plugin.mjs";
|
|
7
|
+
import { PostAcquireTasksService } from "../../substrate/runtime/post-acquire-tasks.mjs";
|
|
8
|
+
import { PortBrokerService } from "../../substrate/runtime/port-broker/service.mjs";
|
|
9
|
+
import "../../substrate/runtime/port-broker/index.mjs";
|
|
10
|
+
import { renderUrl, routedHostname } from "../../substrate/runtime/routed-url.mjs";
|
|
11
|
+
import { HOST_SERVICE_DEFAULT_ENTRYPOINT_PORT, makeHostServiceRoutable } from "./routable.mjs";
|
|
12
|
+
import { pluginErrorContributions } from "../../api/plugin-errors.mjs";
|
|
7
13
|
import { HOST_SERVICE_ERROR_TAGS } from "./errors.mjs";
|
|
8
14
|
import { normalizeHostServiceOptions, prepareHostService } from "./service.mjs";
|
|
9
15
|
import { Effect } from "effect";
|
|
@@ -20,18 +26,38 @@ const hostService = (options) => {
|
|
|
20
26
|
id: serviceResource.id,
|
|
21
27
|
dependsOn: after,
|
|
22
28
|
role: "service",
|
|
29
|
+
section: "service",
|
|
23
30
|
start: () => Effect.gen(function* () {
|
|
24
31
|
const portBroker = yield* PortBrokerService;
|
|
32
|
+
const logger = yield* Logger$1;
|
|
33
|
+
const currentPlugin = yield* CurrentPluginKey;
|
|
34
|
+
const postAcquireTasks = yield* PostAcquireTasksService;
|
|
35
|
+
const identity = yield* IdentityContext;
|
|
36
|
+
const { root: runtimeRoot } = yield* RuntimeRoot;
|
|
37
|
+
const routedUrl = yield* routedHostname(identity, normalized.endpointName).pipe(Effect.map((hostname) => renderUrl({
|
|
38
|
+
protocol: "http",
|
|
39
|
+
hostname,
|
|
40
|
+
port: HOST_SERVICE_DEFAULT_ENTRYPOINT_PORT
|
|
41
|
+
})), Effect.orElseSucceed(() => null));
|
|
25
42
|
const prepared = yield* prepareHostService(normalized, {
|
|
26
43
|
allocatePort: (preferredPort) => portBroker.allocate({
|
|
27
|
-
|
|
44
|
+
owner: `host-service:${normalized.serviceName}`,
|
|
28
45
|
probeHost: HOST_SERVICE_PORT_PROBE_HOST,
|
|
29
46
|
...preferredPort === void 0 ? {} : { preferredPort }
|
|
30
47
|
}).pipe(Effect.map((allocation) => allocation.port)),
|
|
31
|
-
logger
|
|
32
|
-
pluginKey:
|
|
48
|
+
logger,
|
|
49
|
+
pluginKey: currentPlugin.key,
|
|
50
|
+
discoveryIdentity: {
|
|
51
|
+
stack: identity.stack,
|
|
52
|
+
runtimeRoot
|
|
53
|
+
},
|
|
54
|
+
routedUrl
|
|
55
|
+
});
|
|
56
|
+
yield* postAcquireTasks.register({
|
|
57
|
+
pluginKey: currentPlugin.key,
|
|
58
|
+
label: `host-service:${normalized.serviceName}.start`,
|
|
59
|
+
run: prepared.start
|
|
33
60
|
});
|
|
34
|
-
yield* prepared.start;
|
|
35
61
|
return prepared.value;
|
|
36
62
|
}),
|
|
37
63
|
errorContributions: hostServiceErrorContributions,
|