@mysten-incubation/devstack 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dashboard-ui/assets/grpc-a4usE3Nk.js +3 -0
- package/dashboard-ui/assets/index-B82Bh84P.css +1 -0
- package/dashboard-ui/assets/index-CRYJ4pru.js +1277 -0
- package/dashboard-ui/index.html +2 -2
- package/dist/api/define-capabilities.d.mts +1 -20
- package/dist/api/define-capabilities.mjs +15 -22
- package/dist/api/define-capabilities.mjs.map +1 -1
- package/dist/api/define-devstack-with.d.mts +7 -1
- package/dist/api/define-devstack-with.mjs.map +1 -1
- package/dist/api/define-devstack.mjs.map +1 -1
- package/dist/api/define-plugin.d.mts +2 -1
- package/dist/api/inference-network.d.mts +31 -17
- package/dist/api/inference-network.mjs +40 -43
- package/dist/api/inference-network.mjs.map +1 -1
- package/dist/api/load-config.mjs +88 -0
- package/dist/api/load-config.mjs.map +1 -0
- package/dist/api/mode-narrowed-factory.d.mts +1 -1
- package/dist/api/mode-narrowed-factory.mjs.map +1 -1
- package/dist/api/run-stack-internal.mjs +202 -0
- package/dist/api/run-stack-internal.mjs.map +1 -0
- package/dist/api/run-stack.d.mts +82 -31
- package/dist/api/run-stack.mjs +22 -141
- package/dist/api/run-stack.mjs.map +1 -1
- package/dist/build-integrations/dapp-kit/index.d.mts +61 -0
- package/dist/build-integrations/dapp-kit/index.mjs +58 -0
- package/dist/build-integrations/dapp-kit/index.mjs.map +1 -0
- package/dist/build-integrations/playwright/config.d.mts +1 -30
- package/dist/build-integrations/playwright/config.mjs +1 -27
- package/dist/build-integrations/playwright/config.mjs.map +1 -1
- package/dist/build-integrations/playwright/errors.d.mts +4 -7
- package/dist/build-integrations/playwright/errors.mjs.map +1 -1
- package/dist/build-integrations/playwright/global-setup.d.mts +42 -71
- package/dist/build-integrations/playwright/global-setup.mjs +142 -218
- package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
- package/dist/build-integrations/playwright/index.d.mts +2 -2
- package/dist/build-integrations/playwright/index.mjs +2 -2
- package/dist/build-integrations/playwright/stack-context.d.mts +3 -1
- package/dist/build-integrations/playwright/stack-context.mjs +4 -2
- package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
- package/dist/build-integrations/playwright/wallet-context.mjs +44 -19
- package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
- package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
- package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -1
- package/dist/build-integrations/runtime/dapp-kit-slot.mjs.map +1 -1
- package/dist/build-integrations/runtime/discover.d.mts +6 -4
- package/dist/build-integrations/runtime/discover.mjs +15 -4
- package/dist/build-integrations/runtime/discover.mjs.map +1 -1
- package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
- package/dist/build-integrations/runtime/errors.mjs.map +1 -1
- package/dist/build-integrations/runtime/read-stack-context.mjs +3 -3
- package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
- package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +23 -7
- package/dist/build-integrations/runtime/resolve-discovery-env.mjs +25 -12
- package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -1
- package/dist/build-integrations/runtime/stack-context.d.mts +2 -2
- package/dist/build-integrations/vite/index.d.mts +84 -19
- package/dist/build-integrations/vite/index.mjs +203 -28
- package/dist/build-integrations/vite/index.mjs.map +1 -1
- package/dist/build-integrations/vitest/config.d.mts +20 -2
- package/dist/build-integrations/vitest/config.mjs +16 -4
- package/dist/build-integrations/vitest/config.mjs.map +1 -1
- package/dist/build-integrations/vitest/env.d.mts +18 -10
- package/dist/build-integrations/vitest/env.mjs +11 -10
- package/dist/build-integrations/vitest/env.mjs.map +1 -1
- package/dist/build-integrations/vitest/errors.d.mts +7 -11
- package/dist/build-integrations/vitest/errors.mjs +3 -4
- package/dist/build-integrations/vitest/errors.mjs.map +1 -1
- package/dist/build-integrations/vitest/global-setup.d.mts +35 -0
- package/dist/build-integrations/vitest/global-setup.mjs +156 -0
- package/dist/build-integrations/vitest/global-setup.mjs.map +1 -0
- package/dist/build-integrations/vitest/index.d.mts +3 -2
- package/dist/build-integrations/vitest/index.mjs +3 -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 +5 -3
- package/dist/build-integrations/vitest/stack-context.mjs +3 -2
- package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
- package/dist/cli/bail.mjs.map +1 -1
- package/dist/cli/doctor-probes.mjs +1 -3
- package/dist/cli/doctor-probes.mjs.map +1 -1
- package/dist/cli/main.d.mts +23 -1
- package/dist/cli/main.mjs +63 -8
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/prune-direct.mjs.map +1 -1
- package/dist/cli/snapshot-reader.mjs.map +1 -1
- package/dist/cli/up-lifecycle.mjs.map +1 -1
- package/dist/cli/wirings/apply.mjs +28 -21
- package/dist/cli/wirings/apply.mjs.map +1 -1
- package/dist/cli/wirings/codegen.mjs +108 -0
- package/dist/cli/wirings/codegen.mjs.map +1 -0
- package/dist/cli/wirings/config-loader.mjs +12 -62
- package/dist/cli/wirings/config-loader.mjs.map +1 -1
- package/dist/cli/wirings/dump-ids.mjs +86 -0
- package/dist/cli/wirings/dump-ids.mjs.map +1 -0
- package/dist/cli/wirings/engine-command.mjs +1 -1
- package/dist/cli/wirings/engine-command.mjs.map +1 -1
- package/dist/cli/wirings/identity.mjs +2 -2
- package/dist/cli/wirings/identity.mjs.map +1 -1
- package/dist/cli/wirings/provide-file-system.mjs.map +1 -1
- package/dist/cli/wirings/read-devstack-version.mjs +17 -0
- package/dist/cli/wirings/read-devstack-version.mjs.map +1 -0
- package/dist/cli/wirings/snapshot.mjs +27 -34
- package/dist/cli/wirings/snapshot.mjs.map +1 -1
- package/dist/cli/wirings/up-ipc.mjs +147 -0
- package/dist/cli/wirings/up-ipc.mjs.map +1 -0
- package/dist/cli/wirings/up.mjs +218 -198
- package/dist/cli/wirings/up.mjs.map +1 -1
- package/dist/cli/wirings/wipe.mjs +1 -1
- package/dist/cli/wirings/wipe.mjs.map +1 -1
- package/dist/contracts/chain-probe.d.mts +1 -1
- package/dist/contracts/chain-probe.mjs +1 -1
- package/dist/contracts/chain-probe.mjs.map +1 -1
- package/dist/contracts/codegenable.d.mts +60 -6
- package/dist/contracts/codegenable.mjs +28 -0
- package/dist/contracts/codegenable.mjs.map +1 -0
- package/dist/contracts/config-bindings.mjs +162 -0
- package/dist/contracts/config-bindings.mjs.map +1 -0
- package/dist/contracts/container-runtime.d.mts +23 -17
- package/dist/contracts/plugin-expander.mjs.map +1 -1
- package/dist/contracts/snapshotable.d.mts +5 -7
- package/dist/contracts/wallet-protocol.d.mts +2 -5
- package/dist/contracts/wallet-protocol.mjs +2 -5
- package/dist/contracts/wallet-protocol.mjs.map +1 -1
- package/dist/index.d.mts +21 -26
- package/dist/index.mjs +8 -9
- package/dist/orchestrators/boot.d.mts +28 -0
- package/dist/orchestrators/boot.mjs +440 -0
- package/dist/orchestrators/boot.mjs.map +1 -0
- package/dist/orchestrators/codegen/bindings.d.mts +13 -1
- package/dist/orchestrators/codegen/bindings.mjs +23 -9
- package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
- package/dist/orchestrators/codegen/config-runtime.mjs +208 -0
- package/dist/orchestrators/codegen/config-runtime.mjs.map +1 -0
- package/dist/orchestrators/codegen/emit.mjs +1 -1
- package/dist/orchestrators/codegen/emit.mjs.map +1 -1
- package/dist/orchestrators/codegen/errors.mjs +21 -1
- package/dist/orchestrators/codegen/errors.mjs.map +1 -1
- package/dist/orchestrators/codegen/format.mjs +2 -0
- package/dist/orchestrators/codegen/format.mjs.map +1 -1
- package/dist/orchestrators/codegen/gitignore.mjs +30 -11
- package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
- package/dist/orchestrators/codegen/id-config.mjs +107 -0
- package/dist/orchestrators/codegen/id-config.mjs.map +1 -0
- package/dist/orchestrators/codegen/output-location.mjs +23 -32
- package/dist/orchestrators/codegen/output-location.mjs.map +1 -1
- package/dist/orchestrators/codegen/paths.mjs +8 -1
- package/dist/orchestrators/codegen/paths.mjs.map +1 -1
- package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
- package/dist/orchestrators/codegen/service.mjs +286 -58
- package/dist/orchestrators/codegen/service.mjs.map +1 -1
- package/dist/orchestrators/layers.mjs +31 -0
- package/dist/orchestrators/layers.mjs.map +1 -0
- package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -1
- package/dist/orchestrators/lifecycle-prune/index.mjs +8 -10
- package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -1
- package/dist/orchestrators/network-options.d.mts +52 -0
- package/dist/orchestrators/network-options.mjs +43 -0
- package/dist/orchestrators/network-options.mjs.map +1 -0
- package/dist/orchestrators/router/cleanup.mjs.map +1 -1
- package/dist/orchestrators/router/cors.mjs.map +1 -1
- package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
- package/dist/orchestrators/router/errors.mjs.map +1 -1
- package/dist/orchestrators/router/file-provider.mjs.map +1 -1
- package/dist/orchestrators/router/hostname.mjs.map +1 -1
- package/dist/orchestrators/router/profile.mjs +1 -1
- package/dist/orchestrators/router/profile.mjs.map +1 -1
- package/dist/orchestrators/router/service.d.mts +2 -2
- package/dist/orchestrators/router/service.mjs +12 -27
- package/dist/orchestrators/router/service.mjs.map +1 -1
- package/dist/orchestrators/router/traefik-container.mjs +1 -1
- package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
- package/dist/orchestrators/snapshot/capture.mjs +171 -195
- package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
- package/dist/orchestrators/snapshot/descriptor.d.mts +1 -1
- package/dist/orchestrators/snapshot/descriptor.mjs +53 -11
- package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
- package/dist/orchestrators/snapshot/identity-guard.mjs +3 -5
- package/dist/orchestrators/snapshot/identity-guard.mjs.map +1 -1
- package/dist/orchestrators/snapshot/image-bundle-tags.mjs +32 -101
- package/dist/orchestrators/snapshot/image-bundle-tags.mjs.map +1 -1
- package/dist/orchestrators/snapshot/index.mjs +1 -4
- package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
- package/dist/orchestrators/snapshot/interrupted-restore.mjs +116 -0
- package/dist/orchestrators/snapshot/interrupted-restore.mjs.map +1 -0
- package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -1
- package/dist/orchestrators/snapshot/prune.mjs +40 -31
- package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
- package/dist/orchestrators/snapshot/restore.mjs +221 -196
- package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
- package/dist/orchestrators/snapshot/service.mjs +72 -62
- package/dist/orchestrators/snapshot/service.mjs.map +1 -1
- package/dist/orchestrators/snapshot/wipe.mjs +67 -56
- package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
- package/dist/plugins/account/codegen.mjs +3 -0
- package/dist/plugins/account/codegen.mjs.map +1 -1
- package/dist/plugins/account/errors.d.mts +2 -2
- package/dist/plugins/account/errors.mjs +1 -4
- package/dist/plugins/account/errors.mjs.map +1 -1
- package/dist/plugins/account/funding.mjs +3 -27
- package/dist/plugins/account/funding.mjs.map +1 -1
- package/dist/plugins/account/index.d.mts +3 -8
- package/dist/plugins/account/index.mjs +71 -35
- package/dist/plugins/account/index.mjs.map +1 -1
- package/dist/plugins/account/keypair.d.mts +8 -7
- package/dist/plugins/account/keypair.mjs +5 -18
- package/dist/plugins/account/keypair.mjs.map +1 -1
- package/dist/plugins/account/lease.mjs.map +1 -1
- package/dist/plugins/account/registry.d.mts +1 -46
- package/dist/plugins/account/registry.mjs.map +1 -1
- package/dist/plugins/account/service.d.mts +43 -34
- package/dist/plugins/account/service.mjs +9 -54
- package/dist/plugins/account/service.mjs.map +1 -1
- package/dist/plugins/account/snapshot.mjs.map +1 -1
- package/dist/plugins/account/variants/ephemeral.mjs.map +1 -1
- package/dist/plugins/account/variants/impersonate.mjs.map +1 -1
- package/dist/plugins/account/variants/signer.mjs.map +1 -1
- package/dist/plugins/action/discriminator.mjs.map +1 -1
- package/dist/plugins/action/errors.mjs +1 -4
- package/dist/plugins/action/errors.mjs.map +1 -1
- package/dist/plugins/action/execute.mjs +3 -4
- package/dist/plugins/action/execute.mjs.map +1 -1
- package/dist/plugins/action/index.d.mts +2 -2
- package/dist/plugins/action/index.mjs +7 -11
- package/dist/plugins/action/index.mjs.map +1 -1
- package/dist/plugins/action/service.d.mts +5 -7
- package/dist/plugins/action/service.mjs +2 -16
- package/dist/plugins/action/service.mjs.map +1 -1
- package/dist/plugins/coin/address-resolution.mjs.map +1 -1
- package/dist/plugins/coin/codegen.mjs +97 -16
- package/dist/plugins/coin/codegen.mjs.map +1 -1
- package/dist/plugins/coin/discovery.mjs.map +1 -1
- package/dist/plugins/coin/errors.mjs +1 -4
- package/dist/plugins/coin/errors.mjs.map +1 -1
- package/dist/plugins/coin/index.d.mts +4 -34
- package/dist/plugins/coin/index.mjs +47 -28
- package/dist/plugins/coin/index.mjs.map +1 -1
- package/dist/plugins/coin/metadata.d.mts +1 -0
- package/dist/plugins/coin/metadata.mjs +8 -9
- package/dist/plugins/coin/metadata.mjs.map +1 -1
- package/dist/plugins/coin/mint.mjs +7 -21
- package/dist/plugins/coin/mint.mjs.map +1 -1
- package/dist/plugins/coin/registry.mjs +33 -20
- package/dist/plugins/coin/registry.mjs.map +1 -1
- package/dist/plugins/coin/service.d.mts +1 -1
- package/dist/plugins/coin/service.mjs +1 -8
- package/dist/plugins/coin/service.mjs.map +1 -1
- package/dist/plugins/coin/snapshot.mjs.map +1 -1
- package/dist/plugins/coin/type-strings.mjs.map +1 -1
- package/dist/plugins/dashboard/domain.mjs +106 -167
- package/dist/plugins/dashboard/domain.mjs.map +1 -1
- package/dist/plugins/dashboard/index.mjs +13 -13
- package/dist/plugins/dashboard/index.mjs.map +1 -1
- package/dist/plugins/dashboard/origin-policy.mjs +3 -3
- package/dist/plugins/dashboard/origin-policy.mjs.map +1 -1
- package/dist/plugins/dashboard/routable.mjs.map +1 -1
- package/dist/plugins/dashboard/schema/builder.mjs.map +1 -1
- package/dist/plugins/dashboard/schema/enums.mjs.map +1 -1
- package/dist/plugins/dashboard/schema/root.mjs +23 -44
- package/dist/plugins/dashboard/schema/root.mjs.map +1 -1
- package/dist/plugins/dashboard/schema/types.mjs +37 -91
- package/dist/plugins/dashboard/schema/types.mjs.map +1 -1
- package/dist/plugins/dashboard/schema.mjs.map +1 -1
- package/dist/plugins/dashboard/server.mjs.map +1 -1
- package/dist/plugins/deepbook/codegen.d.mts +12 -11
- package/dist/plugins/deepbook/codegen.mjs +108 -11
- package/dist/plugins/deepbook/codegen.mjs.map +1 -1
- package/dist/plugins/deepbook/deploy.mjs +7 -14
- package/dist/plugins/deepbook/deploy.mjs.map +1 -1
- package/dist/plugins/deepbook/errors.mjs +4 -2
- package/dist/plugins/deepbook/errors.mjs.map +1 -1
- package/dist/plugins/deepbook/faucet-strategy.mjs +4 -10
- package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
- package/dist/plugins/deepbook/hash.mjs.map +1 -1
- package/dist/plugins/deepbook/index.d.mts +38 -34
- package/dist/plugins/deepbook/index.mjs +133 -64
- package/dist/plugins/deepbook/index.mjs.map +1 -1
- package/dist/plugins/deepbook/plugin-key.mjs.map +1 -1
- package/dist/plugins/deepbook/pyth/index.mjs +4 -8
- package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
- package/dist/plugins/deepbook/snapshot.mjs +0 -1
- package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
- package/dist/plugins/deepbook/type-strings.mjs.map +1 -1
- package/dist/plugins/deepbook/types.d.mts +2 -1
- package/dist/plugins/deepbook/types.mjs.map +1 -1
- package/dist/plugins/faucet/dispatcher.d.mts +3 -3
- package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
- package/dist/plugins/faucet/errors.mjs.map +1 -1
- package/dist/plugins/faucet/http.mjs +2 -10
- package/dist/plugins/faucet/http.mjs.map +1 -1
- package/dist/plugins/faucet/index.mjs +0 -1
- package/dist/plugins/faucet/index.mjs.map +1 -1
- package/dist/plugins/host-service/errors.d.mts +1 -3
- package/dist/plugins/host-service/errors.mjs +1 -2
- package/dist/plugins/host-service/errors.mjs.map +1 -1
- package/dist/plugins/host-service/index.d.mts +1 -2
- package/dist/plugins/host-service/index.mjs +11 -11
- package/dist/plugins/host-service/index.mjs.map +1 -1
- package/dist/plugins/host-service/routable.mjs.map +1 -1
- package/dist/plugins/host-service/service.mjs +13 -13
- package/dist/plugins/host-service/service.mjs.map +1 -1
- package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -1
- package/dist/plugins/internal/codegen-helpers.mjs +2 -0
- package/dist/plugins/internal/codegen-helpers.mjs.map +1 -1
- package/dist/plugins/internal/funding-failure-error.mjs.map +1 -1
- package/dist/plugins/{postgres → internal/postgres-sidecar}/connection.mjs +1 -1
- package/dist/plugins/internal/postgres-sidecar/connection.mjs.map +1 -0
- package/dist/plugins/{postgres → internal/postgres-sidecar}/db-ensure.mjs +30 -16
- package/dist/plugins/internal/postgres-sidecar/db-ensure.mjs.map +1 -0
- package/dist/plugins/internal/postgres-sidecar/errors.mjs +21 -0
- package/dist/plugins/internal/postgres-sidecar/errors.mjs.map +1 -0
- package/dist/{substrate/runtime/scoped-multimap → plugins/internal/postgres-sidecar}/index.mjs +1 -0
- package/dist/plugins/internal/postgres-sidecar/service.mjs +121 -0
- package/dist/plugins/internal/postgres-sidecar/service.mjs.map +1 -0
- package/dist/plugins/package/build.mjs +2 -2
- package/dist/plugins/package/build.mjs.map +1 -1
- package/dist/plugins/package/codegen.d.mts +7 -14
- package/dist/plugins/package/codegen.mjs +187 -59
- package/dist/plugins/package/codegen.mjs.map +1 -1
- package/dist/plugins/package/dep-resolution.mjs +51 -3
- package/dist/plugins/package/dep-resolution.mjs.map +1 -1
- package/dist/plugins/package/errors.mjs +1 -4
- package/dist/plugins/package/errors.mjs.map +1 -1
- package/dist/plugins/package/git-source.d.mts +18 -0
- package/dist/plugins/package/git-source.mjs +119 -0
- package/dist/plugins/package/git-source.mjs.map +1 -0
- package/dist/plugins/package/index.d.mts +28 -19
- package/dist/plugins/package/index.mjs +107 -32
- package/dist/plugins/package/index.mjs.map +1 -1
- package/dist/plugins/package/mode-known.mjs +2 -2
- package/dist/plugins/package/mode-known.mjs.map +1 -1
- package/dist/plugins/package/mode-local.mjs +18 -35
- package/dist/plugins/package/mode-local.mjs.map +1 -1
- package/dist/plugins/package/publish-executor.mjs +13 -8
- package/dist/plugins/package/publish-executor.mjs.map +1 -1
- package/dist/plugins/package/publish-output.d.mts +1 -11
- package/dist/plugins/package/publish-output.mjs +1 -9
- package/dist/plugins/package/publish-output.mjs.map +1 -1
- package/dist/plugins/package/registry.d.mts +1 -1
- package/dist/plugins/package/registry.mjs +26 -14
- package/dist/plugins/package/registry.mjs.map +1 -1
- package/dist/plugins/package/service.mjs.map +1 -1
- package/dist/plugins/package/snapshot.mjs.map +1 -1
- package/dist/plugins/router-entrypoints.mjs +1 -3
- package/dist/plugins/router-entrypoints.mjs.map +1 -1
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +1 -2
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +1 -6
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
- package/dist/plugins/seal/codegen.d.mts +1 -5
- package/dist/plugins/seal/codegen.mjs +83 -12
- package/dist/plugins/seal/codegen.mjs.map +1 -1
- package/dist/plugins/seal/config-render.mjs +2 -6
- package/dist/plugins/seal/config-render.mjs.map +1 -1
- package/dist/plugins/seal/deploy.mjs +18 -29
- package/dist/plugins/seal/deploy.mjs.map +1 -1
- package/dist/plugins/seal/errors.d.mts +4 -5
- package/dist/plugins/seal/errors.mjs +1 -8
- package/dist/plugins/seal/errors.mjs.map +1 -1
- package/dist/plugins/seal/index.d.mts +7 -28
- package/dist/plugins/seal/index.mjs +69 -47
- package/dist/plugins/seal/index.mjs.map +1 -1
- package/dist/plugins/seal/key-manager.mjs.map +1 -1
- package/dist/plugins/seal/key-server.mjs +1 -6
- package/dist/plugins/seal/key-server.mjs.map +1 -1
- package/dist/plugins/seal/keygen.mjs +2 -3
- package/dist/plugins/seal/keygen.mjs.map +1 -1
- package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
- package/dist/plugins/seal/mode/live.mjs +1 -1
- package/dist/plugins/seal/mode/live.mjs.map +1 -1
- package/dist/plugins/seal/mode/local-keygen.mjs +4 -10
- package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
- package/dist/plugins/seal/plugin-key.mjs.map +1 -1
- 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/snapshot.mjs +1 -2
- package/dist/plugins/seal/snapshot.mjs.map +1 -1
- package/dist/plugins/sui/auto-tick.mjs +5 -5
- package/dist/plugins/sui/auto-tick.mjs.map +1 -1
- package/dist/plugins/sui/chain-build-container.mjs +2 -2
- package/dist/plugins/sui/chain-build-container.mjs.map +1 -1
- package/dist/plugins/sui/chain-probe.mjs +4 -4
- package/dist/plugins/sui/chain-probe.mjs.map +1 -1
- package/dist/plugins/sui/codegen.d.mts +9 -7
- package/dist/plugins/sui/codegen.mjs +49 -46
- package/dist/plugins/sui/codegen.mjs.map +1 -1
- package/dist/plugins/sui/errors.d.mts +1 -1
- package/dist/plugins/sui/errors.mjs +1 -9
- package/dist/plugins/sui/errors.mjs.map +1 -1
- package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/index.d.mts +1 -1
- package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/index.mjs +3 -7
- package/dist/plugins/sui/exec/index.mjs.map +1 -0
- package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.mjs +1 -1
- package/dist/plugins/sui/exec/sign-and-dispatch.mjs.map +1 -0
- package/dist/plugins/sui/fork-faucet-strategy.mjs +2 -6
- package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -1
- package/dist/plugins/sui/fork-orchestration.mjs +13 -23
- package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
- package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
- package/dist/plugins/sui/index.d.mts +34 -83
- package/dist/plugins/sui/index.mjs +200 -68
- package/dist/plugins/sui/index.mjs.map +1 -1
- package/dist/{substrate/runtime/sui-ledger → plugins/sui/ledger}/object-ref.mjs +1 -1
- package/dist/plugins/sui/ledger/object-ref.mjs.map +1 -0
- package/dist/plugins/sui/local-faucet-strategy.mjs +1 -5
- package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -1
- package/dist/plugins/sui/log-attrs.mjs +11 -0
- package/dist/plugins/sui/log-attrs.mjs.map +1 -0
- package/dist/plugins/sui/mode/external.mjs +4 -12
- package/dist/plugins/sui/mode/external.mjs.map +1 -1
- package/dist/plugins/sui/mode/fork.mjs +19 -16
- package/dist/plugins/sui/mode/fork.mjs.map +1 -1
- package/dist/plugins/sui/mode/live.mjs +4 -17
- package/dist/plugins/sui/mode/live.mjs.map +1 -1
- package/dist/plugins/sui/mode/local.d.mts +1 -0
- package/dist/plugins/sui/mode/local.mjs +203 -61
- package/dist/plugins/sui/mode/local.mjs.map +1 -1
- package/dist/plugins/sui/mode/shared-boot.mjs +18 -23
- package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
- package/dist/plugins/sui/mode/shared.d.mts +6 -7
- package/dist/plugins/sui/mode/shared.mjs.map +1 -1
- package/dist/plugins/sui/mode/spec.d.mts +23 -6
- package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.mjs +28 -30
- package/dist/plugins/sui/move/index.mjs.map +1 -0
- package/dist/plugins/sui/move-summary-runner.mjs +8 -4
- package/dist/plugins/sui/move-summary-runner.mjs.map +1 -1
- package/dist/{substrate/network.d.mts → plugins/sui/network-config.d.mts} +11 -10
- package/dist/plugins/sui/network-resolver.d.mts +6 -6
- package/dist/plugins/sui/routable.mjs.map +1 -1
- package/dist/plugins/sui/service.mjs +10 -6
- package/dist/plugins/sui/service.mjs.map +1 -1
- package/dist/plugins/sui/snapshot.mjs +10 -5
- package/dist/plugins/sui/snapshot.mjs.map +1 -1
- package/dist/plugins/wallet/codegen.d.mts +8 -6
- package/dist/plugins/wallet/codegen.mjs +4 -10
- package/dist/plugins/wallet/codegen.mjs.map +1 -1
- package/dist/plugins/wallet/errors.mjs +1 -4
- package/dist/plugins/wallet/errors.mjs.map +1 -1
- package/dist/plugins/wallet/index.d.mts +3 -6
- package/dist/plugins/wallet/index.mjs +16 -21
- package/dist/plugins/wallet/index.mjs.map +1 -1
- package/dist/plugins/wallet/origin-policy.mjs +3 -3
- package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
- package/dist/plugins/wallet/pairing.mjs +6 -24
- package/dist/plugins/wallet/pairing.mjs.map +1 -1
- package/dist/plugins/wallet/protocol.mjs.map +1 -1
- package/dist/plugins/wallet/routable.mjs.map +1 -1
- package/dist/plugins/wallet/server.mjs +17 -24
- package/dist/plugins/wallet/server.mjs.map +1 -1
- package/dist/plugins/wallet/service.d.mts +2 -2
- package/dist/plugins/wallet/service.mjs +4 -15
- package/dist/plugins/wallet/service.mjs.map +1 -1
- package/dist/plugins/wallet/snapshot.mjs.map +1 -1
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +1 -5
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
- package/dist/plugins/walrus/codegen.d.mts +2 -13
- package/dist/plugins/walrus/codegen.mjs +93 -28
- package/dist/plugins/walrus/codegen.mjs.map +1 -1
- package/dist/plugins/walrus/deploy-paths.mjs +2 -3
- package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
- package/dist/plugins/walrus/deploy.mjs +26 -19
- package/dist/plugins/walrus/deploy.mjs.map +1 -1
- package/dist/plugins/walrus/errors.mjs +1 -8
- package/dist/plugins/walrus/errors.mjs.map +1 -1
- package/dist/plugins/walrus/faucet-strategy.mjs +15 -1
- package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
- package/dist/plugins/walrus/index.d.mts +13 -44
- package/dist/plugins/walrus/index.mjs +119 -122
- package/dist/plugins/walrus/index.mjs.map +1 -1
- package/dist/plugins/walrus/mode/known-deploy.mjs +6 -6
- package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
- package/dist/plugins/walrus/mode/local-cluster.d.mts +2 -2
- package/dist/plugins/walrus/mode/local-cluster.mjs +2 -10
- package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
- package/dist/plugins/walrus/plugin-key.mjs.map +1 -1
- package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
- package/dist/plugins/walrus/routable.mjs.map +1 -1
- package/dist/plugins/walrus/service.mjs.map +1 -1
- package/dist/plugins/walrus/snapshot.mjs +3 -3
- package/dist/plugins/walrus/snapshot.mjs.map +1 -1
- package/dist/plugins/walrus/storage-nodes.mjs +53 -14
- package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
- package/dist/plugins/walrus/wal-swap.mjs +4 -8
- package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
- package/dist/primitives/artifact-publisher.mjs.map +1 -1
- package/dist/primitives/cache.d.mts +1 -1
- package/dist/runtime/docker/client.mjs +47 -3
- package/dist/runtime/docker/client.mjs.map +1 -1
- package/dist/runtime/docker/container.mjs +37 -57
- package/dist/runtime/docker/container.mjs.map +1 -1
- package/dist/runtime/docker/errors.mjs.map +1 -1
- package/dist/runtime/docker/exec.mjs +2 -2
- package/dist/runtime/docker/exec.mjs.map +1 -1
- package/dist/runtime/docker/image.mjs +10 -11
- package/dist/runtime/docker/image.mjs.map +1 -1
- package/dist/runtime/docker/index.mjs +0 -1
- package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -1
- package/dist/runtime/docker/inventory.mjs +9 -9
- package/dist/runtime/docker/inventory.mjs.map +1 -1
- package/dist/runtime/docker/labels.mjs +12 -1
- package/dist/runtime/docker/labels.mjs.map +1 -1
- package/dist/runtime/docker/network.mjs +6 -6
- package/dist/runtime/docker/network.mjs.map +1 -1
- package/dist/runtime/docker/render-run-args.mjs.map +1 -1
- package/dist/runtime/docker/service.mjs +31 -45
- package/dist/runtime/docker/service.mjs.map +1 -1
- package/dist/runtime/docker/sweep.mjs +14 -64
- package/dist/runtime/docker/sweep.mjs.map +1 -1
- package/dist/runtime/docker/volume.mjs +1 -1
- package/dist/runtime/docker/volume.mjs.map +1 -1
- package/dist/runtime/docker/wrap.mjs +14 -2
- package/dist/runtime/docker/wrap.mjs.map +1 -1
- package/dist/substrate/brand.d.mts +2 -5
- package/dist/substrate/brand.mjs +3 -2
- package/dist/substrate/brand.mjs.map +1 -1
- package/dist/substrate/cross-process.mjs +2 -16
- package/dist/substrate/cross-process.mjs.map +1 -1
- package/dist/substrate/event-time.mjs +0 -2
- package/dist/substrate/event-time.mjs.map +1 -1
- package/dist/substrate/events.d.mts +46 -16
- package/dist/substrate/identity.d.mts +11 -5
- package/dist/substrate/manifest.d.mts +33 -26
- package/dist/substrate/manifest.mjs +8 -3
- package/dist/substrate/manifest.mjs.map +1 -1
- package/dist/substrate/options.d.mts +33 -4
- package/dist/substrate/plugin-ctx.d.mts +70 -0
- package/dist/substrate/plugin-ctx.mjs +66 -0
- package/dist/substrate/plugin-ctx.mjs.map +1 -0
- package/dist/substrate/plugin.d.mts +46 -38
- package/dist/substrate/plugin.mjs +13 -9
- package/dist/substrate/plugin.mjs.map +1 -1
- package/dist/substrate/projection.d.mts +1 -1
- package/dist/substrate/runtime/atomic-write.mjs +3 -4
- package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
- package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
- package/dist/substrate/runtime/cache/service.mjs +50 -20
- package/dist/substrate/runtime/cache/service.mjs.map +1 -1
- package/dist/substrate/runtime/config-validation.mjs.map +1 -1
- package/dist/substrate/runtime/control-plane/domain.mjs +34 -12
- package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -1
- package/dist/substrate/runtime/control-plane/service.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +14 -17
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
- 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.map +1 -1
- package/dist/substrate/runtime/cross-process/index.mjs +0 -2
- package/dist/substrate/runtime/cross-process/live-clock.mjs +1 -1
- package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/liveness.mjs +11 -18
- package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +2 -2
- package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/roster.mjs +17 -127
- package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/stack-lock.mjs +29 -28
- package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
- package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
- package/dist/substrate/runtime/errors.mjs +1 -13
- package/dist/substrate/runtime/errors.mjs.map +1 -1
- package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -1
- package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -1
- package/dist/substrate/runtime/host-gateway.mjs.map +1 -1
- package/dist/substrate/runtime/host-tree-tar/index.mjs +15 -163
- package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
- package/dist/substrate/runtime/http-probe.d.mts +1 -3
- package/dist/substrate/runtime/http-probe.mjs.map +1 -1
- package/dist/substrate/runtime/index.mjs +1 -6
- package/dist/substrate/runtime/lease-broker/service.mjs +5 -23
- package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs +3 -3
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/graph-input-id.d.mts +1 -0
- package/dist/substrate/runtime/lifecycle/graph-input-id.mjs +133 -0
- package/dist/substrate/runtime/lifecycle/graph-input-id.mjs.map +1 -0
- package/dist/substrate/runtime/lifecycle/index.mjs +2 -2
- package/dist/substrate/runtime/lifecycle/plugin-registry.d.mts +1 -1
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +22 -1
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/ready-gate.mjs +2 -15
- package/dist/substrate/runtime/lifecycle/ready-gate.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/selective-restart.mjs +29 -25
- package/dist/substrate/runtime/lifecycle/selective-restart.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/signals.mjs +1 -1
- package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/state-machine.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/watch-attribution.d.mts +1 -1
- package/dist/substrate/runtime/lifecycle/watch-attribution.mjs +0 -1
- package/dist/substrate/runtime/lifecycle/watch-attribution.mjs.map +1 -1
- package/dist/substrate/runtime/managed-container.d.mts +5 -1
- package/dist/substrate/runtime/managed-container.mjs +8 -10
- package/dist/substrate/runtime/managed-container.mjs.map +1 -1
- package/dist/substrate/runtime/manifest/manifest.mjs +8 -30
- package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
- package/dist/substrate/runtime/mode-errors.d.mts +1 -2
- package/dist/substrate/runtime/mode-errors.mjs.map +1 -1
- package/dist/substrate/runtime/observability/cascade-formatter.mjs +1 -11
- package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
- package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -1
- package/dist/substrate/runtime/observability/index.d.mts +1 -1
- package/dist/substrate/runtime/observability/index.mjs +4 -6
- package/dist/substrate/runtime/observability/log-attrs.mjs +46 -0
- package/dist/substrate/runtime/observability/log-attrs.mjs.map +1 -0
- package/dist/substrate/runtime/observability/log-store.mjs.map +1 -1
- package/dist/substrate/runtime/observability/logger.mjs +3 -3
- package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
- package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -1
- package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
- package/dist/substrate/runtime/observability/process-lines.mjs.map +1 -1
- package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
- package/dist/substrate/runtime/observability/subprocess-capture.mjs +2 -2
- package/dist/substrate/runtime/observability/subprocess-capture.mjs.map +1 -1
- package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -1
- package/dist/substrate/runtime/paths.mjs +27 -9
- package/dist/substrate/runtime/paths.mjs.map +1 -1
- package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -1
- package/dist/substrate/runtime/port-broker/service.mjs +10 -27
- package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
- package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
- package/dist/substrate/runtime/probes.d.mts +2 -3
- package/dist/substrate/runtime/probes.mjs.map +1 -1
- package/dist/substrate/runtime/process-supervisor.mjs.map +1 -1
- package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
- package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
- package/dist/substrate/runtime/projection/update.mjs +87 -11
- package/dist/substrate/runtime/projection/update.mjs.map +1 -1
- package/dist/substrate/runtime/random-suffix.mjs.map +1 -1
- package/dist/substrate/runtime/reconcile/fs-plan.mjs +146 -0
- package/dist/substrate/runtime/reconcile/fs-plan.mjs.map +1 -0
- package/dist/substrate/runtime/reconcile/graph.mjs +19 -0
- package/dist/substrate/runtime/reconcile/graph.mjs.map +1 -0
- package/dist/substrate/runtime/reconcile/index.mjs +5 -0
- package/dist/substrate/runtime/reconcile/label.mjs +41 -0
- package/dist/substrate/runtime/reconcile/label.mjs.map +1 -0
- package/dist/substrate/runtime/reconcile/spec.mjs +15 -0
- package/dist/substrate/runtime/reconcile/spec.mjs.map +1 -0
- package/dist/substrate/runtime/retry-policy.d.mts +2 -3
- package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
- package/dist/substrate/runtime/routed-url.mjs.map +1 -1
- package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
- package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
- package/dist/substrate/runtime/stage-and-swap/index.mjs +49 -12
- package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
- package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -1
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
- package/dist/substrate/runtime/strategy-registry/service.mjs +29 -17
- package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
- package/dist/substrate/runtime/subnet-broker.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/acquire-node.mjs +188 -56
- package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/background-tasks.mjs +79 -65
- package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/command-loop.mjs +82 -23
- package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs +16 -0
- package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/errors.mjs +11 -2
- package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/index.mjs +2 -0
- package/dist/substrate/runtime/supervisor/shutdown.mjs +6 -6
- package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/start-supervisor.mjs +60 -70
- package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/state.d.mts +1 -1
- package/dist/substrate/runtime/supervisor/state.mjs +1 -1
- package/dist/substrate/runtime/supervisor/state.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/teardown.mjs +10 -9
- package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/wiring.mjs +6 -20
- package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -1
- package/dist/substrate/runtime/tar/reader.mjs +216 -0
- package/dist/substrate/runtime/tar/reader.mjs.map +1 -0
- package/dist/substrate/runtime/typed-env.mjs.map +1 -1
- package/dist/substrate/versioned-doc-schema.mjs.map +1 -1
- package/dist/substrate/versioned-doc-sync.mjs +5 -5
- package/dist/substrate/versioned-doc-sync.mjs.map +1 -1
- package/dist/surfaces/cli/command-tree.mjs +49 -7
- package/dist/surfaces/cli/command-tree.mjs.map +1 -1
- package/dist/surfaces/cli/commands/config.mjs +1 -1
- package/dist/surfaces/cli/commands/config.mjs.map +1 -1
- package/dist/surfaces/cli/commands/confirm-node.mjs.map +1 -1
- package/dist/surfaces/cli/commands/confirm.mjs.map +1 -1
- package/dist/surfaces/cli/commands/doctor.mjs +1 -1
- package/dist/surfaces/cli/commands/doctor.mjs.map +1 -1
- package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -1
- package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
- package/dist/surfaces/cli/commands/prune.mjs +1 -1
- package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
- package/dist/surfaces/cli/commands/snapshot.mjs +1 -1
- package/dist/surfaces/cli/commands/snapshot.mjs.map +1 -1
- package/dist/surfaces/cli/commands/status.mjs +1 -1
- package/dist/surfaces/cli/commands/status.mjs.map +1 -1
- package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
- package/dist/surfaces/cli/commands/wipe.mjs +3 -4
- package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
- package/dist/surfaces/cli/envelope.mjs.map +1 -1
- package/dist/surfaces/cli/errors.mjs.map +1 -1
- package/dist/surfaces/cli/flags.mjs.map +1 -1
- package/dist/surfaces/cli/index.mjs +45 -14
- package/dist/surfaces/cli/index.mjs.map +1 -1
- package/dist/surfaces/cli/output.mjs.map +1 -1
- package/dist/surfaces/cli/sysexits.mjs.map +1 -1
- package/dist/surfaces/tui/app.mjs +0 -21
- package/dist/surfaces/tui/app.mjs.map +1 -1
- package/dist/surfaces/tui/dashboard.mjs +0 -48
- package/dist/surfaces/tui/dashboard.mjs.map +1 -1
- package/dist/surfaces/tui/display-derivation.mjs +80 -16
- package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
- package/dist/surfaces/tui/errors.mjs.map +1 -1
- package/dist/surfaces/tui/event-log.mjs +0 -9
- package/dist/surfaces/tui/event-log.mjs.map +1 -1
- package/dist/surfaces/tui/heartbeat.mjs.map +1 -1
- package/dist/surfaces/tui/index.mjs +2 -2
- package/dist/surfaces/tui/index.mjs.map +1 -1
- package/dist/surfaces/tui/input.mjs.map +1 -1
- package/dist/surfaces/tui/mode-detect.mjs.map +1 -1
- package/dist/surfaces/tui/mount-ink.mjs.map +1 -1
- package/dist/surfaces/tui/plain-renderer.mjs +26 -19
- package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
- package/dist/surfaces/tui/resource-table.mjs +8 -10
- package/dist/surfaces/tui/resource-table.mjs.map +1 -1
- package/images/postgres/Dockerfile +0 -1
- package/images/sui/Dockerfile +27 -54
- package/images/sui/entrypoint.sh +17 -179
- package/package.json +23 -15
- package/dashboard-ui/assets/index-Bmi1UtAg.js +0 -1356
- package/dashboard-ui/assets/index-D5EShVt4.js +0 -3
- package/dashboard-ui/assets/index-Deml9drg.css +0 -1
- package/dist/api/plugin-errors.d.mts +0 -7
- package/dist/api/plugin-errors.mjs +0 -10
- package/dist/api/plugin-errors.mjs.map +0 -1
- package/dist/cli/wirings/build-verb-layers.mjs +0 -42
- package/dist/cli/wirings/build-verb-layers.mjs.map +0 -1
- package/dist/contracts/capability-decl.d.mts +0 -40
- package/dist/orchestrators/built-in-plugin-layers.mjs +0 -54
- package/dist/orchestrators/built-in-plugin-layers.mjs.map +0 -1
- package/dist/orchestrators/run.mjs +0 -91
- package/dist/orchestrators/run.mjs.map +0 -1
- package/dist/orchestrators/runtime-composition.d.mts +0 -10
- package/dist/orchestrators/runtime-composition.mjs +0 -252
- package/dist/orchestrators/runtime-composition.mjs.map +0 -1
- package/dist/orchestrators/snapshot/capture-command.d.mts +0 -1
- package/dist/orchestrators/snapshot/capture-command.mjs +0 -25
- package/dist/orchestrators/snapshot/capture-command.mjs.map +0 -1
- package/dist/orchestrators/snapshot/pending-marker.mjs +0 -99
- package/dist/orchestrators/snapshot/pending-marker.mjs.map +0 -1
- package/dist/orchestrators/snapshot/recover-pending.mjs +0 -223
- package/dist/orchestrators/snapshot/recover-pending.mjs.map +0 -1
- package/dist/orchestrators/snapshot/state-document.d.mts +0 -1
- package/dist/orchestrators/snapshot/state-document.mjs +0 -58
- package/dist/orchestrators/snapshot/state-document.mjs.map +0 -1
- package/dist/plugins/account/spans.mjs +0 -16
- package/dist/plugins/account/spans.mjs.map +0 -1
- package/dist/plugins/account/variants/env.mjs +0 -24
- package/dist/plugins/account/variants/env.mjs.map +0 -1
- package/dist/plugins/account/variants/inline.mjs +0 -13
- package/dist/plugins/account/variants/inline.mjs.map +0 -1
- package/dist/plugins/account/variants/keystore.mjs +0 -91
- package/dist/plugins/account/variants/keystore.mjs.map +0 -1
- package/dist/plugins/action/spans.mjs +0 -11
- package/dist/plugins/action/spans.mjs.map +0 -1
- package/dist/plugins/coin/spans.mjs +0 -20
- package/dist/plugins/coin/spans.mjs.map +0 -1
- package/dist/plugins/deepbook/spans.mjs +0 -18
- package/dist/plugins/deepbook/spans.mjs.map +0 -1
- package/dist/plugins/faucet/spans.mjs +0 -12
- package/dist/plugins/faucet/spans.mjs.map +0 -1
- package/dist/plugins/package/spans.mjs +0 -14
- package/dist/plugins/package/spans.mjs.map +0 -1
- package/dist/plugins/postgres/codegen.mjs +0 -42
- package/dist/plugins/postgres/codegen.mjs.map +0 -1
- package/dist/plugins/postgres/connection.d.mts +0 -33
- package/dist/plugins/postgres/connection.mjs.map +0 -1
- package/dist/plugins/postgres/db-ensure.mjs.map +0 -1
- package/dist/plugins/postgres/errors.d.mts +0 -60
- package/dist/plugins/postgres/errors.mjs +0 -29
- package/dist/plugins/postgres/errors.mjs.map +0 -1
- package/dist/plugins/postgres/index.d.mts +0 -37
- package/dist/plugins/postgres/index.mjs +0 -68
- package/dist/plugins/postgres/index.mjs.map +0 -1
- package/dist/plugins/postgres/routable.mjs +0 -33
- package/dist/plugins/postgres/routable.mjs.map +0 -1
- package/dist/plugins/postgres/service.d.mts +0 -50
- package/dist/plugins/postgres/service.mjs +0 -179
- package/dist/plugins/postgres/service.mjs.map +0 -1
- package/dist/plugins/postgres/snapshot.mjs +0 -32
- package/dist/plugins/postgres/snapshot.mjs.map +0 -1
- package/dist/plugins/postgres/spans.mjs +0 -11
- package/dist/plugins/postgres/spans.mjs.map +0 -1
- package/dist/plugins/seal/spans.mjs +0 -18
- package/dist/plugins/seal/spans.mjs.map +0 -1
- package/dist/plugins/sui/spans.mjs +0 -17
- package/dist/plugins/sui/spans.mjs.map +0 -1
- package/dist/plugins/wallet/spans.mjs +0 -22
- package/dist/plugins/wallet/spans.mjs.map +0 -1
- package/dist/plugins/walrus/registry-publish.d.mts +0 -24
- package/dist/plugins/walrus/spans.mjs +0 -18
- package/dist/plugins/walrus/spans.mjs.map +0 -1
- package/dist/runtime/docker/logs.d.mts +0 -1
- package/dist/runtime/docker/logs.mjs +0 -34
- package/dist/runtime/docker/logs.mjs.map +0 -1
- package/dist/substrate/runtime/artifact-publisher/index.mjs +0 -86
- package/dist/substrate/runtime/artifact-publisher/index.mjs.map +0 -1
- package/dist/substrate/runtime/capability-sinks/index.d.mts +0 -1
- package/dist/substrate/runtime/capability-sinks/index.mjs +0 -3
- package/dist/substrate/runtime/capability-sinks/layer.d.mts +0 -1
- package/dist/substrate/runtime/capability-sinks/layer.mjs +0 -31
- package/dist/substrate/runtime/capability-sinks/layer.mjs.map +0 -1
- package/dist/substrate/runtime/capability-sinks/service.d.mts +0 -95
- package/dist/substrate/runtime/capability-sinks/service.mjs +0 -69
- package/dist/substrate/runtime/capability-sinks/service.mjs.map +0 -1
- package/dist/substrate/runtime/cross-process/lock.d.mts +0 -1
- package/dist/substrate/runtime/cross-process/lock.mjs +0 -23
- package/dist/substrate/runtime/cross-process/lock.mjs.map +0 -1
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +0 -113
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +0 -1
- package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs +0 -31
- package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +0 -1
- package/dist/substrate/runtime/observability/formatter-registry.d.mts +0 -1
- package/dist/substrate/runtime/observability/formatter-registry.mjs +0 -48
- package/dist/substrate/runtime/observability/formatter-registry.mjs.map +0 -1
- package/dist/substrate/runtime/observability/span-store.d.mts +0 -1
- package/dist/substrate/runtime/observability/span-store.mjs +0 -110
- package/dist/substrate/runtime/observability/span-store.mjs.map +0 -1
- package/dist/substrate/runtime/observability/spans.d.mts +0 -1
- package/dist/substrate/runtime/observability/spans.mjs +0 -87
- package/dist/substrate/runtime/observability/spans.mjs.map +0 -1
- package/dist/substrate/runtime/projection/index.mjs +0 -4
- package/dist/substrate/runtime/projection/persisted.mjs +0 -213
- package/dist/substrate/runtime/projection/persisted.mjs.map +0 -1
- package/dist/substrate/runtime/scoped-multimap/service.mjs +0 -52
- package/dist/substrate/runtime/scoped-multimap/service.mjs.map +0 -1
- package/dist/substrate/runtime/scoped-ref-map/index.mjs +0 -2
- package/dist/substrate/runtime/scoped-ref-map/service.mjs +0 -83
- package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +0 -1
- package/dist/substrate/runtime/state-store/index.mjs +0 -3
- package/dist/substrate/runtime/state-store/schema.d.mts +0 -1
- package/dist/substrate/runtime/state-store/schema.mjs +0 -41
- package/dist/substrate/runtime/state-store/schema.mjs.map +0 -1
- package/dist/substrate/runtime/state-store/service.d.mts +0 -1
- package/dist/substrate/runtime/state-store/service.mjs +0 -145
- package/dist/substrate/runtime/state-store/service.mjs.map +0 -1
- package/dist/substrate/runtime/sui-execute/index.mjs.map +0 -1
- package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +0 -1
- package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +0 -1
- package/dist/substrate/runtime/sui-move-build/index.mjs.map +0 -1
- package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +0 -151
- package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +0 -1
- package/dist/substrate/state-store.d.mts +0 -1
- /package/dist/orchestrators/{snapshot/pending-marker.d.mts → codegen/id-config.d.mts} +0 -0
- /package/dist/orchestrators/snapshot/{recover-pending.d.mts → interrupted-restore.d.mts} +0 -0
- /package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.d.mts +0 -0
- /package/dist/plugins/{postgres/snapshot.d.mts → sui/ledger/object-ref.d.mts} +0 -0
- /package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.d.mts +0 -0
- /package/dist/substrate/runtime/{state-store/index.d.mts → reconcile/graph.d.mts} +0 -0
- /package/dist/substrate/runtime/{cross-process/snapshot-reservation.d.mts → supervisor/contribution-dispatcher.d.mts} +0 -0
|
@@ -10,6 +10,16 @@ import { generateFromPackageSummary } from "@mysten/codegen";
|
|
|
10
10
|
var MoveSummaryRunnerService = class extends Context.Service()("@devstack/orchestrator/MoveSummaryRunner") {};
|
|
11
11
|
var MoveCodegenService = class extends Context.Service()("@devstack/orchestrator/MoveCodegen") {};
|
|
12
12
|
/**
|
|
13
|
+
* Consumer-side shape guard: does an aggregated value look like a
|
|
14
|
+
* Move-bindings contribution that `emitBindings` knows how to consume?
|
|
15
|
+
* This is structural validation of the orchestrator's own input
|
|
16
|
+
* contract, NOT a plugin-name match — any plugin whose
|
|
17
|
+
* `aggregate.project` returns objects with this shape is forwarded to
|
|
18
|
+
* the Move bindings emitter. The single definition of the seam; both
|
|
19
|
+
* the codegen orchestrator service and the Package plugin reference it.
|
|
20
|
+
*/
|
|
21
|
+
const isPackageBindings = (v) => typeof v === "object" && v !== null && "name" in v && "packageId" in v && "mvrPlaceholder" in v && "sourcePath" in v;
|
|
22
|
+
/**
|
|
13
23
|
* Walk the `PackageBindings` set, filter to LOCAL packages
|
|
14
24
|
* (`sourcePath !== null`), run `sui move summary` + `@mysten/codegen`
|
|
15
25
|
* for each, and write the rendered files into `bindingsDir/<name>/`.
|
|
@@ -21,7 +31,8 @@ const emitBindings = (input) => Effect.gen(function* () {
|
|
|
21
31
|
const runner = yield* MoveSummaryRunnerService;
|
|
22
32
|
const generator = yield* MoveCodegenService;
|
|
23
33
|
const importExtension = input.importExtension ?? ".ts";
|
|
24
|
-
const
|
|
34
|
+
const seenIdentityByName = /* @__PURE__ */ new Map();
|
|
35
|
+
const identityOf = (pkg) => `${pkg.packageId} ${pkg.sourcePath ?? ""}`;
|
|
25
36
|
const targets = [];
|
|
26
37
|
const skipped = [];
|
|
27
38
|
for (const pkg of input.packages) {
|
|
@@ -33,12 +44,14 @@ const emitBindings = (input) => Effect.gen(function* () {
|
|
|
33
44
|
skipped.push(pkg.name);
|
|
34
45
|
continue;
|
|
35
46
|
}
|
|
36
|
-
|
|
37
|
-
|
|
47
|
+
const identity = identityOf(pkg);
|
|
48
|
+
const seenIdentity = seenIdentityByName.get(pkg.name);
|
|
49
|
+
if (seenIdentity !== void 0) {
|
|
50
|
+
if (seenIdentity !== identity) yield* Effect.logWarning(`codegen.bindings: duplicate package name '${pkg.name}' — keeping first and skipping duplicate to avoid HMR re-emit storm. Rename one of the packages.`);
|
|
38
51
|
skipped.push(pkg.name);
|
|
39
52
|
continue;
|
|
40
53
|
}
|
|
41
|
-
|
|
54
|
+
seenIdentityByName.set(pkg.name, identity);
|
|
42
55
|
targets.push(pkg);
|
|
43
56
|
}
|
|
44
57
|
targets.sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -90,8 +103,8 @@ const emitBindings = (input) => Effect.gen(function* () {
|
|
|
90
103
|
packagesSkipped: skipped,
|
|
91
104
|
filesWritten
|
|
92
105
|
};
|
|
93
|
-
})
|
|
94
|
-
const layerMystenMoveCodegen = Layer.succeed(MoveCodegenService, MoveCodegenService.of({ generate: (input) => Effect.tryPromise({
|
|
106
|
+
});
|
|
107
|
+
const layerMystenMoveCodegen = (options = {}) => Layer.succeed(MoveCodegenService, MoveCodegenService.of({ generate: (input) => Effect.tryPromise({
|
|
95
108
|
try: async () => {
|
|
96
109
|
const tmp = await mkdtemp(join(tmpdir(), "devstack-move-codegen-"));
|
|
97
110
|
try {
|
|
@@ -104,7 +117,8 @@ const layerMystenMoveCodegen = Layer.succeed(MoveCodegenService, MoveCodegenServ
|
|
|
104
117
|
},
|
|
105
118
|
prune: true,
|
|
106
119
|
outputDir: tmp,
|
|
107
|
-
importExtension: input.importExtension
|
|
120
|
+
importExtension: input.importExtension,
|
|
121
|
+
includePhantomTypeParameters: options.includePhantomTypeParameters
|
|
108
122
|
});
|
|
109
123
|
return await collectGeneratedFiles(tmp);
|
|
110
124
|
} finally {
|
|
@@ -141,7 +155,7 @@ const joinPath = (...parts) => parts.map((p, i) => i === 0 ? p.replace(/\/+$/, "
|
|
|
141
155
|
*
|
|
142
156
|
* Hand-parse rather than pull in a TOML dependency: the sibling Move-build
|
|
143
157
|
* path already harvests `{ local = "../x" }` deps from Move.toml by regex
|
|
144
|
-
* (`sui
|
|
158
|
+
* (`plugins/sui/move/index.ts`), and we only need the `[addresses]` section's
|
|
145
159
|
* left-hand labels — never their values.
|
|
146
160
|
*/
|
|
147
161
|
const resolveSummaryDirName = async (sourcePath) => {
|
|
@@ -201,6 +215,6 @@ const collectGeneratedFiles = async (root) => {
|
|
|
201
215
|
return out;
|
|
202
216
|
};
|
|
203
217
|
//#endregion
|
|
204
|
-
export { MoveCodegenService, MoveSummaryRunnerService, emitBindings, layerMystenMoveCodegen };
|
|
218
|
+
export { MoveCodegenService, MoveSummaryRunnerService, emitBindings, isPackageBindings, layerMystenMoveCodegen };
|
|
205
219
|
|
|
206
220
|
//# sourceMappingURL=bindings.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.mjs","names":[],"sources":["../../../src/orchestrators/codegen/bindings.ts"],"sourcesContent":["// Move-package bindings emission.\n//\n// Distilled-doc § \"Move-to-TS bindings: per-published-package typed\n// client modules produced from each local Move package's summary.\"\n// Drives `@mysten/codegen`'s `generateFromPackageSummary` against\n// `MoveSummary` JSON contributed by a plugin-owned\n// `MoveSummaryRunnerService`.\n//\n// sourcePath-known-vs-unknown discipline:\n// - `Package` plugin's `Codegenable` emits a `PackageBindings`\n// shape with `sourcePath: string | null`.\n// - The bindings emitter filters to `sourcePath !== null` (i.e.\n// LOCAL packages); `KnownPackage` entries (`sourcePath: null`)\n// are skipped — their bindings come from the SDK or MVR.\n//\n// Architecture seam:\n// - `MoveSummaryRunnerService` is contributed by a plugin (the\n// sui plugin ships `layerSuiMoveSummaryRunnerDocker` /\n// `layerSuiMoveSummaryRunnerHost`). The codegen orchestrator\n// consumes only the abstract service — it never names the Sui\n// CLI binary or container image (architecture: \"Orchestrator\n// boundaries — never names a service\").\n// - The call to `@mysten/codegen.generateFromPackageSummary` is\n// similarly behind a tagged service so unit tests can stub it\n// without pulling in the heavyweight `@mysten/codegen` graph.\n//\n// Distilled-doc § \"Silent no-op from a downstream tool is a\n// failure\": after summary + render, we probe the output dir.\n// If it's empty, that's a `CodegenBindingsFailed` with a hint about\n// the common `Move.toml` `[addresses]` cause.\n\nimport { mkdtemp, readdir, readFile, rm } from 'node:fs/promises';\nimport { tmpdir } from 'node:os';\nimport { join, relative, sep } from 'node:path';\n\nimport { generateFromPackageSummary } from '@mysten/codegen';\nimport { Context, Effect, FileSystem, Layer } from 'effect';\n\nimport type { ImageRef } from '../../contracts/container-runtime.ts';\n\nimport { emitOne } from './emit.ts';\nimport { CodegenBindingsFailed } from './errors.ts';\nimport { NON_SENSITIVE_DIR_MODE, NON_SENSITIVE_FILE_MODE } from './permissions.ts';\n\n// -----------------------------------------------------------------------------\n// Service seam — Move summary + codegen invocation\n// -----------------------------------------------------------------------------\n\n/** Result of `sui move summary` — opaque JSON the codegen generator\n * consumes. We don't decode it here; `@mysten/codegen` owns the\n * schema. */\nexport interface MoveSummary {\n\treadonly packageName: string;\n\treadonly sourcePath: string;\n\treadonly summaryPath?: string;\n\treadonly cleanupPath?: string;\n\treadonly summaryJson: unknown;\n}\n\nexport interface MoveSummaryInput {\n\treadonly packageName: string;\n\treadonly sourcePath: string;\n\treadonly buildImage?: ImageRef | null;\n}\n\n/** Shape of the Move summary runner. Implementations live in\n * plugin packages (e.g. `plugins/sui/move-summary-runner.ts`\n * exports `layerSuiMoveSummaryRunnerDocker` and\n * `layerSuiMoveSummaryRunnerHost`); tests use `stubMoveSummaryRunner`\n * below. */\nexport interface MoveSummaryRunner {\n\treadonly runSummary: (\n\t\tinput: MoveSummaryInput,\n\t) => Effect.Effect<MoveSummary, CodegenBindingsFailed>;\n}\n\nexport class MoveSummaryRunnerService extends Context.Service<\n\tMoveSummaryRunnerService,\n\tMoveSummaryRunner\n>()('@devstack/orchestrator/MoveSummaryRunner') {}\n\n/** Shape of the `@mysten/codegen` invocation. Returns the rendered\n * TS files (path → content) for one package. */\nexport interface MoveCodegen {\n\treadonly generate: (input: {\n\t\treadonly packageName: string;\n\t\treadonly sourcePath: string;\n\t\treadonly summary: MoveSummary;\n\t\treadonly mvrPlaceholder: string;\n\t\treadonly importExtension: '.ts' | '.js' | '';\n\t}) => Effect.Effect<\n\t\tReadonlyArray<{ readonly relPath: string; readonly content: string }>,\n\t\tCodegenBindingsFailed\n\t>;\n}\n\nexport class MoveCodegenService extends Context.Service<MoveCodegenService, MoveCodegen>()(\n\t'@devstack/orchestrator/MoveCodegen',\n) {}\n\n// -----------------------------------------------------------------------------\n// Public entry — emit bindings for the local packages in a set of\n// PackageBindings contributions.\n// -----------------------------------------------------------------------------\n\nexport interface PackageBindings {\n\treadonly name: string;\n\treadonly packageId: string;\n\treadonly mvrPlaceholder: string;\n\treadonly sourcePath: string | null;\n\treadonly excluded: boolean;\n}\n\nexport interface EmitBindingsInput {\n\treadonly bindingsDir: string;\n\treadonly packages: ReadonlyArray<PackageBindings>;\n\treadonly importExtension?: '.ts' | '.js' | '';\n}\n\nexport interface EmitBindingsResult {\n\treadonly packagesEmitted: ReadonlyArray<string>;\n\treadonly packagesSkipped: ReadonlyArray<string>;\n\treadonly filesWritten: ReadonlyArray<string>;\n}\n\n/**\n * Walk the `PackageBindings` set, filter to LOCAL packages\n * (`sourcePath !== null`), run `sui move summary` + `@mysten/codegen`\n * for each, and write the rendered files into `bindingsDir/<name>/`.\n *\n * Serial within a cycle (distilled-doc § \"Serial within a cycle\":\n * shared Move build cache races). Per-package parallelism is unsafe.\n */\nexport const emitBindings = (\n\tinput: EmitBindingsInput,\n): Effect.Effect<\n\tEmitBindingsResult,\n\tCodegenBindingsFailed,\n\tFileSystem.FileSystem | MoveSummaryRunnerService | MoveCodegenService\n> =>\n\tEffect.gen(function* () {\n\t\tconst runner = yield* MoveSummaryRunnerService;\n\t\tconst generator = yield* MoveCodegenService;\n\t\tconst importExtension = input.importExtension ?? '.ts';\n\n\t\t// Dedup by package name. First-wins; distilled-doc § \"Duplicate\n\t\t// package names\": warn + skip the duplicate to avoid the HMR\n\t\t// re-emit storm.\n\t\tconst seen = new Set<string>();\n\t\tconst targets: Array<PackageBindings> = [];\n\t\tconst skipped: Array<string> = [];\n\t\tfor (const pkg of input.packages) {\n\t\t\tif (pkg.sourcePath === null) {\n\t\t\t\tskipped.push(pkg.name);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (pkg.excluded) {\n\t\t\t\tskipped.push(pkg.name);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (seen.has(pkg.name)) {\n\t\t\t\tyield* Effect.logWarning(\n\t\t\t\t\t`codegen.bindings: duplicate package name '${pkg.name}' — keeping ` +\n\t\t\t\t\t\t`first and skipping duplicate to avoid HMR re-emit storm. ` +\n\t\t\t\t\t\t`Rename one of the packages.`,\n\t\t\t\t);\n\t\t\t\tskipped.push(pkg.name);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseen.add(pkg.name);\n\t\t\ttargets.push(pkg);\n\t\t}\n\t\t// Deterministic order: lexicographic by package name.\n\t\ttargets.sort((a, b) => a.name.localeCompare(b.name));\n\n\t\tconst emitted: Array<string> = [];\n\t\tconst filesWritten: Array<string> = [];\n\t\tfor (const pkg of targets) {\n\t\t\t// sourcePath is non-null per the filter above. Narrow.\n\t\t\tif (pkg.sourcePath === null) continue;\n\t\t\tconst summary = yield* runner.runSummary({\n\t\t\t\tpackageName: pkg.name,\n\t\t\t\tsourcePath: pkg.sourcePath,\n\t\t\t});\n\t\t\tconst files = yield* generator.generate({\n\t\t\t\tpackageName: pkg.name,\n\t\t\t\tsourcePath: pkg.sourcePath,\n\t\t\t\tsummary,\n\t\t\t\tmvrPlaceholder: pkg.mvrPlaceholder,\n\t\t\t\timportExtension,\n\t\t\t});\n\t\t\t// Post-emit probe — silent no-op detection.\n\t\t\tif (files.length === 0) {\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\tpackage: pkg.name,\n\t\t\t\t\t\tsourcePath: pkg.sourcePath,\n\t\t\t\t\t\treason: 'no-output',\n\t\t\t\t\t\thint:\n\t\t\t\t\t\t\t'The Move codegen generator produced no files. This is ' +\n\t\t\t\t\t\t\t'usually caused by a missing `[addresses]` block in the ' +\n\t\t\t\t\t\t\t\"package's Move.toml, or a non-published address mapping.\",\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tfor (const f of files) {\n\t\t\t\tif (f.relPath.includes('..') || f.relPath.startsWith('/')) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\t\tpackage: pkg.name,\n\t\t\t\t\t\t\tsourcePath: pkg.sourcePath,\n\t\t\t\t\t\t\treason: 'write-failed',\n\t\t\t\t\t\t\tcause: new Error(`generated binding path escapes output dir: ${f.relPath}`),\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst abs = joinPath(input.bindingsDir, f.relPath);\n\t\t\t\tconst outcome = yield* emitOne({\n\t\t\t\t\tpath: abs,\n\t\t\t\t\tcontent: stabilizeGeneratedBindingContent(f.content),\n\t\t\t\t\tmode: NON_SENSITIVE_FILE_MODE,\n\t\t\t\t\tparentMode: NON_SENSITIVE_DIR_MODE,\n\t\t\t\t}).pipe(\n\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t(cause) =>\n\t\t\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\t\t\tpackage: pkg.name,\n\t\t\t\t\t\t\t\tsourcePath: pkg.sourcePath!,\n\t\t\t\t\t\t\t\treason: 'write-failed',\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tif (outcome.outcome !== 'unchanged') {\n\t\t\t\t\tfilesWritten.push(abs);\n\t\t\t\t}\n\t\t\t}\n\t\t\temitted.push(pkg.name);\n\t\t}\n\n\t\treturn {\n\t\t\tpackagesEmitted: emitted,\n\t\t\tpackagesSkipped: skipped,\n\t\t\tfilesWritten,\n\t\t};\n\t}).pipe(\n\t\tEffect.withSpan('codegen.emitBindings', {\n\t\t\tattributes: { 'codegen.bindingsDir': input.bindingsDir },\n\t\t}),\n\t);\n\n// -----------------------------------------------------------------------------\n// Stub implementations for tests\n// -----------------------------------------------------------------------------\n\n/** Stub runner — returns a synthetic summary. Used in unit tests\n * to exercise the bindings pipeline without a real `sui` binary. */\nexport const stubMoveSummaryRunner = (\n\tsummaryFor: (sourcePath: string) => MoveSummary,\n): MoveSummaryRunner => ({\n\trunSummary: ({ sourcePath }) => Effect.succeed(summaryFor(sourcePath)),\n});\n\n/** Stub generator — returns a synthetic file set. Used in unit\n * tests to exercise the bindings pipeline without pulling in the\n * heavyweight `@mysten/codegen` graph. */\nexport const stubMoveCodegen = (\n\tfiles: (\n\t\tinput: Parameters<MoveCodegen['generate']>[0],\n\t) => ReadonlyArray<{ readonly relPath: string; readonly content: string }>,\n): MoveCodegen => ({\n\tgenerate: (input) => Effect.succeed(files(input)),\n});\n\n// -----------------------------------------------------------------------------\n// Production implementations\n// -----------------------------------------------------------------------------\n//\n// Layer factories for `MoveSummaryRunnerService` are plugin-owned —\n// they live in `src/plugins/sui/move-summary-runner.ts`. The codegen\n// orchestrator does not name the Sui CLI binary or container image;\n// per \"Orchestrator boundaries — never names a service\", any plugin\n// that can produce `MoveSummary` JSON may contribute a runner Layer.\n\nexport const layerMystenMoveCodegen: Layer.Layer<MoveCodegenService> = Layer.succeed(\n\tMoveCodegenService,\n\tMoveCodegenService.of({\n\t\tgenerate: (input) =>\n\t\t\tEffect.tryPromise({\n\t\t\t\ttry: async () => {\n\t\t\t\t\tconst tmp = await mkdtemp(join(tmpdir(), 'devstack-move-codegen-'));\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// `sui move summary` keys each `package_summaries/<dir>`\n\t\t\t\t\t\t// subdirectory by the package's NAMED ADDRESS, not its\n\t\t\t\t\t\t// `[package].name`. These legitimately differ (the canonical\n\t\t\t\t\t\t// example is MoveStdlib, whose package name is \"MoveStdlib\"\n\t\t\t\t\t\t// but whose named address is \"std\"). `@mysten/codegen`'s\n\t\t\t\t\t\t// resolver matches the summary subdir by either (1) a single\n\t\t\t\t\t\t// `[addresses]` label or (2) the `packageName` — but it reads\n\t\t\t\t\t\t// the Move.toml at the path WE pass it (the summary scratch\n\t\t\t\t\t\t// dir), which has NO `[addresses]` table, so its label-based\n\t\t\t\t\t\t// path (1) is defeated and it falls back to (2). We pass the\n\t\t\t\t\t\t// symbolic localPackage() NAME as `packageName`, which is the\n\t\t\t\t\t\t// `[package].name`, NOT the named address — so codegen throws\n\t\t\t\t\t\t// \"Could not identify main package directory\" whenever the two\n\t\t\t\t\t\t// differ. Recover the correct subdir name here from the REAL\n\t\t\t\t\t\t// source Move.toml's `[addresses]` table (which devstack still\n\t\t\t\t\t\t// has at `input.sourcePath`), falling back to the name when the\n\t\t\t\t\t\t// source is unreadable or ambiguous (a no-op for the common\n\t\t\t\t\t\t// case where name == address).\n\t\t\t\t\t\tconst packageName =\n\t\t\t\t\t\t\t(await resolveSummaryDirName(input.sourcePath)) ?? input.packageName;\n\t\t\t\t\t\tawait generateFromPackageSummary({\n\t\t\t\t\t\t\tpackage: {\n\t\t\t\t\t\t\t\tpath: input.summary.summaryPath ?? input.sourcePath,\n\t\t\t\t\t\t\t\tpackage: input.mvrPlaceholder,\n\t\t\t\t\t\t\t\tpackageName,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tprune: true,\n\t\t\t\t\t\t\toutputDir: tmp,\n\t\t\t\t\t\t\timportExtension: input.importExtension,\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn await collectGeneratedFiles(tmp);\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tawait rm(tmp, { recursive: true, force: true });\n\t\t\t\t\t\tif (input.summary.cleanupPath !== undefined) {\n\t\t\t\t\t\t\tawait rm(input.summary.cleanupPath, { recursive: true, force: true });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tcatch: (cause) =>\n\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\tpackage: input.packageName,\n\t\t\t\t\t\tsourcePath: input.sourcePath,\n\t\t\t\t\t\treason: 'render-failed',\n\t\t\t\t\t\tcause,\n\t\t\t\t\t}),\n\t\t\t}),\n\t}),\n);\n\n// -----------------------------------------------------------------------------\n// Local helpers — keep the module dep-free of Path.Path so the\n// caller can compose without an extra service yield.\n// -----------------------------------------------------------------------------\n\nconst joinPath = (...parts: ReadonlyArray<string>): string =>\n\tparts.map((p, i) => (i === 0 ? p.replace(/\\/+$/, '') : p.replace(/^\\/+|\\/+$/g, ''))).join('/');\n\n/**\n * Determine the `package_summaries/<dir>` subdirectory name for a local\n * Move package from its REAL source `Move.toml`. `sui move summary` keys\n * these subdirs by the NAMED ADDRESS (e.g. MoveStdlib → \"std\"), not the\n * `[package].name`, so when the two differ we must hand `@mysten/codegen`\n * the address label rather than the symbolic package name.\n *\n * Returns the single `[addresses]` label when the table has exactly one\n * entry (the overwhelmingly common case — and a no-op when name == address),\n * and `null` otherwise (unreadable Move.toml, no `[addresses]` table, or an\n * ambiguous multi-address table) so the caller can fall back to the package\n * name and preserve `@mysten/codegen`'s own resolution.\n *\n * Hand-parse rather than pull in a TOML dependency: the sibling Move-build\n * path already harvests `{ local = \"../x\" }` deps from Move.toml by regex\n * (`sui-move-build/index.ts`), and we only need the `[addresses]` section's\n * left-hand labels — never their values.\n */\nconst resolveSummaryDirName = async (sourcePath: string): Promise<string | null> => {\n\tlet toml: string;\n\ttry {\n\t\ttoml = await readFile(join(sourcePath, 'Move.toml'), 'utf8');\n\t} catch {\n\t\treturn null;\n\t}\n\tconst labels = parseAddressLabels(toml);\n\treturn labels.length === 1 ? labels[0]! : null;\n};\n\n/** Left-hand labels of the `[addresses]` table in a Move.toml. Scans from\n * the `[addresses]` header to the next `[section]` header (or EOF) and\n * collects each `name = \"...\"` key, ignoring blank/comment lines. */\nconst parseAddressLabels = (toml: string): ReadonlyArray<string> => {\n\tconst lines = toml.split(/\\r?\\n/);\n\tconst start = lines.findIndex((line) => /^\\s*\\[addresses\\]\\s*$/.test(line));\n\tif (start === -1) return [];\n\tconst labels: Array<string> = [];\n\tfor (const line of lines.slice(start + 1)) {\n\t\t// Next table header ends the `[addresses]` section.\n\t\tif (/^\\s*\\[/.test(line)) break;\n\t\tconst stripped = line.replace(/#.*$/, '').trim();\n\t\tif (stripped === '') continue;\n\t\tconst match = /^([A-Za-z_][\\w-]*)\\s*=/.exec(stripped);\n\t\tif (match) labels.push(match[1]!);\n\t}\n\treturn labels;\n};\n\nconst generatedBcsFactoryPattern =\n\t/export function ([A-Za-z_$][\\w$]*)<((?:[^<>]|<[^<>]*>)+)>\\((\\.\\.\\.typeParameters: \\[[\\s\\S]*?\\n\\])\\) \\{\\n(\\s*)return new (MoveStruct|MoveEnum|MoveTuple)\\(/g;\n\nconst bcsFactoryReturnType = (constructorName: string): string => {\n\tif (constructorName === 'MoveEnum') {\n\t\treturn 'MoveEnum<any, string>';\n\t}\n\tif (constructorName === 'MoveTuple') {\n\t\treturn 'MoveTuple<any, string>';\n\t}\n\treturn 'MoveStruct<any, string>';\n};\n\nconst stabilizeGeneratedBindingContent = (content: string): string =>\n\tcontent.replace(\n\t\tgeneratedBcsFactoryPattern,\n\t\t(_match, name, generics, parameters, indent, constructorName: string) =>\n\t\t\t`export function ${name}<${generics}>(${parameters}): ${bcsFactoryReturnType(\n\t\t\t\tconstructorName,\n\t\t\t)} {\\n${indent}return new ${constructorName}(`,\n\t);\n\nconst collectGeneratedFiles = async (\n\troot: string,\n): Promise<ReadonlyArray<{ readonly relPath: string; readonly content: string }>> => {\n\tconst out: Array<{ readonly relPath: string; readonly content: string }> = [];\n\tconst walk = async (dir: string): Promise<void> => {\n\t\tconst entries = await readdir(dir, { withFileTypes: true });\n\t\tfor (const entry of entries) {\n\t\t\tconst abs = join(dir, entry.name);\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tawait walk(abs);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!entry.isFile()) continue;\n\t\t\tconst relPath = relative(root, abs).split(sep).join('/');\n\t\t\tout.push({ relPath, content: await readFile(abs, 'utf8') });\n\t\t}\n\t};\n\tawait walk(root);\n\tout.sort((a, b) => a.relPath.localeCompare(b.relPath));\n\treturn out;\n};\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"bindings.mjs","names":[],"sources":["../../../src/orchestrators/codegen/bindings.ts"],"sourcesContent":["// Move-package bindings emission.\n//\n// Distilled-doc § \"Move-to-TS bindings: per-published-package typed\n// client modules produced from each local Move package's summary.\"\n// Drives `@mysten/codegen`'s `generateFromPackageSummary` against\n// `MoveSummary` JSON contributed by a plugin-owned\n// `MoveSummaryRunnerService`.\n//\n// sourcePath-known-vs-unknown discipline:\n// - `Package` plugin's `Codegenable` emits a `PackageBindings`\n// shape with `sourcePath: string | null`.\n// - The bindings emitter filters to `sourcePath !== null` (i.e.\n// LOCAL packages); `KnownPackage` entries (`sourcePath: null`)\n// are skipped — their bindings come from the SDK or MVR.\n//\n// Architecture seam:\n// - `MoveSummaryRunnerService` is contributed by a plugin (the\n// sui plugin ships `layerSuiMoveSummaryRunnerDocker` /\n// `layerSuiMoveSummaryRunnerHost`). The codegen orchestrator\n// consumes only the abstract service — it never names the Sui\n// CLI binary or container image (architecture: \"Orchestrator\n// boundaries — never names a service\").\n// - The call to `@mysten/codegen.generateFromPackageSummary` is\n// similarly behind a tagged service so unit tests can stub it\n// without pulling in the heavyweight `@mysten/codegen` graph.\n//\n// Distilled-doc § \"Silent no-op from a downstream tool is a\n// failure\": after summary + render, we probe the output dir.\n// If it's empty, that's a `CodegenBindingsFailed` with a hint about\n// the common `Move.toml` `[addresses]` cause.\n\nimport { mkdtemp, readdir, readFile, rm } from 'node:fs/promises';\nimport { tmpdir } from 'node:os';\nimport { join, relative, sep } from 'node:path';\n\nimport { generateFromPackageSummary } from '@mysten/codegen';\nimport { Context, Effect, FileSystem, Layer } from 'effect';\n\nimport type { ImageRef } from '../../contracts/container-runtime.ts';\n\nimport { emitOne } from './emit.ts';\nimport { CodegenBindingsFailed } from './errors.ts';\nimport { NON_SENSITIVE_DIR_MODE, NON_SENSITIVE_FILE_MODE } from './permissions.ts';\n\n// -----------------------------------------------------------------------------\n// Service seam — Move summary + codegen invocation\n// -----------------------------------------------------------------------------\n\n/** Result of `sui move summary` — opaque JSON the codegen generator\n * consumes. We don't decode it here; `@mysten/codegen` owns the\n * schema. */\nexport interface MoveSummary {\n\treadonly packageName: string;\n\treadonly sourcePath: string;\n\treadonly summaryPath?: string;\n\treadonly cleanupPath?: string;\n\treadonly summaryJson: unknown;\n}\n\nexport interface MoveSummaryInput {\n\treadonly packageName: string;\n\treadonly sourcePath: string;\n\treadonly buildImage?: ImageRef | null;\n}\n\n/** Shape of the Move summary runner. Implementations live in\n * plugin packages (e.g. `plugins/sui/move-summary-runner.ts`\n * exports `layerSuiMoveSummaryRunnerDocker` and\n * `layerSuiMoveSummaryRunnerHost`); tests use `stubMoveSummaryRunner`\n * below. */\nexport interface MoveSummaryRunner {\n\treadonly runSummary: (\n\t\tinput: MoveSummaryInput,\n\t) => Effect.Effect<MoveSummary, CodegenBindingsFailed>;\n}\n\nexport class MoveSummaryRunnerService extends Context.Service<\n\tMoveSummaryRunnerService,\n\tMoveSummaryRunner\n>()('@devstack/orchestrator/MoveSummaryRunner') {}\n\n/** Shape of the `@mysten/codegen` invocation. Returns the rendered\n * TS files (path → content) for one package. */\nexport interface MoveCodegen {\n\treadonly generate: (input: {\n\t\treadonly packageName: string;\n\t\treadonly sourcePath: string;\n\t\treadonly summary: MoveSummary;\n\t\treadonly mvrPlaceholder: string;\n\t\treadonly importExtension: '.ts' | '.js' | '';\n\t}) => Effect.Effect<\n\t\tReadonlyArray<{ readonly relPath: string; readonly content: string }>,\n\t\tCodegenBindingsFailed\n\t>;\n}\n\nexport class MoveCodegenService extends Context.Service<MoveCodegenService, MoveCodegen>()(\n\t'@devstack/orchestrator/MoveCodegen',\n) {}\n\n// -----------------------------------------------------------------------------\n// Public entry — emit bindings for the local packages in a set of\n// PackageBindings contributions.\n// -----------------------------------------------------------------------------\n\nexport interface PackageBindings {\n\treadonly name: string;\n\treadonly packageId: string;\n\treadonly mvrPlaceholder: string;\n\treadonly sourcePath: string | null;\n\treadonly excluded: boolean;\n}\n\n/**\n * Consumer-side shape guard: does an aggregated value look like a\n * Move-bindings contribution that `emitBindings` knows how to consume?\n * This is structural validation of the orchestrator's own input\n * contract, NOT a plugin-name match — any plugin whose\n * `aggregate.project` returns objects with this shape is forwarded to\n * the Move bindings emitter. The single definition of the seam; both\n * the codegen orchestrator service and the Package plugin reference it.\n */\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\nexport interface EmitBindingsInput {\n\treadonly bindingsDir: string;\n\treadonly packages: ReadonlyArray<PackageBindings>;\n\treadonly importExtension?: '.ts' | '.js' | '';\n}\n\nexport interface EmitBindingsResult {\n\treadonly packagesEmitted: ReadonlyArray<string>;\n\treadonly packagesSkipped: ReadonlyArray<string>;\n\treadonly filesWritten: ReadonlyArray<string>;\n}\n\n/**\n * Walk the `PackageBindings` set, filter to LOCAL packages\n * (`sourcePath !== null`), run `sui move summary` + `@mysten/codegen`\n * for each, and write the rendered files into `bindingsDir/<name>/`.\n *\n * Serial within a cycle (distilled-doc § \"Serial within a cycle\":\n * shared Move build cache races). Per-package parallelism is unsafe.\n */\nexport const emitBindings = (\n\tinput: EmitBindingsInput,\n): Effect.Effect<\n\tEmitBindingsResult,\n\tCodegenBindingsFailed,\n\tFileSystem.FileSystem | MoveSummaryRunnerService | MoveCodegenService\n> =>\n\tEffect.gen(function* () {\n\t\tconst runner = yield* MoveSummaryRunnerService;\n\t\tconst generator = yield* MoveCodegenService;\n\t\tconst importExtension = input.importExtension ?? '.ts';\n\n\t\t// Dedup by package name. First-wins; distilled-doc § \"Duplicate\n\t\t// package names\": warn + skip the duplicate to avoid the HMR\n\t\t// re-emit storm.\n\t\t// Dedup by package IDENTITY (packageId + sourcePath), keyed for\n\t\t// lookup by name. The SAME package legitimately appears more than\n\t\t// once in the contribution set (e.g. the plugin's localPackage\n\t\t// binding AND a coin's package reference both point at it) — that\n\t\t// is a benign self-duplicate and is skipped SILENTLY. We only warn\n\t\t// when two genuinely DIFFERENT packages (different id/sourcePath)\n\t\t// collide on the same name, which is the real HMR re-emit hazard.\n\t\tconst seenIdentityByName = new Map<string, string>();\n\t\tconst identityOf = (pkg: PackageBindings): string => `${pkg.packageId} ${pkg.sourcePath ?? ''}`;\n\t\tconst targets: Array<PackageBindings> = [];\n\t\tconst skipped: Array<string> = [];\n\t\tfor (const pkg of input.packages) {\n\t\t\tif (pkg.sourcePath === null) {\n\t\t\t\tskipped.push(pkg.name);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (pkg.excluded) {\n\t\t\t\tskipped.push(pkg.name);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst identity = identityOf(pkg);\n\t\t\tconst seenIdentity = seenIdentityByName.get(pkg.name);\n\t\t\tif (seenIdentity !== undefined) {\n\t\t\t\tif (seenIdentity !== identity) {\n\t\t\t\t\t// Two genuinely DIFFERENT packages share a name — a real\n\t\t\t\t\t// collision and a real HMR re-emit hazard.\n\t\t\t\t\tyield* Effect.logWarning(\n\t\t\t\t\t\t`codegen.bindings: duplicate package name '${pkg.name}' — keeping ` +\n\t\t\t\t\t\t\t`first and skipping duplicate to avoid HMR re-emit storm. ` +\n\t\t\t\t\t\t\t`Rename one of the packages.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// Same identity → benign self-duplicate (e.g. localPackage +\n\t\t\t\t// coin package ref): skip silently, no warning.\n\t\t\t\tskipped.push(pkg.name);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseenIdentityByName.set(pkg.name, identity);\n\t\t\ttargets.push(pkg);\n\t\t}\n\t\t// Deterministic order: lexicographic by package name.\n\t\ttargets.sort((a, b) => a.name.localeCompare(b.name));\n\n\t\tconst emitted: Array<string> = [];\n\t\tconst filesWritten: Array<string> = [];\n\t\tfor (const pkg of targets) {\n\t\t\t// sourcePath is non-null per the filter above. Narrow.\n\t\t\tif (pkg.sourcePath === null) continue;\n\t\t\tconst summary = yield* runner.runSummary({\n\t\t\t\tpackageName: pkg.name,\n\t\t\t\tsourcePath: pkg.sourcePath,\n\t\t\t});\n\t\t\tconst files = yield* generator.generate({\n\t\t\t\tpackageName: pkg.name,\n\t\t\t\tsourcePath: pkg.sourcePath,\n\t\t\t\tsummary,\n\t\t\t\tmvrPlaceholder: pkg.mvrPlaceholder,\n\t\t\t\timportExtension,\n\t\t\t});\n\t\t\t// Post-emit probe — silent no-op detection.\n\t\t\tif (files.length === 0) {\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\tpackage: pkg.name,\n\t\t\t\t\t\tsourcePath: pkg.sourcePath,\n\t\t\t\t\t\treason: 'no-output',\n\t\t\t\t\t\thint:\n\t\t\t\t\t\t\t'The Move codegen generator produced no files. This is ' +\n\t\t\t\t\t\t\t'usually caused by a missing `[addresses]` block in the ' +\n\t\t\t\t\t\t\t\"package's Move.toml, or a non-published address mapping.\",\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tfor (const f of files) {\n\t\t\t\tif (f.relPath.includes('..') || f.relPath.startsWith('/')) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\t\tpackage: pkg.name,\n\t\t\t\t\t\t\tsourcePath: pkg.sourcePath,\n\t\t\t\t\t\t\treason: 'write-failed',\n\t\t\t\t\t\t\tcause: new Error(`generated binding path escapes output dir: ${f.relPath}`),\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst abs = joinPath(input.bindingsDir, f.relPath);\n\t\t\t\tconst outcome = yield* emitOne({\n\t\t\t\t\tpath: abs,\n\t\t\t\t\tcontent: stabilizeGeneratedBindingContent(f.content),\n\t\t\t\t\tmode: NON_SENSITIVE_FILE_MODE,\n\t\t\t\t\tparentMode: NON_SENSITIVE_DIR_MODE,\n\t\t\t\t}).pipe(\n\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t(cause) =>\n\t\t\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\t\t\tpackage: pkg.name,\n\t\t\t\t\t\t\t\tsourcePath: pkg.sourcePath!,\n\t\t\t\t\t\t\t\treason: 'write-failed',\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tif (outcome.outcome !== 'unchanged') {\n\t\t\t\t\tfilesWritten.push(abs);\n\t\t\t\t}\n\t\t\t}\n\t\t\temitted.push(pkg.name);\n\t\t}\n\n\t\treturn {\n\t\t\tpackagesEmitted: emitted,\n\t\t\tpackagesSkipped: skipped,\n\t\t\tfilesWritten,\n\t\t};\n\t});\n\n// -----------------------------------------------------------------------------\n// Stub implementations for tests\n// -----------------------------------------------------------------------------\n\n/** Stub runner — returns a synthetic summary. Used in unit tests\n * to exercise the bindings pipeline without a real `sui` binary. */\nexport const stubMoveSummaryRunner = (\n\tsummaryFor: (sourcePath: string) => MoveSummary,\n): MoveSummaryRunner => ({\n\trunSummary: ({ sourcePath }) => Effect.succeed(summaryFor(sourcePath)),\n});\n\n/** Stub generator — returns a synthetic file set. Used in unit\n * tests to exercise the bindings pipeline without pulling in the\n * heavyweight `@mysten/codegen` graph. */\nexport const stubMoveCodegen = (\n\tfiles: (\n\t\tinput: Parameters<MoveCodegen['generate']>[0],\n\t) => ReadonlyArray<{ readonly relPath: string; readonly content: string }>,\n): MoveCodegen => ({\n\tgenerate: (input) => Effect.succeed(files(input)),\n});\n\n// -----------------------------------------------------------------------------\n// Production implementations\n// -----------------------------------------------------------------------------\n//\n// Layer factories for `MoveSummaryRunnerService` are plugin-owned —\n// they live in `src/plugins/sui/move-summary-runner.ts`. The codegen\n// orchestrator does not name the Sui CLI binary or container image;\n// per \"Orchestrator boundaries — never names a service\", any plugin\n// that can produce `MoveSummary` JSON may contribute a runner Layer.\n\nexport const layerMystenMoveCodegen = (\n\toptions: {\n\t\t/** Forwarded verbatim to `@mysten/codegen`'s\n\t\t * `generateFromPackageSummary({ includePhantomTypeParameters })`.\n\t\t * Default `false` (`@mysten/codegen`'s own default): phantom-only\n\t\t * structs render as plain consts with the `<phantom T>` placeholder\n\t\t * baked into `.name`. `true` renders them as factory functions whose\n\t\t * phantom type parameters are REQUIRED arguments, so the returned\n\t\t * instance's `.name` is a fully-qualified, composable type tag\n\t\t * (`Pool(DBTC, DUSDC).name`). Static per stack — threaded from\n\t\t * `DevstackOptions['codegen']` through\n\t\t * `resolveProductionCodegenOptions`, never per-cycle. */\n\t\treadonly includePhantomTypeParameters?: boolean;\n\t} = {},\n): Layer.Layer<MoveCodegenService> =>\n\tLayer.succeed(\n\t\tMoveCodegenService,\n\t\tMoveCodegenService.of({\n\t\t\tgenerate: (input) =>\n\t\t\t\tEffect.tryPromise({\n\t\t\t\t\ttry: async () => {\n\t\t\t\t\t\tconst tmp = await mkdtemp(join(tmpdir(), 'devstack-move-codegen-'));\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t// `sui move summary` keys each `package_summaries/<dir>`\n\t\t\t\t\t\t\t// subdirectory by the package's NAMED ADDRESS, not its\n\t\t\t\t\t\t\t// `[package].name`. These legitimately differ (the canonical\n\t\t\t\t\t\t\t// example is MoveStdlib, whose package name is \"MoveStdlib\"\n\t\t\t\t\t\t\t// but whose named address is \"std\"). `@mysten/codegen`'s\n\t\t\t\t\t\t\t// resolver matches the summary subdir by either (1) a single\n\t\t\t\t\t\t\t// `[addresses]` label or (2) the `packageName` — but it reads\n\t\t\t\t\t\t\t// the Move.toml at the path WE pass it (the summary scratch\n\t\t\t\t\t\t\t// dir), which has NO `[addresses]` table, so its label-based\n\t\t\t\t\t\t\t// path (1) is defeated and it falls back to (2). We pass the\n\t\t\t\t\t\t\t// symbolic localPackage() NAME as `packageName`, which is the\n\t\t\t\t\t\t\t// `[package].name`, NOT the named address — so codegen throws\n\t\t\t\t\t\t\t// \"Could not identify main package directory\" whenever the two\n\t\t\t\t\t\t\t// differ. Recover the correct subdir name here from the REAL\n\t\t\t\t\t\t\t// source Move.toml's `[addresses]` table (which devstack still\n\t\t\t\t\t\t\t// has at `input.sourcePath`), falling back to the name when the\n\t\t\t\t\t\t\t// source is unreadable or ambiguous (a no-op for the common\n\t\t\t\t\t\t\t// case where name == address).\n\t\t\t\t\t\t\tconst packageName =\n\t\t\t\t\t\t\t\t(await resolveSummaryDirName(input.sourcePath)) ?? input.packageName;\n\t\t\t\t\t\t\tawait generateFromPackageSummary({\n\t\t\t\t\t\t\t\tpackage: {\n\t\t\t\t\t\t\t\t\tpath: input.summary.summaryPath ?? input.sourcePath,\n\t\t\t\t\t\t\t\t\tpackage: input.mvrPlaceholder,\n\t\t\t\t\t\t\t\t\tpackageName,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tprune: true,\n\t\t\t\t\t\t\t\toutputDir: tmp,\n\t\t\t\t\t\t\t\timportExtension: input.importExtension,\n\t\t\t\t\t\t\t\tincludePhantomTypeParameters: options.includePhantomTypeParameters,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn await collectGeneratedFiles(tmp);\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tawait rm(tmp, { recursive: true, force: true });\n\t\t\t\t\t\t\tif (input.summary.cleanupPath !== undefined) {\n\t\t\t\t\t\t\t\tawait rm(input.summary.cleanupPath, { recursive: true, force: true });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tcatch: (cause) =>\n\t\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\t\tpackage: input.packageName,\n\t\t\t\t\t\t\tsourcePath: input.sourcePath,\n\t\t\t\t\t\t\treason: 'render-failed',\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t}),\n\t\t\t\t}),\n\t\t}),\n\t);\n\n// -----------------------------------------------------------------------------\n// Local helpers — keep the module dep-free of Path.Path so the\n// caller can compose without an extra service yield.\n// -----------------------------------------------------------------------------\n\nconst joinPath = (...parts: ReadonlyArray<string>): string =>\n\tparts.map((p, i) => (i === 0 ? p.replace(/\\/+$/, '') : p.replace(/^\\/+|\\/+$/g, ''))).join('/');\n\n/**\n * Determine the `package_summaries/<dir>` subdirectory name for a local\n * Move package from its REAL source `Move.toml`. `sui move summary` keys\n * these subdirs by the NAMED ADDRESS (e.g. MoveStdlib → \"std\"), not the\n * `[package].name`, so when the two differ we must hand `@mysten/codegen`\n * the address label rather than the symbolic package name.\n *\n * Returns the single `[addresses]` label when the table has exactly one\n * entry (the overwhelmingly common case — and a no-op when name == address),\n * and `null` otherwise (unreadable Move.toml, no `[addresses]` table, or an\n * ambiguous multi-address table) so the caller can fall back to the package\n * name and preserve `@mysten/codegen`'s own resolution.\n *\n * Hand-parse rather than pull in a TOML dependency: the sibling Move-build\n * path already harvests `{ local = \"../x\" }` deps from Move.toml by regex\n * (`plugins/sui/move/index.ts`), and we only need the `[addresses]` section's\n * left-hand labels — never their values.\n */\nconst resolveSummaryDirName = async (sourcePath: string): Promise<string | null> => {\n\tlet toml: string;\n\ttry {\n\t\ttoml = await readFile(join(sourcePath, 'Move.toml'), 'utf8');\n\t} catch {\n\t\treturn null;\n\t}\n\tconst labels = parseAddressLabels(toml);\n\treturn labels.length === 1 ? labels[0]! : null;\n};\n\n/** Left-hand labels of the `[addresses]` table in a Move.toml. Scans from\n * the `[addresses]` header to the next `[section]` header (or EOF) and\n * collects each `name = \"...\"` key, ignoring blank/comment lines. */\nconst parseAddressLabels = (toml: string): ReadonlyArray<string> => {\n\tconst lines = toml.split(/\\r?\\n/);\n\tconst start = lines.findIndex((line) => /^\\s*\\[addresses\\]\\s*$/.test(line));\n\tif (start === -1) return [];\n\tconst labels: Array<string> = [];\n\tfor (const line of lines.slice(start + 1)) {\n\t\t// Next table header ends the `[addresses]` section.\n\t\tif (/^\\s*\\[/.test(line)) break;\n\t\tconst stripped = line.replace(/#.*$/, '').trim();\n\t\tif (stripped === '') continue;\n\t\tconst match = /^([A-Za-z_][\\w-]*)\\s*=/.exec(stripped);\n\t\tif (match) labels.push(match[1]!);\n\t}\n\treturn labels;\n};\n\nconst generatedBcsFactoryPattern =\n\t/export function ([A-Za-z_$][\\w$]*)<((?:[^<>]|<[^<>]*>)+)>\\((\\.\\.\\.typeParameters: \\[[\\s\\S]*?\\n\\])\\) \\{\\n(\\s*)return new (MoveStruct|MoveEnum|MoveTuple)\\(/g;\n\nconst bcsFactoryReturnType = (constructorName: string): string => {\n\tif (constructorName === 'MoveEnum') {\n\t\treturn 'MoveEnum<any, string>';\n\t}\n\tif (constructorName === 'MoveTuple') {\n\t\treturn 'MoveTuple<any, string>';\n\t}\n\treturn 'MoveStruct<any, string>';\n};\n\nconst stabilizeGeneratedBindingContent = (content: string): string =>\n\tcontent.replace(\n\t\tgeneratedBcsFactoryPattern,\n\t\t(_match, name, generics, parameters, indent, constructorName: string) =>\n\t\t\t`export function ${name}<${generics}>(${parameters}): ${bcsFactoryReturnType(\n\t\t\t\tconstructorName,\n\t\t\t)} {\\n${indent}return new ${constructorName}(`,\n\t);\n\nconst collectGeneratedFiles = async (\n\troot: string,\n): Promise<ReadonlyArray<{ readonly relPath: string; readonly content: string }>> => {\n\tconst out: Array<{ readonly relPath: string; readonly content: string }> = [];\n\tconst walk = async (dir: string): Promise<void> => {\n\t\tconst entries = await readdir(dir, { withFileTypes: true });\n\t\tfor (const entry of entries) {\n\t\t\tconst abs = join(dir, entry.name);\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tawait walk(abs);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!entry.isFile()) continue;\n\t\t\tconst relPath = relative(root, abs).split(sep).join('/');\n\t\t\tout.push({ relPath, content: await readFile(abs, 'utf8') });\n\t\t}\n\t};\n\tawait walk(root);\n\tout.sort((a, b) => a.relPath.localeCompare(b.relPath));\n\treturn out;\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
//#region src/orchestrators/codegen/config-runtime.ts
|
|
2
|
+
/** Output path (relative to the generated tree) of the emitted resolver. */
|
|
3
|
+
const CONFIG_RUNTIME_OUTPUT_PATH = "config-runtime.ts";
|
|
4
|
+
/** The verbatim source emitted as `src/generated/config-runtime.ts`. */
|
|
5
|
+
const CONFIG_RUNTIME_SOURCE = `// THIS FILE IS AUTO-GENERATED BY @mysten/devstack.
|
|
6
|
+
// Do not edit by hand — your changes will be overwritten by the next
|
|
7
|
+
// \`devstack codegen\`. Apps consume codegen output; codegen output never
|
|
8
|
+
// imports from devstack.
|
|
9
|
+
//
|
|
10
|
+
// Loud-failing on-chain id resolver. The committed \`config.ts\` carries no
|
|
11
|
+
// ids; it resolves each id through \`resolveId(...)\` here, which reads the
|
|
12
|
+
// build-time-injected \`__DEVSTACK_IDS__\` global. Run \`devstack up\` for
|
|
13
|
+
// local dev (the Vite plugin injects the live ids), or point the build at a
|
|
14
|
+
// committed id-config file for a real deployment.
|
|
15
|
+
|
|
16
|
+
const UNRESOLVED_ID =
|
|
17
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000';
|
|
18
|
+
|
|
19
|
+
// Node-only runtime fallback for the on-chain ids. The browser/dev/prod
|
|
20
|
+
// path injects \`__DEVSTACK_IDS__\` via the Vite \`define\` (replaced at
|
|
21
|
+
// transform time); this fallback ONLY engages when that define is absent —
|
|
22
|
+
// i.e. under Node/vitest, where the \`define\` bakes to \`null\` because the
|
|
23
|
+
// test stack is booted by the vitest \`globalSetup\` AFTER the Vite config
|
|
24
|
+
// (and so this module) is evaluated. The devstack vitest \`globalSetup\`
|
|
25
|
+
// publishes the booted stack's id-config FILE path as
|
|
26
|
+
// \`process.env.DEVSTACK_IDS_FILE\`; we read+parse it lazily here. Guarded so
|
|
27
|
+
// browser bundles (no \`process\`, no \`node:fs\`) never touch it. Returns
|
|
28
|
+
// \`null\` on any miss, so \`ids()\` throws its actionable error as before.
|
|
29
|
+
// Minimal LOCAL shapes (no \`@types/node\` dependency — this file is also
|
|
30
|
+
// type-checked in browser tsconfigs that don't load node types). We reach
|
|
31
|
+
// \`process\` through \`globalThis\` and feature-test every member.
|
|
32
|
+
interface NodeProcessLike {
|
|
33
|
+
readonly env?: { readonly [k: string]: string | undefined };
|
|
34
|
+
readonly getBuiltinModule?: (id: string) => unknown;
|
|
35
|
+
}
|
|
36
|
+
interface NodeFsLike {
|
|
37
|
+
readonly existsSync: (p: string) => boolean;
|
|
38
|
+
readonly readFileSync: (p: string, enc: 'utf8') => string;
|
|
39
|
+
}
|
|
40
|
+
let nodeFallbackCache: DevstackIds | null | undefined;
|
|
41
|
+
const readNodeFallbackIds = (): DevstackIds | null => {
|
|
42
|
+
if (nodeFallbackCache !== undefined) return nodeFallbackCache;
|
|
43
|
+
nodeFallbackCache = null;
|
|
44
|
+
try {
|
|
45
|
+
const proc = (globalThis as { process?: NodeProcessLike }).process;
|
|
46
|
+
if (proc === undefined) return null;
|
|
47
|
+
const idsFile = proc.env?.DEVSTACK_IDS_FILE;
|
|
48
|
+
if (idsFile === undefined || idsFile.length === 0) return null;
|
|
49
|
+
// \`process.getBuiltinModule\` (Node >=22.3) loads \`node:fs\`
|
|
50
|
+
// synchronously without an \`import\`/\`require\` literal a browser
|
|
51
|
+
// bundler would try to resolve — this whole branch is unreachable in
|
|
52
|
+
// the browser (no \`process\`), so node:fs never enters the bundle.
|
|
53
|
+
const getBuiltin = proc.getBuiltinModule;
|
|
54
|
+
if (typeof getBuiltin !== 'function') return null;
|
|
55
|
+
const fs = getBuiltin('node:fs') as NodeFsLike;
|
|
56
|
+
if (!fs.existsSync(idsFile)) return null;
|
|
57
|
+
nodeFallbackCache = JSON.parse(fs.readFileSync(idsFile, 'utf8')) as DevstackIds;
|
|
58
|
+
return nodeFallbackCache;
|
|
59
|
+
} catch {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** The injected ids, or — under Node with no injected define — the
|
|
65
|
+
* \`DEVSTACK_IDS_FILE\` fallback. \`null\` when neither is available. */
|
|
66
|
+
const injectedIds = (): DevstackIds | null => {
|
|
67
|
+
const injected = typeof __DEVSTACK_IDS__ === 'undefined' ? null : __DEVSTACK_IDS__;
|
|
68
|
+
if (injected !== null && injected !== undefined) return injected;
|
|
69
|
+
return readNodeFallbackIds();
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/** One network connection entry — \`rpc\` is the load-bearing field the app
|
|
73
|
+
* reads synchronously; \`chainId\`/\`faucet\`/\`graphql\` are optional
|
|
74
|
+
* diagnostics (mirrors \`IdConfigNetworkSchema\`). */
|
|
75
|
+
export interface DevstackNetworkEntry {
|
|
76
|
+
readonly rpc: string;
|
|
77
|
+
readonly chainId?: string;
|
|
78
|
+
readonly faucet?: string | null;
|
|
79
|
+
readonly graphql?: string | null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Shape of the injected ids. \`null\` when no stack is running and no
|
|
83
|
+
* id-config file was supplied at build time. */
|
|
84
|
+
export interface DevstackIds {
|
|
85
|
+
readonly network: string;
|
|
86
|
+
readonly networks: { readonly [name: string]: DevstackNetworkEntry };
|
|
87
|
+
readonly packages: {
|
|
88
|
+
readonly [name: string]: { readonly id: string; readonly objects?: { readonly [k: string]: string } };
|
|
89
|
+
};
|
|
90
|
+
readonly accounts: { readonly [name: string]: string };
|
|
91
|
+
readonly mvrOverrides: { readonly [mvrPlaceholder: string]: string };
|
|
92
|
+
/** Generic resolver channel: \`values[namespace][key]\` carries
|
|
93
|
+
* arbitrary plugin JSON the typed fields above can't (deepbook pool
|
|
94
|
+
* ids, coin types, walrus/seal endpoints). Optional — an older
|
|
95
|
+
* injected blob (no \`values\`) still satisfies the typed resolvers. */
|
|
96
|
+
readonly values?: { readonly [namespace: string]: { readonly [key: string]: unknown } };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
declare global {
|
|
100
|
+
// Injected by the devstack Vite plugin via \`define\`. \`null\` when no
|
|
101
|
+
// ids are available (no stack up + no id-config file).
|
|
102
|
+
const __DEVSTACK_IDS__: DevstackIds | null | undefined;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Thrown when a generated config value needs an on-chain id but none was
|
|
106
|
+
* injected — actionable, not a silent zero. */
|
|
107
|
+
export class DevstackConfigMissingError extends Error {
|
|
108
|
+
constructor(detail: string) {
|
|
109
|
+
super(
|
|
110
|
+
\`[devstack] \${detail}\\n\` +
|
|
111
|
+
\`No on-chain ids are available. For local dev, run \\\`devstack up\\\` \` +
|
|
112
|
+
\`(the Vite dev server injects the live ids). For a production build, \` +
|
|
113
|
+
\`point the build at the known deployment's committed id-config file \` +
|
|
114
|
+
\`(the Vite plugin \\\`ids\\\` option, or \\\`DEVSTACK_IDS_FILE\\\`) before \` +
|
|
115
|
+
\`\\\`pnpm build\\\`. See your example README's "Deploy to a real network" \` +
|
|
116
|
+
\`section.\`,
|
|
117
|
+
);
|
|
118
|
+
this.name = 'DevstackConfigMissingError';
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const ids = (): DevstackIds => {
|
|
123
|
+
const injected = injectedIds();
|
|
124
|
+
if (injected === null || injected === undefined) {
|
|
125
|
+
throw new DevstackConfigMissingError('on-chain ids were never injected');
|
|
126
|
+
}
|
|
127
|
+
return injected;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/** Resolve the active-network id for an MVR placeholder (\`@local/<slug>\`).
|
|
131
|
+
* Throws \`DevstackConfigMissingError\` when the id is absent or the
|
|
132
|
+
* all-zero sentinel. */
|
|
133
|
+
export const resolveId = (mvrPlaceholder: string): string => {
|
|
134
|
+
const id = ids().mvrOverrides[mvrPlaceholder];
|
|
135
|
+
if (id === undefined || id === UNRESOLVED_ID) {
|
|
136
|
+
throw new DevstackConfigMissingError(\`id for "\${mvrPlaceholder}" is unresolved\`);
|
|
137
|
+
}
|
|
138
|
+
return id;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
/** Resolve the active network name (the \`networks.<name>\` key the app
|
|
142
|
+
* reads). Environment/live data — the local stack picks a dynamic value
|
|
143
|
+
* and a real deployment names a different network — so it is injected,
|
|
144
|
+
* never baked into the committed tree. Throws when no ids were injected. */
|
|
145
|
+
export const resolveNetwork = (): string => ids().network;
|
|
146
|
+
|
|
147
|
+
/** Resolve the network connection map (\`{ [name]: DevstackNetworkEntry }\`).
|
|
148
|
+
* The local rpc carries a dynamic port; a real deployment supplies its own —
|
|
149
|
+
* so this is injected, never baked. Throws when no ids were injected. */
|
|
150
|
+
export const resolveNetworks = (): { readonly [name: string]: DevstackNetworkEntry } =>
|
|
151
|
+
ids().networks;
|
|
152
|
+
|
|
153
|
+
/** Resolve the ACTIVE network's connection entry —
|
|
154
|
+
* \`resolveNetworks()[resolveNetwork()]\` with a non-undefined return type and
|
|
155
|
+
* a loud throw. Removes the \`config.networks[config.network]\` index-signature
|
|
156
|
+
* footgun: the app reads \`.rpc\` etc. off a guaranteed entry instead of
|
|
157
|
+
* threading an \`undefined\` past the index lookup. Throws
|
|
158
|
+
* \`DevstackConfigMissingError\` when no ids were injected or the active
|
|
159
|
+
* network has no entry in the injected map. */
|
|
160
|
+
export const resolveActiveNetwork = (): DevstackNetworkEntry => {
|
|
161
|
+
const network = resolveNetwork();
|
|
162
|
+
const entry = resolveNetworks()[network];
|
|
163
|
+
if (entry === undefined) {
|
|
164
|
+
throw new DevstackConfigMissingError(\`active network "\${network}" has no entry\`);
|
|
165
|
+
}
|
|
166
|
+
return entry;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
/** Resolve a generic plugin value (\`values[namespace][key]\`). The committed
|
|
170
|
+
* \`config.ts\` calls this for any live plugin value that isn't a package id
|
|
171
|
+
* or the network — deepbook pool ids, coin types, walrus/seal endpoints.
|
|
172
|
+
* Throws \`DevstackConfigMissingError\` when no ids were injected, the value
|
|
173
|
+
* is missing, or it is the all-zero sentinel. */
|
|
174
|
+
export const resolveValue = <T = unknown>(namespace: string, key: string): T => {
|
|
175
|
+
const values = ids().values ?? {};
|
|
176
|
+
const namespaceValues = values[namespace];
|
|
177
|
+
const value = namespaceValues === undefined ? undefined : namespaceValues[key];
|
|
178
|
+
if (value === undefined || value === UNRESOLVED_ID) {
|
|
179
|
+
throw new DevstackConfigMissingError(
|
|
180
|
+
\`value "\${namespace}.\${key}" is unresolved\`,
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
return value as T;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
/** Non-throwing variant of \`resolveValue\`: returns \`undefined\` instead of
|
|
187
|
+
* throwing \`DevstackConfigMissingError\` when no ids were injected, the value
|
|
188
|
+
* is missing, or it is the all-zero sentinel. For discovery-only ids the app
|
|
189
|
+
* GATES on (e.g. a coin's \`treasuryCapId\`/\`metadataId\`, only known after a
|
|
190
|
+
* live publish) rather than the load-bearing fields that should fail loud. */
|
|
191
|
+
export const resolveValueOptional = <T = unknown>(
|
|
192
|
+
namespace: string,
|
|
193
|
+
key: string,
|
|
194
|
+
): T | undefined => {
|
|
195
|
+
const injected = injectedIds();
|
|
196
|
+
const values = injected?.values ?? {};
|
|
197
|
+
const namespaceValues = values[namespace];
|
|
198
|
+
const value = namespaceValues === undefined ? undefined : namespaceValues[key];
|
|
199
|
+
if (value === undefined || value === UNRESOLVED_ID) {
|
|
200
|
+
return undefined;
|
|
201
|
+
}
|
|
202
|
+
return value as T;
|
|
203
|
+
};
|
|
204
|
+
`;
|
|
205
|
+
//#endregion
|
|
206
|
+
export { CONFIG_RUNTIME_OUTPUT_PATH, CONFIG_RUNTIME_SOURCE };
|
|
207
|
+
|
|
208
|
+
//# sourceMappingURL=config-runtime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-runtime.mjs","names":[],"sources":["../../../src/orchestrators/codegen/config-runtime.ts"],"sourcesContent":["// The FIXED `config-runtime.ts` source the codegen verb emits into the\n// committed `src/generated` tree.\n//\n// This is NOT routed through the literal renderer (`format.ts`) — it is a\n// constant string, emitted verbatim. It is the loud-failing id resolver\n// the committed `config.ts` calls: `config.ts` carries NO on-chain id\n// (those are LOADED CONFIG DATA, not codegen output), so each id is a\n// `resolveId('@local/<slug>')` call into this module, which reads the\n// build-time-injected `__DEVSTACK_IDS__` global and THROWS a clear,\n// actionable error when the id is absent or the all-zero sentinel.\n//\n// `__DEVSTACK_IDS__` is injected synchronously by the devstack Vite plugin\n// (`build-integrations/vite/index.ts`) via `define`:\n// - dev (stack up): the live `.devstack/stacks/<stack>/devstack-ids.json`.\n// - prod build: a committed id-config FILE (same schema) — the Vite\n// plugin `ids` option or a `DEVSTACK_IDS_FILE` path.\n// - neither: `null` → `resolveId` throws at access time.\n\n/** Output path (relative to the generated tree) of the emitted resolver. */\nexport const CONFIG_RUNTIME_OUTPUT_PATH = 'config-runtime.ts';\n\n/** The verbatim source emitted as `src/generated/config-runtime.ts`. */\nexport const CONFIG_RUNTIME_SOURCE = `// THIS FILE IS AUTO-GENERATED BY @mysten/devstack.\n// Do not edit by hand — your changes will be overwritten by the next\n// \\`devstack codegen\\`. Apps consume codegen output; codegen output never\n// imports from devstack.\n//\n// Loud-failing on-chain id resolver. The committed \\`config.ts\\` carries no\n// ids; it resolves each id through \\`resolveId(...)\\` here, which reads the\n// build-time-injected \\`__DEVSTACK_IDS__\\` global. Run \\`devstack up\\` for\n// local dev (the Vite plugin injects the live ids), or point the build at a\n// committed id-config file for a real deployment.\n\nconst UNRESOLVED_ID =\n\t'0x0000000000000000000000000000000000000000000000000000000000000000';\n\n// Node-only runtime fallback for the on-chain ids. The browser/dev/prod\n// path injects \\`__DEVSTACK_IDS__\\` via the Vite \\`define\\` (replaced at\n// transform time); this fallback ONLY engages when that define is absent —\n// i.e. under Node/vitest, where the \\`define\\` bakes to \\`null\\` because the\n// test stack is booted by the vitest \\`globalSetup\\` AFTER the Vite config\n// (and so this module) is evaluated. The devstack vitest \\`globalSetup\\`\n// publishes the booted stack's id-config FILE path as\n// \\`process.env.DEVSTACK_IDS_FILE\\`; we read+parse it lazily here. Guarded so\n// browser bundles (no \\`process\\`, no \\`node:fs\\`) never touch it. Returns\n// \\`null\\` on any miss, so \\`ids()\\` throws its actionable error as before.\n// Minimal LOCAL shapes (no \\`@types/node\\` dependency — this file is also\n// type-checked in browser tsconfigs that don't load node types). We reach\n// \\`process\\` through \\`globalThis\\` and feature-test every member.\ninterface NodeProcessLike {\n\treadonly env?: { readonly [k: string]: string | undefined };\n\treadonly getBuiltinModule?: (id: string) => unknown;\n}\ninterface NodeFsLike {\n\treadonly existsSync: (p: string) => boolean;\n\treadonly readFileSync: (p: string, enc: 'utf8') => string;\n}\nlet nodeFallbackCache: DevstackIds | null | undefined;\nconst readNodeFallbackIds = (): DevstackIds | null => {\n\tif (nodeFallbackCache !== undefined) return nodeFallbackCache;\n\tnodeFallbackCache = null;\n\ttry {\n\t\tconst proc = (globalThis as { process?: NodeProcessLike }).process;\n\t\tif (proc === undefined) return null;\n\t\tconst idsFile = proc.env?.DEVSTACK_IDS_FILE;\n\t\tif (idsFile === undefined || idsFile.length === 0) return null;\n\t\t// \\`process.getBuiltinModule\\` (Node >=22.3) loads \\`node:fs\\`\n\t\t// synchronously without an \\`import\\`/\\`require\\` literal a browser\n\t\t// bundler would try to resolve — this whole branch is unreachable in\n\t\t// the browser (no \\`process\\`), so node:fs never enters the bundle.\n\t\tconst getBuiltin = proc.getBuiltinModule;\n\t\tif (typeof getBuiltin !== 'function') return null;\n\t\tconst fs = getBuiltin('node:fs') as NodeFsLike;\n\t\tif (!fs.existsSync(idsFile)) return null;\n\t\tnodeFallbackCache = JSON.parse(fs.readFileSync(idsFile, 'utf8')) as DevstackIds;\n\t\treturn nodeFallbackCache;\n\t} catch {\n\t\treturn null;\n\t}\n};\n\n/** The injected ids, or — under Node with no injected define — the\n * \\`DEVSTACK_IDS_FILE\\` fallback. \\`null\\` when neither is available. */\nconst injectedIds = (): DevstackIds | null => {\n\tconst injected = typeof __DEVSTACK_IDS__ === 'undefined' ? null : __DEVSTACK_IDS__;\n\tif (injected !== null && injected !== undefined) return injected;\n\treturn readNodeFallbackIds();\n};\n\n/** One network connection entry — \\`rpc\\` is the load-bearing field the app\n * reads synchronously; \\`chainId\\`/\\`faucet\\`/\\`graphql\\` are optional\n * diagnostics (mirrors \\`IdConfigNetworkSchema\\`). */\nexport interface DevstackNetworkEntry {\n\treadonly rpc: string;\n\treadonly chainId?: string;\n\treadonly faucet?: string | null;\n\treadonly graphql?: string | null;\n}\n\n/** Shape of the injected ids. \\`null\\` when no stack is running and no\n * id-config file was supplied at build time. */\nexport interface DevstackIds {\n\treadonly network: string;\n\treadonly networks: { readonly [name: string]: DevstackNetworkEntry };\n\treadonly packages: {\n\t\treadonly [name: string]: { readonly id: string; readonly objects?: { readonly [k: string]: string } };\n\t};\n\treadonly accounts: { readonly [name: string]: string };\n\treadonly mvrOverrides: { readonly [mvrPlaceholder: string]: string };\n\t/** Generic resolver channel: \\`values[namespace][key]\\` carries\n\t * arbitrary plugin JSON the typed fields above can't (deepbook pool\n\t * ids, coin types, walrus/seal endpoints). Optional — an older\n\t * injected blob (no \\`values\\`) still satisfies the typed resolvers. */\n\treadonly values?: { readonly [namespace: string]: { readonly [key: string]: unknown } };\n}\n\ndeclare global {\n\t// Injected by the devstack Vite plugin via \\`define\\`. \\`null\\` when no\n\t// ids are available (no stack up + no id-config file).\n\tconst __DEVSTACK_IDS__: DevstackIds | null | undefined;\n}\n\n/** Thrown when a generated config value needs an on-chain id but none was\n * injected — actionable, not a silent zero. */\nexport class DevstackConfigMissingError extends Error {\n\tconstructor(detail: string) {\n\t\tsuper(\n\t\t\t\\`[devstack] \\${detail}\\\\n\\` +\n\t\t\t\t\\`No on-chain ids are available. For local dev, run \\\\\\`devstack up\\\\\\` \\` +\n\t\t\t\t\\`(the Vite dev server injects the live ids). For a production build, \\` +\n\t\t\t\t\\`point the build at the known deployment's committed id-config file \\` +\n\t\t\t\t\\`(the Vite plugin \\\\\\`ids\\\\\\` option, or \\\\\\`DEVSTACK_IDS_FILE\\\\\\`) before \\` +\n\t\t\t\t\\`\\\\\\`pnpm build\\\\\\`. See your example README's \"Deploy to a real network\" \\` +\n\t\t\t\t\\`section.\\`,\n\t\t);\n\t\tthis.name = 'DevstackConfigMissingError';\n\t}\n}\n\nconst ids = (): DevstackIds => {\n\tconst injected = injectedIds();\n\tif (injected === null || injected === undefined) {\n\t\tthrow new DevstackConfigMissingError('on-chain ids were never injected');\n\t}\n\treturn injected;\n};\n\n/** Resolve the active-network id for an MVR placeholder (\\`@local/<slug>\\`).\n * Throws \\`DevstackConfigMissingError\\` when the id is absent or the\n * all-zero sentinel. */\nexport const resolveId = (mvrPlaceholder: string): string => {\n\tconst id = ids().mvrOverrides[mvrPlaceholder];\n\tif (id === undefined || id === UNRESOLVED_ID) {\n\t\tthrow new DevstackConfigMissingError(\\`id for \"\\${mvrPlaceholder}\" is unresolved\\`);\n\t}\n\treturn id;\n};\n\n/** Resolve the active network name (the \\`networks.<name>\\` key the app\n * reads). Environment/live data — the local stack picks a dynamic value\n * and a real deployment names a different network — so it is injected,\n * never baked into the committed tree. Throws when no ids were injected. */\nexport const resolveNetwork = (): string => ids().network;\n\n/** Resolve the network connection map (\\`{ [name]: DevstackNetworkEntry }\\`).\n * The local rpc carries a dynamic port; a real deployment supplies its own —\n * so this is injected, never baked. Throws when no ids were injected. */\nexport const resolveNetworks = (): { readonly [name: string]: DevstackNetworkEntry } =>\n\tids().networks;\n\n/** Resolve the ACTIVE network's connection entry —\n * \\`resolveNetworks()[resolveNetwork()]\\` with a non-undefined return type and\n * a loud throw. Removes the \\`config.networks[config.network]\\` index-signature\n * footgun: the app reads \\`.rpc\\` etc. off a guaranteed entry instead of\n * threading an \\`undefined\\` past the index lookup. Throws\n * \\`DevstackConfigMissingError\\` when no ids were injected or the active\n * network has no entry in the injected map. */\nexport const resolveActiveNetwork = (): DevstackNetworkEntry => {\n\tconst network = resolveNetwork();\n\tconst entry = resolveNetworks()[network];\n\tif (entry === undefined) {\n\t\tthrow new DevstackConfigMissingError(\\`active network \"\\${network}\" has no entry\\`);\n\t}\n\treturn entry;\n};\n\n/** Resolve a generic plugin value (\\`values[namespace][key]\\`). The committed\n * \\`config.ts\\` calls this for any live plugin value that isn't a package id\n * or the network — deepbook pool ids, coin types, walrus/seal endpoints.\n * Throws \\`DevstackConfigMissingError\\` when no ids were injected, the value\n * is missing, or it is the all-zero sentinel. */\nexport const resolveValue = <T = unknown>(namespace: string, key: string): T => {\n\tconst values = ids().values ?? {};\n\tconst namespaceValues = values[namespace];\n\tconst value = namespaceValues === undefined ? undefined : namespaceValues[key];\n\tif (value === undefined || value === UNRESOLVED_ID) {\n\t\tthrow new DevstackConfigMissingError(\n\t\t\t\\`value \"\\${namespace}.\\${key}\" is unresolved\\`,\n\t\t);\n\t}\n\treturn value as T;\n};\n\n/** Non-throwing variant of \\`resolveValue\\`: returns \\`undefined\\` instead of\n * throwing \\`DevstackConfigMissingError\\` when no ids were injected, the value\n * is missing, or it is the all-zero sentinel. For discovery-only ids the app\n * GATES on (e.g. a coin's \\`treasuryCapId\\`/\\`metadataId\\`, only known after a\n * live publish) rather than the load-bearing fields that should fail loud. */\nexport const resolveValueOptional = <T = unknown>(\n\tnamespace: string,\n\tkey: string,\n): T | undefined => {\n\tconst injected = injectedIds();\n\tconst values = injected?.values ?? {};\n\tconst namespaceValues = values[namespace];\n\tconst value = namespaceValues === undefined ? undefined : namespaceValues[key];\n\tif (value === undefined || value === UNRESOLVED_ID) {\n\t\treturn undefined;\n\t}\n\treturn value as T;\n};\n`;\n"],"mappings":";;AAmBA,MAAa,6BAA6B;;AAG1C,MAAa,wBAAwB"}
|
|
@@ -35,7 +35,7 @@ const emitOne = (input) => Effect.gen(function* () {
|
|
|
35
35
|
path: input.path,
|
|
36
36
|
outcome: "wrote"
|
|
37
37
|
};
|
|
38
|
-
})
|
|
38
|
+
});
|
|
39
39
|
/**
|
|
40
40
|
* Check the file's current mode and restore it if drifted. Returns
|
|
41
41
|
* true if a chmod was performed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emit.mjs","names":[],"sources":["../../../src/orchestrators/codegen/emit.ts"],"sourcesContent":["// File emission: per-file atomic write + idempotent no-touch.\n//\n// Distilled-doc § \"No-touch on no change\": when inputs are unchanged,\n// file mtimes do not move. This is load-bearing for dev-server HMR\n// quietness — Vite watchers fire on mtime, not content.\n//\n// Flow per file:\n// 1. Read existing file (best-effort). Decode as UTF-8 string.\n// 2. Compare to rendered content. If identical, restore mode bits\n// (defensive — distilled-doc §\"sensitive-file permission drift\")\n// and return WITHOUT touching the file.\n// 3. Otherwise atomic-write via the substrate's `atomicWriteFile`\n// primitive: tempfile + fsync + rename. Apply mode.\n//\n// Cycle-level atomicity lives in `service.ts.runEmitCycle`, which\n// wraps the entire pipeline in substrate `stageAndSwap`. `emitOne`\n// remains per-file atomic so the inner staging-directory writes\n// stay crash-safe, but the user-visible output dir is replaced as\n// one rename — a half-cycle never reaches consumers.\n\nimport { Effect, FileSystem } from 'effect';\nimport { dirname } from 'node:path';\n\nimport { atomicWriteFile } from '../../substrate/runtime/atomic-write.ts';\n\nimport { CodegenWriteFailed } from './errors.ts';\n\nexport interface EmitOneInput {\n\treadonly path: string;\n\treadonly content: string;\n\treadonly mode: number;\n\treadonly parentMode?: number;\n}\n\nexport interface EmitOneResult {\n\treadonly path: string;\n\t/** `wrote` — content was different and we atomically wrote.\n\t * `unchanged` — bytes matched, we skipped the write.\n\t * `chmod-only` — bytes matched but mode bits drifted; we\n\t * restored the mode but did not rewrite the file. */\n\treadonly outcome: 'wrote' | 'unchanged' | 'chmod-only';\n}\n\n/**\n * Emit one file with idempotency. The mode is re-applied even on\n * the no-write path to recover from manual chmods (distilled-doc\n * §\"sensitive-file permission drift\").\n */\nexport const emitOne = (\n\tinput: EmitOneInput,\n): Effect.Effect<EmitOneResult, CodegenWriteFailed, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst bytes = new TextEncoder().encode(input.content);\n\t\tif (input.parentMode !== undefined) {\n\t\t\tyield* ensureParentDirectory(input.path, input.parentMode);\n\t\t}\n\n\t\t// 1. Best-effort read of existing content for the no-touch\n\t\t// short-circuit. A missing file collapses to \"no existing\n\t\t// bytes\" → write. Any other error also collapses to write\n\t\t// (atomic-write will report the real failure).\n\t\tconst existing = yield* fs.readFileString(input.path).pipe(\n\t\t\tEffect.match({\n\t\t\t\tonSuccess: (text) => text,\n\t\t\t\tonFailure: () => null,\n\t\t\t}),\n\t\t);\n\n\t\tif (existing !== null && existing === input.content) {\n\t\t\t// Content matches — re-apply mode to fix drift, but don't\n\t\t\t// touch the file's mtime. `chmod` updates the inode's\n\t\t\t// `ctime` only.\n\t\t\tconst drifted = yield* checkAndRestoreMode(input.path, input.mode);\n\t\t\treturn {\n\t\t\t\tpath: input.path,\n\t\t\t\toutcome: drifted ? ('chmod-only' as const) : ('unchanged' as const),\n\t\t\t};\n\t\t}\n\n\t\t// 2. Bytes differ (or file missing) — atomic write. The\n\t\t// substrate's `atomicWriteFile` owns mkdir-parent +\n\t\t// tempfile + fsync + rename. Mode is applied at create\n\t\t// time via the `mode` open flag.\n\t\tyield* atomicWriteFile(input.path, bytes, {\n\t\t\tmode: input.mode,\n\t\t\t...(input.parentMode === undefined ? {} : { parentMode: input.parentMode }),\n\t\t}).pipe(\n\t\t\tEffect.mapError(\n\t\t\t\t(cause) =>\n\t\t\t\t\tnew CodegenWriteFailed({\n\t\t\t\t\t\toutputPath: input.path,\n\t\t\t\t\t\tstage: cause.stage === 'mkdir-parent' ? 'mkdir-parent' : 'write',\n\t\t\t\t\t\tcause,\n\t\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t\treturn { path: input.path, outcome: 'wrote' as const };\n\t})
|
|
1
|
+
{"version":3,"file":"emit.mjs","names":[],"sources":["../../../src/orchestrators/codegen/emit.ts"],"sourcesContent":["// File emission: per-file atomic write + idempotent no-touch.\n//\n// Distilled-doc § \"No-touch on no change\": when inputs are unchanged,\n// file mtimes do not move. This is load-bearing for dev-server HMR\n// quietness — Vite watchers fire on mtime, not content.\n//\n// Flow per file:\n// 1. Read existing file (best-effort). Decode as UTF-8 string.\n// 2. Compare to rendered content. If identical, restore mode bits\n// (defensive — distilled-doc §\"sensitive-file permission drift\")\n// and return WITHOUT touching the file.\n// 3. Otherwise atomic-write via the substrate's `atomicWriteFile`\n// primitive: tempfile + fsync + rename. Apply mode.\n//\n// Cycle-level atomicity lives in `service.ts.runEmitCycle`, which\n// wraps the entire pipeline in substrate `stageAndSwap`. `emitOne`\n// remains per-file atomic so the inner staging-directory writes\n// stay crash-safe, but the user-visible output dir is replaced as\n// one rename — a half-cycle never reaches consumers.\n\nimport { Effect, FileSystem } from 'effect';\nimport { dirname } from 'node:path';\n\nimport { atomicWriteFile } from '../../substrate/runtime/atomic-write.ts';\n\nimport { CodegenWriteFailed } from './errors.ts';\n\nexport interface EmitOneInput {\n\treadonly path: string;\n\treadonly content: string;\n\treadonly mode: number;\n\treadonly parentMode?: number;\n}\n\nexport interface EmitOneResult {\n\treadonly path: string;\n\t/** `wrote` — content was different and we atomically wrote.\n\t * `unchanged` — bytes matched, we skipped the write.\n\t * `chmod-only` — bytes matched but mode bits drifted; we\n\t * restored the mode but did not rewrite the file. */\n\treadonly outcome: 'wrote' | 'unchanged' | 'chmod-only';\n}\n\n/**\n * Emit one file with idempotency. The mode is re-applied even on\n * the no-write path to recover from manual chmods (distilled-doc\n * §\"sensitive-file permission drift\").\n */\nexport const emitOne = (\n\tinput: EmitOneInput,\n): Effect.Effect<EmitOneResult, CodegenWriteFailed, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst bytes = new TextEncoder().encode(input.content);\n\t\tif (input.parentMode !== undefined) {\n\t\t\tyield* ensureParentDirectory(input.path, input.parentMode);\n\t\t}\n\n\t\t// 1. Best-effort read of existing content for the no-touch\n\t\t// short-circuit. A missing file collapses to \"no existing\n\t\t// bytes\" → write. Any other error also collapses to write\n\t\t// (atomic-write will report the real failure).\n\t\tconst existing = yield* fs.readFileString(input.path).pipe(\n\t\t\tEffect.match({\n\t\t\t\tonSuccess: (text) => text,\n\t\t\t\tonFailure: () => null,\n\t\t\t}),\n\t\t);\n\n\t\tif (existing !== null && existing === input.content) {\n\t\t\t// Content matches — re-apply mode to fix drift, but don't\n\t\t\t// touch the file's mtime. `chmod` updates the inode's\n\t\t\t// `ctime` only.\n\t\t\tconst drifted = yield* checkAndRestoreMode(input.path, input.mode);\n\t\t\treturn {\n\t\t\t\tpath: input.path,\n\t\t\t\toutcome: drifted ? ('chmod-only' as const) : ('unchanged' as const),\n\t\t\t};\n\t\t}\n\n\t\t// 2. Bytes differ (or file missing) — atomic write. The\n\t\t// substrate's `atomicWriteFile` owns mkdir-parent +\n\t\t// tempfile + fsync + rename. Mode is applied at create\n\t\t// time via the `mode` open flag.\n\t\tyield* atomicWriteFile(input.path, bytes, {\n\t\t\tmode: input.mode,\n\t\t\t...(input.parentMode === undefined ? {} : { parentMode: input.parentMode }),\n\t\t}).pipe(\n\t\t\tEffect.mapError(\n\t\t\t\t(cause) =>\n\t\t\t\t\tnew CodegenWriteFailed({\n\t\t\t\t\t\toutputPath: input.path,\n\t\t\t\t\t\tstage: cause.stage === 'mkdir-parent' ? 'mkdir-parent' : 'write',\n\t\t\t\t\t\tcause,\n\t\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t\treturn { path: input.path, outcome: 'wrote' as const };\n\t});\n\n/**\n * Check the file's current mode and restore it if drifted. Returns\n * true if a chmod was performed.\n */\nconst checkAndRestoreMode = (\n\tpath: string,\n\twantedMode: number,\n): Effect.Effect<boolean, CodegenWriteFailed, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst stat = yield* fs.stat(path).pipe(\n\t\t\tEffect.match({\n\t\t\t\tonSuccess: (s) => s,\n\t\t\t\tonFailure: () => null,\n\t\t\t}),\n\t\t);\n\t\tif (stat === null) return false;\n\t\t// `stat.mode` is the full mode bits; mask to file-perm\n\t\t// bits (lowest 12 — incl. setuid/setgid/sticky).\n\t\tconst currentPermBits = stat.mode & 0o7777;\n\t\tif (currentPermBits === wantedMode) return false;\n\t\tyield* fs.chmod(path, wantedMode).pipe(\n\t\t\tEffect.mapError(\n\t\t\t\t(cause) =>\n\t\t\t\t\tnew CodegenWriteFailed({\n\t\t\t\t\t\toutputPath: path,\n\t\t\t\t\t\tstage: 'chmod',\n\t\t\t\t\t\tcause,\n\t\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t\treturn true;\n\t});\n\nconst ensureParentDirectory = (\n\tpath: string,\n\tparentMode: number,\n): Effect.Effect<void, CodegenWriteFailed, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst parent = dirname(path);\n\t\tyield* fs.makeDirectory(parent, { recursive: true, mode: parentMode }).pipe(\n\t\t\tEffect.mapError(\n\t\t\t\t(cause) =>\n\t\t\t\t\tnew CodegenWriteFailed({\n\t\t\t\t\t\toutputPath: parent,\n\t\t\t\t\t\tstage: 'mkdir-parent',\n\t\t\t\t\t\tcause,\n\t\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t\tyield* checkAndRestoreMode(parent, parentMode).pipe(Effect.asVoid);\n\t});\n"],"mappings":";;;;;;;;;;AAgDA,MAAa,WACZ,UAEA,OAAO,IAAI,aAAa;CACvB,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,QAAQ,IAAI,YAAY,CAAC,CAAC,OAAO,MAAM,OAAO;CACpD,IAAI,MAAM,eAAe,KAAA,GACxB,OAAO,sBAAsB,MAAM,MAAM,MAAM,UAAU;CAO1D,MAAM,WAAW,OAAO,GAAG,eAAe,MAAM,IAAI,CAAC,CAAC,KACrD,OAAO,MAAM;EACZ,YAAY,SAAS;EACrB,iBAAiB;CAClB,CAAC,CACF;CAEA,IAAI,aAAa,QAAQ,aAAa,MAAM,SAAS;EAIpD,MAAM,UAAU,OAAO,oBAAoB,MAAM,MAAM,MAAM,IAAI;EACjE,OAAO;GACN,MAAM,MAAM;GACZ,SAAS,UAAW,eAA0B;EAC/C;CACD;CAMA,OAAO,gBAAgB,MAAM,MAAM,OAAO;EACzC,MAAM,MAAM;EACZ,GAAI,MAAM,eAAe,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,MAAM,WAAW;CAC1E,CAAC,CAAC,CAAC,KACF,OAAO,UACL,UACA,IAAI,mBAAmB;EACtB,YAAY,MAAM;EAClB,OAAO,MAAM,UAAU,iBAAiB,iBAAiB;EACzD;CACD,CAAC,CACH,CACD;CACA,OAAO;EAAE,MAAM,MAAM;EAAM,SAAS;CAAiB;AACtD,CAAC;;;;;AAMF,MAAM,uBACL,MACA,eAEA,OAAO,IAAI,aAAa;CACvB,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,KACjC,OAAO,MAAM;EACZ,YAAY,MAAM;EAClB,iBAAiB;CAClB,CAAC,CACF;CACA,IAAI,SAAS,MAAM,OAAO;CAI1B,KADwB,KAAK,OAAO,UACZ,YAAY,OAAO;CAC3C,OAAO,GAAG,MAAM,MAAM,UAAU,CAAC,CAAC,KACjC,OAAO,UACL,UACA,IAAI,mBAAmB;EACtB,YAAY;EACZ,OAAO;EACP;CACD,CAAC,CACH,CACD;CACA,OAAO;AACR,CAAC;AAEF,MAAM,yBACL,MACA,eAEA,OAAO,IAAI,aAAa;CACvB,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,SAAS,QAAQ,IAAI;CAC3B,OAAO,GAAG,cAAc,QAAQ;EAAE,WAAW;EAAM,MAAM;CAAW,CAAC,CAAC,CAAC,KACtE,OAAO,UACL,UACA,IAAI,mBAAmB;EACtB,YAAY;EACZ,OAAO;EACP;CACD,CAAC,CACH,CACD;CACA,OAAO,oBAAoB,QAAQ,UAAU,CAAC,CAAC,KAAK,OAAO,MAAM;AAClE,CAAC"}
|
|
@@ -20,6 +20,26 @@ var CodegenEmitterCollision = class extends Schema.TaggedErrorClass()("CodegenEm
|
|
|
20
20
|
emitterName: Schema.String,
|
|
21
21
|
outputPaths: Schema.Array(Schema.String)
|
|
22
22
|
}) {};
|
|
23
|
+
/** Two `Codegenable` contributions target the SAME aggregate
|
|
24
|
+
* `bucket` but disagree on its routing/sensitivity metadata
|
|
25
|
+
* (`outputLocation` or `sensitive`). The `AggregateContribution`
|
|
26
|
+
* contract requires all contributors to a bucket to agree; the
|
|
27
|
+
* orchestrator routes the synthesized aggregate from the FIRST
|
|
28
|
+
* contributor it sees, so a silent disagreement could misroute a
|
|
29
|
+
* sensitive aggregate into the committed `generated` tree. Detected
|
|
30
|
+
* while folding contributions so the cycle fails fast rather than
|
|
31
|
+
* emitting a secret with non-sensitive handling. */
|
|
32
|
+
var CodegenAggregateConflict = class extends Schema.TaggedErrorClass()("CodegenAggregateConflict", {
|
|
33
|
+
bucket: Schema.String,
|
|
34
|
+
field: Schema.Literals(["outputLocation", "sensitive"]),
|
|
35
|
+
/** The value the first contributor established for the bucket. */
|
|
36
|
+
established: Schema.String,
|
|
37
|
+
/** The conflicting value a later contributor declared. */
|
|
38
|
+
conflicting: Schema.String,
|
|
39
|
+
/** Emitter names: the contributor that established the value and
|
|
40
|
+
* the one that disagreed. */
|
|
41
|
+
emitters: Schema.Array(Schema.String)
|
|
42
|
+
}) {};
|
|
23
43
|
/** A `Codegenable.emit()` wrote a value that the renderer cannot
|
|
24
44
|
* serialise (a function, a symbol, a circular reference, etc.). */
|
|
25
45
|
var CodegenRenderError = class extends Schema.TaggedErrorClass()("CodegenRenderError", {
|
|
@@ -66,6 +86,6 @@ var CodegenBindingsFailed = class extends Schema.TaggedErrorClass()("CodegenBind
|
|
|
66
86
|
}) {};
|
|
67
87
|
Schema.TaggedErrorClass()("CodegenManifestDrift", { detail: Schema.String });
|
|
68
88
|
//#endregion
|
|
69
|
-
export { CodegenBindingsFailed, CodegenEmitFailed, CodegenEmitterCollision, CodegenPathConflict, CodegenRenderError, CodegenWriteFailed };
|
|
89
|
+
export { CodegenAggregateConflict, CodegenBindingsFailed, CodegenEmitFailed, CodegenEmitterCollision, CodegenPathConflict, CodegenRenderError, CodegenWriteFailed };
|
|
70
90
|
|
|
71
91
|
//# sourceMappingURL=errors.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/orchestrators/codegen/errors.ts"],"sourcesContent":["// Typed errors for the Codegen orchestrator.\n//\n//
|
|
1
|
+
{"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/orchestrators/codegen/errors.ts"],"sourcesContent":["// Typed errors for the Codegen orchestrator.\n//\n// A phase-tagged failure-mode taxonomy: \"emitter-collision at acquire\",\n// \"binary shell-out failure\", and \"pure render failure\" each get a\n// separate tag so callers can `catchTag` on each.\n//\n// Phase tags inside each error name the lifecycle step that failed\n// (resolve → emit → render → write → bindings → finalize) so error\n// attribution stays accurate.\n\nimport { Schema } from 'effect';\n\n/** Path-layer rejection from the codegen orchestrator.\n * - `kind: 'duplicate'` — two `Codegenable` contributions claim the\n * same `outputPath`. Hard failure detected BEFORE write so the\n * user-visible output dir never sees an ambiguous overwrite.\n * - `kind: 'non-relative'` — a plugin-authored `outputPath` escapes\n * the codegen root (contains `..` or is absolute). Defense-in-depth\n * for the file-layout invariants. */\nexport class CodegenPathConflict extends Schema.TaggedErrorClass<CodegenPathConflict>()(\n\t'CodegenPathConflict',\n\t{\n\t\tkind: Schema.Literals(['duplicate', 'non-relative']),\n\t\toutputPath: Schema.String,\n\t\temitters: Schema.Array(Schema.String),\n\t},\n) {}\n\n/** Two `Codegenable` contributions share the SAME `emitterName`\n * literal but resolve to different `outputPath`s — programming\n * bug in plugin code (emitter name should be unique). Distinct\n * from `CodegenPathConflict` so attribution stays clean. */\nexport class CodegenEmitterCollision extends Schema.TaggedErrorClass<CodegenEmitterCollision>()(\n\t'CodegenEmitterCollision',\n\t{\n\t\temitterName: Schema.String,\n\t\toutputPaths: Schema.Array(Schema.String),\n\t},\n) {}\n\n/** Two `Codegenable` contributions target the SAME aggregate\n * `bucket` but disagree on its routing/sensitivity metadata\n * (`outputLocation` or `sensitive`). The `AggregateContribution`\n * contract requires all contributors to a bucket to agree; the\n * orchestrator routes the synthesized aggregate from the FIRST\n * contributor it sees, so a silent disagreement could misroute a\n * sensitive aggregate into the committed `generated` tree. Detected\n * while folding contributions so the cycle fails fast rather than\n * emitting a secret with non-sensitive handling. */\nexport class CodegenAggregateConflict extends Schema.TaggedErrorClass<CodegenAggregateConflict>()(\n\t'CodegenAggregateConflict',\n\t{\n\t\tbucket: Schema.String,\n\t\tfield: Schema.Literals(['outputLocation', 'sensitive']),\n\t\t/** The value the first contributor established for the bucket. */\n\t\testablished: Schema.String,\n\t\t/** The conflicting value a later contributor declared. */\n\t\tconflicting: Schema.String,\n\t\t/** Emitter names: the contributor that established the value and\n\t\t * the one that disagreed. */\n\t\temitters: Schema.Array(Schema.String),\n\t},\n) {}\n\n/** A `Codegenable.emit()` wrote a value that the renderer cannot\n * serialise (a function, a symbol, a circular reference, etc.). */\nexport class CodegenRenderError extends Schema.TaggedErrorClass<CodegenRenderError>()(\n\t'CodegenRenderError',\n\t{\n\t\temitterName: Schema.String,\n\t\toutputPath: Schema.String,\n\t\tdetail: Schema.String,\n\t\tcause: Schema.optional(Schema.Defect),\n\t},\n) {}\n\n/** `Codegenable.emit()` raised. Wraps the inner Effect failure\n * rather than propagating it raw so the orchestrator's error\n * channel stays closed. */\nexport class CodegenEmitFailed extends Schema.TaggedErrorClass<CodegenEmitFailed>()(\n\t'CodegenEmitFailed',\n\t{\n\t\temitterName: Schema.String,\n\t\toutputPath: Schema.String,\n\t\tcause: Schema.optional(Schema.Defect),\n\t},\n) {}\n\n/** Disk write (atomic-write or permission-tighten) failed. */\nexport class CodegenWriteFailed extends Schema.TaggedErrorClass<CodegenWriteFailed>()(\n\t'CodegenWriteFailed',\n\t{\n\t\toutputPath: Schema.String,\n\t\tstage: Schema.Literals(['mkdir-parent', 'write', 'rename', 'chmod', 'gitignore']),\n\t\tcause: Schema.optional(Schema.Defect),\n\t},\n) {}\n\n/** `@mysten/codegen` shell-out (Move-to-TS bindings) failed or\n * silently no-op'd. Distilled-doc § \"Silent no-op from a\n * downstream tool is a failure\" — we surface a hint about the\n * common `Move.toml` cause. */\nexport class CodegenBindingsFailed extends Schema.TaggedErrorClass<CodegenBindingsFailed>()(\n\t'CodegenBindingsFailed',\n\t{\n\t\tpackage: Schema.String,\n\t\tsourcePath: Schema.String,\n\t\treason: Schema.Literals(['summary-failed', 'no-output', 'render-failed', 'write-failed']),\n\t\thint: Schema.optional(Schema.String),\n\t\tcause: Schema.optional(Schema.Defect),\n\t},\n) {}\n\n/** The reader of the manifest envelope detected drift between\n * what plugins contributed and what's on disk — e.g. a stale\n * envelope from a previous stack lifecycle. */\nexport class CodegenManifestDrift extends Schema.TaggedErrorClass<CodegenManifestDrift>()(\n\t'CodegenManifestDrift',\n\t{\n\t\tdetail: Schema.String,\n\t},\n) {}\n\nexport type CodegenError =\n\t| CodegenPathConflict\n\t| CodegenEmitterCollision\n\t| CodegenAggregateConflict\n\t| CodegenRenderError\n\t| CodegenEmitFailed\n\t| CodegenWriteFailed\n\t| CodegenBindingsFailed\n\t| CodegenManifestDrift;\n"],"mappings":";;;;;;;;;AAmBA,IAAa,sBAAb,cAAyC,OAAO,iBAAsC,CAAC,CACtF,uBACA;CACC,MAAM,OAAO,SAAS,CAAC,aAAa,cAAc,CAAC;CACnD,YAAY,OAAO;CACnB,UAAU,OAAO,MAAM,OAAO,MAAM;AACrC,CACD,CAAC,CAAC,CAAC;;;;;AAMH,IAAa,0BAAb,cAA6C,OAAO,iBAA0C,CAAC,CAC9F,2BACA;CACC,aAAa,OAAO;CACpB,aAAa,OAAO,MAAM,OAAO,MAAM;AACxC,CACD,CAAC,CAAC,CAAC;;;;;;;;;;AAWH,IAAa,2BAAb,cAA8C,OAAO,iBAA2C,CAAC,CAChG,4BACA;CACC,QAAQ,OAAO;CACf,OAAO,OAAO,SAAS,CAAC,kBAAkB,WAAW,CAAC;;CAEtD,aAAa,OAAO;;CAEpB,aAAa,OAAO;;;CAGpB,UAAU,OAAO,MAAM,OAAO,MAAM;AACrC,CACD,CAAC,CAAC,CAAC;;;AAIH,IAAa,qBAAb,cAAwC,OAAO,iBAAqC,CAAC,CACpF,sBACA;CACC,aAAa,OAAO;CACpB,YAAY,OAAO;CACnB,QAAQ,OAAO;CACf,OAAO,OAAO,SAAS,OAAO,MAAM;AACrC,CACD,CAAC,CAAC,CAAC;;;;AAKH,IAAa,oBAAb,cAAuC,OAAO,iBAAoC,CAAC,CAClF,qBACA;CACC,aAAa,OAAO;CACpB,YAAY,OAAO;CACnB,OAAO,OAAO,SAAS,OAAO,MAAM;AACrC,CACD,CAAC,CAAC,CAAC;;AAGH,IAAa,qBAAb,cAAwC,OAAO,iBAAqC,CAAC,CACpF,sBACA;CACC,YAAY,OAAO;CACnB,OAAO,OAAO,SAAS;EAAC;EAAgB;EAAS;EAAU;EAAS;CAAW,CAAC;CAChF,OAAO,OAAO,SAAS,OAAO,MAAM;AACrC,CACD,CAAC,CAAC,CAAC;;;;;AAMH,IAAa,wBAAb,cAA2C,OAAO,iBAAwC,CAAC,CAC1F,yBACA;CACC,SAAS,OAAO;CAChB,YAAY,OAAO;CACnB,QAAQ,OAAO,SAAS;EAAC;EAAkB;EAAa;EAAiB;CAAc,CAAC;CACxF,MAAM,OAAO,SAAS,OAAO,MAAM;CACnC,OAAO,OAAO,SAAS,OAAO,MAAM;AACrC,CACD,CAAC,CAAC,CAAC;AAKuC,OAAO,iBAAuC,CAAC,CACxF,wBACA,EACC,QAAQ,OAAO,OAChB,CACD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CodegenRenderError } from "./errors.mjs";
|
|
2
|
+
import { isRawExpr } from "../../contracts/codegenable.mjs";
|
|
2
3
|
//#region src/orchestrators/codegen/format.ts
|
|
3
4
|
const GENERATED_HEADER = [
|
|
4
5
|
"// THIS FILE IS AUTO-GENERATED BY @mysten/devstack.",
|
|
@@ -65,6 +66,7 @@ const tryErr = (detail) => ({
|
|
|
65
66
|
const tryRender = (value, seen, depth = 1) => {
|
|
66
67
|
if (value === null) return tryOk("null");
|
|
67
68
|
if (value === void 0) return tryErr("undefined is not serialisable — emit null instead");
|
|
69
|
+
if (isRawExpr(value)) return tryOk(value.expr);
|
|
68
70
|
const t = typeof value;
|
|
69
71
|
if (t === "string") return tryOk(JSON.stringify(value));
|
|
70
72
|
if (t === "number") {
|