@mysten-incubation/devstack 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -11
- package/dashboard-ui/assets/{grpc-Clz0oOtc.js → grpc-CpkDu4SA.js} +1 -1
- package/dashboard-ui/assets/{index-Cmqv9kiU.js → index-jLPRmjst.js} +2 -2
- package/dashboard-ui/index.html +1 -1
- package/dist/api/inference-network.d.mts +5 -5
- package/dist/api/inference-network.mjs +5 -5
- package/dist/api/inference-network.mjs.map +1 -1
- package/dist/api/run-stack-internal.mjs +1 -3
- package/dist/api/run-stack-internal.mjs.map +1 -1
- package/dist/build-integrations/dapp-kit/index.d.mts +12 -0
- package/dist/build-integrations/dapp-kit/index.mjs +14 -1
- package/dist/build-integrations/dapp-kit/index.mjs.map +1 -1
- package/dist/build-integrations/playwright/errors.d.mts +1 -1
- package/dist/build-integrations/playwright/errors.mjs.map +1 -1
- package/dist/build-integrations/playwright/index.d.mts +2 -2
- package/dist/build-integrations/playwright/index.mjs +2 -2
- package/dist/build-integrations/playwright/wallet-context.d.mts +2 -1
- package/dist/build-integrations/playwright/wallet-context.mjs +141 -41
- package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
- package/dist/build-integrations/runtime/dapp-kit-slot.mjs +1 -1
- package/dist/build-integrations/runtime/dapp-kit-slot.mjs.map +1 -1
- package/dist/build-integrations/vite/index.d.mts +54 -42
- package/dist/build-integrations/vite/index.mjs +239 -106
- package/dist/build-integrations/vite/index.mjs.map +1 -1
- package/dist/build-integrations/vitest/global-setup.mjs +8 -8
- package/dist/build-integrations/vitest/global-setup.mjs.map +1 -1
- package/dist/cli/main.mjs +3 -2
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/wirings/apply.mjs +0 -1
- package/dist/cli/wirings/apply.mjs.map +1 -1
- package/dist/cli/wirings/codegen.mjs +2 -3
- package/dist/cli/wirings/codegen.mjs.map +1 -1
- package/dist/cli/wirings/dump-deployment.mjs +141 -0
- package/dist/cli/wirings/dump-deployment.mjs.map +1 -0
- package/dist/cli/wirings/snapshot.mjs +0 -1
- package/dist/cli/wirings/snapshot.mjs.map +1 -1
- package/dist/contracts/codegenable.d.mts +22 -25
- package/dist/contracts/codegenable.mjs +35 -4
- package/dist/contracts/codegenable.mjs.map +1 -1
- package/dist/contracts/config-bindings.mjs +43 -18
- package/dist/contracts/config-bindings.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/orchestrators/boot.d.mts +0 -10
- package/dist/orchestrators/boot.mjs +19 -59
- package/dist/orchestrators/boot.mjs.map +1 -1
- package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
- package/dist/orchestrators/codegen/config-runtime.mjs +137 -112
- package/dist/orchestrators/codegen/config-runtime.mjs.map +1 -1
- package/dist/orchestrators/codegen/deployment-network-file.mjs +130 -0
- package/dist/orchestrators/codegen/deployment-network-file.mjs.map +1 -0
- package/dist/orchestrators/codegen/deployment-strict.mjs +77 -0
- package/dist/orchestrators/codegen/deployment-strict.mjs.map +1 -0
- package/dist/orchestrators/codegen/deployment.d.mts +63 -0
- package/dist/orchestrators/codegen/deployment.mjs +153 -0
- package/dist/orchestrators/codegen/deployment.mjs.map +1 -0
- package/dist/orchestrators/codegen/errors.mjs +7 -9
- package/dist/orchestrators/codegen/errors.mjs.map +1 -1
- package/dist/orchestrators/codegen/format.mjs +20 -1
- package/dist/orchestrators/codegen/format.mjs.map +1 -1
- package/dist/orchestrators/codegen/paths.mjs +1 -8
- package/dist/orchestrators/codegen/paths.mjs.map +1 -1
- package/dist/orchestrators/codegen/service.mjs +354 -141
- package/dist/orchestrators/codegen/service.mjs.map +1 -1
- package/dist/orchestrators/layers.mjs +0 -1
- package/dist/orchestrators/layers.mjs.map +1 -1
- package/dist/orchestrators/network-options.d.mts +37 -35
- package/dist/orchestrators/network-options.mjs +13 -10
- package/dist/orchestrators/network-options.mjs.map +1 -1
- package/dist/plugins/account/codegen.d.mts +3 -4
- package/dist/plugins/account/codegen.mjs +5 -7
- package/dist/plugins/account/codegen.mjs.map +1 -1
- package/dist/plugins/account/index.mjs +1 -3
- package/dist/plugins/account/index.mjs.map +1 -1
- package/dist/plugins/coin/codegen.mjs +5 -5
- package/dist/plugins/coin/codegen.mjs.map +1 -1
- package/dist/plugins/coin/index.mjs.map +1 -1
- package/dist/plugins/dashboard/schema/root.mjs +3 -1
- package/dist/plugins/dashboard/schema/root.mjs.map +1 -1
- package/dist/plugins/deepbook/codegen.mjs +4 -4
- package/dist/plugins/deepbook/codegen.mjs.map +1 -1
- package/dist/plugins/deepbook/index.d.mts +36 -6
- package/dist/plugins/deepbook/index.mjs +52 -16
- package/dist/plugins/deepbook/index.mjs.map +1 -1
- package/dist/plugins/internal/codegen-helpers.mjs +0 -1
- package/dist/plugins/internal/codegen-helpers.mjs.map +1 -1
- package/dist/plugins/package/codegen.d.mts +1 -12
- package/dist/plugins/package/codegen.mjs +43 -25
- package/dist/plugins/package/codegen.mjs.map +1 -1
- package/dist/plugins/package/dep-resolution.mjs +1 -1
- package/dist/plugins/package/dep-resolution.mjs.map +1 -1
- package/dist/plugins/package/index.d.mts +14 -11
- package/dist/plugins/package/index.mjs +6 -7
- package/dist/plugins/package/index.mjs.map +1 -1
- package/dist/plugins/seal/codegen.d.mts +5 -0
- package/dist/plugins/seal/codegen.mjs +55 -12
- package/dist/plugins/seal/codegen.mjs.map +1 -1
- package/dist/plugins/seal/index.d.mts +64 -19
- package/dist/plugins/seal/index.mjs +26 -36
- package/dist/plugins/seal/index.mjs.map +1 -1
- package/dist/plugins/seal/mode/fork-known.d.mts +0 -2
- package/dist/plugins/seal/mode/fork-known.mjs +11 -22
- package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
- package/dist/plugins/seal/mode/live.d.mts +36 -13
- package/dist/plugins/seal/mode/live.mjs +104 -43
- package/dist/plugins/seal/mode/live.mjs.map +1 -1
- package/dist/plugins/seal/mode/local-keygen.mjs +2 -1
- package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
- package/dist/plugins/seal/registry-publish.d.mts +15 -3
- package/dist/plugins/seal/registry-publish.mjs.map +1 -1
- package/dist/plugins/sui/codegen.mjs +5 -4
- package/dist/plugins/sui/codegen.mjs.map +1 -1
- package/dist/plugins/sui/index.mjs +1 -2
- package/dist/plugins/sui/index.mjs.map +1 -1
- package/dist/plugins/wallet/codegen.d.mts +8 -12
- package/dist/plugins/wallet/codegen.mjs +22 -15
- package/dist/plugins/wallet/codegen.mjs.map +1 -1
- package/dist/plugins/wallet/index.d.mts +4 -3
- package/dist/plugins/wallet/index.mjs +1 -1
- package/dist/plugins/wallet/index.mjs.map +1 -1
- package/dist/plugins/wallet/service.d.mts +2 -2
- package/dist/plugins/wallet/service.mjs +2 -3
- package/dist/plugins/wallet/service.mjs.map +1 -1
- package/dist/plugins/walrus/codegen.mjs +4 -4
- package/dist/plugins/walrus/codegen.mjs.map +1 -1
- package/dist/plugins/walrus/index.d.mts +137 -8
- package/dist/plugins/walrus/index.mjs +46 -9
- package/dist/plugins/walrus/index.mjs.map +1 -1
- package/dist/plugins/walrus/mode/known-deploy.d.mts +5 -1
- package/dist/plugins/walrus/mode/known-deploy.mjs +13 -10
- package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
- package/dist/substrate/manifest.d.mts +17 -22
- package/dist/substrate/manifest.mjs +4 -6
- package/dist/substrate/manifest.mjs.map +1 -1
- package/dist/substrate/plugin-ctx.d.mts +6 -6
- package/dist/substrate/plugin-ctx.mjs.map +1 -1
- package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
- package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
- package/dist/substrate/runtime/paths.mjs +1 -1
- package/dist/surfaces/cli/command-tree.mjs +6 -6
- package/dist/surfaces/cli/command-tree.mjs.map +1 -1
- package/dist/surfaces/cli/index.mjs +6 -4
- package/dist/surfaces/cli/index.mjs.map +1 -1
- package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/cli/wirings/dump-ids.mjs +0 -86
- package/dist/cli/wirings/dump-ids.mjs.map +0 -1
- package/dist/orchestrators/codegen/id-config.d.mts +0 -1
- package/dist/orchestrators/codegen/id-config.mjs +0 -107
- package/dist/orchestrators/codegen/id-config.mjs.map +0 -1
- package/dist/orchestrators/codegen/output-location.mjs +0 -32
- package/dist/orchestrators/codegen/output-location.mjs.map +0 -1
- package/dist/plugins/seal/service.mjs +0 -17
- package/dist/plugins/seal/service.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boot.mjs","names":["Logger"],"sources":["../../src/orchestrators/boot.ts"],"sourcesContent":["// Single L3 boot seam.\n//\n// Consumed by both the CLI verb wirings (`cli/wirings/*`) and the\n// library-facing programmatic surface (`api/run-stack.ts`), plus the e2e\n// boot harness.\n//\n// Composes the substrate Layer stack (L0) + the Docker `ContainerRuntime`\n// adapter (L1), yields the substrate services into a `Context.Context<never>`\n// pluginContext, builds the projection ref, and runs `supervise()` inside a\n// scope. The production orchestrator assembly (Snapshot/Router/Codegen/\n// ManifestEndpoint) and the contribution-delivery dispatcher live here too —\n// the supervisor holds the dispatcher record opaquely (it never imports an\n// orchestrator service).\n//\n// Architecture: this is L3 (orchestrator-level). Layer composition that\n// assembles L0+L1 stacks belongs at L3/L4 — it can't live in `substrate/`\n// because it imports a concrete L1 adapter (Docker) by definition; and it\n// depends on L2 plugin internals (coin/package registries), so it can't live\n// at L1 runtime either. See ARCHITECTURE.md § \"Layer composition belongs at\n// L3/L4, not L0\" and § \"L1-never-imports-from-L2\".\n\nimport { Context, Effect, FileSystem, Layer, Ref, Scope, SubscriptionRef } from 'effect';\nimport { isAbsolute, join, resolve } from 'node:path';\nimport * as NodeFileSystem from '@effect/platform-node/NodeFileSystem';\nimport * as NodePath from '@effect/platform-node/NodePath';\nimport * as NodeChildProcessSpawner from '@effect/platform-node/NodeChildProcessSpawner';\nimport { ChildProcessSpawner } from 'effect/unstable/process/ChildProcessSpawner';\n\nimport type { Identity } from '../substrate/identity.ts';\nimport { CacheService, layerCache } from '../substrate/runtime/cache/index.ts';\nimport { LeaseBrokerService, layerLeaseBroker } from '../substrate/runtime/lease-broker/index.ts';\nimport {\n\tIdentityContext,\n\tRuntimeRoot,\n\tStackPathsService,\n\tlayerIdentity,\n\tlayerRuntimeRoot,\n\tlayerStackPaths,\n} from '../substrate/runtime/paths.ts';\nimport { PortBrokerService, layerPortBroker } from '../substrate/runtime/port-broker/index.ts';\nimport {\n\tStrategyRegistryService,\n\tlayerStrategyRegistry,\n} from '../substrate/runtime/strategy-registry/index.ts';\nimport {\n\tContainerRuntimeService,\n\tDockerSpawner,\n\tlayerContainerRuntimeDocker,\n\tlayerDockerCycleInitial,\n\tlayerDockerHostDefault,\n} from '../runtime/docker/index.ts';\nimport { readResolvedSync } from '../substrate/runtime/lifecycle/index.ts';\nimport { operationalEndpointEventsFromResolvedValue } from '../substrate/runtime/projection/operational-endpoints.ts';\nimport { Logger, layerLogger } from '../substrate/runtime/observability/index.ts';\nimport {\n\tPostAcquireTasksService,\n\tlayerPostAcquireTasks,\n} from '../substrate/runtime/post-acquire-tasks.ts';\nimport {\n\tallReadyOrTerminal,\n\tstartSupervisor,\n\ttype ContributionDispatcher,\n\ttype SupervisedStack,\n\ttype SupervisorCommandHandler,\n\ttype SupervisorHandle,\n\ttype SupervisorPostAcquireHook,\n} from '../substrate/runtime/supervisor/index.ts';\nimport type { ContributionDispatchContext } from '../substrate/runtime/supervisor/contribution-dispatcher.ts';\nimport type { SupervisorPostAcquireContext } from '../substrate/runtime/supervisor/index.ts';\n\nimport {\n\tlayerMystenMoveCodegen,\n\tMoveCodegenService,\n\tMoveSummaryRunnerService,\n} from './codegen/bindings.ts';\nimport { layerSuiMoveSummaryRunnerDocker } from '../plugins/sui/move-summary-runner.ts';\nimport { CodegenPathsService, layerCodegenPaths, layerCodegenRoot } from './codegen/paths.ts';\nimport { resolveCodegenOutput } from './codegen/output-location.ts';\nimport {\n\tCodegenOrchestratorService,\n\tlayerCodegenOrchestrator,\n\ttype Codegenable,\n} from './codegen/service.ts';\nimport { CodegenWriteFailed } from './codegen/errors.ts';\nimport { ID_CONFIG_FILENAME, writeIdConfig } from './codegen/id-config.ts';\nimport {\n\tDEFAULT_TRAEFIK_IMAGE,\n\tlayerDockerUpstreamResolver,\n\tlayerEntrypointRegistry,\n\tlayerRouterConfigLiteral,\n\tlayerRouterService,\n\tlayerTraefikContainerOpsDocker,\n\tRouterService,\n\ttype ResolvedRoute,\n} from './router/index.ts';\nimport { BUILT_IN_ENTRYPOINTS } from '../plugins/router-entrypoints.ts';\nimport {\n\tmakeDefaultRouterProfile,\n\ttype DefaultRouterProfileOptions,\n\ttype RouterProfile,\n} from './router/profile.ts';\nimport { layerSnapshotOrchestrator, SnapshotOrchestratorService } from './snapshot/index.ts';\nimport type { ProjectionDecl } from '../contracts/projection.ts';\nimport type { RoutableDecl } from '../contracts/routable.ts';\nimport type { SnapshotableDecl } from '../contracts/snapshotable.ts';\nimport type { StrategyContributorDecl } from '../contracts/strategy-contributor.ts';\nimport { endpointKey, type PluginKey } from '../substrate/brand.ts';\nimport type { EngineEvent } from '../substrate/events.ts';\nimport {\n\tbuildEnvelope,\n\tCURRENT_MANIFEST_VERSION,\n\twriteManifest,\n} from '../substrate/runtime/manifest/index.ts';\nimport {\n\tManifestExtrasLookupError,\n\tresolveManifestExtras,\n\ttype EndpointEntry,\n\ttype ManifestExtrasInput,\n} from '../substrate/manifest.ts';\nimport { resolveNetworkOptions } from './network-options.ts';\nimport { CoinRegistryService, layerCoinRegistry } from '../plugins/coin/registry.ts';\nimport { PackageRegistryService, layerPackageRegistry } from '../plugins/package/registry.ts';\n\n// ───────────────────────────────────────────────────────────────────────────\n// Substrate lifecycle\n// ───────────────────────────────────────────────────────────────────────────\n\n/** Substrate Layer stack for a single supervised run. Composes every L0\n * service the supervisor yields from its R-channel, plus the L1 Docker\n * `ContainerRuntime`. Built-in plugin services are layered outside\n * substrate and added through `extendContext`. */\nexport const buildSubstrateLayers = (identity: Identity, runtimeRoot: string) => {\n\t// DockerSpawner adapts platform-node's ChildProcessSpawner tag onto\n\t// the docker subsystem's local DockerSpawner tag (same shape; the\n\t// indirection only lets tests inject a stub).\n\tconst layerDockerSpawnerFromNode: Layer.Layer<DockerSpawner, never, ChildProcessSpawner> =\n\t\tLayer.effect(\n\t\t\tDockerSpawner,\n\t\t\tEffect.gen(function* () {\n\t\t\t\treturn yield* ChildProcessSpawner;\n\t\t\t}),\n\t\t);\n\n\tconst platformBase = Layer.mergeAll(\n\t\tlayerIdentity(identity),\n\t\tlayerRuntimeRoot(runtimeRoot),\n\t\tNodePath.layer,\n\t\tNodeFileSystem.layer,\n\t\tlayerDockerHostDefault,\n\t\tlayerDockerCycleInitial,\n\t\tlayerStrategyRegistry,\n\t);\n\n\tconst childProcessSpawnerWired = NodeChildProcessSpawner.layer.pipe(\n\t\tLayer.provideMerge(platformBase),\n\t);\n\tconst withStackPaths = layerStackPaths.pipe(Layer.provideMerge(childProcessSpawnerWired));\n\tconst withCache = layerCache.pipe(Layer.provideMerge(withStackPaths));\n\tconst withPortBroker = layerPortBroker.pipe(Layer.provideMerge(withCache));\n\tconst withLeaseBroker = layerLeaseBroker.pipe(Layer.provideMerge(withPortBroker));\n\tconst withSpawnerAdapter = layerDockerSpawnerFromNode.pipe(Layer.provideMerge(withLeaseBroker));\n\tconst withContainerRuntime = layerContainerRuntimeDocker.pipe(\n\t\tLayer.provideMerge(withSpawnerAdapter),\n\t);\n\tconst withPostAcquireTasks = layerPostAcquireTasks.pipe(Layer.provideMerge(withContainerRuntime));\n\treturn layerLogger.pipe(Layer.provideMerge(withPostAcquireTasks));\n};\n\n/** Build the opaque `Context.Context<never>` the supervisor hands to\n * every plugin's `acquire` body. Yields every substrate service the\n * Docker-backed substrate layer stack provides; downstream callers\n * may extend the context (e.g. layering the built-in plugin registries\n * via `extendBuiltInPluginContext`) before passing it to `supervise()`. */\nconst buildPluginContext = (): Effect.Effect<\n\tContext.Context<never>,\n\tnever,\n\t| IdentityContext\n\t| RuntimeRoot\n\t| StackPathsService\n\t| CacheService\n\t| StrategyRegistryService\n\t| ContainerRuntimeService\n\t| PortBrokerService\n\t| LeaseBrokerService\n\t| PostAcquireTasksService\n\t| Logger\n> =>\n\tEffect.gen(function* () {\n\t\tconst identityCtx = yield* IdentityContext;\n\t\tconst runtimeRootResolved = yield* RuntimeRoot;\n\t\tconst stackPaths = yield* StackPathsService;\n\t\tconst cache = yield* CacheService;\n\t\tconst registry = yield* StrategyRegistryService;\n\t\tconst containerRuntime = yield* ContainerRuntimeService;\n\t\tconst portBroker = yield* PortBrokerService;\n\t\tconst leaseBroker = yield* LeaseBrokerService;\n\t\tconst postAcquireTasks = yield* PostAcquireTasksService;\n\t\tconst logger = yield* Logger;\n\n\t\treturn Context.empty().pipe(\n\t\t\tContext.add(IdentityContext, identityCtx),\n\t\t\tContext.add(RuntimeRoot, runtimeRootResolved),\n\t\t\tContext.add(StackPathsService, stackPaths),\n\t\t\tContext.add(CacheService, cache),\n\t\t\tContext.add(StrategyRegistryService, registry),\n\t\t\tContext.add(ContainerRuntimeService, containerRuntime),\n\t\t\tContext.add(PortBrokerService, portBroker),\n\t\t\tContext.add(LeaseBrokerService, leaseBroker),\n\t\t\tContext.add(PostAcquireTasksService, postAcquireTasks),\n\t\t\tContext.add(Logger, logger),\n\t\t) as Context.Context<never>;\n\t});\n\n/** Options accepted by the supervised-run entrypoint. `lifetime`\n * selects long-running supervision versus a one-shot acquire/codegen\n * cycle. The `beforeInitialAcquire` hook runs inside the supervised\n * scope before the first acquire starts; live renderers use it to\n * subscribe to startup projection changes. The `withinScope` hook\n * runs after the first acquire completes.\n *\n * Generic `R` widens the hook R-channel so callers can yield\n * substrate services (e.g. `StackPathsService`) that are in scope at\n * the supervisor-boot site. */\nexport interface SuperviseStackOptions<R = Scope.Scope, ExtendR = never, HookE = never> {\n\treadonly lifetime?: 'long-running' | 'one-shot';\n\treadonly devstackVersion?: string;\n\treadonly beforeInitialAcquire?: (handle: SupervisorHandle) => Effect.Effect<void, HookE, R>;\n\treadonly withinScope?: (handle: SupervisorHandle) => Effect.Effect<void, HookE, R>;\n\treadonly commandHandler?: SupervisorCommandHandler;\n\treadonly contributionDispatcher?: ContributionDispatcher;\n\treadonly postAcquireHook?: SupervisorPostAcquireHook;\n\t/** Caller-supplied extension layered into `pluginContext` after the\n\t * default substrate context is built. Used by plugin-author Layer\n\t * composition (ARCHITECTURE.md § Plugin-author extension) and by\n\t * the CLI when it wants to inject the built-in plugin registries or\n\t * a custom Logger override. */\n\treadonly extendContext?: (\n\t\tctx: Context.Context<never>,\n\t) => Effect.Effect<Context.Context<never>, never, ExtendR>;\n}\n\n/** Effect that boots the supervisor for `stack` and blocks on the\n * supervisor's shutdown latch. Returns the final `SubscribableState`\n * snapshot so callers (CLI, library handle) can inspect post-shutdown\n * state. */\nexport const superviseStackEffect = <R = Scope.Scope, ExtendR = never, HookE = never>(\n\tstack: SupervisedStack,\n\tidentity: Identity,\n\tstate: SubscriptionRef.SubscriptionRef<import('../substrate/projection.ts').SubscribableState>,\n\topts: SuperviseStackOptions<R, ExtendR, HookE> = {},\n) =>\n\tEffect.gen(function* () {\n\t\treturn yield* Effect.scoped(\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst baseContext = yield* buildPluginContext();\n\t\t\t\tconst pluginContext =\n\t\t\t\t\topts.extendContext === undefined ? baseContext : yield* opts.extendContext(baseContext);\n\n\t\t\t\tconst startup = yield* startSupervisor(\n\t\t\t\t\tstack,\n\t\t\t\t\tidentity,\n\t\t\t\t\tstate,\n\t\t\t\t\tpluginContext,\n\t\t\t\t\topts.contributionDispatcher,\n\t\t\t\t\topts.commandHandler,\n\t\t\t\t\topts.postAcquireHook,\n\t\t\t\t\t{\n\t\t\t\t\t\tcommandLoop: opts.lifetime !== 'one-shot',\n\t\t\t\t\t\t...(opts.devstackVersion === undefined\n\t\t\t\t\t\t\t? {}\n\t\t\t\t\t\t\t: { devstackVersion: opts.devstackVersion }),\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tconst { handle } = startup;\n\t\t\t\tif (opts.beforeInitialAcquire !== undefined) {\n\t\t\t\t\tyield* opts.beforeInitialAcquire(handle);\n\t\t\t\t}\n\t\t\t\tif (opts.lifetime === 'one-shot') {\n\t\t\t\t\t// `runInitialAcquire` runs `acquireFullGraph` to completion (every\n\t\t\t\t\t// node reaches a terminal status) before it returns. Gate the\n\t\t\t\t\t// one-shot `withinScope` on the SUPERVISOR-OWNED readiness signal\n\t\t\t\t\t// — `allReadyOrTerminal` (`ready || done`) — NOT a per-node\n\t\t\t\t\t// `awaitReady` watcher. A run-to-completion `task` node lands in\n\t\t\t\t\t// `done`; the registry contract admits a `done`-status node whose\n\t\t\t\t\t// `readyGate` is unresolved (only `markReady`/`markFailed` resolve\n\t\t\t\t\t// it), so a per-node gate HANGS on it. This is the SAME\n\t\t\t\t\t// `done`-tolerant gate S1 gave the long-running path; reading\n\t\t\t\t\t// statuses never suspends, so it is hang-free.\n\t\t\t\t\tyield* startup.runInitialAcquire;\n\t\t\t\t\tyield* allReadyOrTerminal(startup.handle.graph, startup.handle.registry);\n\t\t\t\t\tif (opts.withinScope !== undefined) {\n\t\t\t\t\t\tyield* opts.withinScope(handle);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst outcome = yield* Effect.raceFirst(\n\t\t\t\t\tstartup.runInitialAcquire.pipe(Effect.as('booted' as const)),\n\t\t\t\t\thandle.awaitShutdown.pipe(Effect.as('shutdown' as const)),\n\t\t\t\t);\n\t\t\t\tif (outcome === 'shutdown') {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (opts.withinScope !== undefined) {\n\t\t\t\t\tyield* opts.withinScope(handle);\n\t\t\t\t}\n\t\t\t\tyield* handle.awaitShutdown;\n\t\t\t}),\n\t\t);\n\t});\n\n// ───────────────────────────────────────────────────────────────────────────\n// Production orchestrator assembly\n// ───────────────────────────────────────────────────────────────────────────\n\nexport interface ProductionCodegenOptions {\n\treadonly appRoot?: string;\n\t/** Resolved absolute path to the dev-only + secret `generated-extras`\n\t * tree for this stack, threaded into `CodegenRoot.extrasDir` and\n\t * recorded in the manifest as `codegen.extrasDir` for the\n\t * `@devstack-dev` Vite alias. This is the ONLY tree boot's codegen\n\t * writes (`emitExtras`); boot never emits the committed `src/generated`\n\t * tree, so it pins no live `outputDir` — the `CodegenRoot.outputDir`\n\t * the production path carries is an unwritten default. The committed\n\t * tree is owned solely by the stack-free `codegen` verb (wired\n\t * separately, where it resolves its own output path). */\n\treadonly extrasDir?: string;\n\t/** Forwarded verbatim to `@mysten/codegen`'s\n\t * `generateFromPackageSummary` via `layerMystenMoveCodegen` — see\n\t * `DevstackOptions['codegen']` for the full contract. Default `false`\n\t * (`@mysten/codegen`'s own default): phantom-only structs render as\n\t * consts with the phantom placeholder baked into `.name`; `true`\n\t * renders them as factories whose required type arguments compose a\n\t * fully-qualified type tag. */\n\treadonly includePhantomTypeParameters?: boolean;\n}\n\n/**\n * The ONE boot seam that maps a stack's codegen config to the production\n * codegen orchestrator options for a LIVE (`'ran'`) projection. Both\n * composition entry points (`api/run-stack.ts` and `orchestrators/layers.ts`)\n * call this so the live output-dir decision (via `resolveCodegenOutput`)\n * is wired exactly once: EVERY live run — including what used to be the\n * \"primary\" stack — emits into `<appRoot>/.devstack/stacks/<stack>/generated`,\n * so the id-bearing live tree never lands in the committed source tree and\n * two stacks never clobber. The committed `src/generated` tree is owned\n * solely by the stack-free `codegen` verb. The resolved literal\n * `outputDir`/`stackSubdir`/`extrasDir` flow into\n * `layerProductionOrchestrators({ codegen })` unchanged — `paths.ts` keeps\n * consuming literals (minimal blast radius).\n *\n * The per-stack inputs: the app root, the resolved effective stack\n * (already through the explicit-`--stack` > `config.stackName` > inferred\n * ladder), and the app's optional explicit `codegen` pins.\n */\nexport const resolveProductionCodegenOptions = (input: {\n\treadonly appRoot: string;\n\treadonly effectiveStack: string;\n\treadonly codegen?:\n\t\t| {\n\t\t\t\treadonly includePhantomTypeParameters?: boolean;\n\t\t }\n\t\t| undefined;\n}): ProductionCodegenOptions => {\n\t// Every live run resolves its dev tree to\n\t// `<appRoot>/.devstack/stacks/<stack>/generated-extras` (the default\n\t// rule). Nothing is ever emitted into the live `generated` tree at boot\n\t// (boot writes only the per-stack `generated-extras` overlay +\n\t// `devstack-ids.json`), so there is no live `outputDir` to resolve — the\n\t// committed `src/generated` tree is owned solely by the stack-free\n\t// `codegen` verb (wired separately).\n\tconst resolved = resolveCodegenOutput({\n\t\tappRoot: input.appRoot,\n\t\teffectiveStack: input.effectiveStack,\n\t});\n\treturn {\n\t\tappRoot: input.appRoot,\n\t\textrasDir: resolved.extrasDir,\n\t\t// Pass-through verbatim — no resolution step; \"unset\" stays unset so\n\t\t// `@mysten/codegen`'s own default (false) applies at the call site.\n\t\t...(input.codegen?.includePhantomTypeParameters === undefined\n\t\t\t? {}\n\t\t\t: { includePhantomTypeParameters: input.codegen.includePhantomTypeParameters }),\n\t};\n};\n\nexport interface ProductionRouterOptions {\n\treadonly codegen?: ProductionCodegenOptions;\n\treadonly disabled?: boolean;\n}\n\nexport class ManifestEndpointRegistryService extends Context.Service<\n\tManifestEndpointRegistryService,\n\t{\n\t\treadonly register: (entry: EndpointEntry) => Effect.Effect<void, never, Scope.Scope>;\n\t\treadonly entries: Effect.Effect<ReadonlyArray<EndpointEntry>>;\n\t}\n>()('@devstack/orchestrators/ManifestEndpointRegistry') {}\n\nexport const layerManifestEndpointRegistry: Layer.Layer<ManifestEndpointRegistryService> =\n\tLayer.effect(\n\t\tManifestEndpointRegistryService,\n\t\tEffect.gen(function* () {\n\t\t\tconst entriesRef = yield* Ref.make<ReadonlyArray<EndpointEntry & { readonly seq: number }>>(\n\t\t\t\t[],\n\t\t\t);\n\t\t\tconst seqRef = yield* Ref.make(0);\n\n\t\t\tconst register = (entry: EndpointEntry): Effect.Effect<void, never, Scope.Scope> =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst seq = yield* Ref.updateAndGet(seqRef, (n) => n + 1);\n\t\t\t\t\tyield* Ref.update(entriesRef, (entries) => [...entries, { ...entry, seq }]);\n\t\t\t\t\tyield* Effect.addFinalizer(() =>\n\t\t\t\t\t\tRef.update(entriesRef, (entries) =>\n\t\t\t\t\t\t\tentries.filter((candidate) => candidate.seq !== seq),\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\treturn ManifestEndpointRegistryService.of({\n\t\t\t\tregister,\n\t\t\t\tentries: Ref.get(entriesRef).pipe(\n\t\t\t\t\tEffect.map((entries) =>\n\t\t\t\t\t\tentries.map((entryWithSeq) => {\n\t\t\t\t\t\t\tconst { seq, ...entry } = entryWithSeq;\n\t\t\t\t\t\t\tvoid seq;\n\t\t\t\t\t\t\treturn entry;\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t});\n\t\t}),\n\t);\n\nexport const productionRouterProfile = (options: DefaultRouterProfileOptions = {}): RouterProfile =>\n\tmakeDefaultRouterProfile(options);\n\n/** `outputDir` for the `CodegenRoot` of a `layerProductionOrchestrators`\n * composition. The production codegen path NEVER emits the committed\n * `src/generated` tree (boot writes only `generated-extras` via\n * `emitExtras`), so this directory is never written — it only has to wire\n * a valid, non-crashing `CodegenRoot`. It resolves to `<appRoot>/src/generated`\n * by convention. The committed tree is owned solely by the stack-free\n * `codegen` verb (wired separately, where it pins its own output path). */\nconst productionCodegenOutputDir = (appRoot: string): string => resolve(appRoot, 'src/generated');\n\n/** Fallback `generated-extras` dir for the cold-start / no-config\n * composition path (`buildDirectSnapshotLayers`). Callers that know\n * their stack (`run-stack`, the verb wirings) pass the resolved\n * per-stack value; this default only feeds direct-snapshot verbs that\n * never run codegen. */\nconst productionCodegenExtrasDir = (appRoot: string, extrasDir: string | undefined): string => {\n\tconst target = extrasDir ?? '.devstack/generated-extras';\n\treturn isAbsolute(target) ? target : resolve(appRoot, target);\n};\n\nexport const layerProductionOrchestrators = (router: ProductionRouterOptions = {}) => {\n\tconst profile = productionRouterProfile();\n\treturn Layer.mergeAll(\n\t\tlayerSnapshotOrchestrator,\n\t\tlayerManifestEndpointRegistry,\n\t\tlayerRouterService.pipe(\n\t\t\tLayer.provideMerge(\n\t\t\t\tLayer.mergeAll(\n\t\t\t\t\tlayerEntrypointRegistry(BUILT_IN_ENTRYPOINTS),\n\t\t\t\t\tlayerTraefikContainerOpsDocker,\n\t\t\t\t\tlayerDockerUpstreamResolver(profile),\n\t\t\t\t\tlayerRouterConfigLiteral({\n\t\t\t\t\t\tdisabled: router.disabled ?? false,\n\t\t\t\t\t\tprofile,\n\t\t\t\t\t\timage: DEFAULT_TRAEFIK_IMAGE,\n\t\t\t\t\t\trouteReadinessProbe: {\n\t\t\t\t\t\t\tenabled: router.disabled !== true,\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t),\n\t\tlayerCodegenOrchestrator,\n\t\tlayerCodegenPaths.pipe(\n\t\t\tLayer.provideMerge(\n\t\t\t\tlayerCodegenRoot({\n\t\t\t\t\toutputDir: productionCodegenOutputDir(router.codegen?.appRoot ?? process.cwd()),\n\t\t\t\t\tstackSubdir: null,\n\t\t\t\t\textrasDir: productionCodegenExtrasDir(\n\t\t\t\t\t\trouter.codegen?.appRoot ?? process.cwd(),\n\t\t\t\t\t\trouter.codegen?.extrasDir,\n\t\t\t\t\t),\n\t\t\t\t}),\n\t\t\t),\n\t\t),\n\t\tlayerSuiMoveSummaryRunnerDocker,\n\t\tlayerMystenMoveCodegen({\n\t\t\tincludePhantomTypeParameters: router.codegen?.includePhantomTypeParameters,\n\t\t}),\n\t);\n};\n\n/** The single adapter for routable endpoints: ONE `ResolvedRoute` (the\n * router's post-mint source of truth) → ALL THREE sink-feeds at once —\n * the router's own `route`, the manifest `EndpointEntry`, and the\n * projection `endpoint.registered` event — derived from one shared\n * field-set so the three sinks can never diverge. The `routable`\n * dispatch body feeds each sink from the object this returns; there is\n * no second, third derivation off the route anywhere.\n *\n * It owns the url-derivation: `tcp` routes carry `tcp://127.0.0.1:port`,\n * everything else `http://hostname:port`. Consumers (codegen, manifest)\n * translate `tcp://` to their protocol-specific scheme (`postgres://`,\n * `redis://`, …).\n *\n * `ResolvedRoute` only carries `entrypointName`, so the endpoint name is\n * recovered from the original `decl.endpointName`; `pluginKey` is supplied\n * by the dispatcher (it is not in `ResolvedRoute`). Router-only fields\n * (`dispatchFileId`/`cors`/`upstreamUrl`) are kept ON `route` for the\n * router sink but discarded from the manifest/projection field-set — those\n * schemas do not consume them. */\nexport const endpointSinksFromRoute = (\n\tdecl: RoutableDecl,\n\troute: ResolvedRoute,\n\tpluginKey: PluginKey,\n\tregisteredAt = Date.now(),\n) => {\n\tconst url =\n\t\troute.wireProtocol === 'tcp'\n\t\t\t? `tcp://127.0.0.1:${route.entrypointPort}`\n\t\t\t: `http://${route.hostname}:${route.entrypointPort}`;\n\tconst common = {\n\t\tname: decl.endpointName,\n\t\turl,\n\t\tdisplayUrl: null,\n\t\twireProtocol: route.wireProtocol,\n\t} as const;\n\tconst endpointKeyString = `${pluginKey}:${decl.endpointName}`;\n\tconst event: Extract<EngineEvent, { readonly tag: 'endpoint.registered' }> = {\n\t\ttag: 'endpoint.registered',\n\t\tendpoint: {\n\t\t\t...common,\n\t\t\tendpointKey: endpointKey(endpointKeyString),\n\t\t\tpluginKey,\n\t\t\tregisteredAt,\n\t\t},\n\t};\n\treturn {\n\t\troute,\n\t\tmanifestEntry: {\n\t\t\t...common,\n\t\t\tendpointKey: endpointKeyString,\n\t\t\tpluginKey: String(pluginKey),\n\t\t},\n\t\tevent,\n\t};\n};\n\nconst manifestEndpointEntryFromOperationalEndpoint = (\n\tendpoint: Extract<EngineEvent, { readonly tag: 'endpoint.registered' }>['endpoint'],\n): EndpointEntry => ({\n\tendpointKey: String(endpoint.endpointKey),\n\tname: endpoint.name,\n\turl: endpoint.url,\n\tdisplayUrl: endpoint.displayUrl,\n\twireProtocol: endpoint.wireProtocol,\n\tpluginKey: String(endpoint.pluginKey),\n});\n\n/** Project a projection decl's `rowKey` (when absent) onto the\n * contributing plugin so projection consumers can attribute the row.\n * The payload stays opaque from the substrate's POV. */\nconst projectionDispatch = (\n\tdecl: ProjectionDecl,\n\tctx: ContributionDispatchContext,\n): Effect.Effect<void, never, never> => {\n\tconst payload = decl.event.payload;\n\tconst payloadWithRowKey =\n\t\tpayload !== null &&\n\t\ttypeof payload === 'object' &&\n\t\t'rowKey' in payload &&\n\t\t(payload as { rowKey: unknown }).rowKey === null\n\t\t\t? { ...payload, rowKey: ctx.pluginKey }\n\t\t\t: payload;\n\treturn ctx.publish({\n\t\t...decl.event,\n\t\tpayload: payloadWithRowKey,\n\t});\n};\n\n/** Register a strategy contribution on the scope-local registry, publish\n * `strategy.registered`, and arm a finalizer publishing\n * `strategy.unregistered`. */\nconst strategyContributorDispatch = (\n\tdecl: StrategyContributorDecl<string, unknown>,\n\tctx: ContributionDispatchContext,\n): Effect.Effect<void, never, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tyield* ctx.strategyRegistry.register(decl.capabilityKey, decl.strategy, {\n\t\t\tautoMounted: decl.autoMounted,\n\t\t\t...(decl.priority === undefined ? {} : { priority: decl.priority }),\n\t\t});\n\t\tyield* ctx.publish({\n\t\t\ttag: 'strategy.registered',\n\t\t\tcapabilityKey: decl.capabilityKey,\n\t\t\tautoMounted: decl.autoMounted,\n\t\t\tat: Date.now(),\n\t\t});\n\t\tyield* Effect.addFinalizer(() =>\n\t\t\tctx.publish({\n\t\t\t\ttag: 'strategy.unregistered',\n\t\t\t\tcapabilityKey: decl.capabilityKey,\n\t\t\t\tat: Date.now(),\n\t\t\t}),\n\t\t);\n\t});\n\n/**\n * Build the production `ContributionDispatcher` — the closed seam the\n * supervisor replays each plugin's buffered contributions through after\n * a successful `start`. Each method's body reads its backing orchestrator\n * service (Snapshot/Router/Codegen/ManifestEndpoint) ONCE here and closes\n * over it; the substrate supervisor holds the resulting record opaquely\n * (it never imports an orchestrator service).\n */\nexport const buildProductionContributionDispatcher = (): Effect.Effect<\n\tContributionDispatcher,\n\tnever,\n\t| SnapshotOrchestratorService\n\t| RouterService\n\t| CodegenOrchestratorService\n\t| ManifestEndpointRegistryService\n> =>\n\tEffect.gen(function* () {\n\t\tconst snapshot = yield* SnapshotOrchestratorService;\n\t\tconst router = yield* RouterService;\n\t\tconst codegen = yield* CodegenOrchestratorService;\n\t\tconst manifestEndpoints = yield* ManifestEndpointRegistryService;\n\t\treturn {\n\t\t\tsnapshotable: (decl: SnapshotableDecl, ctx) =>\n\t\t\t\tsnapshot.registerParticipant(ctx.pluginKey, decl),\n\t\t\troutable: (decl: RoutableDecl, ctx) =>\n\t\t\t\trouter.boot().pipe(\n\t\t\t\t\t// Router sink: `contributeRoute` writes the dispatch file +\n\t\t\t\t\t// publishes the route onto `applied`, returning the post-mint\n\t\t\t\t\t// `ResolvedRoute` — the ONE source of truth.\n\t\t\t\t\tEffect.andThen(router.contributeRoute(decl)),\n\t\t\t\t\tEffect.flatMap((route) => {\n\t\t\t\t\t\t// One adapter off that ResolvedRoute yields BOTH remaining\n\t\t\t\t\t\t// sink-feeds; feed manifest then projection. No second\n\t\t\t\t\t\t// derivation off the route lives anywhere.\n\t\t\t\t\t\tconst sinks = endpointSinksFromRoute(decl, route, ctx.pluginKey);\n\t\t\t\t\t\treturn manifestEndpoints\n\t\t\t\t\t\t\t.register(sinks.manifestEntry)\n\t\t\t\t\t\t\t.pipe(Effect.andThen(ctx.publish(sinks.event)));\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\tcodegenable: (decl: Codegenable, ctx) => codegen.registerContribution(ctx.pluginKey, decl),\n\t\t\tprojection: (decl: ProjectionDecl, ctx) => projectionDispatch(decl, ctx),\n\t\t\tstrategyContributor: (decl: StrategyContributorDecl<string, unknown>, ctx) =>\n\t\t\t\tstrategyContributorDispatch(decl, ctx),\n\t\t} satisfies ContributionDispatcher;\n\t});\n\nconst makeManifestExtrasContext = (ctx: SupervisorPostAcquireContext) => {\n\tconst resourceIdToKey = new Map<string, PluginKey>();\n\tfor (const [key, node] of ctx.graph.nodes) {\n\t\tresourceIdToKey.set(node.member.id, key);\n\t}\n\t// `lookup` throws `ManifestExtrasLookupError` synchronously from\n\t// inside the user-supplied `extras` factory.\n\t// `resolveManifestExtras` invokes that factory under `Effect.try`\n\t// with a typed `catch` mapper, so the throw promotes to the typed\n\t// failure channel — callers `catchTag('ManifestExtrasLookupError',\n\t// ...)` rather than reading the die-cause. Non-tagged throws stay\n\t// defects, preserving the previous semantics for genuine\n\t// programmer errors inside the factory body.\n\tconst lookup = (resourceId: string): unknown => {\n\t\tconst key = resourceIdToKey.get(resourceId);\n\t\tif (key === undefined) {\n\t\t\tthrow new ManifestExtrasLookupError({\n\t\t\t\tkind: 'unknown-resource',\n\t\t\t\tresourceId,\n\t\t\t});\n\t\t}\n\t\tconst resolved = readResolvedSync(ctx.registry, key);\n\t\tif (resolved === undefined) {\n\t\t\tthrow new ManifestExtrasLookupError({\n\t\t\t\tkind: 'unresolved-resource',\n\t\t\t\tresourceId,\n\t\t\t});\n\t\t}\n\t\treturn resolved;\n\t};\n\treturn {\n\t\tvalue: (resource: { readonly id: string }) => lookup(resource.id),\n\t};\n};\n\nconst operationalManifestEndpointEntries = (\n\tctx: SupervisorPostAcquireContext,\n\troutableEntries: ReadonlyArray<EndpointEntry>,\n): ReadonlyArray<EndpointEntry> => {\n\tconst routablePluginKeys = new Set(routableEntries.map((entry) => entry.pluginKey));\n\tconst registeredAt = Date.now();\n\tconst entries: EndpointEntry[] = [];\n\tfor (const [key] of ctx.graph.nodes) {\n\t\tif (routablePluginKeys.has(String(key))) continue;\n\t\tconst resolved = readResolvedSync(ctx.registry, key);\n\t\tif (resolved === undefined) continue;\n\t\tfor (const event of operationalEndpointEventsFromResolvedValue(key, resolved, registeredAt)) {\n\t\t\tentries.push(manifestEndpointEntryFromOperationalEndpoint(event.endpoint));\n\t\t}\n\t}\n\treturn entries;\n};\n\nexport const buildProductionPostAcquireHook = (\n\toptions: {\n\t\treadonly extras?: ManifestExtrasInput;\n\t\treadonly networkOptions?: Readonly<Record<string, unknown>>;\n\t\t/** Dev-`up` only: the STATIC (id-free) codegen contributions to re-emit\n\t\t * the committed `src/generated` tree from when a Move-source edit\n\t\t * reacquires a package — the same decls the stack-free `codegen` verb\n\t\t * derives (`deriveContributions(stack.members)`), NOT the live ones\n\t\t * (which would bake on-chain ids into `config.ts`). Omitted for\n\t\t * `apply` / `runStack`, where the committed tree is an input. */\n\t\treadonly emitBindings?: ReadonlyArray<Codegenable>;\n\t} = {},\n): Effect.Effect<\n\tSupervisorPostAcquireHook,\n\tnever,\n\t| CodegenOrchestratorService\n\t| CodegenPathsService\n\t| FileSystem.FileSystem\n\t| StackPathsService\n\t| PostAcquireTasksService\n\t| ManifestEndpointRegistryService\n\t| MoveSummaryRunnerService\n\t| MoveCodegenService\n> =>\n\tEffect.gen(function* () {\n\t\tconst codegen = yield* CodegenOrchestratorService;\n\t\tconst paths = yield* CodegenPathsService;\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst stackPaths = yield* StackPathsService;\n\t\tconst postAcquireTasks = yield* PostAcquireTasksService;\n\t\tconst manifestEndpoints = yield* ManifestEndpointRegistryService;\n\t\t// Yielded here (outside the per-ctx hook) so the conditional\n\t\t// `generated-extras` flush below can provide them to `emitExtras`.\n\t\tconst moveRunner = yield* MoveSummaryRunnerService;\n\t\tconst moveCodegen = yield* MoveCodegenService;\n\t\treturn (ctx) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst extras = yield* resolveManifestExtras(options.extras, makeManifestExtrasContext(ctx));\n\t\t\t\tconst routableEndpoints = yield* manifestEndpoints.entries;\n\t\t\t\tconst endpoints = [\n\t\t\t\t\t...routableEndpoints,\n\t\t\t\t\t...operationalManifestEndpointEntries(ctx, routableEndpoints),\n\t\t\t\t];\n\t\t\t\t// Boot no longer runs codegen. Its only job is to PRODUCE the\n\t\t\t\t// id-config (loadable on-chain ids), which the Vite plugin injects\n\t\t\t\t// via `__DEVSTACK_IDS__` in dev. The committed `src/generated` tree\n\t\t\t\t// is written ONLY by the stack-free `devstack codegen` verb.\n\t\t\t\t// Assemble the id-config from the SAME live-resolved contributions\n\t\t\t\t// that fed `config.ts` and write it to the gitignored\n\t\t\t\t// `.devstack/stacks/<stack>/`.\n\t\t\t\tconst idConfig = yield* codegen.assembleIdConfig(String(ctx.identity.network)).pipe(\n\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t(cause) =>\n\t\t\t\t\t\t\tnew CodegenWriteFailed({\n\t\t\t\t\t\t\t\toutputPath: ID_CONFIG_FILENAME,\n\t\t\t\t\t\t\t\tstage: 'write',\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tconst idsFile = join(stackPaths.stackRoot, ID_CONFIG_FILENAME);\n\t\t\t\tyield* writeIdConfig(idsFile, idConfig).pipe(\n\t\t\t\t\tEffect.provideService(FileSystem.FileSystem, fs),\n\t\t\t\t);\n\t\t\t\tconst envelope = yield* buildEnvelope({\n\t\t\t\t\tidentity: {\n\t\t\t\t\t\tapp: ctx.identity.app,\n\t\t\t\t\t\tstack: ctx.identity.stack,\n\t\t\t\t\t\tnetwork: ctx.identity.network,\n\t\t\t\t\t},\n\t\t\t\t\tendpoints,\n\t\t\t\t\textras,\n\t\t\t\t\t// Record the dev-only `generated-extras` tree the\n\t\t\t\t\t// `@devstack-dev` Vite alias resolves and the live `idsFile`\n\t\t\t\t\t// the plugin injects as `__DEVSTACK_IDS__` — one decision, one\n\t\t\t\t\t// source of truth. Bindings are NOT recorded: `@generated`\n\t\t\t\t\t// always resolves to the committed `src/generated` tree written\n\t\t\t\t\t// by the stack-free `codegen` verb.\n\t\t\t\t\tcodegen: { extrasDir: paths.extrasDir, idsFile },\n\t\t\t\t});\n\t\t\t\tconst manifestPath = join(stackPaths.stackRoot, 'manifest.json');\n\t\t\t\tyield* writeManifest(envelope, manifestPath).pipe(\n\t\t\t\t\tEffect.provideService(FileSystem.FileSystem, fs),\n\t\t\t\t);\n\t\t\t\t// Conditionally flush the dev-only `generated-extras` tree\n\t\t\t\t// (dev wallet + accounts) — the ONE acquire-resolved surface the\n\t\t\t\t// stack-free `codegen` verb can't produce. Gated on the resolved\n\t\t\t\t// network's `devWallet` flag (per-network options, ON for every\n\t\t\t\t// network except live `mainnet`). When off, nothing is written\n\t\t\t\t// and the Vite plugin's `@devstack-dev` `load` hook no-ops.\n\t\t\t\tconst netOpts = resolveNetworkOptions(ctx.identity.network, options.networkOptions);\n\t\t\t\tconst extrasFiles: string[] = [];\n\t\t\t\tif (netOpts.devWallet) {\n\t\t\t\t\tconst extras = yield* codegen\n\t\t\t\t\t\t.emitExtras()\n\t\t\t\t\t\t.pipe(\n\t\t\t\t\t\t\tEffect.provideService(FileSystem.FileSystem, fs),\n\t\t\t\t\t\t\tEffect.provideService(CodegenPathsService, paths),\n\t\t\t\t\t\t\tEffect.provideService(MoveSummaryRunnerService, moveRunner),\n\t\t\t\t\t\t\tEffect.provideService(MoveCodegenService, moveCodegen),\n\t\t\t\t\t\t);\n\t\t\t\t\textrasFiles.push(...extras.filesWritten, ...extras.filesChmod);\n\t\t\t\t}\n\t\t\t\t// Dev-`up` only: regenerate the committed `src/generated` tree from\n\t\t\t\t// the STATIC (id-free) contributions so an edited Move package's new\n\t\t\t\t// struct/function shapes reach the app (Vite HMRs the changed TS)\n\t\t\t\t// WITHOUT baking the live on-chain id into `config.ts`.\n\t\t\t\t// `runEmitCycle` is content-addressed, so the initial boot and any\n\t\t\t\t// no-op reacquire leave the tree (and its mtimes) untouched.\n\t\t\t\tconst bindingFiles: string[] = [];\n\t\t\t\tif (options.emitBindings !== undefined) {\n\t\t\t\t\tconst emitted = yield* codegen\n\t\t\t\t\t\t.emitBindings(options.emitBindings)\n\t\t\t\t\t\t.pipe(\n\t\t\t\t\t\t\tEffect.provideService(FileSystem.FileSystem, fs),\n\t\t\t\t\t\t\tEffect.provideService(CodegenPathsService, paths),\n\t\t\t\t\t\t\tEffect.provideService(MoveSummaryRunnerService, moveRunner),\n\t\t\t\t\t\t\tEffect.provideService(MoveCodegenService, moveCodegen),\n\t\t\t\t\t\t);\n\t\t\t\t\tbindingFiles.push(...emitted.filesWritten, ...emitted.filesChmod);\n\t\t\t\t}\n\t\t\t\tyield* postAcquireTasks.runAll;\n\t\t\t\treturn [\n\t\t\t\t\t{\n\t\t\t\t\t\ttag: 'manifest.flushed' as const,\n\t\t\t\t\t\tmanifestVersion: CURRENT_MANIFEST_VERSION,\n\t\t\t\t\t\tat: Date.now(),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\ttag: 'codegen.emitted' as const,\n\t\t\t\t\t\tfiles: [idsFile, ...extrasFiles, ...bindingFiles],\n\t\t\t\t\t\tat: Date.now(),\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t});\n\t});\n\n// ───────────────────────────────────────────────────────────────────────────\n// Built-in plugin runtime composition\n//\n// Depends on L2 plugin internals (coin/package registries), so it can't live\n// at L1 runtime — hence its home in this L3 boot module.\n// ───────────────────────────────────────────────────────────────────────────\n\n/** Built-in plugin runtime: the per-stack coin + package registries.\n * Coin auto-discovery from a fresh package publish now runs DIRECTLY in\n * the package plugin's `start` (folding the publish output into the\n * CoinRegistry), so the registries are the whole surface. */\nexport const layerBuiltInPluginRuntime: Layer.Layer<CoinRegistryService | PackageRegistryService> =\n\tLayer.mergeAll(layerCoinRegistry, layerPackageRegistry);\n\nexport const extendBuiltInPluginContext = (\n\tctx: Context.Context<never>,\n): Effect.Effect<\n\tContext.Context<never>,\n\tnever,\n\tCoinRegistryService | PackageRegistryService | SnapshotOrchestratorService | FileSystem.FileSystem\n> =>\n\tEffect.gen(function* () {\n\t\tconst coinRegistry = yield* CoinRegistryService;\n\t\tconst packageRegistry = yield* PackageRegistryService;\n\t\t// Thread the snapshot orchestrator + filesystem into the plugin\n\t\t// runtime context so the supervisor can populate the control-plane\n\t\t// `domain` surface (snapshot list/restore/delete, which never\n\t\t// round-trip through the void `publishCommand`). The\n\t\t// `ContainerRuntimeService` the domain also needs is already in the\n\t\t// base substrate plugin context.\n\t\tconst snapshotOrchestrator = yield* SnapshotOrchestratorService;\n\t\tconst fileSystem = yield* FileSystem.FileSystem;\n\t\treturn ctx.pipe(\n\t\t\tContext.add(CoinRegistryService, coinRegistry),\n\t\t\tContext.add(PackageRegistryService, packageRegistry),\n\t\t\tContext.add(SnapshotOrchestratorService, snapshotOrchestrator),\n\t\t\tContext.add(FileSystem.FileSystem, fileSystem),\n\t\t) as Context.Context<never>;\n\t});\n\n// ───────────────────────────────────────────────────────────────────────────\n// Production supervised-boot assembly — THE single dedup site\n// ───────────────────────────────────────────────────────────────────────────\n\n/** The per-caller inputs to {@link superviseStackWithProductionBoot} — the\n * fields that GENUINELY differ between the long-running programmatic seam\n * (`api/run-stack-internal.ts`) and the one-shot CLI verbs (`apply` /\n * `snapshot`). Everything else — the contribution dispatcher, the\n * post-acquire hook, and the built-in plugin-context extension — is\n * assembled identically by the helper, so it lives in ONE place. */\nexport interface ProductionBootOptions<HookR = Scope.Scope, HookE = never, ExtendR = never> {\n\t/** `'one-shot'` runs the acquire/codegen cycle then returns; the default\n\t * `'long-running'` supervises until shutdown. */\n\treadonly lifetime?: 'long-running' | 'one-shot';\n\treadonly devstackVersion?: string;\n\t/** Threaded into `buildProductionPostAcquireHook` — the stack's manifest\n\t * `extras`. All three callers pass `stack.options.extras`. */\n\treadonly extras?: ManifestExtrasInput;\n\t/** Threaded into `buildProductionPostAcquireHook` — the stack's\n\t * per-network options. The hook resolves the active network's slice to\n\t * decide whether to flush the dev-only `generated-extras` tree. All\n\t * three callers pass `stack.options.networkOptions`. */\n\treadonly networkOptions?: Readonly<Record<string, unknown>>;\n\t/** Dev-`up` only: the STATIC (id-free) codegen contributions used to\n\t * regenerate the committed `src/generated` tree in the post-acquire hook\n\t * when a Move-source edit reacquires a package. Threaded from the `up`\n\t * seam (`deriveContributions(stack.members)`); `apply` / `snapshot` leave\n\t * it off so they never rewrite the committed tree. */\n\treadonly emitBindings?: ReadonlyArray<Codegenable>;\n\t/** The resolved supervisor command handler (run-stack's snapshot bridge).\n\t * One-shot verbs run no command loop, so they pass nothing. */\n\treadonly commandHandler?: SupervisorCommandHandler;\n\treadonly beforeInitialAcquire?: (handle: SupervisorHandle) => Effect.Effect<void, HookE, HookR>;\n\treadonly withinScope?: (handle: SupervisorHandle) => Effect.Effect<void, HookE, HookR>;\n\t/** Caller plugin-context extension layered AFTER the built-in\n\t * (`extendBuiltInPluginContext`). Only the programmatic seam uses it (to\n\t * honor the public `runStack({ extendContext })`); the CLI verbs omit it\n\t * and get the built-in extension alone. */\n\treadonly extendContextAfterBuiltIn?: (\n\t\tctx: Context.Context<never>,\n\t) => Effect.Effect<Context.Context<never>, never, ExtendR>;\n}\n\n/**\n * THE single site that assembles the production supervised body. It builds\n * the contribution dispatcher + post-acquire hook + built-in plugin-context\n * extension ONCE and hands them to {@link superviseStackEffect}, then\n * provides {@link layerBuiltInPluginRuntime}. Before this helper, the same\n * three-piece assembly was hand-rolled in three call sites\n * (`api/run-stack-internal.ts`, `cli/wirings/apply.ts`,\n * `cli/wirings/snapshot.ts`); now they all route through here and only\n * supply what genuinely differs ({@link ProductionBootOptions}).\n *\n * Each caller keeps its OWN lifetime-specific wrapping: the programmatic\n * seam wraps the returned effect in a `forkDetach` handle (long-running);\n * the CLI verbs run it to completion with their existing teardown + result\n * semantics (one-shot). This helper does NOT collapse those — it only\n * dedups the assembly the `superviseStackEffect` call sites shared.\n *\n * The return type is inferred (like `superviseStackEffect`): its R-channel\n * is the union of every substrate/orchestrator service the dispatcher /\n * hook / extension read, MINUS the built-in registries `layerBuiltInPluginRuntime`\n * supplies, PLUS the caller hook `HookR` / extend `ExtendR` channels.\n */\nexport const superviseStackWithProductionBoot = <\n\tHookR = Scope.Scope,\n\tHookE = never,\n\tExtendR = never,\n>(\n\tstack: SupervisedStack,\n\tidentity: Identity,\n\tstate: SubscriptionRef.SubscriptionRef<import('../substrate/projection.ts').SubscribableState>,\n\topts: ProductionBootOptions<HookR, HookE, ExtendR> = {},\n) =>\n\tEffect.gen(function* () {\n\t\tconst contributionDispatcher = yield* buildProductionContributionDispatcher();\n\t\tconst postAcquireHook = yield* buildProductionPostAcquireHook({\n\t\t\t...(opts.extras === undefined ? {} : { extras: opts.extras }),\n\t\t\t...(opts.networkOptions === undefined ? {} : { networkOptions: opts.networkOptions }),\n\t\t\t...(opts.emitBindings === undefined ? {} : { emitBindings: opts.emitBindings }),\n\t\t});\n\t\tyield* superviseStackEffect(stack, identity, state, {\n\t\t\tcontributionDispatcher,\n\t\t\tpostAcquireHook,\n\t\t\t...(opts.lifetime === undefined ? {} : { lifetime: opts.lifetime }),\n\t\t\t...(opts.devstackVersion === undefined ? {} : { devstackVersion: opts.devstackVersion }),\n\t\t\t...(opts.commandHandler === undefined ? {} : { commandHandler: opts.commandHandler }),\n\t\t\t...(opts.beforeInitialAcquire === undefined\n\t\t\t\t? {}\n\t\t\t\t: { beforeInitialAcquire: opts.beforeInitialAcquire }),\n\t\t\t...(opts.withinScope === undefined ? {} : { withinScope: opts.withinScope }),\n\t\t\t// Built-in plugin-context extension ALWAYS runs; a caller extension\n\t\t\t// (the programmatic seam's `opts.extendContext`) chains AFTER it.\n\t\t\textendContext: (ctx) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst builtInContext = yield* extendBuiltInPluginContext(ctx);\n\t\t\t\t\treturn opts.extendContextAfterBuiltIn === undefined\n\t\t\t\t\t\t? builtInContext\n\t\t\t\t\t\t: yield* opts.extendContextAfterBuiltIn(builtInContext);\n\t\t\t\t}),\n\t\t}).pipe(Effect.provide(layerBuiltInPluginRuntime));\n\t});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AK,OAAO;GAC3D,GAAI,KAAK,mBAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,gBAAgB,KAAK,eAAe;GACnF,GAAI,KAAK,iBAAiB,KAAA,IAAY,CAAC,IAAI,EAAE,cAAc,KAAK,aAAa;EAC9E,CAAC;EAIA,GAAI,KAAK,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,KAAK,SAAS;EACjE,GAAI,KAAK,oBAAoB,KAAA,IAAY,CAAC,IAAI,EAAE,iBAAiB,KAAK,gBAAgB;EACtF,GAAI,KAAK,mBAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,gBAAgB,KAAK,eAAe;EACnF,GAAI,KAAK,yBAAyB,KAAA,IAC/B,CAAC,IACD,EAAE,sBAAsB,KAAK,qBAAqB;EACrD,GAAI,KAAK,gBAAgB,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa,KAAK,YAAY;EAG1E,gBAAgB,QACf,OAAO,IAAI,aAAa;GACvB,MAAM,iBAAiB,OAAO,2BAA2B,GAAG;GAC5D,OAAO,KAAK,8BAA8B,KAAA,IACvC,iBACA,OAAO,KAAK,0BAA0B,cAAc;EACxD,CAAC;CACH,CAAC,CAAC,CAAC,KAAK,OAAO,QAAQ,yBAAyB,CAAC;AAClD,CAAC"}
|
|
1
|
+
{"version":3,"file":"boot.mjs","names":["Logger"],"sources":["../../src/orchestrators/boot.ts"],"sourcesContent":["// Single L3 boot seam.\n//\n// Consumed by both the CLI verb wirings (`cli/wirings/*`) and the\n// library-facing programmatic surface (`api/run-stack.ts`), plus the e2e\n// boot harness.\n//\n// Composes the substrate Layer stack (L0) + the Docker `ContainerRuntime`\n// adapter (L1), yields the substrate services into a `Context.Context<never>`\n// pluginContext, builds the projection ref, and runs `supervise()` inside a\n// scope. The production orchestrator assembly (Snapshot/Router/Codegen/\n// ManifestEndpoint) and the contribution-delivery dispatcher live here too —\n// the supervisor holds the dispatcher record opaquely (it never imports an\n// orchestrator service).\n//\n// Architecture: this is L3 (orchestrator-level). Layer composition that\n// assembles L0+L1 stacks belongs at L3/L4 — it can't live in `substrate/`\n// because it imports a concrete L1 adapter (Docker) by definition; and it\n// depends on L2 plugin internals (coin/package registries), so it can't live\n// at L1 runtime either. See ARCHITECTURE.md § \"Layer composition belongs at\n// L3/L4, not L0\" and § \"L1-never-imports-from-L2\".\n\nimport { Context, Effect, FileSystem, Layer, Ref, Scope, SubscriptionRef } from 'effect';\nimport { join, resolve } from 'node:path';\nimport * as NodeFileSystem from '@effect/platform-node/NodeFileSystem';\nimport * as NodePath from '@effect/platform-node/NodePath';\nimport * as NodeChildProcessSpawner from '@effect/platform-node/NodeChildProcessSpawner';\nimport { ChildProcessSpawner } from 'effect/unstable/process/ChildProcessSpawner';\n\nimport type { Identity } from '../substrate/identity.ts';\nimport { CacheService, layerCache } from '../substrate/runtime/cache/index.ts';\nimport { LeaseBrokerService, layerLeaseBroker } from '../substrate/runtime/lease-broker/index.ts';\nimport {\n\tIdentityContext,\n\tRuntimeRoot,\n\tStackPathsService,\n\tlayerIdentity,\n\tlayerRuntimeRoot,\n\tlayerStackPaths,\n} from '../substrate/runtime/paths.ts';\nimport { PortBrokerService, layerPortBroker } from '../substrate/runtime/port-broker/index.ts';\nimport {\n\tStrategyRegistryService,\n\tlayerStrategyRegistry,\n} from '../substrate/runtime/strategy-registry/index.ts';\nimport {\n\tContainerRuntimeService,\n\tDockerSpawner,\n\tlayerContainerRuntimeDocker,\n\tlayerDockerCycleInitial,\n\tlayerDockerHostDefault,\n} from '../runtime/docker/index.ts';\nimport { readResolvedSync } from '../substrate/runtime/lifecycle/index.ts';\nimport { operationalEndpointEventsFromResolvedValue } from '../substrate/runtime/projection/operational-endpoints.ts';\nimport { Logger, layerLogger } from '../substrate/runtime/observability/index.ts';\nimport {\n\tPostAcquireTasksService,\n\tlayerPostAcquireTasks,\n} from '../substrate/runtime/post-acquire-tasks.ts';\nimport {\n\tallReadyOrTerminal,\n\tstartSupervisor,\n\ttype ContributionDispatcher,\n\ttype SupervisedStack,\n\ttype SupervisorCommandHandler,\n\ttype SupervisorHandle,\n\ttype SupervisorPostAcquireHook,\n} from '../substrate/runtime/supervisor/index.ts';\nimport type { ContributionDispatchContext } from '../substrate/runtime/supervisor/contribution-dispatcher.ts';\nimport type { SupervisorPostAcquireContext } from '../substrate/runtime/supervisor/index.ts';\n\nimport {\n\tlayerMystenMoveCodegen,\n\tMoveCodegenService,\n\tMoveSummaryRunnerService,\n} from './codegen/bindings.ts';\nimport { layerSuiMoveSummaryRunnerDocker } from '../plugins/sui/move-summary-runner.ts';\nimport { CodegenPathsService, layerCodegenPaths, layerCodegenRoot } from './codegen/paths.ts';\nimport {\n\tCodegenOrchestratorService,\n\tlayerCodegenOrchestrator,\n\ttype Codegenable,\n} from './codegen/service.ts';\nimport { CodegenWriteFailed } from './codegen/errors.ts';\nimport { DEPLOYMENT_FILENAME, writeDeployment } from './codegen/deployment.ts';\nimport {\n\tDEFAULT_TRAEFIK_IMAGE,\n\tlayerDockerUpstreamResolver,\n\tlayerEntrypointRegistry,\n\tlayerRouterConfigLiteral,\n\tlayerRouterService,\n\tlayerTraefikContainerOpsDocker,\n\tRouterService,\n\ttype ResolvedRoute,\n} from './router/index.ts';\nimport { BUILT_IN_ENTRYPOINTS } from '../plugins/router-entrypoints.ts';\nimport {\n\tmakeDefaultRouterProfile,\n\ttype DefaultRouterProfileOptions,\n\ttype RouterProfile,\n} from './router/profile.ts';\nimport { layerSnapshotOrchestrator, SnapshotOrchestratorService } from './snapshot/index.ts';\nimport type { ProjectionDecl } from '../contracts/projection.ts';\nimport type { RoutableDecl } from '../contracts/routable.ts';\nimport type { SnapshotableDecl } from '../contracts/snapshotable.ts';\nimport type { StrategyContributorDecl } from '../contracts/strategy-contributor.ts';\nimport { endpointKey, type PluginKey } from '../substrate/brand.ts';\nimport type { EngineEvent } from '../substrate/events.ts';\nimport {\n\tbuildEnvelope,\n\tCURRENT_MANIFEST_VERSION,\n\twriteManifest,\n} from '../substrate/runtime/manifest/index.ts';\nimport {\n\tManifestExtrasLookupError,\n\tresolveManifestExtras,\n\ttype EndpointEntry,\n\ttype ManifestExtrasInput,\n} from '../substrate/manifest.ts';\nimport { CoinRegistryService, layerCoinRegistry } from '../plugins/coin/registry.ts';\nimport { PackageRegistryService, layerPackageRegistry } from '../plugins/package/registry.ts';\n\n// ───────────────────────────────────────────────────────────────────────────\n// Substrate lifecycle\n// ───────────────────────────────────────────────────────────────────────────\n\n/** Substrate Layer stack for a single supervised run. Composes every L0\n * service the supervisor yields from its R-channel, plus the L1 Docker\n * `ContainerRuntime`. Built-in plugin services are layered outside\n * substrate and added through `extendContext`. */\nexport const buildSubstrateLayers = (identity: Identity, runtimeRoot: string) => {\n\t// DockerSpawner adapts platform-node's ChildProcessSpawner tag onto\n\t// the docker subsystem's local DockerSpawner tag (same shape; the\n\t// indirection only lets tests inject a stub).\n\tconst layerDockerSpawnerFromNode: Layer.Layer<DockerSpawner, never, ChildProcessSpawner> =\n\t\tLayer.effect(\n\t\t\tDockerSpawner,\n\t\t\tEffect.gen(function* () {\n\t\t\t\treturn yield* ChildProcessSpawner;\n\t\t\t}),\n\t\t);\n\n\tconst platformBase = Layer.mergeAll(\n\t\tlayerIdentity(identity),\n\t\tlayerRuntimeRoot(runtimeRoot),\n\t\tNodePath.layer,\n\t\tNodeFileSystem.layer,\n\t\tlayerDockerHostDefault,\n\t\tlayerDockerCycleInitial,\n\t\tlayerStrategyRegistry,\n\t);\n\n\tconst childProcessSpawnerWired = NodeChildProcessSpawner.layer.pipe(\n\t\tLayer.provideMerge(platformBase),\n\t);\n\tconst withStackPaths = layerStackPaths.pipe(Layer.provideMerge(childProcessSpawnerWired));\n\tconst withCache = layerCache.pipe(Layer.provideMerge(withStackPaths));\n\tconst withPortBroker = layerPortBroker.pipe(Layer.provideMerge(withCache));\n\tconst withLeaseBroker = layerLeaseBroker.pipe(Layer.provideMerge(withPortBroker));\n\tconst withSpawnerAdapter = layerDockerSpawnerFromNode.pipe(Layer.provideMerge(withLeaseBroker));\n\tconst withContainerRuntime = layerContainerRuntimeDocker.pipe(\n\t\tLayer.provideMerge(withSpawnerAdapter),\n\t);\n\tconst withPostAcquireTasks = layerPostAcquireTasks.pipe(Layer.provideMerge(withContainerRuntime));\n\treturn layerLogger.pipe(Layer.provideMerge(withPostAcquireTasks));\n};\n\n/** Build the opaque `Context.Context<never>` the supervisor hands to\n * every plugin's `acquire` body. Yields every substrate service the\n * Docker-backed substrate layer stack provides; downstream callers\n * may extend the context (e.g. layering the built-in plugin registries\n * via `extendBuiltInPluginContext`) before passing it to `supervise()`. */\nconst buildPluginContext = (): Effect.Effect<\n\tContext.Context<never>,\n\tnever,\n\t| IdentityContext\n\t| RuntimeRoot\n\t| StackPathsService\n\t| CacheService\n\t| StrategyRegistryService\n\t| ContainerRuntimeService\n\t| PortBrokerService\n\t| LeaseBrokerService\n\t| PostAcquireTasksService\n\t| Logger\n> =>\n\tEffect.gen(function* () {\n\t\tconst identityCtx = yield* IdentityContext;\n\t\tconst runtimeRootResolved = yield* RuntimeRoot;\n\t\tconst stackPaths = yield* StackPathsService;\n\t\tconst cache = yield* CacheService;\n\t\tconst registry = yield* StrategyRegistryService;\n\t\tconst containerRuntime = yield* ContainerRuntimeService;\n\t\tconst portBroker = yield* PortBrokerService;\n\t\tconst leaseBroker = yield* LeaseBrokerService;\n\t\tconst postAcquireTasks = yield* PostAcquireTasksService;\n\t\tconst logger = yield* Logger;\n\n\t\treturn Context.empty().pipe(\n\t\t\tContext.add(IdentityContext, identityCtx),\n\t\t\tContext.add(RuntimeRoot, runtimeRootResolved),\n\t\t\tContext.add(StackPathsService, stackPaths),\n\t\t\tContext.add(CacheService, cache),\n\t\t\tContext.add(StrategyRegistryService, registry),\n\t\t\tContext.add(ContainerRuntimeService, containerRuntime),\n\t\t\tContext.add(PortBrokerService, portBroker),\n\t\t\tContext.add(LeaseBrokerService, leaseBroker),\n\t\t\tContext.add(PostAcquireTasksService, postAcquireTasks),\n\t\t\tContext.add(Logger, logger),\n\t\t) as Context.Context<never>;\n\t});\n\n/** Options accepted by the supervised-run entrypoint. `lifetime`\n * selects long-running supervision versus a one-shot acquire/codegen\n * cycle. The `beforeInitialAcquire` hook runs inside the supervised\n * scope before the first acquire starts; live renderers use it to\n * subscribe to startup projection changes. The `withinScope` hook\n * runs after the first acquire completes.\n *\n * Generic `R` widens the hook R-channel so callers can yield\n * substrate services (e.g. `StackPathsService`) that are in scope at\n * the supervisor-boot site. */\nexport interface SuperviseStackOptions<R = Scope.Scope, ExtendR = never, HookE = never> {\n\treadonly lifetime?: 'long-running' | 'one-shot';\n\treadonly devstackVersion?: string;\n\treadonly beforeInitialAcquire?: (handle: SupervisorHandle) => Effect.Effect<void, HookE, R>;\n\treadonly withinScope?: (handle: SupervisorHandle) => Effect.Effect<void, HookE, R>;\n\treadonly commandHandler?: SupervisorCommandHandler;\n\treadonly contributionDispatcher?: ContributionDispatcher;\n\treadonly postAcquireHook?: SupervisorPostAcquireHook;\n\t/** Caller-supplied extension layered into `pluginContext` after the\n\t * default substrate context is built. Used by plugin-author Layer\n\t * composition (ARCHITECTURE.md § Plugin-author extension) and by\n\t * the CLI when it wants to inject the built-in plugin registries or\n\t * a custom Logger override. */\n\treadonly extendContext?: (\n\t\tctx: Context.Context<never>,\n\t) => Effect.Effect<Context.Context<never>, never, ExtendR>;\n}\n\n/** Effect that boots the supervisor for `stack` and blocks on the\n * supervisor's shutdown latch. Returns the final `SubscribableState`\n * snapshot so callers (CLI, library handle) can inspect post-shutdown\n * state. */\nexport const superviseStackEffect = <R = Scope.Scope, ExtendR = never, HookE = never>(\n\tstack: SupervisedStack,\n\tidentity: Identity,\n\tstate: SubscriptionRef.SubscriptionRef<import('../substrate/projection.ts').SubscribableState>,\n\topts: SuperviseStackOptions<R, ExtendR, HookE> = {},\n) =>\n\tEffect.gen(function* () {\n\t\treturn yield* Effect.scoped(\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst baseContext = yield* buildPluginContext();\n\t\t\t\tconst pluginContext =\n\t\t\t\t\topts.extendContext === undefined ? baseContext : yield* opts.extendContext(baseContext);\n\n\t\t\t\tconst startup = yield* startSupervisor(\n\t\t\t\t\tstack,\n\t\t\t\t\tidentity,\n\t\t\t\t\tstate,\n\t\t\t\t\tpluginContext,\n\t\t\t\t\topts.contributionDispatcher,\n\t\t\t\t\topts.commandHandler,\n\t\t\t\t\topts.postAcquireHook,\n\t\t\t\t\t{\n\t\t\t\t\t\tcommandLoop: opts.lifetime !== 'one-shot',\n\t\t\t\t\t\t...(opts.devstackVersion === undefined\n\t\t\t\t\t\t\t? {}\n\t\t\t\t\t\t\t: { devstackVersion: opts.devstackVersion }),\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tconst { handle } = startup;\n\t\t\t\tif (opts.beforeInitialAcquire !== undefined) {\n\t\t\t\t\tyield* opts.beforeInitialAcquire(handle);\n\t\t\t\t}\n\t\t\t\tif (opts.lifetime === 'one-shot') {\n\t\t\t\t\t// `runInitialAcquire` runs `acquireFullGraph` to completion (every\n\t\t\t\t\t// node reaches a terminal status) before it returns. Gate the\n\t\t\t\t\t// one-shot `withinScope` on the SUPERVISOR-OWNED readiness signal\n\t\t\t\t\t// — `allReadyOrTerminal` (`ready || done`) — NOT a per-node\n\t\t\t\t\t// `awaitReady` watcher. A run-to-completion `task` node lands in\n\t\t\t\t\t// `done`; the registry contract admits a `done`-status node whose\n\t\t\t\t\t// `readyGate` is unresolved (only `markReady`/`markFailed` resolve\n\t\t\t\t\t// it), so a per-node gate HANGS on it. This is the SAME\n\t\t\t\t\t// `done`-tolerant gate S1 gave the long-running path; reading\n\t\t\t\t\t// statuses never suspends, so it is hang-free.\n\t\t\t\t\tyield* startup.runInitialAcquire;\n\t\t\t\t\tyield* allReadyOrTerminal(startup.handle.graph, startup.handle.registry);\n\t\t\t\t\tif (opts.withinScope !== undefined) {\n\t\t\t\t\t\tyield* opts.withinScope(handle);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst outcome = yield* Effect.raceFirst(\n\t\t\t\t\tstartup.runInitialAcquire.pipe(Effect.as('booted' as const)),\n\t\t\t\t\thandle.awaitShutdown.pipe(Effect.as('shutdown' as const)),\n\t\t\t\t);\n\t\t\t\tif (outcome === 'shutdown') {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (opts.withinScope !== undefined) {\n\t\t\t\t\tyield* opts.withinScope(handle);\n\t\t\t\t}\n\t\t\t\tyield* handle.awaitShutdown;\n\t\t\t}),\n\t\t);\n\t});\n\n// ───────────────────────────────────────────────────────────────────────────\n// Production orchestrator assembly\n// ───────────────────────────────────────────────────────────────────────────\n\nexport interface ProductionCodegenOptions {\n\treadonly appRoot?: string;\n\t/** Forwarded verbatim to `@mysten/codegen`'s\n\t * `generateFromPackageSummary` via `layerMystenMoveCodegen` — see\n\t * `DevstackOptions['codegen']` for the full contract. Default `false`\n\t * (`@mysten/codegen`'s own default): phantom-only structs render as\n\t * consts with the phantom placeholder baked into `.name`; `true`\n\t * renders them as factories whose required type arguments compose a\n\t * fully-qualified type tag. */\n\treadonly includePhantomTypeParameters?: boolean;\n}\n\n/**\n * The ONE boot seam that maps a stack's codegen config to the production\n * codegen orchestrator options for a LIVE (`'ran'`) projection. Both\n * composition entry points (`api/run-stack.ts` and `orchestrators/layers.ts`)\n * call this. Boot writes no committed `src/generated` tree (owned solely by\n * the stack-free `codegen` verb), so there is no live dev-output dir to\n * resolve; only the app root + the pass-through phantom-type flag flow into\n * `layerProductionOrchestrators({ codegen })`.\n */\nexport const resolveProductionCodegenOptions = (input: {\n\treadonly appRoot: string;\n\treadonly codegen?:\n\t\t| {\n\t\t\t\treadonly includePhantomTypeParameters?: boolean;\n\t\t }\n\t\t| undefined;\n}): ProductionCodegenOptions => {\n\t// Boot never emits the committed `src/generated` tree (that is owned\n\t// solely by the stack-free `codegen` verb); its only codegen writes are\n\t// the deployment file (values-only) and the dev-`up` bindings refresh.\n\t// So there is no live dev-output dir to resolve — only the app root + the\n\t// pass-through phantom-type flag flow through.\n\treturn {\n\t\tappRoot: input.appRoot,\n\t\t// Pass-through verbatim — no resolution step; \"unset\" stays unset so\n\t\t// `@mysten/codegen`'s own default (false) applies at the call site.\n\t\t...(input.codegen?.includePhantomTypeParameters === undefined\n\t\t\t? {}\n\t\t\t: { includePhantomTypeParameters: input.codegen.includePhantomTypeParameters }),\n\t};\n};\n\nexport interface ProductionRouterOptions {\n\treadonly codegen?: ProductionCodegenOptions;\n\treadonly disabled?: boolean;\n}\n\nexport class ManifestEndpointRegistryService extends Context.Service<\n\tManifestEndpointRegistryService,\n\t{\n\t\treadonly register: (entry: EndpointEntry) => Effect.Effect<void, never, Scope.Scope>;\n\t\treadonly entries: Effect.Effect<ReadonlyArray<EndpointEntry>>;\n\t}\n>()('@devstack/orchestrators/ManifestEndpointRegistry') {}\n\nexport const layerManifestEndpointRegistry: Layer.Layer<ManifestEndpointRegistryService> =\n\tLayer.effect(\n\t\tManifestEndpointRegistryService,\n\t\tEffect.gen(function* () {\n\t\t\tconst entriesRef = yield* Ref.make<ReadonlyArray<EndpointEntry & { readonly seq: number }>>(\n\t\t\t\t[],\n\t\t\t);\n\t\t\tconst seqRef = yield* Ref.make(0);\n\n\t\t\tconst register = (entry: EndpointEntry): Effect.Effect<void, never, Scope.Scope> =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst seq = yield* Ref.updateAndGet(seqRef, (n) => n + 1);\n\t\t\t\t\tyield* Ref.update(entriesRef, (entries) => [...entries, { ...entry, seq }]);\n\t\t\t\t\tyield* Effect.addFinalizer(() =>\n\t\t\t\t\t\tRef.update(entriesRef, (entries) =>\n\t\t\t\t\t\t\tentries.filter((candidate) => candidate.seq !== seq),\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\treturn ManifestEndpointRegistryService.of({\n\t\t\t\tregister,\n\t\t\t\tentries: Ref.get(entriesRef).pipe(\n\t\t\t\t\tEffect.map((entries) =>\n\t\t\t\t\t\tentries.map((entryWithSeq) => {\n\t\t\t\t\t\t\tconst { seq, ...entry } = entryWithSeq;\n\t\t\t\t\t\t\tvoid seq;\n\t\t\t\t\t\t\treturn entry;\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t});\n\t\t}),\n\t);\n\nexport const productionRouterProfile = (options: DefaultRouterProfileOptions = {}): RouterProfile =>\n\tmakeDefaultRouterProfile(options);\n\n/** `outputDir` for the `CodegenRoot` of a `layerProductionOrchestrators`\n * composition — `<appRoot>/src/generated`. Boot's `assembleDeployment`\n * writes no file here; the dev-`up` `emitBindings` refresh DOES re-emit\n * this committed tree from the STATIC (id-free) contributions so an edited\n * Move package's new shapes reach the app. `apply` / `runStack` pass no\n * `emitBindings`, so they leave it untouched. The stack-free `codegen` verb\n * owns the canonical emit (wired separately, where it pins its own path). */\nconst productionCodegenOutputDir = (appRoot: string): string => resolve(appRoot, 'src/generated');\n\nexport const layerProductionOrchestrators = (router: ProductionRouterOptions = {}) => {\n\tconst profile = productionRouterProfile();\n\treturn Layer.mergeAll(\n\t\tlayerSnapshotOrchestrator,\n\t\tlayerManifestEndpointRegistry,\n\t\tlayerRouterService.pipe(\n\t\t\tLayer.provideMerge(\n\t\t\t\tLayer.mergeAll(\n\t\t\t\t\tlayerEntrypointRegistry(BUILT_IN_ENTRYPOINTS),\n\t\t\t\t\tlayerTraefikContainerOpsDocker,\n\t\t\t\t\tlayerDockerUpstreamResolver(profile),\n\t\t\t\t\tlayerRouterConfigLiteral({\n\t\t\t\t\t\tdisabled: router.disabled ?? false,\n\t\t\t\t\t\tprofile,\n\t\t\t\t\t\timage: DEFAULT_TRAEFIK_IMAGE,\n\t\t\t\t\t\trouteReadinessProbe: {\n\t\t\t\t\t\t\tenabled: router.disabled !== true,\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t),\n\t\tlayerCodegenOrchestrator,\n\t\tlayerCodegenPaths.pipe(\n\t\t\tLayer.provideMerge(\n\t\t\t\tlayerCodegenRoot({\n\t\t\t\t\toutputDir: productionCodegenOutputDir(router.codegen?.appRoot ?? process.cwd()),\n\t\t\t\t\tstackSubdir: null,\n\t\t\t\t}),\n\t\t\t),\n\t\t),\n\t\tlayerSuiMoveSummaryRunnerDocker,\n\t\tlayerMystenMoveCodegen({\n\t\t\tincludePhantomTypeParameters: router.codegen?.includePhantomTypeParameters,\n\t\t}),\n\t);\n};\n\n/** The single adapter for routable endpoints: ONE `ResolvedRoute` (the\n * router's post-mint source of truth) → ALL THREE sink-feeds at once —\n * the router's own `route`, the manifest `EndpointEntry`, and the\n * projection `endpoint.registered` event — derived from one shared\n * field-set so the three sinks can never diverge. The `routable`\n * dispatch body feeds each sink from the object this returns; there is\n * no second, third derivation off the route anywhere.\n *\n * It owns the url-derivation: `tcp` routes carry `tcp://127.0.0.1:port`,\n * everything else `http://hostname:port`. Consumers (codegen, manifest)\n * translate `tcp://` to their protocol-specific scheme (`postgres://`,\n * `redis://`, …).\n *\n * `ResolvedRoute` only carries `entrypointName`, so the endpoint name is\n * recovered from the original `decl.endpointName`; `pluginKey` is supplied\n * by the dispatcher (it is not in `ResolvedRoute`). Router-only fields\n * (`dispatchFileId`/`cors`/`upstreamUrl`) are kept ON `route` for the\n * router sink but discarded from the manifest/projection field-set — those\n * schemas do not consume them. */\nexport const endpointSinksFromRoute = (\n\tdecl: RoutableDecl,\n\troute: ResolvedRoute,\n\tpluginKey: PluginKey,\n\tregisteredAt = Date.now(),\n) => {\n\tconst url =\n\t\troute.wireProtocol === 'tcp'\n\t\t\t? `tcp://127.0.0.1:${route.entrypointPort}`\n\t\t\t: `http://${route.hostname}:${route.entrypointPort}`;\n\tconst common = {\n\t\tname: decl.endpointName,\n\t\turl,\n\t\tdisplayUrl: null,\n\t\twireProtocol: route.wireProtocol,\n\t} as const;\n\tconst endpointKeyString = `${pluginKey}:${decl.endpointName}`;\n\tconst event: Extract<EngineEvent, { readonly tag: 'endpoint.registered' }> = {\n\t\ttag: 'endpoint.registered',\n\t\tendpoint: {\n\t\t\t...common,\n\t\t\tendpointKey: endpointKey(endpointKeyString),\n\t\t\tpluginKey,\n\t\t\tregisteredAt,\n\t\t},\n\t};\n\treturn {\n\t\troute,\n\t\tmanifestEntry: {\n\t\t\t...common,\n\t\t\tendpointKey: endpointKeyString,\n\t\t\tpluginKey: String(pluginKey),\n\t\t},\n\t\tevent,\n\t};\n};\n\nconst manifestEndpointEntryFromOperationalEndpoint = (\n\tendpoint: Extract<EngineEvent, { readonly tag: 'endpoint.registered' }>['endpoint'],\n): EndpointEntry => ({\n\tendpointKey: String(endpoint.endpointKey),\n\tname: endpoint.name,\n\turl: endpoint.url,\n\tdisplayUrl: endpoint.displayUrl,\n\twireProtocol: endpoint.wireProtocol,\n\tpluginKey: String(endpoint.pluginKey),\n});\n\n/** Project a projection decl's `rowKey` (when absent) onto the\n * contributing plugin so projection consumers can attribute the row.\n * The payload stays opaque from the substrate's POV. */\nconst projectionDispatch = (\n\tdecl: ProjectionDecl,\n\tctx: ContributionDispatchContext,\n): Effect.Effect<void, never, never> => {\n\tconst payload = decl.event.payload;\n\tconst payloadWithRowKey =\n\t\tpayload !== null &&\n\t\ttypeof payload === 'object' &&\n\t\t'rowKey' in payload &&\n\t\t(payload as { rowKey: unknown }).rowKey === null\n\t\t\t? { ...payload, rowKey: ctx.pluginKey }\n\t\t\t: payload;\n\treturn ctx.publish({\n\t\t...decl.event,\n\t\tpayload: payloadWithRowKey,\n\t});\n};\n\n/** Register a strategy contribution on the scope-local registry, publish\n * `strategy.registered`, and arm a finalizer publishing\n * `strategy.unregistered`. */\nconst strategyContributorDispatch = (\n\tdecl: StrategyContributorDecl<string, unknown>,\n\tctx: ContributionDispatchContext,\n): Effect.Effect<void, never, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tyield* ctx.strategyRegistry.register(decl.capabilityKey, decl.strategy, {\n\t\t\tautoMounted: decl.autoMounted,\n\t\t\t...(decl.priority === undefined ? {} : { priority: decl.priority }),\n\t\t});\n\t\tyield* ctx.publish({\n\t\t\ttag: 'strategy.registered',\n\t\t\tcapabilityKey: decl.capabilityKey,\n\t\t\tautoMounted: decl.autoMounted,\n\t\t\tat: Date.now(),\n\t\t});\n\t\tyield* Effect.addFinalizer(() =>\n\t\t\tctx.publish({\n\t\t\t\ttag: 'strategy.unregistered',\n\t\t\t\tcapabilityKey: decl.capabilityKey,\n\t\t\t\tat: Date.now(),\n\t\t\t}),\n\t\t);\n\t});\n\n/**\n * Build the production `ContributionDispatcher` — the closed seam the\n * supervisor replays each plugin's buffered contributions through after\n * a successful `start`. Each method's body reads its backing orchestrator\n * service (Snapshot/Router/Codegen/ManifestEndpoint) ONCE here and closes\n * over it; the substrate supervisor holds the resulting record opaquely\n * (it never imports an orchestrator service).\n */\nexport const buildProductionContributionDispatcher = (): Effect.Effect<\n\tContributionDispatcher,\n\tnever,\n\t| SnapshotOrchestratorService\n\t| RouterService\n\t| CodegenOrchestratorService\n\t| ManifestEndpointRegistryService\n> =>\n\tEffect.gen(function* () {\n\t\tconst snapshot = yield* SnapshotOrchestratorService;\n\t\tconst router = yield* RouterService;\n\t\tconst codegen = yield* CodegenOrchestratorService;\n\t\tconst manifestEndpoints = yield* ManifestEndpointRegistryService;\n\t\treturn {\n\t\t\tsnapshotable: (decl: SnapshotableDecl, ctx) =>\n\t\t\t\tsnapshot.registerParticipant(ctx.pluginKey, decl),\n\t\t\troutable: (decl: RoutableDecl, ctx) =>\n\t\t\t\trouter.boot().pipe(\n\t\t\t\t\t// Router sink: `contributeRoute` writes the dispatch file +\n\t\t\t\t\t// publishes the route onto `applied`, returning the post-mint\n\t\t\t\t\t// `ResolvedRoute` — the ONE source of truth.\n\t\t\t\t\tEffect.andThen(router.contributeRoute(decl)),\n\t\t\t\t\tEffect.flatMap((route) => {\n\t\t\t\t\t\t// One adapter off that ResolvedRoute yields BOTH remaining\n\t\t\t\t\t\t// sink-feeds; feed manifest then projection. No second\n\t\t\t\t\t\t// derivation off the route lives anywhere.\n\t\t\t\t\t\tconst sinks = endpointSinksFromRoute(decl, route, ctx.pluginKey);\n\t\t\t\t\t\treturn manifestEndpoints\n\t\t\t\t\t\t\t.register(sinks.manifestEntry)\n\t\t\t\t\t\t\t.pipe(Effect.andThen(ctx.publish(sinks.event)));\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\tcodegenable: (decl: Codegenable, ctx) => codegen.registerContribution(ctx.pluginKey, decl),\n\t\t\tprojection: (decl: ProjectionDecl, ctx) => projectionDispatch(decl, ctx),\n\t\t\tstrategyContributor: (decl: StrategyContributorDecl<string, unknown>, ctx) =>\n\t\t\t\tstrategyContributorDispatch(decl, ctx),\n\t\t} satisfies ContributionDispatcher;\n\t});\n\nconst makeManifestExtrasContext = (ctx: SupervisorPostAcquireContext) => {\n\tconst resourceIdToKey = new Map<string, PluginKey>();\n\tfor (const [key, node] of ctx.graph.nodes) {\n\t\tresourceIdToKey.set(node.member.id, key);\n\t}\n\t// `lookup` throws `ManifestExtrasLookupError` synchronously from\n\t// inside the user-supplied `extras` factory.\n\t// `resolveManifestExtras` invokes that factory under `Effect.try`\n\t// with a typed `catch` mapper, so the throw promotes to the typed\n\t// failure channel — callers `catchTag('ManifestExtrasLookupError',\n\t// ...)` rather than reading the die-cause. Non-tagged throws stay\n\t// defects, preserving the previous semantics for genuine\n\t// programmer errors inside the factory body.\n\tconst lookup = (resourceId: string): unknown => {\n\t\tconst key = resourceIdToKey.get(resourceId);\n\t\tif (key === undefined) {\n\t\t\tthrow new ManifestExtrasLookupError({\n\t\t\t\tkind: 'unknown-resource',\n\t\t\t\tresourceId,\n\t\t\t});\n\t\t}\n\t\tconst resolved = readResolvedSync(ctx.registry, key);\n\t\tif (resolved === undefined) {\n\t\t\tthrow new ManifestExtrasLookupError({\n\t\t\t\tkind: 'unresolved-resource',\n\t\t\t\tresourceId,\n\t\t\t});\n\t\t}\n\t\treturn resolved;\n\t};\n\treturn {\n\t\tvalue: (resource: { readonly id: string }) => lookup(resource.id),\n\t};\n};\n\nconst operationalManifestEndpointEntries = (\n\tctx: SupervisorPostAcquireContext,\n\troutableEntries: ReadonlyArray<EndpointEntry>,\n): ReadonlyArray<EndpointEntry> => {\n\tconst routablePluginKeys = new Set(routableEntries.map((entry) => entry.pluginKey));\n\tconst registeredAt = Date.now();\n\tconst entries: EndpointEntry[] = [];\n\tfor (const [key] of ctx.graph.nodes) {\n\t\tif (routablePluginKeys.has(String(key))) continue;\n\t\tconst resolved = readResolvedSync(ctx.registry, key);\n\t\tif (resolved === undefined) continue;\n\t\tfor (const event of operationalEndpointEventsFromResolvedValue(key, resolved, registeredAt)) {\n\t\t\tentries.push(manifestEndpointEntryFromOperationalEndpoint(event.endpoint));\n\t\t}\n\t}\n\treturn entries;\n};\n\nexport const buildProductionPostAcquireHook = (\n\toptions: {\n\t\treadonly extras?: ManifestExtrasInput;\n\t\t/** Dev-`up` only: the STATIC (id-free) codegen contributions to re-emit\n\t\t * the committed `src/generated` tree from when a Move-source edit\n\t\t * reacquires a package — the same decls the stack-free `codegen` verb\n\t\t * derives (`deriveContributions(stack.members)`), NOT the live ones\n\t\t * (which would bake on-chain ids into `config.ts`). Omitted for\n\t\t * `apply` / `runStack`, where the committed tree is an input. */\n\t\treadonly emitBindings?: ReadonlyArray<Codegenable>;\n\t} = {},\n): Effect.Effect<\n\tSupervisorPostAcquireHook,\n\tnever,\n\t| CodegenOrchestratorService\n\t| CodegenPathsService\n\t| FileSystem.FileSystem\n\t| StackPathsService\n\t| PostAcquireTasksService\n\t| ManifestEndpointRegistryService\n\t| MoveSummaryRunnerService\n\t| MoveCodegenService\n> =>\n\tEffect.gen(function* () {\n\t\tconst codegen = yield* CodegenOrchestratorService;\n\t\tconst paths = yield* CodegenPathsService;\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst stackPaths = yield* StackPathsService;\n\t\tconst postAcquireTasks = yield* PostAcquireTasksService;\n\t\tconst manifestEndpoints = yield* ManifestEndpointRegistryService;\n\t\t// Yielded here (outside the per-ctx hook) so the dev-`up` bindings\n\t\t// refresh below can provide them to `emitBindings`.\n\t\tconst moveRunner = yield* MoveSummaryRunnerService;\n\t\tconst moveCodegen = yield* MoveCodegenService;\n\t\treturn (ctx) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst extras = yield* resolveManifestExtras(options.extras, makeManifestExtrasContext(ctx));\n\t\t\t\tconst routableEndpoints = yield* manifestEndpoints.entries;\n\t\t\t\tconst endpoints = [\n\t\t\t\t\t...routableEndpoints,\n\t\t\t\t\t...operationalManifestEndpointEntries(ctx, routableEndpoints),\n\t\t\t\t];\n\t\t\t\t// Boot no longer runs codegen. Its only job is to PRODUCE the\n\t\t\t\t// deployment (loadable on-chain ids), which the Vite plugin injects\n\t\t\t\t// via `__DEVSTACK_DEPLOYMENT__` in dev. The committed `src/generated` tree\n\t\t\t\t// is written ONLY by the stack-free `devstack codegen` verb.\n\t\t\t\t// Assemble the deployment from the SAME live-resolved contributions\n\t\t\t\t// that fed `config.ts` and write it to the gitignored\n\t\t\t\t// `.devstack/stacks/<stack>/`.\n\t\t\t\tconst deployment = yield* codegen.assembleDeployment(String(ctx.identity.network)).pipe(\n\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t(cause) =>\n\t\t\t\t\t\t\tnew CodegenWriteFailed({\n\t\t\t\t\t\t\t\toutputPath: DEPLOYMENT_FILENAME,\n\t\t\t\t\t\t\t\tstage: 'write',\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tconst deploymentFile = join(stackPaths.stackRoot, DEPLOYMENT_FILENAME);\n\t\t\t\tyield* writeDeployment(deploymentFile, deployment).pipe(\n\t\t\t\t\tEffect.provideService(FileSystem.FileSystem, fs),\n\t\t\t\t);\n\t\t\t\tconst envelope = yield* buildEnvelope({\n\t\t\t\t\tidentity: {\n\t\t\t\t\t\tapp: ctx.identity.app,\n\t\t\t\t\t\tstack: ctx.identity.stack,\n\t\t\t\t\t\tnetwork: ctx.identity.network,\n\t\t\t\t\t},\n\t\t\t\t\tendpoints,\n\t\t\t\t\textras,\n\t\t\t\t\t// Record the live `deploymentFile` the plugin injects as\n\t\t\t\t\t// `__DEVSTACK_DEPLOYMENT__`. Bindings are NOT recorded:\n\t\t\t\t\t// `@generated` always resolves to the committed `src/generated`\n\t\t\t\t\t// tree written by the stack-free `codegen` verb. The dev-wallet\n\t\t\t\t\t// connection + dev accounts ride the deployment envelope's\n\t\t\t\t\t// `values` / `accounts` channels (no separate dev tree).\n\t\t\t\t\tcodegen: { deploymentFile },\n\t\t\t\t});\n\t\t\t\tconst manifestPath = join(stackPaths.stackRoot, 'manifest.json');\n\t\t\t\tyield* writeManifest(envelope, manifestPath).pipe(\n\t\t\t\t\tEffect.provideService(FileSystem.FileSystem, fs),\n\t\t\t\t);\n\t\t\t\t// Dev-`up` only: regenerate the committed `src/generated` tree from\n\t\t\t\t// the STATIC (id-free) contributions so an edited Move package's new\n\t\t\t\t// struct/function shapes reach the app (Vite HMRs the changed TS)\n\t\t\t\t// WITHOUT baking the live on-chain id into `config.ts`.\n\t\t\t\t// `runEmitCycle` is content-addressed, so the initial boot and any\n\t\t\t\t// no-op reacquire leave the tree (and its mtimes) untouched.\n\t\t\t\tconst bindingFiles: string[] = [];\n\t\t\t\tif (options.emitBindings !== undefined) {\n\t\t\t\t\tconst emitted = yield* codegen\n\t\t\t\t\t\t.emitBindings(options.emitBindings)\n\t\t\t\t\t\t.pipe(\n\t\t\t\t\t\t\tEffect.provideService(FileSystem.FileSystem, fs),\n\t\t\t\t\t\t\tEffect.provideService(CodegenPathsService, paths),\n\t\t\t\t\t\t\tEffect.provideService(MoveSummaryRunnerService, moveRunner),\n\t\t\t\t\t\t\tEffect.provideService(MoveCodegenService, moveCodegen),\n\t\t\t\t\t\t);\n\t\t\t\t\tbindingFiles.push(...emitted.filesWritten, ...emitted.filesChmod);\n\t\t\t\t}\n\t\t\t\tyield* postAcquireTasks.runAll;\n\t\t\t\treturn [\n\t\t\t\t\t{\n\t\t\t\t\t\ttag: 'manifest.flushed' as const,\n\t\t\t\t\t\tmanifestVersion: CURRENT_MANIFEST_VERSION,\n\t\t\t\t\t\tat: Date.now(),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\ttag: 'codegen.emitted' as const,\n\t\t\t\t\t\tfiles: [deploymentFile, ...bindingFiles],\n\t\t\t\t\t\tat: Date.now(),\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t});\n\t});\n\n// ───────────────────────────────────────────────────────────────────────────\n// Built-in plugin runtime composition\n//\n// Depends on L2 plugin internals (coin/package registries), so it can't live\n// at L1 runtime — hence its home in this L3 boot module.\n// ───────────────────────────────────────────────────────────────────────────\n\n/** Built-in plugin runtime: the per-stack coin + package registries.\n * Coin auto-discovery from a fresh package publish now runs DIRECTLY in\n * the package plugin's `start` (folding the publish output into the\n * CoinRegistry), so the registries are the whole surface. */\nexport const layerBuiltInPluginRuntime: Layer.Layer<CoinRegistryService | PackageRegistryService> =\n\tLayer.mergeAll(layerCoinRegistry, layerPackageRegistry);\n\nexport const extendBuiltInPluginContext = (\n\tctx: Context.Context<never>,\n): Effect.Effect<\n\tContext.Context<never>,\n\tnever,\n\tCoinRegistryService | PackageRegistryService | SnapshotOrchestratorService | FileSystem.FileSystem\n> =>\n\tEffect.gen(function* () {\n\t\tconst coinRegistry = yield* CoinRegistryService;\n\t\tconst packageRegistry = yield* PackageRegistryService;\n\t\t// Thread the snapshot orchestrator + filesystem into the plugin\n\t\t// runtime context so the supervisor can populate the control-plane\n\t\t// `domain` surface (snapshot list/restore/delete, which never\n\t\t// round-trip through the void `publishCommand`). The\n\t\t// `ContainerRuntimeService` the domain also needs is already in the\n\t\t// base substrate plugin context.\n\t\tconst snapshotOrchestrator = yield* SnapshotOrchestratorService;\n\t\tconst fileSystem = yield* FileSystem.FileSystem;\n\t\treturn ctx.pipe(\n\t\t\tContext.add(CoinRegistryService, coinRegistry),\n\t\t\tContext.add(PackageRegistryService, packageRegistry),\n\t\t\tContext.add(SnapshotOrchestratorService, snapshotOrchestrator),\n\t\t\tContext.add(FileSystem.FileSystem, fileSystem),\n\t\t) as Context.Context<never>;\n\t});\n\n// ───────────────────────────────────────────────────────────────────────────\n// Production supervised-boot assembly — THE single dedup site\n// ───────────────────────────────────────────────────────────────────────────\n\n/** The per-caller inputs to {@link superviseStackWithProductionBoot} — the\n * fields that GENUINELY differ between the long-running programmatic seam\n * (`api/run-stack-internal.ts`) and the one-shot CLI verbs (`apply` /\n * `snapshot`). Everything else — the contribution dispatcher, the\n * post-acquire hook, and the built-in plugin-context extension — is\n * assembled identically by the helper, so it lives in ONE place. */\nexport interface ProductionBootOptions<HookR = Scope.Scope, HookE = never, ExtendR = never> {\n\t/** `'one-shot'` runs the acquire/codegen cycle then returns; the default\n\t * `'long-running'` supervises until shutdown. */\n\treadonly lifetime?: 'long-running' | 'one-shot';\n\treadonly devstackVersion?: string;\n\t/** Threaded into `buildProductionPostAcquireHook` — the stack's manifest\n\t * `extras`. All three callers pass `stack.options.extras`. */\n\treadonly extras?: ManifestExtrasInput;\n\t/** Dev-`up` only: the STATIC (id-free) codegen contributions used to\n\t * regenerate the committed `src/generated` tree in the post-acquire hook\n\t * when a Move-source edit reacquires a package. Threaded from the `up`\n\t * seam (`deriveContributions(stack.members)`); `apply` / `snapshot` leave\n\t * it off so they never rewrite the committed tree. */\n\treadonly emitBindings?: ReadonlyArray<Codegenable>;\n\t/** The resolved supervisor command handler (run-stack's snapshot bridge).\n\t * One-shot verbs run no command loop, so they pass nothing. */\n\treadonly commandHandler?: SupervisorCommandHandler;\n\treadonly beforeInitialAcquire?: (handle: SupervisorHandle) => Effect.Effect<void, HookE, HookR>;\n\treadonly withinScope?: (handle: SupervisorHandle) => Effect.Effect<void, HookE, HookR>;\n\t/** Caller plugin-context extension layered AFTER the built-in\n\t * (`extendBuiltInPluginContext`). Only the programmatic seam uses it (to\n\t * honor the public `runStack({ extendContext })`); the CLI verbs omit it\n\t * and get the built-in extension alone. */\n\treadonly extendContextAfterBuiltIn?: (\n\t\tctx: Context.Context<never>,\n\t) => Effect.Effect<Context.Context<never>, never, ExtendR>;\n}\n\n/**\n * THE single site that assembles the production supervised body. It builds\n * the contribution dispatcher + post-acquire hook + built-in plugin-context\n * extension ONCE and hands them to {@link superviseStackEffect}, then\n * provides {@link layerBuiltInPluginRuntime}. Before this helper, the same\n * three-piece assembly was hand-rolled in three call sites\n * (`api/run-stack-internal.ts`, `cli/wirings/apply.ts`,\n * `cli/wirings/snapshot.ts`); now they all route through here and only\n * supply what genuinely differs ({@link ProductionBootOptions}).\n *\n * Each caller keeps its OWN lifetime-specific wrapping: the programmatic\n * seam wraps the returned effect in a `forkDetach` handle (long-running);\n * the CLI verbs run it to completion with their existing teardown + result\n * semantics (one-shot). This helper does NOT collapse those — it only\n * dedups the assembly the `superviseStackEffect` call sites shared.\n *\n * The return type is inferred (like `superviseStackEffect`): its R-channel\n * is the union of every substrate/orchestrator service the dispatcher /\n * hook / extension read, MINUS the built-in registries `layerBuiltInPluginRuntime`\n * supplies, PLUS the caller hook `HookR` / extend `ExtendR` channels.\n */\nexport const superviseStackWithProductionBoot = <\n\tHookR = Scope.Scope,\n\tHookE = never,\n\tExtendR = never,\n>(\n\tstack: SupervisedStack,\n\tidentity: Identity,\n\tstate: SubscriptionRef.SubscriptionRef<import('../substrate/projection.ts').SubscribableState>,\n\topts: ProductionBootOptions<HookR, HookE, ExtendR> = {},\n) =>\n\tEffect.gen(function* () {\n\t\tconst contributionDispatcher = yield* buildProductionContributionDispatcher();\n\t\tconst postAcquireHook = yield* buildProductionPostAcquireHook({\n\t\t\t...(opts.extras === undefined ? {} : { extras: opts.extras }),\n\t\t\t...(opts.emitBindings === undefined ? {} : { emitBindings: opts.emitBindings }),\n\t\t});\n\t\tyield* superviseStackEffect(stack, identity, state, {\n\t\t\tcontributionDispatcher,\n\t\t\tpostAcquireHook,\n\t\t\t...(opts.lifetime === undefined ? {} : { lifetime: opts.lifetime }),\n\t\t\t...(opts.devstackVersion === undefined ? {} : { devstackVersion: opts.devstackVersion }),\n\t\t\t...(opts.commandHandler === undefined ? {} : { commandHandler: opts.commandHandler }),\n\t\t\t...(opts.beforeInitialAcquire === undefined\n\t\t\t\t? {}\n\t\t\t\t: { beforeInitialAcquire: opts.beforeInitialAcquire }),\n\t\t\t...(opts.withinScope === undefined ? {} : { withinScope: opts.withinScope }),\n\t\t\t// Built-in plugin-context extension ALWAYS runs; a caller extension\n\t\t\t// (the programmatic seam's `opts.extendContext`) chains AFTER it.\n\t\t\textendContext: (ctx) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst builtInContext = yield* extendBuiltInPluginContext(ctx);\n\t\t\t\t\treturn opts.extendContextAfterBuiltIn === undefined\n\t\t\t\t\t\t? builtInContext\n\t\t\t\t\t\t: yield* opts.extendContextAfterBuiltIn(builtInContext);\n\t\t\t\t}),\n\t\t}).pipe(Effect.provide(layerBuiltInPluginRuntime));\n\t});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiIA,MAAa,wBAAwB,UAAoB,gBAAwB;CAIhF,MAAM,6BACL,MAAM,OACL,eACA,OAAO,IAAI,aAAa;EACvB,OAAO,OAAO;CACf,CAAC,CACF;CAED,MAAM,eAAe,MAAM,SAC1B,cAAc,QAAQ,GACtB,iBAAiB,WAAW,GAC5B,SAAS,OACT,eAAe,OACf,wBACA,yBACA,qBACD;CAEA,MAAM,2BAA2B,wBAAwB,MAAM,KAC9D,MAAM,aAAa,YAAY,CAChC;CACA,MAAM,iBAAiB,gBAAgB,KAAK,MAAM,aAAa,wBAAwB,CAAC;CACxF,MAAM,YAAY,WAAW,KAAK,MAAM,aAAa,cAAc,CAAC;CACpE,MAAM,iBAAiB,gBAAgB,KAAK,MAAM,aAAa,SAAS,CAAC;CACzE,MAAM,kBAAkB,iBAAiB,KAAK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AAK,OAAO;GAC3D,GAAI,KAAK,iBAAiB,KAAA,IAAY,CAAC,IAAI,EAAE,cAAc,KAAK,aAAa;EAC9E,CAAC;EAIA,GAAI,KAAK,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,KAAK,SAAS;EACjE,GAAI,KAAK,oBAAoB,KAAA,IAAY,CAAC,IAAI,EAAE,iBAAiB,KAAK,gBAAgB;EACtF,GAAI,KAAK,mBAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,gBAAgB,KAAK,eAAe;EACnF,GAAI,KAAK,yBAAyB,KAAA,IAC/B,CAAC,IACD,EAAE,sBAAsB,KAAK,qBAAqB;EACrD,GAAI,KAAK,gBAAgB,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa,KAAK,YAAY;EAG1E,gBAAgB,QACf,OAAO,IAAI,aAAa;GACvB,MAAM,iBAAiB,OAAO,2BAA2B,GAAG;GAC5D,OAAO,KAAK,8BAA8B,KAAA,IACvC,iBACA,OAAO,KAAK,0BAA0B,cAAc;EACxD,CAAC;CACH,CAAC,CAAC,CAAC,KAAK,OAAO,QAAQ,yBAAyB,CAAC;AAClD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.mjs","names":[],"sources":["../../../src/orchestrators/codegen/bindings.ts"],"sourcesContent":["// Move-package bindings emission.\n//\n// Distilled-doc § \"Move-to-TS bindings: per-published-package typed\n// client modules produced from each local Move package's summary.\"\n// Drives `@mysten/codegen`'s `generateFromPackageSummary` against\n// `MoveSummary` JSON contributed by a plugin-owned\n// `MoveSummaryRunnerService`.\n//\n// sourcePath-known-vs-unknown discipline:\n// - `Package` plugin's `Codegenable` emits a `PackageBindings`\n// shape with `sourcePath: string | null`.\n// - The bindings emitter filters to `sourcePath !== null` (i.e.\n// LOCAL packages); `KnownPackage` entries (`sourcePath: null`)\n// are skipped — their bindings come from the SDK or MVR.\n//\n// Architecture seam:\n// - `MoveSummaryRunnerService` is contributed by a plugin (the\n// sui plugin ships `layerSuiMoveSummaryRunnerDocker` /\n// `layerSuiMoveSummaryRunnerHost`). The codegen orchestrator\n// consumes only the abstract service — it never names the Sui\n// CLI binary or container image (architecture: \"Orchestrator\n// boundaries — never names a service\").\n// - The call to `@mysten/codegen.generateFromPackageSummary` is\n// similarly behind a tagged service so unit tests can stub it\n// without pulling in the heavyweight `@mysten/codegen` graph.\n//\n// Distilled-doc § \"Silent no-op from a downstream tool is a\n// failure\": after summary + render, we probe the output dir.\n// If it's empty, that's a `CodegenBindingsFailed` with a hint about\n// the common `Move.toml` `[addresses]` cause.\n\nimport { mkdtemp, readdir, readFile, rm } from 'node:fs/promises';\nimport { tmpdir } from 'node:os';\nimport { join, relative, sep } from 'node:path';\n\nimport { generateFromPackageSummary } from '@mysten/codegen';\nimport { Context, Effect, FileSystem, Layer } from 'effect';\n\nimport type { ImageRef } from '../../contracts/container-runtime.ts';\n\nimport { emitOne } from './emit.ts';\nimport { CodegenBindingsFailed } from './errors.ts';\nimport { NON_SENSITIVE_DIR_MODE, NON_SENSITIVE_FILE_MODE } from './permissions.ts';\n\n// -----------------------------------------------------------------------------\n// Service seam — Move summary + codegen invocation\n// -----------------------------------------------------------------------------\n\n/** Result of `sui move summary` — opaque JSON the codegen generator\n * consumes. We don't decode it here; `@mysten/codegen` owns the\n * schema. */\nexport interface MoveSummary {\n\treadonly packageName: string;\n\treadonly sourcePath: string;\n\treadonly summaryPath?: string;\n\treadonly cleanupPath?: string;\n\treadonly summaryJson: unknown;\n}\n\nexport interface MoveSummaryInput {\n\treadonly packageName: string;\n\treadonly sourcePath: string;\n\treadonly buildImage?: ImageRef | null;\n}\n\n/** Shape of the Move summary runner. Implementations live in\n * plugin packages (e.g. `plugins/sui/move-summary-runner.ts`\n * exports `layerSuiMoveSummaryRunnerDocker` and\n * `layerSuiMoveSummaryRunnerHost`); tests use `stubMoveSummaryRunner`\n * below. */\nexport interface MoveSummaryRunner {\n\treadonly runSummary: (\n\t\tinput: MoveSummaryInput,\n\t) => Effect.Effect<MoveSummary, CodegenBindingsFailed>;\n}\n\nexport class MoveSummaryRunnerService extends Context.Service<\n\tMoveSummaryRunnerService,\n\tMoveSummaryRunner\n>()('@devstack/orchestrator/MoveSummaryRunner') {}\n\n/** Shape of the `@mysten/codegen` invocation. Returns the rendered\n * TS files (path → content) for one package. */\nexport interface MoveCodegen {\n\treadonly generate: (input: {\n\t\treadonly packageName: string;\n\t\treadonly sourcePath: string;\n\t\treadonly summary: MoveSummary;\n\t\treadonly mvrPlaceholder: string;\n\t\treadonly importExtension: '.ts' | '.js' | '';\n\t}) => Effect.Effect<\n\t\tReadonlyArray<{ readonly relPath: string; readonly content: string }>,\n\t\tCodegenBindingsFailed\n\t>;\n}\n\nexport class MoveCodegenService extends Context.Service<MoveCodegenService, MoveCodegen>()(\n\t'@devstack/orchestrator/MoveCodegen',\n) {}\n\n// -----------------------------------------------------------------------------\n// Public entry — emit bindings for the local packages in a set of\n// PackageBindings contributions.\n// -----------------------------------------------------------------------------\n\nexport interface PackageBindings {\n\treadonly name: string;\n\treadonly packageId: string;\n\treadonly mvrPlaceholder: string;\n\treadonly sourcePath: string | null;\n\treadonly excluded: boolean;\n}\n\n/**\n * Consumer-side shape guard: does an aggregated value look like a\n * Move-bindings contribution that `emitBindings` knows how to consume?\n * This is structural validation of the orchestrator's own input\n * contract, NOT a plugin-name match — any plugin whose\n * `aggregate.project` returns objects with this shape is forwarded to\n * the Move bindings emitter. The single definition of the seam; both\n * the codegen orchestrator service and the Package plugin reference it.\n */\nexport const isPackageBindings = (v: unknown): v is PackageBindings =>\n\ttypeof v === 'object' &&\n\tv !== null &&\n\t'name' in v &&\n\t'packageId' in v &&\n\t'mvrPlaceholder' in v &&\n\t'sourcePath' in v;\n\nexport interface EmitBindingsInput {\n\treadonly bindingsDir: string;\n\treadonly packages: ReadonlyArray<PackageBindings>;\n\treadonly importExtension?: '.ts' | '.js' | '';\n}\n\nexport interface EmitBindingsResult {\n\treadonly packagesEmitted: ReadonlyArray<string>;\n\treadonly packagesSkipped: ReadonlyArray<string>;\n\treadonly filesWritten: ReadonlyArray<string>;\n}\n\n/**\n * Walk the `PackageBindings` set, filter to LOCAL packages\n * (`sourcePath !== null`), run `sui move summary` + `@mysten/codegen`\n * for each, and write the rendered files into `bindingsDir/<name>/`.\n *\n * Serial within a cycle (distilled-doc § \"Serial within a cycle\":\n * shared Move build cache races). Per-package parallelism is unsafe.\n */\nexport const emitBindings = (\n\tinput: EmitBindingsInput,\n): Effect.Effect<\n\tEmitBindingsResult,\n\tCodegenBindingsFailed,\n\tFileSystem.FileSystem | MoveSummaryRunnerService | MoveCodegenService\n> =>\n\tEffect.gen(function* () {\n\t\tconst runner = yield* MoveSummaryRunnerService;\n\t\tconst generator = yield* MoveCodegenService;\n\t\tconst importExtension = input.importExtension ?? '.ts';\n\n\t\t// Dedup by package name. First-wins; distilled-doc § \"Duplicate\n\t\t// package names\": warn + skip the duplicate to avoid the HMR\n\t\t// re-emit storm.\n\t\t// Dedup by package IDENTITY (packageId + sourcePath), keyed for\n\t\t// lookup by name. The SAME package legitimately appears more than\n\t\t// once in the contribution set (e.g. the plugin's localPackage\n\t\t// binding AND a coin's package reference both point at it) — that\n\t\t// is a benign self-duplicate and is skipped SILENTLY. We only warn\n\t\t// when two genuinely DIFFERENT packages (different id/sourcePath)\n\t\t// collide on the same name, which is the real HMR re-emit hazard.\n\t\tconst seenIdentityByName = new Map<string, string>();\n\t\tconst identityOf = (pkg: PackageBindings): string => `${pkg.packageId} ${pkg.sourcePath ?? ''}`;\n\t\tconst targets: Array<PackageBindings> = [];\n\t\tconst skipped: Array<string> = [];\n\t\tfor (const pkg of input.packages) {\n\t\t\tif (pkg.sourcePath === null) {\n\t\t\t\tskipped.push(pkg.name);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (pkg.excluded) {\n\t\t\t\tskipped.push(pkg.name);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst identity = identityOf(pkg);\n\t\t\tconst seenIdentity = seenIdentityByName.get(pkg.name);\n\t\t\tif (seenIdentity !== undefined) {\n\t\t\t\tif (seenIdentity !== identity) {\n\t\t\t\t\t// Two genuinely DIFFERENT packages share a name — a real\n\t\t\t\t\t// collision and a real HMR re-emit hazard.\n\t\t\t\t\tyield* Effect.logWarning(\n\t\t\t\t\t\t`codegen.bindings: duplicate package name '${pkg.name}' — keeping ` +\n\t\t\t\t\t\t\t`first and skipping duplicate to avoid HMR re-emit storm. ` +\n\t\t\t\t\t\t\t`Rename one of the packages.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// Same identity → benign self-duplicate (e.g. localPackage +\n\t\t\t\t// coin package ref): skip silently, no warning.\n\t\t\t\tskipped.push(pkg.name);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseenIdentityByName.set(pkg.name, identity);\n\t\t\ttargets.push(pkg);\n\t\t}\n\t\t// Deterministic order: lexicographic by package name.\n\t\ttargets.sort((a, b) => a.name.localeCompare(b.name));\n\n\t\tconst emitted: Array<string> = [];\n\t\tconst filesWritten: Array<string> = [];\n\t\tfor (const pkg of targets) {\n\t\t\t// sourcePath is non-null per the filter above. Narrow.\n\t\t\tif (pkg.sourcePath === null) continue;\n\t\t\tconst summary = yield* runner.runSummary({\n\t\t\t\tpackageName: pkg.name,\n\t\t\t\tsourcePath: pkg.sourcePath,\n\t\t\t});\n\t\t\tconst files = yield* generator.generate({\n\t\t\t\tpackageName: pkg.name,\n\t\t\t\tsourcePath: pkg.sourcePath,\n\t\t\t\tsummary,\n\t\t\t\tmvrPlaceholder: pkg.mvrPlaceholder,\n\t\t\t\timportExtension,\n\t\t\t});\n\t\t\t// Post-emit probe — silent no-op detection.\n\t\t\tif (files.length === 0) {\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\tpackage: pkg.name,\n\t\t\t\t\t\tsourcePath: pkg.sourcePath,\n\t\t\t\t\t\treason: 'no-output',\n\t\t\t\t\t\thint:\n\t\t\t\t\t\t\t'The Move codegen generator produced no files. This is ' +\n\t\t\t\t\t\t\t'usually caused by a missing `[addresses]` block in the ' +\n\t\t\t\t\t\t\t\"package's Move.toml, or a non-published address mapping.\",\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tfor (const f of files) {\n\t\t\t\tif (f.relPath.includes('..') || f.relPath.startsWith('/')) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\t\tpackage: pkg.name,\n\t\t\t\t\t\t\tsourcePath: pkg.sourcePath,\n\t\t\t\t\t\t\treason: 'write-failed',\n\t\t\t\t\t\t\tcause: new Error(`generated binding path escapes output dir: ${f.relPath}`),\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst abs = joinPath(input.bindingsDir, f.relPath);\n\t\t\t\tconst outcome = yield* emitOne({\n\t\t\t\t\tpath: abs,\n\t\t\t\t\tcontent: stabilizeGeneratedBindingContent(f.content),\n\t\t\t\t\tmode: NON_SENSITIVE_FILE_MODE,\n\t\t\t\t\tparentMode: NON_SENSITIVE_DIR_MODE,\n\t\t\t\t}).pipe(\n\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t(cause) =>\n\t\t\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\t\t\tpackage: pkg.name,\n\t\t\t\t\t\t\t\tsourcePath: pkg.sourcePath!,\n\t\t\t\t\t\t\t\treason: 'write-failed',\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tif (outcome.outcome !== 'unchanged') {\n\t\t\t\t\tfilesWritten.push(abs);\n\t\t\t\t}\n\t\t\t}\n\t\t\temitted.push(pkg.name);\n\t\t}\n\n\t\treturn {\n\t\t\tpackagesEmitted: emitted,\n\t\t\tpackagesSkipped: skipped,\n\t\t\tfilesWritten,\n\t\t};\n\t});\n\n// -----------------------------------------------------------------------------\n// Stub implementations for tests\n// -----------------------------------------------------------------------------\n\n/** Stub runner — returns a synthetic summary. Used in unit tests\n * to exercise the bindings pipeline without a real `sui` binary. */\nexport const stubMoveSummaryRunner = (\n\tsummaryFor: (sourcePath: string) => MoveSummary,\n): MoveSummaryRunner => ({\n\trunSummary: ({ sourcePath }) => Effect.succeed(summaryFor(sourcePath)),\n});\n\n/** Stub generator — returns a synthetic file set. Used in unit\n * tests to exercise the bindings pipeline without pulling in the\n * heavyweight `@mysten/codegen` graph. */\nexport const stubMoveCodegen = (\n\tfiles: (\n\t\tinput: Parameters<MoveCodegen['generate']>[0],\n\t) => ReadonlyArray<{ readonly relPath: string; readonly content: string }>,\n): MoveCodegen => ({\n\tgenerate: (input) => Effect.succeed(files(input)),\n});\n\n// -----------------------------------------------------------------------------\n// Production implementations\n// -----------------------------------------------------------------------------\n//\n// Layer factories for `MoveSummaryRunnerService` are plugin-owned —\n// they live in `src/plugins/sui/move-summary-runner.ts`. The codegen\n// orchestrator does not name the Sui CLI binary or container image;\n// per \"Orchestrator boundaries — never names a service\", any plugin\n// that can produce `MoveSummary` JSON may contribute a runner Layer.\n\nexport const layerMystenMoveCodegen = (\n\toptions: {\n\t\t/** Forwarded verbatim to `@mysten/codegen`'s\n\t\t * `generateFromPackageSummary({ includePhantomTypeParameters })`.\n\t\t * Default `false` (`@mysten/codegen`'s own default): phantom-only\n\t\t * structs render as plain consts with the `<phantom T>` placeholder\n\t\t * baked into `.name`. `true` renders them as factory functions whose\n\t\t * phantom type parameters are REQUIRED arguments, so the returned\n\t\t * instance's `.name` is a fully-qualified, composable type tag\n\t\t * (`Pool(DBTC, DUSDC).name`). Static per stack — threaded from\n\t\t * `DevstackOptions['codegen']` through\n\t\t * `resolveProductionCodegenOptions`, never per-cycle. */\n\t\treadonly includePhantomTypeParameters?: boolean;\n\t} = {},\n): Layer.Layer<MoveCodegenService> =>\n\tLayer.succeed(\n\t\tMoveCodegenService,\n\t\tMoveCodegenService.of({\n\t\t\tgenerate: (input) =>\n\t\t\t\tEffect.tryPromise({\n\t\t\t\t\ttry: async () => {\n\t\t\t\t\t\tconst tmp = await mkdtemp(join(tmpdir(), 'devstack-move-codegen-'));\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t// `sui move summary` keys each `package_summaries/<dir>`\n\t\t\t\t\t\t\t// subdirectory by the package's NAMED ADDRESS, not its\n\t\t\t\t\t\t\t// `[package].name`. These legitimately differ (the canonical\n\t\t\t\t\t\t\t// example is MoveStdlib, whose package name is \"MoveStdlib\"\n\t\t\t\t\t\t\t// but whose named address is \"std\"). `@mysten/codegen`'s\n\t\t\t\t\t\t\t// resolver matches the summary subdir by either (1) a single\n\t\t\t\t\t\t\t// `[addresses]` label or (2) the `packageName` — but it reads\n\t\t\t\t\t\t\t// the Move.toml at the path WE pass it (the summary scratch\n\t\t\t\t\t\t\t// dir), which has NO `[addresses]` table, so its label-based\n\t\t\t\t\t\t\t// path (1) is defeated and it falls back to (2). We pass the\n\t\t\t\t\t\t\t// symbolic localPackage() NAME as `packageName`, which is the\n\t\t\t\t\t\t\t// `[package].name`, NOT the named address — so codegen throws\n\t\t\t\t\t\t\t// \"Could not identify main package directory\" whenever the two\n\t\t\t\t\t\t\t// differ. Recover the correct subdir name here from the REAL\n\t\t\t\t\t\t\t// source Move.toml's `[addresses]` table (which devstack still\n\t\t\t\t\t\t\t// has at `input.sourcePath`), falling back to the name when the\n\t\t\t\t\t\t\t// source is unreadable or ambiguous (a no-op for the common\n\t\t\t\t\t\t\t// case where name == address).\n\t\t\t\t\t\t\tconst packageName =\n\t\t\t\t\t\t\t\t(await resolveSummaryDirName(input.sourcePath)) ?? input.packageName;\n\t\t\t\t\t\t\tawait generateFromPackageSummary({\n\t\t\t\t\t\t\t\tpackage: {\n\t\t\t\t\t\t\t\t\tpath: input.summary.summaryPath ?? input.sourcePath,\n\t\t\t\t\t\t\t\t\tpackage: input.mvrPlaceholder,\n\t\t\t\t\t\t\t\t\tpackageName,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tprune: true,\n\t\t\t\t\t\t\t\toutputDir: tmp,\n\t\t\t\t\t\t\t\timportExtension: input.importExtension,\n\t\t\t\t\t\t\t\tincludePhantomTypeParameters: options.includePhantomTypeParameters,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn await collectGeneratedFiles(tmp);\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tawait rm(tmp, { recursive: true, force: true });\n\t\t\t\t\t\t\tif (input.summary.cleanupPath !== undefined) {\n\t\t\t\t\t\t\t\tawait rm(input.summary.cleanupPath, { recursive: true, force: true });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tcatch: (cause) =>\n\t\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\t\tpackage: input.packageName,\n\t\t\t\t\t\t\tsourcePath: input.sourcePath,\n\t\t\t\t\t\t\treason: 'render-failed',\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t}),\n\t\t\t\t}),\n\t\t}),\n\t);\n\n// -----------------------------------------------------------------------------\n// Local helpers — keep the module dep-free of Path.Path so the\n// caller can compose without an extra service yield.\n// -----------------------------------------------------------------------------\n\nconst joinPath = (...parts: ReadonlyArray<string>): string =>\n\tparts.map((p, i) => (i === 0 ? p.replace(/\\/+$/, '') : p.replace(/^\\/+|\\/+$/g, ''))).join('/');\n\n/**\n * Determine the `package_summaries/<dir>` subdirectory name for a local\n * Move package from its REAL source `Move.toml`. `sui move summary` keys\n * these subdirs by the NAMED ADDRESS (e.g. MoveStdlib → \"std\"), not the\n * `[package].name`, so when the two differ we must hand `@mysten/codegen`\n * the address label rather than the symbolic package name.\n *\n * Returns the single `[addresses]` label when the table has exactly one\n * entry (the overwhelmingly common case — and a no-op when name == address),\n * and `null` otherwise (unreadable Move.toml, no `[addresses]` table, or an\n * ambiguous multi-address table) so the caller can fall back to the package\n * name and preserve `@mysten/codegen`'s own resolution.\n *\n * Hand-parse rather than pull in a TOML dependency: the sibling Move-build\n * path already harvests `{ local = \"../x\" }` deps from Move.toml by regex\n * (`plugins/sui/move/index.ts`), and we only need the `[addresses]` section's\n * left-hand labels — never their values.\n */\nconst resolveSummaryDirName = async (sourcePath: string): Promise<string | null> => {\n\tlet toml: string;\n\ttry {\n\t\ttoml = await readFile(join(sourcePath, 'Move.toml'), 'utf8');\n\t} catch {\n\t\treturn null;\n\t}\n\tconst labels = parseAddressLabels(toml);\n\treturn labels.length === 1 ? labels[0]! : null;\n};\n\n/** Left-hand labels of the `[addresses]` table in a Move.toml. Scans from\n * the `[addresses]` header to the next `[section]` header (or EOF) and\n * collects each `name = \"...\"` key, ignoring blank/comment lines. */\nconst parseAddressLabels = (toml: string): ReadonlyArray<string> => {\n\tconst lines = toml.split(/\\r?\\n/);\n\tconst start = lines.findIndex((line) => /^\\s*\\[addresses\\]\\s*$/.test(line));\n\tif (start === -1) return [];\n\tconst labels: Array<string> = [];\n\tfor (const line of lines.slice(start + 1)) {\n\t\t// Next table header ends the `[addresses]` section.\n\t\tif (/^\\s*\\[/.test(line)) break;\n\t\tconst stripped = line.replace(/#.*$/, '').trim();\n\t\tif (stripped === '') continue;\n\t\tconst match = /^([A-Za-z_][\\w-]*)\\s*=/.exec(stripped);\n\t\tif (match) labels.push(match[1]!);\n\t}\n\treturn labels;\n};\n\nconst generatedBcsFactoryPattern =\n\t/export function ([A-Za-z_$][\\w$]*)<((?:[^<>]|<[^<>]*>)+)>\\((\\.\\.\\.typeParameters: \\[[\\s\\S]*?\\n\\])\\) \\{\\n(\\s*)return new (MoveStruct|MoveEnum|MoveTuple)\\(/g;\n\nconst bcsFactoryReturnType = (constructorName: string): string => {\n\tif (constructorName === 'MoveEnum') {\n\t\treturn 'MoveEnum<any, string>';\n\t}\n\tif (constructorName === 'MoveTuple') {\n\t\treturn 'MoveTuple<any, string>';\n\t}\n\treturn 'MoveStruct<any, string>';\n};\n\nconst stabilizeGeneratedBindingContent = (content: string): string =>\n\tcontent.replace(\n\t\tgeneratedBcsFactoryPattern,\n\t\t(_match, name, generics, parameters, indent, constructorName: string) =>\n\t\t\t`export function ${name}<${generics}>(${parameters}): ${bcsFactoryReturnType(\n\t\t\t\tconstructorName,\n\t\t\t)} {\\n${indent}return new ${constructorName}(`,\n\t);\n\nconst collectGeneratedFiles = async (\n\troot: string,\n): Promise<ReadonlyArray<{ readonly relPath: string; readonly content: string }>> => {\n\tconst out: Array<{ readonly relPath: string; readonly content: string }> = [];\n\tconst walk = async (dir: string): Promise<void> => {\n\t\tconst entries = await readdir(dir, { withFileTypes: true });\n\t\tfor (const entry of entries) {\n\t\t\tconst abs = join(dir, entry.name);\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tawait walk(abs);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!entry.isFile()) continue;\n\t\t\tconst relPath = relative(root, abs).split(sep).join('/');\n\t\t\tout.push({ relPath, content: await readFile(abs, 'utf8') });\n\t\t}\n\t};\n\tawait walk(root);\n\tout.sort((a, b) => a.relPath.localeCompare(b.relPath));\n\treturn out;\n};\n"],"mappings":";;;;;;;;;AA4EA,IAAa,2BAAb,cAA8C,QAAQ,QAGpD,CAAC,CAAC,0CAA0C,CAAC,CAAC,CAAC;AAiBjD,IAAa,qBAAb,cAAwC,QAAQ,QAAyC,CAAC,CACzF,oCACD,CAAC,CAAC,CAAC;;;;;;;;;;AAwBH,MAAa,qBAAqB,MACjC,OAAO,MAAM,YACb,MAAM,QACN,UAAU,KACV,eAAe,KACf,oBAAoB,KACpB,gBAAgB;;;;;;;;;AAsBjB,MAAa,gBACZ,UAMA,OAAO,IAAI,aAAa;CACvB,MAAM,SAAS,OAAO;CACtB,MAAM,YAAY,OAAO;CACzB,MAAM,kBAAkB,MAAM,mBAAmB;CAYjD,MAAM,qCAAqB,IAAI,IAAoB;CACnD,MAAM,cAAc,QAAiC,GAAG,IAAI,UAAU,GAAG,IAAI,cAAc;C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AC7B,SACoF;CACpF,MAAM,MAAqE,CAAC;CAC5E,MAAM,OAAO,OAAO,QAA+B;EAClD,MAAM,UAAU,MAAM,QAAQ,KAAK,EAAE,eAAe,KAAK,CAAC;EAC1D,KAAK,MAAM,SAAS,SAAS;GAC5B,MAAM,MAAM,KAAK,KAAK,MAAM,IAAI;GAChC,IAAI,MAAM,YAAY,GAAG;IACxB,MAAM,KAAK,GAAG;IACd;GACD;GACA,IAAI,CAAC,MAAM,OAAO,GAAG;GACrB,MAAM,UAAU,SAAS,MAAM,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG;GACvD,IAAI,KAAK;IAAE;IAAS,SAAS,MAAM,SAAS,KAAK,MAAM;GAAE,CAAC;EAC3D;CACD;CACA,MAAM,KAAK,IAAI;CACf,IAAI,MAAM,GAAG,MAAM,EAAE,QAAQ,cAAc,EAAE,OAAO,CAAC;CACrD,OAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"bindings.mjs","names":[],"sources":["../../../src/orchestrators/codegen/bindings.ts"],"sourcesContent":["// Move-package bindings emission.\n//\n// Distilled-doc § \"Move-to-TS bindings: per-published-package typed\n// client modules produced from each local Move package's summary.\"\n// Drives `@mysten/codegen`'s `generateFromPackageSummary` against\n// `MoveSummary` JSON contributed by a plugin-owned\n// `MoveSummaryRunnerService`.\n//\n// sourcePath-known-vs-unknown discipline:\n// - `Package` plugin's `Codegenable` emits a `PackageBindings`\n// shape with `sourcePath: string | null`.\n// - The bindings emitter filters to `sourcePath !== null` (i.e.\n// LOCAL packages); `KnownPackage` entries (`sourcePath: null`)\n// are skipped — their bindings come from the SDK or MVR.\n//\n// Architecture seam:\n// - `MoveSummaryRunnerService` is contributed by a plugin (the\n// sui plugin ships `layerSuiMoveSummaryRunnerDocker` /\n// `layerSuiMoveSummaryRunnerHost`). The codegen orchestrator\n// consumes only the abstract service — it never names the Sui\n// CLI binary or container image (architecture: \"Orchestrator\n// boundaries — never names a service\").\n// - The call to `@mysten/codegen.generateFromPackageSummary` is\n// similarly behind a tagged service so unit tests can stub it\n// without pulling in the heavyweight `@mysten/codegen` graph.\n//\n// Distilled-doc § \"Silent no-op from a downstream tool is a\n// failure\": after summary + render, we probe the output dir.\n// If it's empty, that's a `CodegenBindingsFailed` with a hint about\n// the common `Move.toml` `[addresses]` cause.\n\nimport { mkdtemp, readdir, readFile, rm } from 'node:fs/promises';\nimport { tmpdir } from 'node:os';\nimport { join, relative, sep } from 'node:path';\n\nimport { generateFromPackageSummary } from '@mysten/codegen';\nimport { Context, Effect, FileSystem, Layer } from 'effect';\n\nimport type { ImageRef } from '../../contracts/container-runtime.ts';\n\nimport { emitOne } from './emit.ts';\nimport { CodegenBindingsFailed } from './errors.ts';\nimport { NON_SENSITIVE_DIR_MODE, NON_SENSITIVE_FILE_MODE } from './permissions.ts';\n\n// -----------------------------------------------------------------------------\n// Service seam — Move summary + codegen invocation\n// -----------------------------------------------------------------------------\n\n/** Result of `sui move summary` — opaque JSON the codegen generator\n * consumes. We don't decode it here; `@mysten/codegen` owns the\n * schema. */\nexport interface MoveSummary {\n\treadonly packageName: string;\n\treadonly sourcePath: string;\n\treadonly summaryPath?: string;\n\treadonly cleanupPath?: string;\n\treadonly summaryJson: unknown;\n}\n\nexport interface MoveSummaryInput {\n\treadonly packageName: string;\n\treadonly sourcePath: string;\n\treadonly buildImage?: ImageRef | null;\n}\n\n/** Shape of the Move summary runner. Implementations live in\n * plugin packages (e.g. `plugins/sui/move-summary-runner.ts`\n * exports `layerSuiMoveSummaryRunnerDocker` and\n * `layerSuiMoveSummaryRunnerHost`); tests use `stubMoveSummaryRunner`\n * below. */\nexport interface MoveSummaryRunner {\n\treadonly runSummary: (\n\t\tinput: MoveSummaryInput,\n\t) => Effect.Effect<MoveSummary, CodegenBindingsFailed>;\n}\n\nexport class MoveSummaryRunnerService extends Context.Service<\n\tMoveSummaryRunnerService,\n\tMoveSummaryRunner\n>()('@devstack/orchestrator/MoveSummaryRunner') {}\n\n/** One rendered binding file — relative path + TS content. */\nexport interface GeneratedBindingFile {\n\treadonly relPath: string;\n\treadonly content: string;\n}\n\n/** Shape of the `@mysten/codegen` invocation. Returns the rendered\n * TS files (path → content) for one package. */\nexport interface MoveCodegen {\n\treadonly generate: (input: {\n\t\treadonly packageName: string;\n\t\treadonly sourcePath: string;\n\t\treadonly summary: MoveSummary;\n\t\treadonly mvrPlaceholder: string;\n\t\treadonly importExtension: '.ts' | '.js' | '';\n\t}) => Effect.Effect<ReadonlyArray<GeneratedBindingFile>, CodegenBindingsFailed>;\n}\n\nexport class MoveCodegenService extends Context.Service<MoveCodegenService, MoveCodegen>()(\n\t'@devstack/orchestrator/MoveCodegen',\n) {}\n\n// -----------------------------------------------------------------------------\n// Public entry — emit bindings for the local packages in a set of\n// PackageBindings contributions.\n// -----------------------------------------------------------------------------\n\nexport interface PackageBindings {\n\treadonly name: string;\n\treadonly packageId: string;\n\treadonly mvrPlaceholder: string;\n\treadonly sourcePath: string | null;\n\treadonly excluded: boolean;\n}\n\n/**\n * Consumer-side shape guard: does an aggregated value look like a\n * Move-bindings contribution that `emitBindings` knows how to consume?\n * This is structural validation of the orchestrator's own input\n * contract, NOT a plugin-name match — any plugin whose\n * `aggregate.project` returns objects with this shape is forwarded to\n * the Move bindings emitter. The single definition of the seam; both\n * the codegen orchestrator service and the Package plugin reference it.\n */\nexport const isPackageBindings = (v: unknown): v is PackageBindings =>\n\ttypeof v === 'object' &&\n\tv !== null &&\n\t'name' in v &&\n\t'packageId' in v &&\n\t'mvrPlaceholder' in v &&\n\t'sourcePath' in v;\n\nexport interface EmitBindingsInput {\n\treadonly bindingsDir: string;\n\treadonly packages: ReadonlyArray<PackageBindings>;\n\treadonly importExtension?: '.ts' | '.js' | '';\n}\n\nexport interface EmitBindingsResult {\n\treadonly packagesEmitted: ReadonlyArray<string>;\n\treadonly packagesSkipped: ReadonlyArray<string>;\n\treadonly filesWritten: ReadonlyArray<string>;\n}\n\n/**\n * Walk the `PackageBindings` set, filter to LOCAL packages\n * (`sourcePath !== null`), run `sui move summary` + `@mysten/codegen`\n * for each, and write the rendered files into `bindingsDir/<name>/`.\n *\n * Serial within a cycle (distilled-doc § \"Serial within a cycle\":\n * shared Move build cache races). Per-package parallelism is unsafe.\n */\nexport const emitBindings = (\n\tinput: EmitBindingsInput,\n): Effect.Effect<\n\tEmitBindingsResult,\n\tCodegenBindingsFailed,\n\tFileSystem.FileSystem | MoveSummaryRunnerService | MoveCodegenService\n> =>\n\tEffect.gen(function* () {\n\t\tconst runner = yield* MoveSummaryRunnerService;\n\t\tconst generator = yield* MoveCodegenService;\n\t\tconst importExtension = input.importExtension ?? '.ts';\n\n\t\t// Dedup by package name. First-wins; distilled-doc § \"Duplicate\n\t\t// package names\": warn + skip the duplicate to avoid the HMR\n\t\t// re-emit storm.\n\t\t// Dedup by package IDENTITY (packageId + sourcePath), keyed for\n\t\t// lookup by name. The SAME package legitimately appears more than\n\t\t// once in the contribution set (e.g. the plugin's localPackage\n\t\t// binding AND a coin's package reference both point at it) — that\n\t\t// is a benign self-duplicate and is skipped SILENTLY. We only warn\n\t\t// when two genuinely DIFFERENT packages (different id/sourcePath)\n\t\t// collide on the same name, which is the real HMR re-emit hazard.\n\t\tconst seenIdentityByName = new Map<string, string>();\n\t\tconst identityOf = (pkg: PackageBindings): string => `${pkg.packageId} ${pkg.sourcePath ?? ''}`;\n\t\tconst targets: Array<PackageBindings> = [];\n\t\tconst skipped: Array<string> = [];\n\t\tfor (const pkg of input.packages) {\n\t\t\tif (pkg.sourcePath === null) {\n\t\t\t\tskipped.push(pkg.name);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (pkg.excluded) {\n\t\t\t\tskipped.push(pkg.name);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst identity = identityOf(pkg);\n\t\t\tconst seenIdentity = seenIdentityByName.get(pkg.name);\n\t\t\tif (seenIdentity !== undefined) {\n\t\t\t\tif (seenIdentity !== identity) {\n\t\t\t\t\t// Two genuinely DIFFERENT packages share a name — a real\n\t\t\t\t\t// collision and a real HMR re-emit hazard.\n\t\t\t\t\tyield* Effect.logWarning(\n\t\t\t\t\t\t`codegen.bindings: duplicate package name '${pkg.name}' — keeping ` +\n\t\t\t\t\t\t\t`first and skipping duplicate to avoid HMR re-emit storm. ` +\n\t\t\t\t\t\t\t`Rename one of the packages.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// Same identity → benign self-duplicate (e.g. localPackage +\n\t\t\t\t// coin package ref): skip silently, no warning.\n\t\t\t\tskipped.push(pkg.name);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseenIdentityByName.set(pkg.name, identity);\n\t\t\ttargets.push(pkg);\n\t\t}\n\t\t// Deterministic order: lexicographic by package name.\n\t\ttargets.sort((a, b) => a.name.localeCompare(b.name));\n\n\t\tconst emitted: Array<string> = [];\n\t\tconst filesWritten: Array<string> = [];\n\t\tfor (const pkg of targets) {\n\t\t\t// sourcePath is non-null per the filter above. Narrow.\n\t\t\tif (pkg.sourcePath === null) continue;\n\t\t\tconst summary = yield* runner.runSummary({\n\t\t\t\tpackageName: pkg.name,\n\t\t\t\tsourcePath: pkg.sourcePath,\n\t\t\t});\n\t\t\tconst files = yield* generator.generate({\n\t\t\t\tpackageName: pkg.name,\n\t\t\t\tsourcePath: pkg.sourcePath,\n\t\t\t\tsummary,\n\t\t\t\tmvrPlaceholder: pkg.mvrPlaceholder,\n\t\t\t\timportExtension,\n\t\t\t});\n\t\t\t// Post-emit probe — silent no-op detection.\n\t\t\tif (files.length === 0) {\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\tpackage: pkg.name,\n\t\t\t\t\t\tsourcePath: pkg.sourcePath,\n\t\t\t\t\t\treason: 'no-output',\n\t\t\t\t\t\thint:\n\t\t\t\t\t\t\t'The Move codegen generator produced no files. This is ' +\n\t\t\t\t\t\t\t'usually caused by a missing `[addresses]` block in the ' +\n\t\t\t\t\t\t\t\"package's Move.toml, or a non-published address mapping.\",\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tfor (const f of files) {\n\t\t\t\tif (f.relPath.includes('..') || f.relPath.startsWith('/')) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\t\tpackage: pkg.name,\n\t\t\t\t\t\t\tsourcePath: pkg.sourcePath,\n\t\t\t\t\t\t\treason: 'write-failed',\n\t\t\t\t\t\t\tcause: new Error(`generated binding path escapes output dir: ${f.relPath}`),\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst abs = joinPath(input.bindingsDir, f.relPath);\n\t\t\t\tconst outcome = yield* emitOne({\n\t\t\t\t\tpath: abs,\n\t\t\t\t\tcontent: stabilizeGeneratedBindingContent(f.content),\n\t\t\t\t\tmode: NON_SENSITIVE_FILE_MODE,\n\t\t\t\t\tparentMode: NON_SENSITIVE_DIR_MODE,\n\t\t\t\t}).pipe(\n\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t(cause) =>\n\t\t\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\t\t\tpackage: pkg.name,\n\t\t\t\t\t\t\t\tsourcePath: pkg.sourcePath!,\n\t\t\t\t\t\t\t\treason: 'write-failed',\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tif (outcome.outcome !== 'unchanged') {\n\t\t\t\t\tfilesWritten.push(abs);\n\t\t\t\t}\n\t\t\t}\n\t\t\temitted.push(pkg.name);\n\t\t}\n\n\t\treturn {\n\t\t\tpackagesEmitted: emitted,\n\t\t\tpackagesSkipped: skipped,\n\t\t\tfilesWritten,\n\t\t};\n\t});\n\n// -----------------------------------------------------------------------------\n// Stub implementations for tests\n// -----------------------------------------------------------------------------\n\n/** Stub runner — returns a synthetic summary. Used in unit tests\n * to exercise the bindings pipeline without a real `sui` binary. */\nexport const stubMoveSummaryRunner = (\n\tsummaryFor: (sourcePath: string) => MoveSummary,\n): MoveSummaryRunner => ({\n\trunSummary: ({ sourcePath }) => Effect.succeed(summaryFor(sourcePath)),\n});\n\n/** Stub generator — returns a synthetic file set. Used in unit\n * tests to exercise the bindings pipeline without pulling in the\n * heavyweight `@mysten/codegen` graph. */\nexport const stubMoveCodegen = (\n\tfiles: (\n\t\tinput: Parameters<MoveCodegen['generate']>[0],\n\t) => ReadonlyArray<{ readonly relPath: string; readonly content: string }>,\n): MoveCodegen => ({\n\tgenerate: (input) => Effect.succeed(files(input)),\n});\n\n// -----------------------------------------------------------------------------\n// Production implementations\n// -----------------------------------------------------------------------------\n//\n// Layer factories for `MoveSummaryRunnerService` are plugin-owned —\n// they live in `src/plugins/sui/move-summary-runner.ts`. The codegen\n// orchestrator does not name the Sui CLI binary or container image;\n// per \"Orchestrator boundaries — never names a service\", any plugin\n// that can produce `MoveSummary` JSON may contribute a runner Layer.\n\nexport const layerMystenMoveCodegen = (\n\toptions: {\n\t\t/** Forwarded verbatim to `@mysten/codegen`'s\n\t\t * `generateFromPackageSummary({ includePhantomTypeParameters })`.\n\t\t * Default `false` (`@mysten/codegen`'s own default): phantom-only\n\t\t * structs render as plain consts with the `<phantom T>` placeholder\n\t\t * baked into `.name`. `true` renders them as factory functions whose\n\t\t * phantom type parameters are REQUIRED arguments, so the returned\n\t\t * instance's `.name` is a fully-qualified, composable type tag\n\t\t * (`Pool(DBTC, DUSDC).name`). Static per stack — threaded from\n\t\t * `DevstackOptions['codegen']` through\n\t\t * `resolveProductionCodegenOptions`, never per-cycle. */\n\t\treadonly includePhantomTypeParameters?: boolean;\n\t} = {},\n): Layer.Layer<MoveCodegenService> =>\n\tLayer.succeed(\n\t\tMoveCodegenService,\n\t\tMoveCodegenService.of({\n\t\t\tgenerate: (input) =>\n\t\t\t\tEffect.tryPromise({\n\t\t\t\t\ttry: async () => {\n\t\t\t\t\t\tconst tmp = await mkdtemp(join(tmpdir(), 'devstack-move-codegen-'));\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t// `sui move summary` keys each `package_summaries/<dir>`\n\t\t\t\t\t\t\t// subdirectory by the package's NAMED ADDRESS, not its\n\t\t\t\t\t\t\t// `[package].name`. These legitimately differ (the canonical\n\t\t\t\t\t\t\t// example is MoveStdlib, whose package name is \"MoveStdlib\"\n\t\t\t\t\t\t\t// but whose named address is \"std\"). `@mysten/codegen`'s\n\t\t\t\t\t\t\t// resolver matches the summary subdir by either (1) a single\n\t\t\t\t\t\t\t// `[addresses]` label or (2) the `packageName` — but it reads\n\t\t\t\t\t\t\t// the Move.toml at the path WE pass it (the summary scratch\n\t\t\t\t\t\t\t// dir), which has NO `[addresses]` table, so its label-based\n\t\t\t\t\t\t\t// path (1) is defeated and it falls back to (2). We pass the\n\t\t\t\t\t\t\t// symbolic localPackage() NAME as `packageName`, which is the\n\t\t\t\t\t\t\t// `[package].name`, NOT the named address — so codegen throws\n\t\t\t\t\t\t\t// \"Could not identify main package directory\" whenever the two\n\t\t\t\t\t\t\t// differ. Recover the correct subdir name here from the REAL\n\t\t\t\t\t\t\t// source Move.toml's `[addresses]` table (which devstack still\n\t\t\t\t\t\t\t// has at `input.sourcePath`), falling back to the name when the\n\t\t\t\t\t\t\t// source is unreadable or ambiguous (a no-op for the common\n\t\t\t\t\t\t\t// case where name == address).\n\t\t\t\t\t\t\tconst packageName =\n\t\t\t\t\t\t\t\t(await resolveSummaryDirName(input.sourcePath)) ?? input.packageName;\n\t\t\t\t\t\t\tawait generateFromPackageSummary({\n\t\t\t\t\t\t\t\tpackage: {\n\t\t\t\t\t\t\t\t\tpath: input.summary.summaryPath ?? input.sourcePath,\n\t\t\t\t\t\t\t\t\tpackage: input.mvrPlaceholder,\n\t\t\t\t\t\t\t\t\tpackageName,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tprune: true,\n\t\t\t\t\t\t\t\toutputDir: tmp,\n\t\t\t\t\t\t\t\timportExtension: input.importExtension,\n\t\t\t\t\t\t\t\tincludePhantomTypeParameters: options.includePhantomTypeParameters,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treturn await collectGeneratedFiles(tmp);\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tawait rm(tmp, { recursive: true, force: true });\n\t\t\t\t\t\t\tif (input.summary.cleanupPath !== undefined) {\n\t\t\t\t\t\t\t\tawait rm(input.summary.cleanupPath, { recursive: true, force: true });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tcatch: (cause) =>\n\t\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\t\tpackage: input.packageName,\n\t\t\t\t\t\t\tsourcePath: input.sourcePath,\n\t\t\t\t\t\t\treason: 'render-failed',\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t}),\n\t\t\t\t}),\n\t\t}),\n\t);\n\n// -----------------------------------------------------------------------------\n// Local helpers — keep the module dep-free of Path.Path so the\n// caller can compose without an extra service yield.\n// -----------------------------------------------------------------------------\n\nconst joinPath = (...parts: ReadonlyArray<string>): string =>\n\tparts.map((p, i) => (i === 0 ? p.replace(/\\/+$/, '') : p.replace(/^\\/+|\\/+$/g, ''))).join('/');\n\n/**\n * Determine the `package_summaries/<dir>` subdirectory name for a local\n * Move package from its REAL source `Move.toml`. `sui move summary` keys\n * these subdirs by the NAMED ADDRESS (e.g. MoveStdlib → \"std\"), not the\n * `[package].name`, so when the two differ we must hand `@mysten/codegen`\n * the address label rather than the symbolic package name.\n *\n * Returns the single `[addresses]` label when the table has exactly one\n * entry (the overwhelmingly common case — and a no-op when name == address),\n * and `null` otherwise (unreadable Move.toml, no `[addresses]` table, or an\n * ambiguous multi-address table) so the caller can fall back to the package\n * name and preserve `@mysten/codegen`'s own resolution.\n *\n * Hand-parse rather than pull in a TOML dependency: the sibling Move-build\n * path already harvests `{ local = \"../x\" }` deps from Move.toml by regex\n * (`plugins/sui/move/index.ts`), and we only need the `[addresses]` section's\n * left-hand labels — never their values.\n */\nconst resolveSummaryDirName = async (sourcePath: string): Promise<string | null> => {\n\tlet toml: string;\n\ttry {\n\t\ttoml = await readFile(join(sourcePath, 'Move.toml'), 'utf8');\n\t} catch {\n\t\treturn null;\n\t}\n\tconst labels = parseAddressLabels(toml);\n\treturn labels.length === 1 ? labels[0]! : null;\n};\n\n/** Left-hand labels of the `[addresses]` table in a Move.toml. Scans from\n * the `[addresses]` header to the next `[section]` header (or EOF) and\n * collects each `name = \"...\"` key, ignoring blank/comment lines. */\nconst parseAddressLabels = (toml: string): ReadonlyArray<string> => {\n\tconst lines = toml.split(/\\r?\\n/);\n\tconst start = lines.findIndex((line) => /^\\s*\\[addresses\\]\\s*$/.test(line));\n\tif (start === -1) return [];\n\tconst labels: Array<string> = [];\n\tfor (const line of lines.slice(start + 1)) {\n\t\t// Next table header ends the `[addresses]` section.\n\t\tif (/^\\s*\\[/.test(line)) break;\n\t\tconst stripped = line.replace(/#.*$/, '').trim();\n\t\tif (stripped === '') continue;\n\t\tconst match = /^([A-Za-z_][\\w-]*)\\s*=/.exec(stripped);\n\t\tif (match) labels.push(match[1]!);\n\t}\n\treturn labels;\n};\n\nconst generatedBcsFactoryPattern =\n\t/export function ([A-Za-z_$][\\w$]*)<((?:[^<>]|<[^<>]*>)+)>\\((\\.\\.\\.typeParameters: \\[[\\s\\S]*?\\n\\])\\) \\{\\n(\\s*)return new (MoveStruct|MoveEnum|MoveTuple)\\(/g;\n\nconst bcsFactoryReturnType = (constructorName: string): string => {\n\tif (constructorName === 'MoveEnum') {\n\t\treturn 'MoveEnum<any, string>';\n\t}\n\tif (constructorName === 'MoveTuple') {\n\t\treturn 'MoveTuple<any, string>';\n\t}\n\treturn 'MoveStruct<any, string>';\n};\n\nconst stabilizeGeneratedBindingContent = (content: string): string =>\n\tcontent.replace(\n\t\tgeneratedBcsFactoryPattern,\n\t\t(_match, name, generics, parameters, indent, constructorName: string) =>\n\t\t\t`export function ${name}<${generics}>(${parameters}): ${bcsFactoryReturnType(\n\t\t\t\tconstructorName,\n\t\t\t)} {\\n${indent}return new ${constructorName}(`,\n\t);\n\nconst collectGeneratedFiles = async (\n\troot: string,\n): Promise<ReadonlyArray<{ readonly relPath: string; readonly content: string }>> => {\n\tconst out: Array<{ readonly relPath: string; readonly content: string }> = [];\n\tconst walk = async (dir: string): Promise<void> => {\n\t\tconst entries = await readdir(dir, { withFileTypes: true });\n\t\tfor (const entry of entries) {\n\t\t\tconst abs = join(dir, entry.name);\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\tawait walk(abs);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!entry.isFile()) continue;\n\t\t\tconst relPath = relative(root, abs).split(sep).join('/');\n\t\t\tout.push({ relPath, content: await readFile(abs, 'utf8') });\n\t\t}\n\t};\n\tawait walk(root);\n\tout.sort((a, b) => a.relPath.localeCompare(b.relPath));\n\treturn out;\n};\n"],"mappings":";;;;;;;;;AA4EA,IAAa,2BAAb,cAA8C,QAAQ,QAGpD,CAAC,CAAC,0CAA0C,CAAC,CAAC,CAAC;AAoBjD,IAAa,qBAAb,cAAwC,QAAQ,QAAyC,CAAC,CACzF,oCACD,CAAC,CAAC,CAAC;;;;;;;;;;AAwBH,MAAa,qBAAqB,MACjC,OAAO,MAAM,YACb,MAAM,QACN,UAAU,KACV,eAAe,KACf,oBAAoB,KACpB,gBAAgB;;;;;;;;;AAsBjB,MAAa,gBACZ,UAMA,OAAO,IAAI,aAAa;CACvB,MAAM,SAAS,OAAO;CACtB,MAAM,YAAY,OAAO;CACzB,MAAM,kBAAkB,MAAM,mBAAmB;CAYjD,MAAM,qCAAqB,IAAI,IAAoB;CACnD,MAAM,cAAc,QAAiC,GAAG,IAAI,UAAU,GAAG,IAAI,cAAc;CAC3F,MAAM,UAAkC,CAAC;CACzC,MAAM,UAAyB,CAAC;CAChC,KAAK,MAAM,OAAO,MAAM,UAAU;EACjC,IAAI,IAAI,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