@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
|
@@ -3,19 +3,23 @@
|
|
|
3
3
|
* editing this file (and the plugin doc's catalog).
|
|
4
4
|
*
|
|
5
5
|
* Phase semantics:
|
|
6
|
-
* - `discriminator`
|
|
7
|
-
*
|
|
8
|
-
* - `build`
|
|
9
|
-
*
|
|
10
|
-
* - `sign`
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* - `
|
|
15
|
-
*
|
|
16
|
-
*
|
|
6
|
+
* - `discriminator` — `opts.discriminator` Effect evaluation failed.
|
|
7
|
+
* User-code defect or yielded upstream raised.
|
|
8
|
+
* - `build` — `opts.body`'s build phase (the user-supplied
|
|
9
|
+
* Effect) failed before producing a transaction.
|
|
10
|
+
* - `sign` — signing / submit transport failed (signer
|
|
11
|
+
* refused, RPC unreachable, finality timeout).
|
|
12
|
+
* This is `account.signAndExecute`'s error
|
|
13
|
+
* channel; it does NOT cover on-chain failures.
|
|
14
|
+
* - `execute-failed` — transaction was delivered + executed by the
|
|
15
|
+
* validator but the on-chain execution failed
|
|
16
|
+
* (the `$kind: 'FailedTransaction'` variant of
|
|
17
|
+
* `account.signAndExecute`'s return value).
|
|
18
|
+
* - `verify` — verify probe authoritatively raised (transient
|
|
19
|
+
* is masked by the lenient probe — does NOT raise
|
|
20
|
+
* this).
|
|
17
21
|
*/
|
|
18
|
-
type ActionPhase = 'discriminator' | 'build' | 'sign' | '
|
|
22
|
+
type ActionPhase = 'discriminator' | 'build' | 'sign' | 'execute-failed' | 'verify';
|
|
19
23
|
/** Single tagged action error. */
|
|
20
24
|
interface ActionError {
|
|
21
25
|
readonly _tag: 'ActionError';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/plugins/action/errors.ts"],"sourcesContent":["// Action plugin — typed errors.\n//\n// Distilled doc 16-action.md \"Failure modes\": signing failure routes\n// through `PublishError({ phase: 'publish-tx' })`. The rewrite splits\n// the user-facing action error from `package`'s `PublishError` because\n// action-specific phases
|
|
1
|
+
{"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/plugins/action/errors.ts"],"sourcesContent":["// Action plugin — typed errors.\n//\n// Distilled doc 16-action.md \"Failure modes\": signing failure routes\n// through `PublishError({ phase: 'publish-tx' })`. The rewrite splits\n// the user-facing action error from `package`'s `PublishError` because\n// action-specific phases carry different semantics — `build` here is the\n// user-supplied transaction-builder Effect, `sign` is the build/sign/\n// submit transport (the `signAndExecute` invocation, including the\n// Account plugin's `no-digest` envelope violation surfaced via `cause`),\n// and `execute-failed` is the on-chain `FailedTransaction` outcome.\n//\n// Per architecture §Effect, errors are plain interfaces with a `_tag`\n// discriminator; `Effect.catchTag` / `catchTags` match on the literal.\n\n/** Phases for `ActionError`. Closed sum — adding a phase requires\n * editing this file (and the plugin doc's catalog).\n *\n * Phase semantics:\n * - `discriminator` — `opts.discriminator` Effect evaluation failed.\n * User-code defect or yielded upstream raised.\n * - `build` — `opts.body`'s build phase (the user-supplied\n * Effect) failed before producing a transaction.\n * - `sign` — signing / submit transport failed (signer\n * refused, RPC unreachable, finality timeout).\n * This is `account.signAndExecute`'s error\n * channel; it does NOT cover on-chain failures.\n * - `execute-failed` — transaction was delivered + executed by the\n * validator but the on-chain execution failed\n * (the `$kind: 'FailedTransaction'` variant of\n * `account.signAndExecute`'s return value).\n * - `verify` — verify probe authoritatively raised (transient\n * is masked by the lenient probe — does NOT raise\n * this).\n */\nexport type ActionPhase = 'discriminator' | 'build' | 'sign' | 'execute-failed' | 'verify';\n\n/** Single tagged action error. */\nexport interface ActionError {\n\treadonly _tag: 'ActionError';\n\treadonly phase: ActionPhase;\n\t/** Symbolic action name (the user-declared `action.name`). Flows\n\t * into the cache key namespace and the TUI row title. */\n\treadonly actionName: string;\n\treadonly message: string;\n\treadonly cause?: unknown;\n}\n\nexport const actionError = (\n\tphase: ActionPhase,\n\tparts: Omit<ActionError, '_tag' | 'phase'>,\n): ActionError => ({ _tag: 'ActionError', phase, ...parts });\n\n/** Error tags this plugin contributes — surfaced to the cause walker\n * via `PluginErrorContribution`. */\nexport const ACTION_ERROR_TAGS = ['ActionError'] as const;\n"],"mappings":";AA+CA,MAAa,eACZ,OACA,WACkB;CAAE,MAAM;CAAe;CAAO,GAAG;CAAO;;;AAI3D,MAAa,oBAAoB,CAAC,cAAc"}
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
+
import { formatUnknownError } from "../../substrate/runtime/format-unknown-error.mjs";
|
|
2
|
+
import { signAndDispatch } from "../../substrate/runtime/sui-execute/sign-and-dispatch.mjs";
|
|
3
|
+
import { formatExecutedFailure } from "../../substrate/runtime/sui-execute/index.mjs";
|
|
1
4
|
import { buildForkImpersonationTransactionBytes } from "../sui/fork-transaction.mjs";
|
|
5
|
+
import "../sui/index.mjs";
|
|
2
6
|
import { actionError } from "./errors.mjs";
|
|
7
|
+
import { ActionSpans } from "./spans.mjs";
|
|
3
8
|
import { Effect } from "effect";
|
|
4
9
|
import { Transaction } from "@mysten/sui/transactions";
|
|
5
10
|
//#region src/plugins/action/execute.ts
|
|
11
|
+
/**
|
|
12
|
+
* Re-bucket the account's flat `objectChanges` into action-flavored
|
|
13
|
+
* `created` / `mutated` rows. The account plugin's projection emits
|
|
14
|
+
* `{type, objectId, objectType?, outputState?, idOperation?}`; we
|
|
15
|
+
* carry through the optional fields and discriminate on `type` /
|
|
16
|
+
* `kind` so a downstream `findCreatedByType` consumer keeps working.
|
|
17
|
+
*/
|
|
6
18
|
const projectAccountObjectChanges = (changes) => changes.filter((change) => typeof change === "object" && change !== null && typeof change.objectId === "string").map((change) => {
|
|
7
19
|
const entry = {
|
|
8
20
|
kind: change.type === "created" || change.kind === "created" ? "created" : "mutated",
|
|
@@ -13,132 +25,82 @@ const projectAccountObjectChanges = (changes) => changes.filter((change) => type
|
|
|
13
25
|
if (typeof change.idOperation === "string") entry.idOperation = change.idOperation;
|
|
14
26
|
return entry;
|
|
15
27
|
});
|
|
16
|
-
const
|
|
28
|
+
const receiptFromTxResult = (tx) => ({
|
|
17
29
|
digest: tx.digest,
|
|
18
30
|
objectChanges: projectAccountObjectChanges(tx.objectChanges),
|
|
19
31
|
balanceChanges: tx.balanceChanges
|
|
20
32
|
});
|
|
21
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Map an `AccountSignError` onto the action's `'sign'` phase. The
|
|
35
|
+
* account's `signAndExecute` returns a discriminated `SignAndExecuteResult`
|
|
36
|
+
* for the on-chain outcome (success vs FailedTransaction); only
|
|
37
|
+
* transport / lifecycle failures surface here.
|
|
38
|
+
*/
|
|
39
|
+
const accountSignErrorToActionError = (actionName) => (cause) => actionError("sign", {
|
|
40
|
+
actionName,
|
|
41
|
+
message: `Action '${actionName}': account sign/execute failed for '${cause.accountName}' (address=${cause.address}): ${cause.message}`,
|
|
42
|
+
cause
|
|
43
|
+
});
|
|
44
|
+
/** Drive the full build → sign → execute → wait → project pipeline by
|
|
45
|
+
* delegating to the account's `withTransactionSigner` /
|
|
46
|
+
* `signAndExecute` surface, then re-projecting the returned
|
|
47
|
+
* `TxResult` into the action's `ActionReceipt` shape.
|
|
22
48
|
*
|
|
23
49
|
* Allocates a fresh `Transaction`, sets the sender to the account's
|
|
24
50
|
* address, lets the caller populate it via the `build` callback,
|
|
25
|
-
* serialises via `Transaction.build({ client })
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* finality, and projects the envelope into an `ActionReceipt`.
|
|
51
|
+
* serialises via `Transaction.build({ client })` (or the fork-mode
|
|
52
|
+
* builder for impersonation accounts), then hands the bytes to the
|
|
53
|
+
* account's locked-signer scope. The account plugin owns sign,
|
|
54
|
+
* execute, finality wait, and envelope projection.
|
|
30
55
|
*
|
|
31
56
|
* All failures surface as `ActionError`:
|
|
32
|
-
* - `build` callback throws → `phase: 'sign'
|
|
33
|
-
* catch-all phase for body-side failures).
|
|
57
|
+
* - `build` callback throws → `phase: 'sign'`.
|
|
34
58
|
* - `Transaction.build` rejects → `phase: 'sign'`.
|
|
35
|
-
* - `
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
59
|
+
* - `account.signAndExecute` rejects with `AccountSignError` → mapped
|
|
60
|
+
* to `phase: 'sign'`. The Account plugin's `'no-digest'` phase
|
|
61
|
+
* (SDK envelope protocol violation) flows through here as well —
|
|
62
|
+
* the originating `AccountSignError` is preserved via `cause` so
|
|
63
|
+
* the cause walker renders the underlying `phase: 'no-digest'`.
|
|
40
64
|
*
|
|
41
65
|
* The `actionName` parameter threads into every error's `actionName`
|
|
42
66
|
* field so cause-walker output stays attributable.
|
|
43
67
|
*/
|
|
44
|
-
const signAndExecute = (params) =>
|
|
68
|
+
const signAndExecute = (params) => {
|
|
45
69
|
const { actionName, sui, account, build } = params;
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
cause
|
|
61
|
-
}))) : yield* Effect.tryPromise({
|
|
62
|
-
try: () => tx.build({ client: sui.sdk.client }),
|
|
63
|
-
catch: (cause) => actionError("sign", {
|
|
64
|
-
actionName,
|
|
65
|
-
message: `Action '${actionName}': Transaction.build failed — ${cause instanceof Error ? cause.message : String(cause)}.`,
|
|
66
|
-
cause
|
|
67
|
-
})
|
|
68
|
-
});
|
|
69
|
-
if (account.source === "impersonate") return receiptFromAccountTx(yield* lockedSigner.signAndExecute(txBytes).pipe(Effect.mapError((cause) => actionError("sign", {
|
|
70
|
-
actionName,
|
|
71
|
-
message: `Action '${actionName}': account.signAndExecute failed for '${account.name}' (address=${account.address}): ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
72
|
-
cause
|
|
73
|
-
}))));
|
|
74
|
-
const signed = yield* lockedSigner.signTransaction(txBytes).pipe(Effect.mapError((cause) => actionError("sign", {
|
|
75
|
-
actionName,
|
|
76
|
-
message: `Action '${actionName}': account.signTransaction failed for '${account.name}' (address=${account.address}): ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
77
|
-
cause
|
|
78
|
-
})));
|
|
79
|
-
const sdkClient = sui.sdk.client;
|
|
80
|
-
const env = yield* Effect.tryPromise({
|
|
81
|
-
try: () => sdkClient.executeTransaction({
|
|
82
|
-
transaction: txBytes,
|
|
83
|
-
signatures: [signed.signature],
|
|
84
|
-
include: {
|
|
85
|
-
effects: true,
|
|
86
|
-
objectTypes: true
|
|
87
|
-
}
|
|
88
|
-
}),
|
|
89
|
-
catch: (cause) => actionError("sign", {
|
|
70
|
+
return signAndDispatch({
|
|
71
|
+
signerSource: account,
|
|
72
|
+
buildTxBytes: () => Effect.gen(function* () {
|
|
73
|
+
const tx = new Transaction();
|
|
74
|
+
tx.setSender(account.address);
|
|
75
|
+
yield* Effect.try({
|
|
76
|
+
try: () => build(tx),
|
|
77
|
+
catch: (cause) => actionError("sign", {
|
|
78
|
+
actionName,
|
|
79
|
+
message: `Action '${actionName}': build callback threw before serialisation.`,
|
|
80
|
+
cause
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
return account.source === "impersonate" || sui.fork !== null ? yield* buildForkImpersonationTransactionBytes(tx, account.address, sui.sdk.core).pipe(Effect.mapError((cause) => actionError("sign", {
|
|
90
84
|
actionName,
|
|
91
|
-
message: `Action '${actionName}':
|
|
85
|
+
message: `Action '${actionName}': fork Transaction.build failed — ${cause.message}.`,
|
|
92
86
|
cause
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
if (env.$kind === "FailedTransaction") {
|
|
96
|
-
const failedDigest = env.FailedTransaction?.digest;
|
|
97
|
-
if (failedDigest !== void 0) yield* Effect.tryPromise({
|
|
98
|
-
try: () => sdkClient.waitForTransaction({ digest: failedDigest }),
|
|
87
|
+
}))) : yield* Effect.tryPromise({
|
|
88
|
+
try: () => tx.build({ client: sui.sdk.client }),
|
|
99
89
|
catch: (cause) => actionError("sign", {
|
|
100
90
|
actionName,
|
|
101
|
-
message: `Action '${actionName}':
|
|
91
|
+
message: `Action '${actionName}': Transaction.build failed — ${formatUnknownError(cause)}.`,
|
|
102
92
|
cause
|
|
103
93
|
})
|
|
104
94
|
});
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}));
|
|
109
|
-
}
|
|
110
|
-
const txOk = env.Transaction;
|
|
111
|
-
if (txOk?.digest === void 0) return yield* Effect.fail(actionError("parse", {
|
|
95
|
+
}),
|
|
96
|
+
mapSignError: accountSignErrorToActionError(actionName),
|
|
97
|
+
onFailed: (failure) => Effect.fail(actionError("execute-failed", {
|
|
112
98
|
actionName,
|
|
113
|
-
message: `Action '${actionName}':
|
|
114
|
-
}))
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
actionName,
|
|
119
|
-
message: `Action '${actionName}': waitForTransaction(${txOk.digest}) failed.`,
|
|
120
|
-
cause
|
|
121
|
-
})
|
|
122
|
-
});
|
|
123
|
-
const objectTypes = txOk.objectTypes ?? {};
|
|
124
|
-
const objectChanges = (txOk.effects?.changedObjects ?? []).filter((c) => typeof c.objectId === "string").map((c) => {
|
|
125
|
-
const objectType = objectTypes[c.objectId];
|
|
126
|
-
const entry = {
|
|
127
|
-
kind: c.idOperation === "Created" ? "created" : "mutated",
|
|
128
|
-
objectId: c.objectId
|
|
129
|
-
};
|
|
130
|
-
if (objectType !== void 0) entry.objectType = objectType;
|
|
131
|
-
if (c.outputState !== void 0) entry.outputState = c.outputState;
|
|
132
|
-
if (c.idOperation !== void 0) entry.idOperation = c.idOperation;
|
|
133
|
-
return entry;
|
|
134
|
-
});
|
|
135
|
-
return {
|
|
136
|
-
digest: txOk.digest,
|
|
137
|
-
objectChanges,
|
|
138
|
-
balanceChanges: []
|
|
139
|
-
};
|
|
140
|
-
}));
|
|
141
|
-
}).pipe(Effect.withSpan("devstack.plugin.action.signAndExecute", { attributes: { "action.name": params.actionName } }));
|
|
99
|
+
message: `Action '${actionName}': transaction execution failed on-chain for account '${account.name}' (address=${account.address}) ` + formatExecutedFailure(failure)
|
|
100
|
+
})),
|
|
101
|
+
onSuccess: (txResult) => Effect.succeed(receiptFromTxResult(txResult))
|
|
102
|
+
}).pipe(Effect.withSpan("devstack.plugin.action.signAndExecute", { attributes: { [ActionSpans.name]: actionName } }));
|
|
103
|
+
};
|
|
142
104
|
//#endregion
|
|
143
105
|
export { signAndExecute };
|
|
144
106
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.mjs","names":[],"sources":["../../../src/plugins/action/execute.ts"],"sourcesContent":["// Action plugin — `signAndExecute` helper.\n//\n// This module encapsulates the \"build → sign → execute → wait → project\"\n// roundtrip that every action body needs to perform a Move call against\n// the booted Sui chain. Without it, every action body re-implements the\n// SDK boundary cast on `sdk.client.executeTransaction` + the SDK envelope\n// projection + the post-submit `waitForTransaction` gate.\n//\n// The same wiring lives in `plugins/package/publish-executor.ts` — both\n// sites cast the opaque `sdk.client` to call `executeTransaction({\n// include: { effects: true, objectTypes: true }})` so they recover\n// `changedObjects` + their fully-qualified types. Both run through the\n// Account plugin's transaction-signer scope so `Transaction.build`,\n// signing, execute, and finality wait serialize per address.\n//\n// What this helper extracts: the SDK-envelope projection + the\n// finality-wait. Per call sites:\n//\n// - The user supplies a `build(tx)` callback that populates the\n// `Transaction` synchronously (moveCalls, transferObjects, etc.).\n// - The user supplies the signing `account` (an `AccountValue` from\n// the action's resolved dependency values); we sign with the\n// locked transaction signer and drive the SDK's\n// `executeTransaction` directly.\n// - The helper returns an `ActionReceipt` projection: `{ digest,\n// objectChanges }`. The `objectChanges` array is shaped uniformly so\n// downstream consumers can pick by `objectType` substring.\n//\n// All failures route through `ActionError` (phase: `sign` for transport\n// / RPC failures; `parse` for \"no digest\" / \"wrong envelope shape\"\n// situations). The action plugin's outer wrap collapses these into the\n// substrate's artifact publisher `produce-failed` channel.\n\nimport { Effect, type Scope } from 'effect';\n\nimport { Transaction } from '@mysten/sui/transactions';\n\nimport type { AccountValue, TxResult } from '../account/service.ts';\nimport type { SuiClient } from '../sui/index.ts';\nimport { buildForkImpersonationTransactionBytes } from '../sui/fork-transaction.ts';\n\nimport { actionError, type ActionError } from './errors.ts';\nimport type { ActionReceipt } from './service.ts';\n\n// ---------------------------------------------------------------------------\n// Receipt object-change projection\n// ---------------------------------------------------------------------------\n\n/** Flat object-change record surfaced on an `ActionReceipt`. Mirrors\n * the package plugin's `PublishObjectChange` shape so consumers can\n * reuse `findCreatedByType`-style helpers across the two surfaces.\n *\n * - `kind`: 'created' when `idOperation === 'Created'`, else 'mutated'\n * (we expose the same two buckets the package plugin uses; finer\n * distinctions are recoverable from the raw `idOperation` /\n * `outputState` fields preserved alongside).\n * - `objectType`: optional fully-qualified type string\n * (`<packageId>::<module>::<Name>`) — present when the SDK's\n * `objectTypes` map carries the id. */\nexport interface ActionObjectChange {\n\treadonly kind: 'created' | 'mutated';\n\treadonly objectId: string;\n\treadonly objectType?: string;\n\treadonly outputState?: string;\n\treadonly idOperation?: string;\n}\n\n// ---------------------------------------------------------------------------\n// SDK shape — kept narrow, mirrors the cast in publish-executor.ts\n// ---------------------------------------------------------------------------\n\ninterface SdkExecuteClient {\n\treadonly executeTransaction: (args: {\n\t\treadonly transaction: Uint8Array;\n\t\treadonly signatures: ReadonlyArray<string>;\n\t\treadonly include?: {\n\t\t\treadonly effects?: boolean;\n\t\t\treadonly objectTypes?: boolean;\n\t\t};\n\t}) => Promise<unknown>;\n\treadonly waitForTransaction: (args: {\n\t\treadonly digest: string;\n\t\treadonly include?: { readonly effects?: boolean };\n\t\treadonly timeout?: number;\n\t}) => Promise<unknown>;\n}\n\ninterface RawExecuteEnvelope {\n\treadonly $kind?: 'Transaction' | 'FailedTransaction';\n\treadonly Transaction?: {\n\t\treadonly digest?: string;\n\t\treadonly effects?: {\n\t\t\treadonly changedObjects?: ReadonlyArray<{\n\t\t\t\treadonly objectId?: string;\n\t\t\t\treadonly outputState?: string;\n\t\t\t\treadonly idOperation?: string;\n\t\t\t}>;\n\t\t};\n\t\treadonly objectTypes?: Readonly<Record<string, string>>;\n\t};\n\treadonly FailedTransaction?: {\n\t\treadonly digest?: string;\n\t\treadonly status?: { readonly error?: string };\n\t};\n}\n\nconst projectAccountObjectChanges = (\n\tchanges: ReadonlyArray<unknown>,\n): ReadonlyArray<ActionObjectChange> =>\n\tchanges\n\t\t.filter(\n\t\t\t(\n\t\t\t\tchange,\n\t\t\t): change is {\n\t\t\t\treadonly type?: string;\n\t\t\t\treadonly kind?: string;\n\t\t\t\treadonly objectId: string;\n\t\t\t\treadonly objectType?: string;\n\t\t\t\treadonly outputState?: string;\n\t\t\t\treadonly idOperation?: string;\n\t\t\t} =>\n\t\t\t\ttypeof change === 'object' &&\n\t\t\t\tchange !== null &&\n\t\t\t\ttypeof (change as { readonly objectId?: unknown }).objectId === 'string',\n\t\t)\n\t\t.map((change) => {\n\t\t\tconst entry: {\n\t\t\t\t-readonly [K in keyof ActionObjectChange]: ActionObjectChange[K];\n\t\t\t} = {\n\t\t\t\tkind: change.type === 'created' || change.kind === 'created' ? 'created' : 'mutated',\n\t\t\t\tobjectId: change.objectId,\n\t\t\t};\n\t\t\tif (typeof change.objectType === 'string') entry.objectType = change.objectType;\n\t\t\tif (typeof change.outputState === 'string') entry.outputState = change.outputState;\n\t\t\tif (typeof change.idOperation === 'string') entry.idOperation = change.idOperation;\n\t\t\treturn entry;\n\t\t});\n\nconst receiptFromAccountTx = (tx: TxResult): ActionReceipt => ({\n\tdigest: tx.digest,\n\tobjectChanges: projectAccountObjectChanges(tx.objectChanges),\n\tbalanceChanges: tx.balanceChanges,\n});\n\n// ---------------------------------------------------------------------------\n// `signAndExecute` helper\n// ---------------------------------------------------------------------------\n\n/** Drive the full build → sign → execute → wait → project pipeline.\n *\n * Allocates a fresh `Transaction`, sets the sender to the account's\n * address, lets the caller populate it via the `build` callback,\n * serialises via `Transaction.build({ client })`, signs via the\n * account's transaction-signer scope, executes via the SDK's\n * `executeTransaction` (with `include: { effects: true, objectTypes:\n * true }` so the SDK surfaces `changedObjects` + types), waits for\n * finality, and projects the envelope into an `ActionReceipt`.\n *\n * All failures surface as `ActionError`:\n * - `build` callback throws → `phase: 'sign'` (matches the existing\n * catch-all phase for body-side failures).\n * - `Transaction.build` rejects → `phase: 'sign'`.\n * - `signTransaction` rejects → `phase: 'sign'`.\n * - `executeTransaction` rejects → `phase: 'sign'`.\n * - SDK returns `FailedTransaction` → `phase: 'sign'`.\n * - SDK returns no digest → `phase: 'parse'`.\n * - `waitForTransaction` rejects → `phase: 'sign'`.\n *\n * The `actionName` parameter threads into every error's `actionName`\n * field so cause-walker output stays attributable.\n */\nexport const signAndExecute = (params: {\n\treadonly actionName: string;\n\treadonly sui: SuiClient;\n\treadonly account: AccountValue;\n\treadonly build: (tx: Transaction) => void;\n}): Effect.Effect<ActionReceipt, ActionError, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tconst { actionName, sui, account, build } = params;\n\t\treturn yield* account.withTransactionSigner((lockedSigner) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\t// --- 1. Allocate + populate the Transaction ------------------\n\t\t\t\tconst tx = new Transaction();\n\t\t\t\ttx.setSender(account.address);\n\t\t\t\tyield* Effect.try({\n\t\t\t\t\ttry: () => build(tx),\n\t\t\t\t\tcatch: (cause): ActionError =>\n\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\tmessage: `Action '${actionName}': build callback threw before serialisation.`,\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t}),\n\t\t\t\t});\n\n\t\t\t\t// --- 2. Serialise via the mode-appropriate path --------------\n\t\t\t\tconst txBytes =\n\t\t\t\t\taccount.source === 'impersonate'\n\t\t\t\t\t\t? yield* buildForkImpersonationTransactionBytes(tx, account.address, sui.sdk.core).pipe(\n\t\t\t\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t\t\t\t(cause): ActionError =>\n\t\t\t\t\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\t\t\t\t\tmessage: `Action '${actionName}': fork impersonation Transaction.build failed — ${cause.message}.`,\n\t\t\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: yield* Effect.tryPromise({\n\t\t\t\t\t\t\t\ttry: () =>\n\t\t\t\t\t\t\t\t\ttx.build({\n\t\t\t\t\t\t\t\t\t\tclient: sui.sdk.client as Parameters<typeof tx.build>[0] extends\n\t\t\t\t\t\t\t\t\t\t\t| { client?: infer C }\n\t\t\t\t\t\t\t\t\t\t\t| undefined\n\t\t\t\t\t\t\t\t\t\t\t? C\n\t\t\t\t\t\t\t\t\t\t\t: never,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\tcatch: (cause): ActionError =>\n\t\t\t\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\t\t\t\tmessage: `Action '${actionName}': Transaction.build failed — ${\n\t\t\t\t\t\t\t\t\t\t\tcause instanceof Error ? cause.message : String(cause)\n\t\t\t\t\t\t\t\t\t\t}.`,\n\t\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t});\n\n\t\t\t\tif (account.source === 'impersonate') {\n\t\t\t\t\tconst executed = yield* lockedSigner.signAndExecute(txBytes).pipe(\n\t\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t\t(cause): ActionError =>\n\t\t\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t\t`Action '${actionName}': account.signAndExecute failed for ` +\n\t\t\t\t\t\t\t\t\t\t`'${account.name}' (address=${account.address}): ${\n\t\t\t\t\t\t\t\t\t\t\tcause instanceof Error ? cause.message : String(cause)\n\t\t\t\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t\treturn receiptFromAccountTx(executed);\n\t\t\t\t}\n\n\t\t\t\t// --- 3. Sign with the account -------------------------------\n\t\t\t\tconst signed = yield* lockedSigner.signTransaction(txBytes).pipe(\n\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t(cause): ActionError =>\n\t\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t`Action '${actionName}': account.signTransaction failed for ` +\n\t\t\t\t\t\t\t\t\t`'${account.name}' (address=${account.address}): ${\n\t\t\t\t\t\t\t\t\t\tcause instanceof Error ? cause.message : String(cause)\n\t\t\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\t// --- 4. Execute via the SDK (with effects+objectTypes) ------\n\t\t\t\tconst sdkClient = sui.sdk.client as SdkExecuteClient;\n\t\t\t\tconst raw = yield* Effect.tryPromise({\n\t\t\t\t\ttry: () =>\n\t\t\t\t\t\tsdkClient.executeTransaction({\n\t\t\t\t\t\t\ttransaction: txBytes,\n\t\t\t\t\t\t\tsignatures: [signed.signature],\n\t\t\t\t\t\t\tinclude: { effects: true, objectTypes: true },\n\t\t\t\t\t\t}),\n\t\t\t\t\tcatch: (cause): ActionError =>\n\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`Action '${actionName}': executeTransaction failed — ` +\n\t\t\t\t\t\t\t\t(cause instanceof Error ? cause.message : String(cause)),\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t}),\n\t\t\t\t});\n\n\t\t\t\t// --- 5. Project the envelope --------------------------------\n\t\t\t\tconst env = raw as RawExecuteEnvelope;\n\t\t\t\tif (env.$kind === 'FailedTransaction') {\n\t\t\t\t\tconst failedDigest = env.FailedTransaction?.digest;\n\t\t\t\t\tif (failedDigest !== undefined) {\n\t\t\t\t\t\tyield* Effect.tryPromise({\n\t\t\t\t\t\t\ttry: () => sdkClient.waitForTransaction({ digest: failedDigest }),\n\t\t\t\t\t\t\tcatch: (cause): ActionError =>\n\t\t\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\t\t\tmessage: `Action '${actionName}': waitForTransaction(${failedDigest}) failed.`,\n\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`Action '${actionName}': FailedTransaction ` +\n\t\t\t\t\t\t\t\t`(digest=${env.FailedTransaction?.digest ?? '<unknown>'}): ` +\n\t\t\t\t\t\t\t\t`${env.FailedTransaction?.status?.error ?? '<no error>'}`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst txOk = env.Transaction;\n\t\t\t\tif (txOk?.digest === undefined) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tactionError('parse', {\n\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\tmessage: `Action '${actionName}': executeTransaction returned no digest.`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// --- 6. Wait for finality -----------------------------------\n\t\t\t\tyield* Effect.tryPromise({\n\t\t\t\t\ttry: () => sdkClient.waitForTransaction({ digest: txOk.digest! }),\n\t\t\t\t\tcatch: (cause): ActionError =>\n\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\tmessage: `Action '${actionName}': waitForTransaction(${txOk.digest}) failed.`,\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t}),\n\t\t\t\t});\n\n\t\t\t\t// --- 7. Project changedObjects into the receipt's objectChanges\n\t\t\t\tconst objectTypes = txOk.objectTypes ?? {};\n\t\t\t\tconst objectChanges: ReadonlyArray<ActionObjectChange> = (\n\t\t\t\t\ttxOk.effects?.changedObjects ?? []\n\t\t\t\t)\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t(c): c is { objectId: string; outputState?: string; idOperation?: string } =>\n\t\t\t\t\t\t\ttypeof c.objectId === 'string',\n\t\t\t\t\t)\n\t\t\t\t\t.map((c) => {\n\t\t\t\t\t\tconst objectType = objectTypes[c.objectId];\n\t\t\t\t\t\tconst entry: {\n\t\t\t\t\t\t\t-readonly [K in keyof ActionObjectChange]: ActionObjectChange[K];\n\t\t\t\t\t\t} = {\n\t\t\t\t\t\t\tkind: c.idOperation === 'Created' ? 'created' : 'mutated',\n\t\t\t\t\t\t\tobjectId: c.objectId,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (objectType !== undefined) entry.objectType = objectType;\n\t\t\t\t\t\tif (c.outputState !== undefined) entry.outputState = c.outputState;\n\t\t\t\t\t\tif (c.idOperation !== undefined) entry.idOperation = c.idOperation;\n\t\t\t\t\t\treturn entry;\n\t\t\t\t\t});\n\n\t\t\t\tconst receipt: ActionReceipt = {\n\t\t\t\t\tdigest: txOk.digest,\n\t\t\t\t\tobjectChanges,\n\t\t\t\t\tbalanceChanges: [],\n\t\t\t\t};\n\t\t\t\treturn receipt;\n\t\t\t}),\n\t\t);\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.action.signAndExecute', {\n\t\t\tattributes: { 'action.name': params.actionName },\n\t\t}),\n\t);\n"],"mappings":";;;;;AA0GA,MAAM,+BACL,YAEA,QACE,QAEC,WASA,OAAO,WAAW,YAClB,WAAW,QACX,OAAQ,OAA2C,aAAa,SACjE,CACA,KAAK,WAAW;CAChB,MAAM,QAEF;EACH,MAAM,OAAO,SAAS,aAAa,OAAO,SAAS,YAAY,YAAY;EAC3E,UAAU,OAAO;EACjB;AACD,KAAI,OAAO,OAAO,eAAe,SAAU,OAAM,aAAa,OAAO;AACrE,KAAI,OAAO,OAAO,gBAAgB,SAAU,OAAM,cAAc,OAAO;AACvE,KAAI,OAAO,OAAO,gBAAgB,SAAU,OAAM,cAAc,OAAO;AACvE,QAAO;EACN;AAEJ,MAAM,wBAAwB,QAAiC;CAC9D,QAAQ,GAAG;CACX,eAAe,4BAA4B,GAAG,cAAc;CAC5D,gBAAgB,GAAG;CACnB;;;;;;;;;;;;;;;;;;;;;;;;AA6BD,MAAa,kBAAkB,WAM9B,OAAO,IAAI,aAAa;CACvB,MAAM,EAAE,YAAY,KAAK,SAAS,UAAU;AAC5C,QAAO,OAAO,QAAQ,uBAAuB,iBAC5C,OAAO,IAAI,aAAa;EAEvB,MAAM,KAAK,IAAI,aAAa;AAC5B,KAAG,UAAU,QAAQ,QAAQ;AAC7B,SAAO,OAAO,IAAI;GACjB,WAAW,MAAM,GAAG;GACpB,QAAQ,UACP,YAAY,QAAQ;IACnB;IACA,SAAS,WAAW,WAAW;IAC/B;IACA,CAAC;GACH,CAAC;EAGF,MAAM,UACL,QAAQ,WAAW,gBAChB,OAAO,uCAAuC,IAAI,QAAQ,SAAS,IAAI,IAAI,KAAK,CAAC,KACjF,OAAO,UACL,UACA,YAAY,QAAQ;GACnB;GACA,SAAS,WAAW,WAAW,mDAAmD,MAAM,QAAQ;GAChG;GACA,CAAC,CACH,CACD,GACA,OAAO,OAAO,WAAW;GACzB,WACC,GAAG,MAAM,EACR,QAAQ,IAAI,IAAI,QAKhB,CAAC;GACH,QAAQ,UACP,YAAY,QAAQ;IACnB;IACA,SAAS,WAAW,WAAW,gCAC9B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CACtD;IACD;IACA,CAAC;GACH,CAAC;AAEL,MAAI,QAAQ,WAAW,cAetB,QAAO,qBAAqB,OAdJ,aAAa,eAAe,QAAQ,CAAC,KAC5D,OAAO,UACL,UACA,YAAY,QAAQ;GACnB;GACA,SACC,WAAW,WAAW,wCAClB,QAAQ,KAAK,aAAa,QAAQ,QAAQ,KAC7C,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;GAExD;GACA,CAAC,CACH,CACD,CACoC;EAItC,MAAM,SAAS,OAAO,aAAa,gBAAgB,QAAQ,CAAC,KAC3D,OAAO,UACL,UACA,YAAY,QAAQ;GACnB;GACA,SACC,WAAW,WAAW,yCAClB,QAAQ,KAAK,aAAa,QAAQ,QAAQ,KAC7C,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;GAExD;GACA,CAAC,CACH,CACD;EAGD,MAAM,YAAY,IAAI,IAAI;EAmB1B,MAAM,MAAM,OAlBO,OAAO,WAAW;GACpC,WACC,UAAU,mBAAmB;IAC5B,aAAa;IACb,YAAY,CAAC,OAAO,UAAU;IAC9B,SAAS;KAAE,SAAS;KAAM,aAAa;KAAM;IAC7C,CAAC;GACH,QAAQ,UACP,YAAY,QAAQ;IACnB;IACA,SACC,WAAW,WAAW,oCACrB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;IACxD;IACA,CAAC;GACH,CAAC;AAIF,MAAI,IAAI,UAAU,qBAAqB;GACtC,MAAM,eAAe,IAAI,mBAAmB;AAC5C,OAAI,iBAAiB,KAAA,EACpB,QAAO,OAAO,WAAW;IACxB,WAAW,UAAU,mBAAmB,EAAE,QAAQ,cAAc,CAAC;IACjE,QAAQ,UACP,YAAY,QAAQ;KACnB;KACA,SAAS,WAAW,WAAW,wBAAwB,aAAa;KACpE;KACA,CAAC;IACH,CAAC;AAEH,UAAO,OAAO,OAAO,KACpB,YAAY,QAAQ;IACnB;IACA,SACC,WAAW,WAAW,+BACX,IAAI,mBAAmB,UAAU,YAAY,KACrD,IAAI,mBAAmB,QAAQ,SAAS;IAC5C,CAAC,CACF;;EAEF,MAAM,OAAO,IAAI;AACjB,MAAI,MAAM,WAAW,KAAA,EACpB,QAAO,OAAO,OAAO,KACpB,YAAY,SAAS;GACpB;GACA,SAAS,WAAW,WAAW;GAC/B,CAAC,CACF;AAIF,SAAO,OAAO,WAAW;GACxB,WAAW,UAAU,mBAAmB,EAAE,QAAQ,KAAK,QAAS,CAAC;GACjE,QAAQ,UACP,YAAY,QAAQ;IACnB;IACA,SAAS,WAAW,WAAW,wBAAwB,KAAK,OAAO;IACnE;IACA,CAAC;GACH,CAAC;EAGF,MAAM,cAAc,KAAK,eAAe,EAAE;EAC1C,MAAM,iBACL,KAAK,SAAS,kBAAkB,EAAE,EAEjC,QACC,MACA,OAAO,EAAE,aAAa,SACvB,CACA,KAAK,MAAM;GACX,MAAM,aAAa,YAAY,EAAE;GACjC,MAAM,QAEF;IACH,MAAM,EAAE,gBAAgB,YAAY,YAAY;IAChD,UAAU,EAAE;IACZ;AACD,OAAI,eAAe,KAAA,EAAW,OAAM,aAAa;AACjD,OAAI,EAAE,gBAAgB,KAAA,EAAW,OAAM,cAAc,EAAE;AACvD,OAAI,EAAE,gBAAgB,KAAA,EAAW,OAAM,cAAc,EAAE;AACvD,UAAO;IACN;AAOH,SAAO;GAJN,QAAQ,KAAK;GACb;GACA,gBAAgB,EAAE;GAEL;GACb,CACF;EACA,CAAC,KACF,OAAO,SAAS,yCAAyC,EACxD,YAAY,EAAE,eAAe,OAAO,YAAY,EAChD,CAAC,CACF"}
|
|
1
|
+
{"version":3,"file":"execute.mjs","names":[],"sources":["../../../src/plugins/action/execute.ts"],"sourcesContent":["// Action plugin — `signAndExecute` helper.\n//\n// Delegates the full build → sign → execute → wait → project pipeline\n// to the Account plugin's `withTransactionSigner` scope. The action\n// body never sees the SDK envelope; instead it receives the Account's\n// already-projected `TxResult`, which this module re-projects into the\n// action's `ActionReceipt` shape (bucketed `created`/`mutated` instead\n// of the account-flat `objectChanges`).\n//\n// Before the dedup, this module reimplemented the entire SDK roundtrip\n// (`executeTransaction`, `$kind`/`FailedTransaction`/no-digest envelope\n// projection, `waitForTransaction` finality wait). The same logic lived\n// in `account/service.ts:666-704` and `package/publish-executor.ts`, with\n// three near-identical SDK envelope projectors. Backlog item #29 lifts\n// the action path; the remaining package projector is tracked there too.\n//\n// Boundary discipline: this module imports the Account plugin's\n// `AccountValue` + `TxResult` (peer L4 contract) and a `SuiClient`\n// shim (peer L4 contract). It does not import `@mysten/sui/client` or\n// reach into the SDK envelope — those concerns live in\n// `account/service.ts`'s `projectTxResult`.\n\nimport { Effect, type Scope } from 'effect';\n\nimport { Transaction } from '@mysten/sui/transactions';\n\nimport type { AccountSignError, AccountValue, TxResult } from '../account/index.ts';\nimport { buildForkImpersonationTransactionBytes, type SuiClient } from '../sui/index.ts';\nimport { formatUnknownError } from '../../substrate/runtime/format-unknown-error.ts';\nimport { formatExecutedFailure } from '../../substrate/runtime/sui-execute/index.ts';\nimport { signAndDispatch } from '../../substrate/runtime/sui-execute/sign-and-dispatch.ts';\n\nimport { actionError, type ActionError } from './errors.ts';\nimport type { ActionReceipt } from './service.ts';\nimport { ActionSpans } from './spans.ts';\n\n// ---------------------------------------------------------------------------\n// Receipt object-change projection\n// ---------------------------------------------------------------------------\n\n/** Flat object-change record surfaced on an `ActionReceipt`. Mirrors\n * the package plugin's `PublishObjectChange` shape so consumers can\n * reuse `findCreatedByType`-style helpers across the two surfaces.\n *\n * - `kind`: 'created' when `idOperation === 'Created'`, else 'mutated'\n * (we expose the same two buckets the package plugin uses; finer\n * distinctions are recoverable from the raw `idOperation` /\n * `outputState` fields preserved alongside).\n * - `objectType`: optional fully-qualified type string\n * (`<packageId>::<module>::<Name>`) — present when the SDK's\n * `objectTypes` map carries the id. */\nexport interface ActionObjectChange {\n\treadonly kind: 'created' | 'mutated';\n\treadonly objectId: string;\n\treadonly objectType?: string;\n\treadonly outputState?: string;\n\treadonly idOperation?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Account TxResult → ActionReceipt projection\n// ---------------------------------------------------------------------------\n\n/**\n * Re-bucket the account's flat `objectChanges` into action-flavored\n * `created` / `mutated` rows. The account plugin's projection emits\n * `{type, objectId, objectType?, outputState?, idOperation?}`; we\n * carry through the optional fields and discriminate on `type` /\n * `kind` so a downstream `findCreatedByType` consumer keeps working.\n */\nconst projectAccountObjectChanges = (\n\tchanges: ReadonlyArray<unknown>,\n): ReadonlyArray<ActionObjectChange> =>\n\tchanges\n\t\t.filter(\n\t\t\t(\n\t\t\t\tchange,\n\t\t\t): change is {\n\t\t\t\treadonly type?: string;\n\t\t\t\treadonly kind?: string;\n\t\t\t\treadonly objectId: string;\n\t\t\t\treadonly objectType?: string;\n\t\t\t\treadonly outputState?: string;\n\t\t\t\treadonly idOperation?: string;\n\t\t\t} =>\n\t\t\t\ttypeof change === 'object' &&\n\t\t\t\tchange !== null &&\n\t\t\t\ttypeof (change as { readonly objectId?: unknown }).objectId === 'string',\n\t\t)\n\t\t.map((change) => {\n\t\t\tconst entry: {\n\t\t\t\t-readonly [K in keyof ActionObjectChange]: ActionObjectChange[K];\n\t\t\t} = {\n\t\t\t\tkind: change.type === 'created' || change.kind === 'created' ? 'created' : 'mutated',\n\t\t\t\tobjectId: change.objectId,\n\t\t\t};\n\t\t\tif (typeof change.objectType === 'string') entry.objectType = change.objectType;\n\t\t\tif (typeof change.outputState === 'string') entry.outputState = change.outputState;\n\t\t\tif (typeof change.idOperation === 'string') entry.idOperation = change.idOperation;\n\t\t\treturn entry;\n\t\t});\n\nconst receiptFromTxResult = (tx: TxResult): ActionReceipt => ({\n\tdigest: tx.digest,\n\tobjectChanges: projectAccountObjectChanges(tx.objectChanges),\n\tbalanceChanges: tx.balanceChanges,\n});\n\n// ---------------------------------------------------------------------------\n// AccountSignError → ActionError mapping\n// ---------------------------------------------------------------------------\n\n/**\n * Map an `AccountSignError` onto the action's `'sign'` phase. The\n * account's `signAndExecute` returns a discriminated `SignAndExecuteResult`\n * for the on-chain outcome (success vs FailedTransaction); only\n * transport / lifecycle failures surface here.\n */\nconst accountSignErrorToActionError =\n\t(actionName: string) =>\n\t(cause: AccountSignError): ActionError =>\n\t\tactionError('sign', {\n\t\t\tactionName,\n\t\t\tmessage:\n\t\t\t\t`Action '${actionName}': account sign/execute failed for ` +\n\t\t\t\t`'${cause.accountName}' (address=${cause.address}): ${cause.message}`,\n\t\t\tcause,\n\t\t});\n\n// ---------------------------------------------------------------------------\n// `signAndExecute` helper\n// ---------------------------------------------------------------------------\n\n/** Drive the full build → sign → execute → wait → project pipeline by\n * delegating to the account's `withTransactionSigner` /\n * `signAndExecute` surface, then re-projecting the returned\n * `TxResult` into the action's `ActionReceipt` shape.\n *\n * Allocates a fresh `Transaction`, sets the sender to the account's\n * address, lets the caller populate it via the `build` callback,\n * serialises via `Transaction.build({ client })` (or the fork-mode\n * builder for impersonation accounts), then hands the bytes to the\n * account's locked-signer scope. The account plugin owns sign,\n * execute, finality wait, and envelope projection.\n *\n * All failures surface as `ActionError`:\n * - `build` callback throws → `phase: 'sign'`.\n * - `Transaction.build` rejects → `phase: 'sign'`.\n * - `account.signAndExecute` rejects with `AccountSignError` → mapped\n * to `phase: 'sign'`. The Account plugin's `'no-digest'` phase\n * (SDK envelope protocol violation) flows through here as well —\n * the originating `AccountSignError` is preserved via `cause` so\n * the cause walker renders the underlying `phase: 'no-digest'`.\n *\n * The `actionName` parameter threads into every error's `actionName`\n * field so cause-walker output stays attributable.\n */\nexport const signAndExecute = (params: {\n\treadonly actionName: string;\n\treadonly sui: SuiClient;\n\treadonly account: AccountValue;\n\treadonly build: (tx: Transaction) => void;\n}): Effect.Effect<ActionReceipt, ActionError, Scope.Scope> => {\n\tconst { actionName, sui, account, build } = params;\n\tconst mapAccountErr = accountSignErrorToActionError(actionName);\n\t// Delegate the build → sign → execute → dispatch pipeline to the\n\t// shared `signAndDispatch` helper. The build closure handles both\n\t// the user callback (`build(tx)`) and mode-appropriate serialization\n\t// (fork impersonation vs SDK-resolver). On-chain failures surface\n\t// as `phase: 'execute-failed'` so cause-walker renders them distinctly\n\t// from transport-level signing failures (`phase: 'sign'`).\n\treturn signAndDispatch({\n\t\tsignerSource: account,\n\t\tbuildTxBytes: () =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\t// --- 1. Allocate + populate the Transaction ------------------\n\t\t\t\tconst tx = new Transaction();\n\t\t\t\ttx.setSender(account.address);\n\t\t\t\tyield* Effect.try({\n\t\t\t\t\ttry: () => build(tx),\n\t\t\t\t\tcatch: (cause): ActionError =>\n\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\tmessage: `Action '${actionName}': build callback threw before serialisation.`,\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t}),\n\t\t\t\t});\n\n\t\t\t\t// --- 2. Serialise via the mode-appropriate path --------------\n\t\t\t\t// Fork mode (impersonate OR real signer) must build offline with\n\t\t\t\t// explicit gas: the sui-fork binary has no simulate_transaction,\n\t\t\t\t// so the SDK's gas-estimating `tx.build({ client })` fails. The\n\t\t\t\t// real-vs-empty-signature split happens later in signAndExecute.\n\t\t\t\treturn account.source === 'impersonate' || sui.fork !== null\n\t\t\t\t\t? yield* buildForkImpersonationTransactionBytes(tx, account.address, sui.sdk.core).pipe(\n\t\t\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t\t\t(cause): ActionError =>\n\t\t\t\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\t\t\t\tmessage: `Action '${actionName}': fork Transaction.build failed — ${cause.message}.`,\n\t\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t\t: yield* Effect.tryPromise({\n\t\t\t\t\t\t\ttry: () => tx.build({ client: sui.sdk.client }),\n\t\t\t\t\t\t\tcatch: (cause): ActionError =>\n\t\t\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\t\t\tmessage: `Action '${actionName}': Transaction.build failed — ${\n\t\t\t\t\t\t\t\t\t\tformatUnknownError(cause)\n\t\t\t\t\t\t\t\t\t}.`,\n\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\t\t\t}),\n\t\tmapSignError: mapAccountErr,\n\t\tonFailed: (failure) =>\n\t\t\tEffect.fail(\n\t\t\t\tactionError('execute-failed', {\n\t\t\t\t\tactionName,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Action '${actionName}': transaction execution failed on-chain ` +\n\t\t\t\t\t\t`for account '${account.name}' (address=${account.address}) ` +\n\t\t\t\t\t\tformatExecutedFailure(failure),\n\t\t\t\t}),\n\t\t\t),\n\t\tonSuccess: (txResult) => Effect.succeed(receiptFromTxResult(txResult)),\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.action.signAndExecute', {\n\t\t\tattributes: { [ActionSpans.name]: actionName },\n\t\t}),\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAsEA,MAAM,+BACL,YAEA,QACE,QAEC,WASA,OAAO,WAAW,YAClB,WAAW,QACX,OAAQ,OAA2C,aAAa,SACjE,CACA,KAAK,WAAW;CAChB,MAAM,QAEF;EACH,MAAM,OAAO,SAAS,aAAa,OAAO,SAAS,YAAY,YAAY;EAC3E,UAAU,OAAO;EACjB;AACD,KAAI,OAAO,OAAO,eAAe,SAAU,OAAM,aAAa,OAAO;AACrE,KAAI,OAAO,OAAO,gBAAgB,SAAU,OAAM,cAAc,OAAO;AACvE,KAAI,OAAO,OAAO,gBAAgB,SAAU,OAAM,cAAc,OAAO;AACvE,QAAO;EACN;AAEJ,MAAM,uBAAuB,QAAiC;CAC7D,QAAQ,GAAG;CACX,eAAe,4BAA4B,GAAG,cAAc;CAC5D,gBAAgB,GAAG;CACnB;;;;;;;AAYD,MAAM,iCACJ,gBACA,UACA,YAAY,QAAQ;CACnB;CACA,SACC,WAAW,WAAW,sCAClB,MAAM,YAAY,aAAa,MAAM,QAAQ,KAAK,MAAM;CAC7D;CACA,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AA8BJ,MAAa,kBAAkB,WAK+B;CAC7D,MAAM,EAAE,YAAY,KAAK,SAAS,UAAU;AAQ5C,QAAO,gBAAgB;EACtB,cAAc;EACd,oBACC,OAAO,IAAI,aAAa;GAEvB,MAAM,KAAK,IAAI,aAAa;AAC5B,MAAG,UAAU,QAAQ,QAAQ;AAC7B,UAAO,OAAO,IAAI;IACjB,WAAW,MAAM,GAAG;IACpB,QAAQ,UACP,YAAY,QAAQ;KACnB;KACA,SAAS,WAAW,WAAW;KAC/B;KACA,CAAC;IACH,CAAC;AAOF,UAAO,QAAQ,WAAW,iBAAiB,IAAI,SAAS,OACrD,OAAO,uCAAuC,IAAI,QAAQ,SAAS,IAAI,IAAI,KAAK,CAAC,KACjF,OAAO,UACL,UACA,YAAY,QAAQ;IACnB;IACA,SAAS,WAAW,WAAW,qCAAqC,MAAM,QAAQ;IAClF;IACA,CAAC,CACH,CACD,GACA,OAAO,OAAO,WAAW;IACzB,WAAW,GAAG,MAAM,EAAE,QAAQ,IAAI,IAAI,QAAQ,CAAC;IAC/C,QAAQ,UACP,YAAY,QAAQ;KACnB;KACA,SAAS,WAAW,WAAW,gCAC9B,mBAAmB,MAAM,CACzB;KACD;KACA,CAAC;IACH,CAAC;IACH;EACH,cApDqB,8BAA8B,WAoDxB;EAC3B,WAAW,YACV,OAAO,KACN,YAAY,kBAAkB;GAC7B;GACA,SACC,WAAW,WAAW,wDACN,QAAQ,KAAK,aAAa,QAAQ,QAAQ,MAC1D,sBAAsB,QAAQ;GAC/B,CAAC,CACF;EACF,YAAY,aAAa,OAAO,QAAQ,oBAAoB,SAAS,CAAC;EACtE,CAAC,CAAC,KACF,OAAO,SAAS,yCAAyC,EACxD,YAAY,GAAG,YAAY,OAAO,YAAY,EAC9C,CAAC,CACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AnyResourceRef, DependencyInput, DependencyList, Plugin, ResolvedDependencies, ResourceRef } from "../../substrate/plugin.mjs";
|
|
2
|
-
import { SeedObjectsAccumulator } from "../sui/seed-objects.mjs";
|
|
3
2
|
import { SuiClient } from "../sui/mode/shared.mjs";
|
|
4
3
|
import { SuiOptions } from "../sui/mode/spec.mjs";
|
|
5
4
|
import { ActionError, ActionPhase } from "./errors.mjs";
|
|
@@ -49,7 +48,6 @@ interface ActionOptions<DependsOn extends ActionDependencySpec> {
|
|
|
49
48
|
*/
|
|
50
49
|
declare const action: <const Name extends string, const DependsOn extends ActionDependencySpec>(name: Name, opts: ActionOptions<DependsOn>) => Plugin<`action:${Name}`, ActionReceipt, readonly [ResourceRef<"sui", SuiClient & {
|
|
51
50
|
readonly mode: SuiOptions["mode"];
|
|
52
|
-
readonly seedObjects: SeedObjectsAccumulator;
|
|
53
51
|
}>, ...DependencyList<DependsOn>], readonly []>;
|
|
54
52
|
//#endregion
|
|
55
53
|
export { ActionOptions, ActionUpstreamRef, action };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { definePlugin, dependencyList, resolveDependencyValues, resource } from "../../substrate/plugin.mjs";
|
|
2
|
-
import
|
|
3
|
-
import { suiResource } from "../sui/index.mjs";
|
|
2
|
+
import "../../api/define-plugin.mjs";
|
|
4
3
|
import { ArtifactPublisherService } from "../../substrate/runtime/artifact-publisher/index.mjs";
|
|
5
4
|
import { chainProbeFor } from "../../substrate/runtime/strategy-registry/chain-probe-for.mjs";
|
|
5
|
+
import "../../substrate/runtime/strategy-registry/index.mjs";
|
|
6
|
+
import { pluginErrorContributions } from "../../api/plugin-errors.mjs";
|
|
7
|
+
import { suiResource } from "../sui/index.mjs";
|
|
6
8
|
import { ACTION_ERROR_TAGS, actionError } from "./errors.mjs";
|
|
9
|
+
import "./spans.mjs";
|
|
7
10
|
import { signAndExecute } from "./execute.mjs";
|
|
8
11
|
import { bootActionService, resolveDiscriminator } from "./service.mjs";
|
|
9
12
|
import { Effect } from "effect";
|
|
@@ -34,13 +37,15 @@ const action = (name, opts) => {
|
|
|
34
37
|
id: actionRef.id,
|
|
35
38
|
dependsOn: dependencies,
|
|
36
39
|
role: "task",
|
|
40
|
+
section: "action",
|
|
37
41
|
start: (deps) => Effect.gen(function* () {
|
|
38
42
|
const [sui, ...resolvedUpstream] = deps;
|
|
39
43
|
const resolvedByResourceId = new Map(upstreamRefs.map((ref, index) => [ref.id, resolvedUpstream[index]]));
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
+
for (const ref of upstreamRefs) if (!resolvedByResourceId.has(ref.id)) return yield* Effect.fail(actionError("build", {
|
|
45
|
+
actionName: name,
|
|
46
|
+
message: `Action '${name}': dependency '${ref.id}' was not resolved.`
|
|
47
|
+
}));
|
|
48
|
+
const readDeclaredDependency = (id) => resolvedByResourceId.get(id);
|
|
44
49
|
const publisher = yield* ArtifactPublisherService;
|
|
45
50
|
const probe = yield* chainProbeFor(sui.chain);
|
|
46
51
|
const bodyCtx = {
|
|
@@ -60,16 +65,15 @@ const action = (name, opts) => {
|
|
|
60
65
|
actionName: name,
|
|
61
66
|
dependencyResourceIds
|
|
62
67
|
},
|
|
63
|
-
dynamicMaterial: resolveDiscriminator(
|
|
68
|
+
dynamicMaterial: resolveDiscriminator(opts.discriminator, bodyCtx, bodyDeps),
|
|
64
69
|
body: opts.body(bodyCtx, bodyDeps)
|
|
65
|
-
}).pipe(Effect.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return Effect.fail(actionError("sign", {
|
|
70
|
+
}).pipe(Effect.catchTags({
|
|
71
|
+
ActionError: (err) => Effect.fail(err),
|
|
72
|
+
ArtifactPublishError: (err) => Effect.fail(actionError("verify", {
|
|
69
73
|
actionName: name,
|
|
70
|
-
message: detail,
|
|
74
|
+
message: err.detail,
|
|
71
75
|
cause: err
|
|
72
|
-
}))
|
|
76
|
+
}))
|
|
73
77
|
}));
|
|
74
78
|
}),
|
|
75
79
|
capabilities: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["signAndExecuteImpl"],"sources":["../../../src/plugins/action/index.ts"],"sourcesContent":["// Action plugin — barrel + `action(name, opts)` factory.\n//\n// Architecture (16-action.md): an action is a ONE-SHOT on-chain effect\n// (mint, create-singleton-object, seed-config, etc.) that runs after\n// its declared upstream refs (typically a signer account + one or more\n// published packages) are ready. The result (digest + change arrays)\n// is yieldable through the action resource.\n//\n// User-facing factory shape (recommended high-level form):\n//\n// const openLobby = action('connect-four.openLobby', {\n// dependsOn: { signer: alice, pkg: connectFour },\n// body: (ctx, { signer, pkg }) =>\n// ctx.signAndExecute(signer, (tx) => {\n// tx.moveCall({ target: `${pkg.packageId}::game::create_lobby` });\n// }),\n// });\n//\n// The `ctx.signAndExecute(account, build)` helper folds the full\n// build → sign → execute (with `include: {effects, objectTypes}`) →\n// wait-for-finality → envelope-projection pipeline into a single call\n// (see `execute.ts`). The returned `ActionReceipt` carries the real\n// transaction digest and an `objectChanges` array that surfaces the\n// SDK's `changedObjects` (with `kind: 'created' | 'mutated'` + the\n// fully-qualified `objectType` string when available).\n//\n// Resource id: `'action:<name>'` — one tag per user-declared action (the\n// symbolic name is part of the identity so two `action('foo', ...)`\n// calls in one stack collide cleanly at compose time).\n//\n// Caching: delegated to the substrate's `ArtifactPublisher`.\n// Namespace is `action`; the cache key folds chainId + content-hash\n// derived from (name, dependencyResourceIds, dynamic discriminator).\n\nimport { Effect, type Scope } from 'effect';\n\nimport {\n\tdefinePlugin,\n\tdependencyList,\n\tresource,\n\tresolveDependencyValues,\n\ttype AnyResourceRef,\n\ttype DependencyInput,\n\ttype ResolvedDependencies,\n} from '../../api/define-plugin.ts';\nimport { pluginErrorContributions } from '../../api/plugin-errors.ts';\nimport { ArtifactPublisherService } from '../../substrate/runtime/artifact-publisher/index.ts';\nimport { chainProbeFor } from '../../substrate/runtime/strategy-registry/index.ts';\nimport { suiResource } from '../sui/index.ts';\nimport type { SuiProbeKey } from '../sui/chain-probe.ts';\n\nimport type { ActionBuildContext } from './build-context.ts';\nimport { actionError, ACTION_ERROR_TAGS, type ActionError } from './errors.ts';\nimport type { DynamicDiscriminator } from './discriminator.ts';\nimport { signAndExecute as signAndExecuteImpl } from './execute.ts';\nimport {\n\tbootActionService,\n\tresolveDiscriminator,\n\ttype ActionAcquireInputs,\n\ttype ActionReceipt,\n} from './service.ts';\n\nconst actionErrorContributions = pluginErrorContributions(ACTION_ERROR_TAGS);\n\n// ---------------------------------------------------------------------------\n// Resource — one per declared action, keyed by symbolic name\n// ---------------------------------------------------------------------------\n\n/** Resource id constructor. The symbolic action name is part of the tag\n * identity so two `action('foo', ...)` calls in one stack collide\n * cleanly at compose time. */\nexport const actionResourceId = <Name extends string>(name: Name): `action:${Name}` =>\n\t`action:${name}`;\n\nexport type ActionResourceId<Name extends string> = `action:${Name}`;\n\n// ---------------------------------------------------------------------------\n// User-facing factory shape\n// ---------------------------------------------------------------------------\n\n/** A user-supplied upstream resource ref. The user passes plugin values\n * such as `account('alice')` or `localPackage('demo', ...)`; object,\n * tuple, and single-ref shapes are preserved for the action body. */\nexport type ActionUpstreamRef = AnyResourceRef;\n\n/** Options for `action(name, opts)`. */\ntype ActionDependencySpec = DependencyInput;\n\ntype ResolvedActionDependencies<Input extends ActionDependencySpec> = ResolvedDependencies<Input>;\n\nexport interface ActionOptions<DependsOn extends ActionDependencySpec> {\n\t/** Upstream refs the action depends on. The shape determines the\n\t * second argument passed to `body`. */\n\treadonly dependsOn: DependsOn;\n\t/** Optional caller-supplied discriminator material. Two shapes:\n\t * a literal `string`, or a callback `(ctx, deps) => Effect<string>`\n\t * that receives action helpers plus resolved deps shaped like\n\t * `dependsOn`, so the discriminator can derive its value from\n\t * upstream resolved values. See\n\t * `discriminator.ts`. */\n\treadonly discriminator?: DynamicDiscriminator<ResolvedActionDependencies<DependsOn>>;\n\t/** The user's body. Receives action helpers plus resolved deps\n\t * shaped like `dependsOn`, then returns the on-chain effect.\n\t *\n\t * Errors raised here surface as `ActionError({phase:'sign'})`\n\t * unless the body raises an `ActionError` itself (in which case\n\t * it propagates verbatim). */\n\treadonly body: (\n\t\tctx: ActionBuildContext,\n\t\tdeps: ResolvedActionDependencies<DependsOn>,\n\t) => Effect.Effect<ActionReceipt, ActionError, Scope.Scope>;\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\n/** Construct the action plugin instance.\n *\n * The result is a plugin/resource ref that:\n *\n * - publishes an `ActionReceipt`-typed resource identified by\n * `action:<name>`,\n * - `dependsOn:` `[suiResource, ...userDependencies]` (Sui hard upstream for\n * ChainProbe lookup + chainId folding),\n * - `role: 'task'` — Action has no long-lived resources;\n * the substrate's lifecycle wrap surfaces it as \"done\" after\n * `start` resolves.\n */\nexport const action = <const Name extends string, const DependsOn extends ActionDependencySpec>(\n\tname: Name,\n\topts: ActionOptions<DependsOn>,\n) => {\n\tconst actionRef = resource<ActionResourceId<Name>, ActionReceipt>(actionResourceId(name));\n\n\t// Flatten the user-supplied upstream refs for ordering. The start\n\t// body below keeps the original `dependsOn` shape so it can\n\t// reconstruct the user's dependency argument.\n\tconst upstreamRefs = dependencyList(opts.dependsOn);\n\tconst dependencies = [suiResource, ...upstreamRefs] as const;\n\n\t// Static discriminator pieces — known at factory construction\n\t// time. The tag-ids preserve the literal `id` so two actions with\n\t// identical bodies but different upstream packages get different\n\t// cache keys.\n\tconst dependencyResourceIds = upstreamRefs.map(({ id }) => id) as ReadonlyArray<string>;\n\n\treturn definePlugin({\n\t\tid: actionRef.id,\n\t\tdependsOn: dependencies,\n\t\t// Action has no long-lived resources — the body runs once at\n\t\t// acquire and returns; supervisor's lifecycle wrap surfaces\n\t\t// \"done\" after that.\n\t\trole: 'task',\n\t\tstart: (deps) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst [sui, ...resolvedUpstream] = deps;\n\t\t\t\tconst resolvedByResourceId = new Map<string, unknown>(\n\t\t\t\t\tupstreamRefs.map((ref, index) => [ref.id, resolvedUpstream[index]]),\n\t\t\t\t);\n\t\t\t\tconst readDeclaredDependency = (id: string): unknown => {\n\t\t\t\t\tif (!resolvedByResourceId.has(id)) {\n\t\t\t\t\t\tthrow new Error(`Action '${name}': dependency '${id}' was not resolved.`);\n\t\t\t\t\t}\n\t\t\t\t\treturn resolvedByResourceId.get(id);\n\t\t\t\t};\n\n\t\t\t\t// Substrate-context primitives. artifact publisher + strategy registry\n\t\t\t\t// are both provided by the supervisor's pluginContext.\n\t\t\t\tconst publisher = yield* ArtifactPublisherService;\n\t\t\t\tconst probe = yield* chainProbeFor<SuiProbeKey>(sui.chain);\n\n\t\t\t\t// Compose the user's body Effect, closing over the\n\t\t\t\t// action helper context. Resolved upstream values are\n\t\t\t\t// passed separately in the same shape as `dependsOn`.\n\t\t\t\t// - `ctx.sui` — the resolved SuiClient (always set;\n\t\t\t\t// suiResource is the hard upstream).\n\t\t\t\t// - `ctx.signAndExecute(account, build)` — high-level\n\t\t\t\t// helper that drives the full build → sign → execute\n\t\t\t\t// → wait → project pipeline against the supplied\n\t\t\t\t// account, returning a parsed `ActionReceipt`. This\n\t\t\t\t// is what most action bodies want — it folds the\n\t\t\t\t// SDK-boundary cast + `include: {effects, objectTypes}`\n\t\t\t\t// execute + finality wait + envelope projection.\n\t\t\t\tconst bodyCtx: ActionBuildContext = {\n\t\t\t\t\tsui,\n\t\t\t\t\tsignAndExecute: (account, build) =>\n\t\t\t\t\t\tsignAndExecuteImpl({\n\t\t\t\t\t\t\tactionName: name,\n\t\t\t\t\t\t\tsui,\n\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\tbuild,\n\t\t\t\t\t\t}),\n\t\t\t\t};\n\n\t\t\t\tconst bodyDeps = resolveDependencyValues(opts.dependsOn, (member) =>\n\t\t\t\t\treadDeclaredDependency(member.id),\n\t\t\t\t) as ResolvedActionDependencies<DependsOn>;\n\t\t\t\tconst acquireInputs: ActionAcquireInputs = {\n\t\t\t\t\tactionName: name,\n\t\t\t\t\tchainId: sui.chain,\n\t\t\t\t\tstaticDiscriminator: {\n\t\t\t\t\t\tactionName: name,\n\t\t\t\t\t\tdependencyResourceIds,\n\t\t\t\t\t},\n\t\t\t\t\tdynamicMaterial: resolveDiscriminator(name, opts.discriminator, bodyCtx, bodyDeps),\n\t\t\t\t\tbody: opts.body(bodyCtx, bodyDeps),\n\t\t\t\t};\n\n\t\t\t\tconst receipt = yield* bootActionService(publisher, probe, acquireInputs).pipe(\n\t\t\t\t\tEffect.catch((err): Effect.Effect<ActionReceipt, ActionError> => {\n\t\t\t\t\t\t// Re-wrap the ArtifactPublishError into an\n\t\t\t\t\t\t// ActionError so downstream consumers always see\n\t\t\t\t\t\t// the typed `ActionError` shape. The detail\n\t\t\t\t\t\t// already includes the phase + message from the\n\t\t\t\t\t\t// produce-side mapper.\n\t\t\t\t\t\tif ((err as { _tag?: string })._tag === 'ActionError') {\n\t\t\t\t\t\t\treturn Effect.fail(err as ActionError);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst detail =\n\t\t\t\t\t\t\t(err as { detail?: string }).detail ?? `Action '${name}': substrate failure.`;\n\t\t\t\t\t\treturn Effect.fail(\n\t\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\t\tactionName: name,\n\t\t\t\t\t\t\t\tmessage: detail,\n\t\t\t\t\t\t\t\tcause: err,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\treturn receipt;\n\t\t\t}),\n\t\t// No capability decls today. Future surfaces (codegen of\n\t\t// action receipts, manifest extras) land here.\n\t\tcapabilities: [] as const,\n\t\t// Plugin-side error vocabulary. The supervisor's harvest loop\n\t\t// folds this into the substrate's FormatterRegistry; the\n\t\t// cascade formatter then renders `ActionError`-tagged failures\n\t\t// with the action's phase/message header.\n\t\terrorContributions: actionErrorContributions,\n\t});\n};\n\n// ---------------------------------------------------------------------------\n// Re-exports\n// ---------------------------------------------------------------------------\n\nexport type { ActionBuildContext } from './build-context.ts';\nexport type { ActionError, ActionPhase } from './errors.ts';\nexport { ACTION_ERROR_TAGS } from './errors.ts';\nexport type { ActionLifecyclePhase } from './lifecycle.ts';\nexport type { DynamicDiscriminator, StaticDiscriminator } from './discriminator.ts';\nexport type { ActionReceipt } from './service.ts';\nexport { ActionReceiptSchema } from './service.ts';\nexport type { ActionObjectChange } from './execute.ts';\nexport { signAndExecute } from './execute.ts';\n"],"mappings":";;;;;;;;;;AA8DA,MAAM,2BAA2B,yBAAyB,kBAAkB;;;;AAS5E,MAAa,oBAAyC,SACrD,UAAU;;;;;;;;;;;;;AAyDX,MAAa,UACZ,MACA,SACI;CACJ,MAAM,YAAY,SAAgD,iBAAiB,KAAK,CAAC;CAKzF,MAAM,eAAe,eAAe,KAAK,UAAU;CACnD,MAAM,eAAe,CAAC,aAAa,GAAG,aAAa;CAMnD,MAAM,wBAAwB,aAAa,KAAK,EAAE,SAAS,GAAG;AAE9D,QAAO,aAAa;EACnB,IAAI,UAAU;EACd,WAAW;EAIX,MAAM;EACN,QAAQ,SACP,OAAO,IAAI,aAAa;GACvB,MAAM,CAAC,KAAK,GAAG,oBAAoB;GACnC,MAAM,uBAAuB,IAAI,IAChC,aAAa,KAAK,KAAK,UAAU,CAAC,IAAI,IAAI,iBAAiB,OAAO,CAAC,CACnE;GACD,MAAM,0BAA0B,OAAwB;AACvD,QAAI,CAAC,qBAAqB,IAAI,GAAG,CAChC,OAAM,IAAI,MAAM,WAAW,KAAK,iBAAiB,GAAG,qBAAqB;AAE1E,WAAO,qBAAqB,IAAI,GAAG;;GAKpC,MAAM,YAAY,OAAO;GACzB,MAAM,QAAQ,OAAO,cAA2B,IAAI,MAAM;GAc1D,MAAM,UAA8B;IACnC;IACA,iBAAiB,SAAS,UACzBA,eAAmB;KAClB,YAAY;KACZ;KACA;KACA;KACA,CAAC;IACH;GAED,MAAM,WAAW,wBAAwB,KAAK,YAAY,WACzD,uBAAuB,OAAO,GAAG,CACjC;AAiCD,UAAO,OArBgB,kBAAkB,WAAW,OAAO;IAV1D,YAAY;IACZ,SAAS,IAAI;IACb,qBAAqB;KACpB,YAAY;KACZ;KACA;IACD,iBAAiB,qBAAqB,MAAM,KAAK,eAAe,SAAS,SAAS;IAClF,MAAM,KAAK,KAAK,SAAS,SAAS;IAGqC,CAAC,CAAC,KACzE,OAAO,OAAO,QAAmD;AAMhE,QAAK,IAA0B,SAAS,cACvC,QAAO,OAAO,KAAK,IAAmB;IAEvC,MAAM,SACJ,IAA4B,UAAU,WAAW,KAAK;AACxD,WAAO,OAAO,KACb,YAAY,QAAQ;KACnB,YAAY;KACZ,SAAS;KACT,OAAO;KACP,CAAC,CACF;KACA,CACF;IAEA;EAGH,cAAc,EAAE;EAKhB,oBAAoB;EACpB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["signAndExecuteImpl"],"sources":["../../../src/plugins/action/index.ts"],"sourcesContent":["// Action plugin — barrel + `action(name, opts)` factory.\n//\n// Architecture (16-action.md): an action is a ONE-SHOT on-chain effect\n// (mint, create-singleton-object, seed-config, etc.) that runs after\n// its declared upstream refs (typically a signer account + one or more\n// published packages) are ready. The result (digest + change arrays)\n// is yieldable through the action resource.\n//\n// User-facing factory shape (recommended high-level form):\n//\n// const openLobby = action('connect-four.openLobby', {\n// dependsOn: { signer: alice, pkg: connectFour },\n// body: (ctx, { signer, pkg }) =>\n// ctx.signAndExecute(signer, (tx) => {\n// tx.moveCall({ target: `${pkg.packageId}::game::create_lobby` });\n// }),\n// });\n//\n// The `ctx.signAndExecute(account, build)` helper folds the full\n// build → sign → execute (with `include: {effects, objectTypes}`) →\n// wait-for-finality → envelope-projection pipeline into a single call\n// (see `execute.ts`). The returned `ActionReceipt` carries the real\n// transaction digest and an `objectChanges` array that surfaces the\n// SDK's `changedObjects` (with `kind: 'created' | 'mutated'` + the\n// fully-qualified `objectType` string when available).\n//\n// Resource id: `'action:<name>'` — one tag per user-declared action (the\n// symbolic name is part of the identity so two `action('foo', ...)`\n// calls in one stack collide cleanly at compose time).\n//\n// Caching: delegated to the substrate's `ArtifactPublisher`.\n// Namespace is `action`; the cache key folds chainId + content-hash\n// derived from (name, dependencyResourceIds, dynamic discriminator).\n\nimport { Effect, type Scope } from 'effect';\n\nimport {\n\tdefinePlugin,\n\tdependencyList,\n\tresource,\n\tresolveDependencyValues,\n\ttype AnyResourceRef,\n\ttype DependencyInput,\n\ttype ResolvedDependencies,\n} from '../../api/define-plugin.ts';\nimport { pluginErrorContributions } from '../../api/plugin-errors.ts';\nimport { ArtifactPublisherService } from '../../substrate/runtime/artifact-publisher/index.ts';\nimport { chainProbeFor } from '../../substrate/runtime/strategy-registry/index.ts';\nimport { suiResource, type SuiProbeKey } from '../sui/index.ts';\n\nimport type { ActionBuildContext } from './build-context.ts';\nimport { actionError, ACTION_ERROR_TAGS, type ActionError } from './errors.ts';\nimport type { DynamicDiscriminator } from './discriminator.ts';\nimport { signAndExecute as signAndExecuteImpl } from './execute.ts';\nimport {\n\tbootActionService,\n\tresolveDiscriminator,\n\ttype ActionAcquireInputs,\n\ttype ActionReceipt,\n} from './service.ts';\n\nconst actionErrorContributions = pluginErrorContributions(ACTION_ERROR_TAGS);\n\n// ---------------------------------------------------------------------------\n// Resource — one per declared action, keyed by symbolic name\n// ---------------------------------------------------------------------------\n\n/** Resource id constructor. The symbolic action name is part of the tag\n * identity so two `action('foo', ...)` calls in one stack collide\n * cleanly at compose time. */\nexport const actionResourceId = <Name extends string>(name: Name): `action:${Name}` =>\n\t`action:${name}`;\n\nexport type ActionResourceId<Name extends string> = `action:${Name}`;\n\n// ---------------------------------------------------------------------------\n// User-facing factory shape\n// ---------------------------------------------------------------------------\n\n/** A user-supplied upstream resource ref. The user passes plugin values\n * such as `account('alice')` or `localPackage('demo', ...)`; object,\n * tuple, and single-ref shapes are preserved for the action body. */\nexport type ActionUpstreamRef = AnyResourceRef;\n\n/** Options for `action(name, opts)`. */\ntype ActionDependencySpec = DependencyInput;\n\ntype ResolvedActionDependencies<Input extends ActionDependencySpec> = ResolvedDependencies<Input>;\n\nexport interface ActionOptions<DependsOn extends ActionDependencySpec> {\n\t/** Upstream refs the action depends on. The shape determines the\n\t * second argument passed to `body`. */\n\treadonly dependsOn: DependsOn;\n\t/** Optional caller-supplied discriminator material. Two shapes:\n\t * a literal `string`, or a callback `(ctx, deps) => Effect<string>`\n\t * that receives action helpers plus resolved deps shaped like\n\t * `dependsOn`, so the discriminator can derive its value from\n\t * upstream resolved values. See\n\t * `discriminator.ts`. */\n\treadonly discriminator?: DynamicDiscriminator<ResolvedActionDependencies<DependsOn>>;\n\t/** The user's body. Receives action helpers plus resolved deps\n\t * shaped like `dependsOn`, then returns the on-chain effect.\n\t *\n\t * Errors raised here surface as `ActionError({phase:'sign'})`\n\t * unless the body raises an `ActionError` itself (in which case\n\t * it propagates verbatim). */\n\treadonly body: (\n\t\tctx: ActionBuildContext,\n\t\tdeps: ResolvedActionDependencies<DependsOn>,\n\t) => Effect.Effect<ActionReceipt, ActionError, Scope.Scope>;\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\n/** Construct the action plugin instance.\n *\n * The result is a plugin/resource ref that:\n *\n * - publishes an `ActionReceipt`-typed resource identified by\n * `action:<name>`,\n * - `dependsOn:` `[suiResource, ...userDependencies]` (Sui hard upstream for\n * ChainProbe lookup + chainId folding),\n * - `role: 'task'` — Action has no long-lived resources;\n * the substrate's lifecycle wrap surfaces it as \"done\" after\n * `start` resolves.\n */\nexport const action = <const Name extends string, const DependsOn extends ActionDependencySpec>(\n\tname: Name,\n\topts: ActionOptions<DependsOn>,\n) => {\n\tconst actionRef = resource<ActionResourceId<Name>, ActionReceipt>(actionResourceId(name));\n\n\t// Flatten the user-supplied upstream refs for ordering. The start\n\t// body below keeps the original `dependsOn` shape so it can\n\t// reconstruct the user's dependency argument.\n\tconst upstreamRefs = dependencyList(opts.dependsOn);\n\tconst dependencies = [suiResource, ...upstreamRefs] as const;\n\n\t// Static discriminator pieces — known at factory construction\n\t// time. The tag-ids preserve the literal `id` so two actions with\n\t// identical bodies but different upstream packages get different\n\t// cache keys.\n\tconst dependencyResourceIds = upstreamRefs.map(({ id }) => id) as ReadonlyArray<string>;\n\n\treturn definePlugin({\n\t\tid: actionRef.id,\n\t\tdependsOn: dependencies,\n\t\t// Action has no long-lived resources — the body runs once at\n\t\t// acquire and returns; supervisor's lifecycle wrap surfaces\n\t\t// \"done\" after that.\n\t\trole: 'task',\n\t\tsection: 'action',\n\t\tstart: (deps) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst [sui, ...resolvedUpstream] = deps;\n\t\t\t\tconst resolvedByResourceId = new Map<string, unknown>(\n\t\t\t\t\tupstreamRefs.map((ref, index) => [ref.id, resolvedUpstream[index]]),\n\t\t\t\t);\n\n\t\t\t\t// Substrate guarantees `deps` is the resolved positional\n\t\t\t\t// list matching `dependsOn`, so this map is densely\n\t\t\t\t// populated. If the invariant ever breaks (substrate\n\t\t\t\t// bug) we surface a typed ActionError(`build`) BEFORE\n\t\t\t\t// invoking the downstream sync resolver so the cause\n\t\t\t\t// walker attributes the failure to this action rather\n\t\t\t\t// than producing an unattributed defect.\n\t\t\t\tfor (const ref of upstreamRefs) {\n\t\t\t\t\tif (!resolvedByResourceId.has(ref.id)) {\n\t\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\t\tactionError('build', {\n\t\t\t\t\t\t\t\tactionName: name,\n\t\t\t\t\t\t\t\tmessage: `Action '${name}': dependency '${ref.id}' was not resolved.`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst readDeclaredDependency = (id: string): unknown => resolvedByResourceId.get(id);\n\n\t\t\t\t// Substrate-context primitives. artifact publisher + strategy registry\n\t\t\t\t// are both provided by the supervisor's pluginContext.\n\t\t\t\tconst publisher = yield* ArtifactPublisherService;\n\t\t\t\tconst probe = yield* chainProbeFor<SuiProbeKey>(sui.chain);\n\n\t\t\t\t// Compose the user's body Effect, closing over the\n\t\t\t\t// action helper context. Resolved upstream values are\n\t\t\t\t// passed separately in the same shape as `dependsOn`.\n\t\t\t\t// - `ctx.sui` — the resolved SuiClient (always set;\n\t\t\t\t// suiResource is the hard upstream).\n\t\t\t\t// - `ctx.signAndExecute(account, build)` — high-level\n\t\t\t\t// helper that drives the full build → sign → execute\n\t\t\t\t// → wait → project pipeline against the supplied\n\t\t\t\t// account, returning a parsed `ActionReceipt`. This\n\t\t\t\t// is what most action bodies want — it folds the\n\t\t\t\t// SDK-boundary cast + `include: {effects, objectTypes}`\n\t\t\t\t// execute + finality wait + envelope projection.\n\t\t\t\tconst bodyCtx: ActionBuildContext = {\n\t\t\t\t\tsui,\n\t\t\t\t\tsignAndExecute: (account, build) =>\n\t\t\t\t\t\tsignAndExecuteImpl({\n\t\t\t\t\t\t\tactionName: name,\n\t\t\t\t\t\t\tsui,\n\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\tbuild,\n\t\t\t\t\t\t}),\n\t\t\t\t};\n\n\t\t\t\tconst bodyDeps = resolveDependencyValues(opts.dependsOn, (member) =>\n\t\t\t\t\treadDeclaredDependency(member.id),\n\t\t\t\t) as ResolvedActionDependencies<DependsOn>;\n\t\t\t\tconst acquireInputs: ActionAcquireInputs = {\n\t\t\t\t\tactionName: name,\n\t\t\t\t\tchainId: sui.chain,\n\t\t\t\t\tstaticDiscriminator: {\n\t\t\t\t\t\tactionName: name,\n\t\t\t\t\t\tdependencyResourceIds,\n\t\t\t\t\t},\n\t\t\t\t\tdynamicMaterial: resolveDiscriminator(opts.discriminator, bodyCtx, bodyDeps),\n\t\t\t\t\tbody: opts.body(bodyCtx, bodyDeps),\n\t\t\t\t};\n\n\t\t\t\tconst receipt = yield* bootActionService(publisher, probe, acquireInputs).pipe(\n\t\t\t\t\t// `catchTags` narrows on the `_tag` discriminant so each\n\t\t\t\t\t// branch's handler sees the typed shape directly.\n\t\t\t\t\t//\n\t\t\t\t\t// The produce-side body in `service.ts` recovers any\n\t\t\t\t\t// stashed ActionError before the substrate's\n\t\t\t\t\t// mapError wrap, so an ArtifactPublishError reaching\n\t\t\t\t\t// here is always a substrate-side failure (cache\n\t\t\t\t\t// decode failure, verify exhausted). Surface those as\n\t\t\t\t\t// `phase: 'verify'` — they happen during the cache\n\t\t\t\t\t// verify cycle, not at sign-time.\n\t\t\t\t\tEffect.catchTags({\n\t\t\t\t\t\tActionError: (err) => Effect.fail(err),\n\t\t\t\t\t\tArtifactPublishError: (err) =>\n\t\t\t\t\t\t\tEffect.fail(\n\t\t\t\t\t\t\t\tactionError('verify', {\n\t\t\t\t\t\t\t\t\tactionName: name,\n\t\t\t\t\t\t\t\t\tmessage: err.detail,\n\t\t\t\t\t\t\t\t\tcause: err,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\treturn receipt;\n\t\t\t}),\n\t\t// No capability decls today. Future surfaces (codegen of\n\t\t// action receipts, manifest extras) land here.\n\t\tcapabilities: [] as const,\n\t\t// Plugin-side error vocabulary. The supervisor's harvest loop\n\t\t// folds this into the substrate's FormatterRegistry; the\n\t\t// cascade formatter then renders `ActionError`-tagged failures\n\t\t// with the action's phase/message header.\n\t\terrorContributions: actionErrorContributions,\n\t});\n};\n\n// ---------------------------------------------------------------------------\n// Re-exports\n// ---------------------------------------------------------------------------\n\nexport type { ActionBuildContext } from './build-context.ts';\nexport type { ActionError, ActionPhase } from './errors.ts';\nexport { ACTION_ERROR_TAGS } from './errors.ts';\nexport type { DynamicDiscriminator, StaticDiscriminator } from './discriminator.ts';\nexport type { ActionReceipt } from './service.ts';\nexport { ActionReceiptSchema } from './service.ts';\nexport type { ActionObjectChange } from './execute.ts';\nexport { signAndExecute } from './execute.ts';\n\nexport { ActionSpans } from './spans.ts';\n"],"mappings":";;;;;;;;;;;;;AA6DA,MAAM,2BAA2B,yBAAyB,kBAAkB;;;;AAS5E,MAAa,oBAAyC,SACrD,UAAU;;;;;;;;;;;;;AAyDX,MAAa,UACZ,MACA,SACI;CACJ,MAAM,YAAY,SAAgD,iBAAiB,KAAK,CAAC;CAKzF,MAAM,eAAe,eAAe,KAAK,UAAU;CACnD,MAAM,eAAe,CAAC,aAAa,GAAG,aAAa;CAMnD,MAAM,wBAAwB,aAAa,KAAK,EAAE,SAAS,GAAG;AAE9D,QAAO,aAAa;EACnB,IAAI,UAAU;EACd,WAAW;EAIX,MAAM;EACN,SAAS;EACT,QAAQ,SACP,OAAO,IAAI,aAAa;GACvB,MAAM,CAAC,KAAK,GAAG,oBAAoB;GACnC,MAAM,uBAAuB,IAAI,IAChC,aAAa,KAAK,KAAK,UAAU,CAAC,IAAI,IAAI,iBAAiB,OAAO,CAAC,CACnE;AASD,QAAK,MAAM,OAAO,aACjB,KAAI,CAAC,qBAAqB,IAAI,IAAI,GAAG,CACpC,QAAO,OAAO,OAAO,KACpB,YAAY,SAAS;IACpB,YAAY;IACZ,SAAS,WAAW,KAAK,iBAAiB,IAAI,GAAG;IACjD,CAAC,CACF;GAGH,MAAM,0BAA0B,OAAwB,qBAAqB,IAAI,GAAG;GAIpF,MAAM,YAAY,OAAO;GACzB,MAAM,QAAQ,OAAO,cAA2B,IAAI,MAAM;GAc1D,MAAM,UAA8B;IACnC;IACA,iBAAiB,SAAS,UACzBA,eAAmB;KAClB,YAAY;KACZ;KACA;KACA;KACA,CAAC;IACH;GAED,MAAM,WAAW,wBAAwB,KAAK,YAAY,WACzD,uBAAuB,OAAO,GAAG,CACjC;AAmCD,UAAO,OAvBgB,kBAAkB,WAAW,OAAO;IAV1D,YAAY;IACZ,SAAS,IAAI;IACb,qBAAqB;KACpB,YAAY;KACZ;KACA;IACD,iBAAiB,qBAAqB,KAAK,eAAe,SAAS,SAAS;IAC5E,MAAM,KAAK,KAAK,SAAS,SAAS;IAGqC,CAAC,CAAC,KAWzE,OAAO,UAAU;IAChB,cAAc,QAAQ,OAAO,KAAK,IAAI;IACtC,uBAAuB,QACtB,OAAO,KACN,YAAY,UAAU;KACrB,YAAY;KACZ,SAAS,IAAI;KACb,OAAO;KACP,CAAC,CACF;IACF,CAAC,CACF;IAEA;EAGH,cAAc,EAAE;EAKhB,oBAAoB;EACpB,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { contentHash } from "../../substrate/brand.mjs";
|
|
2
|
+
import { artifactPublishError } from "../../primitives/artifact-publisher.mjs";
|
|
3
|
+
import { acquireOnChainArtifact } from "../internal/acquire-on-chain-artifact.mjs";
|
|
2
4
|
import { actionError } from "./errors.mjs";
|
|
5
|
+
import { ActionSpans } from "./spans.mjs";
|
|
6
|
+
import { withPhasePreservingProduce } from "../../substrate/runtime/phase-preserving-produce.mjs";
|
|
3
7
|
import { composeDiscriminatorMaterial } from "./discriminator.mjs";
|
|
4
|
-
import { Effect, Schema } from "effect";
|
|
8
|
+
import { Cause, Effect, Schema } from "effect";
|
|
5
9
|
import { createHash } from "node:crypto";
|
|
6
10
|
Schema.Struct({
|
|
7
11
|
digest: Schema.String,
|
|
@@ -17,14 +21,10 @@ const VerifyTxShape = Schema.Struct({ digest: Schema.String });
|
|
|
17
21
|
* action context and resolved dependency values. Two input shapes
|
|
18
22
|
* (per `DynamicDiscriminator`) collapse onto
|
|
19
23
|
* `Effect<string | undefined, ActionError>`. */
|
|
20
|
-
const resolveDiscriminator = (
|
|
24
|
+
const resolveDiscriminator = (dynamic, ctx, deps) => {
|
|
21
25
|
if (dynamic === void 0) return Effect.succeed(void 0);
|
|
22
26
|
if (typeof dynamic === "string") return Effect.succeed(dynamic);
|
|
23
|
-
return dynamic(ctx, deps)
|
|
24
|
-
actionName,
|
|
25
|
-
message: `Action '${actionName}': discriminator Effect failed.`,
|
|
26
|
-
cause
|
|
27
|
-
}))));
|
|
27
|
+
return dynamic(ctx, deps);
|
|
28
28
|
};
|
|
29
29
|
/** Build the verify-probe Effect for a given cached digest. Lenient
|
|
30
30
|
* mode coerces transient + not-found to null; the substrate then
|
|
@@ -41,43 +41,46 @@ const buildVerifyProbe = (probe, cachedDigest) => probe.get({
|
|
|
41
41
|
* itself surfaces a produce-failure wrap. */
|
|
42
42
|
const bootActionService = (publisher, probe, inputs) => Effect.gen(function* () {
|
|
43
43
|
yield* Effect.annotateCurrentSpan({
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
[ActionSpans.name]: inputs.actionName,
|
|
45
|
+
[ActionSpans.chain]: inputs.chainId
|
|
46
46
|
});
|
|
47
47
|
const resolvedDynamic = yield* inputs.dynamicMaterial;
|
|
48
48
|
const material = composeDiscriminatorMaterial(inputs.staticDiscriminator, resolvedDynamic);
|
|
49
49
|
const inputsHash = contentHash(createHash("sha256").update(material).digest("hex"));
|
|
50
|
-
const
|
|
51
|
-
namespace: "action",
|
|
52
|
-
chain: inputs.chainId,
|
|
53
|
-
contentHash: inputsHash,
|
|
54
|
-
verifySchema: VerifyTxShape,
|
|
55
|
-
verify: (cached) => buildVerifyProbe(probe, cached.digest),
|
|
50
|
+
const { wrappedProduce, recoverTypedError } = yield* withPhasePreservingProduce({
|
|
56
51
|
produce: Effect.gen(function* () {
|
|
57
|
-
yield* Effect.annotateCurrentSpan({
|
|
58
|
-
const receipt = yield* inputs.body.pipe(Effect.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
cause
|
|
62
|
-
|
|
52
|
+
yield* Effect.annotateCurrentSpan({ [ActionSpans.phase]: "building" });
|
|
53
|
+
const receipt = yield* inputs.body.pipe(Effect.catchCause((cause) => {
|
|
54
|
+
const failed = Cause.findError(cause);
|
|
55
|
+
if (failed._tag === "Success") return Effect.fail(failed.success);
|
|
56
|
+
if (Cause.hasInterruptsOnly(cause)) return Effect.failCause(cause);
|
|
57
|
+
const defect = Cause.findDefect(cause);
|
|
58
|
+
const defectValue = defect._tag === "Success" ? defect.success : Cause.squash(cause);
|
|
59
|
+
return Effect.fail(actionError("sign", {
|
|
60
|
+
actionName: inputs.actionName,
|
|
61
|
+
message: `Action '${inputs.actionName}': body Effect raised a defect.`,
|
|
62
|
+
cause: defectValue
|
|
63
|
+
}));
|
|
64
|
+
}));
|
|
63
65
|
yield* Effect.annotateCurrentSpan({
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
[ActionSpans.phase]: "parsing",
|
|
67
|
+
[ActionSpans.digest]: receipt.digest
|
|
66
68
|
});
|
|
67
69
|
return receipt;
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
reason: "produce-failed",
|
|
71
|
-
detail: `action.${inputs.actionName} ${err.phase}: ${err.message}`
|
|
72
|
-
}))),
|
|
73
|
-
register: (_artifact) => Effect.void
|
|
70
|
+
}),
|
|
71
|
+
wrapProduceError: (err) => artifactPublishError("produce-failed", `action.${inputs.actionName} ${err.phase}: ${err.message}`)
|
|
74
72
|
});
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
return yield* acquireOnChainArtifact(publisher, {
|
|
74
|
+
namespace: "action",
|
|
75
|
+
chain: inputs.chainId,
|
|
76
|
+
contentHash: inputsHash,
|
|
77
|
+
verify: (cached) => buildVerifyProbe(probe, cached.digest),
|
|
78
|
+
produce: wrappedProduce
|
|
79
|
+
}).pipe(recoverTypedError);
|
|
80
|
+
}).pipe(Effect.withSpan("devstack.plugin.action.boot", { attributes: {
|
|
81
|
+
[ActionSpans.name]: inputs.actionName,
|
|
82
|
+
[ActionSpans.chain]: inputs.chainId
|
|
83
|
+
} }));
|
|
81
84
|
//#endregion
|
|
82
85
|
export { bootActionService, resolveDiscriminator };
|
|
83
86
|
|