@mysten-incubation/devstack 0.1.0 → 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 +7 -4
- 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 -31
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.mjs","names":[],"sources":["../../../src/orchestrators/codegen/format.ts"],"sourcesContent":["// TypeScript source rendering for codegen-emitted files.\n//\n// Distilled-doc § \"Hand-rolled TS-object-literal rendering ... drifts\n// subtly between emitters; a small shared renderer would absorb the\n// variation and own the bigint policy in one place.\" This module IS\n// that shared renderer.\n//\n// Output shape (one emitted file):\n//\n// <generated-header>\n// <do-not-commit-banner if sensitive>\n// <imports?>\n// <one `export const <name> = <literal> as const;` per export>\n// <trailing newline>\n//\n// The renderer:\n// - sorts object keys (deterministic re-emit, distilled-doc\n// invariant \"Deterministic re-emit\"),\n// - quotes identifier-unsafe keys with double-quoted strings,\n// - serialises bigints as quoted decimal strings for\n// `BigInt(<string>)` consumers,\n// - refuses functions / symbols / undefined / circular refs with a\n// typed render error,\n// - emits arrays and records as readonly literal forms.\n//\n// The renderer does NOT format with prettier; it aims for\n// prettier-compatible spacing (two-space indent, trailing commas,\n// double-quoted strings, semicolons) so a prettier-on-write user\n// hook is a no-op on emitted bytes — that's load-bearing for the\n// \"no mtime touch on identical content\" idempotency invariant.\n\nimport { CodegenRenderError } from './errors.ts';\n\n// -----------------------------------------------------------------------------\n// Headers\n// -----------------------------------------------------------------------------\n\nconst GENERATED_HEADER = [\n\t'// THIS FILE IS AUTO-GENERATED BY @mysten/devstack.',\n\t'// Do not edit by hand — your changes will be overwritten on the next',\n\t'// `devstack up` cycle. Apps consume codegen output; codegen output never',\n\t'// imports from devstack.',\n].join('\\n');\n\nconst SENSITIVE_HEADER = [\n\t'// !!! DO NOT COMMIT THIS FILE !!!',\n\t'// This file carries sensitive material (wallet pair token, database',\n\t'// credentials, or user extras). The output directory ships a .gitignore',\n\t'// covering it; this banner is a belt-and-braces reminder.',\n].join('\\n');\n\n// -----------------------------------------------------------------------------\n// Public render entry\n// -----------------------------------------------------------------------------\n\nexport interface RenderInput {\n\treadonly emitterName: string;\n\treadonly outputPath: string;\n\treadonly sensitive: boolean;\n\t/** The declarations written by `Codegenable.emit(ctx)`. Each entry\n\t * becomes one `export const <key> = <literal> as const;`. */\n\treadonly exports: { readonly [key: string]: unknown };\n\t/** Optional import lines the emitter wants prepended (e.g. a\n\t * type import from `@mysten/dapp-kit` for the wallet config).\n\t * Each entry is a raw import statement string. */\n\treadonly imports?: ReadonlyArray<string>;\n}\n\n/** Result of a render attempt. Discriminated so callers can dispatch\n * on `ok` without resorting to `instanceof` checks (STYLE_GUIDE §2). */\nexport type RenderResult =\n\t| { readonly ok: true; readonly text: string }\n\t| { readonly ok: false; readonly error: CodegenRenderError };\n\nconst renderErr = (\n\tinput: RenderInput,\n\tdetail: string,\n): { readonly ok: false; readonly error: CodegenRenderError } => ({\n\tok: false,\n\terror: new CodegenRenderError({\n\t\temitterName: input.emitterName,\n\t\toutputPath: input.outputPath,\n\t\tdetail,\n\t}),\n});\n\n/** Render an emitted file to a TS source string. Returns a discriminated\n * `RenderResult` — `{ok: true, text}` on success, `{ok: false, error}`\n * when the value is unserialisable or imports forbidden paths. */\nexport const renderFile = (input: RenderInput): RenderResult => {\n\tconst lines: Array<string> = [];\n\tlines.push(GENERATED_HEADER);\n\tif (input.sensitive) {\n\t\tlines.push('');\n\t\tlines.push(SENSITIVE_HEADER);\n\t}\n\tlines.push('');\n\tif (input.imports && input.imports.length > 0) {\n\t\tfor (const imp of input.imports) {\n\t\t\tif (isForbiddenGeneratedImport(imp)) {\n\t\t\t\treturn renderErr(input, `generated files must not import devstack source: ${imp}`);\n\t\t\t}\n\t\t\tlines.push(imp);\n\t\t}\n\t\tlines.push('');\n\t}\n\t// Stable export order: keys lexicographically sorted.\n\tconst keys = Object.keys(input.exports).sort();\n\tfor (const key of keys) {\n\t\tconst value = input.exports[key];\n\t\tconst rendered = tryRender(value, new Set());\n\t\tif (!rendered.ok) {\n\t\t\treturn renderErr(input, `export '${key}': ${rendered.detail}`);\n\t\t}\n\t\tif (!isIdentifier(key)) {\n\t\t\treturn renderErr(input, `export key '${key}' is not a valid TS identifier`);\n\t\t}\n\t\tlines.push(`export const ${key} = ${rendered.text} as const;`);\n\t\tlines.push('');\n\t}\n\t// Single trailing newline; never two.\n\twhile (lines.length > 1 && lines[lines.length - 1] === '' && lines[lines.length - 2] === '') {\n\t\tlines.pop();\n\t}\n\treturn {\n\t\tok: true,\n\t\ttext: lines.join('\\n') + (lines[lines.length - 1] === '' ? '' : '\\n'),\n\t};\n};\n\n// -----------------------------------------------------------------------------\n// Value rendering\n// -----------------------------------------------------------------------------\n\nconst INDENT = '\\t';\n\ntype TryRenderResult =\n\t| { readonly ok: true; readonly text: string }\n\t| { readonly ok: false; readonly detail: string };\n\nconst tryOk = (text: string): TryRenderResult => ({ ok: true, text });\nconst tryErr = (detail: string): TryRenderResult => ({ ok: false, detail });\n\nconst tryRender = (value: unknown, seen: Set<object>, depth = 1): TryRenderResult => {\n\tif (value === null) return tryOk('null');\n\tif (value === undefined) return tryErr('undefined is not serialisable — emit null instead');\n\tconst t = typeof value;\n\tif (t === 'string') return tryOk(JSON.stringify(value));\n\tif (t === 'number') {\n\t\tif (!Number.isFinite(value as number)) return tryErr('non-finite number');\n\t\treturn tryOk(String(value));\n\t}\n\tif (t === 'boolean') return tryOk(String(value));\n\tif (t === 'bigint') return tryOk(JSON.stringify(value.toString()));\n\tif (t === 'function' || t === 'symbol') return tryErr(`${t} is not serialisable`);\n\tif (Array.isArray(value)) {\n\t\tif (seen.has(value)) return tryErr('circular reference');\n\t\tseen.add(value);\n\t\tif (value.length === 0) return tryOk('[]');\n\t\tconst inner: Array<string> = [];\n\t\tfor (const item of value) {\n\t\t\tconst r = tryRender(item, seen, depth + 1);\n\t\t\tif (!r.ok) return r;\n\t\t\tinner.push(INDENT.repeat(depth) + r.text);\n\t\t}\n\t\tseen.delete(value);\n\t\treturn tryOk(`[\\n${inner.join(',\\n')},\\n${INDENT.repeat(depth - 1)}]`);\n\t}\n\tif (t === 'object') {\n\t\tconst obj = value as Record<string, unknown>;\n\t\tif (seen.has(obj)) return tryErr('circular reference');\n\t\tseen.add(obj);\n\t\tconst keys = Object.keys(obj).sort();\n\t\tif (keys.length === 0) return tryOk('{}');\n\t\tconst lines: Array<string> = [];\n\t\tfor (const k of keys) {\n\t\t\tconst v = obj[k];\n\t\t\tif (v === undefined) continue; // drop undefined props (distilled-doc skip-emit-explicit)\n\t\t\tconst r = tryRender(v, seen, depth + 1);\n\t\t\tif (!r.ok) return r;\n\t\t\tconst keyText = isIdentifier(k) ? k : JSON.stringify(k);\n\t\t\tlines.push(`${INDENT.repeat(depth)}${keyText}: ${r.text}`);\n\t\t}\n\t\tseen.delete(obj);\n\t\tif (lines.length === 0) return tryOk('{}');\n\t\treturn tryOk(`{\\n${lines.join(',\\n')},\\n${INDENT.repeat(depth - 1)}}`);\n\t}\n\treturn tryErr(`unsupported value type ${t}`);\n};\n\nconst IDENT_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;\nconst isIdentifier = (s: string): boolean => IDENT_RE.test(s);\n\nconst isForbiddenGeneratedImport = (line: string): boolean =>\n\t/\\bfrom\\s+[\"']@mysten-incubation\\/devstack(?:-rewrite)?(?:\\/|[\"'])/.test(line) ||\n\t/\\bimport\\s*\\(\\s*[\"']@mysten-incubation\\/devstack(?:-rewrite)?(?:\\/|[\"'])/.test(line) ||\n\t/\\bfrom\\s+[\"'][./][^\"']*\\/src\\//.test(line) ||\n\t/\\bimport\\s*\\(\\s*[\"'][./][^\"']*\\/src\\//.test(line);\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"format.mjs","names":[],"sources":["../../../src/orchestrators/codegen/format.ts"],"sourcesContent":["// TypeScript source rendering for codegen-emitted files.\n//\n// Distilled-doc § \"Hand-rolled TS-object-literal rendering ... drifts\n// subtly between emitters; a small shared renderer would absorb the\n// variation and own the bigint policy in one place.\" This module IS\n// that shared renderer.\n//\n// Output shape (one emitted file):\n//\n// <generated-header>\n// <do-not-commit-banner if sensitive>\n// <imports?>\n// <one `export const <name> = <literal> as const;` per export>\n// <trailing newline>\n//\n// The renderer:\n// - sorts object keys (deterministic re-emit, distilled-doc\n// invariant \"Deterministic re-emit\"),\n// - quotes identifier-unsafe keys with double-quoted strings,\n// - serialises bigints as quoted decimal strings for\n// `BigInt(<string>)` consumers,\n// - refuses functions / symbols / undefined / circular refs with a\n// typed render error,\n// - emits arrays and records as readonly literal forms.\n//\n// The renderer does NOT format with prettier; it aims for\n// prettier-compatible spacing (two-space indent, trailing commas,\n// double-quoted strings, semicolons) so a prettier-on-write user\n// hook is a no-op on emitted bytes — that's load-bearing for the\n// \"no mtime touch on identical content\" idempotency invariant.\n\nimport { isRawExpr } from '../../contracts/codegenable.ts';\n\nimport { CodegenRenderError } from './errors.ts';\n\n// -----------------------------------------------------------------------------\n// Headers\n// -----------------------------------------------------------------------------\n\nconst GENERATED_HEADER = [\n\t'// THIS FILE IS AUTO-GENERATED BY @mysten/devstack.',\n\t'// Do not edit by hand — your changes will be overwritten on the next',\n\t'// `devstack up` cycle. Apps consume codegen output; codegen output never',\n\t'// imports from devstack.',\n].join('\\n');\n\nconst SENSITIVE_HEADER = [\n\t'// !!! DO NOT COMMIT THIS FILE !!!',\n\t'// This file carries sensitive material (wallet pair token, database',\n\t'// credentials, or user extras). The output directory ships a .gitignore',\n\t'// covering it; this banner is a belt-and-braces reminder.',\n].join('\\n');\n\n// -----------------------------------------------------------------------------\n// Public render entry\n// -----------------------------------------------------------------------------\n\nexport interface RenderInput {\n\treadonly emitterName: string;\n\treadonly outputPath: string;\n\treadonly sensitive: boolean;\n\t/** The declarations written by `Codegenable.emit(ctx)`. Each entry\n\t * becomes one `export const <key> = <literal> as const;`. */\n\treadonly exports: { readonly [key: string]: unknown };\n\t/** Optional import lines the emitter wants prepended (e.g. a\n\t * type import from `@mysten/dapp-kit` for the wallet config).\n\t * Each entry is a raw import statement string. */\n\treadonly imports?: ReadonlyArray<string>;\n}\n\n/** Result of a render attempt. Discriminated so callers can dispatch\n * on `ok` without resorting to `instanceof` checks (STYLE_GUIDE §2). */\nexport type RenderResult =\n\t| { readonly ok: true; readonly text: string }\n\t| { readonly ok: false; readonly error: CodegenRenderError };\n\nconst renderErr = (\n\tinput: RenderInput,\n\tdetail: string,\n): { readonly ok: false; readonly error: CodegenRenderError } => ({\n\tok: false,\n\terror: new CodegenRenderError({\n\t\temitterName: input.emitterName,\n\t\toutputPath: input.outputPath,\n\t\tdetail,\n\t}),\n});\n\n/** Render an emitted file to a TS source string. Returns a discriminated\n * `RenderResult` — `{ok: true, text}` on success, `{ok: false, error}`\n * when the value is unserialisable or imports forbidden paths. */\nexport const renderFile = (input: RenderInput): RenderResult => {\n\tconst lines: Array<string> = [];\n\tlines.push(GENERATED_HEADER);\n\tif (input.sensitive) {\n\t\tlines.push('');\n\t\tlines.push(SENSITIVE_HEADER);\n\t}\n\tlines.push('');\n\tif (input.imports && input.imports.length > 0) {\n\t\tfor (const imp of input.imports) {\n\t\t\tif (isForbiddenGeneratedImport(imp)) {\n\t\t\t\treturn renderErr(input, `generated files must not import devstack source: ${imp}`);\n\t\t\t}\n\t\t\tlines.push(imp);\n\t\t}\n\t\tlines.push('');\n\t}\n\t// Stable export order: keys lexicographically sorted.\n\tconst keys = Object.keys(input.exports).sort();\n\tfor (const key of keys) {\n\t\tconst value = input.exports[key];\n\t\tconst rendered = tryRender(value, new Set());\n\t\tif (!rendered.ok) {\n\t\t\treturn renderErr(input, `export '${key}': ${rendered.detail}`);\n\t\t}\n\t\tif (!isIdentifier(key)) {\n\t\t\treturn renderErr(input, `export key '${key}' is not a valid TS identifier`);\n\t\t}\n\t\tlines.push(`export const ${key} = ${rendered.text} as const;`);\n\t\tlines.push('');\n\t}\n\t// Single trailing newline; never two.\n\twhile (lines.length > 1 && lines[lines.length - 1] === '' && lines[lines.length - 2] === '') {\n\t\tlines.pop();\n\t}\n\treturn {\n\t\tok: true,\n\t\ttext: lines.join('\\n') + (lines[lines.length - 1] === '' ? '' : '\\n'),\n\t};\n};\n\n// -----------------------------------------------------------------------------\n// Value rendering\n// -----------------------------------------------------------------------------\n\nconst INDENT = '\\t';\n\ntype TryRenderResult =\n\t| { readonly ok: true; readonly text: string }\n\t| { readonly ok: false; readonly detail: string };\n\nconst tryOk = (text: string): TryRenderResult => ({ ok: true, text });\nconst tryErr = (detail: string): TryRenderResult => ({ ok: false, detail });\n\nconst tryRender = (value: unknown, seen: Set<object>, depth = 1): TryRenderResult => {\n\tif (value === null) return tryOk('null');\n\tif (value === undefined) return tryErr('undefined is not serialisable — emit null instead');\n\t// Raw-expression escape hatch: a `RawExpr` is emitted VERBATIM (e.g.\n\t// `resolveId(\"@local/foo\")`) instead of as a quoted literal. The single\n\t// authorized use is id resolution in the emitted `config.ts` — ids are\n\t// LOADED CONFIG DATA injected at app build time, not codegen output, so\n\t// the config calls a runtime resolver rather than embedding a literal id.\n\tif (isRawExpr(value)) return tryOk(value.expr);\n\tconst t = typeof value;\n\tif (t === 'string') return tryOk(JSON.stringify(value));\n\tif (t === 'number') {\n\t\tif (!Number.isFinite(value as number)) return tryErr('non-finite number');\n\t\treturn tryOk(String(value));\n\t}\n\tif (t === 'boolean') return tryOk(String(value));\n\tif (t === 'bigint') return tryOk(JSON.stringify(value.toString()));\n\tif (t === 'function' || t === 'symbol') return tryErr(`${t} is not serialisable`);\n\tif (Array.isArray(value)) {\n\t\tif (seen.has(value)) return tryErr('circular reference');\n\t\tseen.add(value);\n\t\tif (value.length === 0) return tryOk('[]');\n\t\tconst inner: Array<string> = [];\n\t\tfor (const item of value) {\n\t\t\tconst r = tryRender(item, seen, depth + 1);\n\t\t\tif (!r.ok) return r;\n\t\t\tinner.push(INDENT.repeat(depth) + r.text);\n\t\t}\n\t\tseen.delete(value);\n\t\treturn tryOk(`[\\n${inner.join(',\\n')},\\n${INDENT.repeat(depth - 1)}]`);\n\t}\n\tif (t === 'object') {\n\t\tconst obj = value as Record<string, unknown>;\n\t\tif (seen.has(obj)) return tryErr('circular reference');\n\t\tseen.add(obj);\n\t\tconst keys = Object.keys(obj).sort();\n\t\tif (keys.length === 0) return tryOk('{}');\n\t\tconst lines: Array<string> = [];\n\t\tfor (const k of keys) {\n\t\t\tconst v = obj[k];\n\t\t\tif (v === undefined) continue; // drop undefined props (distilled-doc skip-emit-explicit)\n\t\t\tconst r = tryRender(v, seen, depth + 1);\n\t\t\tif (!r.ok) return r;\n\t\t\tconst keyText = isIdentifier(k) ? k : JSON.stringify(k);\n\t\t\tlines.push(`${INDENT.repeat(depth)}${keyText}: ${r.text}`);\n\t\t}\n\t\tseen.delete(obj);\n\t\tif (lines.length === 0) return tryOk('{}');\n\t\treturn tryOk(`{\\n${lines.join(',\\n')},\\n${INDENT.repeat(depth - 1)}}`);\n\t}\n\treturn tryErr(`unsupported value type ${t}`);\n};\n\nconst IDENT_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;\nconst isIdentifier = (s: string): boolean => IDENT_RE.test(s);\n\nconst isForbiddenGeneratedImport = (line: string): boolean =>\n\t/\\bfrom\\s+[\"']@mysten-incubation\\/devstack(?:-rewrite)?(?:\\/|[\"'])/.test(line) ||\n\t/\\bimport\\s*\\(\\s*[\"']@mysten-incubation\\/devstack(?:-rewrite)?(?:\\/|[\"'])/.test(line) ||\n\t/\\bfrom\\s+[\"'][./][^\"']*\\/src\\//.test(line) ||\n\t/\\bimport\\s*\\(\\s*[\"'][./][^\"']*\\/src\\//.test(line);\n"],"mappings":"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"}
|
|
@@ -6,13 +6,21 @@ import { Effect, FileSystem } from "effect";
|
|
|
6
6
|
const USER_BLOCK_START = "# user: customisations below preserved across re-emits";
|
|
7
7
|
const USER_BLOCK_END = "# /user: do not edit below this line";
|
|
8
8
|
const DEFAULT_USER_BLOCK = `${USER_BLOCK_START}\n${USER_BLOCK_END}`;
|
|
9
|
-
const
|
|
9
|
+
const ignoreAllHeader = [
|
|
10
10
|
"# THIS FILE IS AUTO-GENERATED BY @mysten/devstack.",
|
|
11
11
|
"# The codegen output directory is engine-managed; the whole tree is",
|
|
12
12
|
"# ignored from git by default. Sensitive files have an explicit mention",
|
|
13
13
|
"# below for documentation. Add user customisations inside the `# user:`",
|
|
14
14
|
"# block; the rest is rewritten on every emit cycle."
|
|
15
15
|
].join("\n");
|
|
16
|
+
const trackAllHeader = [
|
|
17
|
+
"# THIS FILE IS AUTO-GENERATED BY @mysten/devstack.",
|
|
18
|
+
"# This is the COMMITTED projection tree: the type bindings + sentinel-id",
|
|
19
|
+
"# config stubs are tracked so `tsc`/`vite build` work on a fresh clone",
|
|
20
|
+
"# with no stack running. Only genuinely sensitive files are ignored.",
|
|
21
|
+
"# Add user customisations inside the `# user:` block; the rest is",
|
|
22
|
+
"# rewritten on every emit cycle."
|
|
23
|
+
].join("\n");
|
|
16
24
|
/**
|
|
17
25
|
* Compose the gitignore content, preserving any user customisations
|
|
18
26
|
* between the `# user:` markers in any existing file at `path`.
|
|
@@ -21,16 +29,27 @@ const composeGitignore = (existing, input) => {
|
|
|
21
29
|
const userBlock = existing !== null ? extractUserBlock(existing) : null;
|
|
22
30
|
const sortedSensitive = [...input.sensitivePaths].sort();
|
|
23
31
|
const lines = [];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
if (input.trackTree === true) {
|
|
33
|
+
lines.push(trackAllHeader);
|
|
34
|
+
lines.push("");
|
|
35
|
+
lines.push("# default policy: track the whole committed projection tree.");
|
|
36
|
+
if (sortedSensitive.length > 0) {
|
|
37
|
+
lines.push("");
|
|
38
|
+
lines.push("# sensitive files — never commit these even though the tree is tracked.");
|
|
39
|
+
for (const p of sortedSensitive) lines.push(p);
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
lines.push(ignoreAllHeader);
|
|
31
43
|
lines.push("");
|
|
32
|
-
lines.push("#
|
|
33
|
-
|
|
44
|
+
lines.push("# default policy: ignore the whole output directory.");
|
|
45
|
+
lines.push("*");
|
|
46
|
+
lines.push("# but keep this .gitignore tracked so cloners get the policy.");
|
|
47
|
+
lines.push("!.gitignore");
|
|
48
|
+
if (sortedSensitive.length > 0) {
|
|
49
|
+
lines.push("");
|
|
50
|
+
lines.push("# sensitive files — never commit even if you override the `*` above.");
|
|
51
|
+
for (const p of sortedSensitive) lines.push(p);
|
|
52
|
+
}
|
|
34
53
|
}
|
|
35
54
|
lines.push("");
|
|
36
55
|
lines.push(userBlock !== null ? userBlock : DEFAULT_USER_BLOCK);
|
|
@@ -54,7 +73,7 @@ const writeGitignore = (input) => Effect.gen(function* () {
|
|
|
54
73
|
stage: "gitignore",
|
|
55
74
|
cause: e
|
|
56
75
|
})));
|
|
57
|
-
})
|
|
76
|
+
});
|
|
58
77
|
const extractUserBlock = (text) => {
|
|
59
78
|
const startIdx = text.indexOf(USER_BLOCK_START);
|
|
60
79
|
const endIdx = text.indexOf(USER_BLOCK_END);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitignore.mjs","names":[],"sources":["../../../src/orchestrators/codegen/gitignore.ts"],"sourcesContent":["// .gitignore emission for the codegen output directory.\n//\n//
|
|
1
|
+
{"version":3,"file":"gitignore.mjs","names":[],"sources":["../../../src/orchestrators/codegen/gitignore.ts"],"sourcesContent":["// .gitignore emission for the codegen output directory.\n//\n// The `.gitignore` policy depends on WHICH tree this is (`trackTree`):\n//\n// - An EPHEMERAL tree (e.g. `.devstack/...`) is engine-managed output\n// — the pragmatic default is \"ignore everything emitted here\" (a\n// blanket `*`). Its id-bearing files must never land in git (the\n// `.devstack/` root is already gitignored too; this is\n// defense-in-depth + self-documentation).\n// - The COMMITTED tree at `src/generated`, written by the stack-free\n// `codegen` verb, is meant to be TRACKED: the type bindings + config\n// stubs (which carry NO on-chain ids — those are injected at app\n// build time) are committed so `tsc`/`vite build` work on a fresh\n// clone with no stack. Here the policy TRACKS everything by default\n// and only ignores the genuinely sensitive files (`sensitivePaths`).\n//\n// Three design points common to both:\n// 1. A default policy line at the top of the file with a comment\n// explaining it (`*` for live, an all-tracked comment for committed).\n// 2. Sensitive files get an explicit mention so the `.gitignore` reads\n// as documentation in addition to enforcing the policy.\n// 3. User customisations land in a tracked `# user:` block — any\n// content the user adds between the `# user:` and `# /user:`\n// markers is preserved verbatim across re-emits.\n//\n// The `.gitignore` is emitted with the same per-file atomic writer as\n// the rest of the codegen tree.\n\nimport { Effect, FileSystem } from 'effect';\n\nimport { emitOne } from './emit.ts';\nimport { CodegenWriteFailed } from './errors.ts';\nimport { NON_SENSITIVE_DIR_MODE, NON_SENSITIVE_FILE_MODE } from './permissions.ts';\n\nconst USER_BLOCK_START = '# user: customisations below preserved across re-emits';\nconst USER_BLOCK_END = '# /user: do not edit below this line';\n\nconst DEFAULT_USER_BLOCK = `${USER_BLOCK_START}\\n${USER_BLOCK_END}`;\n\nconst ignoreAllHeader = [\n\t'# THIS FILE IS AUTO-GENERATED BY @mysten/devstack.',\n\t'# The codegen output directory is engine-managed; the whole tree is',\n\t'# ignored from git by default. Sensitive files have an explicit mention',\n\t'# below for documentation. Add user customisations inside the `# user:`',\n\t'# block; the rest is rewritten on every emit cycle.',\n].join('\\n');\n\nconst trackAllHeader = [\n\t'# THIS FILE IS AUTO-GENERATED BY @mysten/devstack.',\n\t'# This is the COMMITTED projection tree: the type bindings + sentinel-id',\n\t'# config stubs are tracked so `tsc`/`vite build` work on a fresh clone',\n\t'# with no stack running. Only genuinely sensitive files are ignored.',\n\t'# Add user customisations inside the `# user:` block; the rest is',\n\t'# rewritten on every emit cycle.',\n].join('\\n');\n\nexport interface GitignoreInput {\n\treadonly path: string;\n\treadonly parentMode?: number;\n\t/** Relative paths inside the output dir that are sensitive — get\n\t * an explicit gitignore line. Sorted lexicographically. */\n\treadonly sensitivePaths: ReadonlyArray<string>;\n\t/** When `true`, this is the COMMITTED projection tree (`src/generated`,\n\t * written by the stack-free `codegen` verb): track the stubs and only\n\t * ignore `sensitivePaths`. When `false`/omitted, this is the LIVE\n\t * ephemeral tree under `.devstack`: blanket-ignore everything. */\n\treadonly trackTree?: boolean;\n}\n\n/**\n * Compose the gitignore content, preserving any user customisations\n * between the `# user:` markers in any existing file at `path`.\n */\nexport const composeGitignore = (existing: string | null, input: GitignoreInput): string => {\n\tconst userBlock = existing !== null ? extractUserBlock(existing) : null;\n\tconst sortedSensitive = [...input.sensitivePaths].sort();\n\tconst lines: Array<string> = [];\n\tif (input.trackTree === true) {\n\t\t// COMMITTED tree: track everything; ignore only the sensitive files.\n\t\tlines.push(trackAllHeader);\n\t\tlines.push('');\n\t\tlines.push('# default policy: track the whole committed projection tree.');\n\t\tif (sortedSensitive.length > 0) {\n\t\t\tlines.push('');\n\t\t\tlines.push('# sensitive files — never commit these even though the tree is tracked.');\n\t\t\tfor (const p of sortedSensitive) lines.push(p);\n\t\t}\n\t} else {\n\t\t// LIVE tree: blanket-ignore everything.\n\t\tlines.push(ignoreAllHeader);\n\t\tlines.push('');\n\t\tlines.push('# default policy: ignore the whole output directory.');\n\t\tlines.push('*');\n\t\tlines.push('# but keep this .gitignore tracked so cloners get the policy.');\n\t\tlines.push('!.gitignore');\n\t\tif (sortedSensitive.length > 0) {\n\t\t\tlines.push('');\n\t\t\tlines.push('# sensitive files — never commit even if you override the `*` above.');\n\t\t\tfor (const p of sortedSensitive) lines.push(p);\n\t\t}\n\t}\n\tlines.push('');\n\tlines.push(userBlock !== null ? userBlock : DEFAULT_USER_BLOCK);\n\treturn lines.join('\\n') + '\\n';\n};\n\n/**\n * Write the gitignore. Idempotent via `emitOne`'s no-touch path.\n */\nexport const writeGitignore = (\n\tinput: GitignoreInput,\n): Effect.Effect<void, CodegenWriteFailed, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\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\t\tconst content = composeGitignore(existing, input);\n\t\tyield* emitOne({\n\t\t\tpath: input.path,\n\t\t\tcontent,\n\t\t\tmode: NON_SENSITIVE_FILE_MODE,\n\t\t\tparentMode: input.parentMode ?? NON_SENSITIVE_DIR_MODE,\n\t\t}).pipe(\n\t\t\tEffect.mapError(\n\t\t\t\t(e) =>\n\t\t\t\t\tnew CodegenWriteFailed({\n\t\t\t\t\t\toutputPath: input.path,\n\t\t\t\t\t\tstage: 'gitignore',\n\t\t\t\t\t\tcause: e,\n\t\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t});\n\nconst extractUserBlock = (text: string): string | null => {\n\tconst startIdx = text.indexOf(USER_BLOCK_START);\n\tconst endIdx = text.indexOf(USER_BLOCK_END);\n\tif (startIdx === -1 || endIdx === -1 || endIdx < startIdx) return null;\n\t// Include both markers in the returned block.\n\tconst endLineEnd = text.indexOf('\\n', endIdx);\n\tconst stop = endLineEnd === -1 ? text.length : endLineEnd;\n\treturn text.slice(startIdx, stop);\n};\n"],"mappings":";;;;;AAkCA,MAAM,mBAAmB;AACzB,MAAM,iBAAiB;AAEvB,MAAM,qBAAqB,GAAG,iBAAiB,IAAI;AAEnD,MAAM,kBAAkB;CACvB;CACA;CACA;CACA;CACA;AACD,CAAC,CAAC,KAAK,IAAI;AAEX,MAAM,iBAAiB;CACtB;CACA;CACA;CACA;CACA;CACA;AACD,CAAC,CAAC,KAAK,IAAI;;;;;AAmBX,MAAa,oBAAoB,UAAyB,UAAkC;CAC3F,MAAM,YAAY,aAAa,OAAO,iBAAiB,QAAQ,IAAI;CACnE,MAAM,kBAAkB,CAAC,GAAG,MAAM,cAAc,CAAC,CAAC,KAAK;CACvD,MAAM,QAAuB,CAAC;CAC9B,IAAI,MAAM,cAAc,MAAM;EAE7B,MAAM,KAAK,cAAc;EACzB,MAAM,KAAK,EAAE;EACb,MAAM,KAAK,8DAA8D;EACzE,IAAI,gBAAgB,SAAS,GAAG;GAC/B,MAAM,KAAK,EAAE;GACb,MAAM,KAAK,yEAAyE;GACpF,KAAK,MAAM,KAAK,iBAAiB,MAAM,KAAK,CAAC;EAC9C;CACD,OAAO;EAEN,MAAM,KAAK,eAAe;EAC1B,MAAM,KAAK,EAAE;EACb,MAAM,KAAK,sDAAsD;EACjE,MAAM,KAAK,GAAG;EACd,MAAM,KAAK,+DAA+D;EAC1E,MAAM,KAAK,aAAa;EACxB,IAAI,gBAAgB,SAAS,GAAG;GAC/B,MAAM,KAAK,EAAE;GACb,MAAM,KAAK,sEAAsE;GACjF,KAAK,MAAM,KAAK,iBAAiB,MAAM,KAAK,CAAC;EAC9C;CACD;CACA,MAAM,KAAK,EAAE;CACb,MAAM,KAAK,cAAc,OAAO,YAAY,kBAAkB;CAC9D,OAAO,MAAM,KAAK,IAAI,IAAI;AAC3B;;;;AAKA,MAAa,kBACZ,UAEA,OAAO,IAAI,aAAa;CAQvB,MAAM,UAAU,iBAAiB,QANT,OADN,WAAW,WAAA,CACF,eAAe,MAAM,IAAI,CAAC,CAAC,KACrD,OAAO,MAAM;EACZ,YAAY,SAAS;EACrB,iBAAiB;CAClB,CAAC,CACF,GAC2C,KAAK;CAChD,OAAO,QAAQ;EACd,MAAM,MAAM;EACZ;EACA,MAAA;EACA,YAAY,MAAM,cAAA;CACnB,CAAC,CAAC,CAAC,KACF,OAAO,UACL,MACA,IAAI,mBAAmB;EACtB,YAAY,MAAM;EAClB,OAAO;EACP,OAAO;CACR,CAAC,CACH,CACD;AACD,CAAC;AAEF,MAAM,oBAAoB,SAAgC;CACzD,MAAM,WAAW,KAAK,QAAQ,gBAAgB;CAC9C,MAAM,SAAS,KAAK,QAAQ,cAAc;CAC1C,IAAI,aAAa,MAAM,WAAW,MAAM,SAAS,UAAU,OAAO;CAElE,MAAM,aAAa,KAAK,QAAQ,MAAM,MAAM;CAC5C,MAAM,OAAO,eAAe,KAAK,KAAK,SAAS;CAC/C,OAAO,KAAK,MAAM,UAAU,IAAI;AACjC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { decodeJsonTextSync } from "../../substrate/runtime/runtime-decode.mjs";
|
|
2
|
+
import { atomicWriteFile } from "../../substrate/runtime/atomic-write.mjs";
|
|
3
|
+
import { Effect, Schema } from "effect";
|
|
4
|
+
//#region src/orchestrators/codegen/id-config.ts
|
|
5
|
+
/** The all-zero Sui object id used as the placeholder for an unresolved
|
|
6
|
+
* (stack-free) id. A committed `config.ts` resolver treats this value —
|
|
7
|
+
* and a missing id — identically: it THROWS `DevstackConfigMissingError`
|
|
8
|
+
* at access time (see `config-runtime.ts`). Apps never transact with it. */
|
|
9
|
+
const UNRESOLVED_ID = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
10
|
+
/** One `networks.<name>` entry — the connection coordinates for a
|
|
11
|
+
* network. Mirrors `SuiNetworkConfigEntry` (plugins/sui/codegen.ts);
|
|
12
|
+
* `rpc` is the load-bearing field the app reads synchronously at module
|
|
13
|
+
* load. */
|
|
14
|
+
const IdConfigNetworkSchema = Schema.Struct({
|
|
15
|
+
rpc: Schema.String,
|
|
16
|
+
chainId: Schema.optional(Schema.String),
|
|
17
|
+
faucet: Schema.optional(Schema.NullOr(Schema.String)),
|
|
18
|
+
graphql: Schema.optional(Schema.NullOr(Schema.String))
|
|
19
|
+
});
|
|
20
|
+
/** One `packages.<name>` entry — the resolved package id plus any
|
|
21
|
+
* resolved object captures for the active network. */
|
|
22
|
+
const IdConfigPackageSchema = Schema.Struct({
|
|
23
|
+
id: Schema.String,
|
|
24
|
+
objects: Schema.optional(Schema.Record(Schema.String, Schema.String))
|
|
25
|
+
});
|
|
26
|
+
/** A JSON-serialisable value carried in the generic `values` channel.
|
|
27
|
+
* The whole id-config round-trips through `JSON.stringify` into the
|
|
28
|
+
* vite `define` global, so the value space is exactly JSON. */
|
|
29
|
+
const IdConfigJsonSchema = Schema.suspend(() => Schema.Union([
|
|
30
|
+
Schema.Null,
|
|
31
|
+
Schema.String,
|
|
32
|
+
Schema.Number,
|
|
33
|
+
Schema.Boolean,
|
|
34
|
+
Schema.Array(IdConfigJsonSchema),
|
|
35
|
+
Schema.Record(Schema.String, IdConfigJsonSchema)
|
|
36
|
+
]));
|
|
37
|
+
/** The generic resolver channel: a two-level namespaced map of arbitrary
|
|
38
|
+
* JSON values a plugin contributes at boot and the committed `config.ts`
|
|
39
|
+
* reads back via `resolveValue(namespace, key)`. This is the open-ended
|
|
40
|
+
* sibling to the typed `network`/`networks`/`packages`/`accounts`/
|
|
41
|
+
* `mvrOverrides` fields — it carries the plugin live values the fixed
|
|
42
|
+
* channel can't (deepbook pool ids, coin types, walrus/seal endpoints). */
|
|
43
|
+
const IdConfigValuesSchema = Schema.Record(Schema.String, Schema.Record(Schema.String, IdConfigJsonSchema));
|
|
44
|
+
/** The id-config interchange shape. The whole document is data — no
|
|
45
|
+
* functions, no devstack imports — so it round-trips through JSON and a
|
|
46
|
+
* `JSON.stringify` into a vite `define` global. */
|
|
47
|
+
const IdConfigSchema = Schema.Struct({
|
|
48
|
+
/** Active network name (the `networks.<name>` key the app reads).
|
|
49
|
+
* Load-bearing — an id-config MUST name its network + connection. */
|
|
50
|
+
network: Schema.String,
|
|
51
|
+
networks: Schema.Record(Schema.String, IdConfigNetworkSchema),
|
|
52
|
+
/** Resolved package ids (+ object captures). Optional, default `{}`: an
|
|
53
|
+
* id-config may have zero packages (a network-only stack, or a
|
|
54
|
+
* hand-authored deploy file), and the boot writer always emits the key
|
|
55
|
+
* anyway — defaulting keeps the injected blob well-formed so the app's
|
|
56
|
+
* resolvers throw `DevstackConfigMissingError` rather than a raw
|
|
57
|
+
* TypeError on a missing section. */
|
|
58
|
+
packages: Schema.Record(Schema.String, IdConfigPackageSchema).pipe(Schema.withDecodingDefaultKey(Effect.succeed({}))),
|
|
59
|
+
accounts: Schema.Record(Schema.String, Schema.String).pipe(Schema.withDecodingDefaultKey(Effect.succeed({}))),
|
|
60
|
+
/** MVR placeholder (`@local/<slug>`) → resolved id, for the active
|
|
61
|
+
* network. An app feeds this straight into dapp-kit's
|
|
62
|
+
* `mvr.overrides.packages`. Optional, default `{}` (see `packages`). */
|
|
63
|
+
mvrOverrides: Schema.Record(Schema.String, Schema.String).pipe(Schema.withDecodingDefaultKey(Effect.succeed({}))),
|
|
64
|
+
/** Generic resolver channel — `values[namespace][key]` carries
|
|
65
|
+
* arbitrary live plugin JSON the typed fields above can't. Optional
|
|
66
|
+
* so older id-config files (no `values`) still decode. */
|
|
67
|
+
values: Schema.optional(IdConfigValuesSchema)
|
|
68
|
+
});
|
|
69
|
+
/** Failure reading or decoding an id-config file. */
|
|
70
|
+
var IdConfigError = class extends Schema.TaggedErrorClass()("IdConfigError", {
|
|
71
|
+
source: Schema.String,
|
|
72
|
+
message: Schema.String,
|
|
73
|
+
cause: Schema.optional(Schema.Defect)
|
|
74
|
+
}) {};
|
|
75
|
+
/** Canonical filename of the per-stack id-config under
|
|
76
|
+
* `.devstack/stacks/<name>/`. */
|
|
77
|
+
const ID_CONFIG_FILENAME = "devstack-ids.json";
|
|
78
|
+
/** Write the id-config as pretty JSON. Idempotent at the byte level for
|
|
79
|
+
* identical input (sorted by the caller's assembly order). */
|
|
80
|
+
const writeIdConfig = (path, config) => Effect.gen(function* () {
|
|
81
|
+
const text = `${JSON.stringify(config, null, 2)}\n`;
|
|
82
|
+
yield* atomicWriteFile(path, new TextEncoder().encode(text), { mode: 420 }).pipe(Effect.mapError((cause) => new IdConfigError({
|
|
83
|
+
source: path,
|
|
84
|
+
message: "failed to write id-config",
|
|
85
|
+
cause
|
|
86
|
+
})));
|
|
87
|
+
});
|
|
88
|
+
/** Project a runtime-decode issue into the typed `IdConfigError`. */
|
|
89
|
+
const mkIdConfigError = (issue) => new IdConfigError({
|
|
90
|
+
source: issue.source,
|
|
91
|
+
message: issue.message,
|
|
92
|
+
...issue.cause === void 0 ? {} : { cause: issue.cause }
|
|
93
|
+
});
|
|
94
|
+
/** Decode + validate an id-config from already-read JSON text. The single
|
|
95
|
+
* schema-decode seam every reader shares (the Vite plugin, the `dump-ids`
|
|
96
|
+
* verb, the codegen verb) so the parse-and-validate decision lives in ONE
|
|
97
|
+
* place rather than each caller hand-rolling `JSON.parse`. Throws
|
|
98
|
+
* `IdConfigError` on malformed JSON or a shape that violates
|
|
99
|
+
* `IdConfigSchema`. */
|
|
100
|
+
const decodeIdConfig = (text) => decodeJsonTextSync(IdConfigSchema, text, {
|
|
101
|
+
source: ID_CONFIG_FILENAME,
|
|
102
|
+
mkError: mkIdConfigError
|
|
103
|
+
});
|
|
104
|
+
//#endregion
|
|
105
|
+
export { ID_CONFIG_FILENAME, UNRESOLVED_ID, decodeIdConfig, writeIdConfig };
|
|
106
|
+
|
|
107
|
+
//# sourceMappingURL=id-config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id-config.mjs","names":[],"sources":["../../../src/orchestrators/codegen/id-config.ts"],"sourcesContent":["// The id-config interchange file — the single source of on-chain ids.\n//\n// Stop treating on-chain ids as codegen OUTPUT. Treat them as loaded\n// CONFIG DATA. Codegen is a deterministic, stack-free function\n// `(Move source, id-config?) → generated`. Booting a stack's only new\n// job is to PRODUCE this file; the codegen verb READS it (or runs with\n// none); the vite plugin INJECTS it into the app build/dev server.\n//\n// Four authors/consumers, one shared schema:\n// - WRITER: `orchestrators/boot.ts` post-acquire assembles this from\n// acquired plugin state and writes it to the gitignored\n// `.devstack/stacks/<name>/devstack-ids.json`.\n// - READER: the stack-free `devstack codegen` verb reads it via the\n// optional `--config <file>` flag (absent ⇒ ids unresolved).\n// - CONSUMER: the emitted `config-runtime.ts` resolver reads the same\n// shape off the injected `__DEVSTACK_IDS__` global.\n// - INJECTOR: the vite plugin reads the live file (dev) or a committed\n// id-config file (prod, via `ids`/`DEVSTACK_IDS_FILE`) and\n// `define`s the global.\n//\n// The shape is the id-half of today's `config.ts`: networks (rpc + the\n// rest), per-package ids (+ captured object ids), account addresses, and\n// the MVR placeholder → id override map an app feeds dapp-kit.\n\nimport { Effect, FileSystem, Schema } from 'effect';\n\nimport { atomicWriteFile } from '../../substrate/runtime/atomic-write.ts';\nimport {\n\tdecodeJsonTextSync,\n\ttype RuntimeDecodeIssue,\n} from '../../substrate/runtime/runtime-decode.ts';\n\n// -----------------------------------------------------------------------------\n// Sentinel — the all-zero id that marks an UNRESOLVED on-chain id.\n// -----------------------------------------------------------------------------\n\n/** The all-zero Sui object id used as the placeholder for an unresolved\n * (stack-free) id. A committed `config.ts` resolver treats this value —\n * and a missing id — identically: it THROWS `DevstackConfigMissingError`\n * at access time (see `config-runtime.ts`). Apps never transact with it. */\nexport const UNRESOLVED_ID = '0x0000000000000000000000000000000000000000000000000000000000000000';\n\n/** True when `id` is absent or the all-zero sentinel — i.e. not a real\n * resolved on-chain id. */\nexport const isUnresolvedId = (id: string | undefined | null): boolean =>\n\tid === undefined || id === null || id === UNRESOLVED_ID;\n\n// -----------------------------------------------------------------------------\n// JSON value space — the generic `values` channel carries exactly JSON.\n// -----------------------------------------------------------------------------\n\n/** Any JSON-serialisable value. The id-config round-trips through\n * `JSON.stringify` into the injected `__DEVSTACK_IDS__` global, so a\n * plugin live value carried in the generic `values` channel must be JSON. */\nexport type JsonValue =\n\t| null\n\t| string\n\t| number\n\t| boolean\n\t| ReadonlyArray<JsonValue>\n\t| { readonly [key: string]: JsonValue };\n\n// -----------------------------------------------------------------------------\n// Schema\n// -----------------------------------------------------------------------------\n\n/** One `networks.<name>` entry — the connection coordinates for a\n * network. Mirrors `SuiNetworkConfigEntry` (plugins/sui/codegen.ts);\n * `rpc` is the load-bearing field the app reads synchronously at module\n * load. */\nexport const IdConfigNetworkSchema = Schema.Struct({\n\trpc: Schema.String,\n\tchainId: Schema.optional(Schema.String),\n\tfaucet: Schema.optional(Schema.NullOr(Schema.String)),\n\tgraphql: Schema.optional(Schema.NullOr(Schema.String)),\n});\n\n/** One `packages.<name>` entry — the resolved package id plus any\n * resolved object captures for the active network. */\nexport const IdConfigPackageSchema = Schema.Struct({\n\tid: Schema.String,\n\tobjects: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n});\n\n/** A JSON-serialisable value carried in the generic `values` channel.\n * The whole id-config round-trips through `JSON.stringify` into the\n * vite `define` global, so the value space is exactly JSON. */\n// Typed as `Schema.Codec<JsonValue>` (NOT `Schema.Schema<JsonValue>`): the\n// type-only `Schema<T>` widens `DecodingServices` to `unknown`, which would\n// poison every decoder of `IdConfigSchema`; `Codec<T>` defaults the decode/\n// encode services to `never`, matching the real (service-free) recursion.\nexport const IdConfigJsonSchema: Schema.Codec<JsonValue> = Schema.suspend(() =>\n\tSchema.Union([\n\t\tSchema.Null,\n\t\tSchema.String,\n\t\tSchema.Number,\n\t\tSchema.Boolean,\n\t\tSchema.Array(IdConfigJsonSchema),\n\t\tSchema.Record(Schema.String, IdConfigJsonSchema),\n\t]),\n) as Schema.Codec<JsonValue>;\n\n/** The generic resolver channel: a two-level namespaced map of arbitrary\n * JSON values a plugin contributes at boot and the committed `config.ts`\n * reads back via `resolveValue(namespace, key)`. This is the open-ended\n * sibling to the typed `network`/`networks`/`packages`/`accounts`/\n * `mvrOverrides` fields — it carries the plugin live values the fixed\n * channel can't (deepbook pool ids, coin types, walrus/seal endpoints). */\nexport const IdConfigValuesSchema = Schema.Record(\n\tSchema.String,\n\tSchema.Record(Schema.String, IdConfigJsonSchema),\n);\n\n/** The id-config interchange shape. The whole document is data — no\n * functions, no devstack imports — so it round-trips through JSON and a\n * `JSON.stringify` into a vite `define` global. */\nexport const IdConfigSchema = Schema.Struct({\n\t/** Active network name (the `networks.<name>` key the app reads).\n\t * Load-bearing — an id-config MUST name its network + connection. */\n\tnetwork: Schema.String,\n\tnetworks: Schema.Record(Schema.String, IdConfigNetworkSchema),\n\t/** Resolved package ids (+ object captures). Optional, default `{}`: an\n\t * id-config may have zero packages (a network-only stack, or a\n\t * hand-authored deploy file), and the boot writer always emits the key\n\t * anyway — defaulting keeps the injected blob well-formed so the app's\n\t * resolvers throw `DevstackConfigMissingError` rather than a raw\n\t * TypeError on a missing section. */\n\tpackages: Schema.Record(Schema.String, IdConfigPackageSchema).pipe(\n\t\tSchema.withDecodingDefaultKey(Effect.succeed({})),\n\t),\n\taccounts: Schema.Record(Schema.String, Schema.String).pipe(\n\t\tSchema.withDecodingDefaultKey(Effect.succeed({})),\n\t),\n\t/** MVR placeholder (`@local/<slug>`) → resolved id, for the active\n\t * network. An app feeds this straight into dapp-kit's\n\t * `mvr.overrides.packages`. Optional, default `{}` (see `packages`). */\n\tmvrOverrides: Schema.Record(Schema.String, Schema.String).pipe(\n\t\tSchema.withDecodingDefaultKey(Effect.succeed({})),\n\t),\n\t/** Generic resolver channel — `values[namespace][key]` carries\n\t * arbitrary live plugin JSON the typed fields above can't. Optional\n\t * so older id-config files (no `values`) still decode. */\n\tvalues: Schema.optional(IdConfigValuesSchema),\n});\n\nexport type IdConfig = typeof IdConfigSchema.Type;\nexport type IdConfigNetwork = typeof IdConfigNetworkSchema.Type;\nexport type IdConfigPackage = typeof IdConfigPackageSchema.Type;\nexport type IdConfigValues = typeof IdConfigValuesSchema.Type;\n\n// -----------------------------------------------------------------------------\n// Error\n// -----------------------------------------------------------------------------\n\n/** Failure reading or decoding an id-config file. */\nexport class IdConfigError extends Schema.TaggedErrorClass<IdConfigError>()('IdConfigError', {\n\tsource: Schema.String,\n\tmessage: Schema.String,\n\tcause: Schema.optional(Schema.Defect),\n}) {}\n\n// -----------------------------------------------------------------------------\n// Read / write helpers\n// -----------------------------------------------------------------------------\n\n/** Canonical filename of the per-stack id-config under\n * `.devstack/stacks/<name>/`. */\nexport const ID_CONFIG_FILENAME = 'devstack-ids.json';\n\n/** Write the id-config as pretty JSON. Idempotent at the byte level for\n * identical input (sorted by the caller's assembly order). */\nexport const writeIdConfig = (\n\tpath: string,\n\tconfig: IdConfig,\n): Effect.Effect<void, IdConfigError, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst text = `${JSON.stringify(config, null, 2)}\\n`;\n\t\tconst bytes = new TextEncoder().encode(text);\n\t\t// Atomic temp+rename — the Vite plugin reads this file with a plain\n\t\t// `readFileSync` + `JSON.parse`, so a torn / partial write would surface\n\t\t// as a parse error. `atomicWriteFile` ensures the parent dir (the\n\t\t// id-config write may run before the manifest write) and fsyncs before\n\t\t// the rename, so readers only ever see a complete file.\n\t\tyield* atomicWriteFile(path, bytes, { mode: 0o644 }).pipe(\n\t\t\tEffect.mapError(\n\t\t\t\t(cause) => new IdConfigError({ source: path, message: 'failed to write id-config', cause }),\n\t\t\t),\n\t\t);\n\t});\n\n/** Project a runtime-decode issue into the typed `IdConfigError`. */\nconst mkIdConfigError = (issue: RuntimeDecodeIssue): IdConfigError =>\n\tnew IdConfigError({\n\t\tsource: issue.source,\n\t\tmessage: issue.message,\n\t\t...(issue.cause === undefined ? {} : { cause: issue.cause }),\n\t});\n\n/** Decode + validate an id-config from already-read JSON text. The single\n * schema-decode seam every reader shares (the Vite plugin, the `dump-ids`\n * verb, the codegen verb) so the parse-and-validate decision lives in ONE\n * place rather than each caller hand-rolling `JSON.parse`. Throws\n * `IdConfigError` on malformed JSON or a shape that violates\n * `IdConfigSchema`. */\nexport const decodeIdConfig = (text: string): IdConfig =>\n\tdecodeJsonTextSync(IdConfigSchema, text, {\n\t\tsource: ID_CONFIG_FILENAME,\n\t\tmkError: mkIdConfigError,\n\t});\n"],"mappings":";;;;;;;;AAwCA,MAAa,gBAAgB;;;;;AA8B7B,MAAa,wBAAwB,OAAO,OAAO;CAClD,KAAK,OAAO;CACZ,SAAS,OAAO,SAAS,OAAO,MAAM;CACtC,QAAQ,OAAO,SAAS,OAAO,OAAO,OAAO,MAAM,CAAC;CACpD,SAAS,OAAO,SAAS,OAAO,OAAO,OAAO,MAAM,CAAC;AACtD,CAAC;;;AAID,MAAa,wBAAwB,OAAO,OAAO;CAClD,IAAI,OAAO;CACX,SAAS,OAAO,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO,MAAM,CAAC;AACrE,CAAC;;;;AASD,MAAa,qBAA8C,OAAO,cACjE,OAAO,MAAM;CACZ,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO,MAAM,kBAAkB;CAC/B,OAAO,OAAO,OAAO,QAAQ,kBAAkB;AAChD,CAAC,CACF;;;;;;;AAQA,MAAa,uBAAuB,OAAO,OAC1C,OAAO,QACP,OAAO,OAAO,OAAO,QAAQ,kBAAkB,CAChD;;;;AAKA,MAAa,iBAAiB,OAAO,OAAO;;;CAG3C,SAAS,OAAO;CAChB,UAAU,OAAO,OAAO,OAAO,QAAQ,qBAAqB;;;;;;;CAO5D,UAAU,OAAO,OAAO,OAAO,QAAQ,qBAAqB,CAAC,CAAC,KAC7D,OAAO,uBAAuB,OAAO,QAAQ,CAAC,CAAC,CAAC,CACjD;CACA,UAAU,OAAO,OAAO,OAAO,QAAQ,OAAO,MAAM,CAAC,CAAC,KACrD,OAAO,uBAAuB,OAAO,QAAQ,CAAC,CAAC,CAAC,CACjD;;;;CAIA,cAAc,OAAO,OAAO,OAAO,QAAQ,OAAO,MAAM,CAAC,CAAC,KACzD,OAAO,uBAAuB,OAAO,QAAQ,CAAC,CAAC,CAAC,CACjD;;;;CAIA,QAAQ,OAAO,SAAS,oBAAoB;AAC7C,CAAC;;AAYD,IAAa,gBAAb,cAAmC,OAAO,iBAAgC,CAAC,CAAC,iBAAiB;CAC5F,QAAQ,OAAO;CACf,SAAS,OAAO;CAChB,OAAO,OAAO,SAAS,OAAO,MAAM;AACrC,CAAC,CAAC,CAAC,CAAC;;;AAQJ,MAAa,qBAAqB;;;AAIlC,MAAa,iBACZ,MACA,WAEA,OAAO,IAAI,aAAa;CACvB,MAAM,OAAO,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE;CAOhD,OAAO,gBAAgB,MANT,IAAI,YAAY,CAAC,CAAC,OAAO,IAMN,GAAG,EAAE,MAAM,IAAM,CAAC,CAAC,CAAC,KACpD,OAAO,UACL,UAAU,IAAI,cAAc;EAAE,QAAQ;EAAM,SAAS;EAA6B;CAAM,CAAC,CAC3F,CACD;AACD,CAAC;;AAGF,MAAM,mBAAmB,UACxB,IAAI,cAAc;CACjB,QAAQ,MAAM;CACd,SAAS,MAAM;CACf,GAAI,MAAM,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,MAAM,MAAM;AAC3D,CAAC;;;;;;;AAQF,MAAa,kBAAkB,SAC9B,mBAAmB,gBAAgB,MAAM;CACxC,QAAQ;CACR,SAAS;AACV,CAAC"}
|
|
@@ -1,38 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { stackSubpath } from "../../substrate/runtime/paths.mjs";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
2
3
|
//#region src/orchestrators/codegen/output-location.ts
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
|
|
4
|
+
/** The app-rooted base under which codegen authors its per-stack subtrees:
|
|
5
|
+
* `<appRoot>/.devstack`. Mirrors the substrate's `RuntimeRoot` base, but
|
|
6
|
+
* rooted at the app source tree (codegen output lives with the user's
|
|
7
|
+
* source, not in engine-private state). The `stacks/<stack>/...` shape is
|
|
8
|
+
* composed by the shared `stackSubpath` so the two authors (substrate at
|
|
9
|
+
* `RuntimeRoot`, codegen here) never drift. */
|
|
10
|
+
const codegenStacksBase = (appRoot) => resolve(appRoot, ".devstack");
|
|
11
|
+
/** Resolve `<appRoot>/.devstack/stacks/<stack>/generated-extras` — the
|
|
12
|
+
* dev-only + secret tree. Always under `.devstack`, so dev-extras never
|
|
13
|
+
* land in the committed `src/generated/` tree. */
|
|
14
|
+
const extrasDirFor = (appRoot, stack) => stackSubpath(join, codegenStacksBase(appRoot), stack, "generated-extras");
|
|
8
15
|
/**
|
|
9
|
-
* Resolve the codegen output location for a stack. See the module
|
|
10
|
-
* header for the rule. Pure — same inputs always yield the same
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* 2. Home stack (`effectiveStack === homeStack`, or no `homeStack`
|
|
18
|
-
* declared) → `<appRoot>/src/generated`, `stackSubdir: null`.
|
|
19
|
-
* 3. Non-home stack → `<appRoot>/.devstack/stacks/<effectiveStack>/generated`,
|
|
20
|
-
* `stackSubdir: null`.
|
|
16
|
+
* Resolve the LIVE codegen output location for a stack. See the module
|
|
17
|
+
* header for the rule. Pure — same inputs always yield the same absolute
|
|
18
|
+
* path. A single fixed per-stack rule (no override): every live stack's
|
|
19
|
+
* dev-only `generated-extras` tree lands under
|
|
20
|
+
* `<appRoot>/.devstack/stacks/<effectiveStack>/generated-extras`. Boot
|
|
21
|
+
* writes ONLY this tree (`emitExtras`); it never emits the committed
|
|
22
|
+
* `src/generated` tree — that is owned solely by the stack-free `codegen`
|
|
23
|
+
* verb (which resolves its own output path directly).
|
|
21
24
|
*/
|
|
22
25
|
const resolveCodegenOutput = (input) => {
|
|
23
|
-
const { appRoot, effectiveStack
|
|
24
|
-
|
|
25
|
-
if (input.explicitOutputDir !== void 0) {
|
|
26
|
-
const target = input.explicitOutputDir;
|
|
27
|
-
return {
|
|
28
|
-
outputDir: isAbsolute(target) ? target : resolve(appRoot, target),
|
|
29
|
-
stackSubdir: explicitStackSubdir
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
outputDir: effectiveStack === (homeStack ?? effectiveStack) ? resolve(appRoot, HOME_OUTPUT_SUBPATH) : nonHomeOutputDir(appRoot, effectiveStack),
|
|
34
|
-
stackSubdir: null
|
|
35
|
-
};
|
|
26
|
+
const { appRoot, effectiveStack } = input;
|
|
27
|
+
return { extrasDir: extrasDirFor(appRoot, effectiveStack) };
|
|
36
28
|
};
|
|
37
29
|
//#endregion
|
|
38
30
|
export { resolveCodegenOutput };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-location.mjs","names":[],"sources":["../../../src/orchestrators/codegen/output-location.ts"],"sourcesContent":["// Per-stack codegen output-location resolver.\n//\n//
|
|
1
|
+
{"version":3,"file":"output-location.mjs","names":[],"sources":["../../../src/orchestrators/codegen/output-location.ts"],"sourcesContent":["// Per-stack codegen output-location resolver.\n//\n// Boot no longer runs codegen — `up` / `apply` write an id-config file to\n// `.devstack/stacks/<stack>/` instead. This resolver still owns the per-\n// stack `.devstack` dev tree (the `generated-extras` overlay the Vite\n// `@devstack-dev` alias reads). The COMMITTED `src/generated` tree is\n// written ONLY by the stack-free `codegen` verb, wired separately.\n//\n// This pure function is the single decision point for the per-stack dev\n// output dir: it maps (appRoot, effective stack) → the `.devstack` dir\n// codegen-adjacent dev artifacts own for THIS stack.\n//\n// - Every live stack → `<appRoot>/.devstack/stacks/<effectiveStack>/generated-extras`\n// — a sibling of that stack's manifest at\n// `.devstack/stacks/<stack>/manifest.json`, already gitignored +\n// tsconfig-excluded. Two stacks of the same app therefore never clobber\n// each other's dev-only artifacts. There is NO output-dir override:\n// `defineDevstack({ codegen })` exposes no public surface for the dev\n// tree (boot writes only the per-stack `generated-extras` overlay + the\n// id-config file), so the location is a single fixed per-stack rule.\n//\n// The resolved absolute `extrasDir` is recorded in the per-stack manifest\n// (`codegen.extrasDir`) so the reader (the Vite plugin's `@devstack-dev`\n// alias) consults the SAME location the writer chose. The committed\n// `src/generated` bindings tree is NOT recorded — the `@generated` alias\n// always resolves to it directly. Pure + unit-testable; no `process.env`,\n// no I/O.\n\nimport { join, resolve } from 'node:path';\n\nimport { stackSubpath } from '../../substrate/runtime/paths.ts';\n\n/** The app-rooted base under which codegen authors its per-stack subtrees:\n * `<appRoot>/.devstack`. Mirrors the substrate's `RuntimeRoot` base, but\n * rooted at the app source tree (codegen output lives with the user's\n * source, not in engine-private state). The `stacks/<stack>/...` shape is\n * composed by the shared `stackSubpath` so the two authors (substrate at\n * `RuntimeRoot`, codegen here) never drift. */\nconst codegenStacksBase = (appRoot: string): string => resolve(appRoot, '.devstack');\n\nexport interface ResolveCodegenOutputInput {\n\t/** The user application root — codegen output is resolved against\n\t * it. */\n\treadonly appRoot: string;\n\t/** The stack the supervisor is actually running (the resolved\n\t * identity's stack: explicit `--stack`/`$DEVSTACK_STACK` >\n\t * `config.stackName` > inferred). */\n\treadonly effectiveStack: string;\n}\n\nexport interface ResolvedCodegenOutput {\n\t/** Absolute path to the dev-only + secret `generated-extras` tree\n\t * for THIS stack — always\n\t * `<appRoot>/.devstack/stacks/<effectiveStack>/generated-extras`\n\t * (gitignored + tsconfig-excluded already). Recorded in the\n\t * manifest as `codegen.extrasDir`; reached via the `@devstack-dev`\n\t * Vite alias. */\n\treadonly extrasDir: string;\n}\n\n/** Resolve `<appRoot>/.devstack/stacks/<stack>/generated-extras` — the\n * dev-only + secret tree. Always under `.devstack`, so dev-extras never\n * land in the committed `src/generated/` tree. */\nconst extrasDirFor = (appRoot: string, stack: string): string =>\n\tstackSubpath(join, codegenStacksBase(appRoot), stack, 'generated-extras');\n\n/**\n * Resolve the LIVE codegen output location for a stack. See the module\n * header for the rule. Pure — same inputs always yield the same absolute\n * path. A single fixed per-stack rule (no override): every live stack's\n * dev-only `generated-extras` tree lands under\n * `<appRoot>/.devstack/stacks/<effectiveStack>/generated-extras`. Boot\n * writes ONLY this tree (`emitExtras`); it never emits the committed\n * `src/generated` tree — that is owned solely by the stack-free `codegen`\n * verb (which resolves its own output path directly).\n */\nexport const resolveCodegenOutput = (input: ResolveCodegenOutputInput): ResolvedCodegenOutput => {\n\tconst { appRoot, effectiveStack } = input;\n\treturn {\n\t\textrasDir: extrasDirFor(appRoot, effectiveStack),\n\t};\n};\n"],"mappings":";;;;;;;;;AAsCA,MAAM,qBAAqB,YAA4B,QAAQ,SAAS,WAAW;;;;AAyBnF,MAAM,gBAAgB,SAAiB,UACtC,aAAa,MAAM,kBAAkB,OAAO,GAAG,OAAO,kBAAkB;;;;;;;;;;;AAYzE,MAAa,wBAAwB,UAA4D;CAChG,MAAM,EAAE,SAAS,mBAAmB;CACpC,OAAO,EACN,WAAW,aAAa,SAAS,cAAc,EAChD;AACD"}
|
|
@@ -33,7 +33,12 @@ const layerCodegenPaths = Layer.effect(CodegenPathsService, Effect.gen(function*
|
|
|
33
33
|
const root = yield* CodegenRoot;
|
|
34
34
|
const path = yield* Path.Path;
|
|
35
35
|
const outputDir = root.stackSubdir ? path.join(root.outputDir, root.stackSubdir) : root.outputDir;
|
|
36
|
-
const
|
|
36
|
+
const extrasDir = root.extrasDir;
|
|
37
|
+
const codegenLockFile = `${extrasDir}.codegen.lock`;
|
|
38
|
+
const resolveExtras = (outputPath) => Effect.gen(function* () {
|
|
39
|
+
yield* assertRelativeCodegenOutputPath(outputPath);
|
|
40
|
+
return path.join(extrasDir, outputPath);
|
|
41
|
+
});
|
|
37
42
|
const buildAt = (atRoot) => {
|
|
38
43
|
const bindingsDir = path.join(atRoot, "bindings");
|
|
39
44
|
const resolve = (outputPath) => Effect.gen(function* () {
|
|
@@ -46,7 +51,9 @@ const layerCodegenPaths = Layer.effect(CodegenPathsService, Effect.gen(function*
|
|
|
46
51
|
gitignoreFile: path.join(atRoot, ".gitignore"),
|
|
47
52
|
bindingsDir,
|
|
48
53
|
codegenLockFile,
|
|
54
|
+
extrasDir,
|
|
49
55
|
resolve,
|
|
56
|
+
resolveExtras,
|
|
50
57
|
resolveBindingsPackage,
|
|
51
58
|
withRoot: (newRoot) => buildAt(newRoot)
|
|
52
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.mjs","names":[],"sources":["../../../src/orchestrators/codegen/paths.ts"],"sourcesContent":["// Codegen output-path layout.\n//\n// Distilled-doc § \"All outputs land under a single user-chosen\n// directory (default `./src/generated/`)\" + §\"Stable output paths\".\n// One file owns the layout so emitters never assemble paths by hand.\n//\n// Default root is `<appRoot>/src/generated/`. Tests and parallel\n// stacks pin a per-test root; the substrate's `RuntimeRoot` is for\n// engine-private state (~/.devstack/...), NOT for codegen output.\n// Codegen output lives in the USER's source tree.\n\nimport { Context, Effect, Layer, Path } from 'effect';\n\nimport { CodegenPathConflict } from './errors.ts';\n\n/** Guard plugin-authored `CodegenableDecl.outputPath` against `..`\n * traversal and absolute paths. Fails with a typed\n * `CodegenPathConflict({kind:'non-relative'})` — defense-in-depth\n * for the file-layout invariants. Called once inside `buildAt` so\n * both the root bundle and any `withRoot`-rebased view enforce the\n * same `..`-rejecting `resolve` discipline.\n *\n * POSIX-only: devstack runs on POSIX filesystems (substrate paths\n * are POSIX-shaped throughout), so this check intentionally inspects\n * only `/`-rooted absolutes and the `..` substring. A Windows-style\n * `'foo/bar\\\\..\\\\baz'` would slip past — that's accepted because\n * devstack never executes on a Windows runtime.\n *\n * STYLE_GUIDE §2 rule 5 — orchestrator failures are typed. */\nexport const assertRelativeCodegenOutputPath = (\n\toutputPath: string,\n): Effect.Effect<void, CodegenPathConflict> =>\n\toutputPath.includes('..') || outputPath.startsWith('/')\n\t\t? Effect.fail(\n\t\t\t\tnew CodegenPathConflict({\n\t\t\t\t\tkind: 'non-relative',\n\t\t\t\t\toutputPath,\n\t\t\t\t\temitters: [],\n\t\t\t\t}),\n\t\t\t)\n\t\t: Effect.void;\n\n/**\n * Codegen output root — the directory codegen owns and overwrites.\n * Pinned at boot time from the user's `defineDevstack` options\n * (default `./src/generated/` resolved against the app's cwd).\n *\n * Held as a service so emitters can yield it without a function\n * argument; mirrors the substrate's `RuntimeRoot` pattern.\n */\nexport interface CodegenRootShape {\n\t/** Absolute path to the output directory. The orchestrator\n\t * manages it; the user never writes here. */\n\treadonly outputDir: string;\n\t/** Optional per-stack subdirectory under `outputDir`. When set,\n\t * parallel stacks emit into sibling directories under the same\n\t * output root (distilled-doc §\"per-stack subdirectory\"). */\n\treadonly stackSubdir: string | null;\n}\n\nexport class CodegenRoot extends Context.Service<CodegenRoot, CodegenRootShape>()(\n\t'@devstack/orchestrator/CodegenRoot',\n) {}\n\n/** Build a `CodegenRoot` layer pinned to a literal path. */\nexport const layerCodegenRoot = (root: CodegenRootShape): Layer.Layer<CodegenRoot> =>\n\tLayer.succeed(CodegenRoot)(root);\n\n/** Closed bundle the resolver returns. Mirrors substrate `StackPaths`. */\nexport interface CodegenPaths {\n\t/** The directory the orchestrator emits into (after applying\n\t * per-stack subdirectory if configured). The watcher MUST\n\t * exclude this directory. */\n\treadonly outputDir: string;\n\t/** Path to the `.gitignore` inside `outputDir`. Written every\n\t * emit (the dir is gitignored). */\n\treadonly gitignoreFile: string;\n\t/** Subtree where Move-to-TS bindings land. */\n\treadonly bindingsDir: string;\n\t/** Per-process lock file gating `runEmitCycle`. Sibling to\n\t * `outputDir` so concurrent invocations (e.g. CLI direct-callers\n\t * racing the supervisor) serialize cleanly without blocking the\n\t * short-section substrate `stack.lock`. Codegen cycles can be\n\t * file-system heavy (multi-emitter, Move-bindings compilation);\n\t * the substrate lock is reserved for short sections per the\n\t * cross-process safety protocol. */\n\treadonly codegenLockFile: string;\n\t/** Helper: resolve an emitter's `outputPath` (e.g. `sui/network.ts`)\n\t * against the output root. Fails with `CodegenPathConflict({kind:\n\t * 'non-relative'})` if the supplied path escapes the root. */\n\treadonly resolve: (outputPath: string) => Effect.Effect<string, CodegenPathConflict>;\n\t/** Helper: resolve a per-package bindings subtree path. */\n\treadonly resolveBindingsPackage: (packageName: string) => string;\n\t/** Data-driven rebase: re-root the entire bundle at `newRoot`.\n\t * Preserves the layout (bindings under `<root>/bindings`, gitignore\n\t * at `<root>/.gitignore`) and the `..`-rejecting `resolve`\n\t * discipline; only the prefix changes. Used by the stage-and-swap\n\t * build to redirect the emit pipeline at the staging directory\n\t * WITHOUT string-surgery in the caller.\n\t *\n\t * Note: `codegenLockFile` is preserved verbatim — the lock is\n\t * acquired ONCE outside the staging build, so the rebased view\n\t * must still name the real lock path. */\n\treadonly withRoot: (newRoot: string) => CodegenPaths;\n}\n\nexport class CodegenPathsService extends Context.Service<CodegenPathsService, CodegenPaths>()(\n\t'@devstack/orchestrator/CodegenPaths',\n) {}\n\n/**\n * Materialize the resolver from `CodegenRoot` + Effect's `Path`\n * service. Stack subdir, if present, is appended:\n * `<outputDir>` or `<outputDir>/<stackSubdir>`.\n */\nexport const layerCodegenPaths: Layer.Layer<CodegenPathsService, never, CodegenRoot | Path.Path> =\n\tLayer.effect(\n\t\tCodegenPathsService,\n\t\tEffect.gen(function* () {\n\t\t\tconst root = yield* CodegenRoot;\n\t\t\tconst path = yield* Path.Path;\n\t\t\tconst outputDir = root.stackSubdir\n\t\t\t\t? path.join(root.outputDir, root.stackSubdir)\n\t\t\t\t: root.outputDir;\n\t\t\t// Sibling of `outputDir` (NOT inside it) so the stage-and-swap\n\t\t\t// rename never sees the lock file as part of the output tree.\n\t\t\t// Captured once at boot — `withRoot` re-roots the rest of the\n\t\t\t// bundle but preserves the original lock path so the rebased\n\t\t\t// view names the real cross-process lock (the lock is acquired\n\t\t\t// ONCE outside the staging build).\n\t\t\tconst codegenLockFile = `${outputDir}.codegen.lock`;\n\t\t\tconst buildAt = (atRoot: string): CodegenPaths => {\n\t\t\t\tconst bindingsDir = path.join(atRoot, 'bindings');\n\t\t\t\tconst resolve = (outputPath: string): Effect.Effect<string, CodegenPathConflict> =>\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tyield* assertRelativeCodegenOutputPath(outputPath);\n\t\t\t\t\t\treturn path.join(atRoot, outputPath);\n\t\t\t\t\t});\n\t\t\t\tconst resolveBindingsPackage = (packageName: string): string =>\n\t\t\t\t\tpath.join(bindingsDir, packageName);\n\t\t\t\tconst bundle: CodegenPaths = {\n\t\t\t\t\toutputDir: atRoot,\n\t\t\t\t\tgitignoreFile: path.join(atRoot, '.gitignore'),\n\t\t\t\t\tbindingsDir,\n\t\t\t\t\tcodegenLockFile,\n\t\t\t\t\tresolve,\n\t\t\t\t\tresolveBindingsPackage,\n\t\t\t\t\twithRoot: (newRoot: string) => buildAt(newRoot),\n\t\t\t\t};\n\t\t\t\treturn bundle;\n\t\t\t};\n\t\t\treturn CodegenPathsService.of(buildAt(outputDir));\n\t\t}),\n\t);\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,MAAa,mCACZ,eAEA,WAAW,SAAS,KAAK,IAAI,WAAW,WAAW,IAAI,GACpD,OAAO,KACP,IAAI,oBAAoB;CACvB,MAAM;CACN;CACA,UAAU,EAAE;CACZ,CAAC,CACF,GACA,OAAO;AAoBX,IAAa,cAAb,cAAiC,QAAQ,SAAwC,CAChF,qCACA,CAAC;;AAGF,MAAa,oBAAoB,SAChC,MAAM,QAAQ,YAAY,CAAC,KAAK;AAwCjC,IAAa,sBAAb,cAAyC,QAAQ,SAA4C,CAC5F,sCACA,CAAC;;;;;;AAOF,MAAa,oBACZ,MAAM,OACL,qBACA,OAAO,IAAI,aAAa;CACvB,MAAM,OAAO,OAAO;CACpB,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,YAAY,KAAK,cACpB,KAAK,KAAK,KAAK,WAAW,KAAK,YAAY,GAC3C,KAAK;CAOR,MAAM,kBAAkB,GAAG,UAAU;CACrC,MAAM,WAAW,WAAiC;EACjD,MAAM,cAAc,KAAK,KAAK,QAAQ,WAAW;EACjD,MAAM,WAAW,eAChB,OAAO,IAAI,aAAa;AACvB,UAAO,gCAAgC,WAAW;AAClD,UAAO,KAAK,KAAK,QAAQ,WAAW;IACnC;EACH,MAAM,0BAA0B,gBAC/B,KAAK,KAAK,aAAa,YAAY;AAUpC,SAAO;GARN,WAAW;GACX,eAAe,KAAK,KAAK,QAAQ,aAAa;GAC9C;GACA;GACA;GACA;GACA,WAAW,YAAoB,QAAQ,QAAQ;GAEnC;;AAEd,QAAO,oBAAoB,GAAG,QAAQ,UAAU,CAAC;EAChD,CACF"}
|
|
1
|
+
{"version":3,"file":"paths.mjs","names":[],"sources":["../../../src/orchestrators/codegen/paths.ts"],"sourcesContent":["// Codegen output-path layout.\n//\n// Distilled-doc § \"All outputs land under a single user-chosen\n// directory (default `./src/generated/`)\" + §\"Stable output paths\".\n// One file owns the layout so emitters never assemble paths by hand.\n//\n// Default root is `<appRoot>/src/generated/`. Tests and parallel\n// stacks pin a per-test root; the substrate's `RuntimeRoot` is for\n// engine-private state (~/.devstack/...), NOT for codegen output.\n// Codegen output lives in the USER's source tree.\n\nimport { Context, Effect, Layer, Path } from 'effect';\n\nimport { CodegenPathConflict } from './errors.ts';\n\n/** Guard plugin-authored `CodegenableDecl.outputPath` against `..`\n * traversal and absolute paths. Fails with a typed\n * `CodegenPathConflict({kind:'non-relative'})` — defense-in-depth\n * for the file-layout invariants. Called once inside `buildAt` so\n * both the root bundle and any `withRoot`-rebased view enforce the\n * same `..`-rejecting `resolve` discipline.\n *\n * POSIX-only: devstack runs on POSIX filesystems (substrate paths\n * are POSIX-shaped throughout), so this check intentionally inspects\n * only `/`-rooted absolutes and the `..` substring. A Windows-style\n * `'foo/bar\\\\..\\\\baz'` would slip past — that's accepted because\n * devstack never executes on a Windows runtime.\n *\n * STYLE_GUIDE §2 rule 5 — orchestrator failures are typed. */\nexport const assertRelativeCodegenOutputPath = (\n\toutputPath: string,\n): Effect.Effect<void, CodegenPathConflict> =>\n\toutputPath.includes('..') || outputPath.startsWith('/')\n\t\t? Effect.fail(\n\t\t\t\tnew CodegenPathConflict({\n\t\t\t\t\tkind: 'non-relative',\n\t\t\t\t\toutputPath,\n\t\t\t\t\temitters: [],\n\t\t\t\t}),\n\t\t\t)\n\t\t: Effect.void;\n\n/**\n * Codegen output root — the directory codegen owns and overwrites.\n * Pinned at boot time from the user's `defineDevstack` options\n * (default `./src/generated/` resolved against the app's cwd).\n *\n * Held as a service so emitters can yield it without a function\n * argument; mirrors the substrate's `RuntimeRoot` pattern.\n */\nexport interface CodegenRootShape {\n\t/** Absolute path to the output directory. The orchestrator\n\t * manages it; the user never writes here. */\n\treadonly outputDir: string;\n\t/** Optional per-stack subdirectory under `outputDir`. When set,\n\t * parallel stacks emit into sibling directories under the same\n\t * output root (distilled-doc §\"per-stack subdirectory\"). */\n\treadonly stackSubdir: string | null;\n\t/** Absolute path to the dev-only + secret `generated-extras` tree\n\t * (`.devstack/stacks/<stack>/generated-extras`). Decls / aggregates\n\t * with `outputLocation: 'generated-extras'` emit here. Outside the\n\t * staging-and-swap tree of `outputDir` — extras are gitignored and\n\t * written in place (no atomic swap), so warm restarts never churn\n\t * the runtime tree's mtimes. */\n\treadonly extrasDir: string;\n}\n\nexport class CodegenRoot extends Context.Service<CodegenRoot, CodegenRootShape>()(\n\t'@devstack/orchestrator/CodegenRoot',\n) {}\n\n/** Build a `CodegenRoot` layer pinned to a literal path. */\nexport const layerCodegenRoot = (root: CodegenRootShape): Layer.Layer<CodegenRoot> =>\n\tLayer.succeed(CodegenRoot)(root);\n\n/** Closed bundle the resolver returns. Mirrors substrate `StackPaths`. */\nexport interface CodegenPaths {\n\t/** The directory the orchestrator emits into (after applying\n\t * per-stack subdirectory if configured). The watcher MUST\n\t * exclude this directory. */\n\treadonly outputDir: string;\n\t/** Path to the `.gitignore` inside `outputDir`. Written every\n\t * emit (the dir is gitignored). */\n\treadonly gitignoreFile: string;\n\t/** Subtree where Move-to-TS bindings land. */\n\treadonly bindingsDir: string;\n\t/** Per-process lock file gating `runEmitCycle`. Sibling to\n\t * `outputDir` so concurrent invocations (e.g. CLI direct-callers\n\t * racing the supervisor) serialize cleanly without blocking the\n\t * short-section substrate `stack.lock`. Codegen cycles can be\n\t * file-system heavy (multi-emitter, Move-bindings compilation);\n\t * the substrate lock is reserved for short sections per the\n\t * cross-process safety protocol. */\n\treadonly codegenLockFile: string;\n\t/** The dev-only + secret `generated-extras` tree. Decls /\n\t * aggregates with `outputLocation: 'generated-extras'` resolve\n\t * against this. Preserved verbatim across `withRoot` — the extras\n\t * tree lives OUTSIDE the staging-and-swap of `outputDir`, so the\n\t * staging rebase must still name the real extras dir. */\n\treadonly extrasDir: string;\n\t/** Helper: resolve an emitter's `outputPath` (e.g. `config.ts`)\n\t * against the output root. Fails with `CodegenPathConflict({kind:\n\t * 'non-relative'})` if the supplied path escapes the root. */\n\treadonly resolve: (outputPath: string) => Effect.Effect<string, CodegenPathConflict>;\n\t/** Helper: resolve an emitter's `outputPath` against the\n\t * `generated-extras` tree (`extrasDir`). Same `..`-rejecting\n\t * discipline as `resolve`. */\n\treadonly resolveExtras: (outputPath: string) => Effect.Effect<string, CodegenPathConflict>;\n\t/** Helper: resolve a per-package bindings subtree path. */\n\treadonly resolveBindingsPackage: (packageName: string) => string;\n\t/** Data-driven rebase: re-root the entire bundle at `newRoot`.\n\t * Preserves the layout (bindings under `<root>/bindings`, gitignore\n\t * at `<root>/.gitignore`) and the `..`-rejecting `resolve`\n\t * discipline; only the prefix changes. Used by the stage-and-swap\n\t * build to redirect the emit pipeline at the staging directory\n\t * WITHOUT string-surgery in the caller.\n\t *\n\t * Note: `codegenLockFile` is preserved verbatim — the lock is\n\t * acquired ONCE outside the staging build, so the rebased view\n\t * must still name the real lock path. */\n\treadonly withRoot: (newRoot: string) => CodegenPaths;\n}\n\nexport class CodegenPathsService extends Context.Service<CodegenPathsService, CodegenPaths>()(\n\t'@devstack/orchestrator/CodegenPaths',\n) {}\n\n/**\n * Materialize the resolver from `CodegenRoot` + Effect's `Path`\n * service. Stack subdir, if present, is appended:\n * `<outputDir>` or `<outputDir>/<stackSubdir>`.\n */\nexport const layerCodegenPaths: Layer.Layer<CodegenPathsService, never, CodegenRoot | Path.Path> =\n\tLayer.effect(\n\t\tCodegenPathsService,\n\t\tEffect.gen(function* () {\n\t\t\tconst root = yield* CodegenRoot;\n\t\t\tconst path = yield* Path.Path;\n\t\t\tconst outputDir = root.stackSubdir\n\t\t\t\t? path.join(root.outputDir, root.stackSubdir)\n\t\t\t\t: root.outputDir;\n\t\t\t// Captured once at boot. Preserved verbatim through `withRoot`\n\t\t\t// (the extras tree is OUTSIDE the staging swap of `outputDir`,\n\t\t\t// so the rebased view must keep naming the real extras dir).\n\t\t\tconst extrasDir = root.extrasDir;\n\t\t\t// Lock the codegen subsystem on a sibling of `extrasDir`, NOT of\n\t\t\t// `outputDir`. At BOOT nothing is ever emitted into the live\n\t\t\t// `outputDir` (`generated`) tree — boot's only codegen write is\n\t\t\t// `emitExtras`, which lands in `extrasDir` — so deriving the lock\n\t\t\t// from `extrasDir` keeps the live `generated` basename entirely\n\t\t\t// out of the boot footprint (no phantom `…/generated.codegen.lock`\n\t\t\t// next to a directory that is never created). The `codegen` verb\n\t\t\t// (the one path that DOES stage into `<outputDir>.staging.<id>`)\n\t\t\t// still gets a stable sibling lock — `<extrasDir>.codegen.lock` —\n\t\t\t// outside both its `outputDir` swap and the `extrasDir` tree.\n\t\t\t// Sibling-NOT-inside is what matters for the stage-and-swap rename\n\t\t\t// of `outputDir`, and an `extrasDir` sibling satisfies that.\n\t\t\t// Captured once at boot — `withRoot` re-roots the rest of the\n\t\t\t// bundle but preserves this lock path verbatim so the rebased\n\t\t\t// staging view names the real cross-process lock (the lock is\n\t\t\t// acquired ONCE outside the staging build).\n\t\t\tconst codegenLockFile = `${extrasDir}.codegen.lock`;\n\t\t\tconst resolveExtras = (outputPath: string): Effect.Effect<string, CodegenPathConflict> =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tyield* assertRelativeCodegenOutputPath(outputPath);\n\t\t\t\t\treturn path.join(extrasDir, outputPath);\n\t\t\t\t});\n\t\t\tconst buildAt = (atRoot: string): CodegenPaths => {\n\t\t\t\tconst bindingsDir = path.join(atRoot, 'bindings');\n\t\t\t\tconst resolve = (outputPath: string): Effect.Effect<string, CodegenPathConflict> =>\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tyield* assertRelativeCodegenOutputPath(outputPath);\n\t\t\t\t\t\treturn path.join(atRoot, outputPath);\n\t\t\t\t\t});\n\t\t\t\tconst resolveBindingsPackage = (packageName: string): string =>\n\t\t\t\t\tpath.join(bindingsDir, packageName);\n\t\t\t\tconst bundle: CodegenPaths = {\n\t\t\t\t\toutputDir: atRoot,\n\t\t\t\t\tgitignoreFile: path.join(atRoot, '.gitignore'),\n\t\t\t\t\tbindingsDir,\n\t\t\t\t\tcodegenLockFile,\n\t\t\t\t\textrasDir,\n\t\t\t\t\tresolve,\n\t\t\t\t\tresolveExtras,\n\t\t\t\t\tresolveBindingsPackage,\n\t\t\t\t\twithRoot: (newRoot: string) => buildAt(newRoot),\n\t\t\t\t};\n\t\t\t\treturn bundle;\n\t\t\t};\n\t\t\treturn CodegenPathsService.of(buildAt(outputDir));\n\t\t}),\n\t);\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,MAAa,mCACZ,eAEA,WAAW,SAAS,IAAI,KAAK,WAAW,WAAW,GAAG,IACnD,OAAO,KACP,IAAI,oBAAoB;CACvB,MAAM;CACN;CACA,UAAU,CAAC;AACZ,CAAC,CACF,IACC,OAAO;AA2BX,IAAa,cAAb,cAAiC,QAAQ,QAAuC,CAAC,CAChF,oCACD,CAAC,CAAC,CAAC;;AAGH,MAAa,oBAAoB,SAChC,MAAM,QAAQ,WAAW,CAAC,CAAC,IAAI;AAkDhC,IAAa,sBAAb,cAAyC,QAAQ,QAA2C,CAAC,CAC5F,qCACD,CAAC,CAAC,CAAC;;;;;;AAOH,MAAa,oBACZ,MAAM,OACL,qBACA,OAAO,IAAI,aAAa;CACvB,MAAM,OAAO,OAAO;CACpB,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,YAAY,KAAK,cACpB,KAAK,KAAK,KAAK,WAAW,KAAK,WAAW,IAC1C,KAAK;CAIR,MAAM,YAAY,KAAK;CAiBvB,MAAM,kBAAkB,GAAG,UAAU;CACrC,MAAM,iBAAiB,eACtB,OAAO,IAAI,aAAa;EACvB,OAAO,gCAAgC,UAAU;EACjD,OAAO,KAAK,KAAK,WAAW,UAAU;CACvC,CAAC;CACF,MAAM,WAAW,WAAiC;EACjD,MAAM,cAAc,KAAK,KAAK,QAAQ,UAAU;EAChD,MAAM,WAAW,eAChB,OAAO,IAAI,aAAa;GACvB,OAAO,gCAAgC,UAAU;GACjD,OAAO,KAAK,KAAK,QAAQ,UAAU;EACpC,CAAC;EACF,MAAM,0BAA0B,gBAC/B,KAAK,KAAK,aAAa,WAAW;EAYnC,OAAO;GAVN,WAAW;GACX,eAAe,KAAK,KAAK,QAAQ,YAAY;GAC7C;GACA;GACA;GACA;GACA;GACA;GACA,WAAW,YAAoB,QAAQ,OAAO;EAEnC;CACb;CACA,OAAO,oBAAoB,GAAG,QAAQ,SAAS,CAAC;AACjD,CAAC,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.mjs","names":[],"sources":["../../../src/orchestrators/codegen/permissions.ts"],"sourcesContent":["// Permission policy for codegen-emitted files.\n//\n// Distilled-doc § \"Sensitive emitted files have restrictive\n// filesystem permissions, re-applied on every emit (not just on\n// create) to recover from manual chmods\". The orchestrator hands the\n// emit/swap layer the mode it should apply.\n//\n// Two-axis policy:\n// - `sensitive: true` → 0o600 (rw user only).\n// - `sensitive: false` → 0o644 (rw user, r world).\n// The parent directory the emit lives in inherits the strictest\n// sensitivity of any file inside it — 0o700 when any file is\n// sensitive, 0o755 otherwise. The orchestrator applies parent mode\n// at swap time, separate from per-file modes.\n\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\n\nexport const SENSITIVE_FILE_MODE = 0o600;\nexport const NON_SENSITIVE_FILE_MODE = 0o644;\nexport const SENSITIVE_DIR_MODE = 0o700;\nexport const NON_SENSITIVE_DIR_MODE = 0o755;\n\n/** File mode for one codegen contribution. */\nexport const modeFor = (decl: Pick<CodegenableDecl, 'sensitive'>): number =>\n\tdecl.sensitive === true ? SENSITIVE_FILE_MODE : NON_SENSITIVE_FILE_MODE;\n\n/** Parent-directory mode given a set of contributions inside it. */\nexport const dirModeFor = (decls: ReadonlyArray<Pick<CodegenableDecl, 'sensitive'>>): number =>\n\tdecls.some((d) => d.sensitive === true) ? SENSITIVE_DIR_MODE : NON_SENSITIVE_DIR_MODE;\n\n/** True if ANY contribution in the set is sensitive — gates the\n * `.gitignore` \"cover by default\" rule and the parent-mode policy. */\nexport const anySensitive = (decls: ReadonlyArray<Pick<CodegenableDecl, 'sensitive'>>): boolean =>\n\tdecls.some((d) => d.sensitive === true);\n"],"mappings":";AAuBA,MAAa,WAAW,SACvB,KAAK,cAAc,OAAA,MAAA;;AAGpB,MAAa,cAAc,UAC1B,MAAM,MAAM,MAAM,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"permissions.mjs","names":[],"sources":["../../../src/orchestrators/codegen/permissions.ts"],"sourcesContent":["// Permission policy for codegen-emitted files.\n//\n// Distilled-doc § \"Sensitive emitted files have restrictive\n// filesystem permissions, re-applied on every emit (not just on\n// create) to recover from manual chmods\". The orchestrator hands the\n// emit/swap layer the mode it should apply.\n//\n// Two-axis policy:\n// - `sensitive: true` → 0o600 (rw user only).\n// - `sensitive: false` → 0o644 (rw user, r world).\n// The parent directory the emit lives in inherits the strictest\n// sensitivity of any file inside it — 0o700 when any file is\n// sensitive, 0o755 otherwise. The orchestrator applies parent mode\n// at swap time, separate from per-file modes.\n\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\n\nexport const SENSITIVE_FILE_MODE = 0o600;\nexport const NON_SENSITIVE_FILE_MODE = 0o644;\nexport const SENSITIVE_DIR_MODE = 0o700;\nexport const NON_SENSITIVE_DIR_MODE = 0o755;\n\n/** File mode for one codegen contribution. */\nexport const modeFor = (decl: Pick<CodegenableDecl, 'sensitive'>): number =>\n\tdecl.sensitive === true ? SENSITIVE_FILE_MODE : NON_SENSITIVE_FILE_MODE;\n\n/** Parent-directory mode given a set of contributions inside it. */\nexport const dirModeFor = (decls: ReadonlyArray<Pick<CodegenableDecl, 'sensitive'>>): number =>\n\tdecls.some((d) => d.sensitive === true) ? SENSITIVE_DIR_MODE : NON_SENSITIVE_DIR_MODE;\n\n/** True if ANY contribution in the set is sensitive — gates the\n * `.gitignore` \"cover by default\" rule and the parent-mode policy. */\nexport const anySensitive = (decls: ReadonlyArray<Pick<CodegenableDecl, 'sensitive'>>): boolean =>\n\tdecls.some((d) => d.sensitive === true);\n"],"mappings":";AAuBA,MAAa,WAAW,SACvB,KAAK,cAAc,OAAA,MAAA;;AAGpB,MAAa,cAAc,UAC1B,MAAM,MAAM,MAAM,EAAE,cAAc,IAAI,IAAA,MAAA"}
|