@wildo-ai/platform-config-lib 1.1.4 → 1.1.5
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/dist/esm/bootstrap/application-backend-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap-planner.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.contracts.d.ts +23 -1
- package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.contracts.js +24 -0
- package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.d.ts +70 -1
- package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.js +55 -4
- package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +12 -0
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js +12 -0
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
- package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -1
- package/dist/esm/bootstrap/runtime-platform-access.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts +29 -0
- package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/wildo-owner-organization.contracts.js +39 -0
- package/dist/esm/bootstrap/wildo-owner-organization.contracts.js.map +1 -1
- package/dist/esm/config-authoring.entry.d.ts.map +1 -1
- package/dist/esm/config-authoring.entry.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lockfile/build-parallelism.d.ts +40 -0
- package/dist/esm/lockfile/build-parallelism.d.ts.map +1 -0
- package/dist/esm/lockfile/build-parallelism.js +64 -0
- package/dist/esm/lockfile/build-parallelism.js.map +1 -0
- package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
- package/dist/esm/lockfile/materialize-infra-section.d.ts +1 -1
- package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
- package/dist/esm/lockfile/materialize-infra-section.js +1 -1
- package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -1
- package/dist/esm/project-config/define-framework-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-infra-env-config.d.ts +899 -15
- package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-infra-env-config.js +397 -16
- package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
- package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-minion-config.js +1 -2
- package/dist/esm/project-config/define-minion-config.js.map +1 -1
- package/dist/esm/project-config/define-saas-config.d.ts +90 -25
- package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-saas-config.js +165 -12
- package/dist/esm/project-config/define-saas-config.js.map +1 -1
- package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
- package/dist/esm/project-config/hosted-infra-env-config.d.ts +59 -0
- package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -0
- package/dist/esm/project-config/hosted-infra-env-config.js +187 -0
- package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -0
- package/dist/esm/project-config/index.d.ts +3 -0
- package/dist/esm/project-config/index.d.ts.map +1 -1
- package/dist/esm/project-config/index.js +3 -0
- package/dist/esm/project-config/index.js.map +1 -1
- package/dist/esm/project-config/loader.d.ts +24 -0
- package/dist/esm/project-config/loader.d.ts.map +1 -1
- package/dist/esm/project-config/loader.js +114 -1
- package/dist/esm/project-config/loader.js.map +1 -1
- package/dist/esm/project-config/provider-catalog-types.d.ts.map +1 -1
- package/dist/esm/project-config/provider-companion-discovery.d.ts +32 -0
- package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
- package/dist/esm/project-config/provider-companion-discovery.js +82 -12
- package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts +71 -22
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.js +135 -13
- package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
- package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/application-modules.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/application-modules.utils.d.ts.map +1 -1
- package/dist/esm/project-config/shared/auth.schemas.d.ts +14 -35
- package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/auth.schemas.js +14 -35
- package/dist/esm/project-config/shared/auth.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/backing-services.schemas.d.ts +17 -12
- package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/backing-services.schemas.js +17 -12
- package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/cdn.example.d.ts.map +1 -1
- package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp-emit.js.map +1 -1
- package/dist/esm/project-config/shared/csp.schemas.d.ts +11 -12
- package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp.schemas.js +11 -12
- package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/env-example-defaults.d.ts.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.d.ts +152 -12
- package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.js +186 -9
- package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +5 -6
- package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infra-providers.schemas.js +0 -3
- package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/infra-service.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
- package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
- package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts.map +1 -1
- package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -1
- package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +77 -47
- package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
- package/dist/esm/project-config/shared/minion-resource-access.validation.js +114 -52
- package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
- package/dist/esm/project-config/shared/platform-services.schemas.d.ts +50 -0
- package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/platform-services.schemas.js +57 -0
- package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/platform-storage.schemas.d.ts +35 -0
- package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -0
- package/dist/esm/project-config/shared/platform-storage.schemas.js +37 -0
- package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -0
- package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts +81 -0
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -0
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.js +74 -0
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.js.map +1 -0
- package/dist/esm/registry/artifact-domain.schemas.d.ts +1 -1
- package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -1
- package/dist/esm/registry/companion-api.schemas.d.ts.map +1 -1
- package/dist/esm/registry/digest.schemas.d.ts.map +1 -1
- package/dist/esm/registry/index.d.ts.map +1 -1
- package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-manifest.schemas.d.ts +10 -16
- package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-manifest.schemas.js +14 -20
- package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
- package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -1
- package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
- package/dist/esm/release/framework-release.constants.d.ts.map +1 -1
- package/dist/esm/release/framework-release.constants.js.map +1 -1
- package/dist/esm/schemas/framework-info.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/framework-secrets.schemas.d.ts +12 -1
- package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/framework-secrets.schemas.js +14 -1
- package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
- package/dist/esm/schemas/platform-application-config.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/platform-application-secrets.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/platform-config.schemas.d.ts.map +1 -1
- package/dist/esm/workspace-scope/application-subject-manifest.d.ts.map +1 -1
- package/dist/esm/workspace-scope/index.d.ts.map +1 -1
- package/dist/esm/workspace-scope/resolve-homes.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts +4 -3
- package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-homes.schemas.js +6 -5
- package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts +15 -6
- package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope.schemas.js +23 -9
- package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-runtime-artifacts.js","sourceRoot":"","sources":["../../../src/project-config/provider-runtime-artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,mCAAmC,EACnC,iCAAiC,EACjC,4BAA4B,EAC5B,mCAAmC,GAGpC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,kCAAkC,GAGnC,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,+BAA+B,EAC/B,mCAAmC,GACpC,MAAM,oCAAoC,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IAAI,EAAE;gBACjF,SAAS,EAAE,CAAC,GAAG,YAAY,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE;gBAC3D,YAAY,EAAE,YAAY,CAAC,aAAa,CAAC,YAAY;aACtD;YACD,CAAC,CAAC,SAAS;QACb,cAAc,EAAE,YAAY,CAAC,cAAc;KAC5C,CAAC,CAAC,CAAC;AACR,CAAC","sourcesContent":["import { createHash } from 'node:crypto';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { resolve as resolvePath } from 'node:path';\nimport { z } from 'zod';\nimport {\n AppFrontendType,\n FRONTEND_PROVIDER_PUBLIC_CONFIG_KEY,\n FrontendProviderPublicConfigError,\n FrontendProvidersBlockSchema,\n overlayFrontendProviderPublicConfig,\n type FrontendProviderEntry,\n type FrontendProvidersBlock,\n} from '@wildo-ai/saas-models';\nimport {\n SaasLockfileProvidersSectionSchema,\n type SaasLockfileProvidersSection,\n type SaasLockfileRuntimeScopesProviders,\n} from '../lockfile/wildo-saas-lock.shared.schemas';\nimport {\n getDeclaredApplicationModuleIds,\n getServiceBoundApplicationModuleIds,\n} from './shared/application-modules.utils';\nimport type { ApplicationModules } from './shared/application-modules.schemas';\nimport {\n SaasProvidersScopesSchema,\n SaasProviderScopeSelectionSchema,\n type SaasProviderScopeSelection,\n type SaasProvidersScopes,\n type WildoSaasConfig,\n} from './define-saas-config';\nimport type { DiscoveredProviderCompanionContribution } from './provider-companion-discovery';\n\nexport const PROVIDER_RUNTIME_ARTIFACT_AUTOGENERATED_WARNING =\n 'AUTO-GENERATED FILE. DO NOT EDIT. Regenerate with `wildo config sync`.';\n\nexport const PROVIDER_RUNTIME_ARTIFACT_GENERATOR = 'wildo provider-runtime-artifact';\n\n/**\n * Canonical relative paths (from saas root) for the per-runtime-kind\n * provider artifact JSON files emitted by `wildo config sync`.\n *\n * Moved from `.wildo-saas/providers/` → `.wildo-saas/generated/providers/`\n * on 2026-05-06 to group ALL CLI-generated runtime topology artifacts\n * under the `.wildo-saas/generated/` namespace (sibling to other\n * generated state). The legacy `.wildo-saas/providers/` location is\n * cleaned up by `cleanupLegacyProviderJsonArtifacts` in the CLI sync\n * so operators don't end up with two copies after the migration.\n */\nexport const PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS = {\n backend: '.wildo-saas/generated/providers/backend.runtime-providers.generated.json',\n companion: '.wildo-saas/generated/providers/companion.runtime-providers.generated.json',\n frontendServices: '.wildo-saas/generated/providers/frontend-services.runtime-providers.generated.json',\n minions: '.wildo-saas/generated/providers/minions.runtime-providers.generated.json',\n nodeWorkers: '.wildo-saas/generated/providers/node-workers.runtime-providers.generated.json',\n} as const;\n\n/**\n * Legacy paths (pre-2026-05-06) for the per-runtime-kind provider\n * artifact JSON files. These are NOT written anymore — kept here so\n * `wildo config sync` can clean them up if they exist on disk from a\n * pre-migration sync. Drop this constant entirely once Wonder Todos\n * + downstream apps have all run a post-migration sync at least once.\n */\nexport const LEGACY_PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS = {\n backend: '.wildo-saas/providers/backend.runtime-providers.generated.json',\n companion: '.wildo-saas/providers/companion.runtime-providers.generated.json',\n frontendServices: '.wildo-saas/providers/frontend-services.runtime-providers.generated.json',\n minions: '.wildo-saas/providers/minions.runtime-providers.generated.json',\n nodeWorkers: '.wildo-saas/providers/node-workers.runtime-providers.generated.json',\n} as const;\n\nexport type ProviderRuntimeArtifactKind = keyof typeof PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS;\n\nexport const PROVIDER_RUNTIME_GENERATED_MODULE_RELATIVE_PATH =\n 'src/generated/wildo-provider-runtime.generated.ts';\n\n/**\n * Canonical lockfile section path the provider-materialization\n * subsystem owns end-to-end. Used by the post-mutation provider sync\n * runner + materialization-hook return types and pinned by tests\n * (`provider-sync-runner.test.ts`, `provider-materialization-hook.test.ts`).\n *\n * Defined here as a single-source constant — used to live as a\n * literal in 3+ places across `wildo-module-client` (third-pass\n * review C-L1).\n */\nexport const PROVIDER_LOCK_SECTION_PATH = 'sections.providers.runtimeScopes' as const;\n\n/**\n * Per-worker generated env file written by `wildo config sync`. Carries\n * provider topology env vars derived from the materialized scope.\n *\n * This file is the **single delivery channel** non-Node workers (Rust /\n * Java / etc.) receive for provider topology — there is no executable\n * JS bundle in their case (Step 5b in\n * `.claude/plans/provider-migration-continuation.md`). Node workers\n * receive both this file and the per-package\n * `wildo-provider-runtime.generated.ts` source module; reading either\n * surface yields a consistent view because they share the same digest.\n *\n * The file is auto-generated and overwritten on every sync. Operator-\n * authored secrets and per-env config stay in the worker's `.env` (not\n * touched by `wildo config sync`); workers should load both files at\n * boot — operator vars from `.env` and provider vars from this file —\n * so the two channels never collide.\n */\nexport const PROVIDER_RUNTIME_GENERATED_ENV_FILE_NAME = '.wildo-providers.env';\n\nconst RuntimeProviderScopeArtifactSchema = z.strictObject({\n providers: z.record(z.string(), SaasProviderScopeSelectionSchema).default({}),\n selection: z.record(\n z.string(),\n z.strictObject({\n primary: z.string().min(1),\n whenUnavailable: z.array(z.string().min(1)).default([]),\n }),\n ).default({}),\n});\n\nconst RuntimeProviderModulesArtifactSchema = z.strictObject({\n declaredModules: z.record(\n z.string(),\n z.strictObject({\n services: z.array(z.string().min(1)),\n haveSamlIntegration: z.boolean().optional(),\n }),\n ).default({}),\n moduleIds: z.array(z.string().min(1)).default([]),\n moduleIdsByService: z.record(z.string(), z.array(z.string().min(1))).default({}),\n});\nexport type RuntimeProviderModulesArtifact = z.infer<typeof RuntimeProviderModulesArtifactSchema>;\n\n/**\n * The per-service frontend bootstrap map, ANNOTATED through a nominal interface rather than inferred.\n *\n * `FrontendProvidersBlockSchema` transitively references three atoms that `@wildo-ai/saas-models`\n * publishes from `/public-runtime` alone, so a consumer that resolves this package's dependency to\n * SOURCE — the minion and worker libraries do, deliberately — has no public specifier through which\n * to NAME them. While the artifact object stayed small TypeScript inlined the shape and nobody\n * noticed; the moment it grew one member past the inline threshold it needed the name and refused:\n * `TS2742 … cannot be named without a reference to\n * node_modules/@wildo-ai/saas-models/src/external-providers/provider-frontend-surface.shared.schemas`.\n *\n * An INTERFACE is what stops the expansion — a type alias is written out structurally in the emitted\n * declaration and takes the unnameable atoms with it, while an interface is written by name. The\n * underlying defect is a root-exported contract depending on a subpath-only module\n * (`package-public-entrypoints.md`, \"The root barrel must not DEPEND on a subpath-only surface\");\n * that module is the frozen provider contract, so it is filed as #356 rather than fixed here. Runtime\n * behaviour and the inferred field type are unchanged.\n */\nexport interface RuntimeProviderFrontendBootstraps {\n [serviceKey: string]: FrontendProvidersBlock;\n}\n\nconst FrontendProviderBootstrapsSchema: z.ZodType<RuntimeProviderFrontendBootstraps> = z.record(\n z.string().min(1),\n FrontendProvidersBlockSchema,\n);\n\nexport const SaasRuntimeProvidersArtifactSchema = z.strictObject({\n __AUTOGENERATED__: z.literal(PROVIDER_RUNTIME_ARTIFACT_AUTOGENERATED_WARNING),\n generatedBy: z.literal(PROVIDER_RUNTIME_ARTIFACT_GENERATOR),\n generatedAt: z.string().datetime({ offset: true }),\n sourceDigest: z.string().min(1),\n providerRefs: z.array(z.string().min(1)).default([]),\n /**\n * `providerRef` -> the package specifier a host dynamic-imports to obtain that provider's backend\n * module (#330).\n *\n * `providerRefs` says WHICH providers a process may expose; this says WHERE each one comes from,\n * and it is what makes a provider shipped as its own npm package loadable at all. Derived from\n * the discovered contribution whose `runtimeTargets` match the host — never authored.\n *\n * Optional, so an artifact written before this field existed still parses. Every ref such an\n * artifact names is engine-shipped, and a host resolves those from the engine's own on-demand map\n * without consulting this record, so an un-resynced application is unaffected.\n */\n providerRuntimeImports: z.record(z.string().min(1), z.string().min(1)).optional(),\n providerGraphDigest: z.string().min(1),\n lockfileSectionDigest: z.string().min(1),\n artifactKind: z.enum([\n 'backend',\n 'companion',\n 'frontendServices',\n 'minions',\n 'nodeWorkers',\n ]),\n modules: RuntimeProviderModulesArtifactSchema,\n scope: RuntimeProviderScopeArtifactSchema.optional(),\n scopes: z.record(z.string(), RuntimeProviderScopeArtifactSchema).optional(),\n frontendProviderBootstraps: FrontendProviderBootstrapsSchema.optional(),\n});\nexport type SaasRuntimeProvidersArtifact = z.infer<typeof SaasRuntimeProvidersArtifactSchema>;\n\nexport interface MaterializedSaasProviderRuntimeArtifacts {\n artifacts: Partial<Record<ProviderRuntimeArtifactKind, SaasRuntimeProvidersArtifact>>;\n lockSection: SaasLockfileProvidersSection;\n}\n\nexport function materializeSaasProviderRuntimeArtifacts(\n // `providerConfigurations` is where an application supplies a frontend provider's public keys\n // (#394 P3). Optional here so the lockfile check and every existing caller that narrows the\n // config keep compiling; absent means \"the application configured nothing\", never a refusal.\n config: Pick<WildoSaasConfig, 'modules' | 'providers' | 'services'> & Partial<Pick<WildoSaasConfig, 'providerConfigurations'>>,\n options?: {\n generatedAt?: string;\n nodeWorkerKeys?: string[];\n discoveredContributions?: DiscoveredProviderCompanionContribution[];\n },\n): MaterializedSaasProviderRuntimeArtifacts {\n const scopes = SaasProvidersScopesSchema.parse(config.providers.scopes);\n const generatedAt = options?.generatedAt ?? new Date().toISOString();\n const modules = materializeModules(config);\n const frontendServiceTypes: Record<string, AppFrontendType> = Object.fromEntries(\n Object.entries(config.services ?? {})\n .filter(([, definition]) => definition.frontendType !== undefined)\n .map(([serviceKey, definition]) => [serviceKey, definition.frontendType as AppFrontendType]),\n );\n const discoveryContext = buildProviderRuntimeDiscoveryContext({\n discoveredContributions: options?.discoveredContributions,\n frontendServiceTypes,\n });\n\n const lockSection = SaasLockfileProvidersSectionSchema.parse({\n runtimeScopes: materializeLockRuntimeScopes({\n scopes,\n discoveryContext,\n }),\n });\n const artifactMetadata = buildArtifactMetadata({\n discoveryContext,\n frontendServiceTypes,\n lockSection,\n modules,\n nodeWorkerKeys: options?.nodeWorkerKeys,\n scopes,\n providerConfigurations: config.providerConfigurations ?? {},\n });\n\n const artifacts = materializeRuntimeArtifacts({\n artifactMetadata,\n discoveryContext,\n frontendServiceTypes,\n generatedAt,\n modules,\n nodeWorkerKeys: options?.nodeWorkerKeys,\n scopes,\n providerConfigurations: config.providerConfigurations ?? {},\n });\n\n return { artifacts, lockSection };\n}\n\nexport function selectScopedProviderRuntimeArtifact(\n artifact: SaasRuntimeProvidersArtifact,\n scopeKey: string,\n): SaasRuntimeProvidersArtifact {\n if (!artifact.scopes) {\n throw new Error(`Provider runtime artifact '${artifact.artifactKind}' does not contain keyed scopes.`);\n }\n\n const scope = artifact.scopes[scopeKey];\n if (!scope) {\n throw new Error(`Provider runtime artifact '${artifact.artifactKind}' does not contain scope '${scopeKey}'.`);\n }\n\n // Recompute `providerRefs` from the projected per-host scope rather\n // than carrying the parent multi-scope union forward unchanged. The\n // multi-scope artifact's `providerRefs` is the union across all\n // hosts (`buildMultiScopeArtifactMetadata`); preserving that union\n // on a single-scope projection makes the per-host artifact internally\n // inconsistent — `scope.providers` would describe one host while\n // `providerRefs` would describe siblings too. The boot-time\n // `assertProviderRuntimeEnvInSync` guard treats `providerRefs.length > 0`\n // as \"this host has providers to reconcile\" — without this\n // recomputation, an empty-scope host would inherit the union and\n // trip the env-missing guard even though its `.wildo-providers.env`\n // was deliberately not written. Recomputation also tightens\n // `BackendProviderRegistry`'s filter (today defended by an empty-list\n // fallback) so the per-host artifact accurately advertises only the\n // refs it should resolve.\n const projectedProviderRefs = Object.keys(scope.providers).sort();\n\n return SaasRuntimeProvidersArtifactSchema.parse({\n ...artifact,\n providerRefs: projectedProviderRefs,\n // Narrowed for the same reason `providerRefs` is recomputed above: the multi-scope artifact's\n // import map is the union across every host, and a per-host projection that advertised a\n // sibling's packages would tell this host it can load something it never declared.\n providerRuntimeImports: Object.fromEntries(\n Object.entries(artifact.providerRuntimeImports ?? {})\n .filter(([providerRef]) => projectedProviderRefs.includes(providerRef)),\n ),\n frontendProviderBootstraps: artifact.frontendProviderBootstraps?.[scopeKey]\n ? { [scopeKey]: artifact.frontendProviderBootstraps[scopeKey] }\n : undefined,\n scope,\n scopes: undefined,\n });\n}\n\n/**\n * Resolve the absolute path to the canonical\n * `frontend-services.runtime-providers.generated.json` artifact under\n * `<saasRoot>/.wildo-saas/generated/providers/`.\n *\n * Build-time consumers (Wonder Todos website + tech-doc) call this\n * instead of hardcoding the relative path so the artifact location\n * stays canonical (single source of truth is\n * `PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS`).\n */\nexport function resolveFrontendServicesArtifactPath(saasRoot: string): string {\n return resolvePath(saasRoot, PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS.frontendServices);\n}\n\n/**\n * Read + project the materialized frontend-services artifact for the\n * given service key. Returns `undefined` if the artifact file is\n * missing (sync hasn't run yet / clean checkout) or if the service\n * has no provider bootstrap entry.\n *\n * The single source of truth for build-time loading of the frontend\n * provider bootstraps. Replaces the (previously duplicated)\n * `loadMaterializedFrontendProviders` helpers that lived in\n * `saas-technical-doc/src/build/load-materialized-frontend-providers.ts`\n * and inline in `examples/wonder-todos/website/src/website-site-context.ts`.\n *\n * Both consumers used identical control flow:\n * 1. existsSync() short-circuit\n * 2. JSON.parse + SaasRuntimeProvidersArtifactSchema.parse\n * 3. frontendProviderBootstraps[serviceKey] lookup\n * 4. FrontendProvidersBlockSchema.parse on the per-service block\n * Centralized 2026-05-06 so a future schema/path change only\n * requires editing this function.\n */\nexport function loadMaterializedFrontendProviders(input: {\n artifactPath: string;\n serviceKey: string;\n}): FrontendProvidersBlock | undefined {\n const { artifactPath, serviceKey } = input;\n\n if (!existsSync(artifactPath)) {\n return undefined;\n }\n\n const parsedArtifact = SaasRuntimeProvidersArtifactSchema.safeParse(\n JSON.parse(readFileSync(artifactPath, 'utf8')),\n );\n if (!parsedArtifact.success) {\n throw staleGeneratedArtifactError(artifactPath, parsedArtifact.error.issues);\n }\n const providerBlock = parsedArtifact.data.frontendProviderBootstraps?.[serviceKey];\n if (providerBlock === undefined) return undefined;\n\n const parsedBlock = FrontendProvidersBlockSchema.safeParse(providerBlock);\n if (!parsedBlock.success) {\n throw staleGeneratedArtifactError(artifactPath, parsedBlock.error.issues);\n }\n return parsedBlock.data;\n}\n\n/**\n * A materialized artifact that does not satisfy the current schema was almost always generated\n * before the contract changed (#328 added the provider identity to every frontend entry). A raw\n * Zod issue list reads as a logic defect in the consumer; the remedy is regeneration, so the\n * error names it. The backend's `applyProviderRuntime` says the same thing for its own reader —\n * one message, two readers.\n */\nfunction staleGeneratedArtifactError(artifactPath: string, issues: ReadonlyArray<{ path: PropertyKey[]; message: string }>): Error {\n return new Error(\n `The generated provider runtime artifact at ${artifactPath} does not satisfy the current contract — it was most `\n + 'likely generated before the contract changed. Regenerate it with `wildo config sync`. Issues: '\n + issues.map((issue) => `${issue.path.map(String).join('.')}: ${issue.message}`).join('; '),\n );\n}\n\nexport function renderProviderRuntimeGeneratedModule(\n artifact: SaasRuntimeProvidersArtifact,\n): string {\n const artifactLiteral = JSON.stringify(artifact, null, 2);\n\n return [\n '/**',\n ` * ${PROVIDER_RUNTIME_ARTIFACT_AUTOGENERATED_WARNING}`,\n ' *',\n ' * This module is generated from wildo.saas.config.ts by `wildo config sync`.',\n ' * It contains environment-independent provider topology only.',\n ' */',\n '',\n // Intentionally NOT `as const` — the generated artifact is *data*, not a\n // frozen literal-typed tuple. Each host (backend / companion / minion /\n // worker) casts the imported value to its own narrowed runtime-artifact\n // type (`ProviderRuntimeArtifact`, `MinionProviderRuntimeArtifact`, …).\n // `as const` would infer `readonly` tuples (e.g. `readonly [\"openai\"]`)\n // that fail TS2352 against the schema-inferred mutable `string[]` shape.\n // Contract conformance is enforced upstream by\n // `SaasRuntimeProvidersArtifactSchema.parse(...)` at materialization time,\n // so widening the TS surface here costs no runtime safety.\n `export const WILDO_PROVIDER_RUNTIME = ${artifactLiteral};`,\n '',\n 'export default WILDO_PROVIDER_RUNTIME;',\n '',\n ].join('\\n');\n}\n\n/**\n * Canonical worker provider env-var keys. All workers receive the same\n * three keys regardless of language; the values are stable across runs\n * as long as the authored scope and discovered contributions don't\n * change.\n *\n * - `WILDO_PROVIDER_REFS` — comma-separated list of authored refs (sorted).\n * Cheap to read from any language (no JSON parser needed).\n * - `WILDO_PROVIDER_TOPOLOGY_JSON` — the per-worker `scope` block from\n * the materialized artifact, JSON-encoded. Workers that want\n * structured access (capability/protocol set) parse this; workers\n * that only need ref membership read `WILDO_PROVIDER_REFS`.\n * - `WILDO_PROVIDER_RUNTIME_DIGEST` — the artifact's `sourceDigest`.\n * Workers can fail-closed at boot if their copy of the env-file\n * disagrees with the lockfile section digest the platform expects.\n */\nexport const PROVIDER_RUNTIME_ENV_KEYS = {\n REFS: 'WILDO_PROVIDER_REFS',\n TOPOLOGY_JSON: 'WILDO_PROVIDER_TOPOLOGY_JSON',\n RUNTIME_DIGEST: 'WILDO_PROVIDER_RUNTIME_DIGEST',\n} as const;\n\n/**\n * Render the per-worker provider env-file body. Inputs:\n * - `scope` — the per-worker scope block from\n * `WildoSaasConfig.providers.scopes.workers[<workerKey>]`. Carries\n * the authored providers + capability/protocol declarations that\n * this worker needs to resolve at runtime.\n * - `sourceDigest` — `SaasRuntimeProvidersArtifact.sourceDigest`\n * (from the lockfile or the corresponding generated artifact).\n *\n * Output: a deterministic dotenv body — sorted refs, stable JSON\n * key ordering — so re-running `wildo config sync` with no upstream\n * changes produces a byte-identical file.\n */\nexport function renderProviderRuntimeEnvFile(input: {\n scope: SaasProviderScopeSelections;\n sourceDigest: string;\n}): string {\n const refs = Object.keys(input.scope.providers).sort();\n const topology: Record<string, {\n engineCapabilities: string[];\n providerCapabilities: string[];\n protocols: string[];\n }> = {};\n for (const ref of refs) {\n const selection = input.scope.providers[ref];\n topology[ref] = {\n engineCapabilities: [...selection.engineCapabilities].sort(),\n providerCapabilities: [...selection.providerCapabilities].sort(),\n protocols: [...selection.protocols].sort(),\n };\n }\n\n return [\n `# ${PROVIDER_RUNTIME_ARTIFACT_AUTOGENERATED_WARNING}`,\n '#',\n '# This file is regenerated on every `wildo config sync`. Do not edit by hand.',\n '# Operator-authored secrets / per-env config stay in `.env` and are never touched here.',\n '',\n `${PROVIDER_RUNTIME_ENV_KEYS.REFS}=${refs.join(',')}`,\n `${PROVIDER_RUNTIME_ENV_KEYS.TOPOLOGY_JSON}=${JSON.stringify(topology)}`,\n `${PROVIDER_RUNTIME_ENV_KEYS.RUNTIME_DIGEST}=${input.sourceDigest}`,\n '',\n ].join('\\n');\n}\n\n/**\n * Result of comparing the runtime host's typed\n * `wildo-provider-runtime.generated.ts` module against its\n * `.wildo-providers.env` file at boot.\n *\n * Drift between the two indicates the operator regenerated one surface\n * but not the other — typically: edited `wildo.saas.config.ts` and\n * re-ran `wildo config sync` while the env file was cached, or vice\n * versa. Either case the runtime would silently boot with mismatched\n * topology unless someone reconciles. See\n * `assertProviderRuntimeEnvInSync` for the fail-closed assertion.\n */\nexport type ProviderRuntimeEnvReconciliationResult =\n | { kind: 'in-sync' }\n | { kind: 'env-missing'; missingKeys: ReadonlyArray<string> }\n | {\n kind: 'refs-mismatch';\n envRefs: ReadonlyArray<string>;\n artifactRefs: ReadonlyArray<string>;\n }\n | {\n kind: 'digest-mismatch';\n envDigest: string;\n artifactDigest: string;\n };\n\n/**\n * Reconcile a runtime artifact's typed projection against the\n * `.wildo-providers.env` mounted into the same process. Pure function\n * so callers can decide how to surface the result (throw / log / ignore).\n *\n * The env file is materialized by `renderProviderRuntimeEnvFile` for\n * EVERY runtime host that is a minion or worker; the typed module is\n * imported by the same hosts. Both should agree on\n * `(providerRefs, sourceDigest)` exactly. Drift means stale sync.\n *\n * Hosts that don't receive an env file (backend, companion, frontend\n * services per `provider-runtime-sync.service.ts`) MUST NOT call this —\n * `WILDO_PROVIDER_*` keys won't be set and every call returns\n * `env-missing`.\n */\nexport function reconcileProviderRuntimeEnv(input: {\n artifactProviderRefs: ReadonlyArray<string>;\n artifactSourceDigest: string;\n env?: NodeJS.ProcessEnv;\n}): ProviderRuntimeEnvReconciliationResult {\n const env = input.env ?? process.env;\n const envRefsRaw = env[PROVIDER_RUNTIME_ENV_KEYS.REFS];\n const envDigest = env[PROVIDER_RUNTIME_ENV_KEYS.RUNTIME_DIGEST];\n\n const missingKeys: string[] = [];\n if (envRefsRaw === undefined) missingKeys.push(PROVIDER_RUNTIME_ENV_KEYS.REFS);\n if (envDigest === undefined) missingKeys.push(PROVIDER_RUNTIME_ENV_KEYS.RUNTIME_DIGEST);\n if (missingKeys.length > 0) {\n return { kind: 'env-missing', missingKeys };\n }\n\n // Filter empty entries so trailing-comma input (e.g. `'openai,'`) or\n // operator-edited stray whitespace don't produce confusing `''`\n // entries in mismatch diagnostics. Materializer never emits trailing\n // commas, but defense-in-depth keeps the helper robust to anything\n // that lands the env file via dotenv loaders or hand-edits.\n const envRefs = envRefsRaw!\n .split(',')\n .map((s) => s.trim())\n .filter((s) => s.length > 0)\n .sort();\n const artifactRefs = [...input.artifactProviderRefs].sort();\n\n if (envRefs.length !== artifactRefs.length || envRefs.some((ref, i) => ref !== artifactRefs[i])) {\n return { kind: 'refs-mismatch', envRefs, artifactRefs };\n }\n\n if (envDigest !== input.artifactSourceDigest) {\n return {\n kind: 'digest-mismatch',\n envDigest: envDigest!,\n artifactDigest: input.artifactSourceDigest,\n };\n }\n\n return { kind: 'in-sync' };\n}\n\n/**\n * Fail-closed wrapper around `reconcileProviderRuntimeEnv`. Throws on\n * any divergence, returns silently when in sync. Designed to be called\n * once at runtime-host boot (minion / Node-worker startup) so a stale\n * `.wildo-providers.env` surfaces immediately instead of being masked\n * by `process.env` drift.\n *\n * Throws a plain `Error` (not `WildoError_Backend`) because this runs\n * BEFORE the DI container has built the error builder — the failure\n * mode here is \"the container can't be trusted to boot at all\".\n */\nexport function assertProviderRuntimeEnvInSync(input: {\n artifactProviderRefs: ReadonlyArray<string>;\n artifactSourceDigest: string;\n hostKind: 'minion' | 'node-worker';\n hostKey: string;\n env?: NodeJS.ProcessEnv;\n}): void {\n const result = reconcileProviderRuntimeEnv(input);\n switch (result.kind) {\n case 'in-sync':\n return;\n case 'env-missing':\n throw new Error(\n `[provider-runtime-env] ${input.hostKind} '${input.hostKey}' booted without `\n + `provider env vars (${result.missingKeys.join(', ')}). The `\n + `\\`.wildo-providers.env\\` file should be mounted into this process — check `\n + `the docker-compose \\`env_file:\\` directive, the K8s ConfigMap mount, or the `\n + `dotenv loader. Re-run \\`wildo config sync\\` to regenerate if missing.`,\n );\n case 'refs-mismatch':\n throw new Error(\n `[provider-runtime-env] ${input.hostKind} '${input.hostKey}' detected stale provider topology. `\n + `\\`.wildo-providers.env\\` advertises refs [${result.envRefs.join(', ')}] but the `\n + `imported \\`wildo-provider-runtime.generated.ts\\` module declares `\n + `[${result.artifactRefs.join(', ')}]. Run \\`wildo config sync\\` to regenerate `\n + `both surfaces from the same \\`wildo.saas.config.ts\\` source.`,\n );\n case 'digest-mismatch':\n throw new Error(\n `[provider-runtime-env] ${input.hostKind} '${input.hostKey}' detected provider runtime digest drift. `\n + `\\`.wildo-providers.env\\` carries digest '${result.envDigest}' but the imported `\n + `\\`wildo-provider-runtime.generated.ts\\` module carries '${result.artifactDigest}'. `\n + `Refs match, but per-provider capabilities/protocols may differ. `\n + `Run \\`wildo config sync\\` to regenerate.`,\n );\n }\n}\n\ntype SaasProviderScopeSelections = {\n providers: Record<string, {\n engineCapabilities: ReadonlyArray<string>;\n providerCapabilities: ReadonlyArray<string>;\n protocols: ReadonlyArray<string>;\n }>;\n};\n\nfunction materializeRuntimeArtifacts(input: {\n artifactMetadata: ProviderRuntimeArtifactMetadataByKind;\n discoveryContext: ProviderRuntimeDiscoveryContext;\n frontendServiceTypes: Record<string, AppFrontendType>;\n generatedAt: string;\n modules: RuntimeProviderModulesArtifact;\n nodeWorkerKeys?: string[];\n scopes: SaasProvidersScopes;\n providerConfigurations: Readonly<Record<string, Readonly<Record<string, unknown>> | undefined>>;\n}): MaterializedSaasProviderRuntimeArtifacts['artifacts'] {\n const { artifactMetadata, discoveryContext, frontendServiceTypes, generatedAt, modules, nodeWorkerKeys, scopes, providerConfigurations } = input;\n const nodeWorkerKeySet = nodeWorkerKeys ? new Set(nodeWorkerKeys) : undefined;\n const nodeWorkerScopes = scopes.workers\n ? Object.fromEntries(\n Object.entries(scopes.workers).filter(([workerKey]) =>\n nodeWorkerKeySet ? nodeWorkerKeySet.has(workerKey) : true,\n ),\n )\n : undefined;\n\n return pruneUndefined({\n backend: materializeRuntimeArtifactFile({\n artifactKind: 'backend',\n generatedAt,\n modules,\n metadata: artifactMetadata.backend,\n frontendProviderBootstraps: materializeFrontendProviderBootstraps({\n discoveredContributions: discoveryContext.contributions,\n frontendServiceScopes: scopes.frontendServices ?? {},\n frontendServiceTypes,\n providerConfigurations,\n }),\n scope: materializeRuntimeScope(scopes.backend ?? { providers: {}, selection: {} }),\n }),\n companion: materializeRuntimeArtifactFile({\n artifactKind: 'companion',\n generatedAt,\n modules,\n metadata: artifactMetadata.companion,\n scope: materializeRuntimeScope(scopes.companion ?? { providers: {}, selection: {} }),\n }),\n frontendServices: scopes.frontendServices\n ? materializeRuntimeArtifactFile({\n artifactKind: 'frontendServices',\n generatedAt,\n modules,\n metadata: artifactMetadata.frontendServices,\n frontendProviderBootstraps: materializeFrontendProviderBootstraps({\n discoveredContributions: discoveryContext.contributions,\n frontendServiceScopes: scopes.frontendServices,\n frontendServiceTypes,\n providerConfigurations,\n }),\n scopes: mapRecord(scopes.frontendServices, materializeRuntimeScope),\n })\n : undefined,\n minions: scopes.minions\n ? materializeRuntimeArtifactFile({\n artifactKind: 'minions',\n generatedAt,\n modules,\n metadata: artifactMetadata.minions,\n scopes: mapRecord(scopes.minions, materializeRuntimeScope),\n })\n : undefined,\n nodeWorkers: nodeWorkerScopes && Object.keys(nodeWorkerScopes).length > 0\n ? materializeRuntimeArtifactFile({\n artifactKind: 'nodeWorkers',\n generatedAt,\n modules,\n metadata: artifactMetadata.nodeWorkers,\n scopes: mapRecord(nodeWorkerScopes, materializeRuntimeScope),\n })\n : undefined,\n });\n}\n\nfunction materializeRuntimeArtifactFile(input: {\n artifactKind: ProviderRuntimeArtifactKind;\n generatedAt: string;\n metadata: ProviderRuntimeArtifactMetadata;\n modules: RuntimeProviderModulesArtifact;\n frontendProviderBootstraps?: Record<string, FrontendProvidersBlock>;\n scope?: z.infer<typeof RuntimeProviderScopeArtifactSchema>;\n scopes?: Record<string, z.infer<typeof RuntimeProviderScopeArtifactSchema>>;\n}): SaasRuntimeProvidersArtifact {\n return SaasRuntimeProvidersArtifactSchema.parse({\n __AUTOGENERATED__: PROVIDER_RUNTIME_ARTIFACT_AUTOGENERATED_WARNING,\n generatedBy: PROVIDER_RUNTIME_ARTIFACT_GENERATOR,\n generatedAt: input.generatedAt,\n sourceDigest: input.metadata.sourceDigest,\n providerRefs: input.metadata.providerRefs,\n providerRuntimeImports: input.metadata.providerRuntimeImports,\n providerGraphDigest: input.metadata.providerGraphDigest,\n lockfileSectionDigest: input.metadata.lockfileSectionDigest,\n artifactKind: input.artifactKind,\n modules: input.modules,\n scope: input.scope,\n scopes: input.scopes,\n frontendProviderBootstraps: input.frontendProviderBootstraps,\n });\n}\n\nfunction materializeRuntimeScope(scope: NonNullable<SaasProvidersScopes['backend']>) {\n return RuntimeProviderScopeArtifactSchema.parse({\n providers: scope.providers,\n selection: scope.selection ?? {},\n });\n}\n\nfunction materializeFrontendProviderBootstraps(input: {\n discoveredContributions: DiscoveredProviderCompanionContribution[];\n frontendServiceScopes: NonNullable<SaasProvidersScopes['frontendServices']>;\n frontendServiceTypes: Record<string, AppFrontendType>;\n providerConfigurations: Readonly<Record<string, Readonly<Record<string, unknown>> | undefined>>;\n}): Record<string, FrontendProvidersBlock> | undefined {\n const { discoveredContributions, frontendServiceScopes, frontendServiceTypes, providerConfigurations } = input;\n const entries = Object.entries(frontendServiceScopes).map(([serviceKey, scope]) => {\n const serviceType = frontendServiceTypes[serviceKey];\n if (!serviceType) {\n throw new Error(\n `Cannot materialize frontend bootstrap for service \"${serviceKey}\": ` +\n `service has no frontendType — only services with a frontendType may appear under providers.scopes.frontendServices.`,\n );\n }\n const providers = Object.fromEntries(Object.keys(scope.providers).map((providerRef) => {\n const matchingContribution = discoveredContributions.filter(\n (contribution) =>\n contribution.ref === providerRef\n && contribution.runtimeTargets.some(\n (target) => target.kind === 'frontendService' && target.serviceType === serviceType,\n ),\n );\n\n if (matchingContribution.length === 0) {\n throw new Error(\n `Cannot materialize frontend bootstrap for service \"${serviceKey}\" (type \"${serviceType}\"): ` +\n `provider \"${providerRef}\" has no discovered frontend companion contribution.`,\n );\n }\n\n if (matchingContribution.some((contribution) => !contribution.frontendEntry)) {\n throw new Error(\n `Cannot materialize frontend bootstrap for service \"${serviceKey}\": ` +\n `provider \"${providerRef}\" is missing frontendEntry on at least one discovered contribution.`,\n );\n }\n\n if (matchingContribution.length > 1) {\n throw new Error(\n `Cannot materialize frontend bootstrap for service \"${serviceKey}\": ` +\n `provider \"${providerRef}\" is contributed more than once for the same runtime.`,\n );\n }\n\n return [\n providerRef,\n applyApplicationPublicConfig({\n serviceKey,\n providerRef,\n entry: matchingContribution[0].frontendEntry as FrontendProviderEntry,\n supplied: providerConfigurations[providerRef]?.[FRONTEND_PROVIDER_PUBLIC_CONFIG_KEY],\n discoveredContributions,\n }),\n ] as const;\n }));\n\n return [serviceKey, FrontendProvidersBlockSchema.parse({ providers })] as const;\n });\n\n return entries.length > 0 ? Object.fromEntries(entries) : undefined;\n}\n\n/**\n * Overlays what the application supplied under `providerConfigurations[ref].frontend_sdk` onto the\n * module's authored `publicConfig` (#394 P3) — the FIRST of the two sites that produce a\n * `FrontendProviderEntry` from a module; the backend fallback is the other, and both call the one\n * function in `saas-models` so they cannot disagree about what crosses.\n *\n * The forbidden set is built from the SAME vendor's non-frontend contributions: a frontend provider\n * owns no secrets (`secretsContractShape: []` by construction), so the only secrets that could be\n * typed into its bag are the backend module's, and those are exactly what this walk has in hand.\n */\nfunction applyApplicationPublicConfig(input: {\n serviceKey: string;\n providerRef: string;\n entry: FrontendProviderEntry;\n supplied: unknown;\n discoveredContributions: DiscoveredProviderCompanionContribution[];\n}): FrontendProviderEntry {\n const { serviceKey, providerRef, entry, supplied, discoveredContributions } = input;\n if (supplied === undefined) return entry;\n\n const forbiddenKeys = new Set(\n discoveredContributions\n .filter((contribution) =>\n contribution.ref === providerRef\n && contribution.runtimeTargets.some((target) => target.kind !== 'frontendService'))\n .flatMap((contribution) => contribution.secretsContractShape.flatMap((slot) => [slot.slug, slot.envVarName])),\n );\n\n try {\n const publicConfig = overlayFrontendProviderPublicConfig({\n providerRef,\n authored: entry.publicConfig,\n supplied,\n declaredKeys: entry.publicConfigKeys,\n forbiddenKeys,\n });\n return publicConfig === undefined ? entry : { ...entry, publicConfig };\n } catch (error) {\n if (error instanceof FrontendProviderPublicConfigError) {\n throw new Error(\n `Cannot materialize frontend bootstrap for service \"${serviceKey}\": ${error.message}`,\n );\n }\n throw error;\n }\n}\n\nfunction buildFrontendProviderBootstrapDigestInput(input: {\n discoveredContributions: DiscoveredProviderCompanionContribution[];\n frontendServiceScopes: NonNullable<SaasProvidersScopes['frontendServices']>;\n frontendServiceTypes: Record<string, AppFrontendType>;\n // In the digest on purpose: an application changing a picker's `appId` changes the served\n // artifact, and a digest that did not move would report the old artifact as current.\n providerConfigurations: Readonly<Record<string, Readonly<Record<string, unknown>> | undefined>>;\n}): Record<string, unknown> | undefined {\n const bootstraps = materializeFrontendProviderBootstraps(input);\n if (!bootstraps) {\n return undefined;\n }\n\n return Object.fromEntries(\n Object.entries(bootstraps).map(([serviceKey, block]) => [\n serviceKey,\n Object.fromEntries(\n Object.entries(block.providers).map(([providerRef, providerEntry]) => [\n providerRef,\n {\n metadata: providerEntry.metadata,\n providerCapabilities: [...providerEntry.providerCapabilities].sort(),\n protocols: [...providerEntry.protocols].sort(),\n publicConfig: providerEntry.publicConfig,\n },\n ]),\n ),\n ]),\n );\n}\n\nfunction materializeModules(\n config: Pick<WildoSaasConfig, 'modules' | 'services'>,\n): RuntimeProviderModulesArtifact {\n const modules = (config.modules ?? {}) as NonNullable<ApplicationModules>;\n return RuntimeProviderModulesArtifactSchema.parse({\n declaredModules: modules,\n moduleIds: getDeclaredApplicationModuleIds(modules),\n moduleIdsByService: Object.fromEntries(\n Object.keys(config.services ?? {}).map((serviceKey) => [\n serviceKey,\n getServiceBoundApplicationModuleIds(modules, serviceKey),\n ]),\n ),\n });\n}\n\nfunction materializeLockRuntimeScopes(input: {\n scopes: SaasProvidersScopes;\n discoveryContext: ProviderRuntimeDiscoveryContext;\n}): SaasLockfileRuntimeScopesProviders {\n const { scopes, discoveryContext } = input;\n return pruneUndefined({\n backend: scopes.backend\n ? materializeLockScope(\n scopes.backend.providers,\n discoveryContext.contributions,\n discoveryContext.backend.matchesRuntimeTarget,\n )\n : undefined,\n companion: scopes.companion\n ? materializeLockScope(\n scopes.companion.providers,\n discoveryContext.contributions,\n discoveryContext.companion.matchesRuntimeTarget,\n )\n : undefined,\n frontendServices: scopes.frontendServices\n ? mapRecord(\n scopes.frontendServices,\n (scope, serviceKey) => materializeLockScope(\n scope.providers,\n discoveryContext.contributions,\n discoveryContext.frontendServices.matchesRuntimeTarget(serviceKey),\n ),\n )\n : undefined,\n minions: scopes.minions\n ? mapRecord(\n scopes.minions,\n (scope, minionKey) => materializeLockScope(\n scope.providers,\n discoveryContext.contributions,\n discoveryContext.minions.matchesRuntimeTarget(minionKey),\n ),\n )\n : undefined,\n workers: scopes.workers\n ? mapRecord(\n scopes.workers,\n (scope, workerKey) => materializeLockScope(\n scope.providers,\n discoveryContext.contributions,\n discoveryContext.workers.matchesRuntimeTarget(workerKey),\n ),\n )\n : undefined,\n });\n}\n\nfunction materializeLockScope(\n providers: Record<string, SaasProviderScopeSelection>,\n discoveredContributions: DiscoveredProviderCompanionContribution[],\n matchesRuntimeTarget: (target: DiscoveredProviderCompanionContribution['runtimeTargets'][number]) => boolean,\n): SaasLockfileRuntimeScopesProviders['backend'] {\n return mapRecord(providers, (selection, ref) => {\n const matchingContributions = findMatchingDiscoveredContributions({\n discoveredContributions,\n matchesRuntimeTarget,\n providerRef: ref,\n });\n const secretsContractShape = resolveProviderSecretsContractShape(ref, matchingContributions);\n\n return {\n ref,\n digest: digestJson({\n selection,\n providerGraph: normalizeDiscoveredContributionsForDigest(matchingContributions),\n }),\n engineCapabilities: selection.engineCapabilities,\n providerCapabilities: selection.providerCapabilities,\n protocols: selection.protocols,\n // assurance-control: WILDO.SECRETS.CONTRACT_INTEGRITY — lock drift\n // covers the values-free provider contract without persisting secret values.\n secretsContractDigest: digestJson({ ref, secretsContractShape }),\n };\n });\n}\n\n/**\n * Resolves one authoritative values-free secret contract for a provider in a\n * concrete runtime scope.\n *\n * Multiple runtime owners may legitimately contribute the same provider, but\n * they must agree on its secret requirements. Missing discovery and divergent\n * shapes fail closed: hashing either state as an empty contract would make the\n * lockfile claim integrity evidence it does not possess.\n */\nfunction resolveProviderSecretsContractShape(\n providerRef: string,\n matchingContributions: DiscoveredProviderCompanionContribution[],\n): DiscoveredProviderCompanionContribution['secretsContractShape'] {\n if (matchingContributions.length === 0) {\n throw new Error(\n `Cannot materialize provider lock entry for \"${providerRef}\": no discovered contribution supplies its secret-contract shape for this runtime.`,\n );\n }\n\n const canonicalShape = matchingContributions[0].secretsContractShape;\n const canonicalDigestInput = stableStringify(canonicalShape);\n for (const contribution of matchingContributions.slice(1)) {\n if (stableStringify(contribution.secretsContractShape) !== canonicalDigestInput) {\n throw new Error(\n `Cannot materialize provider lock entry for \"${providerRef}\": discovered runtime owners disagree on its secret-contract shape.`,\n );\n }\n }\n\n return canonicalShape;\n}\n\nfunction digestJson(value: unknown): string {\n return `sha256:${createHash('sha256').update(stableStringify(value)).digest('hex')}`;\n}\n\nfunction stableStringify(value: unknown): string {\n if (Array.isArray(value)) {\n return `[${value.map(stableStringify).join(',')}]`;\n }\n if (value && typeof value === 'object') {\n const record = value as Record<string, unknown>;\n return `{${Object.keys(record)\n .sort()\n .map((key) => `${JSON.stringify(key)}:${stableStringify(record[key])}`)\n .join(',')}}`;\n }\n return JSON.stringify(value);\n}\n\nfunction mapRecord<TValue, TResult>(\n record: Record<string, TValue>,\n mapper: (value: TValue, key: string) => TResult,\n): Record<string, TResult> {\n return Object.fromEntries(\n Object.entries(record).map(([key, value]) => [key, mapper(value, key)]),\n );\n}\n\nfunction pruneUndefined<T extends Record<string, unknown>>(record: T): T {\n return Object.fromEntries(\n Object.entries(record).filter(([, value]) => value !== undefined),\n ) as T;\n}\n\ninterface ProviderRuntimeArtifactMetadata {\n sourceDigest: string;\n providerRefs: string[];\n providerRuntimeImports: Record<string, string>;\n providerGraphDigest: string;\n lockfileSectionDigest: string;\n}\n\ninterface ProviderRuntimeArtifactMetadataByKind {\n backend: ProviderRuntimeArtifactMetadata;\n companion: ProviderRuntimeArtifactMetadata;\n frontendServices: ProviderRuntimeArtifactMetadata;\n minions: ProviderRuntimeArtifactMetadata;\n nodeWorkers: ProviderRuntimeArtifactMetadata;\n}\n\ninterface RuntimeContributionMatcherFactory {\n matchesRuntimeTarget: (target: DiscoveredProviderCompanionContribution['runtimeTargets'][number]) => boolean;\n}\n\ninterface ScopedRuntimeContributionMatcherFactory {\n matchesRuntimeTarget: (\n scopeKey: string,\n ) => (target: DiscoveredProviderCompanionContribution['runtimeTargets'][number]) => boolean;\n}\n\ninterface ProviderRuntimeDiscoveryContext {\n contributions: DiscoveredProviderCompanionContribution[];\n backend: RuntimeContributionMatcherFactory;\n companion: RuntimeContributionMatcherFactory;\n frontendServices: ScopedRuntimeContributionMatcherFactory;\n minions: ScopedRuntimeContributionMatcherFactory;\n workers: ScopedRuntimeContributionMatcherFactory;\n}\n\nfunction buildProviderRuntimeDiscoveryContext(input: {\n discoveredContributions?: DiscoveredProviderCompanionContribution[];\n frontendServiceTypes: Record<string, AppFrontendType>;\n}): ProviderRuntimeDiscoveryContext {\n const contributions = input.discoveredContributions ?? [];\n const { frontendServiceTypes } = input;\n\n return {\n contributions,\n backend: {\n matchesRuntimeTarget: (target) => target.kind === 'backend',\n },\n companion: {\n matchesRuntimeTarget: (target) => target.kind === 'companion',\n },\n frontendServices: {\n matchesRuntimeTarget: (serviceKey) => {\n const serviceType = frontendServiceTypes[serviceKey];\n // Service has no frontendType ⇒ no contribution can match it.\n if (!serviceType) return () => false;\n return (target) => target.kind === 'frontendService' && target.serviceType === serviceType;\n },\n },\n minions: {\n matchesRuntimeTarget: (minionKey) => (target) => target.kind === 'minion' && target.minionKey === minionKey,\n },\n workers: {\n matchesRuntimeTarget: (workerKey) => (target) => target.kind === 'worker' && target.workerKey === workerKey,\n },\n };\n}\n\nfunction buildArtifactMetadata(input: {\n discoveryContext: ProviderRuntimeDiscoveryContext;\n frontendServiceTypes: Record<string, AppFrontendType>;\n lockSection: SaasLockfileProvidersSection;\n modules: RuntimeProviderModulesArtifact;\n nodeWorkerKeys?: string[];\n scopes: SaasProvidersScopes;\n providerConfigurations: Readonly<Record<string, Readonly<Record<string, unknown>> | undefined>>;\n}): ProviderRuntimeArtifactMetadataByKind {\n const { discoveryContext, frontendServiceTypes, lockSection, modules, nodeWorkerKeys, scopes, providerConfigurations } = input;\n const nodeWorkerKeySet = nodeWorkerKeys ? new Set(nodeWorkerKeys) : undefined;\n\n return {\n backend: buildSingleScopeArtifactMetadata({\n modules,\n providers: scopes.backend?.providers ?? {},\n matchingContributions: findMatchingDiscoveredContributions({\n discoveredContributions: discoveryContext.contributions,\n matchesRuntimeTarget: discoveryContext.backend.matchesRuntimeTarget,\n }),\n extraArtifactState: buildFrontendProviderBootstrapDigestInput({\n discoveredContributions: discoveryContext.contributions,\n frontendServiceScopes: scopes.frontendServices ?? {},\n frontendServiceTypes,\n providerConfigurations,\n }),\n runtimeLockSection: lockSection.runtimeScopes.backend ?? {},\n scopes,\n }),\n companion: buildSingleScopeArtifactMetadata({\n modules,\n providers: scopes.companion?.providers ?? {},\n matchingContributions: findMatchingDiscoveredContributions({\n discoveredContributions: discoveryContext.contributions,\n matchesRuntimeTarget: discoveryContext.companion.matchesRuntimeTarget,\n }),\n runtimeLockSection: lockSection.runtimeScopes.companion ?? {},\n scopes,\n }),\n frontendServices: buildMultiScopeArtifactMetadata({\n keyedProviders: Object.fromEntries(\n Object.entries(scopes.frontendServices ?? {}).map(([scopeKey, scope]) => [scopeKey, scope.providers]),\n ),\n matchingContributionsByScope: Object.fromEntries(\n Object.keys(scopes.frontendServices ?? {}).map((scopeKey) => [\n scopeKey,\n findMatchingDiscoveredContributions({\n discoveredContributions: discoveryContext.contributions,\n matchesRuntimeTarget: discoveryContext.frontendServices.matchesRuntimeTarget(scopeKey),\n }),\n ]),\n ),\n modules,\n extraArtifactState: buildFrontendProviderBootstrapDigestInput({\n discoveredContributions: discoveryContext.contributions,\n frontendServiceScopes: scopes.frontendServices ?? {},\n frontendServiceTypes,\n providerConfigurations,\n }),\n runtimeLockSection: lockSection.runtimeScopes.frontendServices ?? {},\n scopes,\n }),\n minions: buildMultiScopeArtifactMetadata({\n keyedProviders: Object.fromEntries(\n Object.entries(scopes.minions ?? {}).map(([scopeKey, scope]) => [scopeKey, scope.providers]),\n ),\n matchingContributionsByScope: Object.fromEntries(\n Object.keys(scopes.minions ?? {}).map((scopeKey) => [\n scopeKey,\n findMatchingDiscoveredContributions({\n discoveredContributions: discoveryContext.contributions,\n matchesRuntimeTarget: discoveryContext.minions.matchesRuntimeTarget(scopeKey),\n }),\n ]),\n ),\n modules,\n runtimeLockSection: lockSection.runtimeScopes.minions ?? {},\n scopes,\n }),\n nodeWorkers: buildMultiScopeArtifactMetadata({\n keyedProviders: Object.fromEntries(\n Object.entries(scopes.workers ?? {})\n .filter(([scopeKey]) => nodeWorkerKeySet ? nodeWorkerKeySet.has(scopeKey) : true)\n .map(([scopeKey, scope]) => [scopeKey, scope.providers]),\n ),\n matchingContributionsByScope: Object.fromEntries(\n Object.keys(scopes.workers ?? {})\n .filter((scopeKey) => nodeWorkerKeySet ? nodeWorkerKeySet.has(scopeKey) : true)\n .map((scopeKey) => [\n scopeKey,\n findMatchingDiscoveredContributions({\n discoveredContributions: discoveryContext.contributions,\n matchesRuntimeTarget: discoveryContext.workers.matchesRuntimeTarget(scopeKey),\n }),\n ]),\n ),\n modules,\n runtimeLockSection: Object.fromEntries(\n Object.entries(lockSection.runtimeScopes.workers ?? {})\n .filter(([scopeKey]) => nodeWorkerKeySet ? nodeWorkerKeySet.has(scopeKey) : true),\n ),\n scopes,\n }),\n };\n}\n\nfunction buildSingleScopeArtifactMetadata(input: {\n matchingContributions: DiscoveredProviderCompanionContribution[];\n modules: RuntimeProviderModulesArtifact;\n providers: Record<string, SaasProviderScopeSelection>;\n extraArtifactState?: Record<string, unknown>;\n runtimeLockSection: Record<string, unknown>;\n scopes: SaasProvidersScopes;\n}): ProviderRuntimeArtifactMetadata {\n const providerRefs = Object.keys(input.providers).sort();\n const normalizedContributions = normalizeDiscoveredContributionsForDigest(input.matchingContributions);\n const providerGraphDigestInput = input.extraArtifactState\n ? {\n providerGraph: normalizedContributions,\n extraArtifactState: input.extraArtifactState,\n }\n : normalizedContributions;\n\n return {\n sourceDigest: digestJson({\n modules: input.modules,\n providers: input.providers,\n providerGraph: normalizedContributions,\n scopes: input.scopes,\n extraArtifactState: input.extraArtifactState,\n }),\n providerRefs,\n providerRuntimeImports: buildProviderRuntimeImports(providerRefs, input.matchingContributions),\n providerGraphDigest: digestJson(providerGraphDigestInput),\n lockfileSectionDigest: digestJson(input.runtimeLockSection),\n };\n}\n\nfunction buildMultiScopeArtifactMetadata(input: {\n keyedProviders: Record<string, Record<string, SaasProviderScopeSelection>>;\n matchingContributionsByScope: Record<string, DiscoveredProviderCompanionContribution[]>;\n modules: RuntimeProviderModulesArtifact;\n extraArtifactState?: Record<string, unknown>;\n runtimeLockSection: Record<string, unknown>;\n scopes: SaasProvidersScopes;\n}): ProviderRuntimeArtifactMetadata {\n const providerRefs = [...new Set(\n Object.values(input.keyedProviders).flatMap((providers) => Object.keys(providers)),\n )].sort();\n const normalizedContributionsByScope = Object.fromEntries(\n Object.entries(input.matchingContributionsByScope).map(([scopeKey, contributions]) => [\n scopeKey,\n normalizeDiscoveredContributionsForDigest(contributions),\n ]),\n );\n\n const providerGraphDigestInput = input.extraArtifactState\n ? {\n providerGraphByScope: normalizedContributionsByScope,\n extraArtifactState: input.extraArtifactState,\n }\n : normalizedContributionsByScope;\n\n return {\n sourceDigest: digestJson({\n keyedProviders: input.keyedProviders,\n modules: input.modules,\n providerGraphByScope: normalizedContributionsByScope,\n scopes: input.scopes,\n extraArtifactState: input.extraArtifactState,\n }),\n providerRefs,\n providerRuntimeImports: buildProviderRuntimeImports(\n providerRefs,\n Object.values(input.matchingContributionsByScope).flat(),\n ),\n providerGraphDigest: digestJson(providerGraphDigestInput),\n lockfileSectionDigest: digestJson(input.runtimeLockSection),\n };\n}\n\n/**\n * Project the per-ref runtime import path a host dynamic-imports.\n *\n * Only refs actually in scope are recorded, so a per-host artifact never advertises a sibling's\n * packages. A ref no contribution covers is simply absent: the host then resolves it from the\n * engine's on-demand map, and the single fail-loud refusal in the backend registry names it if that\n * map does not hold it either.\n *\n * When several contributions claim one ref with DIFFERENT import paths, the sorted-first path wins\n * — deterministically, so the artifact does not churn. Divergence is possible today only between an\n * application's hand-authored engine projection (`@wildo-ai/saas-backend-lib`) and the engine's own\n * companion export, and neither is consulted for an engine-shipped ref, so the choice cannot change\n * which module a host loads. A package provider is contributed by exactly one package.\n */\nfunction buildProviderRuntimeImports(\n providerRefs: string[],\n contributions: DiscoveredProviderCompanionContribution[],\n): Record<string, string> {\n const inScope = new Set(providerRefs);\n const candidatesByRef = new Map<string, Set<string>>();\n\n for (const contribution of contributions) {\n if (!inScope.has(contribution.ref)) {\n continue;\n }\n const candidates = candidatesByRef.get(contribution.ref) ?? new Set<string>();\n candidates.add(contribution.runtimeImportPath);\n candidatesByRef.set(contribution.ref, candidates);\n }\n\n return Object.fromEntries(\n [...candidatesByRef.entries()]\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([ref, candidates]) => [ref, [...candidates].sort()[0]]),\n );\n}\n\nfunction findMatchingDiscoveredContributions(input: {\n discoveredContributions: DiscoveredProviderCompanionContribution[];\n matchesRuntimeTarget: (target: DiscoveredProviderCompanionContribution['runtimeTargets'][number]) => boolean;\n providerRef?: string;\n}): DiscoveredProviderCompanionContribution[] {\n return input.discoveredContributions.flatMap((contribution) => {\n if (input.providerRef && contribution.ref !== input.providerRef) {\n return [];\n }\n const runtimeTargets = contribution.runtimeTargets.filter(input.matchesRuntimeTarget);\n if (runtimeTargets.length === 0) {\n return [];\n }\n return [{ ...contribution, runtimeTargets }];\n });\n}\n\n/**\n * The portion of a contribution's `owner` that may enter a digest.\n *\n * **`packageRoot` is deliberately excluded, and this is the whole point of the\n * function.** Discovery builds it as `resolve(saasRoot, definition.path)` — an\n * ABSOLUTE filesystem path — so hashing it makes every value derived from this\n * normalizer a property of WHERE THE REPOSITORY HAPPENS TO BE CHECKED OUT\n * rather than of the provider graph.\n *\n * That is not a theoretical concern; it was measured on 2026-08-30. The same\n * Wonder Todos tree, materialized from its real directory and from a symlink to\n * it, produced two different lock digests for every provider in every scope\n * (`sha256:f7eeb2d6…` vs `sha256:d933b95a…` for backend `anthropic`), and a dump\n * of the two contribution sets differed in `owner.packageRoot` and nothing else.\n * The consequences were both real:\n *\n * - `examples/wonder-todos/.wildo-saas/wildo-saas.lock.json` carried 22 digests\n * scoped to whichever checkout last ran `wildo config sync`, so the\n * `Lockfile Drift Check` gate — which runs at `/home/runner/work/…` — could\n * never have agreed with a committed value regardless of actual drift.\n * - The same input feeds `sourceDigest` / `providerGraphDigest` in the generated\n * runtime artifacts and `.wildo-providers.env`, so artifacts generated on a\n * developer's machine and re-materialized under a container's `/app` would\n * trip the `digest-mismatch` runtime diagnostic while describing an identical\n * provider graph.\n *\n * `kind` + `key` already identify an owner uniquely (both are record keys within\n * their config block), so nothing distinguishing is lost. What IS given up is\n * that relocating an owner package without changing its contribution content no\n * longer moves the digest — accepted deliberately: a repository-layout change is\n * not a provider-contract change, and if that signal is ever wanted it must\n * arrive as a saas-root-RELATIVE path, never an absolute one.\n */\nfunction projectOwnerForDigest(\n owner: DiscoveredProviderCompanionContribution['owner'],\n): { kind: string; key: string } {\n return { kind: owner.kind, key: owner.key };\n}\n\nfunction normalizeDiscoveredContributionsForDigest(\n contributions: DiscoveredProviderCompanionContribution[],\n): Array<Record<string, unknown>> {\n return [...contributions]\n .sort((left, right) => stableStringify({\n leftOwner: projectOwnerForDigest(left.owner),\n leftRef: left.ref,\n leftRuntimeImportPath: left.runtimeImportPath,\n leftSourceModuleId: left.sourceModuleId,\n leftTargets: left.runtimeTargets,\n }).localeCompare(stableStringify({\n rightOwner: projectOwnerForDigest(right.owner),\n rightRef: right.ref,\n rightRuntimeImportPath: right.runtimeImportPath,\n rightSourceModuleId: right.sourceModuleId,\n rightTargets: right.runtimeTargets,\n })))\n .map((contribution) => ({\n ref: contribution.ref,\n owner: projectOwnerForDigest(contribution.owner),\n runtimeImportPath: contribution.runtimeImportPath,\n runtimeTargets: contribution.runtimeTargets,\n engineCapabilities: [...contribution.engineCapabilities].sort(),\n providerCapabilities: [...contribution.providerCapabilities].sort(),\n protocols: [...contribution.protocols].sort(),\n secretsContractShape: contribution.secretsContractShape,\n frontendEntry: contribution.frontendEntry\n ? {\n metadata: contribution.frontendEntry.metadata,\n providerCapabilities: [...contribution.frontendEntry.providerCapabilities].sort(),\n protocols: [...contribution.frontendEntry.protocols].sort(),\n publicConfig: contribution.frontendEntry.publicConfig,\n }\n : undefined,\n sourceModuleId: contribution.sourceModuleId,\n }));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"provider-runtime-artifacts.js","sourceRoot":"","sources":["../../../../src/project-config/provider-runtime-artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,mCAAmC,EACnC,iCAAiC,EACjC,4BAA4B,EAC5B,mCAAmC,GAGpC,MAAM,uBAAuB,CA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,oBAAoB,EAAE,YAAY,CAAC,oBAAoB;QACvD,aAAa,EAAE,YAAY,CAAC,aAAa;YACvC,CAAC,CAAC;gBACA,QAAQ,EAAE,YAAY,CAAC,aAAa,CAAC,QAAQ;gBAC7C,oBAAoB,EAAE,CAAC,GAAG,YAAY,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC,IAAI,EAAE;gBACjF,SAAS,EAAE,CAAC,GAAG,YAAY,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE;gBAC3D,YAAY,EAAE,YAAY,CAAC,aAAa,CAAC,YAAY;aACtD;YACD,CAAC,CAAC,SAAS;QACb,cAAc,EAAE,YAAY,CAAC,cAAc;KAC5C,CAAC,CAAC,CAAC;AACR,CAAC","sourcesContent":["import { createHash } from 'node:crypto';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve as resolvePath } from 'node:path';\nimport { z } from 'zod';\nimport {\n AppFrontendType,\n FRONTEND_PROVIDER_PUBLIC_CONFIG_KEY,\n FrontendProviderPublicConfigError,\n FrontendProvidersBlockSchema,\n overlayFrontendProviderPublicConfig,\n type FrontendProviderEntry,\n type FrontendProvidersBlock,\n} from '@wildo-ai/saas-models';\nimport {\n SaasLockfileProvidersSectionSchema,\n type SaasLockfileProvidersSection,\n type SaasLockfileRuntimeScopesProviders,\n} from '../lockfile/wildo-saas-lock.shared.schemas';\nimport {\n getDeclaredApplicationModuleIds,\n getServiceBoundApplicationModuleIds,\n} from './shared/application-modules.utils';\nimport type { ApplicationModules } from './shared/application-modules.schemas';\nimport {\n SaasProvidersScopesSchema,\n SaasProviderScopeSelectionSchema,\n type SaasProviderScopeSelection,\n type SaasProvidersScopes,\n type WildoSaasConfig,\n} from './define-saas-config';\nimport type { DiscoveredProviderCompanionContribution } from './provider-companion-discovery';\n\nexport const PROVIDER_RUNTIME_ARTIFACT_AUTOGENERATED_WARNING =\n 'AUTO-GENERATED FILE. DO NOT EDIT. Regenerate with `wildo config sync`.';\n\nexport const PROVIDER_RUNTIME_ARTIFACT_GENERATOR = 'wildo provider-runtime-artifact';\n\n/**\n * Canonical relative paths (from saas root) for the per-runtime-kind\n * provider artifact JSON files emitted by `wildo config sync`.\n *\n * Moved from `.wildo-saas/providers/` → `.wildo-saas/generated/providers/`\n * on 2026-05-06 to group ALL CLI-generated runtime topology artifacts\n * under the `.wildo-saas/generated/` namespace (sibling to other\n * generated state). The legacy `.wildo-saas/providers/` location is\n * cleaned up by `cleanupLegacyProviderJsonArtifacts` in the CLI sync\n * so operators don't end up with two copies after the migration.\n */\nexport const PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS = {\n backend: '.wildo-saas/generated/providers/backend.runtime-providers.generated.json',\n companion: '.wildo-saas/generated/providers/companion.runtime-providers.generated.json',\n frontendServices: '.wildo-saas/generated/providers/frontend-services.runtime-providers.generated.json',\n minions: '.wildo-saas/generated/providers/minions.runtime-providers.generated.json',\n nodeWorkers: '.wildo-saas/generated/providers/node-workers.runtime-providers.generated.json',\n} as const;\n\n/**\n * Legacy paths (pre-2026-05-06) for the per-runtime-kind provider\n * artifact JSON files. These are NOT written anymore — kept here so\n * `wildo config sync` can clean them up if they exist on disk from a\n * pre-migration sync. Drop this constant entirely once Wonder Todos\n * + downstream apps have all run a post-migration sync at least once.\n */\nexport const LEGACY_PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS = {\n backend: '.wildo-saas/providers/backend.runtime-providers.generated.json',\n companion: '.wildo-saas/providers/companion.runtime-providers.generated.json',\n frontendServices: '.wildo-saas/providers/frontend-services.runtime-providers.generated.json',\n minions: '.wildo-saas/providers/minions.runtime-providers.generated.json',\n nodeWorkers: '.wildo-saas/providers/node-workers.runtime-providers.generated.json',\n} as const;\n\nexport type ProviderRuntimeArtifactKind = keyof typeof PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS;\n\nexport const PROVIDER_RUNTIME_GENERATED_MODULE_RELATIVE_PATH =\n 'src/generated/wildo-provider-runtime.generated.ts';\n\n/**\n * Canonical lockfile section path the provider-materialization\n * subsystem owns end-to-end. Used by the post-mutation provider sync\n * runner + materialization-hook return types and pinned by tests\n * (`provider-sync-runner.test.ts`, `provider-materialization-hook.test.ts`).\n *\n * Defined here as a single-source constant — used to live as a\n * literal in 3+ places across `wildo-module-client` (third-pass\n * review C-L1).\n */\nexport const PROVIDER_LOCK_SECTION_PATH = 'sections.providers.runtimeScopes' as const;\n\n/**\n * Per-worker generated env file written by `wildo config sync`. Carries\n * provider topology env vars derived from the materialized scope.\n *\n * This file is the **single delivery channel** non-Node workers (Rust /\n * Java / etc.) receive for provider topology — there is no executable\n * JS bundle in their case (Step 5b in\n * `.claude/plans/provider-migration-continuation.md`). Node workers\n * receive both this file and the per-package\n * `wildo-provider-runtime.generated.ts` source module; reading either\n * surface yields a consistent view because they share the same digest.\n *\n * The file is auto-generated and overwritten on every sync. Operator-\n * authored secrets and per-env config stay in the worker's `.env` (not\n * touched by `wildo config sync`); workers should load both files at\n * boot — operator vars from `.env` and provider vars from this file —\n * so the two channels never collide.\n */\nexport const PROVIDER_RUNTIME_GENERATED_ENV_FILE_NAME = '.wildo-providers.env';\n\nconst RuntimeProviderScopeArtifactSchema = z.strictObject({\n providers: z.record(z.string(), SaasProviderScopeSelectionSchema).default({}),\n selection: z.record(\n z.string(),\n z.strictObject({\n primary: z.string().min(1),\n whenUnavailable: z.array(z.string().min(1)).default([]),\n }),\n ).default({}),\n});\n\nconst RuntimeProviderModulesArtifactSchema = z.strictObject({\n declaredModules: z.record(\n z.string(),\n z.strictObject({\n services: z.array(z.string().min(1)),\n haveSamlIntegration: z.boolean().optional(),\n }),\n ).default({}),\n moduleIds: z.array(z.string().min(1)).default([]),\n moduleIdsByService: z.record(z.string(), z.array(z.string().min(1))).default({}),\n});\nexport type RuntimeProviderModulesArtifact = z.infer<typeof RuntimeProviderModulesArtifactSchema>;\n\n/**\n * The per-service frontend bootstrap map, keyed by frontend service key.\n *\n * ## It was an ANNOTATED interface until 2026-09-12, and the workaround is gone (#356)\n *\n * `FrontendProvidersBlockSchema` transitively references three atoms — `ProviderFrontendCspOriginBucket`,\n * `ProviderFrontendScriptCrossOrigin`, `ProviderFrontendSelectionDelivery` — that `@wildo-ai/saas-models`\n * published from `/public-runtime` ALONE. While this artifact object stayed small TypeScript inlined the\n * shape and nobody noticed; adding one member past the inline threshold made it reach for the NAME and\n * refuse, here and in `saas-backend-lib` at the same time:\n *\n * `TS2742 … cannot be named without a reference to\n * node_modules/@wildo-ai/saas-models/src/external-providers/provider-frontend-surface.shared.schemas`.\n *\n * #330 stopped the expansion with a locally declared interface, deliberately as a workaround: an\n * interface is written BY NAME in the emitted declaration where a type alias expands structurally and\n * takes the unnameable atoms with it. The boundary has since MOVED — the root barrel now exports that\n * module — so the atoms are nameable through the package root and the workaround has nothing left to do.\n *\n * Verified with the probe `package-public-entrypoints.md` prescribes rather than by re-running the\n * source-mapped packages: a consumer importing ONLY `@wildo-ai/saas-models`, deriving a record over\n * `FrontendProvidersBlockSchema`, compiled with `declaration: true`. It names all three atoms through\n * `import(\"@wildo-ai/saas-models\")` and reaches no relative `node_modules` path at all.\n */\nconst FrontendProviderBootstrapsSchema = z.record(z.string().min(1), FrontendProvidersBlockSchema);\n\nexport const SaasRuntimeProvidersArtifactSchema = z.strictObject({\n __AUTOGENERATED__: z.literal(PROVIDER_RUNTIME_ARTIFACT_AUTOGENERATED_WARNING),\n generatedBy: z.literal(PROVIDER_RUNTIME_ARTIFACT_GENERATOR),\n generatedAt: z.string().datetime({ offset: true }),\n sourceDigest: z.string().min(1),\n providerRefs: z.array(z.string().min(1)).default([]),\n /**\n * `providerRef` -> the package specifier a host dynamic-imports to obtain that provider's backend\n * module (#330).\n *\n * `providerRefs` says WHICH providers a process may expose; this says WHERE each one comes from,\n * and it is what makes a provider shipped as its own npm package loadable at all. Derived from\n * the discovered contribution whose `runtimeTargets` match the host — never authored.\n *\n * Optional, so an artifact written before this field existed still parses. Every ref such an\n * artifact names is engine-shipped, and a host resolves those from the engine's own on-demand map\n * without consulting this record, so an un-resynced application is unaffected.\n */\n providerRuntimeImports: z.record(z.string().min(1), z.string().min(1)).optional(),\n /**\n * Package specifiers that ship SYSTEM-OF-RECORD VENDOR FACETS, in discovery order (#1057).\n *\n * A list rather than a `vendor -> specifier` map, because a facet module contributes a RECORD of\n * vendors rather than one module per vendor: a map would restate the record's own keys in a\n * generated artifact read by a different process, free to disagree with it. The backend imports\n * each specifier in order and takes the first that answers for the vendor.\n *\n * Discovered from the MANIFEST — a package declaring an `./systems-of-record` export — never from\n * loading it. Sync has no business evaluating a vendor facet, and the manifest is the same door\n * `./companion` is found through.\n */\n systemOfRecordFacetModules: z.array(z.string().min(1)).optional(),\n providerGraphDigest: z.string().min(1),\n lockfileSectionDigest: z.string().min(1),\n artifactKind: z.enum([\n 'backend',\n 'companion',\n 'frontendServices',\n 'minions',\n 'nodeWorkers',\n ]),\n modules: RuntimeProviderModulesArtifactSchema,\n scope: RuntimeProviderScopeArtifactSchema.optional(),\n scopes: z.record(z.string(), RuntimeProviderScopeArtifactSchema).optional(),\n frontendProviderBootstraps: FrontendProviderBootstrapsSchema.optional(),\n});\nexport type SaasRuntimeProvidersArtifact = z.infer<typeof SaasRuntimeProvidersArtifactSchema>;\n\nexport interface MaterializedSaasProviderRuntimeArtifacts {\n artifacts: Partial<Record<ProviderRuntimeArtifactKind, SaasRuntimeProvidersArtifact>>;\n lockSection: SaasLockfileProvidersSection;\n}\n\nexport function materializeSaasProviderRuntimeArtifacts(\n // `providerConfigurations` is where an application supplies a frontend provider's public keys\n // (#394 P3). Optional here so the lockfile check and every existing caller that narrows the\n // config keep compiling; absent means \"the application configured nothing\", never a refusal.\n config: Pick<WildoSaasConfig, 'modules' | 'providers' | 'services'> & Partial<Pick<WildoSaasConfig, 'providerConfigurations'>>,\n options?: {\n generatedAt?: string;\n nodeWorkerKeys?: string[];\n discoveredContributions?: DiscoveredProviderCompanionContribution[];\n },\n): MaterializedSaasProviderRuntimeArtifacts {\n const scopes = SaasProvidersScopesSchema.parse(config.providers.scopes);\n const generatedAt = options?.generatedAt ?? new Date().toISOString();\n const modules = materializeModules(config);\n const frontendServiceTypes: Record<string, AppFrontendType> = Object.fromEntries(\n Object.entries(config.services ?? {})\n .filter(([, definition]) => definition.frontendType !== undefined)\n .map(([serviceKey, definition]) => [serviceKey, definition.frontendType as AppFrontendType]),\n );\n // Backend requests carry public service names; build-time consumers use declaration keys.\n // Validate before publication so two scopes can never silently overwrite one another.\n const frontendServiceNames: Record<string, string> = {};\n const publicNames = new Set<string>();\n for (const serviceKey of Object.keys(frontendServiceTypes)) {\n const name = config.services[serviceKey]?.serviceName;\n if (!name?.trim() || publicNames.has(name)) {\n throw new Error(`Frontend service \"${serviceKey}\" needs a unique non-empty public serviceName; received \"${name ?? ''}\".`);\n }\n publicNames.add(name);\n frontendServiceNames[serviceKey] = name;\n }\n const discoveryContext = buildProviderRuntimeDiscoveryContext({\n discoveredContributions: options?.discoveredContributions,\n frontendServiceTypes,\n });\n\n const lockSection = SaasLockfileProvidersSectionSchema.parse({\n runtimeScopes: materializeLockRuntimeScopes({\n scopes,\n discoveryContext,\n }),\n });\n const artifactMetadata = buildArtifactMetadata({\n discoveryContext,\n frontendServiceTypes,\n frontendServiceNames,\n lockSection,\n modules,\n nodeWorkerKeys: options?.nodeWorkerKeys,\n scopes,\n providerConfigurations: config.providerConfigurations ?? {},\n });\n\n const artifacts = materializeRuntimeArtifacts({\n artifactMetadata,\n discoveryContext,\n frontendServiceTypes,\n frontendServiceNames,\n generatedAt,\n modules,\n nodeWorkerKeys: options?.nodeWorkerKeys,\n scopes,\n providerConfigurations: config.providerConfigurations ?? {},\n });\n\n return { artifacts, lockSection };\n}\n\nexport function selectScopedProviderRuntimeArtifact(\n artifact: SaasRuntimeProvidersArtifact,\n scopeKey: string,\n): SaasRuntimeProvidersArtifact {\n if (!artifact.scopes) {\n throw new Error(`Provider runtime artifact '${artifact.artifactKind}' does not contain keyed scopes.`);\n }\n\n const scope = artifact.scopes[scopeKey];\n if (!scope) {\n throw new Error(`Provider runtime artifact '${artifact.artifactKind}' does not contain scope '${scopeKey}'.`);\n }\n\n // Recompute `providerRefs` from the projected per-host scope rather\n // than carrying the parent multi-scope union forward unchanged. The\n // multi-scope artifact's `providerRefs` is the union across all\n // hosts (`buildMultiScopeArtifactMetadata`); preserving that union\n // on a single-scope projection makes the per-host artifact internally\n // inconsistent — `scope.providers` would describe one host while\n // `providerRefs` would describe siblings too. The boot-time\n // `assertProviderRuntimeEnvInSync` guard treats `providerRefs.length > 0`\n // as \"this host has providers to reconcile\" — without this\n // recomputation, an empty-scope host would inherit the union and\n // trip the env-missing guard even though its `.wildo-providers.env`\n // was deliberately not written. Recomputation also tightens\n // `BackendProviderRegistry`'s filter (today defended by an empty-list\n // fallback) so the per-host artifact accurately advertises only the\n // refs it should resolve.\n const projectedProviderRefs = Object.keys(scope.providers).sort();\n\n return SaasRuntimeProvidersArtifactSchema.parse({\n ...artifact,\n providerRefs: projectedProviderRefs,\n // Narrowed for the same reason `providerRefs` is recomputed above: the multi-scope artifact's\n // import map is the union across every host, and a per-host projection that advertised a\n // sibling's packages would tell this host it can load something it never declared.\n providerRuntimeImports: Object.fromEntries(\n Object.entries(artifact.providerRuntimeImports ?? {})\n .filter(([providerRef]) => projectedProviderRefs.includes(providerRef)),\n ),\n frontendProviderBootstraps: artifact.frontendProviderBootstraps?.[scopeKey]\n ? { [scopeKey]: artifact.frontendProviderBootstraps[scopeKey] }\n : undefined,\n scope,\n scopes: undefined,\n });\n}\n\n/**\n * Resolve the absolute path to the canonical\n * `frontend-services.runtime-providers.generated.json` artifact under\n * `<saasRoot>/.wildo-saas/generated/providers/`.\n *\n * Build-time consumers (Wonder Todos website + tech-doc) call this\n * instead of hardcoding the relative path so the artifact location\n * stays canonical (single source of truth is\n * `PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS`).\n */\nexport function resolveFrontendServicesArtifactPath(saasRoot: string): string {\n return resolvePath(saasRoot, PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS.frontendServices);\n}\n\n/**\n * Read + project the materialized frontend-services artifact for the\n * given service key. Returns `undefined` if the artifact file is\n * missing (sync hasn't run yet / clean checkout) or if the service\n * has no provider bootstrap entry.\n *\n * The single source of truth for build-time loading of the frontend\n * provider bootstraps. Replaces the (previously duplicated)\n * `loadMaterializedFrontendProviders` helpers that lived in\n * `saas-technical-doc/src/build/load-materialized-frontend-providers.ts`\n * and inline in `examples/wonder-todos/website/src/website-site-context.ts`.\n *\n * Both consumers used identical control flow:\n * 1. existsSync() short-circuit\n * 2. JSON.parse + SaasRuntimeProvidersArtifactSchema.parse\n * 3. frontendProviderBootstraps[serviceKey] lookup\n * 4. FrontendProvidersBlockSchema.parse on the per-service block\n * Centralized 2026-05-06 so a future schema/path change only\n * requires editing this function.\n */\nexport function loadMaterializedFrontendProviders(input: {\n artifactPath: string;\n serviceKey: string;\n}): FrontendProvidersBlock | undefined {\n const { artifactPath, serviceKey } = input;\n\n if (!existsSync(artifactPath)) {\n return undefined;\n }\n\n const parsedArtifact = SaasRuntimeProvidersArtifactSchema.safeParse(\n JSON.parse(readFileSync(artifactPath, 'utf8')),\n );\n if (!parsedArtifact.success) {\n throw staleGeneratedArtifactError(artifactPath, parsedArtifact.error.issues);\n }\n const providerBlock = parsedArtifact.data.frontendProviderBootstraps?.[serviceKey];\n if (providerBlock === undefined) return undefined;\n\n const parsedBlock = FrontendProvidersBlockSchema.safeParse(providerBlock);\n if (!parsedBlock.success) {\n throw staleGeneratedArtifactError(artifactPath, parsedBlock.error.issues);\n }\n return parsedBlock.data;\n}\n\n/**\n * A materialized artifact that does not satisfy the current schema was almost always generated\n * before the contract changed (#328 added the provider identity to every frontend entry). A raw\n * Zod issue list reads as a logic defect in the consumer; the remedy is regeneration, so the\n * error names it. The backend's `applyProviderRuntime` says the same thing for its own reader —\n * one message, two readers.\n */\nfunction staleGeneratedArtifactError(artifactPath: string, issues: ReadonlyArray<{ path: PropertyKey[]; message: string }>): Error {\n return new Error(\n `The generated provider runtime artifact at ${artifactPath} does not satisfy the current contract — it was most `\n + 'likely generated before the contract changed. Regenerate it with `wildo config sync`. Issues: '\n + issues.map((issue) => `${issue.path.map(String).join('.')}: ${issue.message}`).join('; '),\n );\n}\n\nexport function renderProviderRuntimeGeneratedModule(\n artifact: SaasRuntimeProvidersArtifact,\n): string {\n const artifactLiteral = JSON.stringify(artifact, null, 2);\n\n return [\n '/**',\n ` * ${PROVIDER_RUNTIME_ARTIFACT_AUTOGENERATED_WARNING}`,\n ' *',\n ' * This module is generated from wildo.saas.config.ts by `wildo config sync`.',\n ' * It contains environment-independent provider topology only.',\n ' */',\n '',\n // Intentionally NOT `as const` — the generated artifact is *data*, not a\n // frozen literal-typed tuple. Each host (backend / companion / minion /\n // worker) casts the imported value to its own narrowed runtime-artifact\n // type (`ProviderRuntimeArtifact`, `MinionProviderRuntimeArtifact`, …).\n // `as const` would infer `readonly` tuples (e.g. `readonly [\"openai\"]`)\n // that fail TS2352 against the schema-inferred mutable `string[]` shape.\n // Contract conformance is enforced upstream by\n // `SaasRuntimeProvidersArtifactSchema.parse(...)` at materialization time,\n // so widening the TS surface here costs no runtime safety.\n `export const WILDO_PROVIDER_RUNTIME = ${artifactLiteral};`,\n '',\n 'export default WILDO_PROVIDER_RUNTIME;',\n '',\n ].join('\\n');\n}\n\n/**\n * Canonical worker provider env-var keys. All workers receive the same\n * three keys regardless of language; the values are stable across runs\n * as long as the authored scope and discovered contributions don't\n * change.\n *\n * - `WILDO_PROVIDER_REFS` — comma-separated list of authored refs (sorted).\n * Cheap to read from any language (no JSON parser needed).\n * - `WILDO_PROVIDER_TOPOLOGY_JSON` — the per-worker `scope` block from\n * the materialized artifact, JSON-encoded. Workers that want\n * structured access (capability/protocol set) parse this; workers\n * that only need ref membership read `WILDO_PROVIDER_REFS`.\n * - `WILDO_PROVIDER_RUNTIME_DIGEST` — the artifact's `sourceDigest`.\n * Workers can fail-closed at boot if their copy of the env-file\n * disagrees with the lockfile section digest the platform expects.\n */\nexport const PROVIDER_RUNTIME_ENV_KEYS = {\n REFS: 'WILDO_PROVIDER_REFS',\n TOPOLOGY_JSON: 'WILDO_PROVIDER_TOPOLOGY_JSON',\n RUNTIME_DIGEST: 'WILDO_PROVIDER_RUNTIME_DIGEST',\n} as const;\n\n/**\n * Render the per-worker provider env-file body. Inputs:\n * - `scope` — the per-worker scope block from\n * `WildoSaasConfig.providers.scopes.workers[<workerKey>]`. Carries\n * the authored providers + capability/protocol declarations that\n * this worker needs to resolve at runtime.\n * - `sourceDigest` — `SaasRuntimeProvidersArtifact.sourceDigest`\n * (from the lockfile or the corresponding generated artifact).\n *\n * Output: a deterministic dotenv body — sorted refs, stable JSON\n * key ordering — so re-running `wildo config sync` with no upstream\n * changes produces a byte-identical file.\n */\nexport function renderProviderRuntimeEnvFile(input: {\n scope: SaasProviderScopeSelections;\n sourceDigest: string;\n}): string {\n const refs = Object.keys(input.scope.providers).sort();\n const topology: Record<string, {\n engineCapabilities: string[];\n providerCapabilities: string[];\n protocols: string[];\n }> = {};\n for (const ref of refs) {\n const selection = input.scope.providers[ref];\n topology[ref] = {\n engineCapabilities: [...selection.engineCapabilities].sort(),\n providerCapabilities: [...selection.providerCapabilities].sort(),\n protocols: [...selection.protocols].sort(),\n };\n }\n\n return [\n `# ${PROVIDER_RUNTIME_ARTIFACT_AUTOGENERATED_WARNING}`,\n '#',\n '# This file is regenerated on every `wildo config sync`. Do not edit by hand.',\n '# Operator-authored secrets / per-env config stay in `.env` and are never touched here.',\n '',\n `${PROVIDER_RUNTIME_ENV_KEYS.REFS}=${refs.join(',')}`,\n `${PROVIDER_RUNTIME_ENV_KEYS.TOPOLOGY_JSON}=${JSON.stringify(topology)}`,\n `${PROVIDER_RUNTIME_ENV_KEYS.RUNTIME_DIGEST}=${input.sourceDigest}`,\n '',\n ].join('\\n');\n}\n\n/**\n * Result of comparing the runtime host's typed\n * `wildo-provider-runtime.generated.ts` module against its\n * `.wildo-providers.env` file at boot.\n *\n * Drift between the two indicates the operator regenerated one surface\n * but not the other — typically: edited `wildo.saas.config.ts` and\n * re-ran `wildo config sync` while the env file was cached, or vice\n * versa. Either case the runtime would silently boot with mismatched\n * topology unless someone reconciles. See\n * `assertProviderRuntimeEnvInSync` for the fail-closed assertion.\n */\nexport type ProviderRuntimeEnvReconciliationResult =\n | { kind: 'in-sync' }\n | { kind: 'env-missing'; missingKeys: ReadonlyArray<string> }\n | {\n kind: 'refs-mismatch';\n envRefs: ReadonlyArray<string>;\n artifactRefs: ReadonlyArray<string>;\n }\n | {\n kind: 'digest-mismatch';\n envDigest: string;\n artifactDigest: string;\n };\n\n/**\n * Reconcile a runtime artifact's typed projection against the\n * `.wildo-providers.env` mounted into the same process. Pure function\n * so callers can decide how to surface the result (throw / log / ignore).\n *\n * The env file is materialized by `renderProviderRuntimeEnvFile` for\n * EVERY runtime host that is a minion or worker; the typed module is\n * imported by the same hosts. Both should agree on\n * `(providerRefs, sourceDigest)` exactly. Drift means stale sync.\n *\n * Hosts that don't receive an env file (backend, companion, frontend\n * services per `provider-runtime-sync.service.ts`) MUST NOT call this —\n * `WILDO_PROVIDER_*` keys won't be set and every call returns\n * `env-missing`.\n */\nexport function reconcileProviderRuntimeEnv(input: {\n artifactProviderRefs: ReadonlyArray<string>;\n artifactSourceDigest: string;\n env?: NodeJS.ProcessEnv;\n}): ProviderRuntimeEnvReconciliationResult {\n const env = input.env ?? process.env;\n const envRefsRaw = env[PROVIDER_RUNTIME_ENV_KEYS.REFS];\n const envDigest = env[PROVIDER_RUNTIME_ENV_KEYS.RUNTIME_DIGEST];\n\n const missingKeys: string[] = [];\n if (envRefsRaw === undefined) missingKeys.push(PROVIDER_RUNTIME_ENV_KEYS.REFS);\n if (envDigest === undefined) missingKeys.push(PROVIDER_RUNTIME_ENV_KEYS.RUNTIME_DIGEST);\n if (missingKeys.length > 0) {\n return { kind: 'env-missing', missingKeys };\n }\n\n // Filter empty entries so trailing-comma input (e.g. `'openai,'`) or\n // operator-edited stray whitespace don't produce confusing `''`\n // entries in mismatch diagnostics. Materializer never emits trailing\n // commas, but defense-in-depth keeps the helper robust to anything\n // that lands the env file via dotenv loaders or hand-edits.\n const envRefs = envRefsRaw!\n .split(',')\n .map((s) => s.trim())\n .filter((s) => s.length > 0)\n .sort();\n const artifactRefs = [...input.artifactProviderRefs].sort();\n\n if (envRefs.length !== artifactRefs.length || envRefs.some((ref, i) => ref !== artifactRefs[i])) {\n return { kind: 'refs-mismatch', envRefs, artifactRefs };\n }\n\n if (envDigest !== input.artifactSourceDigest) {\n return {\n kind: 'digest-mismatch',\n envDigest: envDigest!,\n artifactDigest: input.artifactSourceDigest,\n };\n }\n\n return { kind: 'in-sync' };\n}\n\n/**\n * Fail-closed wrapper around `reconcileProviderRuntimeEnv`. Throws on\n * any divergence, returns silently when in sync. Designed to be called\n * once at runtime-host boot (minion / Node-worker startup) so a stale\n * `.wildo-providers.env` surfaces immediately instead of being masked\n * by `process.env` drift.\n *\n * Throws a plain `Error` (not `WildoError_Backend`) because this runs\n * BEFORE the DI container has built the error builder — the failure\n * mode here is \"the container can't be trusted to boot at all\".\n */\nexport function assertProviderRuntimeEnvInSync(input: {\n artifactProviderRefs: ReadonlyArray<string>;\n artifactSourceDigest: string;\n hostKind: 'minion' | 'node-worker';\n hostKey: string;\n env?: NodeJS.ProcessEnv;\n}): void {\n const result = reconcileProviderRuntimeEnv(input);\n switch (result.kind) {\n case 'in-sync':\n return;\n case 'env-missing':\n throw new Error(\n `[provider-runtime-env] ${input.hostKind} '${input.hostKey}' booted without `\n + `provider env vars (${result.missingKeys.join(', ')}). The `\n + `\\`.wildo-providers.env\\` file should be mounted into this process — check `\n + `the docker-compose \\`env_file:\\` directive, the K8s ConfigMap mount, or the `\n + `dotenv loader. Re-run \\`wildo config sync\\` to regenerate if missing.`,\n );\n case 'refs-mismatch':\n throw new Error(\n `[provider-runtime-env] ${input.hostKind} '${input.hostKey}' detected stale provider topology. `\n + `\\`.wildo-providers.env\\` advertises refs [${result.envRefs.join(', ')}] but the `\n + `imported \\`wildo-provider-runtime.generated.ts\\` module declares `\n + `[${result.artifactRefs.join(', ')}]. Run \\`wildo config sync\\` to regenerate `\n + `both surfaces from the same \\`wildo.saas.config.ts\\` source.`,\n );\n case 'digest-mismatch':\n throw new Error(\n `[provider-runtime-env] ${input.hostKind} '${input.hostKey}' detected provider runtime digest drift. `\n + `\\`.wildo-providers.env\\` carries digest '${result.envDigest}' but the imported `\n + `\\`wildo-provider-runtime.generated.ts\\` module carries '${result.artifactDigest}'. `\n + `Refs match, but per-provider capabilities/protocols may differ. `\n + `Run \\`wildo config sync\\` to regenerate.`,\n );\n }\n}\n\ntype SaasProviderScopeSelections = {\n providers: Record<string, {\n engineCapabilities: ReadonlyArray<string>;\n providerCapabilities: ReadonlyArray<string>;\n protocols: ReadonlyArray<string>;\n }>;\n};\n\nfunction materializeRuntimeArtifacts(input: {\n frontendServiceNames: Record<string, string>;\n artifactMetadata: ProviderRuntimeArtifactMetadataByKind;\n discoveryContext: ProviderRuntimeDiscoveryContext;\n frontendServiceTypes: Record<string, AppFrontendType>;\n generatedAt: string;\n modules: RuntimeProviderModulesArtifact;\n nodeWorkerKeys?: string[];\n scopes: SaasProvidersScopes;\n providerConfigurations: Readonly<Record<string, Readonly<Record<string, unknown>> | undefined>>;\n}): MaterializedSaasProviderRuntimeArtifacts['artifacts'] {\n const { artifactMetadata, discoveryContext, frontendServiceTypes, generatedAt, modules, nodeWorkerKeys, scopes, providerConfigurations } = input;\n const nodeWorkerKeySet = nodeWorkerKeys ? new Set(nodeWorkerKeys) : undefined;\n const nodeWorkerScopes = scopes.workers\n ? Object.fromEntries(\n Object.entries(scopes.workers).filter(([workerKey]) =>\n nodeWorkerKeySet ? nodeWorkerKeySet.has(workerKey) : true,\n ),\n )\n : undefined;\n\n const backendBootstraps = materializeFrontendProviderBootstraps({\n discoveredContributions: discoveryContext.contributions,\n frontendServiceScopes: scopes.frontendServices ?? {},\n frontendServiceTypes,\n providerConfigurations,\n });\n\n return pruneUndefined({\n backend: materializeRuntimeArtifactFile({\n artifactKind: 'backend',\n generatedAt,\n modules,\n metadata: artifactMetadata.backend,\n // Only the HTTP-facing backend map uses public names. Static artifacts below\n // deliberately retain declaration keys for build-time scope selection.\n frontendProviderBootstraps: backendBootstraps && Object.fromEntries(\n Object.entries(backendBootstraps).map(([serviceKey, block]) => [input.frontendServiceNames[serviceKey]!, block]),\n ),\n scope: materializeRuntimeScope(scopes.backend ?? { providers: {}, selection: {} }),\n }),\n companion: materializeRuntimeArtifactFile({\n artifactKind: 'companion',\n generatedAt,\n modules,\n metadata: artifactMetadata.companion,\n scope: materializeRuntimeScope(scopes.companion ?? { providers: {}, selection: {} }),\n }),\n frontendServices: scopes.frontendServices\n ? materializeRuntimeArtifactFile({\n artifactKind: 'frontendServices',\n generatedAt,\n modules,\n metadata: artifactMetadata.frontendServices,\n frontendProviderBootstraps: materializeFrontendProviderBootstraps({\n discoveredContributions: discoveryContext.contributions,\n frontendServiceScopes: scopes.frontendServices,\n frontendServiceTypes,\n providerConfigurations,\n }),\n scopes: mapRecord(scopes.frontendServices, materializeRuntimeScope),\n })\n : undefined,\n minions: scopes.minions\n ? materializeRuntimeArtifactFile({\n artifactKind: 'minions',\n generatedAt,\n modules,\n metadata: artifactMetadata.minions,\n scopes: mapRecord(scopes.minions, materializeRuntimeScope),\n })\n : undefined,\n nodeWorkers: nodeWorkerScopes && Object.keys(nodeWorkerScopes).length > 0\n ? materializeRuntimeArtifactFile({\n artifactKind: 'nodeWorkers',\n generatedAt,\n modules,\n metadata: artifactMetadata.nodeWorkers,\n scopes: mapRecord(nodeWorkerScopes, materializeRuntimeScope),\n })\n : undefined,\n });\n}\n\nfunction materializeRuntimeArtifactFile(input: {\n artifactKind: ProviderRuntimeArtifactKind;\n generatedAt: string;\n metadata: ProviderRuntimeArtifactMetadata;\n modules: RuntimeProviderModulesArtifact;\n frontendProviderBootstraps?: Record<string, FrontendProvidersBlock>;\n scope?: z.infer<typeof RuntimeProviderScopeArtifactSchema>;\n scopes?: Record<string, z.infer<typeof RuntimeProviderScopeArtifactSchema>>;\n}): SaasRuntimeProvidersArtifact {\n return SaasRuntimeProvidersArtifactSchema.parse({\n __AUTOGENERATED__: PROVIDER_RUNTIME_ARTIFACT_AUTOGENERATED_WARNING,\n generatedBy: PROVIDER_RUNTIME_ARTIFACT_GENERATOR,\n generatedAt: input.generatedAt,\n sourceDigest: input.metadata.sourceDigest,\n providerRefs: input.metadata.providerRefs,\n providerRuntimeImports: input.metadata.providerRuntimeImports,\n systemOfRecordFacetModules: input.metadata.systemOfRecordFacetModules,\n providerGraphDigest: input.metadata.providerGraphDigest,\n lockfileSectionDigest: input.metadata.lockfileSectionDigest,\n artifactKind: input.artifactKind,\n modules: input.modules,\n scope: input.scope,\n scopes: input.scopes,\n frontendProviderBootstraps: input.frontendProviderBootstraps,\n });\n}\n\nfunction materializeRuntimeScope(scope: NonNullable<SaasProvidersScopes['backend']>) {\n return RuntimeProviderScopeArtifactSchema.parse({\n providers: scope.providers,\n selection: scope.selection ?? {},\n });\n}\n\nfunction materializeFrontendProviderBootstraps(input: {\n discoveredContributions: DiscoveredProviderCompanionContribution[];\n frontendServiceScopes: NonNullable<SaasProvidersScopes['frontendServices']>;\n frontendServiceTypes: Record<string, AppFrontendType>;\n providerConfigurations: Readonly<Record<string, Readonly<Record<string, unknown>> | undefined>>;\n}): Record<string, FrontendProvidersBlock> | undefined {\n const { discoveredContributions, frontendServiceScopes, frontendServiceTypes, providerConfigurations } = input;\n const entries = Object.entries(frontendServiceScopes).map(([serviceKey, scope]) => {\n const serviceType = frontendServiceTypes[serviceKey];\n if (!serviceType) {\n throw new Error(\n `Cannot materialize frontend bootstrap for service \"${serviceKey}\": ` +\n `service has no frontendType — only services with a frontendType may appear under providers.scopes.frontendServices.`,\n );\n }\n const providers = Object.fromEntries(Object.keys(scope.providers).map((providerRef) => {\n const matchingContribution = discoveredContributions.filter(\n (contribution) =>\n contribution.ref === providerRef\n && contribution.runtimeTargets.some(\n (target) => target.kind === 'frontendService' && target.serviceType === serviceType,\n ),\n );\n\n if (matchingContribution.length === 0) {\n throw new Error(\n `Cannot materialize frontend bootstrap for service \"${serviceKey}\" (type \"${serviceType}\"): ` +\n `provider \"${providerRef}\" has no discovered frontend companion contribution.`,\n );\n }\n\n if (matchingContribution.some((contribution) => !contribution.frontendEntry)) {\n throw new Error(\n `Cannot materialize frontend bootstrap for service \"${serviceKey}\": ` +\n `provider \"${providerRef}\" is missing frontendEntry on at least one discovered contribution.`,\n );\n }\n\n if (matchingContribution.length > 1) {\n throw new Error(\n `Cannot materialize frontend bootstrap for service \"${serviceKey}\": ` +\n `provider \"${providerRef}\" is contributed more than once for the same runtime.`,\n );\n }\n\n return [\n providerRef,\n applyApplicationPublicConfig({\n serviceKey,\n providerRef,\n entry: matchingContribution[0].frontendEntry as FrontendProviderEntry,\n supplied: providerConfigurations[providerRef]?.[FRONTEND_PROVIDER_PUBLIC_CONFIG_KEY],\n discoveredContributions,\n }),\n ] as const;\n }));\n\n return [serviceKey, FrontendProvidersBlockSchema.parse({ providers })] as const;\n });\n\n return entries.length > 0 ? Object.fromEntries(entries) : undefined;\n}\n\n/**\n * Overlays what the application supplied under `providerConfigurations[ref].frontend_sdk` onto the\n * module's authored `publicConfig` (#394 P3) — the FIRST of the two sites that produce a\n * `FrontendProviderEntry` from a module; the backend fallback is the other, and both call the one\n * function in `saas-models` so they cannot disagree about what crosses.\n *\n * The forbidden set is built from the SAME vendor's non-frontend contributions: a frontend provider\n * owns no secrets (`secretsContractShape: []` by construction), so the only secrets that could be\n * typed into its bag are the backend module's, and those are exactly what this walk has in hand.\n */\nfunction applyApplicationPublicConfig(input: {\n serviceKey: string;\n providerRef: string;\n entry: FrontendProviderEntry;\n supplied: unknown;\n discoveredContributions: DiscoveredProviderCompanionContribution[];\n}): FrontendProviderEntry {\n const { serviceKey, providerRef, entry, supplied, discoveredContributions } = input;\n if (supplied === undefined) return entry;\n\n const forbiddenKeys = new Set(\n discoveredContributions\n .filter((contribution) =>\n contribution.ref === providerRef\n && contribution.runtimeTargets.some((target) => target.kind !== 'frontendService'))\n .flatMap((contribution) => contribution.secretsContractShape.flatMap((slot) => [slot.slug, slot.envVarName])),\n );\n\n try {\n const publicConfig = overlayFrontendProviderPublicConfig({\n providerRef,\n authored: entry.publicConfig,\n supplied,\n declaredKeys: entry.publicConfigKeys,\n forbiddenKeys,\n });\n return publicConfig === undefined ? entry : { ...entry, publicConfig };\n } catch (error) {\n if (error instanceof FrontendProviderPublicConfigError) {\n throw new Error(\n `Cannot materialize frontend bootstrap for service \"${serviceKey}\": ${error.message}`,\n );\n }\n throw error;\n }\n}\n\nfunction buildFrontendProviderBootstrapDigestInput(input: {\n discoveredContributions: DiscoveredProviderCompanionContribution[];\n frontendServiceScopes: NonNullable<SaasProvidersScopes['frontendServices']>;\n frontendServiceTypes: Record<string, AppFrontendType>;\n // In the digest on purpose: an application changing a picker's `appId` changes the served\n // artifact, and a digest that did not move would report the old artifact as current.\n providerConfigurations: Readonly<Record<string, Readonly<Record<string, unknown>> | undefined>>;\n}): Record<string, unknown> | undefined {\n const bootstraps = materializeFrontendProviderBootstraps(input);\n if (!bootstraps) {\n return undefined;\n }\n\n return Object.fromEntries(\n Object.entries(bootstraps).map(([serviceKey, block]) => [\n serviceKey,\n Object.fromEntries(\n Object.entries(block.providers).map(([providerRef, providerEntry]) => [\n providerRef,\n {\n metadata: providerEntry.metadata,\n providerCapabilities: [...providerEntry.providerCapabilities].sort(),\n protocols: [...providerEntry.protocols].sort(),\n publicConfig: providerEntry.publicConfig,\n },\n ]),\n ),\n ]),\n );\n}\n\nfunction materializeModules(\n config: Pick<WildoSaasConfig, 'modules' | 'services'>,\n): RuntimeProviderModulesArtifact {\n const modules = (config.modules ?? {}) as NonNullable<ApplicationModules>;\n return RuntimeProviderModulesArtifactSchema.parse({\n declaredModules: modules,\n moduleIds: getDeclaredApplicationModuleIds(modules),\n moduleIdsByService: Object.fromEntries(\n Object.keys(config.services ?? {}).map((serviceKey) => [\n serviceKey,\n getServiceBoundApplicationModuleIds(modules, serviceKey),\n ]),\n ),\n });\n}\n\nfunction materializeLockRuntimeScopes(input: {\n scopes: SaasProvidersScopes;\n discoveryContext: ProviderRuntimeDiscoveryContext;\n}): SaasLockfileRuntimeScopesProviders {\n const { scopes, discoveryContext } = input;\n return pruneUndefined({\n backend: scopes.backend\n ? materializeLockScope(\n scopes.backend.providers,\n discoveryContext.contributions,\n discoveryContext.backend.matchesRuntimeTarget,\n )\n : undefined,\n companion: scopes.companion\n ? materializeLockScope(\n scopes.companion.providers,\n discoveryContext.contributions,\n discoveryContext.companion.matchesRuntimeTarget,\n )\n : undefined,\n frontendServices: scopes.frontendServices\n ? mapRecord(\n scopes.frontendServices,\n (scope, serviceKey) => materializeLockScope(\n scope.providers,\n discoveryContext.contributions,\n discoveryContext.frontendServices.matchesRuntimeTarget(serviceKey),\n ),\n )\n : undefined,\n minions: scopes.minions\n ? mapRecord(\n scopes.minions,\n (scope, minionKey) => materializeLockScope(\n scope.providers,\n discoveryContext.contributions,\n discoveryContext.minions.matchesRuntimeTarget(minionKey),\n ),\n )\n : undefined,\n workers: scopes.workers\n ? mapRecord(\n scopes.workers,\n (scope, workerKey) => materializeLockScope(\n scope.providers,\n discoveryContext.contributions,\n discoveryContext.workers.matchesRuntimeTarget(workerKey),\n ),\n )\n : undefined,\n });\n}\n\nfunction materializeLockScope(\n providers: Record<string, SaasProviderScopeSelection>,\n discoveredContributions: DiscoveredProviderCompanionContribution[],\n matchesRuntimeTarget: (target: DiscoveredProviderCompanionContribution['runtimeTargets'][number]) => boolean,\n): SaasLockfileRuntimeScopesProviders['backend'] {\n return mapRecord(providers, (selection, ref) => {\n const matchingContributions = findMatchingDiscoveredContributions({\n discoveredContributions,\n matchesRuntimeTarget,\n providerRef: ref,\n });\n const secretsContractShape = resolveProviderSecretsContractShape(ref, matchingContributions);\n\n return {\n ref,\n digest: digestJson({\n selection,\n providerGraph: normalizeDiscoveredContributionsForDigest(matchingContributions),\n }),\n engineCapabilities: selection.engineCapabilities,\n providerCapabilities: selection.providerCapabilities,\n protocols: selection.protocols,\n // assurance-control: WILDO.SECRETS.CONTRACT_INTEGRITY — lock drift\n // covers the values-free provider contract without persisting secret values.\n secretsContractDigest: digestJson({ ref, secretsContractShape }),\n };\n });\n}\n\n/**\n * Resolves one authoritative values-free secret contract for a provider in a\n * concrete runtime scope.\n *\n * Multiple runtime owners may legitimately contribute the same provider, but\n * they must agree on its secret requirements. Missing discovery and divergent\n * shapes fail closed: hashing either state as an empty contract would make the\n * lockfile claim integrity evidence it does not possess.\n */\nfunction resolveProviderSecretsContractShape(\n providerRef: string,\n matchingContributions: DiscoveredProviderCompanionContribution[],\n): DiscoveredProviderCompanionContribution['secretsContractShape'] {\n if (matchingContributions.length === 0) {\n throw new Error(\n `Cannot materialize provider lock entry for \"${providerRef}\": no discovered contribution supplies its secret-contract shape for this runtime.`,\n );\n }\n\n const canonicalShape = matchingContributions[0].secretsContractShape;\n const canonicalDigestInput = stableStringify(canonicalShape);\n for (const contribution of matchingContributions.slice(1)) {\n if (stableStringify(contribution.secretsContractShape) !== canonicalDigestInput) {\n throw new Error(\n `Cannot materialize provider lock entry for \"${providerRef}\": discovered runtime owners disagree on its secret-contract shape.`,\n );\n }\n }\n\n return canonicalShape;\n}\n\nfunction digestJson(value: unknown): string {\n return `sha256:${createHash('sha256').update(stableStringify(value)).digest('hex')}`;\n}\n\nfunction stableStringify(value: unknown): string {\n if (Array.isArray(value)) {\n return `[${value.map(stableStringify).join(',')}]`;\n }\n if (value && typeof value === 'object') {\n const record = value as Record<string, unknown>;\n return `{${Object.keys(record)\n .sort()\n .map((key) => `${JSON.stringify(key)}:${stableStringify(record[key])}`)\n .join(',')}}`;\n }\n return JSON.stringify(value);\n}\n\nfunction mapRecord<TValue, TResult>(\n record: Record<string, TValue>,\n mapper: (value: TValue, key: string) => TResult,\n): Record<string, TResult> {\n return Object.fromEntries(\n Object.entries(record).map(([key, value]) => [key, mapper(value, key)]),\n );\n}\n\nfunction pruneUndefined<T extends Record<string, unknown>>(record: T): T {\n return Object.fromEntries(\n Object.entries(record).filter(([, value]) => value !== undefined),\n ) as T;\n}\n\ninterface ProviderRuntimeArtifactMetadata {\n sourceDigest: string;\n providerRefs: string[];\n providerRuntimeImports: Record<string, string>;\n systemOfRecordFacetModules: string[];\n providerGraphDigest: string;\n lockfileSectionDigest: string;\n}\n\ninterface ProviderRuntimeArtifactMetadataByKind {\n backend: ProviderRuntimeArtifactMetadata;\n companion: ProviderRuntimeArtifactMetadata;\n frontendServices: ProviderRuntimeArtifactMetadata;\n minions: ProviderRuntimeArtifactMetadata;\n nodeWorkers: ProviderRuntimeArtifactMetadata;\n}\n\ninterface RuntimeContributionMatcherFactory {\n matchesRuntimeTarget: (target: DiscoveredProviderCompanionContribution['runtimeTargets'][number]) => boolean;\n}\n\ninterface ScopedRuntimeContributionMatcherFactory {\n matchesRuntimeTarget: (\n scopeKey: string,\n ) => (target: DiscoveredProviderCompanionContribution['runtimeTargets'][number]) => boolean;\n}\n\ninterface ProviderRuntimeDiscoveryContext {\n contributions: DiscoveredProviderCompanionContribution[];\n backend: RuntimeContributionMatcherFactory;\n companion: RuntimeContributionMatcherFactory;\n frontendServices: ScopedRuntimeContributionMatcherFactory;\n minions: ScopedRuntimeContributionMatcherFactory;\n workers: ScopedRuntimeContributionMatcherFactory;\n}\n\nfunction buildProviderRuntimeDiscoveryContext(input: {\n discoveredContributions?: DiscoveredProviderCompanionContribution[];\n frontendServiceTypes: Record<string, AppFrontendType>;\n}): ProviderRuntimeDiscoveryContext {\n const contributions = input.discoveredContributions ?? [];\n const { frontendServiceTypes } = input;\n\n return {\n contributions,\n backend: {\n matchesRuntimeTarget: (target) => target.kind === 'backend',\n },\n companion: {\n matchesRuntimeTarget: (target) => target.kind === 'companion',\n },\n frontendServices: {\n matchesRuntimeTarget: (serviceKey) => {\n const serviceType = frontendServiceTypes[serviceKey];\n // Service has no frontendType ⇒ no contribution can match it.\n if (!serviceType) return () => false;\n return (target) => target.kind === 'frontendService' && target.serviceType === serviceType;\n },\n },\n minions: {\n matchesRuntimeTarget: (minionKey) => (target) => target.kind === 'minion' && target.minionKey === minionKey,\n },\n workers: {\n matchesRuntimeTarget: (workerKey) => (target) => target.kind === 'worker' && target.workerKey === workerKey,\n },\n };\n}\n\nfunction buildArtifactMetadata(input: {\n frontendServiceNames: Record<string, string>;\n discoveryContext: ProviderRuntimeDiscoveryContext;\n frontendServiceTypes: Record<string, AppFrontendType>;\n lockSection: SaasLockfileProvidersSection;\n modules: RuntimeProviderModulesArtifact;\n nodeWorkerKeys?: string[];\n scopes: SaasProvidersScopes;\n providerConfigurations: Readonly<Record<string, Readonly<Record<string, unknown>> | undefined>>;\n}): ProviderRuntimeArtifactMetadataByKind {\n const { discoveryContext, frontendServiceTypes, lockSection, modules, nodeWorkerKeys, scopes, providerConfigurations } = input;\n /*\n * Computed ONCE for every artifact kind, because a vendor facet is not scoped to a runtime the way\n * a provider is: it says what a vendor NEEDS, which does not change between a backend and a\n * minion. Only the backend reads it today (#1055 D2 gives the instance environment to that runtime\n * alone), and recording it everywhere is what keeps that a policy of the RUNTIME rather than a\n * property of the artifact.\n */\n const systemOfRecordFacetModules = discoverSystemOfRecordFacetModules(discoveryContext.contributions);\n const nodeWorkerKeySet = nodeWorkerKeys ? new Set(nodeWorkerKeys) : undefined;\n\n return {\n backend: buildSingleScopeArtifactMetadata({\n systemOfRecordFacetModules,\n modules,\n providers: scopes.backend?.providers ?? {},\n matchingContributions: findMatchingDiscoveredContributions({\n discoveredContributions: discoveryContext.contributions,\n matchesRuntimeTarget: discoveryContext.backend.matchesRuntimeTarget,\n }),\n extraArtifactState: {\n frontendServiceNames: input.frontendServiceNames,\n bootstraps: buildFrontendProviderBootstrapDigestInput({\n discoveredContributions: discoveryContext.contributions,\n frontendServiceScopes: scopes.frontendServices ?? {},\n frontendServiceTypes,\n providerConfigurations,\n }),\n },\n runtimeLockSection: lockSection.runtimeScopes.backend ?? {},\n scopes,\n }),\n companion: buildSingleScopeArtifactMetadata({\n systemOfRecordFacetModules,\n modules,\n providers: scopes.companion?.providers ?? {},\n matchingContributions: findMatchingDiscoveredContributions({\n discoveredContributions: discoveryContext.contributions,\n matchesRuntimeTarget: discoveryContext.companion.matchesRuntimeTarget,\n }),\n runtimeLockSection: lockSection.runtimeScopes.companion ?? {},\n scopes,\n }),\n frontendServices: buildMultiScopeArtifactMetadata({\n systemOfRecordFacetModules,\n keyedProviders: Object.fromEntries(\n Object.entries(scopes.frontendServices ?? {}).map(([scopeKey, scope]) => [scopeKey, scope.providers]),\n ),\n matchingContributionsByScope: Object.fromEntries(\n Object.keys(scopes.frontendServices ?? {}).map((scopeKey) => [\n scopeKey,\n findMatchingDiscoveredContributions({\n discoveredContributions: discoveryContext.contributions,\n matchesRuntimeTarget: discoveryContext.frontendServices.matchesRuntimeTarget(scopeKey),\n }),\n ]),\n ),\n modules,\n extraArtifactState: buildFrontendProviderBootstrapDigestInput({\n discoveredContributions: discoveryContext.contributions,\n frontendServiceScopes: scopes.frontendServices ?? {},\n frontendServiceTypes,\n providerConfigurations,\n }),\n runtimeLockSection: lockSection.runtimeScopes.frontendServices ?? {},\n scopes,\n }),\n minions: buildMultiScopeArtifactMetadata({\n systemOfRecordFacetModules,\n keyedProviders: Object.fromEntries(\n Object.entries(scopes.minions ?? {}).map(([scopeKey, scope]) => [scopeKey, scope.providers]),\n ),\n matchingContributionsByScope: Object.fromEntries(\n Object.keys(scopes.minions ?? {}).map((scopeKey) => [\n scopeKey,\n findMatchingDiscoveredContributions({\n discoveredContributions: discoveryContext.contributions,\n matchesRuntimeTarget: discoveryContext.minions.matchesRuntimeTarget(scopeKey),\n }),\n ]),\n ),\n modules,\n runtimeLockSection: lockSection.runtimeScopes.minions ?? {},\n scopes,\n }),\n nodeWorkers: buildMultiScopeArtifactMetadata({\n systemOfRecordFacetModules,\n keyedProviders: Object.fromEntries(\n Object.entries(scopes.workers ?? {})\n .filter(([scopeKey]) => nodeWorkerKeySet ? nodeWorkerKeySet.has(scopeKey) : true)\n .map(([scopeKey, scope]) => [scopeKey, scope.providers]),\n ),\n matchingContributionsByScope: Object.fromEntries(\n Object.keys(scopes.workers ?? {})\n .filter((scopeKey) => nodeWorkerKeySet ? nodeWorkerKeySet.has(scopeKey) : true)\n .map((scopeKey) => [\n scopeKey,\n findMatchingDiscoveredContributions({\n discoveredContributions: discoveryContext.contributions,\n matchesRuntimeTarget: discoveryContext.workers.matchesRuntimeTarget(scopeKey),\n }),\n ]),\n ),\n modules,\n runtimeLockSection: Object.fromEntries(\n Object.entries(lockSection.runtimeScopes.workers ?? {})\n .filter(([scopeKey]) => nodeWorkerKeySet ? nodeWorkerKeySet.has(scopeKey) : true),\n ),\n scopes,\n }),\n };\n}\n\nfunction buildSingleScopeArtifactMetadata(input: {\n systemOfRecordFacetModules: string[];\n matchingContributions: DiscoveredProviderCompanionContribution[];\n modules: RuntimeProviderModulesArtifact;\n providers: Record<string, SaasProviderScopeSelection>;\n extraArtifactState?: Record<string, unknown>;\n runtimeLockSection: Record<string, unknown>;\n scopes: SaasProvidersScopes;\n}): ProviderRuntimeArtifactMetadata {\n const providerRefs = Object.keys(input.providers).sort();\n const normalizedContributions = normalizeDiscoveredContributionsForDigest(input.matchingContributions);\n const providerGraphDigestInput = input.extraArtifactState\n ? {\n providerGraph: normalizedContributions,\n extraArtifactState: input.extraArtifactState,\n }\n : normalizedContributions;\n\n return {\n sourceDigest: digestJson({\n modules: input.modules,\n providers: input.providers,\n providerGraph: normalizedContributions,\n scopes: input.scopes,\n extraArtifactState: input.extraArtifactState,\n }),\n providerRefs,\n providerRuntimeImports: buildProviderRuntimeImports(providerRefs, input.matchingContributions),\n systemOfRecordFacetModules: input.systemOfRecordFacetModules,\n providerGraphDigest: digestJson(providerGraphDigestInput),\n lockfileSectionDigest: digestJson(input.runtimeLockSection),\n };\n}\n\nfunction buildMultiScopeArtifactMetadata(input: {\n systemOfRecordFacetModules: string[];\n keyedProviders: Record<string, Record<string, SaasProviderScopeSelection>>;\n matchingContributionsByScope: Record<string, DiscoveredProviderCompanionContribution[]>;\n modules: RuntimeProviderModulesArtifact;\n extraArtifactState?: Record<string, unknown>;\n runtimeLockSection: Record<string, unknown>;\n scopes: SaasProvidersScopes;\n}): ProviderRuntimeArtifactMetadata {\n const providerRefs = [...new Set(\n Object.values(input.keyedProviders).flatMap((providers) => Object.keys(providers)),\n )].sort();\n const normalizedContributionsByScope = Object.fromEntries(\n Object.entries(input.matchingContributionsByScope).map(([scopeKey, contributions]) => [\n scopeKey,\n normalizeDiscoveredContributionsForDigest(contributions),\n ]),\n );\n\n const providerGraphDigestInput = input.extraArtifactState\n ? {\n providerGraphByScope: normalizedContributionsByScope,\n extraArtifactState: input.extraArtifactState,\n }\n : normalizedContributionsByScope;\n\n return {\n sourceDigest: digestJson({\n keyedProviders: input.keyedProviders,\n modules: input.modules,\n providerGraphByScope: normalizedContributionsByScope,\n scopes: input.scopes,\n extraArtifactState: input.extraArtifactState,\n }),\n providerRefs,\n providerRuntimeImports: buildProviderRuntimeImports(\n providerRefs,\n Object.values(input.matchingContributionsByScope).flat(),\n ),\n systemOfRecordFacetModules: input.systemOfRecordFacetModules,\n providerGraphDigest: digestJson(providerGraphDigestInput),\n lockfileSectionDigest: digestJson(input.runtimeLockSection),\n };\n}\n\n/**\n * Which packages ship SYSTEM-OF-RECORD VENDOR FACETS (#1057).\n *\n * ## Read from the MANIFEST, never by loading\n *\n * A package contributes facets by declaring an `./systems-of-record` export — the same door\n * `./companion` is found through, and the same reason: a build-time consumer has no business\n * EVALUATING a vendor facet to learn that one exists. Loading would also make the discovery depend\n * on the package compiling, which is a different question from whether it declares the surface.\n *\n * ## Derived from the contribution walk rather than from a second walk\n *\n * Every candidate package root is already visited to load its companion exports, so the facet\n * question is answered from what that walk found. The consequence, stated because it is a real\n * bound: a package that ships facets and NO provider contributions is not discovered, because\n * nothing would have visited it. That package does not exist today (the catalogue ships 651\n * contributions), and the day one does, this function needs the walk's targets rather than its\n * results — which is a change here and nowhere else.\n *\n * Sorted, so the artifact does not churn on filesystem order, and de-duplicated because one package\n * root contributes hundreds of providers and exactly one facet module.\n */\nfunction discoverSystemOfRecordFacetModules(\n contributions: readonly DiscoveredProviderCompanionContribution[],\n): string[] {\n const specifiers = new Set<string>();\n const visitedRoots = new Set<string>();\n\n for (const contribution of contributions) {\n const packageRoot = contribution.owner?.packageRoot;\n if (packageRoot === undefined || visitedRoots.has(packageRoot)) continue;\n visitedRoots.add(packageRoot);\n\n let manifest: { name?: string; exports?: Record<string, unknown> };\n try {\n manifest = JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf-8')) as typeof manifest;\n } catch {\n // Unreadable or absent: the companion walk already tolerates that, and a package we could not\n // read is not one we can say anything about.\n continue;\n }\n\n if (manifest.exports?.[SYSTEM_OF_RECORD_FACET_SUBPATH] === undefined) continue;\n if (typeof manifest.name !== 'string' || manifest.name.length === 0) continue;\n specifiers.add(`${manifest.name}${SYSTEM_OF_RECORD_FACET_SUBPATH.slice(1)}`);\n }\n\n return [...specifiers].sort();\n}\n\n/** The export a package declares to contribute system-of-record vendor facets. */\nconst SYSTEM_OF_RECORD_FACET_SUBPATH = './systems-of-record';\n\n/**\n * Project the per-ref runtime import path a host dynamic-imports.\n *\n * Only refs actually in scope are recorded, so a per-host artifact never advertises a sibling's\n * packages. A ref no contribution covers is simply absent: the host then resolves it from the\n * engine's on-demand map, and the single fail-loud refusal in the backend registry names it if that\n * map does not hold it either.\n *\n * When several contributions claim one ref with DIFFERENT import paths, the sorted-first path wins\n * — deterministically, so the artifact does not churn. Divergence is possible today only between an\n * application's hand-authored engine projection (`@wildo-ai/saas-backend-lib`) and the engine's own\n * companion export, and neither is consulted for an engine-shipped ref, so the choice cannot change\n * which module a host loads. A package provider is contributed by exactly one package.\n */\nfunction buildProviderRuntimeImports(\n providerRefs: string[],\n contributions: DiscoveredProviderCompanionContribution[],\n): Record<string, string> {\n const inScope = new Set(providerRefs);\n const candidatesByRef = new Map<string, Set<string>>();\n\n for (const contribution of contributions) {\n if (!inScope.has(contribution.ref)) {\n continue;\n }\n const candidates = candidatesByRef.get(contribution.ref) ?? new Set<string>();\n candidates.add(contribution.runtimeImportPath);\n candidatesByRef.set(contribution.ref, candidates);\n }\n\n return Object.fromEntries(\n [...candidatesByRef.entries()]\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([ref, candidates]) => [ref, [...candidates].sort()[0]]),\n );\n}\n\nfunction findMatchingDiscoveredContributions(input: {\n discoveredContributions: DiscoveredProviderCompanionContribution[];\n matchesRuntimeTarget: (target: DiscoveredProviderCompanionContribution['runtimeTargets'][number]) => boolean;\n providerRef?: string;\n}): DiscoveredProviderCompanionContribution[] {\n return input.discoveredContributions.flatMap((contribution) => {\n if (input.providerRef && contribution.ref !== input.providerRef) {\n return [];\n }\n const runtimeTargets = contribution.runtimeTargets.filter(input.matchesRuntimeTarget);\n if (runtimeTargets.length === 0) {\n return [];\n }\n return [{ ...contribution, runtimeTargets }];\n });\n}\n\n/**\n * The portion of a contribution's `owner` that may enter a digest.\n *\n * **`packageRoot` is deliberately excluded, and this is the whole point of the\n * function.** Discovery builds it as `resolve(saasRoot, definition.path)` — an\n * ABSOLUTE filesystem path — so hashing it makes every value derived from this\n * normalizer a property of WHERE THE REPOSITORY HAPPENS TO BE CHECKED OUT\n * rather than of the provider graph.\n *\n * That is not a theoretical concern; it was measured on 2026-08-30. The same\n * Wonder Todos tree, materialized from its real directory and from a symlink to\n * it, produced two different lock digests for every provider in every scope\n * (`sha256:f7eeb2d6…` vs `sha256:d933b95a…` for backend `anthropic`), and a dump\n * of the two contribution sets differed in `owner.packageRoot` and nothing else.\n * The consequences were both real:\n *\n * - `examples/wonder-todos/.wildo-saas/wildo-saas.lock.json` carried 22 digests\n * scoped to whichever checkout last ran `wildo config sync`, so the\n * `Lockfile Drift Check` gate — which runs at `/home/runner/work/…` — could\n * never have agreed with a committed value regardless of actual drift.\n * - The same input feeds `sourceDigest` / `providerGraphDigest` in the generated\n * runtime artifacts and `.wildo-providers.env`, so artifacts generated on a\n * developer's machine and re-materialized under a container's `/app` would\n * trip the `digest-mismatch` runtime diagnostic while describing an identical\n * provider graph.\n *\n * `kind` + `key` already identify an owner uniquely (both are record keys within\n * their config block), so nothing distinguishing is lost. What IS given up is\n * that relocating an owner package without changing its contribution content no\n * longer moves the digest — accepted deliberately: a repository-layout change is\n * not a provider-contract change, and if that signal is ever wanted it must\n * arrive as a saas-root-RELATIVE path, never an absolute one.\n */\nfunction projectOwnerForDigest(\n owner: DiscoveredProviderCompanionContribution['owner'],\n): { kind: string; key: string } {\n return { kind: owner.kind, key: owner.key };\n}\n\nfunction normalizeDiscoveredContributionsForDigest(\n contributions: DiscoveredProviderCompanionContribution[],\n): Array<Record<string, unknown>> {\n return [...contributions]\n .sort((left, right) => stableStringify({\n leftOwner: projectOwnerForDigest(left.owner),\n leftRef: left.ref,\n leftRuntimeImportPath: left.runtimeImportPath,\n leftSourceModuleId: left.sourceModuleId,\n leftTargets: left.runtimeTargets,\n }).localeCompare(stableStringify({\n rightOwner: projectOwnerForDigest(right.owner),\n rightRef: right.ref,\n rightRuntimeImportPath: right.runtimeImportPath,\n rightSourceModuleId: right.sourceModuleId,\n rightTargets: right.runtimeTargets,\n })))\n .map((contribution) => ({\n ref: contribution.ref,\n owner: projectOwnerForDigest(contribution.owner),\n runtimeImportPath: contribution.runtimeImportPath,\n runtimeTargets: contribution.runtimeTargets,\n engineCapabilities: [...contribution.engineCapabilities].sort(),\n providerCapabilities: [...contribution.providerCapabilities].sort(),\n protocols: [...contribution.protocols].sort(),\n secretsContractShape: contribution.secretsContractShape,\n frontendEntry: contribution.frontendEntry\n ? {\n metadata: contribution.frontendEntry.metadata,\n providerCapabilities: [...contribution.frontendEntry.providerCapabilities].sort(),\n protocols: [...contribution.frontendEntry.protocols].sort(),\n publicConfig: contribution.frontendEntry.publicConfig,\n }\n : undefined,\n sourceModuleId: contribution.sourceModuleId,\n }));\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-creation-verification.schemas.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"application-creation-verification.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/application-creation-verification.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,eAAO,MAAM,2CAA2C;IACtD,0EAA0E;;IAU1E,iFAAiF;;kBAEjF,CAAC;AAEH,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2CAA2C,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-modules.schemas.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"application-modules.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/application-modules.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,8BAA8B;;;iBAOzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,eAAO,MAAM,wBAAwB;;;mBAGzB,CAAC;AACb,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,iEAAiE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-modules.utils.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"application-modules.utils.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/application-modules.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AA4BxE,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,kBAAkB,GAAG,SAAS,GACtC,MAAM,EAAE,CAEV;AAED,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,kBAAkB,GAAG,SAAS,EACvC,UAAU,EAAE,MAAM,GACjB,MAAM,EAAE,CAEV;AAED,wBAAgB,wCAAwC,CACtD,OAAO,EAAE,kBAAkB,GAAG,SAAS,EACvC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,GAC7B,OAAO,CAOT;AAED,wBAAgB,iCAAiC,CAAC,CAAC,EACjD,OAAO,EAAE,kBAAkB,GAAG,SAAS,EACvC,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EACtC,aAAa,EAAE,MAAM,GACpB,CAAC,EAAE,CAML;AAED,wBAAgB,qCAAqC,CAAC,CAAC,EACrD,OAAO,EAAE,kBAAkB,GAAG,SAAS,EACvC,UAAU,EAAE,MAAM,EAClB,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EACtC,aAAa,SAA4B,GACxC,CAAC,EAAE,CAML"}
|
|
@@ -10,9 +10,9 @@ import { z } from 'zod';
|
|
|
10
10
|
* refreshTokenExpirationDays}`. The runtime backend reads them at
|
|
11
11
|
* token-sign time (`auth-token-issuer.backend.service.ts`,
|
|
12
12
|
* `jwt.backend.service.ts`).
|
|
13
|
-
* -
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* - First registration uses the schema defaults when `serviceAuth` is absent. Ordinary
|
|
14
|
+
* re-registration preserves the stored policy when the whole block is omitted. A present
|
|
15
|
+
* block resolves omitted members through these defaults and reconciles both lifetimes.
|
|
16
16
|
*
|
|
17
17
|
* Default tightening (Auth-hardening Slice A Step 5, 2026-04-13):
|
|
18
18
|
* - `accessTokenExpirationMinutes` default was lowered from 60 \u2192 15 in
|
|
@@ -35,39 +35,18 @@ import { z } from 'zod';
|
|
|
35
35
|
* `platform-services-to-manager.apps-manager.platform.controller.ts`).
|
|
36
36
|
* Authoring an algorithm here would add a knob with no honest consumer.
|
|
37
37
|
*
|
|
38
|
-
*
|
|
39
|
-
* - The CLI forwards
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* -
|
|
46
|
-
*
|
|
38
|
+
* Publication lifecycle:
|
|
39
|
+
* - The CLI forwards `env.serviceAuth` through the admin initialization request. Existing
|
|
40
|
+
* applications reconcile an explicitly supplied policy even when no other settings changed;
|
|
41
|
+
* no broad initialization override is required for a token-lifetime-only change.
|
|
42
|
+
* - Ordinary initialization with an omitted block preserves existing lifetimes, including
|
|
43
|
+
* incidental public-key/database repairs. Explicit `override:true` retains its wider reset
|
|
44
|
+
* semantics: absent `serviceAuth` resets lifetimes to the schema defaults below.
|
|
45
|
+
* - Applications retrieve the persisted policy at startup. Running processes do not receive
|
|
46
|
+
* live policy updates, and existing tokens retain the expiration already encoded in them.
|
|
47
47
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* `_merge_WildoApplicationConfig(currentConfig=null, newConfig={})`,
|
|
51
|
-
* which reduces to "return the freshly-built `defaultConfig`". The
|
|
52
|
-
* `defaultConfig` is seeded by `_getDefault_WildoApplicationConfig`
|
|
53
|
-
* with `WildoAuthConfigSchema.parse(serviceAuth ?? {})`. So when an
|
|
54
|
-
* older CLI or a direct HTTP caller omits `serviceAuth` AND passes
|
|
55
|
-
* `override:true`, the persisted TTLs are RESET to the schema
|
|
56
|
-
* defaults below (60 min / 30 days) \u2014 they are NOT preserved. The
|
|
57
|
-
* only path that preserves the persisted TTLs is `override:false`,
|
|
58
|
-
* where the upstream guard at
|
|
59
|
-
* `wildo-application-lifecycle.apps-manager.platform.service.ts:~869`
|
|
60
|
-
* skips the `repository.update` call entirely.
|
|
61
|
-
* - Caveat: that upstream guard ALSO triggers `repository.update` on
|
|
62
|
-
* `needsPublicKeyUpdate` and `needsDatabaseConfigUpdate` (e.g. JWT
|
|
63
|
-
* key rotation, k8s host hydration). When either bypass fires with
|
|
64
|
-
* `override:false` AND `serviceAuth` omitted, the persisted TTLs
|
|
65
|
-
* silently rebind to the schema defaults too. See the JSDoc on
|
|
66
|
-
* `_merge_WildoApplicationConfig` for the full enumeration.
|
|
67
|
-
*
|
|
68
|
-
* Pinned by `wildo-application-lifecycle.defaults.test.ts` (production
|
|
69
|
-
* shape: `(null, {})` + omitted `serviceAuth` returns 15/30 from
|
|
70
|
-
* `WildoAuthConfigSchema.parse({})`).
|
|
48
|
+
* Pinned by `managed-token-policy-convergence.apps-manager.platform.test.ts` and the lifecycle
|
|
49
|
+
* default derivation tests; the former exercises persistence and the bootstrap consumer offline.
|
|
71
50
|
*/
|
|
72
51
|
/**
|
|
73
52
|
* `z.strictObject` (Zod 4) is intentional: any unknown key (e.g. a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.schemas.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"auth.schemas.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/auth.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB;IAChC;;;;;;;;;OASG;;IAEH;;;;;;OAMG;;kBAEH,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|