@mysten-incubation/devstack 0.0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/dashboard-ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dashboard-ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dashboard-ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dashboard-ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-cyrillic-ext-wght-normal-I4S5GZfc.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-cyrillic-wght-normal-BmXc_FBt.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-latin-ext-wght-normal-DrnZ1wKl.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-latin-wght-normal-B_7UjwxQ.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-symbols2-wght-normal-GZpp1pK2.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-vietnamese-wght-normal-D8KDMBhC.woff2 +0 -0
- package/dashboard-ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dashboard-ui/assets/index-Bmi1UtAg.js +1356 -0
- package/dashboard-ui/assets/index-D5EShVt4.js +3 -0
- package/dashboard-ui/assets/index-Deml9drg.css +1 -0
- package/dashboard-ui/index.html +13 -0
- package/dist/api/define-capabilities.d.mts +14 -3
- package/dist/api/define-capabilities.mjs +18 -1
- package/dist/api/define-capabilities.mjs.map +1 -1
- package/dist/api/define-devstack.d.mts +1 -1
- package/dist/api/define-devstack.mjs +6 -26
- package/dist/api/define-devstack.mjs.map +1 -1
- package/dist/api/define-plugin.d.mts +1 -0
- package/dist/api/define-plugin.mjs +2 -0
- package/dist/api/inference-network.d.mts +132 -0
- package/dist/api/inference-network.mjs +105 -16
- package/dist/api/inference-network.mjs.map +1 -1
- package/dist/api/plugin-errors.d.mts +7 -0
- package/dist/api/run-stack.d.mts +20 -9
- package/dist/api/run-stack.mjs +56 -29
- package/dist/api/run-stack.mjs.map +1 -1
- package/dist/build-integrations/playwright/config.d.mts +6 -4
- package/dist/build-integrations/playwright/config.mjs +5 -3
- package/dist/build-integrations/playwright/config.mjs.map +1 -1
- package/dist/build-integrations/playwright/errors.d.mts +1 -1
- package/dist/build-integrations/playwright/global-setup.d.mts +43 -17
- package/dist/build-integrations/playwright/global-setup.mjs +250 -13
- package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
- package/dist/build-integrations/playwright/index.d.mts +5 -3
- package/dist/build-integrations/playwright/index.mjs +4 -2
- package/dist/build-integrations/playwright/stack-context.d.mts +0 -1
- package/dist/build-integrations/playwright/stack-context.mjs +24 -63
- package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
- package/dist/build-integrations/playwright/wallet-context.d.mts +7 -10
- package/dist/build-integrations/playwright/wallet-context.mjs +8 -13
- package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
- package/dist/build-integrations/runtime/cold-start-url.d.mts +5 -0
- package/dist/build-integrations/runtime/cold-start-url.mjs +4 -3
- package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
- package/dist/build-integrations/runtime/conventional-routes.d.mts +51 -0
- package/dist/build-integrations/runtime/conventional-routes.mjs +92 -0
- package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -0
- package/dist/build-integrations/runtime/discover.d.mts +38 -30
- package/dist/build-integrations/runtime/discover.mjs +73 -70
- package/dist/build-integrations/runtime/discover.mjs.map +1 -1
- package/dist/build-integrations/runtime/endpoint-registry.d.mts +3 -1
- package/dist/build-integrations/runtime/endpoint-registry.mjs +3 -1
- package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
- package/dist/build-integrations/runtime/index.d.mts +7 -2
- package/dist/build-integrations/runtime/index.mjs +9 -2
- package/dist/build-integrations/runtime/manifest-types.d.mts +2 -0
- package/dist/build-integrations/runtime/manifest-types.mjs +3 -0
- package/dist/build-integrations/runtime/playwright-stack-context-slot.d.mts +29 -0
- package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs +10 -0
- package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs.map +1 -0
- package/dist/build-integrations/runtime/read-stack-context.d.mts +1 -1
- package/dist/build-integrations/runtime/read-stack-context.mjs +10 -4
- package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
- package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +48 -0
- package/dist/build-integrations/runtime/resolve-discovery-env.mjs +42 -0
- package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -0
- package/dist/build-integrations/runtime/stack-context.d.mts +1 -1
- package/dist/build-integrations/runtime/wallet-paths.mjs +2 -0
- package/dist/build-integrations/vite/index.d.mts +51 -0
- package/dist/build-integrations/vite/index.mjs +73 -0
- package/dist/build-integrations/vite/index.mjs.map +1 -0
- package/dist/build-integrations/vitest/env.d.mts +4 -3
- package/dist/build-integrations/vitest/env.mjs +6 -4
- package/dist/build-integrations/vitest/env.mjs.map +1 -1
- package/dist/build-integrations/vitest/errors.d.mts +25 -4
- package/dist/build-integrations/vitest/errors.mjs +15 -2
- package/dist/build-integrations/vitest/errors.mjs.map +1 -1
- package/dist/build-integrations/vitest/index.d.mts +2 -2
- package/dist/build-integrations/vitest/index.mjs +3 -3
- package/dist/build-integrations/vitest/setup.d.mts +4 -2
- package/dist/build-integrations/vitest/setup.mjs +2 -2
- package/dist/build-integrations/vitest/setup.mjs.map +1 -1
- package/dist/build-integrations/vitest/stack-context.d.mts +0 -1
- package/dist/build-integrations/vitest/stack-context.mjs +33 -13
- package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
- package/dist/cli/bail.mjs +23 -0
- package/dist/cli/bail.mjs.map +1 -0
- package/dist/{surfaces/cli/commands → cli}/doctor-probes.mjs +26 -16
- package/dist/cli/doctor-probes.mjs.map +1 -0
- package/dist/cli/main.d.mts +15 -1
- package/dist/cli/main.mjs +166 -482
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/prune-direct.mjs +31 -201
- package/dist/cli/prune-direct.mjs.map +1 -1
- package/dist/cli/snapshot-reader.mjs +14 -11
- package/dist/cli/snapshot-reader.mjs.map +1 -1
- package/dist/cli/up-lifecycle.mjs +4 -1
- package/dist/cli/up-lifecycle.mjs.map +1 -1
- package/dist/cli/wirings/apply.mjs +95 -0
- package/dist/cli/wirings/apply.mjs.map +1 -0
- package/dist/cli/wirings/build-verb-layers.mjs +42 -0
- package/dist/cli/wirings/build-verb-layers.mjs.map +1 -0
- package/dist/cli/wirings/config-loader.mjs +69 -0
- package/dist/cli/wirings/config-loader.mjs.map +1 -0
- package/dist/cli/wirings/engine-command.mjs +30 -0
- package/dist/cli/wirings/engine-command.mjs.map +1 -0
- package/dist/cli/wirings/identity.mjs +72 -0
- package/dist/cli/wirings/identity.mjs.map +1 -0
- package/dist/cli/wirings/provide-file-system.mjs +7 -0
- package/dist/cli/wirings/provide-file-system.mjs.map +1 -0
- package/dist/cli/wirings/snapshot.mjs +177 -0
- package/dist/cli/wirings/snapshot.mjs.map +1 -0
- package/dist/cli/wirings/up.mjs +287 -0
- package/dist/cli/wirings/up.mjs.map +1 -0
- package/dist/cli/wirings/wipe.mjs +40 -0
- package/dist/cli/wirings/wipe.mjs.map +1 -0
- package/dist/contracts/capability-decl.d.mts +0 -2
- package/dist/contracts/codegenable.d.mts +43 -0
- package/dist/contracts/container-runtime.d.mts +26 -1
- package/dist/contracts/faucet-strategy.d.mts +25 -0
- package/dist/contracts/funding-strategy.d.mts +42 -0
- package/dist/contracts/plugin-expander.mjs +60 -0
- package/dist/contracts/plugin-expander.mjs.map +1 -0
- package/dist/contracts/projection.d.mts +5 -3
- package/dist/contracts/renderer.d.mts +23 -0
- package/dist/contracts/routable.d.mts +14 -1
- package/dist/contracts/snapshotable.d.mts +25 -3
- package/dist/contracts/wallet-protocol.d.mts +52 -0
- package/dist/contracts/wallet-protocol.mjs +52 -0
- package/dist/contracts/wallet-protocol.mjs.map +1 -0
- package/dist/index.d.mts +26 -25
- package/dist/index.mjs +20 -13
- package/dist/{runtime → orchestrators}/built-in-plugin-layers.mjs +10 -5
- package/dist/orchestrators/built-in-plugin-layers.mjs.map +1 -0
- package/dist/orchestrators/codegen/bindings.d.mts +1 -2
- package/dist/orchestrators/codegen/bindings.mjs +52 -186
- package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
- package/dist/orchestrators/codegen/emit.mjs +19 -1
- package/dist/orchestrators/codegen/emit.mjs.map +1 -1
- package/dist/orchestrators/codegen/errors.mjs +8 -3
- package/dist/orchestrators/codegen/errors.mjs.map +1 -1
- package/dist/orchestrators/codegen/format.mjs +47 -39
- package/dist/orchestrators/codegen/format.mjs.map +1 -1
- package/dist/orchestrators/codegen/gitignore.mjs +3 -1
- package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
- package/dist/orchestrators/codegen/output-location.mjs +41 -0
- package/dist/orchestrators/codegen/output-location.mjs.map +1 -0
- package/dist/orchestrators/codegen/paths.d.mts +1 -1
- package/dist/orchestrators/codegen/paths.mjs +40 -14
- package/dist/orchestrators/codegen/paths.mjs.map +1 -1
- package/dist/orchestrators/codegen/permissions.mjs +3 -1
- package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
- package/dist/orchestrators/codegen/service.mjs +157 -105
- package/dist/orchestrators/codegen/service.mjs.map +1 -1
- package/dist/orchestrators/lifecycle-prune/errors.mjs +31 -0
- package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -0
- package/dist/orchestrators/lifecycle-prune/index.mjs +350 -0
- package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -0
- package/dist/orchestrators/router/cleanup.mjs +26 -27
- package/dist/orchestrators/router/cleanup.mjs.map +1 -1
- package/dist/orchestrators/router/entrypoints.mjs +2 -2
- package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
- package/dist/orchestrators/router/file-provider.mjs +14 -5
- package/dist/orchestrators/router/file-provider.mjs.map +1 -1
- package/dist/orchestrators/router/hostname.mjs +19 -55
- package/dist/orchestrators/router/hostname.mjs.map +1 -1
- package/dist/orchestrators/router/index.mjs +11 -0
- package/dist/orchestrators/router/profile.mjs +2 -2
- package/dist/orchestrators/router/sentinels.mjs +26 -0
- package/dist/orchestrators/router/sentinels.mjs.map +1 -0
- package/dist/orchestrators/router/service.mjs +40 -37
- package/dist/orchestrators/router/service.mjs.map +1 -1
- package/dist/orchestrators/router/traefik-container.mjs +27 -16
- package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
- package/dist/{substrate/runtime → orchestrators}/run.mjs +26 -21
- package/dist/orchestrators/run.mjs.map +1 -0
- package/dist/orchestrators/runtime-composition.d.mts +1 -1
- package/dist/orchestrators/runtime-composition.mjs +123 -39
- package/dist/orchestrators/runtime-composition.mjs.map +1 -1
- package/dist/orchestrators/snapshot/capture-command.d.mts +1 -0
- package/dist/orchestrators/snapshot/capture-command.mjs +25 -0
- package/dist/orchestrators/snapshot/capture-command.mjs.map +1 -0
- package/dist/orchestrators/snapshot/capture.mjs +42 -28
- package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
- package/dist/orchestrators/snapshot/descriptor.mjs +35 -10
- package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
- package/dist/orchestrators/snapshot/identity-guard.mjs +1 -1
- package/dist/orchestrators/snapshot/index.mjs +13 -0
- package/dist/orchestrators/snapshot/integrity.d.mts +1 -1
- package/dist/orchestrators/snapshot/integrity.mjs +73 -17
- package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
- package/dist/orchestrators/snapshot/pending-marker.d.mts +1 -0
- package/dist/orchestrators/snapshot/pending-marker.mjs +99 -0
- package/dist/orchestrators/snapshot/pending-marker.mjs.map +1 -0
- package/dist/orchestrators/snapshot/phase-error.mjs +23 -0
- package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -0
- package/dist/orchestrators/snapshot/prune.mjs +20 -55
- package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
- package/dist/orchestrators/snapshot/recover-pending.d.mts +1 -0
- package/dist/orchestrators/snapshot/recover-pending.mjs +223 -0
- package/dist/orchestrators/snapshot/recover-pending.mjs.map +1 -0
- package/dist/orchestrators/snapshot/restore.mjs +118 -84
- package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
- package/dist/orchestrators/snapshot/service.mjs +53 -56
- package/dist/orchestrators/snapshot/service.mjs.map +1 -1
- package/dist/orchestrators/snapshot/state-document.d.mts +1 -0
- package/dist/orchestrators/snapshot/state-document.mjs +47 -7
- package/dist/orchestrators/snapshot/state-document.mjs.map +1 -1
- package/dist/orchestrators/snapshot/wipe.mjs +67 -10
- package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
- package/dist/plugins/account/codegen.mjs +9 -8
- package/dist/plugins/account/codegen.mjs.map +1 -1
- package/dist/plugins/account/errors.d.mts +33 -6
- package/dist/plugins/account/errors.mjs.map +1 -1
- package/dist/plugins/account/funding.d.mts +29 -19
- package/dist/plugins/account/funding.mjs +84 -66
- package/dist/plugins/account/funding.mjs.map +1 -1
- package/dist/plugins/account/index.d.mts +2 -4
- package/dist/plugins/account/index.mjs +64 -31
- package/dist/plugins/account/index.mjs.map +1 -1
- package/dist/plugins/account/keypair.mjs +6 -9
- package/dist/plugins/account/keypair.mjs.map +1 -1
- package/dist/plugins/account/lease.mjs +1 -0
- package/dist/plugins/account/lease.mjs.map +1 -1
- package/dist/plugins/account/registry.d.mts +14 -1
- package/dist/plugins/account/registry.mjs +18 -18
- package/dist/plugins/account/registry.mjs.map +1 -1
- package/dist/plugins/account/service.d.mts +23 -4
- package/dist/plugins/account/service.mjs +83 -45
- package/dist/plugins/account/service.mjs.map +1 -1
- package/dist/plugins/account/snapshot.mjs +2 -5
- package/dist/plugins/account/snapshot.mjs.map +1 -1
- package/dist/plugins/account/spans.mjs +16 -0
- package/dist/plugins/account/spans.mjs.map +1 -0
- package/dist/plugins/account/variants/keystore.mjs +6 -8
- package/dist/plugins/account/variants/keystore.mjs.map +1 -1
- package/dist/plugins/action/build-context.d.mts +3 -2
- package/dist/plugins/action/errors.d.mts +16 -12
- package/dist/plugins/action/errors.mjs.map +1 -1
- package/dist/plugins/action/execute.mjs +65 -103
- package/dist/plugins/action/execute.mjs.map +1 -1
- package/dist/plugins/action/index.d.mts +0 -2
- package/dist/plugins/action/index.mjs +17 -13
- package/dist/plugins/action/index.mjs.map +1 -1
- package/dist/plugins/action/service.mjs +38 -35
- package/dist/plugins/action/service.mjs.map +1 -1
- package/dist/plugins/action/spans.mjs +11 -0
- package/dist/plugins/action/spans.mjs.map +1 -0
- package/dist/plugins/coin/codegen.mjs +9 -8
- package/dist/plugins/coin/codegen.mjs.map +1 -1
- package/dist/plugins/coin/discovery.mjs +8 -4
- package/dist/plugins/coin/discovery.mjs.map +1 -1
- package/dist/plugins/coin/index.d.mts +11 -29
- package/dist/plugins/coin/index.mjs +56 -27
- package/dist/plugins/coin/index.mjs.map +1 -1
- package/dist/plugins/coin/metadata.mjs +8 -15
- package/dist/plugins/coin/metadata.mjs.map +1 -1
- package/dist/plugins/coin/mint.d.mts +30 -11
- package/dist/plugins/coin/mint.mjs +78 -74
- package/dist/plugins/coin/mint.mjs.map +1 -1
- package/dist/plugins/coin/registry.mjs +4 -7
- package/dist/plugins/coin/registry.mjs.map +1 -1
- package/dist/plugins/coin/service.d.mts +39 -1
- package/dist/plugins/coin/service.mjs +11 -4
- package/dist/plugins/coin/service.mjs.map +1 -1
- package/dist/plugins/coin/spans.mjs +20 -0
- package/dist/plugins/coin/spans.mjs.map +1 -0
- package/dist/plugins/dashboard/domain.mjs +402 -0
- package/dist/plugins/dashboard/domain.mjs.map +1 -0
- package/dist/plugins/dashboard/index.d.mts +29 -0
- package/dist/plugins/dashboard/index.mjs +91 -0
- package/dist/plugins/dashboard/index.mjs.map +1 -0
- package/dist/plugins/dashboard/origin-policy.mjs +36 -0
- package/dist/plugins/dashboard/origin-policy.mjs.map +1 -0
- package/dist/plugins/dashboard/routable.mjs +27 -0
- package/dist/plugins/dashboard/routable.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/builder.mjs +21 -0
- package/dist/plugins/dashboard/schema/builder.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/enums.mjs +72 -0
- package/dist/plugins/dashboard/schema/enums.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/root.mjs +351 -0
- package/dist/plugins/dashboard/schema/root.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/types.mjs +508 -0
- package/dist/plugins/dashboard/schema/types.mjs.map +1 -0
- package/dist/plugins/dashboard/schema.mjs +11 -0
- package/dist/plugins/dashboard/schema.mjs.map +1 -0
- package/dist/plugins/dashboard/server.mjs +166 -0
- package/dist/plugins/dashboard/server.mjs.map +1 -0
- package/dist/plugins/deepbook/deploy.mjs +53 -115
- package/dist/plugins/deepbook/deploy.mjs.map +1 -1
- package/dist/plugins/deepbook/errors.mjs +1 -0
- package/dist/plugins/deepbook/errors.mjs.map +1 -1
- package/dist/plugins/deepbook/faucet-strategy.mjs +47 -34
- package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
- package/dist/plugins/deepbook/hash.mjs +9 -0
- package/dist/plugins/deepbook/hash.mjs.map +1 -0
- package/dist/plugins/deepbook/index.d.mts +1 -10
- package/dist/plugins/deepbook/index.mjs +25 -22
- package/dist/plugins/deepbook/index.mjs.map +1 -1
- package/dist/plugins/deepbook/pyth/index.mjs +26 -55
- package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
- package/dist/plugins/deepbook/snapshot.mjs +17 -29
- package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
- package/dist/plugins/deepbook/spans.mjs +18 -0
- package/dist/plugins/deepbook/spans.mjs.map +1 -0
- package/dist/plugins/deepbook/type-strings.mjs +65 -0
- package/dist/plugins/deepbook/type-strings.mjs.map +1 -0
- package/dist/plugins/deepbook/types.d.mts +2 -3
- package/dist/plugins/deepbook/types.mjs.map +1 -1
- package/dist/plugins/faucet/dispatcher.d.mts +21 -2
- package/dist/plugins/faucet/dispatcher.mjs +1 -2
- package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
- package/dist/plugins/faucet/errors.d.mts +11 -24
- package/dist/plugins/faucet/errors.mjs.map +1 -1
- package/dist/plugins/faucet/http.mjs +33 -14
- package/dist/plugins/faucet/http.mjs.map +1 -1
- package/dist/plugins/faucet/index.d.mts +15 -5
- package/dist/plugins/faucet/index.mjs +3 -0
- package/dist/plugins/faucet/index.mjs.map +1 -1
- package/dist/plugins/faucet/spans.mjs +12 -0
- package/dist/plugins/faucet/spans.mjs.map +1 -0
- package/dist/plugins/host-service/errors.d.mts +1 -1
- package/dist/plugins/host-service/index.mjs +34 -8
- package/dist/plugins/host-service/index.mjs.map +1 -1
- package/dist/plugins/host-service/routable.mjs +2 -1
- package/dist/plugins/host-service/routable.mjs.map +1 -1
- package/dist/plugins/host-service/service.d.mts +21 -0
- package/dist/plugins/host-service/service.mjs +136 -81
- package/dist/plugins/host-service/service.mjs.map +1 -1
- package/dist/plugins/internal/acquire-on-chain-artifact.mjs +23 -0
- package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -0
- package/dist/plugins/internal/codegen-helpers.mjs +18 -0
- package/dist/plugins/internal/codegen-helpers.mjs.map +1 -0
- package/dist/plugins/internal/funding-failure-error.mjs +32 -0
- package/dist/plugins/internal/funding-failure-error.mjs.map +1 -0
- package/dist/plugins/package/build.mjs +1 -1
- package/dist/plugins/package/build.mjs.map +1 -1
- package/dist/plugins/package/codegen.mjs +26 -0
- package/dist/plugins/package/codegen.mjs.map +1 -1
- package/dist/plugins/package/errors.d.mts +16 -6
- package/dist/plugins/package/errors.mjs.map +1 -1
- package/dist/plugins/package/index.d.mts +0 -4
- package/dist/plugins/package/index.mjs +27 -21
- package/dist/plugins/package/index.mjs.map +1 -1
- package/dist/plugins/package/mode-known.mjs +26 -12
- package/dist/plugins/package/mode-known.mjs.map +1 -1
- package/dist/plugins/package/mode-local.mjs +47 -41
- package/dist/plugins/package/mode-local.mjs.map +1 -1
- package/dist/plugins/package/publish-executor.mjs +55 -114
- package/dist/plugins/package/publish-executor.mjs.map +1 -1
- package/dist/plugins/package/registry.mjs +2 -1
- package/dist/plugins/package/registry.mjs.map +1 -1
- package/dist/plugins/package/service.mjs.map +1 -1
- package/dist/plugins/package/spans.mjs +14 -0
- package/dist/plugins/package/spans.mjs.map +1 -0
- package/dist/plugins/postgres/db-ensure.mjs +19 -12
- package/dist/plugins/postgres/db-ensure.mjs.map +1 -1
- package/dist/plugins/postgres/errors.d.mts +5 -0
- package/dist/plugins/postgres/errors.mjs.map +1 -1
- package/dist/plugins/postgres/index.mjs +10 -17
- package/dist/plugins/postgres/index.mjs.map +1 -1
- package/dist/plugins/postgres/service.mjs +58 -24
- package/dist/plugins/postgres/service.mjs.map +1 -1
- package/dist/plugins/postgres/snapshot.mjs.map +1 -1
- package/dist/plugins/postgres/spans.mjs +11 -0
- package/dist/plugins/postgres/spans.mjs.map +1 -0
- package/dist/plugins/router-entrypoints.mjs +4 -4
- package/dist/plugins/router-entrypoints.mjs.map +1 -1
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +15 -13
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +15 -19
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
- package/dist/plugins/seal/codegen.d.mts +2 -3
- package/dist/plugins/seal/codegen.mjs.map +1 -1
- package/dist/plugins/seal/config-render.mjs +35 -8
- package/dist/plugins/seal/config-render.mjs.map +1 -1
- package/dist/plugins/seal/deploy.mjs +31 -39
- package/dist/plugins/seal/deploy.mjs.map +1 -1
- package/dist/plugins/seal/errors.d.mts +1 -3
- package/dist/plugins/seal/errors.mjs +7 -1
- package/dist/plugins/seal/errors.mjs.map +1 -1
- package/dist/plugins/seal/index.d.mts +1 -6
- package/dist/plugins/seal/index.mjs +40 -14
- package/dist/plugins/seal/index.mjs.map +1 -1
- package/dist/plugins/seal/key-manager.d.mts +1 -9
- package/dist/plugins/seal/key-manager.mjs +2 -18
- package/dist/plugins/seal/key-manager.mjs.map +1 -1
- package/dist/plugins/seal/key-server.mjs +37 -36
- package/dist/plugins/seal/key-server.mjs.map +1 -1
- package/dist/plugins/seal/keygen.mjs +16 -17
- package/dist/plugins/seal/keygen.mjs.map +1 -1
- package/dist/plugins/seal/mode/fork-known.mjs +36 -14
- package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
- package/dist/plugins/seal/mode/live.d.mts +6 -4
- package/dist/plugins/seal/mode/live.mjs +14 -21
- package/dist/plugins/seal/mode/live.mjs.map +1 -1
- package/dist/plugins/seal/mode/local-keygen.mjs +57 -21
- package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
- package/dist/plugins/seal/registry-publish.mjs +1 -0
- package/dist/plugins/seal/registry-publish.mjs.map +1 -1
- package/dist/plugins/seal/routable.mjs.map +1 -1
- package/dist/plugins/seal/service.mjs.map +1 -1
- package/dist/plugins/seal/spans.mjs +18 -0
- package/dist/plugins/seal/spans.mjs.map +1 -0
- package/dist/plugins/sui/auto-tick.mjs +17 -23
- package/dist/plugins/sui/auto-tick.mjs.map +1 -1
- package/dist/plugins/sui/chain-build-container.mjs +18 -0
- package/dist/plugins/sui/chain-build-container.mjs.map +1 -0
- package/dist/plugins/sui/chain-probe.d.mts +5 -5
- package/dist/plugins/sui/chain-probe.mjs +28 -58
- package/dist/plugins/sui/chain-probe.mjs.map +1 -1
- package/dist/plugins/sui/codegen.mjs +26 -0
- package/dist/plugins/sui/codegen.mjs.map +1 -1
- package/dist/plugins/sui/errors.d.mts +2 -29
- package/dist/plugins/sui/errors.mjs +1 -3
- package/dist/plugins/sui/errors.mjs.map +1 -1
- package/dist/plugins/sui/fork-faucet-strategy.d.mts +1 -0
- package/dist/plugins/sui/fork-faucet-strategy.mjs +55 -0
- package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -0
- package/dist/plugins/sui/fork-orchestration.d.mts +1 -0
- package/dist/plugins/sui/fork-orchestration.mjs +170 -2
- package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
- package/dist/plugins/sui/fork-transaction.d.mts +2 -0
- package/dist/plugins/sui/fork-transaction.mjs +92 -28
- package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
- package/dist/plugins/sui/index.d.mts +33 -70
- package/dist/plugins/sui/index.mjs +58 -35
- package/dist/plugins/sui/index.mjs.map +1 -1
- package/dist/plugins/{faucet/strategies/sui-local.mjs → sui/local-faucet-strategy.mjs} +10 -7
- package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -0
- package/dist/plugins/sui/mode/external.mjs +7 -13
- package/dist/plugins/sui/mode/external.mjs.map +1 -1
- package/dist/plugins/sui/mode/fork.mjs +136 -59
- package/dist/plugins/sui/mode/fork.mjs.map +1 -1
- package/dist/plugins/sui/mode/live.mjs +10 -16
- package/dist/plugins/sui/mode/live.mjs.map +1 -1
- package/dist/plugins/sui/mode/local.mjs +37 -36
- package/dist/plugins/sui/mode/local.mjs.map +1 -1
- package/dist/plugins/sui/mode/shared-boot.mjs +38 -115
- package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
- package/dist/plugins/sui/mode/shared.d.mts +1 -5
- package/dist/plugins/sui/mode/shared.mjs.map +1 -1
- package/dist/plugins/sui/mode/spec.d.mts +18 -0
- package/dist/plugins/sui/move-summary-runner.mjs +207 -0
- package/dist/plugins/sui/move-summary-runner.mjs.map +1 -0
- package/dist/plugins/sui/network-resolver.d.mts +4 -3
- package/dist/plugins/sui/service.mjs.map +1 -1
- package/dist/plugins/sui/snapshot.mjs +3 -0
- package/dist/plugins/sui/snapshot.mjs.map +1 -1
- package/dist/plugins/sui/spans.mjs +17 -0
- package/dist/plugins/sui/spans.mjs.map +1 -0
- package/dist/plugins/wallet/codegen.d.mts +0 -1
- package/dist/plugins/wallet/codegen.mjs +8 -9
- package/dist/plugins/wallet/codegen.mjs.map +1 -1
- package/dist/plugins/wallet/index.d.mts +6 -8
- package/dist/plugins/wallet/index.mjs +46 -35
- package/dist/plugins/wallet/index.mjs.map +1 -1
- package/dist/plugins/wallet/origin-policy.mjs +12 -28
- package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
- package/dist/plugins/wallet/pairing.mjs +6 -4
- package/dist/plugins/wallet/pairing.mjs.map +1 -1
- package/dist/plugins/wallet/protocol.d.mts +1 -0
- package/dist/plugins/wallet/protocol.mjs +5 -44
- package/dist/plugins/wallet/protocol.mjs.map +1 -1
- package/dist/plugins/wallet/routable.mjs +2 -8
- package/dist/plugins/wallet/routable.mjs.map +1 -1
- package/dist/plugins/wallet/server.mjs +36 -44
- package/dist/plugins/wallet/server.mjs.map +1 -1
- package/dist/plugins/wallet/service.d.mts +1 -5
- package/dist/plugins/wallet/service.mjs +22 -18
- package/dist/plugins/wallet/service.mjs.map +1 -1
- package/dist/plugins/wallet/spans.mjs +22 -0
- package/dist/plugins/wallet/spans.mjs.map +1 -0
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +33 -8
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
- package/dist/plugins/walrus/codegen.d.mts +3 -3
- package/dist/plugins/walrus/codegen.mjs.map +1 -1
- package/dist/plugins/walrus/deploy-paths.mjs +21 -5
- package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
- package/dist/plugins/walrus/deploy.mjs +67 -69
- package/dist/plugins/walrus/deploy.mjs.map +1 -1
- package/dist/plugins/walrus/errors.mjs +1 -0
- package/dist/plugins/walrus/errors.mjs.map +1 -1
- package/dist/plugins/walrus/faucet-strategy.mjs +12 -7
- package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
- package/dist/plugins/walrus/index.d.mts +2 -13
- package/dist/plugins/walrus/index.mjs +18 -23
- package/dist/plugins/walrus/index.mjs.map +1 -1
- package/dist/plugins/walrus/mode/known-deploy.mjs +7 -5
- package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
- package/dist/plugins/walrus/mode/local-cluster.mjs +26 -7
- package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
- package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
- package/dist/plugins/walrus/routable.mjs +7 -23
- package/dist/plugins/walrus/routable.mjs.map +1 -1
- package/dist/plugins/walrus/service.mjs.map +1 -1
- package/dist/plugins/walrus/spans.mjs +18 -0
- package/dist/plugins/walrus/spans.mjs.map +1 -0
- package/dist/plugins/walrus/storage-nodes.d.mts +6 -2
- package/dist/plugins/walrus/storage-nodes.mjs +15 -8
- package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
- package/dist/plugins/walrus/wal-swap.mjs +58 -15
- package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
- package/dist/primitives/artifact-publisher.d.mts +1 -1
- package/dist/primitives/artifact-publisher.mjs +15 -0
- package/dist/primitives/artifact-publisher.mjs.map +1 -0
- package/dist/runtime/docker/client.mjs +17 -4
- package/dist/runtime/docker/client.mjs.map +1 -1
- package/dist/runtime/docker/container.mjs +219 -132
- package/dist/runtime/docker/container.mjs.map +1 -1
- package/dist/runtime/docker/errors.mjs +0 -6
- package/dist/runtime/docker/errors.mjs.map +1 -1
- package/dist/runtime/docker/exec.mjs +21 -18
- package/dist/runtime/docker/exec.mjs.map +1 -1
- package/dist/runtime/docker/image.mjs +36 -13
- package/dist/runtime/docker/image.mjs.map +1 -1
- package/dist/runtime/docker/index.mjs +14 -0
- package/dist/runtime/docker/inspect-and-decode.mjs +51 -0
- package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -0
- package/dist/runtime/docker/inventory.mjs +14 -11
- package/dist/runtime/docker/inventory.mjs.map +1 -1
- package/dist/runtime/docker/labels.mjs +38 -5
- package/dist/runtime/docker/labels.mjs.map +1 -1
- package/dist/runtime/docker/logs.d.mts +1 -1
- package/dist/runtime/docker/logs.mjs.map +1 -1
- package/dist/runtime/docker/network.mjs +83 -47
- package/dist/runtime/docker/network.mjs.map +1 -1
- package/dist/runtime/docker/render-run-args.mjs +82 -0
- package/dist/runtime/docker/render-run-args.mjs.map +1 -0
- package/dist/runtime/docker/service.d.mts +1 -1
- package/dist/runtime/docker/service.mjs +12 -7
- package/dist/runtime/docker/service.mjs.map +1 -1
- package/dist/runtime/docker/sweep.mjs +118 -43
- package/dist/runtime/docker/sweep.mjs.map +1 -1
- package/dist/runtime/docker/volume.mjs +2 -0
- package/dist/runtime/docker/volume.mjs.map +1 -1
- package/dist/runtime/docker/wrap.mjs +30 -1
- package/dist/runtime/docker/wrap.mjs.map +1 -1
- package/dist/substrate/cross-process.mjs +14 -8
- package/dist/substrate/cross-process.mjs.map +1 -1
- package/dist/substrate/event-time.mjs +33 -0
- package/dist/substrate/event-time.mjs.map +1 -0
- package/dist/substrate/events.d.mts +28 -8
- package/dist/substrate/identity.d.mts +2 -1
- package/dist/substrate/manifest.d.mts +68 -5
- package/dist/substrate/manifest.mjs +34 -5
- package/dist/substrate/manifest.mjs.map +1 -1
- package/dist/substrate/network.d.mts +3 -5
- package/dist/substrate/options.d.mts +0 -2
- package/dist/substrate/plugin.d.mts +13 -0
- package/dist/substrate/plugin.mjs +4 -2
- package/dist/substrate/plugin.mjs.map +1 -1
- package/dist/substrate/projection.d.mts +35 -3
- package/dist/substrate/runtime/artifact-publisher/index.mjs +19 -9
- package/dist/substrate/runtime/artifact-publisher/index.mjs.map +1 -1
- package/dist/substrate/runtime/atomic-write.mjs +97 -32
- package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
- package/dist/substrate/runtime/cache/index.mjs +3 -0
- package/dist/substrate/runtime/cache/schema.mjs +2 -2
- package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
- package/dist/substrate/runtime/cache/service.mjs +9 -7
- package/dist/substrate/runtime/cache/service.mjs.map +1 -1
- package/dist/substrate/runtime/capability-sinks/index.d.mts +1 -1
- package/dist/substrate/runtime/capability-sinks/index.mjs +3 -0
- package/dist/substrate/runtime/capability-sinks/layer.mjs +1 -1
- package/dist/substrate/runtime/capability-sinks/service.d.mts +61 -2
- package/dist/substrate/runtime/capability-sinks/service.mjs +21 -26
- package/dist/substrate/runtime/capability-sinks/service.mjs.map +1 -1
- package/dist/substrate/runtime/config-validation.d.mts +1 -13
- package/dist/substrate/runtime/config-validation.mjs +2 -91
- package/dist/substrate/runtime/config-validation.mjs.map +1 -1
- package/dist/substrate/runtime/container-runtime.d.mts +1 -0
- package/dist/substrate/runtime/container-runtime.mjs +2 -0
- package/dist/substrate/runtime/control-plane/domain.mjs +101 -0
- package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -0
- package/dist/substrate/runtime/control-plane/service.mjs +7 -0
- package/dist/substrate/runtime/control-plane/service.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +46 -19
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs +30 -12
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/index.mjs +5 -0
- package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs +11 -2
- package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs +1 -1
- package/dist/substrate/runtime/cross-process/index.mjs +11 -0
- package/dist/substrate/runtime/cross-process/live-clock.mjs +34 -0
- package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/liveness.mjs +52 -10
- package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/lock.d.mts +1 -0
- package/dist/substrate/runtime/cross-process/lock.mjs +23 -0
- package/dist/substrate/runtime/cross-process/lock.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +64 -0
- package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/roster.mjs +97 -83
- package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/self-pid.mjs +8 -0
- package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +24 -28
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/stack-lock.mjs +41 -20
- package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
- package/dist/substrate/runtime/current-plugin.mjs +2 -2
- package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
- package/dist/substrate/runtime/errors.mjs +12 -6
- package/dist/substrate/runtime/errors.mjs.map +1 -1
- package/dist/substrate/runtime/format-unknown-error.mjs +30 -0
- package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -0
- package/dist/substrate/runtime/host-bind-mount-owner.mjs +10 -0
- package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -0
- package/dist/substrate/runtime/host-gateway.mjs +20 -0
- package/dist/substrate/runtime/host-gateway.mjs.map +1 -0
- package/dist/substrate/runtime/host-tree-tar/index.mjs +61 -50
- package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
- package/dist/substrate/runtime/http-probe.d.mts +1 -1
- package/dist/substrate/runtime/index.mjs +14 -0
- package/dist/substrate/runtime/lease-broker/index.d.mts +1 -1
- package/dist/substrate/runtime/lease-broker/index.mjs +2 -0
- package/dist/substrate/runtime/lease-broker/service.d.mts +1 -64
- package/dist/substrate/runtime/lease-broker/service.mjs +1 -1
- package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs +22 -3
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/index.mjs +9 -0
- package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +20 -3
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/selective-restart.mjs +1 -1
- package/dist/substrate/runtime/lifecycle/signals.mjs +5 -5
- package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/state-machine.mjs +1 -1
- package/dist/substrate/runtime/managed-container.d.mts +19 -1
- package/dist/substrate/runtime/managed-container.mjs +20 -1
- package/dist/substrate/runtime/managed-container.mjs.map +1 -1
- package/dist/substrate/runtime/manifest/index.mjs +3 -0
- package/dist/substrate/runtime/manifest/manifest.mjs +15 -11
- package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
- package/dist/substrate/runtime/mode-errors.mjs +20 -0
- package/dist/substrate/runtime/mode-errors.mjs.map +1 -0
- package/dist/substrate/runtime/observability/cascade-formatter.mjs +9 -13
- package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
- package/dist/substrate/runtime/observability/formatter-registry.mjs +19 -36
- package/dist/substrate/runtime/observability/formatter-registry.mjs.map +1 -1
- package/dist/substrate/runtime/observability/ignore-with-log.d.mts +1 -0
- package/dist/substrate/runtime/observability/ignore-with-log.mjs +17 -0
- package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -0
- package/dist/substrate/runtime/observability/index.d.mts +1 -1
- package/dist/substrate/runtime/observability/index.mjs +13 -0
- package/dist/substrate/runtime/observability/log-store.d.mts +1 -0
- package/dist/substrate/runtime/observability/log-store.mjs +175 -0
- package/dist/substrate/runtime/observability/log-store.mjs.map +1 -0
- package/dist/substrate/runtime/observability/logger.d.mts +2 -1
- package/dist/substrate/runtime/observability/logger.mjs +5 -9
- package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
- package/dist/substrate/runtime/observability/output-truncate.mjs +35 -0
- package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -0
- package/dist/substrate/runtime/observability/pretty-error.mjs +9 -12
- package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
- package/dist/substrate/runtime/observability/redaction.d.mts +2 -13
- package/dist/substrate/runtime/observability/redaction.mjs +8 -14
- package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
- package/dist/substrate/runtime/observability/span-store.d.mts +1 -0
- package/dist/substrate/runtime/observability/span-store.mjs +110 -0
- package/dist/substrate/runtime/observability/span-store.mjs.map +1 -0
- package/dist/substrate/runtime/observability/spans.mjs +14 -14
- package/dist/substrate/runtime/observability/spans.mjs.map +1 -1
- package/dist/substrate/runtime/observability/subprocess-capture.mjs +1 -1
- package/dist/substrate/runtime/passthrough-or-wrap.mjs +33 -0
- package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -0
- package/dist/substrate/runtime/paths.d.mts +1 -1
- package/dist/substrate/runtime/paths.mjs +4 -3
- package/dist/substrate/runtime/paths.mjs.map +1 -1
- package/dist/substrate/runtime/phase-preserving-produce.mjs +40 -0
- package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -0
- package/dist/substrate/runtime/port-broker/index.mjs +3 -0
- package/dist/substrate/runtime/port-broker/service.mjs +170 -126
- package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
- package/dist/substrate/runtime/post-acquire-tasks.mjs +1 -1
- package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
- package/dist/substrate/runtime/probes.d.mts +7 -5
- package/dist/substrate/runtime/probes.mjs +3 -1
- package/dist/substrate/runtime/probes.mjs.map +1 -1
- package/dist/substrate/runtime/projection/index.mjs +4 -0
- package/dist/substrate/runtime/projection/operational-endpoints.mjs +1 -2
- package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
- package/dist/substrate/runtime/projection/persisted.mjs +33 -15
- package/dist/substrate/runtime/projection/persisted.mjs.map +1 -1
- package/dist/substrate/runtime/projection/state-ref.mjs +26 -2
- package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
- package/dist/substrate/runtime/projection/update.mjs +88 -24
- package/dist/substrate/runtime/projection/update.mjs.map +1 -1
- package/dist/substrate/runtime/random-suffix.mjs +11 -0
- package/dist/substrate/runtime/random-suffix.mjs.map +1 -0
- package/dist/substrate/runtime/retry-policy.d.mts +59 -1
- package/dist/substrate/runtime/retry-policy.mjs +66 -1
- package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
- package/dist/substrate/runtime/routed-url.d.mts +1 -0
- package/dist/substrate/runtime/routed-url.mjs +79 -0
- package/dist/substrate/runtime/routed-url.mjs.map +1 -0
- package/dist/substrate/runtime/runtime-decode.d.mts +1 -1
- package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
- package/dist/substrate/runtime/scoped-http-server.mjs +2 -3
- package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
- package/dist/substrate/runtime/scoped-multimap/index.mjs +2 -0
- package/dist/substrate/runtime/scoped-multimap/service.mjs +52 -0
- package/dist/substrate/runtime/scoped-multimap/service.mjs.map +1 -0
- package/dist/substrate/runtime/scoped-ref-map/index.mjs +2 -0
- package/dist/substrate/runtime/scoped-ref-map/service.mjs +2 -2
- package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +1 -1
- package/dist/substrate/runtime/stage-and-swap/index.mjs +72 -4
- package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
- package/dist/substrate/runtime/state-store/index.d.mts +1 -0
- package/dist/substrate/runtime/state-store/index.mjs +3 -0
- package/dist/substrate/runtime/state-store/schema.d.mts +1 -0
- package/dist/substrate/runtime/state-store/schema.mjs +19 -14
- package/dist/substrate/runtime/state-store/schema.mjs.map +1 -1
- package/dist/substrate/runtime/state-store/service.d.mts +1 -0
- package/dist/substrate/runtime/state-store/service.mjs +145 -0
- package/dist/substrate/runtime/state-store/service.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.d.mts +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs +33 -0
- package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs +1 -1
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
- package/dist/substrate/runtime/strategy-registry/index.mjs +4 -0
- package/dist/substrate/runtime/strategy-registry/service.mjs +19 -33
- package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
- package/dist/substrate/runtime/subnet-broker.mjs +60 -0
- package/dist/substrate/runtime/subnet-broker.mjs.map +1 -0
- package/dist/substrate/runtime/sui-execute/index.d.mts +21 -1
- package/dist/substrate/runtime/sui-execute/index.mjs +84 -20
- package/dist/substrate/runtime/sui-execute/index.mjs.map +1 -1
- package/dist/substrate/runtime/sui-execute/sign-and-dispatch.d.mts +1 -0
- package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs +32 -0
- package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +1 -0
- package/dist/substrate/runtime/sui-ledger/object-ref.mjs +32 -0
- package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +1 -0
- package/dist/substrate/runtime/sui-move-build/index.mjs +93 -19
- package/dist/substrate/runtime/sui-move-build/index.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/acquire-node.mjs +181 -0
- package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/background-tasks.mjs +144 -0
- package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/command-loop.mjs +68 -0
- package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +151 -0
- package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/errors.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/errors.mjs +9 -0
- package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/index.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/index.mjs +3 -0
- package/dist/substrate/runtime/supervisor/shutdown.mjs +51 -0
- package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/start-supervisor.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/start-supervisor.mjs +250 -0
- package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/state.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/state.mjs +22 -0
- package/dist/substrate/runtime/supervisor/state.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/teardown.mjs +57 -0
- package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/types.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/wiring.mjs +133 -0
- package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -0
- package/dist/substrate/runtime/typed-env.mjs +8 -0
- package/dist/substrate/runtime/typed-env.mjs.map +1 -0
- package/dist/substrate/state-store.d.mts +1 -0
- package/dist/substrate/versioned-doc-schema.mjs +17 -0
- package/dist/substrate/versioned-doc-schema.mjs.map +1 -0
- package/dist/substrate/versioned-doc-sync.mjs +94 -0
- package/dist/substrate/versioned-doc-sync.mjs.map +1 -0
- package/dist/surfaces/cli/command-tree.mjs.map +1 -1
- package/dist/surfaces/cli/commands/index.mjs +9 -0
- package/dist/surfaces/cli/commands/prune-picker-entry.mjs +13 -0
- package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -0
- package/dist/surfaces/cli/commands/prune-picker.mjs +3 -2
- package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
- package/dist/surfaces/cli/commands/prune.mjs +34 -17
- package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
- package/dist/surfaces/cli/commands/status.mjs +2 -2
- package/dist/surfaces/cli/commands/status.mjs.map +1 -1
- package/dist/surfaces/cli/commands/supervisor-presence.mjs +5 -3
- package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
- package/dist/surfaces/cli/commands/wipe.mjs +38 -4
- package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
- package/dist/surfaces/cli/errors.mjs +1 -1
- package/dist/surfaces/cli/errors.mjs.map +1 -1
- package/dist/surfaces/cli/flags.mjs +0 -1
- package/dist/surfaces/cli/flags.mjs.map +1 -1
- package/dist/surfaces/cli/index.mjs +98 -18
- package/dist/surfaces/cli/index.mjs.map +1 -1
- package/dist/surfaces/cli/output.mjs +1 -0
- package/dist/surfaces/cli/output.mjs.map +1 -1
- package/dist/surfaces/cli/sysexits.mjs +2 -1
- package/dist/surfaces/cli/sysexits.mjs.map +1 -1
- package/dist/surfaces/tui/app.mjs +25 -3
- package/dist/surfaces/tui/app.mjs.map +1 -1
- package/dist/surfaces/tui/display-derivation.mjs +23 -74
- package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
- package/dist/surfaces/tui/event-log.mjs +35 -23
- package/dist/surfaces/tui/event-log.mjs.map +1 -1
- package/dist/surfaces/tui/input.mjs +5 -1
- package/dist/surfaces/tui/input.mjs.map +1 -1
- package/dist/surfaces/tui/plain-renderer.mjs +70 -34
- package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
- package/package.json +24 -4
- package/dist/contracts/liveness-classifier.d.mts +0 -19
- package/dist/contracts/network-resolver.d.mts +0 -15
- package/dist/contracts/network-resolver.mjs +0 -7
- package/dist/contracts/network-resolver.mjs.map +0 -1
- package/dist/orchestrators/codegen/extras.mjs +0 -16
- package/dist/orchestrators/codegen/extras.mjs.map +0 -1
- package/dist/plugins/deepbook/routable.mjs +0 -21
- package/dist/plugins/deepbook/routable.mjs.map +0 -1
- package/dist/plugins/faucet/service.d.mts +0 -20
- package/dist/plugins/faucet/strategies/sui-local.d.mts +0 -23
- package/dist/plugins/faucet/strategies/sui-local.mjs.map +0 -1
- package/dist/plugins/sui/seed-objects.d.mts +0 -18
- package/dist/plugins/sui/seed-objects.mjs +0 -25
- package/dist/plugins/sui/seed-objects.mjs.map +0 -1
- package/dist/runtime/built-in-plugin-layers.mjs.map +0 -1
- package/dist/substrate/runtime/context-helpers.mjs +0 -32
- package/dist/substrate/runtime/context-helpers.mjs.map +0 -1
- package/dist/substrate/runtime/run.mjs.map +0 -1
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs +0 -30
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs.map +0 -1
- package/dist/substrate/runtime/supervisor.d.mts +0 -1
- package/dist/substrate/runtime/supervisor.mjs +0 -831
- package/dist/substrate/runtime/supervisor.mjs.map +0 -1
- package/dist/surfaces/cli/commands/doctor-probes.mjs.map +0 -1
- /package/dist/{substrate/runtime/strategy-registry/faucet-capability-for.d.mts → plugins/faucet/http.d.mts} +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
//#region src/plugins/internal/codegen-helpers.ts
|
|
3
|
+
const defineSimpleConstExport = (spec) => ({
|
|
4
|
+
kind: "codegenable",
|
|
5
|
+
emitterName: spec.emitterName,
|
|
6
|
+
outputPath: spec.outputPath,
|
|
7
|
+
sensitive: spec.sensitive ?? false,
|
|
8
|
+
...spec.aggregate ? { aggregate: spec.aggregate } : {},
|
|
9
|
+
emit: (ctx) => Effect.gen(function* () {
|
|
10
|
+
if (spec.preEmit) yield* spec.preEmit;
|
|
11
|
+
ctx.exportConst(spec.exportName, spec.value);
|
|
12
|
+
return ctx.done();
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
//#endregion
|
|
16
|
+
export { defineSimpleConstExport };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=codegen-helpers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codegen-helpers.mjs","names":[],"sources":["../../../src/plugins/internal/codegen-helpers.ts"],"sourcesContent":["// Internal plugin helpers — codegen shape factories.\n//\n// `defineSimpleConstExport` collapses the duplicated `CodegenableDecl`\n// boilerplate shared by `coin/codegen.ts`, `wallet/codegen.ts`, and\n// `account/codegen.ts`. Each of those plugins emits one file containing\n// exactly one `export const` from a resolved value record, optionally\n// joining a cross-decl aggregate bucket and optionally running a\n// pre-emit Effect (e.g. span annotation) before writing.\n//\n// Internal to this package — not re-exported from the root barrel.\n\nimport { Effect } from 'effect';\n\nimport type {\n\tAggregateContribution,\n\tCodegenableDecl,\n} from '../../contracts/codegenable.ts';\n\n/** Spec for a `CodegenableDecl` that emits a single `export const`.\n *\n * `Emitter` is preserved as a generic so plugins that template the\n * emitter name (e.g. `coin/${symbol}`, `account/${name}`) keep their\n * literal-typed emission identity. */\nexport interface SimpleConstExportSpec<Emitter extends string, Value> {\n\treadonly emitterName: Emitter;\n\treadonly outputPath: string;\n\treadonly exportName: string;\n\treadonly value: Value;\n\treadonly sensitive?: boolean;\n\treadonly aggregate?: AggregateContribution;\n\t/** Optional Effect run before the `exportConst` write — used by the\n\t * wallet plugin to annotate the current span with a redacted form\n\t * of the emitted value. Runs inside the emit Effect so the\n\t * annotation lands on the codegen span. */\n\treadonly preEmit?: Effect.Effect<void>;\n}\n\nexport const defineSimpleConstExport = <Emitter extends string, Value>(\n\tspec: SimpleConstExportSpec<Emitter, Value>,\n): CodegenableDecl<Emitter> => ({\n\tkind: 'codegenable',\n\temitterName: spec.emitterName,\n\toutputPath: spec.outputPath,\n\tsensitive: spec.sensitive ?? false,\n\t...(spec.aggregate ? { aggregate: spec.aggregate } : {}),\n\temit: (ctx) =>\n\t\tEffect.gen(function* () {\n\t\t\tif (spec.preEmit) {\n\t\t\t\tyield* spec.preEmit;\n\t\t\t}\n\t\t\tctx.exportConst(spec.exportName, spec.value);\n\t\t\treturn ctx.done();\n\t\t}),\n});\n"],"mappings":";;AAqCA,MAAa,2BACZ,UAC+B;CAC/B,MAAM;CACN,aAAa,KAAK;CAClB,YAAY,KAAK;CACjB,WAAW,KAAK,aAAa;CAC7B,GAAI,KAAK,YAAY,EAAE,WAAW,KAAK,WAAW,GAAG,EAAE;CACvD,OAAO,QACN,OAAO,IAAI,aAAa;AACvB,MAAI,KAAK,QACR,QAAO,KAAK;AAEb,MAAI,YAAY,KAAK,YAAY,KAAK,MAAM;AAC5C,SAAO,IAAI,MAAM;GAChB;CACH"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { accountAcquireError } from "../account/errors.mjs";
|
|
2
|
+
//#region src/plugins/internal/funding-failure-error.ts
|
|
3
|
+
const extractTag = (cause) => typeof cause === "object" && cause !== null && "_tag" in cause ? String(cause._tag) : "unknown";
|
|
4
|
+
const FUND_DEFAULT_HINT = "See the cause chain — typical roots are the faucet container not yet ready (FaucetUnreachable), the wall-clock budget elapsed (FaucetExhausted), or the body returned Failure (FaucetBodyError).";
|
|
5
|
+
const FUND_CROSS_CUTTING_HINT = "Cross-cutting funding requires the matching strategy to be registered at the time of acquire — check the plugin that contributes this coin and any `via` dependency.";
|
|
6
|
+
/** Build the `AccountAcquireError` for a funding strategy request that
|
|
7
|
+
* failed. The message and hint are templated from `phase`; the tag is
|
|
8
|
+
* extracted from the cause's `_tag` field (falling back to
|
|
9
|
+
* `'unknown'`). */
|
|
10
|
+
const fundingFailureError = (spec) => {
|
|
11
|
+
if (spec.phase === "fund-default") return accountAcquireError({
|
|
12
|
+
phase: "fund-default",
|
|
13
|
+
accountName: spec.accountName,
|
|
14
|
+
variant: spec.variant,
|
|
15
|
+
message: `Account '${spec.accountName}': faucet strategy request failed for chain '${spec.chainId}' (tag=${spec.cause._tag}).`,
|
|
16
|
+
cause: spec.cause,
|
|
17
|
+
hint: FUND_DEFAULT_HINT
|
|
18
|
+
});
|
|
19
|
+
const tag = extractTag(spec.cause);
|
|
20
|
+
return accountAcquireError({
|
|
21
|
+
phase: "fund-cross-cutting",
|
|
22
|
+
accountName: spec.accountName,
|
|
23
|
+
variant: spec.variant,
|
|
24
|
+
message: `Account '${spec.accountName}': cross-cutting funding failed for coin (key='${spec.key}') amount=${spec.amount} (tag=${tag}).`,
|
|
25
|
+
cause: spec.cause,
|
|
26
|
+
hint: FUND_CROSS_CUTTING_HINT
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { fundingFailureError };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=funding-failure-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"funding-failure-error.mjs","names":[],"sources":["../../../src/plugins/internal/funding-failure-error.ts"],"sourcesContent":["// Internal plugin helpers — funding-failure error envelope.\n//\n// `fundingFailureError` collapses the two near-identical\n// `accountAcquireError` builds in `plugins/account/funding.ts` that wrap\n// a strategy `request(...)` failure during funding:\n//\n// - `fund-default` — the ephemeral-account SUI faucet path\n// (the `wrapFaucetFailure` site).\n// - `fund-cross-cutting` — the per-coin cross-cutting path\n// (the `wrapCrossCuttingFailure` site).\n//\n// Both sites produced an `AccountAcquireError` with the same shape\n// (`phase`, `accountName`, `variant`, `cause`, `message`, `hint`), the\n// same `(tag=...)` suffix extracted from the cause, and a phase-specific\n// hint. This helper centralizes the tag extraction and the phase →\n// (message-template, hint) mapping so the call sites collapse to a\n// single line each.\n//\n// Internal to this package — not re-exported from the root barrel.\n\nimport {\n\taccountAcquireError,\n\ttype AccountAcquireError,\n\ttype AccountVariantKind,\n} from '../account/errors.ts';\n\n/** Discriminated spec for `fundingFailureError`. Each phase carries\n * the identifying fields it needs to preserve byte-identical message\n * output with the original inline builders in `funding.ts`. */\nexport type FundingFailureErrorSpec =\n\t| {\n\t\t\treadonly phase: 'fund-default';\n\t\t\treadonly accountName: string;\n\t\t\treadonly variant: AccountVariantKind;\n\t\t\t/** Chain id the faucet strategy was keyed on. */\n\t\t\treadonly chainId: string;\n\t\t\treadonly cause: { readonly _tag: string };\n\t }\n\t| {\n\t\t\treadonly phase: 'fund-cross-cutting';\n\t\t\treadonly accountName: string;\n\t\t\treadonly variant: AccountVariantKind;\n\t\t\t/** Strategy-registry key the request was routed through —\n\t\t\t * `faucet:request:<chainId>` for SUI entries or\n\t\t\t * `coinType:<fullCoinType>` for other entries. */\n\t\t\treadonly key: string;\n\t\t\treadonly amount: bigint;\n\t\t\treadonly cause: unknown;\n\t };\n\nconst extractTag = (cause: unknown): string =>\n\ttypeof cause === 'object' && cause !== null && '_tag' in cause\n\t\t? String((cause as { readonly _tag?: unknown })._tag)\n\t\t: 'unknown';\n\nconst FUND_DEFAULT_HINT =\n\t'See the cause chain — typical roots are the faucet container ' +\n\t'not yet ready (FaucetUnreachable), the wall-clock budget elapsed ' +\n\t'(FaucetExhausted), or the body returned Failure (FaucetBodyError).';\n\nconst FUND_CROSS_CUTTING_HINT =\n\t'Cross-cutting funding requires the matching strategy ' +\n\t'to be registered at the time of acquire — check the ' +\n\t'plugin that contributes this coin and any `via` dependency.';\n\n/** Build the `AccountAcquireError` for a funding strategy request that\n * failed. The message and hint are templated from `phase`; the tag is\n * extracted from the cause's `_tag` field (falling back to\n * `'unknown'`). */\nexport const fundingFailureError = (spec: FundingFailureErrorSpec): AccountAcquireError => {\n\tif (spec.phase === 'fund-default') {\n\t\treturn accountAcquireError({\n\t\t\tphase: 'fund-default',\n\t\t\taccountName: spec.accountName,\n\t\t\tvariant: spec.variant,\n\t\t\tmessage:\n\t\t\t\t`Account '${spec.accountName}': faucet strategy request failed ` +\n\t\t\t\t`for chain '${spec.chainId}' (tag=${spec.cause._tag}).`,\n\t\t\tcause: spec.cause,\n\t\t\thint: FUND_DEFAULT_HINT,\n\t\t});\n\t}\n\tconst tag = extractTag(spec.cause);\n\treturn accountAcquireError({\n\t\tphase: 'fund-cross-cutting',\n\t\taccountName: spec.accountName,\n\t\tvariant: spec.variant,\n\t\tmessage:\n\t\t\t`Account '${spec.accountName}': cross-cutting funding ` +\n\t\t\t`failed for coin (key='${spec.key}') amount=${spec.amount} ` +\n\t\t\t`(tag=${tag}).`,\n\t\tcause: spec.cause,\n\t\thint: FUND_CROSS_CUTTING_HINT,\n\t});\n};\n"],"mappings":";;AAkDA,MAAM,cAAc,UACnB,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,QACtD,OAAQ,MAAsC,KAAK,GACnD;AAEJ,MAAM,oBACL;AAID,MAAM,0BACL;;;;;AAQD,MAAa,uBAAuB,SAAuD;AAC1F,KAAI,KAAK,UAAU,eAClB,QAAO,oBAAoB;EAC1B,OAAO;EACP,aAAa,KAAK;EAClB,SAAS,KAAK;EACd,SACC,YAAY,KAAK,YAAY,+CACf,KAAK,QAAQ,SAAS,KAAK,MAAM,KAAK;EACrD,OAAO,KAAK;EACZ,MAAM;EACN,CAAC;CAEH,MAAM,MAAM,WAAW,KAAK,MAAM;AAClC,QAAO,oBAAoB;EAC1B,OAAO;EACP,aAAa,KAAK;EAClB,SAAS,KAAK;EACd,SACC,YAAY,KAAK,YAAY,iDACJ,KAAK,IAAI,YAAY,KAAK,OAAO,QAClD,IAAI;EACb,OAAO,KAAK;EACZ,MAAM;EACN,CAAC"}
|
|
@@ -9,7 +9,7 @@ const toPublishError = (err) => publishError(err.phase, {
|
|
|
9
9
|
...err.cause !== void 0 ? { cause: err.cause } : { cause: err }
|
|
10
10
|
});
|
|
11
11
|
const hashMoveSources = (sourcePath) => hashMoveSources$1(sourcePath).pipe(Effect.mapError(toPublishError));
|
|
12
|
-
const scrubLocksHost = (sourcePath, moveHomeRoot
|
|
12
|
+
const scrubLocksHost = (sourcePath, moveHomeRoot) => scrubLocksHost$1(sourcePath, moveHomeRoot).pipe(Effect.mapError(toPublishError));
|
|
13
13
|
const runMoveBuild = (inputs) => runMoveBuild$1({
|
|
14
14
|
sourcePath: inputs.sourcePath,
|
|
15
15
|
packageName: inputs.packageName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.mjs","names":["hashMoveSourcesNeutral","scrubLocksHostNeutral","runMoveBuildNeutral"],"sources":["../../../src/plugins/package/build.ts"],"sourcesContent":["// Package plugin
|
|
1
|
+
{"version":3,"file":"build.mjs","names":["hashMoveSourcesNeutral","scrubLocksHostNeutral","runMoveBuildNeutral"],"sources":["../../../src/plugins/package/build.ts"],"sourcesContent":["// Package plugin bridge for shared Sui Move build helpers.\n\nimport { Effect, type Scope } from 'effect';\n\nimport type { ContainerRuntime, ImageRef } from '../../contracts/container-runtime.ts';\nimport type { ChainId, ContentHash } from '../../substrate/brand.ts';\nimport {\n\thashMoveSources as hashMoveSourcesNeutral,\n\trunMoveBuild as runMoveBuildNeutral,\n\tscrubLocksHost as scrubLocksHostNeutral,\n\ttype BuildOutput,\n\ttype MoveBuildError,\n\ttype MoveBuildContainer,\n} from '../../substrate/runtime/sui-move-build/index.ts';\nimport type { ChainBuildContainer } from '../sui/index.ts';\nimport { publishError, type PublishError } from './errors.ts';\n\nexport {\n\tcontainerInnerScript,\n\textractTrailingJson,\n\tparseBuildOutput,\n\tstripPinnedSections,\n\ttype MoveBuildContainer,\n\ttype MoveBuildError,\n\ttype MoveBuildPhase,\n\ttype MoveBuildInput,\n\ttype MoveBuildOutput,\n} from '../../substrate/runtime/sui-move-build/index.ts';\nexport type { BuildOutput };\n\nexport interface BuildInputs {\n\treadonly sourcePath: string;\n\treadonly packageName: string;\n\treadonly chainId: ChainId;\n\treadonly buildContainer?: ChainBuildContainer;\n\treadonly runtime?: ContainerRuntime;\n\treadonly buildImage?: ImageRef;\n}\n\nconst toPublishError = (err: MoveBuildError): PublishError =>\n\tpublishError(err.phase, {\n\t\tsourcePath: err.sourcePath,\n\t\tpackageName: err.packageName,\n\t\tmessage: err.message,\n\t\t...(err.cause !== undefined ? { cause: err.cause } : { cause: err }),\n\t});\n\nexport const hashMoveSources = (sourcePath: string): Effect.Effect<ContentHash, PublishError> =>\n\thashMoveSourcesNeutral(sourcePath).pipe(Effect.mapError(toPublishError));\n\nexport const scrubLocksHost = (\n\tsourcePath: string,\n\tmoveHomeRoot: string,\n): Effect.Effect<void, PublishError, Scope.Scope> =>\n\tscrubLocksHostNeutral(sourcePath, moveHomeRoot).pipe(Effect.mapError(toPublishError));\n\nexport const runMoveBuild = (\n\tinputs: BuildInputs,\n): Effect.Effect<BuildOutput, PublishError, Scope.Scope> =>\n\trunMoveBuildNeutral({\n\t\tsourcePath: inputs.sourcePath,\n\t\tpackageName: inputs.packageName,\n\t\tchainId: inputs.chainId,\n\t\t...(inputs.buildContainer !== undefined\n\t\t\t? { buildContainer: inputs.buildContainer satisfies MoveBuildContainer }\n\t\t\t: {}),\n\t\t...(inputs.runtime !== undefined ? { runtime: inputs.runtime } : {}),\n\t\t...(inputs.buildImage !== undefined ? { buildImage: inputs.buildImage } : {}),\n\t}).pipe(Effect.mapError(toPublishError));\n"],"mappings":";;;;AAuCA,MAAM,kBAAkB,QACvB,aAAa,IAAI,OAAO;CACvB,YAAY,IAAI;CAChB,aAAa,IAAI;CACjB,SAAS,IAAI;CACb,GAAI,IAAI,UAAU,KAAA,IAAY,EAAE,OAAO,IAAI,OAAO,GAAG,EAAE,OAAO,KAAK;CACnE,CAAC;AAEH,MAAa,mBAAmB,eAC/BA,kBAAuB,WAAW,CAAC,KAAK,OAAO,SAAS,eAAe,CAAC;AAEzE,MAAa,kBACZ,YACA,iBAEAC,iBAAsB,YAAY,aAAa,CAAC,KAAK,OAAO,SAAS,eAAe,CAAC;AAEtF,MAAa,gBACZ,WAEAC,eAAoB;CACnB,YAAY,OAAO;CACnB,aAAa,OAAO;CACpB,SAAS,OAAO;CAChB,GAAI,OAAO,mBAAmB,KAAA,IAC3B,EAAE,gBAAgB,OAAO,gBAA6C,GACtE,EAAE;CACL,GAAI,OAAO,YAAY,KAAA,IAAY,EAAE,SAAS,OAAO,SAAS,GAAG,EAAE;CACnE,GAAI,OAAO,eAAe,KAAA,IAAY,EAAE,YAAY,OAAO,YAAY,GAAG,EAAE;CAC5E,CAAC,CAAC,KAAK,OAAO,SAAS,eAAe,CAAC"}
|
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
//#region src/plugins/package/codegen.ts
|
|
3
|
+
/** Type guard for the `packageBindings` shape emitted into the
|
|
4
|
+
* CodegenEmitContext below. Lives in the plugin so the codegen
|
|
5
|
+
* orchestrator never has to recognize the shape — it only calls
|
|
6
|
+
* the projector. */
|
|
7
|
+
const isPackageBindings = (v) => typeof v === "object" && v !== null && "name" in v && "packageId" in v && "mvrPlaceholder" in v && "sourcePath" in v;
|
|
8
|
+
/** Aggregate projection: extract the `packageBindings` shape and key
|
|
9
|
+
* it by the package name into the cross-plugin `packages.ts`
|
|
10
|
+
* aggregate. The orchestrator stays name-blind; this projector
|
|
11
|
+
* owns the `packages.<name>` → `PackageBindings` mapping. */
|
|
12
|
+
const projectPackageBindings = (exported) => {
|
|
13
|
+
const bindings = exported["packageBindings"];
|
|
14
|
+
if (!isPackageBindings(bindings)) return null;
|
|
15
|
+
return { [bindings.name]: bindings };
|
|
16
|
+
};
|
|
3
17
|
/** Build the Codegenable contribution for a local package. */
|
|
4
18
|
const makeLocalCodegenable = (resolved, options) => ({
|
|
5
19
|
kind: "codegenable",
|
|
6
20
|
emitterName: "package",
|
|
7
21
|
outputPath: `package/${resolved.mvrPlaceholder}.ts`,
|
|
22
|
+
allowEmitterNameRepetition: true,
|
|
23
|
+
aggregate: {
|
|
24
|
+
kind: "package",
|
|
25
|
+
bucket: "packages.ts",
|
|
26
|
+
project: projectPackageBindings
|
|
27
|
+
},
|
|
8
28
|
emit: (ctx) => Effect.sync(() => {
|
|
9
29
|
ctx.exportConst("packageBindings", {
|
|
10
30
|
name: resolved.name,
|
|
@@ -24,6 +44,12 @@ const makeKnownCodegenable = (resolved) => ({
|
|
|
24
44
|
kind: "codegenable",
|
|
25
45
|
emitterName: "package",
|
|
26
46
|
outputPath: `package/${resolved.mvrPlaceholder}.ts`,
|
|
47
|
+
allowEmitterNameRepetition: true,
|
|
48
|
+
aggregate: {
|
|
49
|
+
kind: "package",
|
|
50
|
+
bucket: "packages.ts",
|
|
51
|
+
project: projectPackageBindings
|
|
52
|
+
},
|
|
27
53
|
emit: (ctx) => Effect.sync(() => {
|
|
28
54
|
ctx.exportConst("packageBindings", {
|
|
29
55
|
name: resolved.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.mjs","names":[],"sources":["../../../src/plugins/package/codegen.ts"],"sourcesContent":["// Package plugin — Codegenable contribution.\n//\n// Distilled doc §Outputs: \"Bindings input — the source path of every\n// local Package is read by the bindings emitter (KnownPackages\n// filtered out).\"\n//\n// The contribution emitted here is the LIGHTWEIGHT one: package id +\n// MVR placeholder + (for local packages) the source path the\n// bindings emitter consumes. The HEAVY codegen — `@mysten/codegen`\n// emitting typed function shims — happens in the codegen\n// ORCHESTRATOR (plugin/codegen layer, NOT this plugin). The\n// orchestrator walks every member's caps tuple, finds the\n// Package-emitted contributions, and dispatches `@mysten/codegen`\n// once across all of them so a single TS program references every\n// emitted package binding.\n//\n// This file therefore declares the SEAM, not the binding bytes.\n// Distilled doc §Cross-component references §codegen: package\n// \"consumes local Package source paths to emit bindings; respects\n// the per-package codegen-exclude flag; uses MVR placeholders so\n// emitted code stays portable.\"\n\nimport { Effect } from 'effect';\n\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\nimport type { ResolvedLocalPackage, ResolvedKnownPackage } from './registry.ts';\n\n/** Codegenable shape — what each Package contributes to the codegen\n * orchestrator. Two variants mirror the local/known split. */\nexport interface PackageBindings {\n\treadonly name: string;\n\treadonly packageId: string;\n\treadonly mvrPlaceholder: string;\n\t/** Present for local packages only — the bindings emitter reads\n\t * this; KnownPackages omit it and the orchestrator skips them\n\t * for bindings emission (compile-time enforcement at the\n\t * factory layer per distilled doc Invariant 9). */\n\treadonly sourcePath: string | null;\n\t/** Per-package opt-out (distilled doc §Inputs — \"Codegen\n\t * exclusion flag\"). */\n\treadonly excluded: boolean;\n}\n\n/** Build the Codegenable contribution for a local package. */\nexport const makeLocalCodegenable = (\n\tresolved: ResolvedLocalPackage,\n\toptions: { readonly excluded: boolean },\n): CodegenableDecl<'package'> => ({\n\tkind: 'codegenable',\n\temitterName: 'package',\n\toutputPath: `package/${resolved.mvrPlaceholder}.ts`,\n\temit: (ctx) =>\n\t\tEffect.sync(() => {\n\t\t\t// The orchestrator picks up these fields and threads them\n\t\t\t// into `@mysten/codegen` along with the source-path read.\n\t\t\t// The literal binding-file bytes are written by the\n\t\t\t// orchestrator, NOT this plugin.\n\t\t\tctx.exportConst('packageBindings', {\n\t\t\t\tname: resolved.name,\n\t\t\t\tpackageId: resolved.packageId,\n\t\t\t\tmvrPlaceholder: resolved.mvrPlaceholder,\n\t\t\t\tsourcePath: resolved.sourcePath,\n\t\t\t\texcluded: options.excluded,\n\t\t\t} satisfies PackageBindings);\n\t\t\treturn ctx.done();\n\t\t}),\n});\n\n/** Build the Codegenable contribution for a known package. The\n * shape is identical except `sourcePath: null`. The codegen\n * orchestrator filters these out before invoking the bindings\n * emitter. */\nexport const makeKnownCodegenable = (\n\tresolved: ResolvedKnownPackage,\n): CodegenableDecl<'package'> => ({\n\tkind: 'codegenable',\n\temitterName: 'package',\n\toutputPath: `package/${resolved.mvrPlaceholder}.ts`,\n\temit: (ctx) =>\n\t\tEffect.sync(() => {\n\t\t\tctx.exportConst('packageBindings', {\n\t\t\t\tname: resolved.name,\n\t\t\t\tpackageId: resolved.packageId,\n\t\t\t\tmvrPlaceholder: resolved.mvrPlaceholder,\n\t\t\t\tsourcePath: null,\n\t\t\t\texcluded: true, // implicit — KnownPackages never emit bindings.\n\t\t\t} satisfies PackageBindings);\n\t\t\treturn ctx.done();\n\t\t}),\n});\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"codegen.mjs","names":[],"sources":["../../../src/plugins/package/codegen.ts"],"sourcesContent":["// Package plugin — Codegenable contribution.\n//\n// Distilled doc §Outputs: \"Bindings input — the source path of every\n// local Package is read by the bindings emitter (KnownPackages\n// filtered out).\"\n//\n// The contribution emitted here is the LIGHTWEIGHT one: package id +\n// MVR placeholder + (for local packages) the source path the\n// bindings emitter consumes. The HEAVY codegen — `@mysten/codegen`\n// emitting typed function shims — happens in the codegen\n// ORCHESTRATOR (plugin/codegen layer, NOT this plugin). The\n// orchestrator walks every member's caps tuple, finds the\n// Package-emitted contributions, and dispatches `@mysten/codegen`\n// once across all of them so a single TS program references every\n// emitted package binding.\n//\n// This file therefore declares the SEAM, not the binding bytes.\n// Distilled doc §Cross-component references §codegen: package\n// \"consumes local Package source paths to emit bindings; respects\n// the per-package codegen-exclude flag; uses MVR placeholders so\n// emitted code stays portable.\"\n\nimport { Effect } from 'effect';\n\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\nimport type { ResolvedLocalPackage, ResolvedKnownPackage } from './registry.ts';\n\n/** Codegenable shape — what each Package contributes to the codegen\n * orchestrator. Two variants mirror the local/known split. */\nexport interface PackageBindings {\n\treadonly name: string;\n\treadonly packageId: string;\n\treadonly mvrPlaceholder: string;\n\t/** Present for local packages only — the bindings emitter reads\n\t * this; KnownPackages omit it and the orchestrator skips them\n\t * for bindings emission (compile-time enforcement at the\n\t * factory layer per distilled doc Invariant 9). */\n\treadonly sourcePath: string | null;\n\t/** Per-package opt-out (distilled doc §Inputs — \"Codegen\n\t * exclusion flag\"). */\n\treadonly excluded: boolean;\n}\n\n/** Type guard for the `packageBindings` shape emitted into the\n * CodegenEmitContext below. Lives in the plugin so the codegen\n * orchestrator never has to recognize the shape — it only calls\n * the projector. */\nexport const isPackageBindings = (v: unknown): v is PackageBindings =>\n\ttypeof v === 'object' &&\n\tv !== null &&\n\t'name' in v &&\n\t'packageId' in v &&\n\t'mvrPlaceholder' in v &&\n\t'sourcePath' in v;\n\n/** Aggregate projection: extract the `packageBindings` shape and key\n * it by the package name into the cross-plugin `packages.ts`\n * aggregate. The orchestrator stays name-blind; this projector\n * owns the `packages.<name>` → `PackageBindings` mapping. */\nconst projectPackageBindings = (\n\texported: Readonly<Record<string, unknown>>,\n): Readonly<Record<string, unknown>> | null => {\n\tconst bindings = exported['packageBindings'];\n\tif (!isPackageBindings(bindings)) return null;\n\treturn { [bindings.name]: bindings };\n};\n\n/** Build the Codegenable contribution for a local package. */\nexport const makeLocalCodegenable = (\n\tresolved: ResolvedLocalPackage,\n\toptions: { readonly excluded: boolean },\n): CodegenableDecl<'package'> => ({\n\tkind: 'codegenable',\n\temitterName: 'package',\n\toutputPath: `package/${resolved.mvrPlaceholder}.ts`,\n\t// One Package contribution per published package. The shared\n\t// `'package'` emitter name is by-design — the codegen orchestrator\n\t// skips its emitter-name uniqueness check for this flag.\n\tallowEmitterNameRepetition: true,\n\taggregate: {\n\t\tkind: 'package',\n\t\tbucket: 'packages.ts',\n\t\tproject: projectPackageBindings,\n\t},\n\temit: (ctx) =>\n\t\tEffect.sync(() => {\n\t\t\t// The orchestrator picks up these fields and threads them\n\t\t\t// into `@mysten/codegen` along with the source-path read.\n\t\t\t// The literal binding-file bytes are written by the\n\t\t\t// orchestrator, NOT this plugin.\n\t\t\tctx.exportConst('packageBindings', {\n\t\t\t\tname: resolved.name,\n\t\t\t\tpackageId: resolved.packageId,\n\t\t\t\tmvrPlaceholder: resolved.mvrPlaceholder,\n\t\t\t\tsourcePath: resolved.sourcePath,\n\t\t\t\texcluded: options.excluded,\n\t\t\t} satisfies PackageBindings);\n\t\t\treturn ctx.done();\n\t\t}),\n});\n\n/** Build the Codegenable contribution for a known package. The\n * shape is identical except `sourcePath: null`. The codegen\n * orchestrator filters these out before invoking the bindings\n * emitter. */\nexport const makeKnownCodegenable = (\n\tresolved: ResolvedKnownPackage,\n): CodegenableDecl<'package'> => ({\n\tkind: 'codegenable',\n\temitterName: 'package',\n\toutputPath: `package/${resolved.mvrPlaceholder}.ts`,\n\t// Mirrors `makeLocalCodegenable` — one Package contribution per\n\t// known package.\n\tallowEmitterNameRepetition: true,\n\taggregate: {\n\t\tkind: 'package',\n\t\tbucket: 'packages.ts',\n\t\tproject: projectPackageBindings,\n\t},\n\temit: (ctx) =>\n\t\tEffect.sync(() => {\n\t\t\tctx.exportConst('packageBindings', {\n\t\t\t\tname: resolved.name,\n\t\t\t\tpackageId: resolved.packageId,\n\t\t\t\tmvrPlaceholder: resolved.mvrPlaceholder,\n\t\t\t\tsourcePath: null,\n\t\t\t\texcluded: true, // implicit — KnownPackages never emit bindings.\n\t\t\t} satisfies PackageBindings);\n\t\t\treturn ctx.done();\n\t\t}),\n});\n"],"mappings":";;;;;;AA+CA,MAAa,qBAAqB,MACjC,OAAO,MAAM,YACb,MAAM,QACN,UAAU,KACV,eAAe,KACf,oBAAoB,KACpB,gBAAgB;;;;;AAMjB,MAAM,0BACL,aAC8C;CAC9C,MAAM,WAAW,SAAS;AAC1B,KAAI,CAAC,kBAAkB,SAAS,CAAE,QAAO;AACzC,QAAO,GAAG,SAAS,OAAO,UAAU;;;AAIrC,MAAa,wBACZ,UACA,aACiC;CACjC,MAAM;CACN,aAAa;CACb,YAAY,WAAW,SAAS,eAAe;CAI/C,4BAA4B;CAC5B,WAAW;EACV,MAAM;EACN,QAAQ;EACR,SAAS;EACT;CACD,OAAO,QACN,OAAO,WAAW;AAKjB,MAAI,YAAY,mBAAmB;GAClC,MAAM,SAAS;GACf,WAAW,SAAS;GACpB,gBAAgB,SAAS;GACzB,YAAY,SAAS;GACrB,UAAU,QAAQ;GAClB,CAA2B;AAC5B,SAAO,IAAI,MAAM;GAChB;CACH;;;;;AAMD,MAAa,wBACZ,cACiC;CACjC,MAAM;CACN,aAAa;CACb,YAAY,WAAW,SAAS,eAAe;CAG/C,4BAA4B;CAC5B,WAAW;EACV,MAAM;EACN,QAAQ;EACR,SAAS;EACT;CACD,OAAO,QACN,OAAO,WAAW;AACjB,MAAI,YAAY,mBAAmB;GAClC,MAAM,SAAS;GACf,WAAW,SAAS;GACpB,gBAAgB,SAAS;GACzB,YAAY;GACZ,UAAU;GACV,CAA2B;AAC5B,SAAO,IAAI,MAAM;GAChB;CACH"}
|
|
@@ -20,12 +20,22 @@ type PublishPhase = 'hash' | 'scrub' | 'build' | 'publish-tx' | 'parse' | 'verif
|
|
|
20
20
|
interface PublishError {
|
|
21
21
|
readonly _tag: 'PublishError';
|
|
22
22
|
readonly phase: PublishPhase;
|
|
23
|
-
/** Source path of the package being published.
|
|
24
|
-
* — `KnownPackage` paths set this
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
/** Source path of the package being published. Populated at every
|
|
24
|
+
* throw site that has it in scope — `KnownPackage` paths set this
|
|
25
|
+
* to the symbolic id; post-publish probe phases (e.g. the
|
|
26
|
+
* `postPublishReadyHint` step that only sees the on-chain `packageId`)
|
|
27
|
+
* pass `undefined`. The `mode-local` re-stamp pass back-fills
|
|
28
|
+
* from the outer `inputs.sourcePath` whenever it can. */
|
|
29
|
+
readonly sourcePath?: string | undefined;
|
|
30
|
+
/** Symbolic package name (the user-declared `pkg.name`). Optional
|
|
31
|
+
* because some throw sites (e.g. `postPublishReadyHint` in
|
|
32
|
+
* `publish-executor.ts`) only have the resolved on-chain
|
|
33
|
+
* `packageId` in scope; the `mode-local` re-stamp pass back-fills
|
|
34
|
+
* the symbolic name from `inputs.packageName` whenever it can.
|
|
35
|
+
* Throw sites MUST NOT overload this slot with the on-chain
|
|
36
|
+
* `packageId` — the symbolic name is what user-facing error
|
|
37
|
+
* displays expect. */
|
|
38
|
+
readonly packageName?: string | undefined;
|
|
29
39
|
readonly message: string;
|
|
30
40
|
readonly cause?: unknown;
|
|
31
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/plugins/package/errors.ts"],"sourcesContent":["// Package plugin — typed errors.\n//\n// Distilled doc §\"Edge cases and known failure modes\": the publish\n// error is a SINGLE tagged error with a CLOSED step set. Per\n// architecture §Effect, errors are plain interfaces with a `_tag`\n// discriminator; `Effect.catchTag` / `catchTags` match on the literal.\n\n/** Closed step set for `PublishError`.\n *\n * - `hash` — source-tree walk / digest failed (FS read perms,\n * symlink loop, disk error).\n * - `scrub` — vendored Move.lock scrub failed.\n * - `build` — `sui move build` exit / parse failure / container\n * unreachable. Cause-chain carries verbatim\n * stdout/stderr.\n * - `publish-tx` — sign-and-execute failed (gas, bytecode\n * verification, RPC).\n * - `parse` — no `published` change in receipt OR the\n * post-publish ready-probe timed out.\n * - `verify` — KnownPackage verify probe authoritatively says\n * \"object not present\" (transient is masked by\n * lenient probe — does NOT raise this).\n */\nexport type PublishPhase = 'hash' | 'scrub' | 'build' | 'publish-tx' | 'parse' | 'verify';\n\n/** Single tagged publish error. */\nexport interface PublishError {\n\treadonly _tag: 'PublishError';\n\treadonly phase: PublishPhase;\n\t/** Source path of the package being published.
|
|
1
|
+
{"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/plugins/package/errors.ts"],"sourcesContent":["// Package plugin — typed errors.\n//\n// Distilled doc §\"Edge cases and known failure modes\": the publish\n// error is a SINGLE tagged error with a CLOSED step set. Per\n// architecture §Effect, errors are plain interfaces with a `_tag`\n// discriminator; `Effect.catchTag` / `catchTags` match on the literal.\n\n/** Closed step set for `PublishError`.\n *\n * - `hash` — source-tree walk / digest failed (FS read perms,\n * symlink loop, disk error).\n * - `scrub` — vendored Move.lock scrub failed.\n * - `build` — `sui move build` exit / parse failure / container\n * unreachable. Cause-chain carries verbatim\n * stdout/stderr.\n * - `publish-tx` — sign-and-execute failed (gas, bytecode\n * verification, RPC).\n * - `parse` — no `published` change in receipt OR the\n * post-publish ready-probe timed out.\n * - `verify` — KnownPackage verify probe authoritatively says\n * \"object not present\" (transient is masked by\n * lenient probe — does NOT raise this).\n */\nexport type PublishPhase = 'hash' | 'scrub' | 'build' | 'publish-tx' | 'parse' | 'verify';\n\n/** Single tagged publish error. */\nexport interface PublishError {\n\treadonly _tag: 'PublishError';\n\treadonly phase: PublishPhase;\n\t/** Source path of the package being published. Populated at every\n\t * throw site that has it in scope — `KnownPackage` paths set this\n\t * to the symbolic id; post-publish probe phases (e.g. the\n\t * `postPublishReadyHint` step that only sees the on-chain `packageId`)\n\t * pass `undefined`. The `mode-local` re-stamp pass back-fills\n\t * from the outer `inputs.sourcePath` whenever it can. */\n\treadonly sourcePath?: string | undefined;\n\t/** Symbolic package name (the user-declared `pkg.name`). Optional\n\t * because some throw sites (e.g. `postPublishReadyHint` in\n\t * `publish-executor.ts`) only have the resolved on-chain\n\t * `packageId` in scope; the `mode-local` re-stamp pass back-fills\n\t * the symbolic name from `inputs.packageName` whenever it can.\n\t * Throw sites MUST NOT overload this slot with the on-chain\n\t * `packageId` — the symbolic name is what user-facing error\n\t * displays expect. */\n\treadonly packageName?: string | undefined;\n\treadonly message: string;\n\treadonly cause?: unknown;\n}\n\nexport const publishError = (\n\tphase: PublishPhase,\n\tparts: Omit<PublishError, '_tag' | 'phase'>,\n): PublishError => ({ _tag: 'PublishError', phase, ...parts });\n\n/** Error tags this plugin contributes — surfaced to the cause walker\n * via `PluginErrorContribution`. */\nexport const PACKAGE_ERROR_TAGS = ['PublishError'] as const;\n\nexport type PackageError = PublishError;\n"],"mappings":";AAiDA,MAAa,gBACZ,OACA,WACmB;CAAE,MAAM;CAAgB;CAAO,GAAG;CAAO;;;AAI7D,MAAa,qBAAqB,CAAC,eAAe"}
|
|
@@ -3,7 +3,6 @@ import { ProjectionDecl } from "../../contracts/projection.mjs";
|
|
|
3
3
|
import { SnapshotableDecl } from "../../contracts/snapshotable.mjs";
|
|
4
4
|
import { StrategyContributorDecl } from "../../contracts/strategy-contributor.mjs";
|
|
5
5
|
import { AnyResourceRef, Plugin, ResourceRef } from "../../substrate/plugin.mjs";
|
|
6
|
-
import { SeedObjectsAccumulator } from "../sui/seed-objects.mjs";
|
|
7
6
|
import { SuiClient } from "../sui/mode/shared.mjs";
|
|
8
7
|
import { SuiOptions } from "../sui/mode/spec.mjs";
|
|
9
8
|
import { AccountValue } from "../account/service.mjs";
|
|
@@ -87,13 +86,11 @@ interface PackageRegistryProjectionContribution {
|
|
|
87
86
|
declare const localPackage: <Name extends string, const Publisher extends PublisherAccountMember, const Capture extends PackageCapture | undefined = undefined>(name: Name, opts: LocalPackageOptions<Publisher, Capture>) => Plugin<`package:${Name}`, LocalPackageResolved<Capture>, {
|
|
88
87
|
readonly sui: ResourceRef<"sui", SuiClient & {
|
|
89
88
|
readonly mode: SuiOptions["mode"];
|
|
90
|
-
readonly seedObjects: SeedObjectsAccumulator;
|
|
91
89
|
}>;
|
|
92
90
|
readonly publisher: Publisher;
|
|
93
91
|
} extends infer T ? T extends {
|
|
94
92
|
readonly sui: ResourceRef<"sui", SuiClient & {
|
|
95
93
|
readonly mode: SuiOptions["mode"];
|
|
96
|
-
readonly seedObjects: SeedObjectsAccumulator;
|
|
97
94
|
}>;
|
|
98
95
|
readonly publisher: Publisher;
|
|
99
96
|
} ? T extends Readonly<Record<string, AnyResourceRef>> ? readonly T[keyof T][] : readonly [] : never : never, readonly [SnapshotableDecl, CodegenableDecl<"package">, StrategyContributorDecl<"package-registry", PackageRegistryProjectionContribution>, ProjectionDecl, ...LocalPackagePublishedDecl[]]>;
|
|
@@ -102,7 +99,6 @@ declare const localPackage: <Name extends string, const Publisher extends Publis
|
|
|
102
99
|
* bindings emitter rejects this at compose time. */
|
|
103
100
|
declare const knownPackage: <Name extends string>(name: Name, opts: KnownPackageOptions) => Plugin<`package:${Name}`, ResolvedKnownPackage, readonly ResourceRef<"sui", SuiClient & {
|
|
104
101
|
readonly mode: SuiOptions["mode"];
|
|
105
|
-
readonly seedObjects: SeedObjectsAccumulator;
|
|
106
102
|
}>[], readonly [SnapshotableDecl, CodegenableDecl<"package">, StrategyContributorDecl<"package-registry", PackageRegistryProjectionContribution>, ProjectionDecl]>;
|
|
107
103
|
//#endregion
|
|
108
104
|
export { KnownPackageOptions, KnownPackageResolved, LocalPackageOptions, LocalPackageResolved, PackageCapture, PackageResolved, PublisherAccountMember, knownPackage, localPackage };
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { definePlugin, resource } from "../../substrate/plugin.mjs";
|
|
2
|
-
import
|
|
2
|
+
import "../../api/define-plugin.mjs";
|
|
3
3
|
import { ContainerRuntimeService } from "../../runtime/docker/service.mjs";
|
|
4
|
-
import { suiResource } from "../sui/index.mjs";
|
|
5
4
|
import { ArtifactPublisherService } from "../../substrate/runtime/artifact-publisher/index.mjs";
|
|
6
5
|
import { chainProbeFor } from "../../substrate/runtime/strategy-registry/chain-probe-for.mjs";
|
|
6
|
+
import "../../substrate/runtime/strategy-registry/index.mjs";
|
|
7
7
|
import { makeLocalPackagePublishedDecl, pickCreatedByType } from "./publish-output.mjs";
|
|
8
8
|
import { PACKAGE_REGISTRY_CAPABILITY_KEY, PackageRegistryService } from "./registry.mjs";
|
|
9
|
+
import { projection } from "../../api/define-capabilities.mjs";
|
|
10
|
+
import { pluginErrorContributions } from "../../api/plugin-errors.mjs";
|
|
11
|
+
import { suiResource } from "../sui/index.mjs";
|
|
9
12
|
import { makeKnownCodegenable, makeLocalCodegenable } from "./codegen.mjs";
|
|
10
13
|
import { PACKAGE_ERROR_TAGS } from "./errors.mjs";
|
|
14
|
+
import "./spans.mjs";
|
|
11
15
|
import { makePublishExecutor } from "./publish-executor.mjs";
|
|
12
16
|
import { bootPackageService } from "./service.mjs";
|
|
13
17
|
import { makeSnapshotable } from "./snapshot.mjs";
|
|
@@ -19,26 +23,25 @@ const packageErrorContributions = pluginErrorContributions(PACKAGE_ERROR_TAGS);
|
|
|
19
23
|
* cleanly (two `localPackage('foo', ...)` calls in one stack → typed
|
|
20
24
|
* error at compose time). */
|
|
21
25
|
const packageResourceId = (name) => `package:${name}`;
|
|
22
|
-
const makePackageProjectionContribution = (
|
|
26
|
+
const makePackageProjectionContribution = (contribution) => {
|
|
23
27
|
const updatedAt = Date.now();
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
28
|
+
const key = `package/${contribution.name}`;
|
|
29
|
+
return projection({
|
|
30
|
+
kind: "package",
|
|
31
|
+
key,
|
|
32
|
+
payload: {
|
|
33
|
+
key,
|
|
34
|
+
rowKey: null,
|
|
35
|
+
name: contribution.name,
|
|
36
|
+
kind: contribution.kind,
|
|
37
|
+
packageId: contribution.packageId,
|
|
38
|
+
upgradeCapId: contribution.upgradeCapId,
|
|
39
|
+
mvrPlaceholder: contribution.mvrPlaceholder,
|
|
40
|
+
sourcePath: contribution.sourcePath,
|
|
41
|
+
updatedAt
|
|
42
|
+
},
|
|
43
|
+
at: updatedAt
|
|
44
|
+
});
|
|
42
45
|
};
|
|
43
46
|
const normalizeCapture = (packageName, capture) => {
|
|
44
47
|
if (capture === void 0) return void 0;
|
|
@@ -62,6 +65,7 @@ const buildLocalPlugin = (name, opts) => {
|
|
|
62
65
|
publisher: opts.publisher
|
|
63
66
|
},
|
|
64
67
|
role: "task",
|
|
68
|
+
section: "package",
|
|
65
69
|
watch: {
|
|
66
70
|
paths: [
|
|
67
71
|
`${opts.sourcePath}/**/*.move`,
|
|
@@ -79,6 +83,7 @@ const buildLocalPlugin = (name, opts) => {
|
|
|
79
83
|
sdk: sui.sdk,
|
|
80
84
|
account: publisherAccount,
|
|
81
85
|
runtime: containerRuntime,
|
|
86
|
+
forkMode: sui.fork !== null,
|
|
82
87
|
...sui.buildImage !== null ? { buildImage: sui.buildImage } : {}
|
|
83
88
|
});
|
|
84
89
|
const { resolved, output } = yield* bootPackageService(publisher, probe, registry, {
|
|
@@ -107,6 +112,7 @@ const buildKnownPlugin = (name, opts) => {
|
|
|
107
112
|
id: resource(packageResourceId(name)).id,
|
|
108
113
|
dependsOn: { sui: suiResource },
|
|
109
114
|
role: "task",
|
|
115
|
+
section: "package",
|
|
110
116
|
start: ({ sui }) => Effect.gen(function* () {
|
|
111
117
|
const { resolved } = yield* bootPackageService(yield* ArtifactPublisherService, yield* chainProbeFor(sui.chain), yield* PackageRegistryService, {
|
|
112
118
|
mode: "known",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugins/package/index.ts"],"sourcesContent":["// Package plugin — barrel + factories.\n//\n// Architecture: Package is the canonical implementation of the\n// `ArtifactPublisher` substrate primitive. Many service\n// plugins depend on its publish output (Coin types, Walrus/Seal/\n// Deepbook contracts, Action outputs).\n//\n// Public surface:\n//\n// - `localPackage(name, opts)` — build + publish a Move source tree.\n// - `knownPackage(name, opts)` — verify-only against a fixed id.\n//\n// Type split (distilled doc Invariant 9): `localPackage` resolves to\n// `LocalPackage`; `knownPackage` resolves to `KnownPackage`. The\n// bindings emitter (in the codegen orchestrator) types-out KnownPackage\n// at compose time, so misuse fails at compile time rather than at\n// emit time.\n//\n// Resource id: `'package:<name>'` — one tag per user-declared package\n// (the symbolic name is part of the identity so two `localPackage`\n// calls in the same stack don't collide on the substrate's tag\n// registry). Substrate-side plugin key is the same string.\n\nimport { Effect } from 'effect';\n\nimport { definePlugin, resource, type ResourceRef } from '../../api/define-plugin.ts';\nimport { pluginErrorContributions } from '../../api/plugin-errors.ts';\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\nimport type { ProjectionDecl } from '../../contracts/projection.ts';\nimport {\n\tmakeLocalPackagePublishedDecl,\n\tpickCreatedByType,\n\ttype LocalPackagePublishOutput,\n} from './publish-output.ts';\nimport type { SnapshotableDecl } from '../../contracts/snapshotable.ts';\nimport type { StrategyContributorDecl } from '../../contracts/strategy-contributor.ts';\nimport { ContainerRuntimeService } from '../../runtime/docker/service.ts';\nimport type { ChainId } from '../../substrate/brand.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';\nimport type { AccountResourceId } from '../account/index.ts';\nimport type { AccountValue } from '../account/service.ts';\nimport { makeKnownCodegenable, makeLocalCodegenable } from './codegen.ts';\nimport { makePublishExecutor } from './publish-executor.ts';\nimport { bootPackageService, type PackageMode } from './service.ts';\nimport {\n\tPACKAGE_REGISTRY_CAPABILITY_KEY,\n\tPackageRegistryService,\n\ttype ResolvedKnownPackage,\n\ttype ResolvedLocalPackage,\n} from './registry.ts';\nimport { makeSnapshotable } from './snapshot.ts';\nimport { PACKAGE_ERROR_TAGS } from './errors.ts';\n\nconst packageErrorContributions = pluginErrorContributions(PACKAGE_ERROR_TAGS);\n\n// ---------------------------------------------------------------------------\n// Publisher account ref — explicit upstream\n// ---------------------------------------------------------------------------\n\n/** A user-supplied publisher account ref. The user passes the result\n * of `account('alice')` — NOT a bare string. Generic over the\n * literal account name so the package dependency preserves the\n * per-account resource id. */\nexport type PublisherAccountMember<Name extends string = string> = ResourceRef<\n\tAccountResourceId<Name>,\n\tAccountValue\n>;\n\n// ---------------------------------------------------------------------------\n// Resource — one per declared package, keyed by symbolic name\n// ---------------------------------------------------------------------------\n\n/** Resource id constructor. The symbolic package name is part of the tag\n * identity so the substrate's compose-time dedup detects collisions\n * cleanly (two `localPackage('foo', ...)` calls in one stack → typed\n * error at compose time). */\nexport const packageResourceId = <Name extends string>(name: Name): `package:${Name}` =>\n\t`package:${name}`;\n\n/** The literal-template resource id for a package by symbolic name. */\nexport type PackageResourceId<Name extends string> = `package:${Name}`;\n\n/** Public resolved value shapes — re-exported from `registry.ts` to\n * give consumers one stable import path. */\nexport type { ResolvedLocalPackage, ResolvedKnownPackage, ResolvedPackage } from './registry.ts';\nexport type {\n\tPickCreatedByTypeOptions,\n\tLocalPackagePublishOutput,\n\tPackagePublishObjectChange,\n} from './publish-output.ts';\nexport { pickCreatedByType } from './publish-output.ts';\nexport type { PublishError } from './errors.ts';\nexport { PACKAGE_ERROR_TAGS } from './errors.ts';\nexport type { PackageBindings } from './codegen.ts';\nexport type { PublishExecutor } from './mode-local.ts';\n\n/** Resolved value carried by the package resource. Local packages also\n * expose the publish output so manifest emitters and capture-spec\n * callers can read it. Sibling plugin folds consume the package-owned\n * extension contribution instead of importing package internals. */\nexport type PackageCaptureMap = Readonly<Record<string, string>>;\n\ntype PackageCaptureCallback = (\n\toutput: LocalPackagePublishOutput,\n) => Readonly<Record<string, string>>;\n\nexport type PackageCapture = PackageCaptureMap;\n\nexport type CapturedPackageValues<Capture> = Capture extends PackageCaptureCallback\n\t? Readonly<Record<string, string>>\n\t: Capture extends PackageCaptureMap\n\t\t? { readonly [K in keyof Capture]: string }\n\t\t: Readonly<Record<string, string>>;\n\nexport interface LocalPackageResolved<Capture = undefined> extends Omit<\n\tResolvedLocalPackage,\n\t'captured'\n> {\n\t/** Captured object ids keyed by the user's `capture` option. */\n\treadonly captured: CapturedPackageValues<Capture>;\n\t/** Publisher account that signed this package. Kept on the live\n\t * resource value so downstream local coin plugins can mint from\n\t * publisher-owned TreasuryCaps through the centralized funding\n\t * strategy path. It is intentionally not written to generated\n\t * bindings or the package registry. */\n\treadonly publisher: AccountValue;\n\t/** Publish output — present after a fresh publish, null on\n\t * cache hit (verify-only path). Consumers that need the\n\t * output MUST tolerate null and fall back to chain reads via\n\t * the ChainProbe. */\n\treadonly publishResult: LocalPackagePublishOutput | null;\n}\n\nexport type KnownPackageResolved = ResolvedKnownPackage;\n\nexport type PackageResolved = LocalPackageResolved | KnownPackageResolved;\n\n// ---------------------------------------------------------------------------\n// Factory options\n// ---------------------------------------------------------------------------\n\nexport interface LocalPackageOptions<\n\tPublisher extends PublisherAccountMember = PublisherAccountMember,\n\tCapture extends PackageCapture | undefined = undefined,\n> {\n\treadonly sourcePath: string;\n\treadonly mvrPlaceholder?: string;\n\treadonly excludeFromCodegen?: boolean;\n\t/** Capture created objects from the publish output. The record\n\t * form maps output keys to object-type suffixes, e.g.\n\t * `{ boardId: '::board::Board' }`. */\n\treadonly capture?: Capture;\n\t/** Publisher account — the signer for the publish tx. Pass the\n\t * result of `account('alice')` (the same plugin/resource ref used\n\t * in the rest of the stack — NOT a duplicate factory call).\n\t *\n\t * Required for local packages: a publish tx must be signed by\n\t * SOMEONE; we make the choice explicit so two packages in the\n\t * same stack can publish under different accounts (no implicit\n\t * \"first account\" convention to memorise). Distilled doc Invariant\n\t * 4 — \"Signer MUST be an explicit upstream\". */\n\treadonly publisher: Publisher;\n}\n\nexport interface KnownPackageOptions {\n\treadonly packageId: string;\n\treadonly upgradeCapId?: string;\n\treadonly mvrPlaceholder?: string;\n}\n\ninterface PackageRegistryProjectionContribution {\n\treadonly kind: 'local' | 'known';\n\treadonly name: string;\n\treadonly packageId: string;\n\treadonly upgradeCapId: string | null;\n\treadonly mvrPlaceholder: string;\n\treadonly sourcePath: string | null;\n}\n\nconst makePackageProjectionContribution = (\n\tprojection: PackageRegistryProjectionContribution,\n): ProjectionDecl => {\n\tconst updatedAt = Date.now();\n\treturn {\n\t\tkind: 'projection',\n\t\tevent: {\n\t\t\ttag: 'package.updated',\n\t\t\tpackage: {\n\t\t\t\tkey: `package/${projection.name}` as `package/${string}`,\n\t\t\t\trowKey: null,\n\t\t\t\tname: projection.name,\n\t\t\t\tkind: projection.kind,\n\t\t\t\tpackageId: projection.packageId,\n\t\t\t\tupgradeCapId: projection.upgradeCapId,\n\t\t\t\tmvrPlaceholder: projection.mvrPlaceholder,\n\t\t\t\tsourcePath: projection.sourcePath,\n\t\t\t\tupdatedAt,\n\t\t\t},\n\t\t\tat: updatedAt,\n\t\t},\n\t};\n};\n\n// ---------------------------------------------------------------------------\n// Internal builders\n// ---------------------------------------------------------------------------\n\nconst normalizeCapture = <Capture extends PackageCapture | undefined>(\n\tpackageName: string,\n\tcapture: Capture,\n): PackageCaptureCallback | undefined => {\n\tif (capture === undefined) return undefined;\n\treturn (output) => {\n\t\tconst captured: Record<string, string> = {};\n\t\tfor (const [key, suffix] of Object.entries(capture)) {\n\t\t\tconst objectId = pickCreatedByType(output.objectChanges, { suffix });\n\t\t\tif (objectId === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`localPackage('${packageName}') capture '${key}' matched no created object with suffix '${suffix}'.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcaptured[key] = objectId;\n\t\t}\n\t\treturn captured;\n\t};\n};\n\nconst buildLocalPlugin = <\n\tName extends string,\n\tconst Publisher extends PublisherAccountMember,\n\tCapture extends PackageCapture | undefined,\n>(\n\tname: Name,\n\topts: LocalPackageOptions<Publisher, Capture>,\n) => {\n\tconst packageRef = resource<PackageResourceId<Name>, LocalPackageResolved<Capture>>(\n\t\tpackageResourceId(name),\n\t);\n\tconst capture = normalizeCapture(name, opts.capture);\n\n\treturn definePlugin({\n\t\tid: packageRef.id,\n\t\tdependsOn: { sui: suiResource, publisher: opts.publisher },\n\t\trole: 'task',\n\t\twatch: {\n\t\t\t// File-watcher contribution — restart on Move source edits.\n\t\t\t// Distilled doc §Outputs: literal-path Packages contribute\n\t\t\t// watch roots. Effect-resolved paths do NOT auto-attach.\n\t\t\tpaths: [\n\t\t\t\t`${opts.sourcePath}/**/*.move`,\n\t\t\t\t`${opts.sourcePath}/Move.toml`,\n\t\t\t\t`${opts.sourcePath}/Move.lock`,\n\t\t\t],\n\t\t\tcascade: true,\n\t\t},\n\t\tstart: ({ sui, publisher: publisherAccount }) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\t// Substrate-context primitives: ArtifactPublisher\n\t\t\t\t// is provided by the supervisor's pluginContext;\n\t\t\t\t// ChainProbe is looked up via the StrategyRegistry\n\t\t\t\t// (Sui registered itself there at acquire). The\n\t\t\t\t// PackageRegistry is a per-stack plugin-owned service\n\t\t\t\t// (instantiated from the substrate's generic\n\t\t\t\t// ScopedRefMap primitive — see `registry.ts`) — every\n\t\t\t\t// package plugin in the stack yields the SAME instance\n\t\t\t\t// via `PackageRegistryService`, so cross-plugin lookups\n\t\t\t\t// stay consistent and warm-restart verify can use the\n\t\t\t\t// previous packageId as a hint.\n\t\t\t\tconst publisher = yield* ArtifactPublisherService;\n\t\t\t\tconst probe = yield* chainProbeFor<SuiProbeKey>(sui.chain);\n\t\t\t\tconst registry = yield* PackageRegistryService;\n\t\t\t\t// ContainerRuntime + the Sui plugin's resolved image feed\n\t\t\t\t// `runMoveBuild`'s path-(b) (`docker run --rm`) build path.\n\t\t\t\t// Sui surfaces `buildImage` on its resolved client; modes\n\t\t\t\t// without an in-stack image (external, live) surface null\n\t\t\t\t// — runMoveBuild then surfaces a typed error from path (c)\n\t\t\t\t// (host CLI not routed).\n\t\t\t\tconst containerRuntime = yield* ContainerRuntimeService;\n\n\t\t\t\t// Build the concrete `PublishExecutor` once per acquire.\n\t\t\t\t// Hands the resolved SuiSdkShim (for `Transaction.build`,\n\t\t\t\t// `executeTransaction`, `waitForTransaction`) and the\n\t\t\t\t// publisher account (for `signAndExecute`) to the executor\n\t\t\t\t// methods; mode-local's produce body drives them.\n\t\t\t\tconst executor = makePublishExecutor({\n\t\t\t\t\tsdk: sui.sdk,\n\t\t\t\t\taccount: publisherAccount,\n\t\t\t\t\truntime: containerRuntime,\n\t\t\t\t\t...(sui.buildImage !== null ? { buildImage: sui.buildImage } : {}),\n\t\t\t\t});\n\n\t\t\t\tconst mode = {\n\t\t\t\t\tmode: 'local',\n\t\t\t\t\tpackageName: name,\n\t\t\t\t\tsourcePath: opts.sourcePath,\n\t\t\t\t\tchainId: sui.chain,\n\t\t\t\t\tpublisherAddress: publisherAccount.address,\n\t\t\t\t\tmvrOverride: opts.mvrPlaceholder,\n\t\t\t\t\t...(capture !== undefined ? { capture } : {}),\n\t\t\t\t\texecutor,\n\t\t\t\t} satisfies PackageMode;\n\n\t\t\t\tconst { resolved, output } = yield* bootPackageService(publisher, probe, registry, mode);\n\n\t\t\t\tconst projected: LocalPackageResolved<Capture> = {\n\t\t\t\t\t...resolved,\n\t\t\t\t\tcaptured: resolved.captured as CapturedPackageValues<Capture>,\n\t\t\t\t\tpublisher: publisherAccount,\n\t\t\t\t\tpublishResult: output,\n\t\t\t\t};\n\t\t\t\treturn projected;\n\t\t\t}),\n\t\terrorContributions: packageErrorContributions,\n\t\tcapabilities: ({ value, runtime }) => makeLocalCapabilities(name, opts, value, runtime.chain),\n\t});\n};\n\nconst buildKnownPlugin = <Name extends string>(name: Name, opts: KnownPackageOptions) => {\n\tconst packageRef = resource<PackageResourceId<Name>, KnownPackageResolved>(\n\t\tpackageResourceId(name),\n\t);\n\treturn definePlugin({\n\t\tid: packageRef.id,\n\t\tdependsOn: { sui: suiResource },\n\t\trole: 'task',\n\t\tstart: ({ sui }) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst publisher = yield* ArtifactPublisherService;\n\t\t\t\tconst probe = yield* chainProbeFor<SuiProbeKey>(sui.chain);\n\t\t\t\tconst registry = yield* PackageRegistryService;\n\t\t\t\tconst mode = {\n\t\t\t\t\tmode: 'known',\n\t\t\t\t\tpackageName: name,\n\t\t\t\t\tpackageId: opts.packageId,\n\t\t\t\t\tupgradeCapId: opts.upgradeCapId,\n\t\t\t\t\tmvrOverride: opts.mvrPlaceholder,\n\t\t\t\t} satisfies PackageMode;\n\t\t\t\tconst { resolved } = yield* bootPackageService(publisher, probe, registry, mode);\n\t\t\t\t// Known mode never publishes — no output to walk, so\n\t\t\t\t// the coin-discovery hook is skipped here. Users who\n\t\t\t\t// want coin records for a knownPackage point a\n\t\t\t\t// `coin.known('0xPKG::module::Witness')` at the\n\t\t\t\t// fully-qualified type directly; the bare-type path\n\t\t\t\t// hits the live RPC for metadata rather than the\n\t\t\t\t// output-walker.\n\t\t\t\treturn resolved;\n\t\t\t}),\n\t\terrorContributions: packageErrorContributions,\n\t\tcapabilities: ({ value }) => makeKnownCapabilities(name, opts, value),\n\t});\n};\n\nconst makeLocalCapabilities = (\n\tname: string,\n\topts: { readonly excludeFromCodegen?: boolean },\n\tresolved: LocalPackageResolved,\n\tchain: ChainId,\n) => {\n\t// Snapshot + codegen lift their typed fields off the resolved\n\t// publish (real packageId + captured object ids). The static-form\n\t// placeholders are gone.\n\tconst snap: SnapshotableDecl = makeSnapshotable(\n\t\tname,\n\t\tresolved.publishResult?.packageId ?? resolved.packageId,\n\t);\n\tconst codegen: CodegenableDecl<'package'> = makeLocalCodegenable(\n\t\t{\n\t\t\tkind: 'local',\n\t\t\tname,\n\t\t\tpackageId: resolved.packageId,\n\t\t\tupgradeCapId: resolved.upgradeCapId,\n\t\t\tsourcePath: resolved.sourcePath,\n\t\t\tmvrPlaceholder: resolved.mvrPlaceholder,\n\t\t\tcaptured: resolved.captured,\n\t\t},\n\t\t{ excluded: opts.excludeFromCodegen ?? false },\n\t);\n\t// The plugin contributes to the package-registry strategy under a\n\t// fixed key — the substrate orchestrator wires all packages'\n\t// contributions into the same per-stack registry.\n\tconst projection: PackageRegistryProjectionContribution = {\n\t\tkind: 'local',\n\t\tname,\n\t\tpackageId: resolved.packageId,\n\t\tupgradeCapId: resolved.upgradeCapId ?? null,\n\t\tmvrPlaceholder: resolved.mvrPlaceholder,\n\t\tsourcePath: resolved.sourcePath,\n\t};\n\tconst registryContribution: StrategyContributorDecl<\n\t\ttypeof PACKAGE_REGISTRY_CAPABILITY_KEY,\n\t\tPackageRegistryProjectionContribution\n\t> = {\n\t\tkind: 'strategy-contributor',\n\t\tcapabilityKey: PACKAGE_REGISTRY_CAPABILITY_KEY,\n\t\tstrategy: projection,\n\t\tautoMounted: true,\n\t};\n\treturn [\n\t\tsnap,\n\t\tcodegen,\n\t\tregistryContribution,\n\t\tmakePackageProjectionContribution(projection),\n\t\t...(resolved.publishResult === null\n\t\t\t? []\n\t\t\t: [\n\t\t\t\t\tmakeLocalPackagePublishedDecl({\n\t\t\t\t\t\tpackageName: name,\n\t\t\t\t\t\tpackageId: resolved.packageId,\n\t\t\t\t\t\tchain,\n\t\t\t\t\t\toutput: resolved.publishResult,\n\t\t\t\t\t}),\n\t\t\t\t]),\n\t] as const;\n};\n\nconst makeKnownCapabilities = (\n\tname: string,\n\topts: KnownPackageOptions,\n\tresolved: KnownPackageResolved,\n) => {\n\tconst snap: SnapshotableDecl = makeSnapshotable(name, `known:${resolved.packageId}`);\n\tconst codegen: CodegenableDecl<'package'> = makeKnownCodegenable({\n\t\tkind: 'known',\n\t\tname,\n\t\tpackageId: resolved.packageId,\n\t\tupgradeCapId: resolved.upgradeCapId ?? opts.upgradeCapId,\n\t\tmvrPlaceholder: resolved.mvrPlaceholder,\n\t});\n\tconst projection: PackageRegistryProjectionContribution = {\n\t\tkind: 'known',\n\t\tname,\n\t\tpackageId: resolved.packageId,\n\t\tupgradeCapId: resolved.upgradeCapId ?? opts.upgradeCapId ?? null,\n\t\tmvrPlaceholder: resolved.mvrPlaceholder,\n\t\tsourcePath: null,\n\t};\n\tconst registryContribution: StrategyContributorDecl<\n\t\ttypeof PACKAGE_REGISTRY_CAPABILITY_KEY,\n\t\tPackageRegistryProjectionContribution\n\t> = {\n\t\tkind: 'strategy-contributor',\n\t\tcapabilityKey: PACKAGE_REGISTRY_CAPABILITY_KEY,\n\t\tstrategy: projection,\n\t\tautoMounted: true,\n\t};\n\treturn [\n\t\tsnap,\n\t\tcodegen,\n\t\tregistryContribution,\n\t\tmakePackageProjectionContribution(projection),\n\t] as const;\n};\n\n// ---------------------------------------------------------------------------\n// Public factories\n// ---------------------------------------------------------------------------\n\n/** Build + publish a local Move package. The resolved value is\n * `LocalPackageResolved` so consumers that need bindings / source\n * path are typed correctly.\n *\n * Required `opts.publisher`: the account that signs the publish tx.\n * Pass the same `account('alice')` reference used elsewhere in the\n * stack — the package.s `dependsOn` includes `account/<publisher>`\n * so the substrate orders the publisher's keypair + funding strictly\n * before publish. */\nexport const localPackage = <\n\tName extends string,\n\tconst Publisher extends PublisherAccountMember,\n\tconst Capture extends PackageCapture | undefined = undefined,\n>(\n\tname: Name,\n\topts: LocalPackageOptions<Publisher, Capture>,\n) => buildLocalPlugin(name, opts);\n\n/** Verify-only against a fixed on-chain package id. The resolved\n * value is `KnownPackageResolved` — narrower than local, so the\n * bindings emitter rejects this at compose time. */\nexport const knownPackage = <Name extends string>(name: Name, opts: KnownPackageOptions) =>\n\tbuildKnownPlugin(name, opts);\n"],"mappings":";;;;;;;;;;;;;;;AAwDA,MAAM,4BAA4B,yBAAyB,mBAAmB;;;;;AAuB9E,MAAa,qBAA0C,SACtD,WAAW;AAsGZ,MAAM,qCACL,eACoB;CACpB,MAAM,YAAY,KAAK,KAAK;AAC5B,QAAO;EACN,MAAM;EACN,OAAO;GACN,KAAK;GACL,SAAS;IACR,KAAK,WAAW,WAAW;IAC3B,QAAQ;IACR,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,WAAW,WAAW;IACtB,cAAc,WAAW;IACzB,gBAAgB,WAAW;IAC3B,YAAY,WAAW;IACvB;IACA;GACD,IAAI;GACJ;EACD;;AAOF,MAAM,oBACL,aACA,YACwC;AACxC,KAAI,YAAY,KAAA,EAAW,QAAO,KAAA;AAClC,SAAQ,WAAW;EAClB,MAAM,WAAmC,EAAE;AAC3C,OAAK,MAAM,CAAC,KAAK,WAAW,OAAO,QAAQ,QAAQ,EAAE;GACpD,MAAM,WAAW,kBAAkB,OAAO,eAAe,EAAE,QAAQ,CAAC;AACpE,OAAI,aAAa,KAAA,EAChB,OAAM,IAAI,MACT,iBAAiB,YAAY,cAAc,IAAI,2CAA2C,OAAO,IACjG;AAEF,YAAS,OAAO;;AAEjB,SAAO;;;AAIT,MAAM,oBAKL,MACA,SACI;CACJ,MAAM,aAAa,SAClB,kBAAkB,KAAK,CACvB;CACD,MAAM,UAAU,iBAAiB,MAAM,KAAK,QAAQ;AAEpD,QAAO,aAAa;EACnB,IAAI,WAAW;EACf,WAAW;GAAE,KAAK;GAAa,WAAW,KAAK;GAAW;EAC1D,MAAM;EACN,OAAO;GAIN,OAAO;IACN,GAAG,KAAK,WAAW;IACnB,GAAG,KAAK,WAAW;IACnB,GAAG,KAAK,WAAW;IACnB;GACD,SAAS;GACT;EACD,QAAQ,EAAE,KAAK,WAAW,uBACzB,OAAO,IAAI,aAAa;GAYvB,MAAM,YAAY,OAAO;GACzB,MAAM,QAAQ,OAAO,cAA2B,IAAI,MAAM;GAC1D,MAAM,WAAW,OAAO;GAOxB,MAAM,mBAAmB,OAAO;GAOhC,MAAM,WAAW,oBAAoB;IACpC,KAAK,IAAI;IACT,SAAS;IACT,SAAS;IACT,GAAI,IAAI,eAAe,OAAO,EAAE,YAAY,IAAI,YAAY,GAAG,EAAE;IACjE,CAAC;GAaF,MAAM,EAAE,UAAU,WAAW,OAAO,mBAAmB,WAAW,OAAO,UAAU;IAVlF,MAAM;IACN,aAAa;IACb,YAAY,KAAK;IACjB,SAAS,IAAI;IACb,kBAAkB,iBAAiB;IACnC,aAAa,KAAK;IAClB,GAAI,YAAY,KAAA,IAAY,EAAE,SAAS,GAAG,EAAE;IAC5C;IAGsF,CAAC;AAQxF,UAAO;IALN,GAAG;IACH,UAAU,SAAS;IACnB,WAAW;IACX,eAAe;IAEA;IACf;EACH,oBAAoB;EACpB,eAAe,EAAE,OAAO,cAAc,sBAAsB,MAAM,MAAM,OAAO,QAAQ,MAAM;EAC7F,CAAC;;AAGH,MAAM,oBAAyC,MAAY,SAA8B;AAIxF,QAAO,aAAa;EACnB,IAJkB,SAClB,kBAAkB,KAAK,CAGT,CAAC;EACf,WAAW,EAAE,KAAK,aAAa;EAC/B,MAAM;EACN,QAAQ,EAAE,UACT,OAAO,IAAI,aAAa;GAWvB,MAAM,EAAE,aAAa,OAAO,mBAAmB,OAVtB,0BAUiC,OATrC,cAA2B,IAAI,MAAM,EASO,OARzC,wBAQmD;IAN1E,MAAM;IACN,aAAa;IACb,WAAW,KAAK;IAChB,cAAc,KAAK;IACnB,aAAa,KAAK;IAE4D,CAAC;AAQhF,UAAO;IACN;EACH,oBAAoB;EACpB,eAAe,EAAE,YAAY,sBAAsB,MAAM,MAAM,MAAM;EACrE,CAAC;;AAGH,MAAM,yBACL,MACA,MACA,UACA,UACI;CAIJ,MAAM,OAAyB,iBAC9B,MACA,SAAS,eAAe,aAAa,SAAS,UAC9C;CACD,MAAM,UAAsC,qBAC3C;EACC,MAAM;EACN;EACA,WAAW,SAAS;EACpB,cAAc,SAAS;EACvB,YAAY,SAAS;EACrB,gBAAgB,SAAS;EACzB,UAAU,SAAS;EACnB,EACD,EAAE,UAAU,KAAK,sBAAsB,OAAO,CAC9C;CAID,MAAM,aAAoD;EACzD,MAAM;EACN;EACA,WAAW,SAAS;EACpB,cAAc,SAAS,gBAAgB;EACvC,gBAAgB,SAAS;EACzB,YAAY,SAAS;EACrB;AAUD,QAAO;EACN;EACA;EACA;GARA,MAAM;GACN,eAAe;GACf,UAAU;GACV,aAAa;GAKO;EACpB,kCAAkC,WAAW;EAC7C,GAAI,SAAS,kBAAkB,OAC5B,EAAE,GACF,CACA,8BAA8B;GAC7B,aAAa;GACb,WAAW,SAAS;GACpB;GACA,QAAQ,SAAS;GACjB,CAAC,CACF;EACH;;AAGF,MAAM,yBACL,MACA,MACA,aACI;CACJ,MAAM,OAAyB,iBAAiB,MAAM,SAAS,SAAS,YAAY;CACpF,MAAM,UAAsC,qBAAqB;EAChE,MAAM;EACN;EACA,WAAW,SAAS;EACpB,cAAc,SAAS,gBAAgB,KAAK;EAC5C,gBAAgB,SAAS;EACzB,CAAC;CACF,MAAM,aAAoD;EACzD,MAAM;EACN;EACA,WAAW,SAAS;EACpB,cAAc,SAAS,gBAAgB,KAAK,gBAAgB;EAC5D,gBAAgB,SAAS;EACzB,YAAY;EACZ;AAUD,QAAO;EACN;EACA;EACA;GARA,MAAM;GACN,eAAe;GACf,UAAU;GACV,aAAa;GAKO;EACpB,kCAAkC,WAAW;EAC7C;;;;;;;;;;;AAgBF,MAAa,gBAKZ,MACA,SACI,iBAAiB,MAAM,KAAK;;;;AAKjC,MAAa,gBAAqC,MAAY,SAC7D,iBAAiB,MAAM,KAAK"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugins/package/index.ts"],"sourcesContent":["// Package plugin — barrel + factories.\n//\n// Architecture: Package is the canonical implementation of the\n// `ArtifactPublisher` substrate primitive. Many service\n// plugins depend on its publish output (Coin types, Walrus/Seal/\n// Deepbook contracts, Action outputs).\n//\n// Public surface:\n//\n// - `localPackage(name, opts)` — build + publish a Move source tree.\n// - `knownPackage(name, opts)` — verify-only against a fixed id.\n//\n// Type split (distilled doc Invariant 9): `localPackage` resolves to\n// `LocalPackage`; `knownPackage` resolves to `KnownPackage`. The\n// bindings emitter (in the codegen orchestrator) types-out KnownPackage\n// at compose time, so misuse fails at compile time rather than at\n// emit time.\n//\n// Resource id: `'package:<name>'` — one tag per user-declared package\n// (the symbolic name is part of the identity so two `localPackage`\n// calls in the same stack don't collide on the substrate's tag\n// registry). Substrate-side plugin key is the same string.\n\nimport { Effect } from 'effect';\n\nimport { projection } from '../../api/define-capabilities.ts';\nimport { definePlugin, resource, type ResourceRef } from '../../api/define-plugin.ts';\nimport { pluginErrorContributions } from '../../api/plugin-errors.ts';\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\nimport type { ProjectionDecl } from '../../contracts/projection.ts';\nimport {\n\tmakeLocalPackagePublishedDecl,\n\tpickCreatedByType,\n\ttype LocalPackagePublishOutput,\n} from './publish-output.ts';\nimport type { SnapshotableDecl } from '../../contracts/snapshotable.ts';\nimport type { StrategyContributorDecl } from '../../contracts/strategy-contributor.ts';\nimport { ContainerRuntimeService } from '../../runtime/docker/service.ts';\nimport type { ChainId } from '../../substrate/brand.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';\nimport type { AccountResourceId, AccountValue } from '../account/index.ts';\nimport { makeKnownCodegenable, makeLocalCodegenable } from './codegen.ts';\nimport { makePublishExecutor } from './publish-executor.ts';\nimport { bootPackageService, type PackageMode } from './service.ts';\nimport {\n\tPACKAGE_REGISTRY_CAPABILITY_KEY,\n\tPackageRegistryService,\n\ttype ResolvedKnownPackage,\n\ttype ResolvedLocalPackage,\n} from './registry.ts';\nimport { makeSnapshotable } from './snapshot.ts';\nimport { PACKAGE_ERROR_TAGS } from './errors.ts';\n\nconst packageErrorContributions = pluginErrorContributions(PACKAGE_ERROR_TAGS);\n\n// ---------------------------------------------------------------------------\n// Publisher account ref — explicit upstream\n// ---------------------------------------------------------------------------\n\n/** A user-supplied publisher account ref. The user passes the result\n * of `account('alice')` — NOT a bare string. Generic over the\n * literal account name so the package dependency preserves the\n * per-account resource id. */\nexport type PublisherAccountMember<Name extends string = string> = ResourceRef<\n\tAccountResourceId<Name>,\n\tAccountValue\n>;\n\n// ---------------------------------------------------------------------------\n// Resource — one per declared package, keyed by symbolic name\n// ---------------------------------------------------------------------------\n\n/** Resource id constructor. The symbolic package name is part of the tag\n * identity so the substrate's compose-time dedup detects collisions\n * cleanly (two `localPackage('foo', ...)` calls in one stack → typed\n * error at compose time). */\nexport const packageResourceId = <Name extends string>(name: Name): `package:${Name}` =>\n\t`package:${name}`;\n\n/** The literal-template resource id for a package by symbolic name. */\nexport type PackageResourceId<Name extends string> = `package:${Name}`;\n\n/** Public resolved value shapes — re-exported from `registry.ts` to\n * give consumers one stable import path. */\nexport type { ResolvedLocalPackage, ResolvedKnownPackage, ResolvedPackage } from './registry.ts';\nexport type {\n\tPickCreatedByTypeOptions,\n\tLocalPackagePublishOutput,\n\tPackagePublishObjectChange,\n} from './publish-output.ts';\nexport { pickCreatedByType } from './publish-output.ts';\nexport type { PublishError } from './errors.ts';\nexport { PACKAGE_ERROR_TAGS } from './errors.ts';\nexport type { PackageBindings } from './codegen.ts';\nexport type { PublishExecutor } from './mode-local.ts';\nexport { PackageSpans } from './spans.ts';\n\n/** Resolved value carried by the package resource. Local packages also\n * expose the publish output so manifest emitters and capture-spec\n * callers can read it. Sibling plugin folds consume the package-owned\n * extension contribution instead of importing package internals. */\nexport type PackageCaptureMap = Readonly<Record<string, string>>;\n\ntype PackageCaptureCallback = (\n\toutput: LocalPackagePublishOutput,\n) => Readonly<Record<string, string>>;\n\nexport type PackageCapture = PackageCaptureMap;\n\nexport type CapturedPackageValues<Capture> = Capture extends PackageCaptureCallback\n\t? Readonly<Record<string, string>>\n\t: Capture extends PackageCaptureMap\n\t\t? { readonly [K in keyof Capture]: string }\n\t\t: Readonly<Record<string, string>>;\n\nexport interface LocalPackageResolved<Capture = undefined> extends Omit<\n\tResolvedLocalPackage,\n\t'captured'\n> {\n\t/** Captured object ids keyed by the user's `capture` option. */\n\treadonly captured: CapturedPackageValues<Capture>;\n\t/** Publisher account that signed this package. Kept on the live\n\t * resource value so downstream local coin plugins can mint from\n\t * publisher-owned TreasuryCaps through the centralized funding\n\t * strategy path. It is intentionally not written to generated\n\t * bindings or the package registry. */\n\treadonly publisher: AccountValue;\n\t/** Publish output — present after a fresh publish, null on\n\t * cache hit (verify-only path). Consumers that need the\n\t * output MUST tolerate null and fall back to chain reads via\n\t * the ChainProbe. */\n\treadonly publishResult: LocalPackagePublishOutput | null;\n}\n\nexport type KnownPackageResolved = ResolvedKnownPackage;\n\nexport type PackageResolved = LocalPackageResolved | KnownPackageResolved;\n\n// ---------------------------------------------------------------------------\n// Factory options\n// ---------------------------------------------------------------------------\n\nexport interface LocalPackageOptions<\n\tPublisher extends PublisherAccountMember = PublisherAccountMember,\n\tCapture extends PackageCapture | undefined = undefined,\n> {\n\treadonly sourcePath: string;\n\treadonly mvrPlaceholder?: string;\n\treadonly excludeFromCodegen?: boolean;\n\t/** Capture created objects from the publish output. The record\n\t * form maps output keys to object-type suffixes, e.g.\n\t * `{ boardId: '::board::Board' }`. */\n\treadonly capture?: Capture;\n\t/** Publisher account — the signer for the publish tx. Pass the\n\t * result of `account('alice')` (the same plugin/resource ref used\n\t * in the rest of the stack — NOT a duplicate factory call).\n\t *\n\t * Required for local packages: a publish tx must be signed by\n\t * SOMEONE; we make the choice explicit so two packages in the\n\t * same stack can publish under different accounts (no implicit\n\t * \"first account\" convention to memorise). Distilled doc Invariant\n\t * 4 — \"Signer MUST be an explicit upstream\". */\n\treadonly publisher: Publisher;\n}\n\nexport interface KnownPackageOptions {\n\treadonly packageId: string;\n\treadonly upgradeCapId?: string;\n\treadonly mvrPlaceholder?: string;\n}\n\ninterface PackageRegistryProjectionContribution {\n\treadonly kind: 'local' | 'known';\n\treadonly name: string;\n\treadonly packageId: string;\n\treadonly upgradeCapId: string | null;\n\treadonly mvrPlaceholder: string;\n\treadonly sourcePath: string | null;\n}\n\nconst makePackageProjectionContribution = (\n\tcontribution: PackageRegistryProjectionContribution,\n): ProjectionDecl => {\n\tconst updatedAt = Date.now();\n\tconst key = `package/${contribution.name}` as `package/${string}`;\n\treturn projection({\n\t\tkind: 'package',\n\t\tkey,\n\t\tpayload: {\n\t\t\tkey,\n\t\t\trowKey: null,\n\t\t\tname: contribution.name,\n\t\t\tkind: contribution.kind,\n\t\t\tpackageId: contribution.packageId,\n\t\t\tupgradeCapId: contribution.upgradeCapId,\n\t\t\tmvrPlaceholder: contribution.mvrPlaceholder,\n\t\t\tsourcePath: contribution.sourcePath,\n\t\t\tupdatedAt,\n\t\t},\n\t\tat: updatedAt,\n\t});\n};\n\n// ---------------------------------------------------------------------------\n// Internal builders\n// ---------------------------------------------------------------------------\n\nconst normalizeCapture = <Capture extends PackageCapture | undefined>(\n\tpackageName: string,\n\tcapture: Capture,\n): PackageCaptureCallback | undefined => {\n\tif (capture === undefined) return undefined;\n\treturn (output) => {\n\t\tconst captured: Record<string, string> = {};\n\t\tfor (const [key, suffix] of Object.entries(capture)) {\n\t\t\tconst objectId = pickCreatedByType(output.objectChanges, { suffix });\n\t\t\tif (objectId === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`localPackage('${packageName}') capture '${key}' matched no created object with suffix '${suffix}'.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcaptured[key] = objectId;\n\t\t}\n\t\treturn captured;\n\t};\n};\n\nconst buildLocalPlugin = <\n\tName extends string,\n\tconst Publisher extends PublisherAccountMember,\n\tCapture extends PackageCapture | undefined,\n>(\n\tname: Name,\n\topts: LocalPackageOptions<Publisher, Capture>,\n) => {\n\tconst packageRef = resource<PackageResourceId<Name>, LocalPackageResolved<Capture>>(\n\t\tpackageResourceId(name),\n\t);\n\tconst capture = normalizeCapture(name, opts.capture);\n\n\treturn definePlugin({\n\t\tid: packageRef.id,\n\t\tdependsOn: { sui: suiResource, publisher: opts.publisher },\n\t\trole: 'task',\n\t\tsection: 'package',\n\t\twatch: {\n\t\t\t// File-watcher contribution — restart on Move source edits.\n\t\t\t// Distilled doc §Outputs: literal-path Packages contribute\n\t\t\t// watch roots. Effect-resolved paths do NOT auto-attach.\n\t\t\tpaths: [\n\t\t\t\t`${opts.sourcePath}/**/*.move`,\n\t\t\t\t`${opts.sourcePath}/Move.toml`,\n\t\t\t\t`${opts.sourcePath}/Move.lock`,\n\t\t\t],\n\t\t\tcascade: true,\n\t\t},\n\t\tstart: ({ sui, publisher: publisherAccount }) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\t// Substrate-context primitives: ArtifactPublisher\n\t\t\t\t// is provided by the supervisor's pluginContext;\n\t\t\t\t// ChainProbe is looked up via the StrategyRegistry\n\t\t\t\t// (Sui registered itself there at acquire). The\n\t\t\t\t// PackageRegistry is a per-stack plugin-owned service\n\t\t\t\t// (instantiated from the substrate's generic\n\t\t\t\t// ScopedRefMap primitive — see `registry.ts`) — every\n\t\t\t\t// package plugin in the stack yields the SAME instance\n\t\t\t\t// via `PackageRegistryService`, so cross-plugin lookups\n\t\t\t\t// stay consistent and warm-restart verify can use the\n\t\t\t\t// previous packageId as a hint.\n\t\t\t\tconst publisher = yield* ArtifactPublisherService;\n\t\t\t\tconst probe = yield* chainProbeFor<SuiProbeKey>(sui.chain);\n\t\t\t\tconst registry = yield* PackageRegistryService;\n\t\t\t\t// ContainerRuntime + the Sui plugin's resolved image feed\n\t\t\t\t// `runMoveBuild`'s path-(b) (`docker run --rm`) build path.\n\t\t\t\t// Sui surfaces `buildImage` on its resolved client; modes\n\t\t\t\t// without an in-stack image (external, live) surface null\n\t\t\t\t// — runMoveBuild then surfaces a typed error from path (c)\n\t\t\t\t// (host CLI not routed).\n\t\t\t\tconst containerRuntime = yield* ContainerRuntimeService;\n\n\t\t\t\t// Build the concrete `PublishExecutor` once per acquire.\n\t\t\t\t// Hands the resolved SuiSdkShim (for `Transaction.build`,\n\t\t\t\t// `executeTransaction`, `waitForTransaction`) and the\n\t\t\t\t// publisher account (for `signAndExecute`) to the executor\n\t\t\t\t// methods; mode-local's produce body drives them.\n\t\t\t\tconst executor = makePublishExecutor({\n\t\t\t\t\tsdk: sui.sdk,\n\t\t\t\t\taccount: publisherAccount,\n\t\t\t\t\truntime: containerRuntime,\n\t\t\t\t\tforkMode: sui.fork !== null,\n\t\t\t\t\t...(sui.buildImage !== null ? { buildImage: sui.buildImage } : {}),\n\t\t\t\t});\n\n\t\t\t\tconst mode = {\n\t\t\t\t\tmode: 'local',\n\t\t\t\t\tpackageName: name,\n\t\t\t\t\tsourcePath: opts.sourcePath,\n\t\t\t\t\tchainId: sui.chain,\n\t\t\t\t\tpublisherAddress: publisherAccount.address,\n\t\t\t\t\tmvrOverride: opts.mvrPlaceholder,\n\t\t\t\t\t...(capture !== undefined ? { capture } : {}),\n\t\t\t\t\texecutor,\n\t\t\t\t} satisfies PackageMode;\n\n\t\t\t\tconst { resolved, output } = yield* bootPackageService(publisher, probe, registry, mode);\n\n\t\t\t\tconst projected: LocalPackageResolved<Capture> = {\n\t\t\t\t\t...resolved,\n\t\t\t\t\tcaptured: resolved.captured as CapturedPackageValues<Capture>,\n\t\t\t\t\tpublisher: publisherAccount,\n\t\t\t\t\tpublishResult: output,\n\t\t\t\t};\n\t\t\t\treturn projected;\n\t\t\t}),\n\t\terrorContributions: packageErrorContributions,\n\t\tcapabilities: ({ value, runtime }) => makeLocalCapabilities(name, opts, value, runtime.chain),\n\t});\n};\n\nconst buildKnownPlugin = <Name extends string>(name: Name, opts: KnownPackageOptions) => {\n\tconst packageRef = resource<PackageResourceId<Name>, KnownPackageResolved>(\n\t\tpackageResourceId(name),\n\t);\n\treturn definePlugin({\n\t\tid: packageRef.id,\n\t\tdependsOn: { sui: suiResource },\n\t\trole: 'task',\n\t\tsection: 'package',\n\t\tstart: ({ sui }) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst publisher = yield* ArtifactPublisherService;\n\t\t\t\tconst probe = yield* chainProbeFor<SuiProbeKey>(sui.chain);\n\t\t\t\tconst registry = yield* PackageRegistryService;\n\t\t\t\tconst mode = {\n\t\t\t\t\tmode: 'known',\n\t\t\t\t\tpackageName: name,\n\t\t\t\t\tpackageId: opts.packageId,\n\t\t\t\t\tupgradeCapId: opts.upgradeCapId,\n\t\t\t\t\tmvrOverride: opts.mvrPlaceholder,\n\t\t\t\t} satisfies PackageMode;\n\t\t\t\tconst { resolved } = yield* bootPackageService(publisher, probe, registry, mode);\n\t\t\t\t// Known mode never publishes — no output to walk, so\n\t\t\t\t// the coin-discovery hook is skipped here. Users who\n\t\t\t\t// want coin records for a knownPackage point a\n\t\t\t\t// `coin.known('0xPKG::module::Witness')` at the\n\t\t\t\t// fully-qualified type directly; the bare-type path\n\t\t\t\t// hits the live RPC for metadata rather than the\n\t\t\t\t// output-walker.\n\t\t\t\treturn resolved;\n\t\t\t}),\n\t\terrorContributions: packageErrorContributions,\n\t\tcapabilities: ({ value }) => makeKnownCapabilities(name, opts, value),\n\t});\n};\n\nconst makeLocalCapabilities = (\n\tname: string,\n\topts: { readonly excludeFromCodegen?: boolean },\n\tresolved: LocalPackageResolved,\n\tchain: ChainId,\n) => {\n\t// Snapshot + codegen lift their typed fields off the resolved\n\t// publish (real packageId + captured object ids). The static-form\n\t// placeholders are gone.\n\tconst snap: SnapshotableDecl = makeSnapshotable(\n\t\tname,\n\t\tresolved.publishResult?.packageId ?? resolved.packageId,\n\t);\n\tconst codegen: CodegenableDecl<'package'> = makeLocalCodegenable(\n\t\t{\n\t\t\tkind: 'local',\n\t\t\tname,\n\t\t\tpackageId: resolved.packageId,\n\t\t\tupgradeCapId: resolved.upgradeCapId,\n\t\t\tsourcePath: resolved.sourcePath,\n\t\t\tmvrPlaceholder: resolved.mvrPlaceholder,\n\t\t\tcaptured: resolved.captured,\n\t\t},\n\t\t{ excluded: opts.excludeFromCodegen ?? false },\n\t);\n\t// The plugin contributes to the package-registry strategy under a\n\t// fixed key — the substrate orchestrator wires all packages'\n\t// contributions into the same per-stack registry.\n\tconst projection: PackageRegistryProjectionContribution = {\n\t\tkind: 'local',\n\t\tname,\n\t\tpackageId: resolved.packageId,\n\t\tupgradeCapId: resolved.upgradeCapId ?? null,\n\t\tmvrPlaceholder: resolved.mvrPlaceholder,\n\t\tsourcePath: resolved.sourcePath,\n\t};\n\tconst registryContribution: StrategyContributorDecl<\n\t\ttypeof PACKAGE_REGISTRY_CAPABILITY_KEY,\n\t\tPackageRegistryProjectionContribution\n\t> = {\n\t\tkind: 'strategy-contributor',\n\t\tcapabilityKey: PACKAGE_REGISTRY_CAPABILITY_KEY,\n\t\tstrategy: projection,\n\t\tautoMounted: true,\n\t};\n\treturn [\n\t\tsnap,\n\t\tcodegen,\n\t\tregistryContribution,\n\t\tmakePackageProjectionContribution(projection),\n\t\t...(resolved.publishResult === null\n\t\t\t? []\n\t\t\t: [\n\t\t\t\t\tmakeLocalPackagePublishedDecl({\n\t\t\t\t\t\tpackageName: name,\n\t\t\t\t\t\tpackageId: resolved.packageId,\n\t\t\t\t\t\tchain,\n\t\t\t\t\t\toutput: resolved.publishResult,\n\t\t\t\t\t}),\n\t\t\t\t]),\n\t] as const;\n};\n\nconst makeKnownCapabilities = (\n\tname: string,\n\topts: KnownPackageOptions,\n\tresolved: KnownPackageResolved,\n) => {\n\tconst snap: SnapshotableDecl = makeSnapshotable(name, `known:${resolved.packageId}`);\n\tconst codegen: CodegenableDecl<'package'> = makeKnownCodegenable({\n\t\tkind: 'known',\n\t\tname,\n\t\tpackageId: resolved.packageId,\n\t\tupgradeCapId: resolved.upgradeCapId ?? opts.upgradeCapId,\n\t\tmvrPlaceholder: resolved.mvrPlaceholder,\n\t});\n\tconst projection: PackageRegistryProjectionContribution = {\n\t\tkind: 'known',\n\t\tname,\n\t\tpackageId: resolved.packageId,\n\t\tupgradeCapId: resolved.upgradeCapId ?? opts.upgradeCapId ?? null,\n\t\tmvrPlaceholder: resolved.mvrPlaceholder,\n\t\tsourcePath: null,\n\t};\n\tconst registryContribution: StrategyContributorDecl<\n\t\ttypeof PACKAGE_REGISTRY_CAPABILITY_KEY,\n\t\tPackageRegistryProjectionContribution\n\t> = {\n\t\tkind: 'strategy-contributor',\n\t\tcapabilityKey: PACKAGE_REGISTRY_CAPABILITY_KEY,\n\t\tstrategy: projection,\n\t\tautoMounted: true,\n\t};\n\treturn [\n\t\tsnap,\n\t\tcodegen,\n\t\tregistryContribution,\n\t\tmakePackageProjectionContribution(projection),\n\t] as const;\n};\n\n// ---------------------------------------------------------------------------\n// Public factories\n// ---------------------------------------------------------------------------\n\n/** Build + publish a local Move package. The resolved value is\n * `LocalPackageResolved` so consumers that need bindings / source\n * path are typed correctly.\n *\n * Required `opts.publisher`: the account that signs the publish tx.\n * Pass the same `account('alice')` reference used elsewhere in the\n * stack — the package.s `dependsOn` includes `account/<publisher>`\n * so the substrate orders the publisher's keypair + funding strictly\n * before publish. */\nexport const localPackage = <\n\tName extends string,\n\tconst Publisher extends PublisherAccountMember,\n\tconst Capture extends PackageCapture | undefined = undefined,\n>(\n\tname: Name,\n\topts: LocalPackageOptions<Publisher, Capture>,\n) => buildLocalPlugin(name, opts);\n\n/** Verify-only against a fixed on-chain package id. The resolved\n * value is `KnownPackageResolved` — narrower than local, so the\n * bindings emitter rejects this at compose time. */\nexport const knownPackage = <Name extends string>(name: Name, opts: KnownPackageOptions) =>\n\tbuildKnownPlugin(name, opts);\n"],"mappings":"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"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./registry.mjs";
|
|
1
2
|
import { publishError } from "./errors.mjs";
|
|
2
3
|
import { mvrSlugify } from "./dep-resolution.mjs";
|
|
3
4
|
import { Effect, Schema } from "effect";
|
|
@@ -8,23 +9,36 @@ const KnownObjectShape = Schema.Struct({ objectId: Schema.String });
|
|
|
8
9
|
/**
|
|
9
10
|
* Acquire body for known mode.
|
|
10
11
|
*
|
|
11
|
-
* Runs
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* Runs a strict ChainProbe verify and registers the resolved value.
|
|
13
|
+
* Strict mode surfaces a typed `ChainProbeError` whose `reason`
|
|
14
|
+
* discriminates an authoritative miss from a transient RPC failure, so we
|
|
15
|
+
* can fail boot on a real typo / wrong-network mistake while masking
|
|
16
|
+
* transient failures so a flaky RPC does not abort boot:
|
|
17
|
+
* - `reason: 'not-found'` → verify failure (no object at the id).
|
|
18
|
+
* - `reason: 'decode-failed'` → verify failure (an object exists but is
|
|
19
|
+
* the wrong object kind — its on-chain shape fails `KnownObjectShape`).
|
|
20
|
+
* - `reason: 'transient' | 'no-probe-registered'` → masked; the verify
|
|
21
|
+
* re-runs on the next cycle.
|
|
22
|
+
* A `null` strict payload (probe reports absence after decode) is also a
|
|
23
|
+
* verify failure.
|
|
17
24
|
*/
|
|
18
25
|
const acquireKnown = (probe, registry, inputs) => Effect.gen(function* () {
|
|
19
26
|
const mvrPlaceholder = mvrSlugify(inputs.mvrOverride ?? inputs.packageName);
|
|
20
|
-
|
|
21
|
-
kind: "object",
|
|
22
|
-
objectId: inputs.packageId
|
|
23
|
-
}, KnownObjectShape, "lenient").pipe(Effect.mapError(() => publishError("verify", {
|
|
27
|
+
const verifyError = (message) => publishError("verify", {
|
|
24
28
|
sourcePath: `known:${inputs.packageId}`,
|
|
25
29
|
packageName: inputs.packageName,
|
|
26
|
-
message
|
|
27
|
-
})
|
|
30
|
+
message
|
|
31
|
+
});
|
|
32
|
+
if ((yield* probe.get({
|
|
33
|
+
kind: "object",
|
|
34
|
+
objectId: inputs.packageId
|
|
35
|
+
}, KnownObjectShape, "strict").pipe(Effect.catch((err) => {
|
|
36
|
+
switch (err.reason) {
|
|
37
|
+
case "not-found": return Effect.fail(verifyError(`known package id ${inputs.packageId} does not exist on this chain — check for a typo or wrong network.`));
|
|
38
|
+
case "decode-failed": return Effect.fail(verifyError(`known package id ${inputs.packageId} resolved to an unexpected object shape on this chain — check for a typo or wrong network.`));
|
|
39
|
+
default: return Effect.succeed("transient");
|
|
40
|
+
}
|
|
41
|
+
}))) === null) return yield* Effect.fail(verifyError(`known package id ${inputs.packageId} resolved to an unexpected object shape on this chain.`));
|
|
28
42
|
const resolved = {
|
|
29
43
|
kind: "known",
|
|
30
44
|
name: inputs.packageName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mode-known.mjs","names":[],"sources":["../../../src/plugins/package/mode-known.ts"],"sourcesContent":["// Known mode — skip publish; load existing package id from on-chain.\n//\n// Distilled doc §Responsibilities + §Inputs/dependencies §KnownPackage-\n// only: a `KnownPackage` declares a fixed `packageId` (optionally\n// `upgradeCapId`, `mvrPlaceholder`) and threads through the same\n// registries as a freshly published one. No build, no publish-tx, no\n// cache key folding by content-hash — the id IS the identity.\n//\n// What we still do:\n//\n// 1.
|
|
1
|
+
{"version":3,"file":"mode-known.mjs","names":[],"sources":["../../../src/plugins/package/mode-known.ts"],"sourcesContent":["// Known mode — skip publish; load existing package id from on-chain.\n//\n// Distilled doc §Responsibilities + §Inputs/dependencies §KnownPackage-\n// only: a `KnownPackage` declares a fixed `packageId` (optionally\n// `upgradeCapId`, `mvrPlaceholder`) and threads through the same\n// registries as a freshly published one. No build, no publish-tx, no\n// cache key folding by content-hash — the id IS the identity.\n//\n// What we still do:\n//\n// 1. Strict verify probe (chain reachable + object exists). Strict\n// mode lets the ChainProbe distinguish an authoritative miss from a\n// transient RPC failure. Two miss shapes surface a\n// PublishError(phase='verify') so the user catches the typo /\n// wrong-network mistake at boot:\n// - `reason: 'not-found'` — no object at the id.\n// - `reason: 'decode-failed'` — an object exists at the id but\n// its on-chain shape does not satisfy `KnownObjectShape`\n// (a wrong-kind object — the typical wrong-network / copy-paste\n// mistake). This is a THROWN `ChainProbeError`, not a `null`\n// result, because the real Sui probe fails Schema decode on a\n// wrong-shape id.\n// Only genuinely-transient reasons (`'transient'`,\n// `'no-probe-registered'`) are masked (no abort) — the id re-verifies\n// on the next cycle rather than failing boot on a flaky RPC. A `null`\n// strict result (object decodes against the minimal shape but the\n// probe still reports absence) is also treated as a verify failure.\n// 2. Register the resolved value on EVERY cycle.\n//\n// Bindings: KnownPackage cannot be bound by `@mysten/codegen` (no\n// source tree). The codegen contribution emitted for known packages\n// has `sourcePath: null`; the codegen orchestrator filters those\n// out before invoking the bindings emitter. The user-facing type\n// split (`localPackage` vs `knownPackage` factories) enforces this\n// at compose time per distilled doc Invariant 9.\n\nimport { Effect, Schema, type Scope } from 'effect';\n\nimport type { ChainProbe } from '../../contracts/chain-probe.ts';\nimport type { SuiProbeKey } from '../sui/index.ts';\nimport { mvrSlugify } from './dep-resolution.ts';\nimport { type PackageRegistry, type ResolvedKnownPackage } from './registry.ts';\nimport { publishError, type PublishError } from './errors.ts';\n\n/** Verify-schema for known mode — minimum signal: object exists at\n * the given id. */\nconst KnownObjectShape = Schema.Struct({\n\tobjectId: Schema.String,\n});\n\nexport interface KnownModeInputs {\n\treadonly packageName: string;\n\treadonly packageId: string;\n\treadonly upgradeCapId?: string;\n\treadonly mvrOverride?: string;\n}\n\nexport interface KnownModeOutputs {\n\treadonly resolved: ResolvedKnownPackage;\n}\n\n/**\n * Acquire body for known mode.\n *\n * Runs a strict ChainProbe verify and registers the resolved value.\n * Strict mode surfaces a typed `ChainProbeError` whose `reason`\n * discriminates an authoritative miss from a transient RPC failure, so we\n * can fail boot on a real typo / wrong-network mistake while masking\n * transient failures so a flaky RPC does not abort boot:\n * - `reason: 'not-found'` → verify failure (no object at the id).\n * - `reason: 'decode-failed'` → verify failure (an object exists but is\n * the wrong object kind — its on-chain shape fails `KnownObjectShape`).\n * - `reason: 'transient' | 'no-probe-registered'` → masked; the verify\n * re-runs on the next cycle.\n * A `null` strict payload (probe reports absence after decode) is also a\n * verify failure.\n */\nexport const acquireKnown = (\n\tprobe: ChainProbe<SuiProbeKey>,\n\tregistry: PackageRegistry,\n\tinputs: KnownModeInputs,\n): Effect.Effect<KnownModeOutputs, PublishError, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tconst mvrPlaceholder = mvrSlugify(inputs.mvrOverride ?? inputs.packageName);\n\n\t\tconst verifyError = (message: string): PublishError =>\n\t\t\tpublishError('verify', {\n\t\t\t\tsourcePath: `known:${inputs.packageId}`,\n\t\t\t\tpackageName: inputs.packageName,\n\t\t\t\tmessage,\n\t\t\t});\n\t\t// `'transient'` is a sentinel for \"masked transient RPC failure —\n\t\t// skip the verify aborts and re-derive next cycle\".\n\t\tconst found: { readonly objectId: string } | null | 'transient' = yield* probe\n\t\t\t.get({ kind: 'object', objectId: inputs.packageId }, KnownObjectShape, 'strict')\n\t\t\t.pipe(\n\t\t\t\t// Classify the strict-probe failure. An authoritative miss\n\t\t\t\t// (`not-found`) and a wrong-kind object (`decode-failed` — an\n\t\t\t\t// object exists at the id but its shape does not satisfy\n\t\t\t\t// `KnownObjectShape`) BOTH surface a verify error: they are the\n\t\t\t\t// typo / wrong-network mistakes strict mode exists to catch. Only\n\t\t\t\t// genuinely-transient reasons (`transient`, `no-probe-registered`)\n\t\t\t\t// are masked so the id re-verifies next cycle rather than aborting\n\t\t\t\t// boot on a flaky RPC.\n\t\t\t\tEffect.catch((err) => {\n\t\t\t\t\tswitch (err.reason) {\n\t\t\t\t\t\tcase 'not-found':\n\t\t\t\t\t\t\treturn Effect.fail(\n\t\t\t\t\t\t\t\tverifyError(\n\t\t\t\t\t\t\t\t\t`known package id ${inputs.packageId} does not exist on this chain — check for a typo or wrong network.`,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tcase 'decode-failed':\n\t\t\t\t\t\t\treturn Effect.fail(\n\t\t\t\t\t\t\t\tverifyError(\n\t\t\t\t\t\t\t\t\t`known package id ${inputs.packageId} resolved to an unexpected object shape on this chain — check for a typo or wrong network.`,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn Effect.succeed('transient' as const);\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t// A `null` strict result means the id exists but is not the\n\t\t// expected object kind — also a verify failure.\n\t\tif (found === null) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tverifyError(\n\t\t\t\t\t`known package id ${inputs.packageId} resolved to an unexpected object shape on this chain.`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tconst resolved: ResolvedKnownPackage = {\n\t\t\tkind: 'known',\n\t\t\tname: inputs.packageName,\n\t\t\tpackageId: inputs.packageId,\n\t\t\tupgradeCapId: inputs.upgradeCapId,\n\t\t\tmvrPlaceholder,\n\t\t};\n\n\t\t// Distilled doc Invariant 6: register on EVERY cycle (here\n\t\t// always — known mode has no \"miss\" branch).\n\t\tyield* registry.set(resolved.name, resolved);\n\n\t\treturn { resolved };\n\t});\n"],"mappings":";;;;;;;AA8CA,MAAM,mBAAmB,OAAO,OAAO,EACtC,UAAU,OAAO,QACjB,CAAC;;;;;;;;;;;;;;;;;AA6BF,MAAa,gBACZ,OACA,UACA,WAEA,OAAO,IAAI,aAAa;CACvB,MAAM,iBAAiB,WAAW,OAAO,eAAe,OAAO,YAAY;CAE3E,MAAM,eAAe,YACpB,aAAa,UAAU;EACtB,YAAY,SAAS,OAAO;EAC5B,aAAa,OAAO;EACpB;EACA,CAAC;AAmCH,MAAI,OAhCqE,MACvE,IAAI;EAAE,MAAM;EAAU,UAAU,OAAO;EAAW,EAAE,kBAAkB,SAAS,CAC/E,KASA,OAAO,OAAO,QAAQ;AACrB,UAAQ,IAAI,QAAZ;GACC,KAAK,YACJ,QAAO,OAAO,KACb,YACC,oBAAoB,OAAO,UAAU,oEACrC,CACD;GACF,KAAK,gBACJ,QAAO,OAAO,KACb,YACC,oBAAoB,OAAO,UAAU,4FACrC,CACD;GACF,QACC,QAAO,OAAO,QAAQ,YAAqB;;GAE5C,CACF,MAGY,KACb,QAAO,OAAO,OAAO,KACpB,YACC,oBAAoB,OAAO,UAAU,wDACrC,CACD;CAGF,MAAM,WAAiC;EACtC,MAAM;EACN,MAAM,OAAO;EACb,WAAW,OAAO;EAClB,cAAc,OAAO;EACrB;EACA;AAID,QAAO,SAAS,IAAI,SAAS,MAAM,SAAS;AAE5C,QAAO,EAAE,UAAU;EAClB"}
|