@mysten-incubation/devstack 0.0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/dashboard-ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dashboard-ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dashboard-ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dashboard-ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-cyrillic-ext-wght-normal-I4S5GZfc.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-cyrillic-wght-normal-BmXc_FBt.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-latin-ext-wght-normal-DrnZ1wKl.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-latin-wght-normal-B_7UjwxQ.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-symbols2-wght-normal-GZpp1pK2.woff2 +0 -0
- package/dashboard-ui/assets/geist-mono-vietnamese-wght-normal-D8KDMBhC.woff2 +0 -0
- package/dashboard-ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dashboard-ui/assets/index-Bmi1UtAg.js +1356 -0
- package/dashboard-ui/assets/index-D5EShVt4.js +3 -0
- package/dashboard-ui/assets/index-Deml9drg.css +1 -0
- package/dashboard-ui/index.html +13 -0
- package/dist/api/define-capabilities.d.mts +14 -3
- package/dist/api/define-capabilities.mjs +18 -1
- package/dist/api/define-capabilities.mjs.map +1 -1
- package/dist/api/define-devstack.d.mts +1 -1
- package/dist/api/define-devstack.mjs +6 -26
- package/dist/api/define-devstack.mjs.map +1 -1
- package/dist/api/define-plugin.d.mts +1 -0
- package/dist/api/define-plugin.mjs +2 -0
- package/dist/api/inference-network.d.mts +132 -0
- package/dist/api/inference-network.mjs +105 -16
- package/dist/api/inference-network.mjs.map +1 -1
- package/dist/api/plugin-errors.d.mts +7 -0
- package/dist/api/run-stack.d.mts +20 -9
- package/dist/api/run-stack.mjs +56 -29
- package/dist/api/run-stack.mjs.map +1 -1
- package/dist/build-integrations/playwright/config.d.mts +6 -4
- package/dist/build-integrations/playwright/config.mjs +5 -3
- package/dist/build-integrations/playwright/config.mjs.map +1 -1
- package/dist/build-integrations/playwright/errors.d.mts +1 -1
- package/dist/build-integrations/playwright/global-setup.d.mts +43 -17
- package/dist/build-integrations/playwright/global-setup.mjs +250 -13
- package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
- package/dist/build-integrations/playwright/index.d.mts +5 -3
- package/dist/build-integrations/playwright/index.mjs +4 -2
- package/dist/build-integrations/playwright/stack-context.d.mts +0 -1
- package/dist/build-integrations/playwright/stack-context.mjs +24 -63
- package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
- package/dist/build-integrations/playwright/wallet-context.d.mts +7 -10
- package/dist/build-integrations/playwright/wallet-context.mjs +8 -13
- package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
- package/dist/build-integrations/runtime/cold-start-url.d.mts +5 -0
- package/dist/build-integrations/runtime/cold-start-url.mjs +4 -3
- package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
- package/dist/build-integrations/runtime/conventional-routes.d.mts +51 -0
- package/dist/build-integrations/runtime/conventional-routes.mjs +92 -0
- package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -0
- package/dist/build-integrations/runtime/discover.d.mts +38 -30
- package/dist/build-integrations/runtime/discover.mjs +73 -70
- package/dist/build-integrations/runtime/discover.mjs.map +1 -1
- package/dist/build-integrations/runtime/endpoint-registry.d.mts +3 -1
- package/dist/build-integrations/runtime/endpoint-registry.mjs +3 -1
- package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
- package/dist/build-integrations/runtime/index.d.mts +7 -2
- package/dist/build-integrations/runtime/index.mjs +9 -2
- package/dist/build-integrations/runtime/manifest-types.d.mts +2 -0
- package/dist/build-integrations/runtime/manifest-types.mjs +3 -0
- package/dist/build-integrations/runtime/playwright-stack-context-slot.d.mts +29 -0
- package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs +10 -0
- package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs.map +1 -0
- package/dist/build-integrations/runtime/read-stack-context.d.mts +1 -1
- package/dist/build-integrations/runtime/read-stack-context.mjs +10 -4
- package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
- package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +48 -0
- package/dist/build-integrations/runtime/resolve-discovery-env.mjs +42 -0
- package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -0
- package/dist/build-integrations/runtime/stack-context.d.mts +1 -1
- package/dist/build-integrations/runtime/wallet-paths.mjs +2 -0
- package/dist/build-integrations/vite/index.d.mts +51 -0
- package/dist/build-integrations/vite/index.mjs +73 -0
- package/dist/build-integrations/vite/index.mjs.map +1 -0
- package/dist/build-integrations/vitest/env.d.mts +4 -3
- package/dist/build-integrations/vitest/env.mjs +6 -4
- package/dist/build-integrations/vitest/env.mjs.map +1 -1
- package/dist/build-integrations/vitest/errors.d.mts +25 -4
- package/dist/build-integrations/vitest/errors.mjs +15 -2
- package/dist/build-integrations/vitest/errors.mjs.map +1 -1
- package/dist/build-integrations/vitest/index.d.mts +2 -2
- package/dist/build-integrations/vitest/index.mjs +3 -3
- package/dist/build-integrations/vitest/setup.d.mts +4 -2
- package/dist/build-integrations/vitest/setup.mjs +2 -2
- package/dist/build-integrations/vitest/setup.mjs.map +1 -1
- package/dist/build-integrations/vitest/stack-context.d.mts +0 -1
- package/dist/build-integrations/vitest/stack-context.mjs +33 -13
- package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
- package/dist/cli/bail.mjs +23 -0
- package/dist/cli/bail.mjs.map +1 -0
- package/dist/{surfaces/cli/commands → cli}/doctor-probes.mjs +26 -16
- package/dist/cli/doctor-probes.mjs.map +1 -0
- package/dist/cli/main.d.mts +15 -1
- package/dist/cli/main.mjs +166 -482
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/prune-direct.mjs +31 -201
- package/dist/cli/prune-direct.mjs.map +1 -1
- package/dist/cli/snapshot-reader.mjs +14 -11
- package/dist/cli/snapshot-reader.mjs.map +1 -1
- package/dist/cli/up-lifecycle.mjs +4 -1
- package/dist/cli/up-lifecycle.mjs.map +1 -1
- package/dist/cli/wirings/apply.mjs +95 -0
- package/dist/cli/wirings/apply.mjs.map +1 -0
- package/dist/cli/wirings/build-verb-layers.mjs +42 -0
- package/dist/cli/wirings/build-verb-layers.mjs.map +1 -0
- package/dist/cli/wirings/config-loader.mjs +69 -0
- package/dist/cli/wirings/config-loader.mjs.map +1 -0
- package/dist/cli/wirings/engine-command.mjs +30 -0
- package/dist/cli/wirings/engine-command.mjs.map +1 -0
- package/dist/cli/wirings/identity.mjs +72 -0
- package/dist/cli/wirings/identity.mjs.map +1 -0
- package/dist/cli/wirings/provide-file-system.mjs +7 -0
- package/dist/cli/wirings/provide-file-system.mjs.map +1 -0
- package/dist/cli/wirings/snapshot.mjs +177 -0
- package/dist/cli/wirings/snapshot.mjs.map +1 -0
- package/dist/cli/wirings/up.mjs +287 -0
- package/dist/cli/wirings/up.mjs.map +1 -0
- package/dist/cli/wirings/wipe.mjs +40 -0
- package/dist/cli/wirings/wipe.mjs.map +1 -0
- package/dist/contracts/capability-decl.d.mts +0 -2
- package/dist/contracts/codegenable.d.mts +43 -0
- package/dist/contracts/container-runtime.d.mts +26 -1
- package/dist/contracts/faucet-strategy.d.mts +25 -0
- package/dist/contracts/funding-strategy.d.mts +42 -0
- package/dist/contracts/plugin-expander.mjs +60 -0
- package/dist/contracts/plugin-expander.mjs.map +1 -0
- package/dist/contracts/projection.d.mts +5 -3
- package/dist/contracts/renderer.d.mts +23 -0
- package/dist/contracts/routable.d.mts +14 -1
- package/dist/contracts/snapshotable.d.mts +25 -3
- package/dist/contracts/wallet-protocol.d.mts +52 -0
- package/dist/contracts/wallet-protocol.mjs +52 -0
- package/dist/contracts/wallet-protocol.mjs.map +1 -0
- package/dist/index.d.mts +26 -25
- package/dist/index.mjs +20 -13
- package/dist/{runtime → orchestrators}/built-in-plugin-layers.mjs +10 -5
- package/dist/orchestrators/built-in-plugin-layers.mjs.map +1 -0
- package/dist/orchestrators/codegen/bindings.d.mts +1 -2
- package/dist/orchestrators/codegen/bindings.mjs +52 -186
- package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
- package/dist/orchestrators/codegen/emit.mjs +19 -1
- package/dist/orchestrators/codegen/emit.mjs.map +1 -1
- package/dist/orchestrators/codegen/errors.mjs +8 -3
- package/dist/orchestrators/codegen/errors.mjs.map +1 -1
- package/dist/orchestrators/codegen/format.mjs +47 -39
- package/dist/orchestrators/codegen/format.mjs.map +1 -1
- package/dist/orchestrators/codegen/gitignore.mjs +3 -1
- package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
- package/dist/orchestrators/codegen/output-location.mjs +41 -0
- package/dist/orchestrators/codegen/output-location.mjs.map +1 -0
- package/dist/orchestrators/codegen/paths.d.mts +1 -1
- package/dist/orchestrators/codegen/paths.mjs +40 -14
- package/dist/orchestrators/codegen/paths.mjs.map +1 -1
- package/dist/orchestrators/codegen/permissions.mjs +3 -1
- package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
- package/dist/orchestrators/codegen/service.mjs +157 -105
- package/dist/orchestrators/codegen/service.mjs.map +1 -1
- package/dist/orchestrators/lifecycle-prune/errors.mjs +31 -0
- package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -0
- package/dist/orchestrators/lifecycle-prune/index.mjs +350 -0
- package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -0
- package/dist/orchestrators/router/cleanup.mjs +26 -27
- package/dist/orchestrators/router/cleanup.mjs.map +1 -1
- package/dist/orchestrators/router/entrypoints.mjs +2 -2
- package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
- package/dist/orchestrators/router/file-provider.mjs +14 -5
- package/dist/orchestrators/router/file-provider.mjs.map +1 -1
- package/dist/orchestrators/router/hostname.mjs +19 -55
- package/dist/orchestrators/router/hostname.mjs.map +1 -1
- package/dist/orchestrators/router/index.mjs +11 -0
- package/dist/orchestrators/router/profile.mjs +2 -2
- package/dist/orchestrators/router/sentinels.mjs +26 -0
- package/dist/orchestrators/router/sentinels.mjs.map +1 -0
- package/dist/orchestrators/router/service.mjs +40 -37
- package/dist/orchestrators/router/service.mjs.map +1 -1
- package/dist/orchestrators/router/traefik-container.mjs +27 -16
- package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
- package/dist/{substrate/runtime → orchestrators}/run.mjs +26 -21
- package/dist/orchestrators/run.mjs.map +1 -0
- package/dist/orchestrators/runtime-composition.d.mts +1 -1
- package/dist/orchestrators/runtime-composition.mjs +123 -39
- package/dist/orchestrators/runtime-composition.mjs.map +1 -1
- package/dist/orchestrators/snapshot/capture-command.d.mts +1 -0
- package/dist/orchestrators/snapshot/capture-command.mjs +25 -0
- package/dist/orchestrators/snapshot/capture-command.mjs.map +1 -0
- package/dist/orchestrators/snapshot/capture.mjs +42 -28
- package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
- package/dist/orchestrators/snapshot/descriptor.mjs +35 -10
- package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
- package/dist/orchestrators/snapshot/identity-guard.mjs +1 -1
- package/dist/orchestrators/snapshot/index.mjs +13 -0
- package/dist/orchestrators/snapshot/integrity.d.mts +1 -1
- package/dist/orchestrators/snapshot/integrity.mjs +73 -17
- package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
- package/dist/orchestrators/snapshot/pending-marker.d.mts +1 -0
- package/dist/orchestrators/snapshot/pending-marker.mjs +99 -0
- package/dist/orchestrators/snapshot/pending-marker.mjs.map +1 -0
- package/dist/orchestrators/snapshot/phase-error.mjs +23 -0
- package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -0
- package/dist/orchestrators/snapshot/prune.mjs +20 -55
- package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
- package/dist/orchestrators/snapshot/recover-pending.d.mts +1 -0
- package/dist/orchestrators/snapshot/recover-pending.mjs +223 -0
- package/dist/orchestrators/snapshot/recover-pending.mjs.map +1 -0
- package/dist/orchestrators/snapshot/restore.mjs +118 -84
- package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
- package/dist/orchestrators/snapshot/service.mjs +53 -56
- package/dist/orchestrators/snapshot/service.mjs.map +1 -1
- package/dist/orchestrators/snapshot/state-document.d.mts +1 -0
- package/dist/orchestrators/snapshot/state-document.mjs +47 -7
- package/dist/orchestrators/snapshot/state-document.mjs.map +1 -1
- package/dist/orchestrators/snapshot/wipe.mjs +67 -10
- package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
- package/dist/plugins/account/codegen.mjs +9 -8
- package/dist/plugins/account/codegen.mjs.map +1 -1
- package/dist/plugins/account/errors.d.mts +33 -6
- package/dist/plugins/account/errors.mjs.map +1 -1
- package/dist/plugins/account/funding.d.mts +29 -19
- package/dist/plugins/account/funding.mjs +84 -66
- package/dist/plugins/account/funding.mjs.map +1 -1
- package/dist/plugins/account/index.d.mts +2 -4
- package/dist/plugins/account/index.mjs +64 -31
- package/dist/plugins/account/index.mjs.map +1 -1
- package/dist/plugins/account/keypair.mjs +6 -9
- package/dist/plugins/account/keypair.mjs.map +1 -1
- package/dist/plugins/account/lease.mjs +1 -0
- package/dist/plugins/account/lease.mjs.map +1 -1
- package/dist/plugins/account/registry.d.mts +14 -1
- package/dist/plugins/account/registry.mjs +18 -18
- package/dist/plugins/account/registry.mjs.map +1 -1
- package/dist/plugins/account/service.d.mts +23 -4
- package/dist/plugins/account/service.mjs +83 -45
- package/dist/plugins/account/service.mjs.map +1 -1
- package/dist/plugins/account/snapshot.mjs +2 -5
- package/dist/plugins/account/snapshot.mjs.map +1 -1
- package/dist/plugins/account/spans.mjs +16 -0
- package/dist/plugins/account/spans.mjs.map +1 -0
- package/dist/plugins/account/variants/keystore.mjs +6 -8
- package/dist/plugins/account/variants/keystore.mjs.map +1 -1
- package/dist/plugins/action/build-context.d.mts +3 -2
- package/dist/plugins/action/errors.d.mts +16 -12
- package/dist/plugins/action/errors.mjs.map +1 -1
- package/dist/plugins/action/execute.mjs +65 -103
- package/dist/plugins/action/execute.mjs.map +1 -1
- package/dist/plugins/action/index.d.mts +0 -2
- package/dist/plugins/action/index.mjs +17 -13
- package/dist/plugins/action/index.mjs.map +1 -1
- package/dist/plugins/action/service.mjs +38 -35
- package/dist/plugins/action/service.mjs.map +1 -1
- package/dist/plugins/action/spans.mjs +11 -0
- package/dist/plugins/action/spans.mjs.map +1 -0
- package/dist/plugins/coin/codegen.mjs +9 -8
- package/dist/plugins/coin/codegen.mjs.map +1 -1
- package/dist/plugins/coin/discovery.mjs +8 -4
- package/dist/plugins/coin/discovery.mjs.map +1 -1
- package/dist/plugins/coin/index.d.mts +11 -29
- package/dist/plugins/coin/index.mjs +56 -27
- package/dist/plugins/coin/index.mjs.map +1 -1
- package/dist/plugins/coin/metadata.mjs +8 -15
- package/dist/plugins/coin/metadata.mjs.map +1 -1
- package/dist/plugins/coin/mint.d.mts +30 -11
- package/dist/plugins/coin/mint.mjs +78 -74
- package/dist/plugins/coin/mint.mjs.map +1 -1
- package/dist/plugins/coin/registry.mjs +4 -7
- package/dist/plugins/coin/registry.mjs.map +1 -1
- package/dist/plugins/coin/service.d.mts +39 -1
- package/dist/plugins/coin/service.mjs +11 -4
- package/dist/plugins/coin/service.mjs.map +1 -1
- package/dist/plugins/coin/spans.mjs +20 -0
- package/dist/plugins/coin/spans.mjs.map +1 -0
- package/dist/plugins/dashboard/domain.mjs +402 -0
- package/dist/plugins/dashboard/domain.mjs.map +1 -0
- package/dist/plugins/dashboard/index.d.mts +29 -0
- package/dist/plugins/dashboard/index.mjs +91 -0
- package/dist/plugins/dashboard/index.mjs.map +1 -0
- package/dist/plugins/dashboard/origin-policy.mjs +36 -0
- package/dist/plugins/dashboard/origin-policy.mjs.map +1 -0
- package/dist/plugins/dashboard/routable.mjs +27 -0
- package/dist/plugins/dashboard/routable.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/builder.mjs +21 -0
- package/dist/plugins/dashboard/schema/builder.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/enums.mjs +72 -0
- package/dist/plugins/dashboard/schema/enums.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/root.mjs +351 -0
- package/dist/plugins/dashboard/schema/root.mjs.map +1 -0
- package/dist/plugins/dashboard/schema/types.mjs +508 -0
- package/dist/plugins/dashboard/schema/types.mjs.map +1 -0
- package/dist/plugins/dashboard/schema.mjs +11 -0
- package/dist/plugins/dashboard/schema.mjs.map +1 -0
- package/dist/plugins/dashboard/server.mjs +166 -0
- package/dist/plugins/dashboard/server.mjs.map +1 -0
- package/dist/plugins/deepbook/deploy.mjs +53 -115
- package/dist/plugins/deepbook/deploy.mjs.map +1 -1
- package/dist/plugins/deepbook/errors.mjs +1 -0
- package/dist/plugins/deepbook/errors.mjs.map +1 -1
- package/dist/plugins/deepbook/faucet-strategy.mjs +47 -34
- package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
- package/dist/plugins/deepbook/hash.mjs +9 -0
- package/dist/plugins/deepbook/hash.mjs.map +1 -0
- package/dist/plugins/deepbook/index.d.mts +1 -10
- package/dist/plugins/deepbook/index.mjs +25 -22
- package/dist/plugins/deepbook/index.mjs.map +1 -1
- package/dist/plugins/deepbook/pyth/index.mjs +26 -55
- package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
- package/dist/plugins/deepbook/snapshot.mjs +17 -29
- package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
- package/dist/plugins/deepbook/spans.mjs +18 -0
- package/dist/plugins/deepbook/spans.mjs.map +1 -0
- package/dist/plugins/deepbook/type-strings.mjs +65 -0
- package/dist/plugins/deepbook/type-strings.mjs.map +1 -0
- package/dist/plugins/deepbook/types.d.mts +2 -3
- package/dist/plugins/deepbook/types.mjs.map +1 -1
- package/dist/plugins/faucet/dispatcher.d.mts +21 -2
- package/dist/plugins/faucet/dispatcher.mjs +1 -2
- package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
- package/dist/plugins/faucet/errors.d.mts +11 -24
- package/dist/plugins/faucet/errors.mjs.map +1 -1
- package/dist/plugins/faucet/http.mjs +33 -14
- package/dist/plugins/faucet/http.mjs.map +1 -1
- package/dist/plugins/faucet/index.d.mts +15 -5
- package/dist/plugins/faucet/index.mjs +3 -0
- package/dist/plugins/faucet/index.mjs.map +1 -1
- package/dist/plugins/faucet/spans.mjs +12 -0
- package/dist/plugins/faucet/spans.mjs.map +1 -0
- package/dist/plugins/host-service/errors.d.mts +1 -1
- package/dist/plugins/host-service/index.mjs +34 -8
- package/dist/plugins/host-service/index.mjs.map +1 -1
- package/dist/plugins/host-service/routable.mjs +2 -1
- package/dist/plugins/host-service/routable.mjs.map +1 -1
- package/dist/plugins/host-service/service.d.mts +21 -0
- package/dist/plugins/host-service/service.mjs +136 -81
- package/dist/plugins/host-service/service.mjs.map +1 -1
- package/dist/plugins/internal/acquire-on-chain-artifact.mjs +23 -0
- package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -0
- package/dist/plugins/internal/codegen-helpers.mjs +18 -0
- package/dist/plugins/internal/codegen-helpers.mjs.map +1 -0
- package/dist/plugins/internal/funding-failure-error.mjs +32 -0
- package/dist/plugins/internal/funding-failure-error.mjs.map +1 -0
- package/dist/plugins/package/build.mjs +1 -1
- package/dist/plugins/package/build.mjs.map +1 -1
- package/dist/plugins/package/codegen.mjs +26 -0
- package/dist/plugins/package/codegen.mjs.map +1 -1
- package/dist/plugins/package/errors.d.mts +16 -6
- package/dist/plugins/package/errors.mjs.map +1 -1
- package/dist/plugins/package/index.d.mts +0 -4
- package/dist/plugins/package/index.mjs +27 -21
- package/dist/plugins/package/index.mjs.map +1 -1
- package/dist/plugins/package/mode-known.mjs +26 -12
- package/dist/plugins/package/mode-known.mjs.map +1 -1
- package/dist/plugins/package/mode-local.mjs +47 -41
- package/dist/plugins/package/mode-local.mjs.map +1 -1
- package/dist/plugins/package/publish-executor.mjs +55 -114
- package/dist/plugins/package/publish-executor.mjs.map +1 -1
- package/dist/plugins/package/registry.mjs +2 -1
- package/dist/plugins/package/registry.mjs.map +1 -1
- package/dist/plugins/package/service.mjs.map +1 -1
- package/dist/plugins/package/spans.mjs +14 -0
- package/dist/plugins/package/spans.mjs.map +1 -0
- package/dist/plugins/postgres/db-ensure.mjs +19 -12
- package/dist/plugins/postgres/db-ensure.mjs.map +1 -1
- package/dist/plugins/postgres/errors.d.mts +5 -0
- package/dist/plugins/postgres/errors.mjs.map +1 -1
- package/dist/plugins/postgres/index.mjs +10 -17
- package/dist/plugins/postgres/index.mjs.map +1 -1
- package/dist/plugins/postgres/service.mjs +58 -24
- package/dist/plugins/postgres/service.mjs.map +1 -1
- package/dist/plugins/postgres/snapshot.mjs.map +1 -1
- package/dist/plugins/postgres/spans.mjs +11 -0
- package/dist/plugins/postgres/spans.mjs.map +1 -0
- package/dist/plugins/router-entrypoints.mjs +4 -4
- package/dist/plugins/router-entrypoints.mjs.map +1 -1
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +15 -13
- package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +15 -19
- package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
- package/dist/plugins/seal/codegen.d.mts +2 -3
- package/dist/plugins/seal/codegen.mjs.map +1 -1
- package/dist/plugins/seal/config-render.mjs +35 -8
- package/dist/plugins/seal/config-render.mjs.map +1 -1
- package/dist/plugins/seal/deploy.mjs +31 -39
- package/dist/plugins/seal/deploy.mjs.map +1 -1
- package/dist/plugins/seal/errors.d.mts +1 -3
- package/dist/plugins/seal/errors.mjs +7 -1
- package/dist/plugins/seal/errors.mjs.map +1 -1
- package/dist/plugins/seal/index.d.mts +1 -6
- package/dist/plugins/seal/index.mjs +40 -14
- package/dist/plugins/seal/index.mjs.map +1 -1
- package/dist/plugins/seal/key-manager.d.mts +1 -9
- package/dist/plugins/seal/key-manager.mjs +2 -18
- package/dist/plugins/seal/key-manager.mjs.map +1 -1
- package/dist/plugins/seal/key-server.mjs +37 -36
- package/dist/plugins/seal/key-server.mjs.map +1 -1
- package/dist/plugins/seal/keygen.mjs +16 -17
- package/dist/plugins/seal/keygen.mjs.map +1 -1
- package/dist/plugins/seal/mode/fork-known.mjs +36 -14
- package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
- package/dist/plugins/seal/mode/live.d.mts +6 -4
- package/dist/plugins/seal/mode/live.mjs +14 -21
- package/dist/plugins/seal/mode/live.mjs.map +1 -1
- package/dist/plugins/seal/mode/local-keygen.mjs +57 -21
- package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
- package/dist/plugins/seal/registry-publish.mjs +1 -0
- package/dist/plugins/seal/registry-publish.mjs.map +1 -1
- package/dist/plugins/seal/routable.mjs.map +1 -1
- package/dist/plugins/seal/service.mjs.map +1 -1
- package/dist/plugins/seal/spans.mjs +18 -0
- package/dist/plugins/seal/spans.mjs.map +1 -0
- package/dist/plugins/sui/auto-tick.mjs +17 -23
- package/dist/plugins/sui/auto-tick.mjs.map +1 -1
- package/dist/plugins/sui/chain-build-container.mjs +18 -0
- package/dist/plugins/sui/chain-build-container.mjs.map +1 -0
- package/dist/plugins/sui/chain-probe.d.mts +5 -5
- package/dist/plugins/sui/chain-probe.mjs +28 -58
- package/dist/plugins/sui/chain-probe.mjs.map +1 -1
- package/dist/plugins/sui/codegen.mjs +26 -0
- package/dist/plugins/sui/codegen.mjs.map +1 -1
- package/dist/plugins/sui/errors.d.mts +2 -29
- package/dist/plugins/sui/errors.mjs +1 -3
- package/dist/plugins/sui/errors.mjs.map +1 -1
- package/dist/plugins/sui/fork-faucet-strategy.d.mts +1 -0
- package/dist/plugins/sui/fork-faucet-strategy.mjs +55 -0
- package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -0
- package/dist/plugins/sui/fork-orchestration.d.mts +1 -0
- package/dist/plugins/sui/fork-orchestration.mjs +170 -2
- package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
- package/dist/plugins/sui/fork-transaction.d.mts +2 -0
- package/dist/plugins/sui/fork-transaction.mjs +92 -28
- package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
- package/dist/plugins/sui/index.d.mts +33 -70
- package/dist/plugins/sui/index.mjs +58 -35
- package/dist/plugins/sui/index.mjs.map +1 -1
- package/dist/plugins/{faucet/strategies/sui-local.mjs → sui/local-faucet-strategy.mjs} +10 -7
- package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -0
- package/dist/plugins/sui/mode/external.mjs +7 -13
- package/dist/plugins/sui/mode/external.mjs.map +1 -1
- package/dist/plugins/sui/mode/fork.mjs +136 -59
- package/dist/plugins/sui/mode/fork.mjs.map +1 -1
- package/dist/plugins/sui/mode/live.mjs +10 -16
- package/dist/plugins/sui/mode/live.mjs.map +1 -1
- package/dist/plugins/sui/mode/local.mjs +37 -36
- package/dist/plugins/sui/mode/local.mjs.map +1 -1
- package/dist/plugins/sui/mode/shared-boot.mjs +38 -115
- package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
- package/dist/plugins/sui/mode/shared.d.mts +1 -5
- package/dist/plugins/sui/mode/shared.mjs.map +1 -1
- package/dist/plugins/sui/mode/spec.d.mts +18 -0
- package/dist/plugins/sui/move-summary-runner.mjs +207 -0
- package/dist/plugins/sui/move-summary-runner.mjs.map +1 -0
- package/dist/plugins/sui/network-resolver.d.mts +4 -3
- package/dist/plugins/sui/service.mjs.map +1 -1
- package/dist/plugins/sui/snapshot.mjs +3 -0
- package/dist/plugins/sui/snapshot.mjs.map +1 -1
- package/dist/plugins/sui/spans.mjs +17 -0
- package/dist/plugins/sui/spans.mjs.map +1 -0
- package/dist/plugins/wallet/codegen.d.mts +0 -1
- package/dist/plugins/wallet/codegen.mjs +8 -9
- package/dist/plugins/wallet/codegen.mjs.map +1 -1
- package/dist/plugins/wallet/index.d.mts +6 -8
- package/dist/plugins/wallet/index.mjs +46 -35
- package/dist/plugins/wallet/index.mjs.map +1 -1
- package/dist/plugins/wallet/origin-policy.mjs +12 -28
- package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
- package/dist/plugins/wallet/pairing.mjs +6 -4
- package/dist/plugins/wallet/pairing.mjs.map +1 -1
- package/dist/plugins/wallet/protocol.d.mts +1 -0
- package/dist/plugins/wallet/protocol.mjs +5 -44
- package/dist/plugins/wallet/protocol.mjs.map +1 -1
- package/dist/plugins/wallet/routable.mjs +2 -8
- package/dist/plugins/wallet/routable.mjs.map +1 -1
- package/dist/plugins/wallet/server.mjs +36 -44
- package/dist/plugins/wallet/server.mjs.map +1 -1
- package/dist/plugins/wallet/service.d.mts +1 -5
- package/dist/plugins/wallet/service.mjs +22 -18
- package/dist/plugins/wallet/service.mjs.map +1 -1
- package/dist/plugins/wallet/spans.mjs +22 -0
- package/dist/plugins/wallet/spans.mjs.map +1 -0
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +33 -8
- package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
- package/dist/plugins/walrus/codegen.d.mts +3 -3
- package/dist/plugins/walrus/codegen.mjs.map +1 -1
- package/dist/plugins/walrus/deploy-paths.mjs +21 -5
- package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
- package/dist/plugins/walrus/deploy.mjs +67 -69
- package/dist/plugins/walrus/deploy.mjs.map +1 -1
- package/dist/plugins/walrus/errors.mjs +1 -0
- package/dist/plugins/walrus/errors.mjs.map +1 -1
- package/dist/plugins/walrus/faucet-strategy.mjs +12 -7
- package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
- package/dist/plugins/walrus/index.d.mts +2 -13
- package/dist/plugins/walrus/index.mjs +18 -23
- package/dist/plugins/walrus/index.mjs.map +1 -1
- package/dist/plugins/walrus/mode/known-deploy.mjs +7 -5
- package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
- package/dist/plugins/walrus/mode/local-cluster.mjs +26 -7
- package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
- package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
- package/dist/plugins/walrus/routable.mjs +7 -23
- package/dist/plugins/walrus/routable.mjs.map +1 -1
- package/dist/plugins/walrus/service.mjs.map +1 -1
- package/dist/plugins/walrus/spans.mjs +18 -0
- package/dist/plugins/walrus/spans.mjs.map +1 -0
- package/dist/plugins/walrus/storage-nodes.d.mts +6 -2
- package/dist/plugins/walrus/storage-nodes.mjs +15 -8
- package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
- package/dist/plugins/walrus/wal-swap.mjs +58 -15
- package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
- package/dist/primitives/artifact-publisher.d.mts +1 -1
- package/dist/primitives/artifact-publisher.mjs +15 -0
- package/dist/primitives/artifact-publisher.mjs.map +1 -0
- package/dist/runtime/docker/client.mjs +17 -4
- package/dist/runtime/docker/client.mjs.map +1 -1
- package/dist/runtime/docker/container.mjs +219 -132
- package/dist/runtime/docker/container.mjs.map +1 -1
- package/dist/runtime/docker/errors.mjs +0 -6
- package/dist/runtime/docker/errors.mjs.map +1 -1
- package/dist/runtime/docker/exec.mjs +21 -18
- package/dist/runtime/docker/exec.mjs.map +1 -1
- package/dist/runtime/docker/image.mjs +36 -13
- package/dist/runtime/docker/image.mjs.map +1 -1
- package/dist/runtime/docker/index.mjs +14 -0
- package/dist/runtime/docker/inspect-and-decode.mjs +51 -0
- package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -0
- package/dist/runtime/docker/inventory.mjs +14 -11
- package/dist/runtime/docker/inventory.mjs.map +1 -1
- package/dist/runtime/docker/labels.mjs +38 -5
- package/dist/runtime/docker/labels.mjs.map +1 -1
- package/dist/runtime/docker/logs.d.mts +1 -1
- package/dist/runtime/docker/logs.mjs.map +1 -1
- package/dist/runtime/docker/network.mjs +83 -47
- package/dist/runtime/docker/network.mjs.map +1 -1
- package/dist/runtime/docker/render-run-args.mjs +82 -0
- package/dist/runtime/docker/render-run-args.mjs.map +1 -0
- package/dist/runtime/docker/service.d.mts +1 -1
- package/dist/runtime/docker/service.mjs +12 -7
- package/dist/runtime/docker/service.mjs.map +1 -1
- package/dist/runtime/docker/sweep.mjs +118 -43
- package/dist/runtime/docker/sweep.mjs.map +1 -1
- package/dist/runtime/docker/volume.mjs +2 -0
- package/dist/runtime/docker/volume.mjs.map +1 -1
- package/dist/runtime/docker/wrap.mjs +30 -1
- package/dist/runtime/docker/wrap.mjs.map +1 -1
- package/dist/substrate/cross-process.mjs +14 -8
- package/dist/substrate/cross-process.mjs.map +1 -1
- package/dist/substrate/event-time.mjs +33 -0
- package/dist/substrate/event-time.mjs.map +1 -0
- package/dist/substrate/events.d.mts +28 -8
- package/dist/substrate/identity.d.mts +2 -1
- package/dist/substrate/manifest.d.mts +68 -5
- package/dist/substrate/manifest.mjs +34 -5
- package/dist/substrate/manifest.mjs.map +1 -1
- package/dist/substrate/network.d.mts +3 -5
- package/dist/substrate/options.d.mts +0 -2
- package/dist/substrate/plugin.d.mts +13 -0
- package/dist/substrate/plugin.mjs +4 -2
- package/dist/substrate/plugin.mjs.map +1 -1
- package/dist/substrate/projection.d.mts +35 -3
- package/dist/substrate/runtime/artifact-publisher/index.mjs +19 -9
- package/dist/substrate/runtime/artifact-publisher/index.mjs.map +1 -1
- package/dist/substrate/runtime/atomic-write.mjs +97 -32
- package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
- package/dist/substrate/runtime/cache/index.mjs +3 -0
- package/dist/substrate/runtime/cache/schema.mjs +2 -2
- package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
- package/dist/substrate/runtime/cache/service.mjs +9 -7
- package/dist/substrate/runtime/cache/service.mjs.map +1 -1
- package/dist/substrate/runtime/capability-sinks/index.d.mts +1 -1
- package/dist/substrate/runtime/capability-sinks/index.mjs +3 -0
- package/dist/substrate/runtime/capability-sinks/layer.mjs +1 -1
- package/dist/substrate/runtime/capability-sinks/service.d.mts +61 -2
- package/dist/substrate/runtime/capability-sinks/service.mjs +21 -26
- package/dist/substrate/runtime/capability-sinks/service.mjs.map +1 -1
- package/dist/substrate/runtime/config-validation.d.mts +1 -13
- package/dist/substrate/runtime/config-validation.mjs +2 -91
- package/dist/substrate/runtime/config-validation.mjs.map +1 -1
- package/dist/substrate/runtime/container-runtime.d.mts +1 -0
- package/dist/substrate/runtime/container-runtime.mjs +2 -0
- package/dist/substrate/runtime/control-plane/domain.mjs +101 -0
- package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -0
- package/dist/substrate/runtime/control-plane/service.mjs +7 -0
- package/dist/substrate/runtime/control-plane/service.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +46 -19
- package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs +30 -12
- package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/index.mjs +5 -0
- package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs +11 -2
- package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs +1 -1
- package/dist/substrate/runtime/cross-process/index.mjs +11 -0
- package/dist/substrate/runtime/cross-process/live-clock.mjs +34 -0
- package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/liveness.mjs +52 -10
- package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/lock.d.mts +1 -0
- package/dist/substrate/runtime/cross-process/lock.mjs +23 -0
- package/dist/substrate/runtime/cross-process/lock.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +64 -0
- package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/roster.mjs +97 -83
- package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/self-pid.mjs +8 -0
- package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -0
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +24 -28
- package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/stack-lock.mjs +41 -20
- package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
- package/dist/substrate/runtime/current-plugin.mjs +2 -2
- package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
- package/dist/substrate/runtime/errors.mjs +12 -6
- package/dist/substrate/runtime/errors.mjs.map +1 -1
- package/dist/substrate/runtime/format-unknown-error.mjs +30 -0
- package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -0
- package/dist/substrate/runtime/host-bind-mount-owner.mjs +10 -0
- package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -0
- package/dist/substrate/runtime/host-gateway.mjs +20 -0
- package/dist/substrate/runtime/host-gateway.mjs.map +1 -0
- package/dist/substrate/runtime/host-tree-tar/index.mjs +61 -50
- package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
- package/dist/substrate/runtime/http-probe.d.mts +1 -1
- package/dist/substrate/runtime/index.mjs +14 -0
- package/dist/substrate/runtime/lease-broker/index.d.mts +1 -1
- package/dist/substrate/runtime/lease-broker/index.mjs +2 -0
- package/dist/substrate/runtime/lease-broker/service.d.mts +1 -64
- package/dist/substrate/runtime/lease-broker/service.mjs +1 -1
- package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs +22 -3
- package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/index.mjs +9 -0
- package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +20 -3
- package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/selective-restart.mjs +1 -1
- package/dist/substrate/runtime/lifecycle/signals.mjs +5 -5
- package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
- package/dist/substrate/runtime/lifecycle/state-machine.mjs +1 -1
- package/dist/substrate/runtime/managed-container.d.mts +19 -1
- package/dist/substrate/runtime/managed-container.mjs +20 -1
- package/dist/substrate/runtime/managed-container.mjs.map +1 -1
- package/dist/substrate/runtime/manifest/index.mjs +3 -0
- package/dist/substrate/runtime/manifest/manifest.mjs +15 -11
- package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
- package/dist/substrate/runtime/mode-errors.mjs +20 -0
- package/dist/substrate/runtime/mode-errors.mjs.map +1 -0
- package/dist/substrate/runtime/observability/cascade-formatter.mjs +9 -13
- package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
- package/dist/substrate/runtime/observability/formatter-registry.mjs +19 -36
- package/dist/substrate/runtime/observability/formatter-registry.mjs.map +1 -1
- package/dist/substrate/runtime/observability/ignore-with-log.d.mts +1 -0
- package/dist/substrate/runtime/observability/ignore-with-log.mjs +17 -0
- package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -0
- package/dist/substrate/runtime/observability/index.d.mts +1 -1
- package/dist/substrate/runtime/observability/index.mjs +13 -0
- package/dist/substrate/runtime/observability/log-store.d.mts +1 -0
- package/dist/substrate/runtime/observability/log-store.mjs +175 -0
- package/dist/substrate/runtime/observability/log-store.mjs.map +1 -0
- package/dist/substrate/runtime/observability/logger.d.mts +2 -1
- package/dist/substrate/runtime/observability/logger.mjs +5 -9
- package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
- package/dist/substrate/runtime/observability/output-truncate.mjs +35 -0
- package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -0
- package/dist/substrate/runtime/observability/pretty-error.mjs +9 -12
- package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
- package/dist/substrate/runtime/observability/redaction.d.mts +2 -13
- package/dist/substrate/runtime/observability/redaction.mjs +8 -14
- package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
- package/dist/substrate/runtime/observability/span-store.d.mts +1 -0
- package/dist/substrate/runtime/observability/span-store.mjs +110 -0
- package/dist/substrate/runtime/observability/span-store.mjs.map +1 -0
- package/dist/substrate/runtime/observability/spans.mjs +14 -14
- package/dist/substrate/runtime/observability/spans.mjs.map +1 -1
- package/dist/substrate/runtime/observability/subprocess-capture.mjs +1 -1
- package/dist/substrate/runtime/passthrough-or-wrap.mjs +33 -0
- package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -0
- package/dist/substrate/runtime/paths.d.mts +1 -1
- package/dist/substrate/runtime/paths.mjs +4 -3
- package/dist/substrate/runtime/paths.mjs.map +1 -1
- package/dist/substrate/runtime/phase-preserving-produce.mjs +40 -0
- package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -0
- package/dist/substrate/runtime/port-broker/index.mjs +3 -0
- package/dist/substrate/runtime/port-broker/service.mjs +170 -126
- package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
- package/dist/substrate/runtime/post-acquire-tasks.mjs +1 -1
- package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
- package/dist/substrate/runtime/probes.d.mts +7 -5
- package/dist/substrate/runtime/probes.mjs +3 -1
- package/dist/substrate/runtime/probes.mjs.map +1 -1
- package/dist/substrate/runtime/projection/index.mjs +4 -0
- package/dist/substrate/runtime/projection/operational-endpoints.mjs +1 -2
- package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
- package/dist/substrate/runtime/projection/persisted.mjs +33 -15
- package/dist/substrate/runtime/projection/persisted.mjs.map +1 -1
- package/dist/substrate/runtime/projection/state-ref.mjs +26 -2
- package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
- package/dist/substrate/runtime/projection/update.mjs +88 -24
- package/dist/substrate/runtime/projection/update.mjs.map +1 -1
- package/dist/substrate/runtime/random-suffix.mjs +11 -0
- package/dist/substrate/runtime/random-suffix.mjs.map +1 -0
- package/dist/substrate/runtime/retry-policy.d.mts +59 -1
- package/dist/substrate/runtime/retry-policy.mjs +66 -1
- package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
- package/dist/substrate/runtime/routed-url.d.mts +1 -0
- package/dist/substrate/runtime/routed-url.mjs +79 -0
- package/dist/substrate/runtime/routed-url.mjs.map +1 -0
- package/dist/substrate/runtime/runtime-decode.d.mts +1 -1
- package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
- package/dist/substrate/runtime/scoped-http-server.mjs +2 -3
- package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
- package/dist/substrate/runtime/scoped-multimap/index.mjs +2 -0
- package/dist/substrate/runtime/scoped-multimap/service.mjs +52 -0
- package/dist/substrate/runtime/scoped-multimap/service.mjs.map +1 -0
- package/dist/substrate/runtime/scoped-ref-map/index.mjs +2 -0
- package/dist/substrate/runtime/scoped-ref-map/service.mjs +2 -2
- package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +1 -1
- package/dist/substrate/runtime/stage-and-swap/index.mjs +72 -4
- package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
- package/dist/substrate/runtime/state-store/index.d.mts +1 -0
- package/dist/substrate/runtime/state-store/index.mjs +3 -0
- package/dist/substrate/runtime/state-store/schema.d.mts +1 -0
- package/dist/substrate/runtime/state-store/schema.mjs +19 -14
- package/dist/substrate/runtime/state-store/schema.mjs.map +1 -1
- package/dist/substrate/runtime/state-store/service.d.mts +1 -0
- package/dist/substrate/runtime/state-store/service.mjs +145 -0
- package/dist/substrate/runtime/state-store/service.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.d.mts +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs +33 -0
- package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -0
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs +1 -1
- package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
- package/dist/substrate/runtime/strategy-registry/index.mjs +4 -0
- package/dist/substrate/runtime/strategy-registry/service.mjs +19 -33
- package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
- package/dist/substrate/runtime/subnet-broker.mjs +60 -0
- package/dist/substrate/runtime/subnet-broker.mjs.map +1 -0
- package/dist/substrate/runtime/sui-execute/index.d.mts +21 -1
- package/dist/substrate/runtime/sui-execute/index.mjs +84 -20
- package/dist/substrate/runtime/sui-execute/index.mjs.map +1 -1
- package/dist/substrate/runtime/sui-execute/sign-and-dispatch.d.mts +1 -0
- package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs +32 -0
- package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +1 -0
- package/dist/substrate/runtime/sui-ledger/object-ref.mjs +32 -0
- package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +1 -0
- package/dist/substrate/runtime/sui-move-build/index.mjs +93 -19
- package/dist/substrate/runtime/sui-move-build/index.mjs.map +1 -1
- package/dist/substrate/runtime/supervisor/acquire-node.mjs +181 -0
- package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/background-tasks.mjs +144 -0
- package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/command-loop.mjs +68 -0
- package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +151 -0
- package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/errors.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/errors.mjs +9 -0
- package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/index.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/index.mjs +3 -0
- package/dist/substrate/runtime/supervisor/shutdown.mjs +51 -0
- package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/start-supervisor.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/start-supervisor.mjs +250 -0
- package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/state.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/state.mjs +22 -0
- package/dist/substrate/runtime/supervisor/state.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/teardown.mjs +57 -0
- package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -0
- package/dist/substrate/runtime/supervisor/types.d.mts +1 -0
- package/dist/substrate/runtime/supervisor/wiring.mjs +133 -0
- package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -0
- package/dist/substrate/runtime/typed-env.mjs +8 -0
- package/dist/substrate/runtime/typed-env.mjs.map +1 -0
- package/dist/substrate/state-store.d.mts +1 -0
- package/dist/substrate/versioned-doc-schema.mjs +17 -0
- package/dist/substrate/versioned-doc-schema.mjs.map +1 -0
- package/dist/substrate/versioned-doc-sync.mjs +94 -0
- package/dist/substrate/versioned-doc-sync.mjs.map +1 -0
- package/dist/surfaces/cli/command-tree.mjs.map +1 -1
- package/dist/surfaces/cli/commands/index.mjs +9 -0
- package/dist/surfaces/cli/commands/prune-picker-entry.mjs +13 -0
- package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -0
- package/dist/surfaces/cli/commands/prune-picker.mjs +3 -2
- package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
- package/dist/surfaces/cli/commands/prune.mjs +34 -17
- package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
- package/dist/surfaces/cli/commands/status.mjs +2 -2
- package/dist/surfaces/cli/commands/status.mjs.map +1 -1
- package/dist/surfaces/cli/commands/supervisor-presence.mjs +5 -3
- package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
- package/dist/surfaces/cli/commands/wipe.mjs +38 -4
- package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
- package/dist/surfaces/cli/errors.mjs +1 -1
- package/dist/surfaces/cli/errors.mjs.map +1 -1
- package/dist/surfaces/cli/flags.mjs +0 -1
- package/dist/surfaces/cli/flags.mjs.map +1 -1
- package/dist/surfaces/cli/index.mjs +98 -18
- package/dist/surfaces/cli/index.mjs.map +1 -1
- package/dist/surfaces/cli/output.mjs +1 -0
- package/dist/surfaces/cli/output.mjs.map +1 -1
- package/dist/surfaces/cli/sysexits.mjs +2 -1
- package/dist/surfaces/cli/sysexits.mjs.map +1 -1
- package/dist/surfaces/tui/app.mjs +25 -3
- package/dist/surfaces/tui/app.mjs.map +1 -1
- package/dist/surfaces/tui/display-derivation.mjs +23 -74
- package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
- package/dist/surfaces/tui/event-log.mjs +35 -23
- package/dist/surfaces/tui/event-log.mjs.map +1 -1
- package/dist/surfaces/tui/input.mjs +5 -1
- package/dist/surfaces/tui/input.mjs.map +1 -1
- package/dist/surfaces/tui/plain-renderer.mjs +70 -34
- package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
- package/package.json +24 -4
- package/dist/contracts/liveness-classifier.d.mts +0 -19
- package/dist/contracts/network-resolver.d.mts +0 -15
- package/dist/contracts/network-resolver.mjs +0 -7
- package/dist/contracts/network-resolver.mjs.map +0 -1
- package/dist/orchestrators/codegen/extras.mjs +0 -16
- package/dist/orchestrators/codegen/extras.mjs.map +0 -1
- package/dist/plugins/deepbook/routable.mjs +0 -21
- package/dist/plugins/deepbook/routable.mjs.map +0 -1
- package/dist/plugins/faucet/service.d.mts +0 -20
- package/dist/plugins/faucet/strategies/sui-local.d.mts +0 -23
- package/dist/plugins/faucet/strategies/sui-local.mjs.map +0 -1
- package/dist/plugins/sui/seed-objects.d.mts +0 -18
- package/dist/plugins/sui/seed-objects.mjs +0 -25
- package/dist/plugins/sui/seed-objects.mjs.map +0 -1
- package/dist/runtime/built-in-plugin-layers.mjs.map +0 -1
- package/dist/substrate/runtime/context-helpers.mjs +0 -32
- package/dist/substrate/runtime/context-helpers.mjs.map +0 -1
- package/dist/substrate/runtime/run.mjs.map +0 -1
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs +0 -30
- package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs.map +0 -1
- package/dist/substrate/runtime/supervisor.d.mts +0 -1
- package/dist/substrate/runtime/supervisor.mjs +0 -831
- package/dist/substrate/runtime/supervisor.mjs.map +0 -1
- package/dist/surfaces/cli/commands/doctor-probes.mjs.map +0 -1
- /package/dist/{substrate/runtime/strategy-registry/faucet-capability-for.d.mts → plugins/faucet/http.d.mts} +0 -0
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { __exportAll } from "../../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
-
import { Context, Effect, Layer, Ref } from "effect";
|
|
3
2
|
//#region src/substrate/runtime/observability/redaction.ts
|
|
4
3
|
var redaction_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
-
Redactor: () => Redactor,
|
|
6
|
-
layerRedactor: () => layerRedactor,
|
|
7
4
|
redactText: () => redactText,
|
|
8
5
|
redactValue: () => redactValue
|
|
9
6
|
});
|
|
10
|
-
var Redactor = class extends Context.Service()("@devstack-rewrite/substrate/Redactor") {};
|
|
11
7
|
const DEFAULT_REPLACEMENT = "<redacted>";
|
|
12
8
|
const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
|
9
|
+
/** A non-global pattern redacts only its FIRST match — every later
|
|
10
|
+
* occurrence leaks. Force the global flag so all occurrences are
|
|
11
|
+
* redacted; clone (don't mutate the caller's RegExp) and preserve any
|
|
12
|
+
* unicode flag. Already-global patterns pass through untouched so we
|
|
13
|
+
* don't double-apply. */
|
|
14
|
+
const asGlobalPattern = (pattern) => pattern.global ? pattern : new RegExp(pattern.source, `${pattern.flags}g`);
|
|
13
15
|
const redactText = (text, rules) => {
|
|
14
16
|
let next = text;
|
|
15
17
|
for (const rule of rules) {
|
|
@@ -17,7 +19,7 @@ const redactText = (text, rules) => {
|
|
|
17
19
|
if (rule.kind === "literal") {
|
|
18
20
|
if (rule.value.length === 0) continue;
|
|
19
21
|
next = next.replace(new RegExp(escapeRegExp(rule.value), "gu"), replacement);
|
|
20
|
-
} else next = next.replace(rule.pattern, replacement);
|
|
22
|
+
} else next = next.replace(asGlobalPattern(rule.pattern), replacement);
|
|
21
23
|
}
|
|
22
24
|
return next;
|
|
23
25
|
};
|
|
@@ -31,15 +33,7 @@ const redactValue = (value, rules, visited = /* @__PURE__ */ new WeakSet()) => {
|
|
|
31
33
|
for (const [key, entry] of Object.entries(value)) out[key] = redactValue(entry, rules, visited);
|
|
32
34
|
return out;
|
|
33
35
|
};
|
|
34
|
-
const layerRedactor = Layer.effect(Redactor, Effect.gen(function* () {
|
|
35
|
-
const ref = yield* Ref.make([]);
|
|
36
|
-
return Redactor.of({
|
|
37
|
-
register: (rule) => Ref.update(ref, (rules) => [...rules, rule]),
|
|
38
|
-
redact: (text) => Ref.get(ref).pipe(Effect.map((rules) => redactText(text, rules))),
|
|
39
|
-
rules: Ref.get(ref)
|
|
40
|
-
});
|
|
41
|
-
}));
|
|
42
36
|
//#endregion
|
|
43
|
-
export {
|
|
37
|
+
export { redactText, redactValue, redaction_exports };
|
|
44
38
|
|
|
45
39
|
//# sourceMappingURL=redaction.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redaction.mjs","names":[],"sources":["../../../../src/substrate/runtime/observability/redaction.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"redaction.mjs","names":[],"sources":["../../../../src/substrate/runtime/observability/redaction.ts"],"sourcesContent":["// Pure redaction helpers. These back the inline plugin-level redaction\n// in seal (`redactMasterKey`) and wallet (`redactToken`), and the\n// cascade-formatter's `safeJson` field scrubbing. There is intentionally\n// no engine-wide Redactor service: plugins that surface secret-bearing\n// output defend themselves at the point of emission with a local rule\n// set, which keeps the rules co-located with the thing they protect.\n\nexport type RedactionRule =\n\t| {\n\t\t\treadonly kind: 'literal';\n\t\t\treadonly value: string;\n\t\t\treadonly replacement?: string;\n\t }\n\t| {\n\t\t\treadonly kind: 'pattern';\n\t\t\treadonly pattern: RegExp;\n\t\t\treadonly replacement?: string;\n\t };\n\nconst DEFAULT_REPLACEMENT = '<redacted>';\n\nconst escapeRegExp = (value: string): string => value.replace(/[.*+?^${}()|[\\]\\\\]/gu, '\\\\$&');\n\n/** A non-global pattern redacts only its FIRST match — every later\n * occurrence leaks. Force the global flag so all occurrences are\n * redacted; clone (don't mutate the caller's RegExp) and preserve any\n * unicode flag. Already-global patterns pass through untouched so we\n * don't double-apply. */\nconst asGlobalPattern = (pattern: RegExp): RegExp =>\n\tpattern.global ? pattern : new RegExp(pattern.source, `${pattern.flags}g`);\n\nexport const redactText = (text: string, rules: ReadonlyArray<RedactionRule>): string => {\n\tlet next = text;\n\tfor (const rule of rules) {\n\t\tconst replacement = rule.replacement ?? DEFAULT_REPLACEMENT;\n\t\tif (rule.kind === 'literal') {\n\t\t\tif (rule.value.length === 0) continue;\n\t\t\tnext = next.replace(new RegExp(escapeRegExp(rule.value), 'gu'), replacement);\n\t\t} else {\n\t\t\tnext = next.replace(asGlobalPattern(rule.pattern), replacement);\n\t\t}\n\t}\n\treturn next;\n};\n\nexport const redactValue = (\n\tvalue: unknown,\n\trules: ReadonlyArray<RedactionRule>,\n\tvisited: WeakSet<object> = new WeakSet(),\n): unknown => {\n\tif (typeof value === 'string') return redactText(value, rules);\n\tif (typeof value !== 'object' || value === null) return value;\n\tif (visited.has(value)) return value;\n\tvisited.add(value);\n\tif (Array.isArray(value)) return value.map((entry) => redactValue(entry, rules, visited));\n\tconst out: Record<string, unknown> = {};\n\tfor (const [key, entry] of Object.entries(value)) {\n\t\tout[key] = redactValue(entry, rules, visited);\n\t}\n\treturn out;\n};\n"],"mappings":";;;;;;AAmBA,MAAM,sBAAsB;AAE5B,MAAM,gBAAgB,UAA0B,MAAM,QAAQ,wBAAwB,OAAO;;;;;;AAO7F,MAAM,mBAAmB,YACxB,QAAQ,SAAS,UAAU,IAAI,OAAO,QAAQ,QAAQ,GAAG,QAAQ,MAAM,GAAG;AAE3E,MAAa,cAAc,MAAc,UAAgD;CACxF,IAAI,OAAO;AACX,MAAK,MAAM,QAAQ,OAAO;EACzB,MAAM,cAAc,KAAK,eAAe;AACxC,MAAI,KAAK,SAAS,WAAW;AAC5B,OAAI,KAAK,MAAM,WAAW,EAAG;AAC7B,UAAO,KAAK,QAAQ,IAAI,OAAO,aAAa,KAAK,MAAM,EAAE,KAAK,EAAE,YAAY;QAE5E,QAAO,KAAK,QAAQ,gBAAgB,KAAK,QAAQ,EAAE,YAAY;;AAGjE,QAAO;;AAGR,MAAa,eACZ,OACA,OACA,0BAA2B,IAAI,SAAS,KAC3B;AACb,KAAI,OAAO,UAAU,SAAU,QAAO,WAAW,OAAO,MAAM;AAC9D,KAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,KAAI,QAAQ,IAAI,MAAM,CAAE,QAAO;AAC/B,SAAQ,IAAI,MAAM;AAClB,KAAI,MAAM,QAAQ,MAAM,CAAE,QAAO,MAAM,KAAK,UAAU,YAAY,OAAO,OAAO,QAAQ,CAAC;CACzF,MAAM,MAA+B,EAAE;AACvC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,CAC/C,KAAI,OAAO,YAAY,OAAO,OAAO,QAAQ;AAE9C,QAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Context, Effect, Layer, Tracer } from "effect";
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { SpanAttr } from "./spans.mjs";
|
|
2
|
+
import { Context, Effect, Exit, Layer, Option, Tracer } from "effect";
|
|
3
|
+
//#region src/substrate/runtime/observability/span-store.ts
|
|
4
|
+
/** Completed-span retention. Bounded so a long-lived stack stays flat. */
|
|
5
|
+
const DEFAULT_SPAN_CAPACITY = 2e3;
|
|
6
|
+
var SpanStore = class extends Context.Service()("@devstack/substrate/SpanStore") {};
|
|
7
|
+
const pushRecord = (ring, record) => {
|
|
8
|
+
ring.records.push(record);
|
|
9
|
+
if (ring.records.length > ring.capacity) ring.records.shift();
|
|
10
|
+
};
|
|
11
|
+
const NANOS_PER_MILLI = 1000000n;
|
|
12
|
+
const nanosToMillis = (n) => Number(n / NANOS_PER_MILLI);
|
|
13
|
+
/** Derive the dashboard `service` for a span: prefer the canonical
|
|
14
|
+
* `devstack.plugin` attribute, else fall back to the span name. Plugin
|
|
15
|
+
* spans without the attribute use the dotted `devstack.plugin.<name>.…`
|
|
16
|
+
* convention, so we special-case that prefix to recover `<name>` (e.g.
|
|
17
|
+
* `devstack.plugin.postgres.acquire` → `postgres`) instead of bucketing
|
|
18
|
+
* every plugin span under the shared `devstack` head. Other namespaced
|
|
19
|
+
* spans fall back to the leading dotted/slashed segment
|
|
20
|
+
* (`lifecycle.supervisor.runCommand` → `lifecycle`). `null` when neither
|
|
21
|
+
* is informative. */
|
|
22
|
+
const PLUGIN_SPAN_PREFIX = "devstack.plugin.";
|
|
23
|
+
const deriveService = (name, attributes) => {
|
|
24
|
+
const plugin = attributes.get(SpanAttr.plugin);
|
|
25
|
+
if (typeof plugin === "string" && plugin.length > 0) return plugin;
|
|
26
|
+
if (name.startsWith(PLUGIN_SPAN_PREFIX)) {
|
|
27
|
+
const pluginName = name.slice(16).split(/[./]/, 1)[0];
|
|
28
|
+
if (pluginName !== void 0 && pluginName.length > 0) return pluginName;
|
|
29
|
+
}
|
|
30
|
+
const head = name.split(/[./]/, 1)[0];
|
|
31
|
+
return head !== void 0 && head.length > 0 && head !== name ? head : null;
|
|
32
|
+
};
|
|
33
|
+
const flattenAttributes = (attributes) => {
|
|
34
|
+
const out = {};
|
|
35
|
+
for (const [k, v] of attributes) out[k] = typeof v === "string" ? v : String(v);
|
|
36
|
+
return out;
|
|
37
|
+
};
|
|
38
|
+
/** Build the recording span from the native span at end time. */
|
|
39
|
+
const recordFrom = (span, endTime, exit) => {
|
|
40
|
+
const parent = Option.getOrUndefined(span.parent);
|
|
41
|
+
const startMillis = nanosToMillis(span.startTime);
|
|
42
|
+
return {
|
|
43
|
+
traceId: span.traceId,
|
|
44
|
+
spanId: span.spanId,
|
|
45
|
+
parentId: parent?.spanId ?? null,
|
|
46
|
+
name: span.name,
|
|
47
|
+
service: deriveService(span.name, span.attributes),
|
|
48
|
+
startMillis,
|
|
49
|
+
durationMillis: Math.max(0, nanosToMillis(endTime) - startMillis),
|
|
50
|
+
status: Exit.isSuccess(exit) ? "ok" : "error",
|
|
51
|
+
attributes: flattenAttributes(span.attributes)
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
/** A `Tracer` that builds Effect's `NativeSpan` (so parent/trace propagation
|
|
55
|
+
* and attribute capture behave exactly like the default) and records each
|
|
56
|
+
* span into `ring` when it ends. */
|
|
57
|
+
const recordingTracer = (ring) => Tracer.make({ span: (options) => {
|
|
58
|
+
const span = new Tracer.NativeSpan(options);
|
|
59
|
+
const originalEnd = span.end.bind(span);
|
|
60
|
+
span.end = (endTime, exit) => {
|
|
61
|
+
originalEnd(endTime, exit);
|
|
62
|
+
try {
|
|
63
|
+
pushRecord(ring, recordFrom(span, endTime, exit));
|
|
64
|
+
} catch {}
|
|
65
|
+
};
|
|
66
|
+
return span;
|
|
67
|
+
} });
|
|
68
|
+
/** Build a `SpanStoreShape` over a fresh ring. The supervisor calls this so
|
|
69
|
+
* the ring is process-scoped. `capacity` is injectable for tests. */
|
|
70
|
+
const makeSpanStore = (capacity = DEFAULT_SPAN_CAPACITY) => Effect.sync(() => {
|
|
71
|
+
const ring = {
|
|
72
|
+
records: [],
|
|
73
|
+
capacity
|
|
74
|
+
};
|
|
75
|
+
const query = (filter) => Effect.sync(() => applySpanFilter(ring.records, filter, capacity));
|
|
76
|
+
const services = Effect.sync(() => {
|
|
77
|
+
const seen = /* @__PURE__ */ new Set();
|
|
78
|
+
for (const r of ring.records) if (r.service !== null) seen.add(r.service);
|
|
79
|
+
return [...seen].sort();
|
|
80
|
+
});
|
|
81
|
+
return SpanStore.of({
|
|
82
|
+
query,
|
|
83
|
+
services,
|
|
84
|
+
tracer: recordingTracer(ring)
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
/** Pure filter application — exported for tests. Stored oldest-first; we
|
|
88
|
+
* return newest-first and cap to `limit`. */
|
|
89
|
+
const applySpanFilter = (records, filter, capacity) => {
|
|
90
|
+
const serviceSet = filter?.services && filter.services.length > 0 ? new Set(filter.services) : null;
|
|
91
|
+
const statusSet = filter?.statuses && filter.statuses.length > 0 ? new Set(filter.statuses) : null;
|
|
92
|
+
const search = filter?.search?.trim().toLowerCase();
|
|
93
|
+
const since = filter?.sinceMillis;
|
|
94
|
+
const limit = filter?.limit ?? capacity;
|
|
95
|
+
const out = [];
|
|
96
|
+
for (let i = records.length - 1; i >= 0 && out.length < limit; i -= 1) {
|
|
97
|
+
const r = records[i];
|
|
98
|
+
if (serviceSet !== null && (r.service === null || !serviceSet.has(r.service))) continue;
|
|
99
|
+
if (statusSet !== null && !statusSet.has(r.status)) continue;
|
|
100
|
+
if (since !== void 0 && r.startMillis < since) continue;
|
|
101
|
+
if (search !== void 0 && search.length > 0 && !r.name.toLowerCase().includes(search) && !(r.service ?? "").toLowerCase().includes(search)) continue;
|
|
102
|
+
out.push(r);
|
|
103
|
+
}
|
|
104
|
+
return out;
|
|
105
|
+
};
|
|
106
|
+
Layer.effect(SpanStore, makeSpanStore());
|
|
107
|
+
//#endregion
|
|
108
|
+
export { DEFAULT_SPAN_CAPACITY, SpanStore, applySpanFilter, makeSpanStore };
|
|
109
|
+
|
|
110
|
+
//# sourceMappingURL=span-store.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"span-store.mjs","names":[],"sources":["../../../../src/substrate/runtime/observability/span-store.ts"],"sourcesContent":["// Completed-span ring + recording Tracer.\n//\n// Devstack emits spans with `Effect.withSpan` all over the substrate\n// (`acquire-node`, command names, background tasks, teardown, http handlers,\n// …) carrying the canonical `devstack.*` attributes (see spans.ts). Until\n// now no `Tracer` was provided, so those spans hit Effect's default no-op\n// native tracer and evaporated — the dashboard's \"Traces\" tab had nothing to\n// read.\n//\n// This module provides a minimal RECORDING tracer: it wraps Effect's\n// `NativeSpan` and, when a span ends, projects it into a bounded ring the\n// dashboard can query. The tracer is a drop-in for the default native tracer\n// (it still produces real `Span` objects with parent/trace ids, so span\n// propagation and any future OTel layer keep working) — it just also pushes\n// the completed span into the ring on `end()`.\n//\n// Hot-path discipline: `span()` allocates one `NativeSpan` (same as the\n// default). `end()` does one synchronous array push + bounded trim via a\n// direct mutable array — NO Effect/Ref round-trip on the hot path, since\n// `Tracer.span` / `Span.end` are synchronous and run on the fiber's critical\n// path. The ring is a plain object captured in the closure; reads go through\n// an Effect accessor for the service surface.\n//\n// Process-scoped: the ring object is created in the supervisor alongside the\n// log store, so it survives `stack.restart`.\n\nimport { Context, Effect, Exit, Layer, Option, Tracer } from 'effect';\n\nimport { SpanAttr } from './spans.ts';\n\n// -----------------------------------------------------------------------------\n// Record shape\n// -----------------------------------------------------------------------------\n\n/** One completed span. Plain data; the dashboard schema projects it\n * directly. `op` is the span name; `service` is derived from the\n * `devstack.plugin` attribute (falling back to the span name's leading\n * segment). */\nexport interface SpanRecord {\n\treadonly traceId: string;\n\treadonly spanId: string;\n\treadonly parentId: string | null;\n\t/** Span name / operation (`acquire-node`, `lifecycle.supervisor.runCommand`, …). */\n\treadonly name: string;\n\t/** `devstack.plugin` attribute when present, else `null`. */\n\treadonly service: string | null;\n\treadonly startMillis: number;\n\treadonly durationMillis: number;\n\treadonly status: 'ok' | 'error';\n\t/** Flattened span attributes (string-coerced values). */\n\treadonly attributes: Readonly<Record<string, string>>;\n}\n\n/** Server-side span filter. Every field optional. */\nexport interface SpanFilter {\n\t/** Keep only spans whose derived `service` is in this set. */\n\treadonly services?: ReadonlyArray<string>;\n\t/** Keep only spans with one of these statuses. */\n\treadonly statuses?: ReadonlyArray<'ok' | 'error'>;\n\t/** Case-insensitive substring match against the span name (and service). */\n\treadonly search?: string;\n\t/** Keep only spans that STARTED at/after this epoch-ms. */\n\treadonly sinceMillis?: number;\n\t/** Cap on returned spans (most recent first). */\n\treadonly limit?: number;\n}\n\n// -----------------------------------------------------------------------------\n// Capacity policy\n// -----------------------------------------------------------------------------\n\n/** Completed-span retention. Bounded so a long-lived stack stays flat. */\nexport const DEFAULT_SPAN_CAPACITY = 2000;\n\n// -----------------------------------------------------------------------------\n// Service\n// -----------------------------------------------------------------------------\n\nexport interface SpanStoreShape {\n\t/** Query the ring with a filter (most-recent-first). Never fails. */\n\treadonly query: (filter?: SpanFilter) => Effect.Effect<ReadonlyArray<SpanRecord>>;\n\t/** Distinct derived service keys currently in the ring. */\n\treadonly services: Effect.Effect<ReadonlyArray<string>>;\n\t/** The recording `Tracer` to provide into the supervisor's effect\n\t * context. Wraps Effect's native tracer; records on span `end()`. */\n\treadonly tracer: Tracer.Tracer;\n}\n\nexport class SpanStore extends Context.Service<SpanStore, SpanStoreShape>()(\n\t'@devstack/substrate/SpanStore',\n) {}\n\n// -----------------------------------------------------------------------------\n// Plain mutable ring (hot-path-cheap; no Ref round-trip in `end()`)\n// -----------------------------------------------------------------------------\n\ninterface Ring {\n\trecords: SpanRecord[];\n\treadonly capacity: number;\n}\n\nconst pushRecord = (ring: Ring, record: SpanRecord): void => {\n\tring.records.push(record);\n\tif (ring.records.length > ring.capacity) {\n\t\t// Drop the oldest. `shift` is O(n) but spans complete far slower than\n\t\t// logs and the capacity is bounded; keep it simple over a head index.\n\t\tring.records.shift();\n\t}\n};\n\nconst NANOS_PER_MILLI = 1_000_000n;\nconst nanosToMillis = (n: bigint): number => Number(n / NANOS_PER_MILLI);\n\n/** Derive the dashboard `service` for a span: prefer the canonical\n * `devstack.plugin` attribute, else fall back to the span name. Plugin\n * spans without the attribute use the dotted `devstack.plugin.<name>.…`\n * convention, so we special-case that prefix to recover `<name>` (e.g.\n * `devstack.plugin.postgres.acquire` → `postgres`) instead of bucketing\n * every plugin span under the shared `devstack` head. Other namespaced\n * spans fall back to the leading dotted/slashed segment\n * (`lifecycle.supervisor.runCommand` → `lifecycle`). `null` when neither\n * is informative. */\nconst PLUGIN_SPAN_PREFIX = 'devstack.plugin.';\nconst deriveService = (name: string, attributes: ReadonlyMap<string, unknown>): string | null => {\n\tconst plugin = attributes.get(SpanAttr.plugin);\n\tif (typeof plugin === 'string' && plugin.length > 0) return plugin;\n\tif (name.startsWith(PLUGIN_SPAN_PREFIX)) {\n\t\t// `devstack.plugin.<name>.<op>` → `<name>` (the segment after the prefix).\n\t\tconst rest = name.slice(PLUGIN_SPAN_PREFIX.length);\n\t\tconst pluginName = rest.split(/[./]/, 1)[0];\n\t\tif (pluginName !== undefined && pluginName.length > 0) return pluginName;\n\t}\n\tconst head = name.split(/[./]/, 1)[0];\n\treturn head !== undefined && head.length > 0 && head !== name ? head : null;\n};\n\nconst flattenAttributes = (attributes: ReadonlyMap<string, unknown>): Record<string, string> => {\n\tconst out: Record<string, string> = {};\n\tfor (const [k, v] of attributes) {\n\t\tout[k] = typeof v === 'string' ? v : String(v);\n\t}\n\treturn out;\n};\n\n/** Build the recording span from the native span at end time. */\nconst recordFrom = (\n\tspan: Tracer.NativeSpan,\n\tendTime: bigint,\n\texit: Exit.Exit<unknown, unknown>,\n): SpanRecord => {\n\tconst parent = Option.getOrUndefined(span.parent);\n\tconst startMillis = nanosToMillis(span.startTime);\n\treturn {\n\t\ttraceId: span.traceId,\n\t\tspanId: span.spanId,\n\t\tparentId: parent?.spanId ?? null,\n\t\tname: span.name,\n\t\tservice: deriveService(span.name, span.attributes),\n\t\tstartMillis,\n\t\tdurationMillis: Math.max(0, nanosToMillis(endTime) - startMillis),\n\t\tstatus: Exit.isSuccess(exit) ? 'ok' : 'error',\n\t\tattributes: flattenAttributes(span.attributes),\n\t};\n};\n\n/** A `Tracer` that builds Effect's `NativeSpan` (so parent/trace propagation\n * and attribute capture behave exactly like the default) and records each\n * span into `ring` when it ends. */\nconst recordingTracer = (ring: Ring): Tracer.Tracer =>\n\tTracer.make({\n\t\tspan: (options) => {\n\t\t\tconst span = new Tracer.NativeSpan(options);\n\t\t\tconst originalEnd = span.end.bind(span);\n\t\t\tspan.end = (endTime, exit) => {\n\t\t\t\toriginalEnd(endTime, exit);\n\t\t\t\t// Guard: recording must never break tracing.\n\t\t\t\ttry {\n\t\t\t\t\tpushRecord(ring, recordFrom(span, endTime, exit));\n\t\t\t\t} catch {\n\t\t\t\t\t/* swallow — observability is best-effort */\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn span;\n\t\t},\n\t});\n\n/** Build a `SpanStoreShape` over a fresh ring. The supervisor calls this so\n * the ring is process-scoped. `capacity` is injectable for tests. */\nexport const makeSpanStore = (\n\tcapacity: number = DEFAULT_SPAN_CAPACITY,\n): Effect.Effect<SpanStoreShape> =>\n\tEffect.sync(() => {\n\t\tconst ring: Ring = { records: [], capacity };\n\n\t\tconst query: SpanStoreShape['query'] = (filter) =>\n\t\t\tEffect.sync(() => applySpanFilter(ring.records, filter, capacity));\n\n\t\tconst services: SpanStoreShape['services'] = Effect.sync(() => {\n\t\t\tconst seen = new Set<string>();\n\t\t\tfor (const r of ring.records) if (r.service !== null) seen.add(r.service);\n\t\t\treturn [...seen].sort();\n\t\t});\n\n\t\treturn SpanStore.of({ query, services, tracer: recordingTracer(ring) });\n\t});\n\n/** Pure filter application — exported for tests. Stored oldest-first; we\n * return newest-first and cap to `limit`. */\nexport const applySpanFilter = (\n\trecords: ReadonlyArray<SpanRecord>,\n\tfilter: SpanFilter | undefined,\n\tcapacity: number,\n): ReadonlyArray<SpanRecord> => {\n\tconst serviceSet =\n\t\tfilter?.services && filter.services.length > 0 ? new Set(filter.services) : null;\n\tconst statusSet =\n\t\tfilter?.statuses && filter.statuses.length > 0 ? new Set(filter.statuses) : null;\n\tconst search = filter?.search?.trim().toLowerCase();\n\tconst since = filter?.sinceMillis;\n\tconst limit = filter?.limit ?? capacity;\n\n\tconst out: SpanRecord[] = [];\n\tfor (let i = records.length - 1; i >= 0 && out.length < limit; i -= 1) {\n\t\tconst r = records[i]!;\n\t\tif (serviceSet !== null && (r.service === null || !serviceSet.has(r.service))) continue;\n\t\tif (statusSet !== null && !statusSet.has(r.status)) continue;\n\t\tif (since !== undefined && r.startMillis < since) continue;\n\t\tif (\n\t\t\tsearch !== undefined &&\n\t\t\tsearch.length > 0 &&\n\t\t\t!r.name.toLowerCase().includes(search) &&\n\t\t\t!(r.service ?? '').toLowerCase().includes(search)\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\t\tout.push(r);\n\t}\n\treturn out;\n};\n\n/** Layer form (default capacity) for callers that want the store via a Layer. */\nexport const layerSpanStore: Layer.Layer<SpanStore> = Layer.effect(SpanStore, makeSpanStore());\n"],"mappings":";;;;AAwEA,MAAa,wBAAwB;AAgBrC,IAAa,YAAb,cAA+B,QAAQ,SAAoC,CAC1E,gCACA,CAAC;AAWF,MAAM,cAAc,MAAY,WAA6B;AAC5D,MAAK,QAAQ,KAAK,OAAO;AACzB,KAAI,KAAK,QAAQ,SAAS,KAAK,SAG9B,MAAK,QAAQ,OAAO;;AAItB,MAAM,kBAAkB;AACxB,MAAM,iBAAiB,MAAsB,OAAO,IAAI,gBAAgB;;;;;;;;;;AAWxE,MAAM,qBAAqB;AAC3B,MAAM,iBAAiB,MAAc,eAA4D;CAChG,MAAM,SAAS,WAAW,IAAI,SAAS,OAAO;AAC9C,KAAI,OAAO,WAAW,YAAY,OAAO,SAAS,EAAG,QAAO;AAC5D,KAAI,KAAK,WAAW,mBAAmB,EAAE;EAGxC,MAAM,aADO,KAAK,MAAM,GACD,CAAC,MAAM,QAAQ,EAAE,CAAC;AACzC,MAAI,eAAe,KAAA,KAAa,WAAW,SAAS,EAAG,QAAO;;CAE/D,MAAM,OAAO,KAAK,MAAM,QAAQ,EAAE,CAAC;AACnC,QAAO,SAAS,KAAA,KAAa,KAAK,SAAS,KAAK,SAAS,OAAO,OAAO;;AAGxE,MAAM,qBAAqB,eAAqE;CAC/F,MAAM,MAA8B,EAAE;AACtC,MAAK,MAAM,CAAC,GAAG,MAAM,WACpB,KAAI,KAAK,OAAO,MAAM,WAAW,IAAI,OAAO,EAAE;AAE/C,QAAO;;;AAIR,MAAM,cACL,MACA,SACA,SACgB;CAChB,MAAM,SAAS,OAAO,eAAe,KAAK,OAAO;CACjD,MAAM,cAAc,cAAc,KAAK,UAAU;AACjD,QAAO;EACN,SAAS,KAAK;EACd,QAAQ,KAAK;EACb,UAAU,QAAQ,UAAU;EAC5B,MAAM,KAAK;EACX,SAAS,cAAc,KAAK,MAAM,KAAK,WAAW;EAClD;EACA,gBAAgB,KAAK,IAAI,GAAG,cAAc,QAAQ,GAAG,YAAY;EACjE,QAAQ,KAAK,UAAU,KAAK,GAAG,OAAO;EACtC,YAAY,kBAAkB,KAAK,WAAW;EAC9C;;;;;AAMF,MAAM,mBAAmB,SACxB,OAAO,KAAK,EACX,OAAO,YAAY;CAClB,MAAM,OAAO,IAAI,OAAO,WAAW,QAAQ;CAC3C,MAAM,cAAc,KAAK,IAAI,KAAK,KAAK;AACvC,MAAK,OAAO,SAAS,SAAS;AAC7B,cAAY,SAAS,KAAK;AAE1B,MAAI;AACH,cAAW,MAAM,WAAW,MAAM,SAAS,KAAK,CAAC;UAC1C;;AAIT,QAAO;GAER,CAAC;;;AAIH,MAAa,iBACZ,WAAmB,0BAEnB,OAAO,WAAW;CACjB,MAAM,OAAa;EAAE,SAAS,EAAE;EAAE;EAAU;CAE5C,MAAM,SAAkC,WACvC,OAAO,WAAW,gBAAgB,KAAK,SAAS,QAAQ,SAAS,CAAC;CAEnE,MAAM,WAAuC,OAAO,WAAW;EAC9D,MAAM,uBAAO,IAAI,KAAa;AAC9B,OAAK,MAAM,KAAK,KAAK,QAAS,KAAI,EAAE,YAAY,KAAM,MAAK,IAAI,EAAE,QAAQ;AACzE,SAAO,CAAC,GAAG,KAAK,CAAC,MAAM;GACtB;AAEF,QAAO,UAAU,GAAG;EAAE;EAAO;EAAU,QAAQ,gBAAgB,KAAK;EAAE,CAAC;EACtE;;;AAIH,MAAa,mBACZ,SACA,QACA,aAC+B;CAC/B,MAAM,aACL,QAAQ,YAAY,OAAO,SAAS,SAAS,IAAI,IAAI,IAAI,OAAO,SAAS,GAAG;CAC7E,MAAM,YACL,QAAQ,YAAY,OAAO,SAAS,SAAS,IAAI,IAAI,IAAI,OAAO,SAAS,GAAG;CAC7E,MAAM,SAAS,QAAQ,QAAQ,MAAM,CAAC,aAAa;CACnD,MAAM,QAAQ,QAAQ;CACtB,MAAM,QAAQ,QAAQ,SAAS;CAE/B,MAAM,MAAoB,EAAE;AAC5B,MAAK,IAAI,IAAI,QAAQ,SAAS,GAAG,KAAK,KAAK,IAAI,SAAS,OAAO,KAAK,GAAG;EACtE,MAAM,IAAI,QAAQ;AAClB,MAAI,eAAe,SAAS,EAAE,YAAY,QAAQ,CAAC,WAAW,IAAI,EAAE,QAAQ,EAAG;AAC/E,MAAI,cAAc,QAAQ,CAAC,UAAU,IAAI,EAAE,OAAO,CAAE;AACpD,MAAI,UAAU,KAAA,KAAa,EAAE,cAAc,MAAO;AAClD,MACC,WAAW,KAAA,KACX,OAAO,SAAS,KAChB,CAAC,EAAE,KAAK,aAAa,CAAC,SAAS,OAAO,IACtC,EAAE,EAAE,WAAW,IAAI,aAAa,CAAC,SAAS,OAAO,CAEjD;AAED,MAAI,KAAK,EAAE;;AAEZ,QAAO;;AAI8C,MAAM,OAAO,WAAW,eAAe,CAAC"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
+
import "../paths.mjs";
|
|
1
2
|
import { Effect } from "effect";
|
|
2
3
|
//#region src/substrate/runtime/observability/spans.ts
|
|
3
|
-
/** Canonical span-attribute keys.
|
|
4
|
-
*
|
|
4
|
+
/** Canonical span-attribute keys. Engine-dimensional + http/process
|
|
5
|
+
* generic only. Plugin-domain keys belong on per-plugin `spans.ts`. */
|
|
5
6
|
const SpanAttr = {
|
|
6
|
-
accountFundingFrom: "account.funding.from",
|
|
7
|
-
accountFundingTo: "account.funding.to",
|
|
8
|
-
accountName: "account.name",
|
|
9
7
|
app: "devstack.app",
|
|
10
8
|
stack: "devstack.stack",
|
|
11
9
|
network: "devstack.network",
|
|
12
|
-
coinType: "coin.type",
|
|
13
10
|
plugin: "devstack.plugin",
|
|
14
11
|
role: "devstack.role",
|
|
15
12
|
phase: "devstack.phase",
|
|
@@ -36,14 +33,17 @@ const SpanAttr = {
|
|
|
36
33
|
serviceName: "devstack.service.name",
|
|
37
34
|
stageAndSwapStagingPath: "stageAndSwap.stagingPath",
|
|
38
35
|
stageAndSwapTargetPath: "stageAndSwap.targetPath",
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
cacheCorruption: "cache.corruption",
|
|
37
|
+
capabilitySinksKind: "capability-sinks.kind",
|
|
38
|
+
strategyKey: "strategy.key",
|
|
39
|
+
strategyAutoMounted: "strategy.autoMounted",
|
|
40
|
+
artifactPublisherNamespace: "artifactPublisher.namespace",
|
|
41
|
+
artifactPublisherChain: "artifactPublisher.chain",
|
|
42
|
+
artifactPublisherContentHash: "artifactPublisher.contentHash",
|
|
43
|
+
artifactPublisherPath: "artifactPublisher.path",
|
|
44
|
+
stackLockPath: "devstack.stack-lock.path",
|
|
45
|
+
stackLockTimeoutMillis: "devstack.stack-lock.timeoutMillis",
|
|
46
|
+
snapshotReservationPath: "devstack.snapshot-reservation.path"
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
49
49
|
* Wrap an Effect in a stack-scoped span. Sets `devstack.app`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spans.mjs","names":[],"sources":["../../../../src/substrate/runtime/observability/spans.ts"],"sourcesContent":["// Span propagation wrappers.\n//\n// Architecture § L0 Observability: \"span/annotation conventions\".\n// Centralises the attribute keys so every wrapped span uses the same\n// vocabulary — OTEL consumers can filter by `devstack.app`,\n// `devstack.stack`, `devstack.plugin`, `devstack.role` reliably.\n//\n// Discipline:
|
|
1
|
+
{"version":3,"file":"spans.mjs","names":[],"sources":["../../../../src/substrate/runtime/observability/spans.ts"],"sourcesContent":["// Span propagation wrappers.\n//\n// Architecture § L0 Observability: \"span/annotation conventions\".\n// Centralises the attribute keys so every wrapped span uses the same\n// vocabulary — OTEL consumers can filter by `devstack.app`,\n// `devstack.stack`, `devstack.plugin`, `devstack.role` reliably.\n//\n// Discipline: substrate-owned vocabulary carries ONLY engine-dimensional\n// keys (`devstack.*`, `error.*`, `process.exit.*`, `container.*`) plus\n// HTTP-generic keys (`http.*`, `server.*`). Plugin-domain keys\n// (`wallet.token`, `sui.mode`, `account.name`, etc.) live in\n// `src/plugins/<name>/spans.ts` next to the plugin that owns them; see\n// STYLE_GUIDE §16.\n\nimport { Effect } from 'effect';\n\nimport type { PluginKey } from '../../brand.ts';\nimport type { PluginRole } from '../../lifecycle.ts';\nimport { IdentityContext } from '../paths.ts';\n\n/** Canonical span-attribute keys. Engine-dimensional + http/process\n * generic only. Plugin-domain keys belong on per-plugin `spans.ts`. */\nexport const SpanAttr = {\n\tapp: 'devstack.app',\n\tstack: 'devstack.stack',\n\tnetwork: 'devstack.network',\n\tplugin: 'devstack.plugin',\n\trole: 'devstack.role',\n\tphase: 'devstack.phase',\n\tcontainerName: 'container.name',\n\tcontainerRole: 'container.role',\n\tevent: 'event.name',\n\terrorCode: 'error.code',\n\terrorCause: 'error.cause',\n\terrorMessage: 'error.message',\n\texitCode: 'process.exit.code',\n\texitSignal: 'process.exit.signal',\n\texitStatus: 'process.exit.status',\n\tendpointKey: 'devstack.endpoint.key',\n\thttpMethod: 'http.method',\n\thttpPath: 'http.path',\n\thttpUrl: 'http.url',\n\thost: 'server.address',\n\tlogTag: 'log.tag',\n\tport: 'server.port',\n\tcycleId: 'devstack.cycle.id',\n\top: 'devstack.op',\n\trequestId: 'devstack.request.id',\n\trosterHeartbeatIntervalMs: 'roster.heartbeat.intervalMs',\n\tserviceName: 'devstack.service.name',\n\tstageAndSwapStagingPath: 'stageAndSwap.stagingPath',\n\tstageAndSwapTargetPath: 'stageAndSwap.targetPath',\n\tcacheCorruption: 'cache.corruption',\n\tcapabilitySinksKind: 'capability-sinks.kind',\n\tstrategyKey: 'strategy.key',\n\tstrategyAutoMounted: 'strategy.autoMounted',\n\tartifactPublisherNamespace: 'artifactPublisher.namespace',\n\tartifactPublisherChain: 'artifactPublisher.chain',\n\tartifactPublisherContentHash: 'artifactPublisher.contentHash',\n\tartifactPublisherPath: 'artifactPublisher.path',\n\tstackLockPath: 'devstack.stack-lock.path',\n\tstackLockTimeoutMillis: 'devstack.stack-lock.timeoutMillis',\n\tsnapshotReservationPath: 'devstack.snapshot-reservation.path',\n} as const;\n\nexport interface StackSpanContext {\n\treadonly app: string;\n\treadonly stack: string;\n\treadonly network: string;\n}\n\nexport interface PluginSpanContext extends StackSpanContext {\n\treadonly pluginKey: PluginKey;\n\treadonly role: PluginRole;\n}\n\n/**\n * Wrap an Effect in a stack-scoped span. Sets `devstack.app`,\n * `devstack.stack`, `devstack.network` attributes. Use at the\n * top-level engine entry points (boot, cycle start, supervisor\n * loop) — not inside per-plugin code (use `withPluginSpan` for that).\n */\nexport const withStackSpan =\n\t(name: string, ctx: StackSpanContext) =>\n\t<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>\n\t\teffect.pipe(\n\t\t\tEffect.withSpan(name, {\n\t\t\t\tattributes: {\n\t\t\t\t\t[SpanAttr.app]: ctx.app,\n\t\t\t\t\t[SpanAttr.stack]: ctx.stack,\n\t\t\t\t\t[SpanAttr.network]: ctx.network,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\n/**\n * Wrap an Effect in a plugin-scoped span. Inherits stack identity from\n * the surrounding Context (callers should compose with\n * `withStackSpan` at the top so the stack identity propagates).\n */\nexport const withPluginSpan =\n\t(name: string, ctx: PluginSpanContext) =>\n\t<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>\n\t\teffect.pipe(\n\t\t\tEffect.withSpan(name, {\n\t\t\t\tattributes: {\n\t\t\t\t\t[SpanAttr.app]: ctx.app,\n\t\t\t\t\t[SpanAttr.stack]: ctx.stack,\n\t\t\t\t\t[SpanAttr.network]: ctx.network,\n\t\t\t\t\t[SpanAttr.plugin]: ctx.pluginKey,\n\t\t\t\t\t[SpanAttr.role]: ctx.role,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\n/**\n * Annotate the current span with a phase marker. Cheap; safe to call\n * from anywhere. Used by the supervisor when transitioning a plugin\n * through acquire phases so the OTEL trace correlates with the\n * lifecycle stream.\n */\nexport const annotatePhase = (phase: string): Effect.Effect<void> =>\n\tEffect.annotateCurrentSpan({ [SpanAttr.phase]: phase });\n\n/**\n * Annotate the current span with the engine cycle id. Called once per\n * cycle at supervisor entry.\n */\nexport const annotateCycle = (cycleId: number): Effect.Effect<void> =>\n\tEffect.annotateCurrentSpan({ [SpanAttr.cycleId]: cycleId });\n\n/**\n * Annotate the current span with a subprocess `op` tag. Mirrors the\n * `CaptureError.op` field so a failure that originates in a captured\n * subprocess can be traced back to its span by `devstack.op`.\n */\nexport const annotateOp = (op: string): Effect.Effect<void> =>\n\tEffect.annotateCurrentSpan({ [SpanAttr.op]: op });\n\n/**\n * Canonical labels every `spanWithLabels` span carries. `plugin` is\n * caller-supplied (per-acquisition); `endpoint` + `op` are optional\n * canonical narrowers — anything plugin-specific goes through `extras`\n * so the OTEL namespace check (STYLE_GUIDE §16) still applies.\n */\nexport interface SpanLabels {\n\treadonly plugin: PluginKey | string;\n\treadonly endpoint?: string;\n\treadonly op?: string;\n}\n\n/**\n * Wrap an Effect in a span that pre-bakes the canonical identity\n * footprint — `devstack.app` + `devstack.stack` (read from the ambient\n * `IdentityContext`) + `devstack.plugin` from `labels.plugin`. Reach\n * for this on any span that needs to be filterable or groupable by\n * plugin on the dashboard (i.e. basically every span). Coexists with\n * raw `Effect.withSpan` — migration is incremental, not a flag day.\n *\n * Adoption prerequisite: this adds `IdentityContext` to the wrapped\n * effect's `R`. Only reach for it where `IdentityContext` is already in\n * scope (or the boot signature can be widened to carry it). Plugin\n * acquire/boot effects currently do NOT thread `IdentityContext` — they\n * set `devstack.plugin` directly via `Effect.withSpan` — so migrating\n * them needs the identity plumbed first. Note also that a span's\n * app/stack may legitimately differ from the ambient identity (e.g. the\n * `_per-app_` shared-stack sentinel in `managed-container.ts`), where\n * this helper is the wrong tool.\n */\nexport const spanWithLabels =\n\t(name: string, labels: SpanLabels, extras?: Record<string, unknown>) =>\n\t<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R | IdentityContext> =>\n\t\tEffect.gen(function* () {\n\t\t\tconst identity = yield* IdentityContext;\n\t\t\tconst attributes: Record<string, unknown> = {\n\t\t\t\t[SpanAttr.app]: identity.app,\n\t\t\t\t[SpanAttr.stack]: identity.stack,\n\t\t\t\t[SpanAttr.plugin]: labels.plugin,\n\t\t\t\t...(labels.endpoint !== undefined ? { [SpanAttr.endpointKey]: labels.endpoint } : {}),\n\t\t\t\t...(labels.op !== undefined ? { [SpanAttr.op]: labels.op } : {}),\n\t\t\t\t...extras,\n\t\t\t};\n\t\t\treturn yield* effect.pipe(Effect.withSpan(name, { attributes }));\n\t\t});\n"],"mappings":";;;;;AAsBA,MAAa,WAAW;CACvB,KAAK;CACL,OAAO;CACP,SAAS;CACT,QAAQ;CACR,MAAM;CACN,OAAO;CACP,eAAe;CACf,eAAe;CACf,OAAO;CACP,WAAW;CACX,YAAY;CACZ,cAAc;CACd,UAAU;CACV,YAAY;CACZ,YAAY;CACZ,aAAa;CACb,YAAY;CACZ,UAAU;CACV,SAAS;CACT,MAAM;CACN,QAAQ;CACR,MAAM;CACN,SAAS;CACT,IAAI;CACJ,WAAW;CACX,2BAA2B;CAC3B,aAAa;CACb,yBAAyB;CACzB,wBAAwB;CACxB,iBAAiB;CACjB,qBAAqB;CACrB,aAAa;CACb,qBAAqB;CACrB,4BAA4B;CAC5B,wBAAwB;CACxB,8BAA8B;CAC9B,uBAAuB;CACvB,eAAe;CACf,wBAAwB;CACxB,yBAAyB;CACzB;;;;;;;AAmBD,MAAa,iBACX,MAAc,SACL,WACT,OAAO,KACN,OAAO,SAAS,MAAM,EACrB,YAAY;EACV,SAAS,MAAM,IAAI;EACnB,SAAS,QAAQ,IAAI;EACrB,SAAS,UAAU,IAAI;CACxB,EACD,CAAC,CACF;;;;;;AAOH,MAAa,kBACX,MAAc,SACL,WACT,OAAO,KACN,OAAO,SAAS,MAAM,EACrB,YAAY;EACV,SAAS,MAAM,IAAI;EACnB,SAAS,QAAQ,IAAI;EACrB,SAAS,UAAU,IAAI;EACvB,SAAS,SAAS,IAAI;EACtB,SAAS,OAAO,IAAI;CACrB,EACD,CAAC,CACF;;;;;;;AAQH,MAAa,iBAAiB,UAC7B,OAAO,oBAAoB,GAAG,SAAS,QAAQ,OAAO,CAAC;;;;;;AAcxD,MAAa,cAAc,OAC1B,OAAO,oBAAoB,GAAG,SAAS,KAAK,IAAI,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
//#region src/substrate/runtime/passthrough-or-wrap.ts
|
|
3
|
+
/** Internal: build the operator from a known-tag set + unknown
|
|
4
|
+
* wrapper. Shared by both the direct and curried entry points. */
|
|
5
|
+
const buildPassthroughOrWrap = (knownTags, mkUnknown) => (self) => {
|
|
6
|
+
const known = new Set(knownTags);
|
|
7
|
+
return self.pipe(Effect.catch((err) => {
|
|
8
|
+
if (typeof err === "object" && err !== null && "_tag" in err && typeof err._tag === "string" && known.has(err._tag)) return Effect.fail(err);
|
|
9
|
+
return Effect.fail(mkUnknown(err));
|
|
10
|
+
}));
|
|
11
|
+
};
|
|
12
|
+
/** Operator that catches every error: lets through tagged errors whose
|
|
13
|
+
* `_tag` is in `knownTags`, wraps everything else through `mkUnknown`.
|
|
14
|
+
*
|
|
15
|
+
* Use this for the outer plugin-pipeline catch where the aggregate E
|
|
16
|
+
* channel mixes plugin-typed errors with substrate-side unknowns. The
|
|
17
|
+
* output E channel is `KnownE | UnknownE` — callers parameterize
|
|
18
|
+
* `KnownE` at the call site (the runtime `_tag` check is the
|
|
19
|
+
* load-bearing part; the type parameter is documentation + a downstream
|
|
20
|
+
* narrowing aid).
|
|
21
|
+
*
|
|
22
|
+
* Two call shapes:
|
|
23
|
+
* - Direct: `passthroughOrWrap<KnownE, UnknownE>(tags, mkUnknown)` —
|
|
24
|
+
* explicit on both type params.
|
|
25
|
+
* - Curried: `passthroughOrWrap.for<KnownE>()(tags, mkUnknown)` — pin
|
|
26
|
+
* `KnownE` up front so TS infers `UnknownE` from `mkUnknown`'s
|
|
27
|
+
* return type at the second call. Preferred when `KnownE` is a
|
|
28
|
+
* plugin-side union that doesn't appear in the args. */
|
|
29
|
+
const passthroughOrWrap = Object.assign(buildPassthroughOrWrap, { for: () => (knownTags, mkUnknown) => buildPassthroughOrWrap(knownTags, mkUnknown) });
|
|
30
|
+
//#endregion
|
|
31
|
+
export { passthroughOrWrap };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=passthrough-or-wrap.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passthrough-or-wrap.mjs","names":[],"sources":["../../../src/substrate/runtime/passthrough-or-wrap.ts"],"sourcesContent":["// passthroughOrWrap — collapse the recurring \"let known tagged errors\n// through; wrap everything else into one canonical plugin-side error\"\n// shape that every plugin's outer pipeline implements.\n//\n// Plugins routinely compose `Effect.gen` bodies whose aggregate `E`\n// channel includes substrate-side errors with shapes the plugin author\n// doesn't statically know (artifact-publisher produce bodies, dependency\n// reads). `Effect.catchTags` requires a statically-known tagged union, so\n// the recurring pattern is either a long catchTags chain that re-fails\n// each known tag, or a runtime `_tag` discriminator check that walks the\n// known list and wraps the rest. Both shapes spell out the same logic in\n// 10-20 lines per plugin.\n//\n// This helper centralizes that: caller supplies the list of known tagged\n// `_tag` literals plus a `mkUnknown` constructor; helper returns an\n// Effect operator that lets known errors through unchanged (typed E\n// channel preserved at the call site) and wraps anything else through\n// `mkUnknown`.\n//\n// Distilled-doc § Invariants: already-typed errors must NOT be re-wrapped\n// by the catch-all unknown handler. Putting this in one place enforces\n// that invariant by construction.\n\nimport { Effect } from 'effect';\n\n/** Internal: build the operator from a known-tag set + unknown\n * wrapper. Shared by both the direct and curried entry points. */\nconst buildPassthroughOrWrap =\n\t<KnownE extends { readonly _tag: string }, UnknownE>(\n\t\tknownTags: ReadonlyArray<KnownE['_tag']>,\n\t\tmkUnknown: (cause: unknown) => UnknownE,\n\t) =>\n\t<A, R, EIn = KnownE>(\n\t\tself: Effect.Effect<A, EIn, R>,\n\t): Effect.Effect<A, KnownE | UnknownE, R> => {\n\t\tconst known = new Set<string>(knownTags);\n\t\treturn self.pipe(\n\t\t\tEffect.catch(\n\t\t\t\t(err: unknown): Effect.Effect<never, KnownE | UnknownE> => {\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof err === 'object' &&\n\t\t\t\t\t\terr !== null &&\n\t\t\t\t\t\t'_tag' in err &&\n\t\t\t\t\t\ttypeof (err as { _tag: unknown })._tag === 'string' &&\n\t\t\t\t\t\tknown.has((err as { _tag: string })._tag)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn Effect.fail(err as KnownE);\n\t\t\t\t\t}\n\t\t\t\t\treturn Effect.fail(mkUnknown(err));\n\t\t\t\t},\n\t\t\t),\n\t\t);\n\t};\n\n/** Operator that catches every error: lets through tagged errors whose\n * `_tag` is in `knownTags`, wraps everything else through `mkUnknown`.\n *\n * Use this for the outer plugin-pipeline catch where the aggregate E\n * channel mixes plugin-typed errors with substrate-side unknowns. The\n * output E channel is `KnownE | UnknownE` — callers parameterize\n * `KnownE` at the call site (the runtime `_tag` check is the\n * load-bearing part; the type parameter is documentation + a downstream\n * narrowing aid).\n *\n * Two call shapes:\n * - Direct: `passthroughOrWrap<KnownE, UnknownE>(tags, mkUnknown)` —\n * explicit on both type params.\n * - Curried: `passthroughOrWrap.for<KnownE>()(tags, mkUnknown)` — pin\n * `KnownE` up front so TS infers `UnknownE` from `mkUnknown`'s\n * return type at the second call. Preferred when `KnownE` is a\n * plugin-side union that doesn't appear in the args. */\nexport const passthroughOrWrap: {\n\t<KnownE extends { readonly _tag: string }, UnknownE>(\n\t\tknownTags: ReadonlyArray<KnownE['_tag']>,\n\t\tmkUnknown: (cause: unknown) => UnknownE,\n\t): <A, R, EIn = KnownE>(\n\t\tself: Effect.Effect<A, EIn, R>,\n\t) => Effect.Effect<A, KnownE | UnknownE, R>;\n\tfor: <KnownE extends { readonly _tag: string }>() => <UnknownE>(\n\t\tknownTags: ReadonlyArray<KnownE['_tag']>,\n\t\tmkUnknown: (cause: unknown) => UnknownE,\n\t) => <A, R, EIn = KnownE>(\n\t\tself: Effect.Effect<A, EIn, R>,\n\t) => Effect.Effect<A, KnownE | UnknownE, R>;\n} = Object.assign(buildPassthroughOrWrap, {\n\tfor:\n\t\t<KnownE extends { readonly _tag: string }>() =>\n\t\t<UnknownE>(\n\t\t\tknownTags: ReadonlyArray<KnownE['_tag']>,\n\t\t\tmkUnknown: (cause: unknown) => UnknownE,\n\t\t) =>\n\t\t\tbuildPassthroughOrWrap<KnownE, UnknownE>(knownTags, mkUnknown),\n});\n"],"mappings":";;;;AA2BA,MAAM,0BAEJ,WACA,eAGA,SAC4C;CAC5C,MAAM,QAAQ,IAAI,IAAY,UAAU;AACxC,QAAO,KAAK,KACX,OAAO,OACL,QAA0D;AAC1D,MACC,OAAO,QAAQ,YACf,QAAQ,QACR,UAAU,OACV,OAAQ,IAA0B,SAAS,YAC3C,MAAM,IAAK,IAAyB,KAAK,CAEzC,QAAO,OAAO,KAAK,IAAc;AAElC,SAAO,OAAO,KAAK,UAAU,IAAI,CAAC;GAEnC,CACD;;;;;;;;;;;;;;;;;;;AAoBH,MAAa,oBAaT,OAAO,OAAO,wBAAwB,EACzC,YAGE,WACA,cAEA,uBAAyC,WAAW,UAAU,EAChE,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { Identity } from "../identity.mjs";
|
|
|
2
2
|
import { Context, Layer, Path } from "effect";
|
|
3
3
|
|
|
4
4
|
//#region src/substrate/runtime/paths.d.ts
|
|
5
|
-
declare const IdentityContext_base: Context.ServiceClass<IdentityContext, "@devstack
|
|
5
|
+
declare const IdentityContext_base: Context.ServiceClass<IdentityContext, "@devstack/substrate/Identity", Identity>;
|
|
6
6
|
/**
|
|
7
7
|
* Identity-bound. Same shape as `substrate/identity.ts`'s `Identity`,
|
|
8
8
|
* but lifted into a Context service so path resolution can yield it
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context, Effect, Layer, Path } from "effect";
|
|
2
2
|
//#region src/substrate/runtime/paths.ts
|
|
3
|
-
var RuntimeRoot = class extends Context.Service()("@devstack
|
|
3
|
+
var RuntimeRoot = class extends Context.Service()("@devstack/substrate/RuntimeRoot") {};
|
|
4
4
|
/** Build a `RuntimeRoot` layer pinned to a literal path. */
|
|
5
5
|
const layerRuntimeRoot = (root) => Layer.succeed(RuntimeRoot)({ root });
|
|
6
6
|
/**
|
|
@@ -11,14 +11,14 @@ const layerRuntimeRoot = (root) => Layer.succeed(RuntimeRoot)({ root });
|
|
|
11
11
|
* Boot wires this once (Identity is validated up front); the
|
|
12
12
|
* resolver and every consumer reads from this single source.
|
|
13
13
|
*/
|
|
14
|
-
var IdentityContext = class extends Context.Service()("@devstack
|
|
14
|
+
var IdentityContext = class extends Context.Service()("@devstack/substrate/Identity") {};
|
|
15
15
|
const layerIdentity = (identity) => Layer.succeed(IdentityContext)(identity);
|
|
16
16
|
/**
|
|
17
17
|
* The path resolver service. Yields `StackPaths` once per stack —
|
|
18
18
|
* `Effect.cached`-friendly since `Identity` + `RuntimeRoot` are
|
|
19
19
|
* boot-immutable.
|
|
20
20
|
*/
|
|
21
|
-
var StackPathsService = class extends Context.Service()("@devstack
|
|
21
|
+
var StackPathsService = class extends Context.Service()("@devstack/substrate/StackPaths") {};
|
|
22
22
|
/**
|
|
23
23
|
* Layer that materializes the resolver from `RuntimeRoot` +
|
|
24
24
|
* `IdentityContext` + the Effect `Path` service. The cache helper
|
|
@@ -49,6 +49,7 @@ const layerStackPaths = Layer.effect(StackPathsService, Effect.gen(function* ()
|
|
|
49
49
|
snapshotDir: path.join(stackRoot, "snapshots"),
|
|
50
50
|
stackLockFile: path.join(stackRoot, "stack.lock"),
|
|
51
51
|
rosterFile: path.join(stackRoot, "roster.json"),
|
|
52
|
+
containerClaimsFile: path.join(stackRoot, "container-claims.json"),
|
|
52
53
|
snapshotReservationFile: path.join(stackRoot, "snapshot.reservation"),
|
|
53
54
|
cacheEntry,
|
|
54
55
|
cacheChainDir,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.mjs","names":[],"sources":["../../../src/substrate/runtime/paths.ts"],"sourcesContent":["// Unified path resolver.\n//\n// Architecture § \"What's collapsed\" — three path resolvers\n// (state-store, service-paths, snapshot) consolidate to one. This is\n// the L0 helper every disk-touching subsystem reaches for; nothing\n// else in the runtime package may compose `<root>/stacks/<stack>/...`\n// by hand.\n//\n// The resolver is a typed bundle: given an `Identity` and the\n// `RuntimeRoot`, it returns the closed set of paths the substrate\n// understands. Subsystems that need a sub-path inside one of those\n// (e.g. cache namespace + chain + content-hash) compose ON TOP of the\n// bundle's `cacheDir`, but they NEVER reach for\n// `path.join(root, 'stacks', stack)` themselves.\n\nimport { Context, Effect, Layer, Path } from 'effect';\n\nimport type { Identity } from '../identity.ts';\n\n/**\n * Runtime root — the on-disk base under which every stack's state\n * lives. Defaults to `.devstack`, but is injectable so tests pin to\n * a tempdir and parallel-stack tests pin to per-test prefixes.\n *\n * Held as a tagged service so the rest of the substrate can request\n * it without threading the string through every signature.\n */\nexport interface RuntimeRootShape {\n\treadonly root: string;\n}\n\nexport class RuntimeRoot extends Context.Service<RuntimeRoot, RuntimeRootShape>()(\n\t'@devstack
|
|
1
|
+
{"version":3,"file":"paths.mjs","names":[],"sources":["../../../src/substrate/runtime/paths.ts"],"sourcesContent":["// Unified path resolver.\n//\n// Architecture § \"What's collapsed\" — three path resolvers\n// (state-store, service-paths, snapshot) consolidate to one. This is\n// the L0 helper every disk-touching subsystem reaches for; nothing\n// else in the runtime package may compose `<root>/stacks/<stack>/...`\n// by hand.\n//\n// The resolver is a typed bundle: given an `Identity` and the\n// `RuntimeRoot`, it returns the closed set of paths the substrate\n// understands. Subsystems that need a sub-path inside one of those\n// (e.g. cache namespace + chain + content-hash) compose ON TOP of the\n// bundle's `cacheDir`, but they NEVER reach for\n// `path.join(root, 'stacks', stack)` themselves.\n\nimport { Context, Effect, Layer, Path } from 'effect';\n\nimport type { Identity } from '../identity.ts';\n\n/**\n * Runtime root — the on-disk base under which every stack's state\n * lives. Defaults to `.devstack`, but is injectable so tests pin to\n * a tempdir and parallel-stack tests pin to per-test prefixes.\n *\n * Held as a tagged service so the rest of the substrate can request\n * it without threading the string through every signature.\n */\nexport interface RuntimeRootShape {\n\treadonly root: string;\n}\n\nexport class RuntimeRoot extends Context.Service<RuntimeRoot, RuntimeRootShape>()(\n\t'@devstack/substrate/RuntimeRoot',\n) {}\n\n/** Build a `RuntimeRoot` layer pinned to a literal path. */\nexport const layerRuntimeRoot = (root: string): Layer.Layer<RuntimeRoot> =>\n\tLayer.succeed(RuntimeRoot)({ root });\n\n/**\n * Identity-bound. Same shape as `substrate/identity.ts`'s `Identity`,\n * but lifted into a Context service so path resolution can yield it\n * without taking it as a function argument.\n *\n * Boot wires this once (Identity is validated up front); the\n * resolver and every consumer reads from this single source.\n */\nexport class IdentityContext extends Context.Service<IdentityContext, Identity>()(\n\t'@devstack/substrate/Identity',\n) {}\n\nexport const layerIdentity = (identity: Identity): Layer.Layer<IdentityContext> =>\n\tLayer.succeed(IdentityContext)(identity);\n\n/**\n * Closed bundle the resolver returns. Three groups of paths:\n *\n * - `stackRoot` and the cross-process artifacts (lock, roster,\n * command channel, snapshot reservation) live directly under the stack\n * directory. Cross-process safety lives here.\n * - `stateFile` is the per-stack state-store JSON. ONE file per\n * stack — schema-validated on read.\n * - `cacheDir` is the parent directory; the cache subsystem\n * composes `<cacheDir>/<namespace>/<chainId>/<contentHash>.json`\n * via a helper on this resolver. Subsystems do NOT reach into\n * `cacheDir` with their own `path.join` calls.\n */\nexport interface StackPaths {\n\treadonly stackRoot: string;\n\treadonly stateFile: string;\n\treadonly stateLockHint: string;\n\treadonly cacheDir: string;\n\treadonly snapshotDir: string;\n\treadonly stackLockFile: string;\n\treadonly rosterFile: string;\n\t/** Sibling of `rosterFile` — the per-container claim ledger that\n\t * the roster module mutates under `stack.lock`. Composing this\n\t * inside the substrate path resolver keeps the discipline \"nothing\n\t * else builds cache/cross-process paths\" closed: the roster module\n\t * reads this field rather than reconstructing\n\t * `dirname(rosterFile) + 'container-claims.json'` itself. */\n\treadonly containerClaimsFile: string;\n\treadonly snapshotReservationFile: string;\n\t/**\n\t * Helper that composes the cache entry path from cache-key\n\t * components. The substrate folds the components together here so\n\t * that nothing else in the runtime tree builds cache paths.\n\t */\n\treadonly cacheEntry: (\n\t\tnamespace: string,\n\t\tchain: string,\n\t\tcontentHash: string,\n\t) => { readonly dir: string; readonly file: string };\n\t/** Helper that returns the cache namespace directory for a given\n\t * namespace + chain — for `readDirectory` enumeration. */\n\treadonly cacheChainDir: (namespace: string, chain: string) => string;\n\t/** Helper that returns the cache namespace directory (across all\n\t * chains) — for namespace-scoped enumeration. */\n\treadonly cacheNamespaceDir: (namespace: string) => string;\n}\n\n/**\n * The path resolver service. Yields `StackPaths` once per stack —\n * `Effect.cached`-friendly since `Identity` + `RuntimeRoot` are\n * boot-immutable.\n */\nexport class StackPathsService extends Context.Service<StackPathsService, StackPaths>()(\n\t'@devstack/substrate/StackPaths',\n) {}\n\n/**\n * Layer that materializes the resolver from `RuntimeRoot` +\n * `IdentityContext` + the Effect `Path` service. The cache helper\n * uses `Path.join` so OS-correct separators round-trip on Windows\n * (defense-in-depth — devstack is posix-only in practice but the\n * cost of `Path.join` over template strings is zero).\n */\nexport const layerStackPaths: Layer.Layer<\n\tStackPathsService,\n\tnever,\n\tRuntimeRoot | IdentityContext | Path.Path\n> = Layer.effect(\n\tStackPathsService,\n\tEffect.gen(function* () {\n\t\tconst { root } = yield* RuntimeRoot;\n\t\tconst identity = yield* IdentityContext;\n\t\tconst path = yield* Path.Path;\n\t\tconst stackRoot = path.join(root, 'stacks', identity.stack);\n\t\tconst cacheDir = path.join(stackRoot, 'cache');\n\t\tconst cacheNamespaceDir = (namespace: string): string => path.join(cacheDir, namespace);\n\t\tconst cacheChainDir = (namespace: string, chain: string): string =>\n\t\t\tpath.join(cacheNamespaceDir(namespace), chain);\n\t\tconst cacheEntry = (\n\t\t\tnamespace: string,\n\t\t\tchain: string,\n\t\t\tcontentHash: string,\n\t\t): { readonly dir: string; readonly file: string } => {\n\t\t\tconst dir = cacheChainDir(namespace, chain);\n\t\t\treturn { dir, file: path.join(dir, `${contentHash}.json`) };\n\t\t};\n\t\treturn StackPathsService.of({\n\t\t\tstackRoot,\n\t\t\tstateFile: path.join(stackRoot, 'state.json'),\n\t\t\tstateLockHint: path.join(stackRoot, 'state.json.lock'),\n\t\t\tcacheDir,\n\t\t\tsnapshotDir: path.join(stackRoot, 'snapshots'),\n\t\t\tstackLockFile: path.join(stackRoot, 'stack.lock'),\n\t\t\trosterFile: path.join(stackRoot, 'roster.json'),\n\t\t\tcontainerClaimsFile: path.join(stackRoot, 'container-claims.json'),\n\t\t\tsnapshotReservationFile: path.join(stackRoot, 'snapshot.reservation'),\n\t\t\tcacheEntry,\n\t\t\tcacheChainDir,\n\t\t\tcacheNamespaceDir,\n\t\t});\n\t}),\n);\n"],"mappings":";;AA+BA,IAAa,cAAb,cAAiC,QAAQ,SAAwC,CAChF,kCACA,CAAC;;AAGF,MAAa,oBAAoB,SAChC,MAAM,QAAQ,YAAY,CAAC,EAAE,MAAM,CAAC;;;;;;;;;AAUrC,IAAa,kBAAb,cAAqC,QAAQ,SAAoC,CAChF,+BACA,CAAC;AAEF,MAAa,iBAAiB,aAC7B,MAAM,QAAQ,gBAAgB,CAAC,SAAS;;;;;;AAsDzC,IAAa,oBAAb,cAAuC,QAAQ,SAAwC,CACtF,iCACA,CAAC;;;;;;;;AASF,MAAa,kBAIT,MAAM,OACT,mBACA,OAAO,IAAI,aAAa;CACvB,MAAM,EAAE,SAAS,OAAO;CACxB,MAAM,WAAW,OAAO;CACxB,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,YAAY,KAAK,KAAK,MAAM,UAAU,SAAS,MAAM;CAC3D,MAAM,WAAW,KAAK,KAAK,WAAW,QAAQ;CAC9C,MAAM,qBAAqB,cAA8B,KAAK,KAAK,UAAU,UAAU;CACvF,MAAM,iBAAiB,WAAmB,UACzC,KAAK,KAAK,kBAAkB,UAAU,EAAE,MAAM;CAC/C,MAAM,cACL,WACA,OACA,gBACqD;EACrD,MAAM,MAAM,cAAc,WAAW,MAAM;AAC3C,SAAO;GAAE;GAAK,MAAM,KAAK,KAAK,KAAK,GAAG,YAAY,OAAO;GAAE;;AAE5D,QAAO,kBAAkB,GAAG;EAC3B;EACA,WAAW,KAAK,KAAK,WAAW,aAAa;EAC7C,eAAe,KAAK,KAAK,WAAW,kBAAkB;EACtD;EACA,aAAa,KAAK,KAAK,WAAW,YAAY;EAC9C,eAAe,KAAK,KAAK,WAAW,aAAa;EACjD,YAAY,KAAK,KAAK,WAAW,cAAc;EAC/C,qBAAqB,KAAK,KAAK,WAAW,wBAAwB;EAClE,yBAAyB,KAAK,KAAK,WAAW,uBAAuB;EACrE;EACA;EACA;EACA,CAAC;EACD,CACF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import "../../primitives/artifact-publisher.mjs";
|
|
2
|
+
import { Effect, Ref } from "effect";
|
|
3
|
+
//#region src/substrate/runtime/phase-preserving-produce.ts
|
|
4
|
+
/** Wrap a domain-typed `produce` Effect so the typed error survives the
|
|
5
|
+
* substrate's `ArtifactPublishError` boundary.
|
|
6
|
+
*
|
|
7
|
+
* Inputs:
|
|
8
|
+
* - `produce`: the typed produce Effect (`<Produced, TypedError, R>`).
|
|
9
|
+
* This is the Effect the caller would otherwise place in
|
|
10
|
+
* `ArtifactSpec.produce` directly.
|
|
11
|
+
* - `wrapProduceError`: projects `TypedError` to `ArtifactPublishError`
|
|
12
|
+
* for the substrate-facing channel. Mirrors the `Effect.mapError`
|
|
13
|
+
* closure callers would write inline.
|
|
14
|
+
*
|
|
15
|
+
* Returns `{ wrappedProduce, recoverTypedError }`:
|
|
16
|
+
* - `wrappedProduce`: the Effect to place in `ArtifactSpec.produce` —
|
|
17
|
+
* surfaces only `ArtifactPublishError` (substrate contract) but
|
|
18
|
+
* stashes the typed cause into the Ref before the wrap.
|
|
19
|
+
* - `recoverTypedError`: a `pipe`-able recovery step. Apply via
|
|
20
|
+
* `.pipe(recoverTypedError)` AFTER `publisher.publish(...)` to
|
|
21
|
+
* restore the typed error channel. `reason: 'produce-failed'` lifts
|
|
22
|
+
* the stashed typed error; other reasons propagate untouched. */
|
|
23
|
+
const withPhasePreservingProduce = (params) => Effect.gen(function* () {
|
|
24
|
+
const stashed = yield* Ref.make(null);
|
|
25
|
+
const wrappedProduce = params.produce.pipe(Effect.tapError((err) => Ref.set(stashed, err)), Effect.mapError(params.wrapProduceError));
|
|
26
|
+
const recoverTypedError = (self) => self.pipe(Effect.catchTag("ArtifactPublishError", (err) => Effect.gen(function* () {
|
|
27
|
+
const seen = yield* Ref.get(stashed);
|
|
28
|
+
const typedErr = err;
|
|
29
|
+
if (seen !== null && typedErr.reason === "produce-failed") return yield* Effect.fail(seen);
|
|
30
|
+
return yield* Effect.fail(typedErr);
|
|
31
|
+
})));
|
|
32
|
+
return {
|
|
33
|
+
wrappedProduce,
|
|
34
|
+
recoverTypedError
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
//#endregion
|
|
38
|
+
export { withPhasePreservingProduce };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=phase-preserving-produce.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phase-preserving-produce.mjs","names":[],"sources":["../../../src/substrate/runtime/phase-preserving-produce.ts"],"sourcesContent":["// withPhasePreservingProduce — substrate helper for the\n// \"Ref-stash typed error across ArtifactPublishError wrap\" pattern.\n//\n// Background: `ArtifactPublisher.publish` requires the `produce` Effect\n// to surface failures as `ArtifactPublishError` (substrate contract —\n// the substrate is name-blind, so domain-typed errors cannot reach the\n// substrate's failure channel). For most plugins this is fine: the\n// produce body's typed error is projected directly to\n// `artifactPublishError('produce-failed', message)` via `mapError` and\n// the plugin caller sees a generic ArtifactPublishError it then maps\n// back to its domain (e.g. deepbook's `mapArtifactError`).\n//\n// But the Action plugin needs to preserve the original typed error's\n// `phase` discriminator across the wrap: the user-supplied body Effect\n// emits `ActionError` with one of several `phase` literals\n// (`'sign' | 'parse' | …`), and consumers `catchTag('ActionError')`\n// expecting that `phase` to survive. The substrate's wrap would\n// uniformly stamp every failure as `phase: 'sign'`.\n//\n// This helper captures the pattern: stash the typed error in a Ref\n// before the mapError boundary, then recover it on the\n// `ArtifactPublishError` recovery seam. Only `reason: 'produce-failed'`\n// surfaces a stashed typed error — the substrate-side reasons\n// (`verify-exhausted`, `cache-corrupt`) have no upstream typed error\n// and propagate as ArtifactPublishError untouched.\n//\n// Boundary discipline: lives under `substrate/runtime/` because the\n// pattern is generic over any tagged typed error — no plugin-domain\n// shape leaks in. The single piece of plugin knowledge the helper\n// requires (the `wrapProduceError` projection) is passed in by the\n// caller.\n//\n// Currently consumed by the Action plugin (`plugins/action/service.ts`).\n// The Package plugin (`plugins/package/mode-local.ts:149-152`) has a\n// similar shape ripe for migration but has not yet adopted the helper —\n// migrate when the next package-plugin pass surfaces.\n\nimport { Effect, Ref } from 'effect';\n\nimport { type ArtifactPublishError } from '../../primitives/artifact-publisher.ts';\n\n/** Wrap a domain-typed `produce` Effect so the typed error survives the\n * substrate's `ArtifactPublishError` boundary.\n *\n * Inputs:\n * - `produce`: the typed produce Effect (`<Produced, TypedError, R>`).\n * This is the Effect the caller would otherwise place in\n * `ArtifactSpec.produce` directly.\n * - `wrapProduceError`: projects `TypedError` to `ArtifactPublishError`\n * for the substrate-facing channel. Mirrors the `Effect.mapError`\n * closure callers would write inline.\n *\n * Returns `{ wrappedProduce, recoverTypedError }`:\n * - `wrappedProduce`: the Effect to place in `ArtifactSpec.produce` —\n * surfaces only `ArtifactPublishError` (substrate contract) but\n * stashes the typed cause into the Ref before the wrap.\n * - `recoverTypedError`: a `pipe`-able recovery step. Apply via\n * `.pipe(recoverTypedError)` AFTER `publisher.publish(...)` to\n * restore the typed error channel. `reason: 'produce-failed'` lifts\n * the stashed typed error; other reasons propagate untouched. */\nexport const withPhasePreservingProduce = <Produced, TypedError, R>(params: {\n\treadonly produce: Effect.Effect<Produced, TypedError, R>;\n\treadonly wrapProduceError: (err: TypedError) => ArtifactPublishError;\n}): Effect.Effect<\n\t{\n\t\treadonly wrappedProduce: Effect.Effect<Produced, ArtifactPublishError, R>;\n\t\treadonly recoverTypedError: <A, E, RR>(\n\t\t\tself: Effect.Effect<A, E, RR>,\n\t\t) => Effect.Effect<A, TypedError | Exclude<E, ArtifactPublishError>, RR>;\n\t},\n\tnever,\n\tnever\n> =>\n\tEffect.gen(function* () {\n\t\t// Stash slot — typed `TypedError | null`. Set on `produce` failure\n\t\t// BEFORE the mapError boundary so the outer recovery can read it.\n\t\tconst stashed = yield* Ref.make<TypedError | null>(null);\n\n\t\tconst wrappedProduce: Effect.Effect<Produced, ArtifactPublishError, R> = params.produce.pipe(\n\t\t\t// Stash the typed error before the mapError boundary so the\n\t\t\t// outer recovery path can re-raise with the original tag\n\t\t\t// (and phase, for `ActionError`-style discriminators) intact.\n\t\t\tEffect.tapError((err) => Ref.set(stashed, err)),\n\t\t\tEffect.mapError(params.wrapProduceError),\n\t\t);\n\n\t\tconst recoverTypedError = <A, E, RR>(\n\t\t\tself: Effect.Effect<A, E, RR>,\n\t\t): Effect.Effect<A, TypedError | Exclude<E, ArtifactPublishError>, RR> =>\n\t\t\t(self as Effect.Effect<A, E | ArtifactPublishError, RR>).pipe(\n\t\t\t\t// Recover the stashed typed error if produce raised one.\n\t\t\t\t// `verify-exhausted` / `cache-corrupt` are substrate-side\n\t\t\t\t// signals with no upstream typed error — they propagate\n\t\t\t\t// untouched.\n\t\t\t\tEffect.catchTag('ArtifactPublishError', (err) =>\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tconst seen = yield* Ref.get(stashed);\n\t\t\t\t\t\tconst typedErr = err as ArtifactPublishError;\n\t\t\t\t\t\tif (seen !== null && typedErr.reason === 'produce-failed') {\n\t\t\t\t\t\t\treturn yield* Effect.fail(seen);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn yield* Effect.fail(typedErr);\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t) as Effect.Effect<A, TypedError | Exclude<E, ArtifactPublishError>, RR>;\n\n\t\treturn { wrappedProduce, recoverTypedError };\n\t});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAa,8BAAuD,WAanE,OAAO,IAAI,aAAa;CAGvB,MAAM,UAAU,OAAO,IAAI,KAAwB,KAAK;CAExD,MAAM,iBAAmE,OAAO,QAAQ,KAIvF,OAAO,UAAU,QAAQ,IAAI,IAAI,SAAS,IAAI,CAAC,EAC/C,OAAO,SAAS,OAAO,iBAAiB,CACxC;CAED,MAAM,qBACL,SAEC,KAAwD,KAKxD,OAAO,SAAS,yBAAyB,QACxC,OAAO,IAAI,aAAa;EACvB,MAAM,OAAO,OAAO,IAAI,IAAI,QAAQ;EACpC,MAAM,WAAW;AACjB,MAAI,SAAS,QAAQ,SAAS,WAAW,iBACxC,QAAO,OAAO,OAAO,KAAK,KAAK;AAEhC,SAAO,OAAO,OAAO,KAAK,SAAS;GAClC,CACF,CACD;AAEF,QAAO;EAAE;EAAgB;EAAmB;EAC3C"}
|